Skip to content

Commit

Permalink
used latest adapter-react
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Jun 10, 2024
1 parent 1e4c22d commit 4fbd645
Show file tree
Hide file tree
Showing 25 changed files with 419 additions and 560 deletions.
874 changes: 380 additions & 494 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@devbookhq/splitter": "^1.4.2",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@iobroker/adapter-react-v5": "^4.13.24",
"@iobroker/adapter-react-v5": "^5.0.5",
"@iobroker/type-detector": "^3.0.5",
"@iobroker/types": "^6.0.0",
"@iobroker/vis-2-widgets-react-dev": "^1.0.6",
Expand Down
1 change: 0 additions & 1 deletion packages/iobroker.vis-2/src/src/Attributes/CSS.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ const CSS = (props: CSSProps) => {
</DialogContent>
<DialogActions>
<Button
// @ts-expect-error grey is valid color
color="grey"
variant="contained"
onClick={() => setShowHelp(false)}
Expand Down
2 changes: 1 addition & 1 deletion packages/iobroker.vis-2/src/src/Attributes/View.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ import {
Utils,
I18n,
type LegacyConnection,
type ThemeType,
} from '@iobroker/adapter-react-v5';
import { ThemeType } from '@iobroker/adapter-react-v5/types';

import { store } from '@/Store';
import { Project, View } from '@iobroker/types-vis-2';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {

import { Close, DragHandle, FormatPaint } from '@mui/icons-material';

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

import { Project } from '@iobroker/types-vis-2';
import { getViewsWithDifferentValues } from '@/Attributes/View/ApplyProperties';
Expand Down Expand Up @@ -168,7 +167,6 @@ export default function showAllViewsDialog(props: ShowAllViewsDialogProps) {
<Button
variant="contained"
onClick={props.onClose}
// @ts-expect-error grey is valid color
color="grey"
startIcon={<Close />}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ import {
IconPicker, LegacyConnection,
TextWithIcon,
Utils,
type ThemeType,
} from '@iobroker/adapter-react-v5';

import { Clear as ClearIcon } from '@mui/icons-material';

import { deepClone } from '@/Utils/utils';
import { Field } from '@/Attributes/View/Items';
import { ThemeType } from '@iobroker/adapter-react-v5/types';
import { Project } from '@iobroker/types-vis-2';

import EditFieldImage from './EditFieldImage';
Expand Down Expand Up @@ -219,7 +219,6 @@ export default function getEditField(gProps: EditFieldProps): React.JSX.Element
className={classes.fieldContentColor}
disabled={!editMode || disabled}
onChange={color => change(color)}
openAbove
/>;
}
if (field.type === 'icon') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@ import { Clear as ClearIcon } from '@mui/icons-material';
import {
Icon,
Utils,
type ThemeType,
} from '@iobroker/adapter-react-v5';

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

import MaterialIconSelector from '@/Components/MaterialIconSelector';

interface EditFieldIcon64Props {
Expand Down Expand Up @@ -52,7 +51,6 @@ export default function EditFieldIcon64(props: EditFieldIcon64Props) {
<Button
disabled={!props.editMode || props.disabled}
variant={props.value ? 'outlined' : undefined}
// @ts-expect-error grey is a valid color
color={props.value ? 'grey' : undefined}
onClick={() => setShowDialog(true)}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ import {
LegacyConnection,
SelectFile as SelectFileDialog,
Utils,
type ThemeType,
} from '@iobroker/adapter-react-v5';

import { Field } from '@/Attributes/View/Items';
import { ThemeType } from '@iobroker/adapter-react-v5/types';

interface EditFieldImageProps {
value: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ class WidgetBindingField extends Component<WidgetBindingFieldProps, WidgetBindin
</Button>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
startIcon={<Cancel />}
onClick={() => this.setState({ showEditBindingDialog: false })}
Expand Down Expand Up @@ -931,7 +930,6 @@ class WidgetBindingField extends Component<WidgetBindingFieldProps, WidgetBindin
<DialogActions>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
onClick={() => {
const options = this.state.askToModify;
Expand All @@ -944,7 +942,6 @@ class WidgetBindingField extends Component<WidgetBindingFieldProps, WidgetBindin
</Button>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
onClick={() => {
const options = this.state.askToModify;
Expand Down Expand Up @@ -1020,7 +1017,6 @@ class WidgetBindingField extends Component<WidgetBindingFieldProps, WidgetBindin
<DialogActions>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
onClick={() => {
const options = this.state.askForArguments;
Expand All @@ -1033,7 +1029,6 @@ class WidgetBindingField extends Component<WidgetBindingFieldProps, WidgetBindin
</Button>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
onClick={() => this.setState({ askForArguments: null })}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,6 @@ const WidgetField = (props: WidgetFieldProps) => {
{I18n.t('Move to new place')}
</Button>
<Button
// @ts-expect-error grey is valid color
color="grey"
variant="contained"
onClick={() => setAskForUsage(null)}
Expand Down Expand Up @@ -860,7 +859,6 @@ const WidgetField = (props: WidgetFieldProps) => {
value={value as string || ''}
className={props.classes.fieldContentColor}
onChange={color => change(color)}
openAbove
/>;
}

Expand Down Expand Up @@ -1413,7 +1411,6 @@ const WidgetField = (props: WidgetFieldProps) => {
/>
<Button
variant={value ? 'outlined' : undefined}
// @ts-expect-error grey is valid color
color={value ? 'grey' : undefined}
onClick={() => setIdDialog(true)}
>
Expand Down
8 changes: 4 additions & 4 deletions packages/iobroker.vis-2/src/src/Attributes/Widget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import {
I18n, Icon,
LegacyConnection, Utils,
type ThemeType,
} from '@iobroker/adapter-react-v5';
import {
store, recalculateFields, updateWidget, selectWidget,
Expand All @@ -41,7 +42,6 @@ import {
Widget as SingleGroupWidget,
VisTheme, WidgetData, WidgetStyle, GroupData,
} from '@iobroker/types-vis-2';
import { ThemeType } from '@iobroker/adapter-react-v5/types';

import WidgetField from './WidgetField';
import IODialog from '../../Components/IODialog';
Expand Down Expand Up @@ -999,7 +999,7 @@ class Widget extends Component<WidgetProps, WidgetState> {
this.props.selectedWidgets.forEach(wid => {
const widgetData = _widgets[wid].data;
// move all fields of the group to -1
idxGroup.fields.forEach((attr, i) =>
idxGroup.fields.forEach((_attr, i) =>
widgetData[idxGroup.fields[i].name] = widgetData[idxGroupPlus.fields[i].name]);

// move the group-used flag
Expand Down Expand Up @@ -1044,7 +1044,7 @@ class Widget extends Component<WidgetProps, WidgetState> {
// order all attributes for better readability
const widgetData = _widgets[wid].data;

lastGroup.fields.forEach((attr, i) => {
lastGroup.fields.forEach((_attr, i) => {
const name = lastGroup.fields[i].name.replace(/\d?\d+$/, newIndex.toString());
widgetData[name] = null;
});
Expand Down Expand Up @@ -1447,7 +1447,7 @@ class Widget extends Component<WidgetProps, WidgetState> {
key={group.name}
elevation={0}
expanded={!!(this.state.accordionOpen[group.name] && group.hasValues)}
onChange={(e, expanded) => {
onChange={(_e, expanded) => {
const accordionOpen = { ...this.state.accordionOpen };
accordionOpen[group.name] = expanded;
this.setAccordionState(accordionOpen);
Expand Down
1 change: 0 additions & 1 deletion packages/iobroker.vis-2/src/src/Components/CodeDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class CodeDialog extends Component<CodeDialogProps> {
</Button>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
startIcon={<CloseIcon />}
onClick={() => this.props.onClose()}
Expand Down
1 change: 0 additions & 1 deletion packages/iobroker.vis-2/src/src/Components/IODialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ const IODialog = (props: IODialogProps) => (props.open ? <Dialog
</Button> : null}
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
onClick={props.onClose}
disabled={props.closeDisabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,6 @@ class MaterialIconSelector extends Component<MaterialIconSelectorProps, Material
{this.state.maxPages > 1 ? <div style={{ flexGrow: 1 }} /> : null}
{this.props.value ? <Button
variant="outlined"
// @ts-expect-error grey is valid color
color="grey"
onClick={() => this.props.onClose('')}
startIcon={<EraseIcon />}
Expand All @@ -425,7 +424,6 @@ class MaterialIconSelector extends Component<MaterialIconSelectorProps, Material
</Button>
<Button
variant="contained"
// @ts-expect-error grey is valid color
color="grey"
onClick={() => this.props.onClose(null)}
startIcon={<ClearIcon />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import {
} from '@mui/material';
import { Close } from '@mui/icons-material';

import { I18n } from '@iobroker/adapter-react-v5';
import { ThemeName } from '@iobroker/adapter-react-v5/types';
import { I18n, type ThemeName } from '@iobroker/adapter-react-v5';
import {
GroupWidgetId,
MarketplaceWidgetRevision,
Expand Down
7 changes: 5 additions & 2 deletions packages/iobroker.vis-2/src/src/Palette/Widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ import {
Block as DeletedIcon,
} from '@mui/icons-material';

import { I18n, LegacyConnection, Utils } from '@iobroker/adapter-react-v5';
import { ThemeType } from '@iobroker/adapter-react-v5/types';
import {
I18n, LegacyConnection,
Utils,
type ThemeType,
} from '@iobroker/adapter-react-v5';
import { MarketplaceWidgetRevision, Project } from '@iobroker/types-vis-2';

import { store } from '@/Store';
Expand Down
2 changes: 1 addition & 1 deletion packages/iobroker.vis-2/src/src/Palette/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ import {
import {
I18n, Utils,
Icon, LegacyConnection,
type ThemeType,
} from '@iobroker/adapter-react-v5';

import { Marketplace, MarketplaceWidgetRevision, Project } from '@iobroker/types-vis-2';
import { store } from '@/Store';

import { getWidgetTypes, WidgetType } from '@/Vis/visWidgetsCatalog';
import { ThemeType } from '@iobroker/adapter-react-v5/types';
import { loadComponent } from '@/Vis/visLoadWidgets';
import type { MarketplaceDialogProps } from '@/Marketplace/MarketplaceDialog';
import Widget from './Widget';
Expand Down
3 changes: 1 addition & 2 deletions packages/iobroker.vis-2/src/src/Toolbar/MultiSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import {
ArrowDropUp as IconArrowUp,
} from '@mui/icons-material';

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

const styles: Record<string, any> = (theme: Theme) => ({
navMain: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,6 @@ const WidgetImportDialog = (props: WidgetImportDialogProps) => {
</Button>
<Button
variant="contained"
// @ts-expect-error works like that
color="grey"
onClick={props.onClose}
startIcon={<CloseIcon />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,6 @@ class FiltersEditorDialog extends Component<FiltersEditorDialogProps, FiltersEdi
/>
<Button
variant={item.icon ? 'outlined' : undefined}
// @ts-expect-error grey is correct
color={item.icon ? 'grey' : undefined}
onClick={() => this.setState({ selectIcon: index })}
>
Expand Down Expand Up @@ -359,7 +358,6 @@ class FiltersEditorDialog extends Component<FiltersEditorDialogProps, FiltersEdi
/>
<Button
variant={image ? 'outlined' : undefined}
// @ts-expect-error grey is correct
color={image ? 'grey' : undefined}
onClick={() => this.setState({ selectImage: index })}
>
Expand Down Expand Up @@ -488,7 +486,6 @@ class FiltersEditorDialog extends Component<FiltersEditorDialogProps, FiltersEdi
</Button>
<Button
variant="contained"
// @ts-expect-error grey is correct
color="grey"
onClick={() => this.props.onClose()}
startIcon={<Close />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,6 @@ class BulkEditor extends React.Component<BulkEditorProps, BulkEditorState> {
</Button>
<Button
variant="contained"
// @ts-expect-error this is fine
color="grey"
startIcon={<Close />}
onClick={() => this.setState({ dialogDelete: null })}
Expand Down Expand Up @@ -565,7 +564,6 @@ class BulkEditor extends React.Component<BulkEditorProps, BulkEditorState> {
</Button>
<Button
variant="contained"
// @ts-expect-error this is fine
color="grey"
startIcon={<Close />}
onClick={() => this.setState({ editDialog: null })}
Expand Down Expand Up @@ -681,7 +679,6 @@ class BulkEditor extends React.Component<BulkEditorProps, BulkEditorState> {
} else {
button = <Button
style={{ color: this.state.activeLine === i ? (this.state.activeColors[i] || this.state.colors[i]) : this.state.colors[i] || undefined }}
// @ts-expect-error this is fine
color={this.state.activeLine === i ? 'primary' : 'grey'}
variant={this.props.data.variant === undefined ? 'contained' : this.props.data.variant}
onClick={() => this.setState({ activeLine: i })}
Expand Down Expand Up @@ -744,7 +741,6 @@ class BulkEditor extends React.Component<BulkEditorProps, BulkEditorState> {
/>
<Button
variant={this.state.icons[i] ? 'outlined' : undefined}
// @ts-expect-error this is fine
color={this.state.icons[i] ? 'grey' : undefined}
onClick={() => this.setState({ iconDialog: i })}
>
Expand Down Expand Up @@ -950,7 +946,6 @@ class BulkEditor extends React.Component<BulkEditorProps, BulkEditorState> {
</Button>
<Button
variant="contained"
// @ts-expect-error this is fine
color="grey"
startIcon={<Close />}
onClick={() => this.setState({ minMaxDialog: false })}
Expand Down Expand Up @@ -1084,7 +1079,6 @@ class BulkEditor extends React.Component<BulkEditorProps, BulkEditorState> {
</Button>
<Button
variant="contained"
// @ts-expect-error this works
color="grey"
startIcon={<Close />}
onClick={() => this.setState({ dialog: false })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import React from 'react';

import {
Button, ButtonTypeMap,
Button,
} from '@mui/material';

import {
Expand Down Expand Up @@ -466,12 +466,10 @@ class JQuiWriteState extends VisRxWidget<RxData, JQuiWriteStateState> {
buttonStyle.height = '100%';
buttonStyle.minWidth = 'unset';

// @ts-expect-error grey is valid color
const buttonColor: ButtonTypeMap = isActive ? 'primary' : 'grey';
const buttonColor: 'primary' | 'grey' = isActive ? 'primary' : 'grey';

const content = <Button
style={buttonStyle}
// @ts-expect-error grey is valid color
color={buttonColor}
startIcon={text ? this.renderIcon(isActive) : null}
onClick={() => this.onClick()}
Expand Down
Loading

0 comments on commit 4fbd645

Please sign in to comment.