@iobroker/adapter-react-v5 6.0.9 → 6.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Components/ColorPicker.d.ts +3 -10
- package/Components/ColorPicker.js +1 -9
- package/Components/ObjectBrowser.d.ts +7 -1
- package/Components/ObjectBrowser.js +279 -108
- package/README.md +7 -0
- package/Theme.d.ts +2 -2
- package/Theme.js +12 -14
- package/i18n/de.json +2 -1
- package/i18n/en.json +2 -1
- package/i18n/es.json +2 -1
- package/i18n/fr.json +2 -1
- package/i18n/it.json +2 -1
- package/i18n/nl.json +2 -1
- package/i18n/pl.json +2 -1
- package/i18n/pt.json +2 -1
- package/i18n/ru.json +2 -1
- package/i18n/uk.json +2 -1
- package/i18n/zh-cn.json +2 -1
- package/package.json +6 -6
|
@@ -36,6 +36,7 @@ interface ColorPickerProps {
|
|
|
36
36
|
customPalette?: string[];
|
|
37
37
|
noInputField?: boolean;
|
|
38
38
|
barWidth?: number;
|
|
39
|
+
sx?: Record<string, any>;
|
|
39
40
|
}
|
|
40
41
|
interface ColorPickerState {
|
|
41
42
|
displayColorPicker: boolean;
|
|
@@ -44,14 +45,8 @@ interface ColorPickerState {
|
|
|
44
45
|
}
|
|
45
46
|
declare class ColorPicker extends Component<ColorPickerProps, ColorPickerState> {
|
|
46
47
|
constructor(props: ColorPickerProps);
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
*/
|
|
50
|
-
handleClick: (e: React.MouseEvent<HTMLDivElement>) => void;
|
|
51
|
-
/**
|
|
52
|
-
* @private
|
|
53
|
-
*/
|
|
54
|
-
handleClose: () => void;
|
|
48
|
+
private handleClick;
|
|
49
|
+
private handleClose;
|
|
55
50
|
/**
|
|
56
51
|
* Convert the given color to hex ('#rrggbb') or rgba ('rgba(r,g,b,a)') format.
|
|
57
52
|
* @returns the hex or rgba representation of the given color.
|
|
@@ -68,8 +63,6 @@ declare class ColorPicker extends Component<ColorPickerProps, ColorPickerState>
|
|
|
68
63
|
private handleChange;
|
|
69
64
|
/**
|
|
70
65
|
* IF the props are updated from outside, they should override the state
|
|
71
|
-
* @param _prevProps
|
|
72
|
-
* @param prevState
|
|
73
66
|
*/
|
|
74
67
|
componentDidUpdate(_prevProps: ColorPickerProps, prevState: ColorPickerState): void;
|
|
75
68
|
renderCustomPalette(): React.JSX.Element;
|
|
@@ -115,18 +115,12 @@ const styles = {
|
|
|
115
115
|
class ColorPicker extends react_1.Component {
|
|
116
116
|
constructor(props) {
|
|
117
117
|
super(props);
|
|
118
|
-
/**
|
|
119
|
-
* @private
|
|
120
|
-
*/
|
|
121
118
|
this.handleClick = (e) => {
|
|
122
119
|
this.setState({
|
|
123
120
|
displayColorPicker: !this.state.displayColorPicker,
|
|
124
121
|
anchorEl: this.state.displayColorPicker ? null : e.currentTarget,
|
|
125
122
|
});
|
|
126
123
|
};
|
|
127
|
-
/**
|
|
128
|
-
* @private
|
|
129
|
-
*/
|
|
130
124
|
this.handleClose = () => {
|
|
131
125
|
this.setState({ displayColorPicker: false, anchorEl: null });
|
|
132
126
|
};
|
|
@@ -177,8 +171,6 @@ class ColorPicker extends react_1.Component {
|
|
|
177
171
|
}
|
|
178
172
|
/**
|
|
179
173
|
* IF the props are updated from outside, they should override the state
|
|
180
|
-
* @param _prevProps
|
|
181
|
-
* @param prevState
|
|
182
174
|
*/
|
|
183
175
|
componentDidUpdate(_prevProps, prevState) {
|
|
184
176
|
const color = ColorPicker.getColor(this.props.color || this.props.value || '');
|
|
@@ -200,7 +192,7 @@ class ColorPicker extends react_1.Component {
|
|
|
200
192
|
const style = Object.assign({}, (this.props.style || {}));
|
|
201
193
|
style.position = 'relative';
|
|
202
194
|
const { color } = this.state;
|
|
203
|
-
return react_1.default.createElement(material_1.Box, { component: "div", style: style, className: this.props.className || '' },
|
|
195
|
+
return react_1.default.createElement(material_1.Box, { component: "div", style: style, sx: this.props.sx || undefined, className: this.props.className || '' },
|
|
204
196
|
this.props.noInputField ? null : react_1.default.createElement(material_1.TextField, { disabled: this.props.disabled, variant: "standard", id: "ar_color_picker_name", label: this.props.label || this.props.name || 'color', value: color || '', margin: "dense", sx: {
|
|
205
197
|
'&.MuiFormControl-root': styles.textDense,
|
|
206
198
|
width: color ? 'calc(100% - 80px)' : 'calc(100% - 56px)',
|
|
@@ -181,6 +181,7 @@ interface ObjectBrowserValueProps {
|
|
|
181
181
|
isFloatComma: boolean;
|
|
182
182
|
t: Translate;
|
|
183
183
|
lang: ioBroker.Languages;
|
|
184
|
+
width: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
184
185
|
}
|
|
185
186
|
interface ObjectBrowserEditObjectProps {
|
|
186
187
|
socket: Connection;
|
|
@@ -197,6 +198,7 @@ interface ObjectBrowserEditObjectProps {
|
|
|
197
198
|
isFloatComma: boolean;
|
|
198
199
|
onNewObject: (obj: ioBroker.AnyObject) => void;
|
|
199
200
|
t: Translate;
|
|
201
|
+
width: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
200
202
|
}
|
|
201
203
|
interface ObjectAliasEditorProps {
|
|
202
204
|
t: Translate;
|
|
@@ -285,6 +287,7 @@ interface ObjectBrowserState {
|
|
|
285
287
|
loaded: boolean;
|
|
286
288
|
foldersFirst: boolean;
|
|
287
289
|
selected: string[];
|
|
290
|
+
focused: string;
|
|
288
291
|
selectedNonObject: string;
|
|
289
292
|
filter: ObjectBrowserFilter;
|
|
290
293
|
filterKey: number;
|
|
@@ -538,7 +541,10 @@ export declare class ObjectBrowserClass extends Component<ObjectBrowserProps, Ob
|
|
|
538
541
|
*/
|
|
539
542
|
renderLeaf(item: TreeItem, isExpanded: boolean | undefined, counter: {
|
|
540
543
|
count: number;
|
|
541
|
-
}):
|
|
544
|
+
}): {
|
|
545
|
+
row: React.JSX.Element;
|
|
546
|
+
details: React.JSX.Element | null;
|
|
547
|
+
};
|
|
542
548
|
/**
|
|
543
549
|
* Renders an item.
|
|
544
550
|
*/
|
|
@@ -179,6 +179,7 @@ const styles = {
|
|
|
179
179
|
lineHeight: `${ROW_HEIGHT}px`,
|
|
180
180
|
verticalAlign: 'top',
|
|
181
181
|
userSelect: 'none',
|
|
182
|
+
position: 'relative',
|
|
182
183
|
width: '100%',
|
|
183
184
|
'&:hover': {
|
|
184
185
|
background: `${theme.palette.mode === 'dark' ? theme.palette.primary.dark : theme.palette.primary.light} !important`,
|
|
@@ -202,6 +203,17 @@ const styles = {
|
|
|
202
203
|
tableRowAliasReadWrite: {
|
|
203
204
|
height: ROW_HEIGHT + 22,
|
|
204
205
|
},
|
|
206
|
+
tableRowFocused: (theme) => ({
|
|
207
|
+
'&:after': {
|
|
208
|
+
content: '""',
|
|
209
|
+
position: 'absolute',
|
|
210
|
+
top: 1,
|
|
211
|
+
left: 1,
|
|
212
|
+
right: 1,
|
|
213
|
+
bottom: 1,
|
|
214
|
+
border: theme.palette.mode ? '1px dotted #000' : '1px dotted #FFF',
|
|
215
|
+
},
|
|
216
|
+
}),
|
|
205
217
|
checkBox: {
|
|
206
218
|
padding: 0,
|
|
207
219
|
},
|
|
@@ -276,6 +288,12 @@ const styles = {
|
|
|
276
288
|
position: 'absolute',
|
|
277
289
|
right: 3,
|
|
278
290
|
},
|
|
291
|
+
cellCopyButtonInDetails: {
|
|
292
|
+
width: SMALL_BUTTON_SIZE,
|
|
293
|
+
height: SMALL_BUTTON_SIZE,
|
|
294
|
+
top: (ROW_HEIGHT - SMALL_BUTTON_SIZE) / 2,
|
|
295
|
+
opacity: 0.8,
|
|
296
|
+
},
|
|
279
297
|
cellEditButton: {
|
|
280
298
|
width: SMALL_BUTTON_SIZE,
|
|
281
299
|
height: SMALL_BUTTON_SIZE,
|
|
@@ -501,6 +519,18 @@ const styles = {
|
|
|
501
519
|
cellButtonsValueButtonEdit: {
|
|
502
520
|
right: (SMALL_BUTTON_SIZE / 2) + 16,
|
|
503
521
|
},
|
|
522
|
+
cellDetailsLine: {
|
|
523
|
+
display: 'flex',
|
|
524
|
+
alignItems: 'center',
|
|
525
|
+
width: '100%',
|
|
526
|
+
height: 32,
|
|
527
|
+
fontSize: 16,
|
|
528
|
+
},
|
|
529
|
+
cellDetailsName: {
|
|
530
|
+
fontWeight: 'bold',
|
|
531
|
+
marginRight: 8,
|
|
532
|
+
minWidth: 100,
|
|
533
|
+
},
|
|
504
534
|
filteredOut: {
|
|
505
535
|
opacity: 0.5,
|
|
506
536
|
},
|
|
@@ -2270,6 +2300,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2270
2300
|
selectedNonObject: this.localStorage.getItem(`${props.dialogName || 'App'}.selectedNonObject`) || '',
|
|
2271
2301
|
filter,
|
|
2272
2302
|
filterKey: 0,
|
|
2303
|
+
focused: this.localStorage.getItem(`${props.dialogName || 'App'}.focused`) || '',
|
|
2273
2304
|
depth: 0,
|
|
2274
2305
|
expandAllVisible: false,
|
|
2275
2306
|
expanded,
|
|
@@ -2303,6 +2334,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2303
2334
|
tooltipInfo: null,
|
|
2304
2335
|
};
|
|
2305
2336
|
this.texts = {
|
|
2337
|
+
name: props.t('ra_Name'),
|
|
2338
|
+
categories: props.t('ra_Categories'),
|
|
2306
2339
|
value: props.t('ra_tooltip_value'),
|
|
2307
2340
|
ack: props.t('ra_tooltip_ack'),
|
|
2308
2341
|
ts: props.t('ra_tooltip_ts'),
|
|
@@ -2679,12 +2712,13 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2679
2712
|
* Called when an item is selected/deselected.
|
|
2680
2713
|
*/
|
|
2681
2714
|
onSelect(toggleItem, isDouble, cb) {
|
|
2715
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.focused`, toggleItem);
|
|
2682
2716
|
if (!this.props.multiSelect) {
|
|
2683
2717
|
if (this.objects[toggleItem] &&
|
|
2684
2718
|
(!this.props.types || this.props.types.includes(this.objects[toggleItem].type))) {
|
|
2685
2719
|
this.localStorage.removeItem(`${this.props.dialogName || 'App'}.selectedNonObject`);
|
|
2686
2720
|
if (this.state.selected[0] !== toggleItem) {
|
|
2687
|
-
this.setState({ selected: [toggleItem], selectedNonObject: '' }, () => {
|
|
2721
|
+
this.setState({ selected: [toggleItem], selectedNonObject: '', focused: toggleItem }, () => {
|
|
2688
2722
|
this.onAfterSelect(isDouble);
|
|
2689
2723
|
cb && cb();
|
|
2690
2724
|
});
|
|
@@ -2695,7 +2729,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2695
2729
|
}
|
|
2696
2730
|
else {
|
|
2697
2731
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.selectedNonObject`, toggleItem);
|
|
2698
|
-
this.setState({ selected: [], selectedNonObject: toggleItem }, () => {
|
|
2732
|
+
this.setState({ selected: [], selectedNonObject: toggleItem, focused: toggleItem }, () => {
|
|
2699
2733
|
this.onAfterSelect();
|
|
2700
2734
|
cb && cb();
|
|
2701
2735
|
});
|
|
@@ -2713,7 +2747,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2713
2747
|
else if (!isDouble) {
|
|
2714
2748
|
selected.splice(pos, 1);
|
|
2715
2749
|
}
|
|
2716
|
-
this.setState({ selected, selectedNonObject: '' }, () => {
|
|
2750
|
+
this.setState({ selected, selectedNonObject: '', focused: toggleItem }, () => {
|
|
2717
2751
|
this.onAfterSelect(isDouble);
|
|
2718
2752
|
cb && cb();
|
|
2719
2753
|
});
|
|
@@ -3500,6 +3534,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3500
3534
|
display: 'flex',
|
|
3501
3535
|
width: '100%',
|
|
3502
3536
|
alignItems: 'center',
|
|
3537
|
+
overflowX: 'auto',
|
|
3503
3538
|
} },
|
|
3504
3539
|
react_1.default.createElement("div", { style: {
|
|
3505
3540
|
display: 'flex',
|
|
@@ -3510,19 +3545,19 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3510
3545
|
react_1.default.createElement("div", null,
|
|
3511
3546
|
react_1.default.createElement(material_1.IconButton, { onClick: () => this.refreshComponent(), disabled: this.state.updating, size: "large" },
|
|
3512
3547
|
react_1.default.createElement(icons_material_1.Refresh, null)))),
|
|
3513
|
-
this.props.showExpertButton && !this.props.expertMode &&
|
|
3548
|
+
this.props.showExpertButton && !this.props.expertMode && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_expertMode'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3514
3549
|
react_1.default.createElement(material_1.IconButton, { key: "expertMode", color: this.state.filter.expertMode ? 'secondary' : 'default', onClick: () => this.onFilter('expertMode', !this.state.filter.expertMode), size: "large" },
|
|
3515
|
-
react_1.default.createElement(IconExpert_1.default, null)))
|
|
3516
|
-
!this.props.disableColumnSelector &&
|
|
3550
|
+
react_1.default.createElement(IconExpert_1.default, null))),
|
|
3551
|
+
!this.props.disableColumnSelector && this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Configure'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3517
3552
|
react_1.default.createElement(material_1.IconButton, { key: "columnSelector", color: this.state.columnsAuto ? 'primary' : 'default', onClick: () => this.setState({ columnsSelectorShow: true }), size: "large" },
|
|
3518
|
-
react_1.default.createElement(icons_material_1.ViewColumn, null)))
|
|
3519
|
-
this.state.expandAllVisible &&
|
|
3553
|
+
react_1.default.createElement(icons_material_1.ViewColumn, null))),
|
|
3554
|
+
this.props.width !== 'xs' && this.state.expandAllVisible && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand all nodes'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3520
3555
|
react_1.default.createElement(material_1.IconButton, { key: "expandAll", onClick: () => this.onExpandAll(), size: "large" },
|
|
3521
|
-
react_1.default.createElement(IconOpen_1.default, null)))
|
|
3556
|
+
react_1.default.createElement(IconOpen_1.default, null))),
|
|
3522
3557
|
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse all nodes'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3523
3558
|
react_1.default.createElement(material_1.IconButton, { key: "collapseAll", onClick: () => this.onCollapseAll(), size: "large" },
|
|
3524
3559
|
react_1.default.createElement(IconClosed_1.default, null))),
|
|
3525
|
-
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand one step node'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3560
|
+
this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand one step node'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3526
3561
|
react_1.default.createElement(material_1.IconButton, { key: "expandVisible", color: "primary", onClick: () => this.onExpandVisible(), size: "large" },
|
|
3527
3562
|
react_1.default.createElement(material_1.Badge, { badgeContent: this.state.depth, color: "secondary", sx: (theme) => ({
|
|
3528
3563
|
badge: {
|
|
@@ -3533,7 +3568,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3533
3568
|
},
|
|
3534
3569
|
}) },
|
|
3535
3570
|
react_1.default.createElement(IconOpen_1.default, null)))),
|
|
3536
|
-
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse one step node'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3571
|
+
this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse one step node'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3537
3572
|
react_1.default.createElement(material_1.IconButton, { key: "collapseVisible", color: "primary", onClick: () => this.onCollapseVisible(), size: "large" },
|
|
3538
3573
|
react_1.default.createElement(material_1.Badge, { sx: (theme) => ({
|
|
3539
3574
|
badge: {
|
|
@@ -3544,9 +3579,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3544
3579
|
},
|
|
3545
3580
|
}), badgeContent: this.state.depth, color: "secondary" },
|
|
3546
3581
|
react_1.default.createElement(IconClosed_1.default, null)))),
|
|
3547
|
-
this.props.objectStatesView &&
|
|
3582
|
+
this.props.objectStatesView && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Toggle the states view'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3548
3583
|
react_1.default.createElement(material_1.IconButton, { onClick: () => this.onStatesViewVisible(), size: "large" },
|
|
3549
|
-
react_1.default.createElement(icons_material_1.LooksOne, { color: this.state.statesView ? 'primary' : 'inherit' })))
|
|
3584
|
+
react_1.default.createElement(icons_material_1.LooksOne, { color: this.state.statesView ? 'primary' : 'inherit' }))),
|
|
3550
3585
|
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Show/Hide object descriptions'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3551
3586
|
react_1.default.createElement(material_1.IconButton, { onClick: () => {
|
|
3552
3587
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.desc`, this.state.showDescription ? 'false' : 'true');
|
|
@@ -3576,7 +3611,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3576
3611
|
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Save objects tree as JSON file'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3577
3612
|
react_1.default.createElement(material_1.IconButton, { onClick: () => this.setState({ showExportDialog: this._getSelectedIdsForExport().length }), size: "large" },
|
|
3578
3613
|
react_1.default.createElement(icons_material_1.Publish, { style: { transform: 'rotate(180deg)' } })))),
|
|
3579
|
-
!!this.props.objectBrowserEditObject &&
|
|
3614
|
+
!!this.props.objectBrowserEditObject && this.props.width !== 'xs' && react_1.default.createElement("div", { style: { display: 'flex', whiteSpace: 'nowrap' } }, `${this.props.t('ra_Objects')}: ${Object.keys(this.info.objects).length}, ${this.props.t('ra_States')}: ${Object.keys(this.info.objects).filter(el => this.info.objects[el].type === 'state').length}`),
|
|
3580
3615
|
this.props.objectEditBoolean && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Edit custom config'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3581
3616
|
react_1.default.createElement(material_1.IconButton, { onClick: () => {
|
|
3582
3617
|
var _b;
|
|
@@ -3794,7 +3829,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3794
3829
|
}
|
|
3795
3830
|
this.setState({ tooltipInfo: { el: valFullRx, id } }, () => cb && cb());
|
|
3796
3831
|
}
|
|
3797
|
-
renderColumnValue(id, item) {
|
|
3832
|
+
renderColumnValue(id, item, narrowStyleWithDetails) {
|
|
3798
3833
|
var _b, _c;
|
|
3799
3834
|
const obj = item.data.obj;
|
|
3800
3835
|
if (!obj || !this.states) {
|
|
@@ -3832,7 +3867,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3832
3867
|
"(",
|
|
3833
3868
|
valText.s,
|
|
3834
3869
|
")"));
|
|
3835
|
-
valTextRx.push(react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: this.styles.iconCopy, onClick: e => this.onCopy(e, copyText), key: "cc" }));
|
|
3870
|
+
!narrowStyleWithDetails && valTextRx.push(react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: this.styles.iconCopy, onClick: e => this.onCopy(e, copyText), key: "cc" }));
|
|
3836
3871
|
// <IconEdit className="copyButton" style={{{ ...styles.cellButtonsValueButton, styles.cellButtonsValueButtonEdit)} key="ce" />
|
|
3837
3872
|
info = item.data.state;
|
|
3838
3873
|
}
|
|
@@ -3841,11 +3876,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3841
3876
|
if (!this.state.filter.expertMode && item.data.button) {
|
|
3842
3877
|
val = [react_1.default.createElement(icons_material_1.RoomService, { style: styles.cellValueButton })];
|
|
3843
3878
|
}
|
|
3844
|
-
return react_1.default.createElement(material_1.Tooltip, { key: "value", title: (
|
|
3879
|
+
return react_1.default.createElement(material_1.Tooltip, { key: "value", title: (_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el, componentsProps: {
|
|
3845
3880
|
popper: { sx: styles.cellValueTooltipBox },
|
|
3846
3881
|
tooltip: { sx: styles.cellValueTooltip },
|
|
3847
3882
|
}, onOpen: () => this.getTooltipInfo(id, () => this.readHistory(id)), onClose: () => { var _b; return ((_b = this.state.tooltipInfo) === null || _b === void 0 ? void 0 : _b.id) === id && this.setState({ tooltipInfo: null }); } },
|
|
3848
|
-
react_1.default.createElement(material_1.Box, { component: "div", style: info.style, sx: styles.cellValueText }, val));
|
|
3883
|
+
react_1.default.createElement(material_1.Box, { component: "div", style: info.style, sx: Object.assign(Object.assign({}, styles.cellValueText), { height: narrowStyleWithDetails ? undefined : ROW_HEIGHT }) }, val));
|
|
3849
3884
|
}
|
|
3850
3885
|
_syncEnum(id, enumIds, newArray, cb) {
|
|
3851
3886
|
var _b, _c, _d;
|
|
@@ -4157,7 +4192,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4157
4192
|
* Renders a leaf.
|
|
4158
4193
|
*/
|
|
4159
4194
|
renderLeaf(item, isExpanded, counter) {
|
|
4160
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
4195
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
|
|
4161
4196
|
const id = item.data.id;
|
|
4162
4197
|
counter.count++;
|
|
4163
4198
|
isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
|
|
@@ -4411,7 +4446,208 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4411
4446
|
useDesc = !!oTooltip;
|
|
4412
4447
|
}
|
|
4413
4448
|
}
|
|
4414
|
-
|
|
4449
|
+
const narrowStyleWithDetails = this.props.width === 'xs' && this.state.focused === id;
|
|
4450
|
+
const colID = react_1.default.createElement(material_1.Grid, { container: true, wrap: "nowrap", direction: "row", sx: styles.cellId, style: { width: this.columnsVisibility.id, paddingLeft } },
|
|
4451
|
+
react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" },
|
|
4452
|
+
checkbox,
|
|
4453
|
+
iconFolder),
|
|
4454
|
+
react_1.default.createElement(material_1.Grid, { item: true, style: Object.assign(Object.assign(Object.assign({}, styles.cellIdSpan), (invertBackground ? this.styles.invertedBackground : undefined)), { color: checkColor, fontWeight: bold ? 'bold' : undefined }) },
|
|
4455
|
+
react_1.default.createElement(material_1.Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
4456
|
+
react_1.default.createElement("div", null, item.data.name)),
|
|
4457
|
+
alias,
|
|
4458
|
+
icons),
|
|
4459
|
+
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.grow), (invertBackground ? this.styles.invertedBackgroundFlex : {})) }),
|
|
4460
|
+
react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, iconItem),
|
|
4461
|
+
this.props.width !== 'xs' || narrowStyleWithDetails ? react_1.default.createElement("div", null,
|
|
4462
|
+
react_1.default.createElement(IconCopy_1.default, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) })) : null);
|
|
4463
|
+
let colName = (narrowStyleWithDetails && name) || this.columnsVisibility.name ? react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign(Object.assign({}, styles.cellName), (useDesc ? styles.cellNameWithDesc : undefined)), { width: this.props.width !== 'xs' ? this.columnsVisibility.name : undefined, ml: narrowStyleWithDetails ? 0 : '5px' }) },
|
|
4464
|
+
name,
|
|
4465
|
+
!narrowStyleWithDetails && ((_g = item.data) === null || _g === void 0 ? void 0 : _g.title) ? react_1.default.createElement(material_1.Box, { style: { color: checkColor } },
|
|
4466
|
+
react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButton, onClick: e => { var _b; return this.onCopy(e, (_b = item.data) === null || _b === void 0 ? void 0 : _b.title); } })) : null) : null;
|
|
4467
|
+
let colMiddle;
|
|
4468
|
+
if (!this.state.statesView) {
|
|
4469
|
+
colMiddle = [
|
|
4470
|
+
(narrowStyleWithDetails && (obj === null || obj === void 0 ? void 0 : obj.type)) || this.columnsVisibility.type ? {
|
|
4471
|
+
el: react_1.default.createElement("div", { key: "type", style: Object.assign(Object.assign({}, styles.cellType), { width: this.props.width !== 'xs' ? this.columnsVisibility.type : undefined }) },
|
|
4472
|
+
typeImg,
|
|
4473
|
+
"\u00A0", obj === null || obj === void 0 ? void 0 :
|
|
4474
|
+
obj.type),
|
|
4475
|
+
type: 'filter_type',
|
|
4476
|
+
} : null,
|
|
4477
|
+
(narrowStyleWithDetails && common) || this.columnsVisibility.role ? {
|
|
4478
|
+
el: react_1.default.createElement("div", { key: "role", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.role : '100%', cursor: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole
|
|
4479
|
+
? 'text'
|
|
4480
|
+
: 'default' }), onClick: !narrowStyleWithDetails && this.state.filter.expertMode &&
|
|
4481
|
+
enumEditable && this.props.objectBrowserEditRole
|
|
4482
|
+
? () => this.setState({ roleDialog: item.data.id })
|
|
4483
|
+
: undefined }, common === null || common === void 0 ? void 0 : common.role),
|
|
4484
|
+
type: 'filter_role',
|
|
4485
|
+
onClick: narrowStyleWithDetails && this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole
|
|
4486
|
+
? () => this.setState({ roleDialog: item.data.id })
|
|
4487
|
+
: undefined,
|
|
4488
|
+
} : null,
|
|
4489
|
+
(narrowStyleWithDetails && common) || this.columnsVisibility.room ? {
|
|
4490
|
+
el: react_1.default.createElement("div", { key: "room", style: Object.assign(Object.assign(Object.assign({}, styles.cellRoom), (item.data.per ? styles.cellEnumParent : {})), { width: this.props.width !== 'xs' ? this.columnsVisibility.room : '100%', cursor: enumEditable ? 'text' : 'default' }), onClick: !narrowStyleWithDetails && enumEditable ? () => {
|
|
4491
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4492
|
+
this.setState({
|
|
4493
|
+
enumDialogEnums: enums,
|
|
4494
|
+
enumDialog: {
|
|
4495
|
+
item,
|
|
4496
|
+
type: 'room',
|
|
4497
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4498
|
+
},
|
|
4499
|
+
});
|
|
4500
|
+
} : undefined }, item.data.rooms),
|
|
4501
|
+
type: 'filter_room',
|
|
4502
|
+
onClick: narrowStyleWithDetails && enumEditable ? () => {
|
|
4503
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4504
|
+
this.setState({
|
|
4505
|
+
enumDialogEnums: enums,
|
|
4506
|
+
enumDialog: {
|
|
4507
|
+
item,
|
|
4508
|
+
type: 'room',
|
|
4509
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4510
|
+
},
|
|
4511
|
+
});
|
|
4512
|
+
} : undefined,
|
|
4513
|
+
} : null,
|
|
4514
|
+
(narrowStyleWithDetails && common) || this.columnsVisibility.func ? {
|
|
4515
|
+
el: react_1.default.createElement("div", { key: "func", style: Object.assign(Object.assign(Object.assign({}, styles.cellFunc), (item.data.pef ? styles.cellEnumParent : {})), { width: this.props.width !== 'xs' ? this.columnsVisibility.func : '100%', cursor: enumEditable ? 'text' : 'default' }), onClick: !narrowStyleWithDetails && enumEditable ? () => {
|
|
4516
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4517
|
+
this.setState({
|
|
4518
|
+
enumDialogEnums: enums,
|
|
4519
|
+
enumDialog: {
|
|
4520
|
+
item,
|
|
4521
|
+
type: 'func',
|
|
4522
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4523
|
+
},
|
|
4524
|
+
});
|
|
4525
|
+
} : undefined }, item.data.funcs),
|
|
4526
|
+
type: 'filter_func',
|
|
4527
|
+
onClick: narrowStyleWithDetails && enumEditable ? () => {
|
|
4528
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4529
|
+
this.setState({
|
|
4530
|
+
enumDialogEnums: enums,
|
|
4531
|
+
enumDialog: {
|
|
4532
|
+
item,
|
|
4533
|
+
type: 'func',
|
|
4534
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4535
|
+
},
|
|
4536
|
+
});
|
|
4537
|
+
} : undefined,
|
|
4538
|
+
} : null,
|
|
4539
|
+
];
|
|
4540
|
+
}
|
|
4541
|
+
else {
|
|
4542
|
+
colMiddle = [
|
|
4543
|
+
(narrowStyleWithDetails && checkVisibleObjectType && ((_h = this.states[id]) === null || _h === void 0 ? void 0 : _h.from)) || this.columnsVisibility.changedFrom ? {
|
|
4544
|
+
el: react_1.default.createElement("div", { key: "from", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.changedFrom : undefined }), title: newValueTitle.join('\n') }, checkVisibleObjectType && ((_j = this.states[id]) === null || _j === void 0 ? void 0 : _j.from) ? newValue : null),
|
|
4545
|
+
type: 'from',
|
|
4546
|
+
} : null,
|
|
4547
|
+
(narrowStyleWithDetails && q) || this.columnsVisibility.qualityCode ? {
|
|
4548
|
+
el: react_1.default.createElement("div", { key: "q", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.qualityCode : undefined }), title: q || '' }, q),
|
|
4549
|
+
type: 'quality',
|
|
4550
|
+
} : null,
|
|
4551
|
+
(narrowStyleWithDetails && checkVisibleObjectType && ((_k = this.states[id]) === null || _k === void 0 ? void 0 : _k.ts)) || this.columnsVisibility.timestamp ? {
|
|
4552
|
+
el: react_1.default.createElement("div", { key: "ts", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.timestamp : undefined }) }, checkVisibleObjectType && ((_l = this.states[id]) === null || _l === void 0 ? void 0 : _l.ts)
|
|
4553
|
+
? Utils_1.default.formatDate(new Date(this.states[id].ts), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4554
|
+
: null),
|
|
4555
|
+
type: 'ts',
|
|
4556
|
+
} : null,
|
|
4557
|
+
(narrowStyleWithDetails && checkVisibleObjectType && ((_m = this.states[id]) === null || _m === void 0 ? void 0 : _m.lc)) || this.columnsVisibility.lastChange ? {
|
|
4558
|
+
el: react_1.default.createElement("div", { key: "lc", style: Object.assign(Object.assign({}, styles.cellRole), { width: this.props.width !== 'xs' ? this.columnsVisibility.lastChange : undefined }) }, checkVisibleObjectType && ((_o = this.states[id]) === null || _o === void 0 ? void 0 : _o.lc)
|
|
4559
|
+
? Utils_1.default.formatDate(new Date(this.states[id].lc), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4560
|
+
: null),
|
|
4561
|
+
type: 'lc',
|
|
4562
|
+
} : null,
|
|
4563
|
+
];
|
|
4564
|
+
}
|
|
4565
|
+
let colCustom = ((_p = this.adapterColumns) === null || _p === void 0 ? void 0 : _p.map(it => react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellAdapter), { width: this.props.width !== 'xs' ? this.columnsVisibility[it.id] : undefined }), key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null))) || null;
|
|
4566
|
+
const columnValue = narrowStyleWithDetails || this.columnsVisibility.val ? this.renderColumnValue(id, item, narrowStyleWithDetails) : null;
|
|
4567
|
+
let colValue = (narrowStyleWithDetails && columnValue) || this.columnsVisibility.val ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellValue), { width: this.props.width !== 'xs' ? this.columnsVisibility.val : undefined, cursor: valueEditable ? ((common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : (item.data.button ? 'grab' : 'text')) : 'default' }), onClick: valueEditable ? () => {
|
|
4568
|
+
if (!obj || !this.states) {
|
|
4569
|
+
// return;
|
|
4570
|
+
}
|
|
4571
|
+
else if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
4572
|
+
this.setState({ viewFileDialog: id });
|
|
4573
|
+
// eslint-disable-next-line brace-style
|
|
4574
|
+
}
|
|
4575
|
+
else if (!this.state.filter.expertMode && item.data.button) {
|
|
4576
|
+
// in non-expert mode control button directly
|
|
4577
|
+
this.props.socket
|
|
4578
|
+
.setState(id, true)
|
|
4579
|
+
.catch(e => window.alert(`Cannot write state "${id}": ${e}`));
|
|
4580
|
+
}
|
|
4581
|
+
else {
|
|
4582
|
+
this.edit = {
|
|
4583
|
+
val: this.states[id] ? this.states[id].val : '',
|
|
4584
|
+
q: this.states[id] ? this.states[id].q || 0 : 0,
|
|
4585
|
+
ack: false,
|
|
4586
|
+
id,
|
|
4587
|
+
};
|
|
4588
|
+
this.setState({ updateOpened: true });
|
|
4589
|
+
}
|
|
4590
|
+
} : undefined }, columnValue) : null;
|
|
4591
|
+
let colButtons = narrowStyleWithDetails || this.columnsVisibility.buttons ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellButtons), { width: this.props.width !== 'xs' ? this.columnsVisibility.buttons : undefined }) }, this.renderColumnButtons(id, item)) : null;
|
|
4592
|
+
let colDetails = null;
|
|
4593
|
+
if (this.props.width === 'xs' && this.state.focused === id) {
|
|
4594
|
+
colMiddle = colMiddle.filter(a => a);
|
|
4595
|
+
let renderedMiddle;
|
|
4596
|
+
if (!colMiddle.length) {
|
|
4597
|
+
renderedMiddle = null;
|
|
4598
|
+
}
|
|
4599
|
+
else {
|
|
4600
|
+
renderedMiddle = colMiddle.map(it => react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4601
|
+
react_1.default.createElement("span", { style: styles.cellDetailsName },
|
|
4602
|
+
this.texts[it.type],
|
|
4603
|
+
":"),
|
|
4604
|
+
it.el,
|
|
4605
|
+
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
4606
|
+
it.onClick ? react_1.default.createElement(icons_material_1.Edit, { style: styles.cellCopyButtonInDetails, onClick: () => it.onClick() }) : null));
|
|
4607
|
+
}
|
|
4608
|
+
if (!colCustom.length) {
|
|
4609
|
+
colCustom = null;
|
|
4610
|
+
}
|
|
4611
|
+
colDetails = react_1.default.createElement(material_1.Paper, { style: {
|
|
4612
|
+
width: '100%',
|
|
4613
|
+
display: 'flex',
|
|
4614
|
+
flexDirection: 'column',
|
|
4615
|
+
padding: 10,
|
|
4616
|
+
backgroundColor: this.props.theme.palette.mode === 'dark' ? '#333' : '#ccc',
|
|
4617
|
+
} },
|
|
4618
|
+
colName && react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4619
|
+
react_1.default.createElement("span", { style: styles.cellDetailsName },
|
|
4620
|
+
this.texts.name,
|
|
4621
|
+
":"),
|
|
4622
|
+
colName,
|
|
4623
|
+
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
4624
|
+
((_q = item.data) === null || _q === void 0 ? void 0 : _q.title) ? react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => { var _b; return this.onCopy(e, (_b = item.data) === null || _b === void 0 ? void 0 : _b.title); } }) : null),
|
|
4625
|
+
renderedMiddle,
|
|
4626
|
+
colCustom && react_1.default.createElement("div", { style: styles.cellDetailsLine }, colCustom),
|
|
4627
|
+
((_r = this.objects[id]) === null || _r === void 0 ? void 0 : _r.type) === 'state' && react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4628
|
+
react_1.default.createElement("span", { style: styles.cellDetailsName },
|
|
4629
|
+
this.texts.value,
|
|
4630
|
+
":"),
|
|
4631
|
+
colValue,
|
|
4632
|
+
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
4633
|
+
react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButtonInDetails, onClick: e => {
|
|
4634
|
+
const { valText } = formatValue({
|
|
4635
|
+
state: this.states[id],
|
|
4636
|
+
obj: this.objects[id],
|
|
4637
|
+
texts: this.texts,
|
|
4638
|
+
dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat,
|
|
4639
|
+
isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma,
|
|
4640
|
+
});
|
|
4641
|
+
this.onCopy(e, valText.v.toString());
|
|
4642
|
+
}, key: "cc" })),
|
|
4643
|
+
colButtons && react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellDetailsLine), { justifyContent: 'right' }) }, colButtons));
|
|
4644
|
+
colName = null;
|
|
4645
|
+
colMiddle = null;
|
|
4646
|
+
colCustom = null;
|
|
4647
|
+
colValue = null;
|
|
4648
|
+
colButtons = null;
|
|
4649
|
+
}
|
|
4650
|
+
const row = react_1.default.createElement(material_1.Grid, { container: true, direction: "row", wrap: "nowrap", sx: Utils_1.default.getStyle(this.props.theme, styles.tableRow, this.state.linesEnabled && styles.tableRowLines, !this.props.dragEnabled && styles.tableRowNoDragging, alias && styles.tableRowAlias, readWriteAlias && styles.tableRowAliasReadWrite, this.state.focused === id && this.props.multiSelect && styles.tableRowFocused, !item.data.visible && styles.filteredOut, item.data.hasVisibleParent &&
|
|
4415
4651
|
!item.data.visible &&
|
|
4416
4652
|
!item.data.hasVisibleChildren &&
|
|
4417
4653
|
styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
|
|
@@ -4442,89 +4678,13 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4442
4678
|
this.toggleExpanded(id);
|
|
4443
4679
|
}
|
|
4444
4680
|
} },
|
|
4445
|
-
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
alias,
|
|
4453
|
-
icons),
|
|
4454
|
-
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.grow), (invertBackground ? this.styles.invertedBackgroundFlex : {})) }),
|
|
4455
|
-
react_1.default.createElement(material_1.Grid, { item: true, container: true, alignItems: "center" }, iconItem),
|
|
4456
|
-
react_1.default.createElement("div", null,
|
|
4457
|
-
react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) }))),
|
|
4458
|
-
this.columnsVisibility.name ? react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign(Object.assign({}, styles.cellName), (useDesc ? styles.cellNameWithDesc : undefined)), { width: this.columnsVisibility.name }) },
|
|
4459
|
-
name,
|
|
4460
|
-
((_g = item.data) === null || _g === void 0 ? void 0 : _g.title) ? react_1.default.createElement(material_1.Box, { style: { color: checkColor } },
|
|
4461
|
-
react_1.default.createElement(IconCopy_1.default, { className: "copyButton", style: styles.cellCopyButton, onClick: e => { var _b; return this.onCopy(e, (_b = item.data) === null || _b === void 0 ? void 0 : _b.title); } })) : null) : null,
|
|
4462
|
-
!this.state.statesView ? react_1.default.createElement(react_1.default.Fragment, null,
|
|
4463
|
-
this.columnsVisibility.type ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellType), { width: this.columnsVisibility.type }) },
|
|
4464
|
-
typeImg,
|
|
4465
|
-
"\u00A0",
|
|
4466
|
-
obj && obj.type) : null,
|
|
4467
|
-
this.columnsVisibility.role ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellRole), { width: this.columnsVisibility.role, cursor: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole
|
|
4468
|
-
? 'text'
|
|
4469
|
-
: 'default' }), onClick: this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole
|
|
4470
|
-
? () => this.setState({ roleDialog: item.data.id })
|
|
4471
|
-
: undefined }, common === null || common === void 0 ? void 0 : common.role) : null,
|
|
4472
|
-
this.columnsVisibility.room ? react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.cellRoom), (item.data.per ? styles.cellEnumParent : {})), { width: this.columnsVisibility.room, cursor: enumEditable ? 'text' : 'default' }), onClick: enumEditable ? () => {
|
|
4473
|
-
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4474
|
-
this.setState({
|
|
4475
|
-
enumDialogEnums: enums,
|
|
4476
|
-
enumDialog: {
|
|
4477
|
-
item,
|
|
4478
|
-
type: 'room',
|
|
4479
|
-
enumsOriginal: JSON.stringify(enums),
|
|
4480
|
-
},
|
|
4481
|
-
});
|
|
4482
|
-
} : undefined }, item.data.rooms) : null,
|
|
4483
|
-
this.columnsVisibility.func ? react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.cellFunc), (item.data.pef ? styles.cellEnumParent : {})), { width: this.columnsVisibility.func, cursor: enumEditable ? 'text' : 'default' }), onClick: enumEditable ? () => {
|
|
4484
|
-
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4485
|
-
this.setState({
|
|
4486
|
-
enumDialogEnums: enums,
|
|
4487
|
-
enumDialog: {
|
|
4488
|
-
item,
|
|
4489
|
-
type: 'func',
|
|
4490
|
-
enumsOriginal: JSON.stringify(enums),
|
|
4491
|
-
},
|
|
4492
|
-
});
|
|
4493
|
-
} : undefined }, item.data.funcs) : null) : react_1.default.createElement(react_1.default.Fragment, null,
|
|
4494
|
-
this.columnsVisibility.changedFrom ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellRole), { width: this.columnsVisibility.changedFrom }), title: newValueTitle.join('\n') }, checkVisibleObjectType && ((_h = this.states[id]) === null || _h === void 0 ? void 0 : _h.from) ? newValue : null) : null,
|
|
4495
|
-
this.columnsVisibility.qualityCode ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellRole), { width: this.columnsVisibility.qualityCode }), title: q || '' }, q) : null,
|
|
4496
|
-
this.columnsVisibility.timestamp ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellRole), { width: this.columnsVisibility.timestamp }) }, checkVisibleObjectType && ((_j = this.states[id]) === null || _j === void 0 ? void 0 : _j.ts)
|
|
4497
|
-
? Utils_1.default.formatDate(new Date(this.states[id].ts), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4498
|
-
: null) : null,
|
|
4499
|
-
this.columnsVisibility.lastChange ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellRole), { width: this.columnsVisibility.lastChange }) }, checkVisibleObjectType && ((_k = this.states[id]) === null || _k === void 0 ? void 0 : _k.lc)
|
|
4500
|
-
? Utils_1.default.formatDate(new Date(this.states[id].lc), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4501
|
-
: null) : null),
|
|
4502
|
-
this.adapterColumns.map(it => react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellAdapter), { width: this.columnsVisibility[it.id] }), key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null)),
|
|
4503
|
-
this.columnsVisibility.val ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellValue), { width: this.columnsVisibility.val, cursor: valueEditable ? ((common === null || common === void 0 ? void 0 : common.type) === 'file' ? 'zoom-in' : (item.data.button ? 'grab' : 'text')) : 'default' }), onClick: valueEditable ? () => {
|
|
4504
|
-
if (!obj || !this.states) {
|
|
4505
|
-
// return;
|
|
4506
|
-
}
|
|
4507
|
-
else if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
4508
|
-
this.setState({ viewFileDialog: id });
|
|
4509
|
-
// eslint-disable-next-line brace-style
|
|
4510
|
-
}
|
|
4511
|
-
else if (!this.state.filter.expertMode && item.data.button) {
|
|
4512
|
-
// in non-expert mode control button directly
|
|
4513
|
-
this.props.socket
|
|
4514
|
-
.setState(id, true)
|
|
4515
|
-
.catch(e => window.alert(`Cannot write state "${id}": ${e}`));
|
|
4516
|
-
}
|
|
4517
|
-
else {
|
|
4518
|
-
this.edit = {
|
|
4519
|
-
val: this.states[id] ? this.states[id].val : '',
|
|
4520
|
-
q: this.states[id] ? this.states[id].q || 0 : 0,
|
|
4521
|
-
ack: false,
|
|
4522
|
-
id,
|
|
4523
|
-
};
|
|
4524
|
-
this.setState({ updateOpened: true });
|
|
4525
|
-
}
|
|
4526
|
-
} : undefined }, this.renderColumnValue(id, item)) : null,
|
|
4527
|
-
this.columnsVisibility.buttons ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellButtons), { width: this.columnsVisibility.buttons }) }, this.renderColumnButtons(id, item)) : null);
|
|
4681
|
+
colID,
|
|
4682
|
+
colName, colMiddle === null || colMiddle === void 0 ? void 0 :
|
|
4683
|
+
colMiddle.map(it => it === null || it === void 0 ? void 0 : it.el),
|
|
4684
|
+
colCustom,
|
|
4685
|
+
colValue,
|
|
4686
|
+
colButtons);
|
|
4687
|
+
return { row, details: colDetails };
|
|
4528
4688
|
}
|
|
4529
4689
|
/**
|
|
4530
4690
|
* Renders an item.
|
|
@@ -4532,18 +4692,25 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4532
4692
|
renderItem(root, isExpanded, counter) {
|
|
4533
4693
|
const items = [];
|
|
4534
4694
|
counter = counter || { count: 0 };
|
|
4535
|
-
|
|
4695
|
+
const result = this.renderLeaf(root, isExpanded, counter);
|
|
4696
|
+
let leaf;
|
|
4536
4697
|
const DragWrapper = this.props.DragWrapper;
|
|
4537
4698
|
if (this.props.dragEnabled && DragWrapper) {
|
|
4538
4699
|
if (root.data.sumVisibility) {
|
|
4539
|
-
leaf = react_1.default.createElement(DragWrapper, { key: root.data.id, item: root, style: styles.draggable },
|
|
4700
|
+
leaf = react_1.default.createElement(DragWrapper, { key: root.data.id, item: root, style: styles.draggable }, result.row);
|
|
4540
4701
|
}
|
|
4541
4702
|
else {
|
|
4542
4703
|
// change cursor
|
|
4543
|
-
leaf = react_1.default.createElement("div", { key: root.data.id, style: styles.nonDraggable },
|
|
4704
|
+
leaf = react_1.default.createElement("div", { key: root.data.id, style: styles.nonDraggable }, result.row);
|
|
4544
4705
|
}
|
|
4545
4706
|
}
|
|
4707
|
+
else {
|
|
4708
|
+
leaf = result.row;
|
|
4709
|
+
}
|
|
4546
4710
|
root.data.id && leaf && items.push(leaf);
|
|
4711
|
+
if (result.details) {
|
|
4712
|
+
items.push(result.details);
|
|
4713
|
+
}
|
|
4547
4714
|
isExpanded = isExpanded === undefined ? binarySearch(this.state.expanded, root.data.id) : isExpanded;
|
|
4548
4715
|
if (!root.data.id || isExpanded) {
|
|
4549
4716
|
if (!this.state.foldersFirst) {
|
|
@@ -4815,6 +4982,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4815
4982
|
react_1.default.createElement(IconClearFilter_1.default, null),
|
|
4816
4983
|
react_1.default.createElement(icons_material_1.Close, { style: styles.buttonClearFilterIcon }));
|
|
4817
4984
|
}
|
|
4985
|
+
if (this.props.width === 'xs') {
|
|
4986
|
+
return react_1.default.createElement("div", { style: styles.headerRow },
|
|
4987
|
+
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: '100%' }) }, this.getFilterInput('id')));
|
|
4988
|
+
}
|
|
4818
4989
|
return react_1.default.createElement("div", { style: styles.headerRow },
|
|
4819
4990
|
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.id, position: 'relative' }), "data-min": 240, "data-name": "id" },
|
|
4820
4991
|
this.getFilterInput('id'),
|
|
@@ -4942,7 +5113,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4942
5113
|
.catch(e => this.showError(`Cannot write object: ${e}`));
|
|
4943
5114
|
}
|
|
4944
5115
|
this.setState({ editObjectDialog: '', editObjectAlias: false });
|
|
4945
|
-
} });
|
|
5116
|
+
}, width: this.props.width });
|
|
4946
5117
|
}
|
|
4947
5118
|
renderViewObjectFileDialog() {
|
|
4948
5119
|
if (!this.state.viewFileDialog || !this.props.objectBrowserViewFile) {
|
|
@@ -5302,7 +5473,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5302
5473
|
return react_1.default.createElement(ObjectBrowserValue, { t: this.props.t, lang: this.props.lang, type: type, role: role || '', states: Utils_1.default.getStates(this.objects[this.edit.id]), themeType: this.props.themeType, theme: this.props.theme, expertMode: !!this.state.filter.expertMode, value: this.edit.val, socket: this.props.socket, object: this.objects[this.edit.id], defaultHistory: this.defaultHistory, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined ? this.systemConfig.common.isFloatComma : this.props.isFloatComma, onClose: (res) => {
|
|
5303
5474
|
this.setState({ updateOpened: false });
|
|
5304
5475
|
res && this.onUpdate(res);
|
|
5305
|
-
} });
|
|
5476
|
+
}, width: this.props.width });
|
|
5306
5477
|
}
|
|
5307
5478
|
/**
|
|
5308
5479
|
* The rendering method of this component.
|
package/README.md
CHANGED
|
@@ -771,6 +771,13 @@ The best practice is to replace `padding` with `p` and `margin` with `m`, so you
|
|
|
771
771
|
-->
|
|
772
772
|
|
|
773
773
|
## Changelog
|
|
774
|
+
### 6.0.11 (2024-06-29)
|
|
775
|
+
* (bluefox) Added support of the overrides in the theme
|
|
776
|
+
|
|
777
|
+
### 6.0.10 (2024-06-27)
|
|
778
|
+
* (bluefox) Added translation
|
|
779
|
+
* (bluefox) Mobile object browser improved
|
|
780
|
+
|
|
774
781
|
### 6.0.9 (2024-06-26)
|
|
775
782
|
* (bluefox) Corrected Icons
|
|
776
783
|
|
package/Theme.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import { type IobTheme, type ThemeName } from './types';
|
|
|
2
2
|
/**
|
|
3
3
|
* The theme creation factory function.
|
|
4
4
|
*/
|
|
5
|
-
declare
|
|
6
|
-
export default
|
|
5
|
+
declare function customTheme(type: ThemeName, overrides?: Record<string, any>): IobTheme;
|
|
6
|
+
export default customTheme;
|
package/Theme.js
CHANGED
|
@@ -67,12 +67,12 @@ overlay) {
|
|
|
67
67
|
/**
|
|
68
68
|
* The theme creation factory function.
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
function customTheme(type, overrides) {
|
|
71
71
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
72
72
|
let options;
|
|
73
|
-
let
|
|
73
|
+
let localOverrides;
|
|
74
74
|
if (type === 'dark') {
|
|
75
|
-
|
|
75
|
+
localOverrides = {
|
|
76
76
|
MuiAppBar: {
|
|
77
77
|
colorDefault: {
|
|
78
78
|
backgroundColor: '#272727',
|
|
@@ -113,7 +113,7 @@ const CustomTheme = (type) => {
|
|
|
113
113
|
};
|
|
114
114
|
}
|
|
115
115
|
else if (type === 'blue') {
|
|
116
|
-
|
|
116
|
+
localOverrides = {
|
|
117
117
|
MuiAppBar: {
|
|
118
118
|
colorDefault: {
|
|
119
119
|
backgroundColor: '#3399CC',
|
|
@@ -153,7 +153,7 @@ const CustomTheme = (type) => {
|
|
|
153
153
|
};
|
|
154
154
|
}
|
|
155
155
|
else if (type === 'colored') {
|
|
156
|
-
|
|
156
|
+
localOverrides = {
|
|
157
157
|
MuiAppBar: {
|
|
158
158
|
colorDefault: {
|
|
159
159
|
backgroundColor: '#2a3135',
|
|
@@ -186,7 +186,7 @@ const CustomTheme = (type) => {
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
else if (type === 'PT') {
|
|
189
|
-
|
|
189
|
+
localOverrides = {
|
|
190
190
|
MuiAppBar: {
|
|
191
191
|
colorDefault: {
|
|
192
192
|
backgroundColor: '#0F99DE',
|
|
@@ -218,7 +218,7 @@ const CustomTheme = (type) => {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
else if (type === 'DX') {
|
|
221
|
-
|
|
221
|
+
localOverrides = {
|
|
222
222
|
MuiAppBar: {
|
|
223
223
|
colorDefault: {
|
|
224
224
|
backgroundColor: '#a9a9a9',
|
|
@@ -255,7 +255,7 @@ const CustomTheme = (type) => {
|
|
|
255
255
|
};
|
|
256
256
|
}
|
|
257
257
|
else {
|
|
258
|
-
|
|
258
|
+
localOverrides = {
|
|
259
259
|
MuiLink: {
|
|
260
260
|
root: {
|
|
261
261
|
textTransform: 'uppercase',
|
|
@@ -302,8 +302,7 @@ const CustomTheme = (type) => {
|
|
|
302
302
|
}
|
|
303
303
|
const theme = (0, styles_1.createTheme)(options);
|
|
304
304
|
const palette = theme.palette;
|
|
305
|
-
return (0, styles_1.createTheme)(theme, {
|
|
306
|
-
components: Object.assign(Object.assign({}, overrides), { MuiButton: {
|
|
305
|
+
return (0, styles_1.createTheme)(theme, Object.assign(Object.assign({}, (overrides || undefined)), { components: Object.assign(Object.assign(Object.assign({}, localOverrides), { MuiButton: {
|
|
307
306
|
variants: [
|
|
308
307
|
{
|
|
309
308
|
props: { variant: 'contained', color: 'grey' },
|
|
@@ -339,7 +338,6 @@ const CustomTheme = (type) => {
|
|
|
339
338
|
},
|
|
340
339
|
},
|
|
341
340
|
],
|
|
342
|
-
} }),
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
exports.default = CustomTheme;
|
|
341
|
+
} }), ((overrides === null || overrides === void 0 ? void 0 : overrides.components) || undefined)) }));
|
|
342
|
+
}
|
|
343
|
+
exports.default = customTheme;
|
package/i18n/de.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Erweiterte Optionen",
|
|
426
426
|
"sc_everyN_dow": "jeden x-ten Tag der Woche",
|
|
427
427
|
"sc_every_dow": "jeden Tag der Woche",
|
|
428
|
-
"sc_specific_dow": "bestimmte(r) Tag(e) der Woche"
|
|
428
|
+
"sc_specific_dow": "bestimmte(r) Tag(e) der Woche",
|
|
429
|
+
"ra_Name": "Name"
|
|
429
430
|
}
|
package/i18n/en.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_create_boolean_state": "Create boolean state",
|
|
426
426
|
"ra_Select color": "Select color",
|
|
427
427
|
"ra_Cannot read licenses: %s": "Cannot read licenses: %s",
|
|
428
|
-
"ra_Advanced options": "Advanced options"
|
|
428
|
+
"ra_Advanced options": "Advanced options",
|
|
429
|
+
"ra_Name": "Name"
|
|
429
430
|
}
|
package/i18n/es.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Opciones avanzadas",
|
|
426
426
|
"sc_everyN_dow": "cada enésimo día de la semana",
|
|
427
427
|
"sc_every_dow": "Cada día de la semana",
|
|
428
|
-
"sc_specific_dow": "día(s) específico(s) de la semana"
|
|
428
|
+
"sc_specific_dow": "día(s) específico(s) de la semana",
|
|
429
|
+
"ra_Name": "Nombre"
|
|
429
430
|
}
|
package/i18n/fr.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Options avancées",
|
|
426
426
|
"sc_everyN_dow": "chaque Nième jour de la semaine",
|
|
427
427
|
"sc_every_dow": "Chaque jour de la semaine",
|
|
428
|
-
"sc_specific_dow": "jour(s) spécifique(s) de la semaine"
|
|
428
|
+
"sc_specific_dow": "jour(s) spécifique(s) de la semaine",
|
|
429
|
+
"ra_Name": "Nom"
|
|
429
430
|
}
|
package/i18n/it.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Opzioni avanzate",
|
|
426
426
|
"sc_everyN_dow": "ogni Nesimo giorno della settimana",
|
|
427
427
|
"sc_every_dow": "Tutti i giorni della settimana",
|
|
428
|
-
"sc_specific_dow": "giorno/i specifico/i della settimana"
|
|
428
|
+
"sc_specific_dow": "giorno/i specifico/i della settimana",
|
|
429
|
+
"ra_Name": "Nome"
|
|
429
430
|
}
|
package/i18n/nl.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Geavanceerde mogelijkheden",
|
|
426
426
|
"sc_everyN_dow": "elke N-de dag van de week",
|
|
427
427
|
"sc_every_dow": "elke dag van de week",
|
|
428
|
-
"sc_specific_dow": "specifieke dag(en) van de week"
|
|
428
|
+
"sc_specific_dow": "specifieke dag(en) van de week",
|
|
429
|
+
"ra_Name": "Naam"
|
|
429
430
|
}
|
package/i18n/pl.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Zaawansowane opcje",
|
|
426
426
|
"sc_everyN_dow": "w każdy N-ty dzień tygodnia",
|
|
427
427
|
"sc_every_dow": "każdy dzień tygodnia",
|
|
428
|
-
"sc_specific_dow": "określone dni tygodnia"
|
|
428
|
+
"sc_specific_dow": "określone dni tygodnia",
|
|
429
|
+
"ra_Name": "Nazwa"
|
|
429
430
|
}
|
package/i18n/pt.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Opções avançadas",
|
|
426
426
|
"sc_everyN_dow": "todo enésimo dia da semana",
|
|
427
427
|
"sc_every_dow": "todos os dias da semana",
|
|
428
|
-
"sc_specific_dow": "dia(s) específico(s) da semana"
|
|
428
|
+
"sc_specific_dow": "dia(s) específico(s) da semana",
|
|
429
|
+
"ra_Name": "Nome"
|
|
429
430
|
}
|
package/i18n/ru.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Расширенные настройки",
|
|
426
426
|
"sc_everyN_dow": "каждый N-й день недели",
|
|
427
427
|
"sc_every_dow": "Каждый день недели",
|
|
428
|
-
"sc_specific_dow": "конкретный день(а) недели"
|
|
428
|
+
"sc_specific_dow": "конкретный день(а) недели",
|
|
429
|
+
"ra_Name": "Имя"
|
|
429
430
|
}
|
package/i18n/uk.json
CHANGED
|
@@ -425,5 +425,6 @@
|
|
|
425
425
|
"ra_Advanced options": "Розширені опції",
|
|
426
426
|
"sc_everyN_dow": "кожен N-й день тижня",
|
|
427
427
|
"sc_every_dow": "кожен день тижня",
|
|
428
|
-
"sc_specific_dow": "конкретний день (дні) тижня"
|
|
428
|
+
"sc_specific_dow": "конкретний день (дні) тижня",
|
|
429
|
+
"ra_Name": "Ім'я"
|
|
429
430
|
}
|
package/i18n/zh-cn.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/adapter-react-v5",
|
|
3
|
-
"version": "6.0.
|
|
3
|
+
"version": "6.0.11",
|
|
4
4
|
"description": "React classes to develop admin interfaces for ioBroker with react.",
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "Denis Haev (bluefox)",
|
|
@@ -30,13 +30,13 @@
|
|
|
30
30
|
"@emotion/react": "^11.11.4",
|
|
31
31
|
"@emotion/styled": "^11.11.5",
|
|
32
32
|
"@iobroker/socket-client": "^2.4.18",
|
|
33
|
-
"@iobroker/types": "^6.0.
|
|
33
|
+
"@iobroker/types": "^6.0.6-alpha.0-20240624-92c3310c8",
|
|
34
34
|
"@iobroker/js-controller-common": "^6.0.5",
|
|
35
35
|
"@iobroker/js-controller-common-db": "^6.0.5",
|
|
36
|
-
"@mui/icons-material": "^5.15.
|
|
37
|
-
"@mui/material": "^5.15.
|
|
38
|
-
"@mui/x-date-pickers": "^7.
|
|
39
|
-
"@sentry/browser": "^8.
|
|
36
|
+
"@mui/icons-material": "^5.15.21",
|
|
37
|
+
"@mui/material": "^5.15.21",
|
|
38
|
+
"@mui/x-date-pickers": "^7.8.0",
|
|
39
|
+
"@sentry/browser": "^8.13.0",
|
|
40
40
|
"react-color": "^2.19.3",
|
|
41
41
|
"react-colorful": "^5.6.1",
|
|
42
42
|
"react-cropper": "^2.3.3",
|