Skip to content

Commit

Permalink
Corrected types
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jul 7, 2024
1 parent 39122df commit 648438f
Show file tree
Hide file tree
Showing 19 changed files with 133 additions and 118 deletions.
14 changes: 7 additions & 7 deletions packages/iobroker.vis-2/src/src/Attributes/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
type LegacyConnection,
} from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import type { VisTheme } from '@iobroker/types-vis-2';
import commonStyles from '@/Utils/styles';
import CSS from './CSS';
Expand Down Expand Up @@ -49,20 +49,20 @@ interface AttributesProps {
adapterName: string;
instance: number;
projectName: string;
saveCssFile: EditorClass['saveCssFile'];
saveCssFile: Editor['saveCssFile'];
editMode: boolean;
onHide: (hide: boolean) => void;
adapterId: string;
userGroups: EditorClass['state']['userGroups'];
userGroups: Editor['state']['userGroups'];
selectedWidgets: string[];
widgetsLoaded: boolean;
selectedView: string;
changeProject: EditorClass['changeProject'];
changeProject: Editor['changeProject'];
socket: LegacyConnection;
fonts: string[];
cssClone: EditorClass['cssClone'];
onPxToPercent: EditorClass['onPxToPercent'];
onPercentToPx: EditorClass['onPercentToPx'];
cssClone: Editor['cssClone'];
onPxToPercent: Editor['onPxToPercent'];
onPercentToPx: Editor['onPercentToPx'];
theme: VisTheme;
}

Expand Down
6 changes: 2 additions & 4 deletions packages/iobroker.vis-2/src/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ const styles: Record<string, any> = {

interface ViewDropProps {
// eslint-disable-next-line no-use-before-define
addMarketplaceWidget: EditorClass['addMarketplaceWidget'];
addMarketplaceWidget: Editor['addMarketplaceWidget'];
// eslint-disable-next-line no-use-before-define
addWidget: EditorClass['addWidget'];
addWidget: Editor['addWidget'];
editMode: boolean;
children: React.JSX.Element;
}
Expand Down Expand Up @@ -2211,6 +2211,4 @@ class Editor extends Runtime<EditorProps, EditorState> {
}
}

export type EditorClass = Editor;

export default Editor;
12 changes: 6 additions & 6 deletions packages/iobroker.vis-2/src/src/Palette/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import type { WidgetType } from '@/Vis/visWidgetsCatalog';
import { getWidgetTypes } from '@/Vis/visWidgetsCatalog';
import { loadComponent } from '@/Vis/visLoadWidgets';
import commonStyles from '@/Utils/styles';
import type { EditorClass } from '../Editor';
import type Editor from '../Editor';
import Widget from './Widget';
import MarketplacePalette from '../Marketplace/MarketplacePalette';

