Skip to content

Commit

Permalink
Added types
Browse files Browse the repository at this point in the history
  • Loading branch information
GermanBluefox committed Dec 2, 2024
1 parent 2d0179d commit a49b9e5
Show file tree
Hide file tree
Showing 6 changed files with 686 additions and 524 deletions.
606 changes: 408 additions & 198 deletions packages/iobroker.vis-2/src-vis/public/widgets/basic/js/table.js

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions packages/iobroker.vis-2/src-vis/src/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1190,17 +1190,17 @@ class Editor extends Runtime<EditorProps, EditorState> {
return;
}
this.setState({ selectedGroup: groupId });
this.setSelectedWidgets([]);
void this.setSelectedWidgets([]);
};

undo = async (): Promise<void> => {
this.setSelectedWidgets([]);
void this.setSelectedWidgets([]);
await this.changeProject(this.state.history[this.state.historyCursor - 1], true);
await this.setStateAsync({ historyCursor: this.state.historyCursor - 1 });
};

redo = async (): Promise<void> => {
this.setSelectedWidgets([]);
void this.setSelectedWidgets([]);
await this.changeProject(this.state.history[this.state.historyCursor + 1], true);
await this.setStateAsync({ historyCursor: this.state.historyCursor + 1 });
};
Expand Down Expand Up @@ -1669,13 +1669,15 @@ class Editor extends Runtime<EditorProps, EditorState> {
const project = deepClone(store.getState().visProject);
const widget = project[this.state.selectedView].widgets[id];
if (widget?.marketplace) {
const marketplace = deepClone(
const marketplace: MarketplaceWidgetRevision | null = deepClone(
store
.getState()
.visProject.___settings.marketplace.find(item => item.widget_id === widget.marketplace.widget_id),
);
await this.deleteWidgetsAction();
await this.addMarketplaceWidget(marketplace.id, null, null, id, widget.data, widget.style);
if (marketplace) {
await this.addMarketplaceWidget(marketplace.id, null, null, id, widget.data, widget.style);
}
}
};

Expand Down Expand Up @@ -2152,13 +2154,12 @@ class Editor extends Runtime<EditorProps, EditorState> {
name: view,
widgets: [],
};
Object.keys(store.getState().visProject[view].widgets).forEach((widget: AnyWidgetId) => {
const pWidgets = store.getState().visProject[view].widgets;
Object.keys(pWidgets).forEach((widget: AnyWidgetId) => {
if (
this.state.updateWidgetsDialog &&
store.getState().visProject[view].widgets[widget].marketplace?.widget_id ===
this.state.updateWidgetsDialog.widget_id &&
store.getState().visProject[view].widgets[widget].marketplace?.version !==
this.state.updateWidgetsDialog.version
pWidgets[widget].marketplace?.widget_id === this.state.updateWidgetsDialog.widget_id &&
pWidgets[widget].marketplace?.version !== this.state.updateWidgetsDialog.version
) {
viewWidgets.widgets.push(widget);
}
Expand Down
Loading

0 comments on commit a49b9e5

Please sign in to comment.