Skip to content

Commit

Permalink
Merge branch 'master' into issue-211-2
Browse files Browse the repository at this point in the history
Signed-off-by: Max Hauser <[email protected]>
  • Loading branch information
foxriver76 authored Nov 29, 2023
2 parents 43733de + d601f86 commit 09f4ac5
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 11 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ E.g., if it was used in a menu and the menu is red, the circle would be red.
### **WORK IN PROGRESS**
* (foxriver76) fixed reactivity in custom components
* (foxriver76) after creating a group it is now pre-selected
* (foxriver76) fields are now updated when moved via keyboard

### 2.9.1 (2023-11-28)
* (foxriver76) recalculate fields after moving widgets
Expand Down
5 changes: 5 additions & 0 deletions src/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ module.exports = {
'only-warn',
'react-hooks',
],
settings: {
'import/resolver': {
typescript: {}, // this loads <rootdir>/tsconfig.json to eslint
},
},
rules: {
'arrow-parens': [1, 'as-needed'],
'react/jsx-indent': 'off',
Expand Down
3 changes: 2 additions & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"echarts-for-react": "^3.0.2",
"eslint": "^8.54.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-eqeqeq-fix": "^1.0.3",
"eslint-plugin-import": "^2.29.0",
"eslint-plugin-jsx-a11y": "^6.8.0",
Expand Down Expand Up @@ -70,4 +71,4 @@
"not ie <= 11",
"not op_mini all"
]
}
}
2 changes: 1 addition & 1 deletion src/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ import {
Message as MessageDialog,
SelectFile as SelectFileDialog, Icon,
} from '@iobroker/adapter-react-v5';
import { recalculateFields, store, updateProject } from './Store';
import {
isGroup, getNewWidgetId, getNewGroupId, pasteGroup, unsyncMultipleWidgets, deepClone,
} from './Utils/utils';
import { recalculateFields, store, updateProject } from './Store';

import Attributes from './Attributes';
import Palette from './Palette';
Expand Down
10 changes: 6 additions & 4 deletions src/src/Toolbar/WidgetImportDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@ const WidgetImportDialog = props => {
const project = JSON.parse(JSON.stringify(visProject));
const widgets = JSON.parse(data);
const newWidgets = {};
let groupOffset = 0;
let widgetOffset = 0;

widgets.forEach(widget => {
for (const widget of widgets) {
if (isGroup(widget)) {
const newKey = getNewGroupId(visProject);
const newKey = getNewGroupId(visProject, groupOffset++);
newWidgets[newKey] = widget;
// find all widgets that belong to this group and change groupid
let w;
Expand All @@ -41,7 +43,7 @@ const WidgetImportDialog = props => {
}
} while (w);
} else {
const newKey = getNewWidgetId(visProject);
const newKey = getNewWidgetId(visProject, widgetOffset++);
newWidgets[newKey] = widget;
if (widget.grouped && newWidgets[widget.groupid] && newWidgets[widget.groupid].data && newWidgets[widget.groupid].data.members) {
// find group
Expand All @@ -51,7 +53,7 @@ const WidgetImportDialog = props => {
}
}
}
});
}

Object.keys(newWidgets).forEach(wid => delete newWidgets[wid]._id);

Expand Down
6 changes: 3 additions & 3 deletions src/src/Vis/Widgets/Basic/BasicScreenResolution.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import React from 'react';

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

// eslint-disable-next-line import/no-cycle
import VisRxWidget from '../../visRxWidget';

import {
RxRenderWidgetProps, VisLegacy,
RxWidgetState, RxWidgetProps,
} from '@/types';

// eslint-disable-next-line import/no-cycle
import VisRxWidget from '../../visRxWidget';

declare global {
interface Window {
vis: VisLegacy;
Expand Down
3 changes: 1 addition & 2 deletions src/src/Vis/Widgets/Basic/BasicSvgShape.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import React from 'react';

import { RxRenderWidgetProps } from '@/types';
// eslint-disable-next-line import/no-cycle
import VisRxWidget from '../../visRxWidget';

import { RxRenderWidgetProps } from '@/types';

export default class BasicSvgShape extends VisRxWidget {
/**
* Returns the widget info which is rendered in the edit mode
Expand Down
1 change: 1 addition & 0 deletions src/src/Vis/visView.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ class VisView extends React.Component {
this.moveTimer = setTimeout(() => {
this.moveTimer = null;
this.showRulers(true);
store.dispatch(recalculateFields(true));

this.props.selectedWidgets.forEach(wid => {
if (this.widgetsRefs[wid]?.onMove) {
Expand Down

0 comments on commit 09f4ac5

Please sign in to comment.