Expand Down Expand Up @@ -144,11 +144,11 @@ interface WidgetSetProps {

interface PaletteProps {
onHide: (hide: boolean) => void;
changeView: EditorClass['changeView'];
changeProject: EditorClass['changeProject'];
uninstallWidget: EditorClass['uninstallWidget'];
setMarketplaceDialog: EditorClass['setMarketplaceDialog'];
updateWidgets: EditorClass['updateWidgets'];
changeView: Editor['changeView'];
changeProject: Editor['changeProject'];
uninstallWidget: Editor['uninstallWidget'];
setMarketplaceDialog: Editor['setMarketplaceDialog'];
updateWidgets: Editor['updateWidgets'];
widgetsLoaded: boolean;
socket: LegacyConnection;
themeType: ThemeType;
Expand Down
6 changes: 4 additions & 2 deletions packages/iobroker.vis-2/src/src/Runtime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,9 @@ export interface RuntimeState extends GenericAppState {

declare global {
interface Window {
sentryDSN: string;
disableDataReporting: boolean;
sentryDSN?: string;
disableDataReporting?: boolean;
visAdapterInstance?: number;
}
}

Expand Down Expand Up @@ -261,6 +262,7 @@ class Runtime<P extends RuntimeProps = RuntimeProps, S extends RuntimeState = Ru
registerWidgetsLoadIndicator(this.setWidgetsLoadingProgress);
}

// eslint-disable-next-line class-methods-use-this
createTheme(name?: ThemeName | null | undefined): VisTheme {
return createTheme(Utils.getThemeName(name));
}
Expand Down
18 changes: 9 additions & 9 deletions packages/iobroker.vis-2/src/src/Toolbar/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,27 @@ import {
} from '@iobroker/adapter-react-v5';

import type { VisTheme } from '@iobroker/types-vis-2';
import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import type { ToolbarItem } from './ToolbarItems';
import ToolbarItems from './ToolbarItems';
import Settings from './Settings';
import ProjectsManager from './ProjectsManager';

interface ToolsProps {
adapterName: string;
addProject: EditorClass['addProject'];
changeProject: EditorClass['changeProject'];
deleteProject: EditorClass['deleteProject'];
addProject: Editor['addProject'];
changeProject: Editor['changeProject'];
deleteProject: Editor['deleteProject'];
instance: number;
loadProject: EditorClass['loadProject'];
loadProject: Editor['loadProject'];
projectName: string;
projects: string[];
projectsDialog: boolean;
refreshProjects: EditorClass['refreshProjects'];
renameProject: EditorClass['renameProject'];
refreshProjects: Editor['refreshProjects'];
renameProject: Editor['renameProject'];
selectedView: string;
setProjectsDialog: EditorClass['setProjectsDialog'];
setSelectedWidgets: EditorClass['setSelectedWidgets'];
setProjectsDialog: Editor['setProjectsDialog'];
setSelectedWidgets: Editor['setSelectedWidgets'];
socket: LegacyConnection;
theme: VisTheme;
themeType: ThemeType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
type ThemeType, type LegacyConnection,
} from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import UploadFile from '../../Components/UploadFile';
import IODialog from '../../Components/IODialog';

Expand All @@ -33,10 +33,10 @@ export const getLiveHost = async (socket: LegacyConnection) => {
interface ImportProjectDialogProps {
onClose: (isYes?: boolean, projectName?: string) => void;
projectName: string;
refreshProjects: EditorClass['refreshProjects'];
refreshProjects: Editor['refreshProjects'];
socket: LegacyConnection;
themeType: ThemeType;
loadProject: EditorClass['loadProject'];
loadProject: Editor['loadProject'];
adapterName: string;
instance: number;
openNewProjectOnCreate?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { BiImport, BiExport } from 'react-icons/bi';

import { I18n, type ThemeType, type LegacyConnection } from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import type { VisTheme } from '@iobroker/types-vis-2';
import commonStyles from '@/Utils/styles';
import IODialog from '../../Components/IODialog';
Expand Down Expand Up @@ -62,22 +62,22 @@ const styles: Record<string, React.CSSProperties> = {
};

interface ProjectsManageProps {
addProject: EditorClass['addProject'];
loadProject: EditorClass['loadProject'];
addProject: Editor['addProject'];
loadProject: Editor['loadProject'];
onClose: () => void;
open: boolean;
projects: string[];
projectName: string;
refreshProjects: EditorClass['refreshProjects'];
refreshProjects: Editor['refreshProjects'];
socket: LegacyConnection;
themeType: ThemeType;
theme: VisTheme;
adapterName: string;
instance: number;
selectedView: string;
changeProject: EditorClass['changeProject'];
deleteProject: EditorClass['deleteProject'];
renameProject: EditorClass['renameProject'];
changeProject: Editor['changeProject'];
deleteProject: Editor['deleteProject'];
renameProject: Editor['renameProject'];
}

const ProjectsManage: React.FC<ProjectsManageProps> = props => {
Expand Down
4 changes: 2 additions & 2 deletions packages/iobroker.vis-2/src/src/Toolbar/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Save as SaveIcon } from '@mui/icons-material';
import type { LegacyConnection } from '@iobroker/adapter-react-v5';
import { I18n } from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import { store } from '@/Store';
import { deepClone } from '@/Utils/utils';
import type { ProjectSettings } from '@iobroker/types-vis-2';
Expand Down Expand Up @@ -67,7 +67,7 @@ interface SettingsFieldNumber extends SettingsFieldBase {
type SettingsField = SettingsFieldSelect | SettingsFieldRaw | SettingsFieldCheckbox | SettingsFieldSwitchMode | SettingsFieldNumber;

interface SettingsProps {
changeProject: EditorClass['changeProject'];
changeProject: Editor['changeProject'];
onClose: () => void;
socket: LegacyConnection;
adapterName: string;
Expand Down
6 changes: 3 additions & 3 deletions packages/iobroker.vis-2/src/src/Toolbar/ToolbarItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { I18n, type ThemeType } from '@iobroker/adapter-react-v5';
import { deepClone } from '@/Utils/utils';
import type { ViewSettings, VisTheme } from '@iobroker/types-vis-2';
import { store } from '@/Store';
import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import commonStyles from '@/Utils/styles';
import MultiSelect from './MultiSelect';

Expand Down Expand Up @@ -130,11 +130,11 @@ interface ToolbarItemsProps {
last?: boolean;
toolbarHeight: 'full' | 'narrow' | 'veryNarrow';
// eslint-disable-next-line react/no-unused-prop-types
changeProject: EditorClass['changeProject'];
changeProject: Editor['changeProject'];
// eslint-disable-next-line react/no-unused-prop-types
selectedView: string;
// eslint-disable-next-line react/no-unused-prop-types
setSelectedWidgets: EditorClass['setSelectedWidgets'];
setSelectedWidgets: Editor['setSelectedWidgets'];
}

// eslint-disable-next-line no-use-before-define
Expand Down
14 changes: 7 additions & 7 deletions packages/iobroker.vis-2/src/src/Toolbar/Views.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import type { ThemeName, ThemeType } from '@iobroker/adapter-react-v5';
import { I18n } from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import type { VisTheme } from '@iobroker/types-vis-2';
import commonStyles from '@/Utils/styles';
import ViewsManager from './ViewsManager';
Expand All @@ -40,19 +40,19 @@ const styles: Record<string, React.CSSProperties> = {
interface ViewsProps {
projectName: string;
selectedView: string;
setViewsManager: EditorClass['setViewsManager'];
setViewsManager: Editor['setViewsManager'];
viewsManager: boolean;
selectedGroup: string;
editMode: boolean;
setProjectsDialog: EditorClass['setProjectsDialog'];
changeProject: EditorClass['changeProject'];
setProjectsDialog: Editor['setProjectsDialog'];
changeProject: Editor['changeProject'];
theme: VisTheme;
changeView: EditorClass['changeView'];
setSelectedWidgets: EditorClass['setSelectedWidgets'];
changeView: Editor['changeView'];
setSelectedWidgets: Editor['setSelectedWidgets'];
themeType: ThemeType;
toolbarHeight: 'full' | 'narrow' | 'veryNarrow';
themeName: ThemeName;
toggleView: EditorClass['toggleView'];
toggleView: Editor['toggleView'];
}

const Views = (props: ViewsProps) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import DeleteIcon from '@mui/icons-material/Delete';

import { I18n } from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import React from 'react';
import { deepClone } from '@/Utils/utils';
import IODialog from '../../Components/IODialog';
import { useFocus } from '../../Utils';
import { store } from '../../Store';

interface FolderDialogProps {
changeProject: EditorClass['changeProject'];
changeProject: Editor['changeProject'];
dialog: 'add' | 'rename' | 'delete';
dialogFolder: string;
dialogName: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { BiImport } from 'react-icons/bi';

import { I18n, type ThemeName, type ThemeType } from '@iobroker/adapter-react-v5';

import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import type {
View as ViewType,
AnyWidgetId, VisTheme,
Expand Down Expand Up @@ -68,7 +68,7 @@ const styles: Record<string, any> = {
};

interface ViewsManagerProps {
changeProject: EditorClass['changeProject'];
changeProject: Editor['changeProject'];
name?: string;
onClose: () => void;
open: boolean;
Expand All @@ -81,7 +81,7 @@ interface ViewsManagerProps {
themeName: ThemeName;
themeType: ThemeType;
theme: VisTheme;
toggleView: EditorClass['toggleView'];
toggleView: Editor['toggleView'];
editMode: boolean;
selectedView: string;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import {
} from '@mui/icons-material';

import { I18n } from '@iobroker/adapter-react-v5';
import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import type { AnyWidgetId } from '@iobroker/types-vis-2';
import { store } from '../Store';

interface WidgetFilterDialogProps {
changeProject: EditorClass['changeProject'];
changeProject: Editor['changeProject'];
onClose: () => void;
selectedView: string;
}
Expand Down
32 changes: 16 additions & 16 deletions packages/iobroker.vis-2/src/src/Toolbar/Widgets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import type { ThemeType } from '@iobroker/adapter-react-v5';
import { I18n } from '@iobroker/adapter-react-v5';
import type { AnyWidgetId, GroupWidgetId, VisTheme } from '@iobroker/types-vis-2';
import type { EditorClass } from '@/Editor';
import type Editor from '@/Editor';
import { store } from '../Store';

import type { ToolbarItem } from './ToolbarItems';
Expand All @@ -41,27 +41,27 @@ interface WidgetsProps {
themeType: ThemeType;
selectedView: string;
selectedWidgets: AnyWidgetId[];
setSelectedWidgets: EditorClass['setSelectedWidgets'];
setSelectedWidgets: Editor['setSelectedWidgets'];
selectedGroup: GroupWidgetId;
editMode: boolean;
lockDragging: boolean;
widgetHint: string;
historyCursor: number;
history: EditorClass['state']['history'];
history: Editor['state']['history'];
widgetsLoaded: boolean;
changeProject: EditorClass['changeProject'];
deleteWidgets: EditorClass['deleteWidgets'];
cloneWidgets: EditorClass['cloneWidgets'];
cutWidgets: EditorClass['cutWidgets'];
copyWidgets: EditorClass['copyWidgets'];
pasteWidgets: EditorClass['pasteWidgets'];
undo: EditorClass['undo'];
redo: EditorClass['redo'];
alignWidgets: EditorClass['alignWidgets'];
orderWidgets: EditorClass['orderWidgets'];
toggleLockDragging: EditorClass['toggleLockDragging'];
toggleWidgetHint: EditorClass['toggleWidgetHint'];
widgetsClipboard: EditorClass['state']['widgetsClipboard'];
changeProject: Editor['changeProject'];
deleteWidgets: Editor['deleteWidgets'];
cloneWidgets: Editor['cloneWidgets'];
cutWidgets: Editor['cutWidgets'];
copyWidgets: Editor['copyWidgets'];
pasteWidgets: Editor['pasteWidgets'];
undo: Editor['undo'];
redo: Editor['redo'];
alignWidgets: Editor['alignWidgets'];
orderWidgets: Editor['orderWidgets'];
toggleLockDragging: Editor['toggleLockDragging'];
toggleWidgetHint: Editor['toggleWidgetHint'];
widgetsClipboard: Editor['state']['widgetsClipboard'];
toolbarHeight: 'full' | 'narrow' | 'veryNarrow';
theme: VisTheme;
}
Expand Down
Loading

0 comments on commit 648438f

Please sign in to comment.