@iobroker/adapter-react-v5 7.6.18 → 7.6.20
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/build/Components/DeviceType/DeviceTypeIcon.js +3 -2
- package/build/Components/DeviceType/DeviceTypeIcon.js.map +1 -1
- package/build/Components/DeviceType/DeviceTypeSelector.js +2 -1
- package/build/Components/DeviceType/DeviceTypeSelector.js.map +1 -1
- package/build/Components/DeviceType/deviceTypeTranslations.js +16 -12
- package/build/Components/DeviceType/deviceTypeTranslations.js.map +1 -1
- package/build/Components/ObjectBrowser.d.ts +3 -0
- package/build/Components/ObjectBrowser.js +104 -70
- package/build/Components/ObjectBrowser.js.map +1 -1
- package/build/Components/Schedule.js +10 -9
- package/build/Components/Schedule.js.map +1 -1
- package/build/Components/SelectWithIcon.js +6 -2
- package/build/Components/SelectWithIcon.js.map +1 -1
- package/build/Components/ToggleThemeMenu.d.ts +1 -1
- package/build/Components/ToggleThemeMenu.js.map +1 -1
- package/build/LegacyConnection.js.map +1 -1
- package/build/i18n/de.json +1 -0
- package/build/i18n/en.json +1 -0
- package/build/i18n/es.json +1 -0
- package/build/i18n/fr.json +1 -0
- package/build/i18n/it.json +1 -0
- package/build/i18n/nl.json +1 -0
- package/build/i18n/pl.json +1 -0
- package/build/i18n/pt.json +1 -0
- package/build/i18n/ru.json +1 -0
- package/build/i18n/uk.json +1 -0
- package/build/i18n/zh-cn.json +1 -0
- package/build/modulefederation.admin.config.d.ts +1 -1
- package/build/modulefederation.admin.config.js +1 -1
- package/build/modulefederation.admin.config.js.map +1 -1
- package/i18n/de.json +1 -0
- package/i18n/en.json +1 -0
- package/i18n/es.json +1 -0
- package/i18n/fr.json +1 -0
- package/i18n/it.json +1 -0
- package/i18n/nl.json +1 -0
- package/i18n/pl.json +1 -0
- package/i18n/pt.json +1 -0
- package/i18n/ru.json +1 -0
- package/i18n/uk.json +1 -0
- package/i18n/zh-cn.json +1 -0
- package/package.json +10 -10
|
@@ -715,6 +715,14 @@ function ButtonIcon(props) {
|
|
|
715
715
|
React.createElement("path", { d: "m195.23077,24.30769c-36,3 -67,12 -96,26c-49,24 -82,61 -93,104l-3,11l-1,50c0,46 0,49 2,59l5,20c21,58 84,103 165,116c16,3 53,4 70,2c60,-6 111,-28 147,-64c21,-21 36,-49 40,-74a866,866 0 0 0 1,-104c-3,-18 -6,-28 -13,-43c-26,-52 -87,-90 -162,-101c-16,-2 -48,-3 -63,-2l1,0zm60,23c36,5 70,18 95,35c31,20 51,47 59,77c2,7 2,11 2,25c1,15 0,18 -2,26c-19,69 -104,117 -200,114c-47,-2 -90,-15 -124,-38c-31,-20 -51,-47 -59,-77c-3,-11 -4,-32 -2,-43c8,-42 41,-78 91,-101a260,260 0 0 1 140,-19l0,1zm-221,222c21,26 57,49 95,62c81,27 174,14 239,-32c14,-10 31,-27 41,-41c2,-2 2,-2 2,7c-1,23 -16,50 -38,72c-78,74 -233,74 -311,-1a121,121 0 0 1 -39,-76l0,-6l3,4l8,11z" }),
|
|
716
716
|
React.createElement("path", { d: "m201.23077,47.30769c-40,3 -79,19 -104,44c-55,55 -38,133 37,171c52,26 122,24 172,-5c30,-17 51,-42 58,-71c3,-11 3,-34 0,-45c-6,-23 -21,-44 -40,-60l-27,-16a184,184 0 0 0 -96,-18zm30,21c56,5 100,35 112,75c4,11 4,30 0,41c-8,25 -26,45 -54,59a166,166 0 0 1 -160,-8a98,98 0 0 1 -41,-53c-5,-18 -2,-39 8,-57c23,-39 79,-62 135,-57z" }))));
|
|
717
717
|
}
|
|
718
|
+
/** Converts ioB pattern into regex */
|
|
719
|
+
export function pattern2RegEx(pattern) {
|
|
720
|
+
pattern = (pattern || '').toString();
|
|
721
|
+
const startsWithWildcard = pattern[0] === '*';
|
|
722
|
+
const endsWithWildcard = pattern[pattern.length - 1] === '*';
|
|
723
|
+
pattern = pattern.replace(/[-/\\^$+?.()|[\]{}]/g, '\\$&').replace(/\*/g, '.*');
|
|
724
|
+
return (startsWithWildcard ? '' : '^') + pattern + (endsWithWildcard ? '' : '$');
|
|
725
|
+
}
|
|
718
726
|
/**
|
|
719
727
|
* Function that walks through all keys of an object or array and applies a function to each key.
|
|
720
728
|
*/
|
|
@@ -820,7 +828,7 @@ options) {
|
|
|
820
828
|
}
|
|
821
829
|
// d=data, t=target, s=start, e=end, m=middle
|
|
822
830
|
function binarySearch(list, find, _start, _end) {
|
|
823
|
-
_start
|
|
831
|
+
_start ||= 0;
|
|
824
832
|
if (_end === undefined) {
|
|
825
833
|
_end = list.length - 1;
|
|
826
834
|
if (!_end) {
|
|
@@ -853,10 +861,10 @@ function getName(name, lang) {
|
|
|
853
861
|
}
|
|
854
862
|
export function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
855
863
|
// `admin` has prefix '.' and `web` has '../..'
|
|
856
|
-
imagePrefix
|
|
864
|
+
imagePrefix ||= '.'; // http://localhost:8081';
|
|
857
865
|
let src = '';
|
|
858
866
|
const _id_ = `system.adapter.${id}`;
|
|
859
|
-
const aIcon = id && objects[_id_]
|
|
867
|
+
const aIcon = id && objects[_id_]?.common?.icon;
|
|
860
868
|
if (aIcon) {
|
|
861
869
|
// if not BASE64
|
|
862
870
|
if (!aIcon.startsWith('data:image/')) {
|
|
@@ -940,15 +948,27 @@ export function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
|
940
948
|
return src || null;
|
|
941
949
|
}
|
|
942
950
|
function applyFilter(item, filters, lang, objects, context, counter, customFilter, selectedTypes, _depth) {
|
|
943
|
-
_depth
|
|
951
|
+
_depth ||= 0;
|
|
944
952
|
let filteredOut = false;
|
|
945
953
|
if (!context) {
|
|
946
954
|
context = {};
|
|
947
955
|
if (filters.id) {
|
|
948
|
-
|
|
956
|
+
const id = filters.id.toLowerCase();
|
|
957
|
+
if (id.includes('*')) {
|
|
958
|
+
context.idRx = new RegExp(pattern2RegEx(filters.id), 'i');
|
|
959
|
+
}
|
|
960
|
+
else {
|
|
961
|
+
context.id = id;
|
|
962
|
+
}
|
|
949
963
|
}
|
|
950
964
|
if (filters.name) {
|
|
951
|
-
|
|
965
|
+
const name = filters.name.toLowerCase();
|
|
966
|
+
if (name.includes('*')) {
|
|
967
|
+
context.nameRx = new RegExp(pattern2RegEx(name), 'i');
|
|
968
|
+
}
|
|
969
|
+
else {
|
|
970
|
+
context.name = name;
|
|
971
|
+
}
|
|
952
972
|
}
|
|
953
973
|
if (filters.type) {
|
|
954
974
|
context.type = filters.type.toLowerCase();
|
|
@@ -1056,10 +1076,13 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1056
1076
|
}
|
|
1057
1077
|
filteredOut = !data.fID.includes(context.id);
|
|
1058
1078
|
}
|
|
1079
|
+
if (!filteredOut && context.idRx) {
|
|
1080
|
+
filteredOut = !context.idRx.test(data.id);
|
|
1081
|
+
}
|
|
1059
1082
|
if (!filteredOut && context.name) {
|
|
1060
1083
|
if (common) {
|
|
1061
1084
|
if (data.fName === undefined) {
|
|
1062
|
-
data.fName =
|
|
1085
|
+
data.fName = getName(common.name, lang) || '';
|
|
1063
1086
|
data.fName = data.fName.toLowerCase();
|
|
1064
1087
|
}
|
|
1065
1088
|
filteredOut = !data.fName.includes(context.name);
|
|
@@ -1068,6 +1091,15 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1068
1091
|
filteredOut = true;
|
|
1069
1092
|
}
|
|
1070
1093
|
}
|
|
1094
|
+
if (!filteredOut && context.nameRx) {
|
|
1095
|
+
if (common) {
|
|
1096
|
+
if (data.fName === undefined) {
|
|
1097
|
+
data.fName = getName(common.name, lang) || '';
|
|
1098
|
+
data.fName = data.fName.toLowerCase();
|
|
1099
|
+
}
|
|
1100
|
+
filteredOut = !context.nameRx.test(data.fName);
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1071
1103
|
if (!filteredOut && filters.role && common) {
|
|
1072
1104
|
if (common) {
|
|
1073
1105
|
filteredOut = !(typeof common.role === 'string' && common.role.startsWith(context.role));
|
|
@@ -1094,7 +1126,7 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1094
1126
|
filteredOut = !!common.custom;
|
|
1095
1127
|
}
|
|
1096
1128
|
else {
|
|
1097
|
-
filteredOut = !common.custom
|
|
1129
|
+
filteredOut = !common.custom?.[context.custom];
|
|
1098
1130
|
}
|
|
1099
1131
|
}
|
|
1100
1132
|
else {
|
|
@@ -1124,7 +1156,7 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1124
1156
|
return data.visible || data.hasVisibleChildren;
|
|
1125
1157
|
}
|
|
1126
1158
|
function getVisibleItems(item, type, objects, _result) {
|
|
1127
|
-
_result
|
|
1159
|
+
_result ||= [];
|
|
1128
1160
|
const data = item.data;
|
|
1129
1161
|
if (data.sumVisibility) {
|
|
1130
1162
|
if (data.id && objects[data.id] && (!type || objects[data.id].type === type)) {
|
|
@@ -1324,7 +1356,7 @@ function buildTree(objects, options) {
|
|
|
1324
1356
|
generated: true,
|
|
1325
1357
|
},
|
|
1326
1358
|
};
|
|
1327
|
-
cRoot.children
|
|
1359
|
+
cRoot.children ||= [];
|
|
1328
1360
|
cRoot.children.push(_cRoot);
|
|
1329
1361
|
cRoot = _cRoot;
|
|
1330
1362
|
info.ids.push(curPath); // IDs will be added by alphabet
|
|
@@ -1360,7 +1392,7 @@ function buildTree(objects, options) {
|
|
|
1360
1392
|
obj.common.role.startsWith('url'),
|
|
1361
1393
|
},
|
|
1362
1394
|
};
|
|
1363
|
-
cRoot.children
|
|
1395
|
+
cRoot.children ||= [];
|
|
1364
1396
|
cRoot.children.push(_cRoot);
|
|
1365
1397
|
cRoot = _cRoot;
|
|
1366
1398
|
currentPathLen = parts.length;
|
|
@@ -1449,7 +1481,7 @@ function findNode(root, id, _parts, _path, _level) {
|
|
|
1449
1481
|
}
|
|
1450
1482
|
}
|
|
1451
1483
|
if (found) {
|
|
1452
|
-
_level
|
|
1484
|
+
_level ||= 0;
|
|
1453
1485
|
return findNode(found, id, _parts, `${_path}.${_parts[_level + 1]}`, _level + 1);
|
|
1454
1486
|
}
|
|
1455
1487
|
return null;
|
|
@@ -1458,7 +1490,7 @@ function findRoomsForObject(info, id, lang, rooms) {
|
|
|
1458
1490
|
if (!id) {
|
|
1459
1491
|
return { rooms: [], per: false };
|
|
1460
1492
|
}
|
|
1461
|
-
rooms
|
|
1493
|
+
rooms ||= [];
|
|
1462
1494
|
for (const room of info.roomEnums) {
|
|
1463
1495
|
const common = info.objects[room]?.common;
|
|
1464
1496
|
if (!common) {
|
|
@@ -1484,7 +1516,7 @@ function findEnumsForObjectAsIds(info, id, enumName, funcs) {
|
|
|
1484
1516
|
if (!id) {
|
|
1485
1517
|
return [];
|
|
1486
1518
|
}
|
|
1487
|
-
funcs
|
|
1519
|
+
funcs ||= [];
|
|
1488
1520
|
for (let i = 0; i < info[enumName].length; i++) {
|
|
1489
1521
|
const common = info.objects[info[enumName][i]]?.common;
|
|
1490
1522
|
if (common?.members?.includes(id) && !funcs.includes(info[enumName][i])) {
|
|
@@ -1498,7 +1530,7 @@ function findFunctionsForObject(info, id, lang, funcs) {
|
|
|
1498
1530
|
if (!id) {
|
|
1499
1531
|
return { funcs: [], pef: false };
|
|
1500
1532
|
}
|
|
1501
|
-
funcs
|
|
1533
|
+
funcs ||= [];
|
|
1502
1534
|
for (let i = 0; i < info.funcEnums.length; i++) {
|
|
1503
1535
|
const common = info.objects[info.funcEnums[i]]?.common;
|
|
1504
1536
|
if (!common) {
|
|
@@ -1696,8 +1728,8 @@ function prepareSparkData(values, from) {
|
|
|
1696
1728
|
}
|
|
1697
1729
|
else {
|
|
1698
1730
|
// remove nulls
|
|
1699
|
-
values[i - 1].val
|
|
1700
|
-
values[i].val
|
|
1731
|
+
values[i - 1].val ||= 0;
|
|
1732
|
+
values[i].val ||= 0;
|
|
1701
1733
|
// interpolate
|
|
1702
1734
|
const nm1 = values[i - 1].val;
|
|
1703
1735
|
const n = values[i].val;
|
|
@@ -2197,7 +2229,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2197
2229
|
this.objects = {};
|
|
2198
2230
|
const propsTypes = props.types;
|
|
2199
2231
|
Object.keys(objects).forEach(id => {
|
|
2200
|
-
const type = objects[id]
|
|
2232
|
+
const type = objects[id]?.type;
|
|
2201
2233
|
// include "folder" types too
|
|
2202
2234
|
if (type &&
|
|
2203
2235
|
(type === 'channel' ||
|
|
@@ -2240,7 +2272,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2240
2272
|
this.root = root;
|
|
2241
2273
|
this.info = info;
|
|
2242
2274
|
// Show first selected item
|
|
2243
|
-
const node = this.state.selected
|
|
2275
|
+
const node = this.state.selected?.length && findNode(this.root, this.state.selected[0]);
|
|
2244
2276
|
this.lastAppliedFilter = null;
|
|
2245
2277
|
// If the selected ID is not visible, reset filter
|
|
2246
2278
|
if (node &&
|
|
@@ -2299,18 +2331,20 @@ export class ObjectBrowserClass extends Component {
|
|
|
2299
2331
|
if (this.selectFirst && this.selectFirst !== this.state.selected[0]) {
|
|
2300
2332
|
this.selectFirst = '';
|
|
2301
2333
|
}
|
|
2334
|
+
// If the this.state.selected[0] filtered out, disable the filter
|
|
2335
|
+
const item = this.findItem(this.state.selected[0]);
|
|
2336
|
+
if (item?.data && !item.data.visible) {
|
|
2337
|
+
// If the selected ID is not visible, reset filter
|
|
2338
|
+
this.clearFilter();
|
|
2339
|
+
}
|
|
2302
2340
|
if (this.state.selected.length === 1 && this.objects[this.state.selected[0]]) {
|
|
2303
2341
|
const name = Utils.getObjectName(this.objects, this.state.selected[0], null, {
|
|
2304
2342
|
language: this.props.lang,
|
|
2305
2343
|
});
|
|
2306
|
-
|
|
2307
|
-
this.props.onSelect(this.state.selected, name, isDouble);
|
|
2308
|
-
}
|
|
2344
|
+
this.props.onSelect?.(this.state.selected, name, isDouble);
|
|
2309
2345
|
}
|
|
2310
2346
|
else if (this.state.selected.length === 1 && this.props.allowNonObjects) {
|
|
2311
|
-
|
|
2312
|
-
this.props.onSelect(this.state.selected, null, isDouble);
|
|
2313
|
-
}
|
|
2347
|
+
this.props.onSelect?.(this.state.selected, null, isDouble);
|
|
2314
2348
|
}
|
|
2315
2349
|
}
|
|
2316
2350
|
else {
|
|
@@ -2430,9 +2464,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2430
2464
|
break;
|
|
2431
2465
|
}
|
|
2432
2466
|
}
|
|
2433
|
-
|
|
2434
|
-
this.props.onObjectDelete(id, !!item.children?.length, !obj.common?.dontDelete, count + 1);
|
|
2435
|
-
}
|
|
2467
|
+
this.props.onObjectDelete?.(id, !!item.children?.length, !obj.common?.dontDelete, count + 1);
|
|
2436
2468
|
}
|
|
2437
2469
|
/**
|
|
2438
2470
|
* Context menu handler.
|
|
@@ -2615,28 +2647,27 @@ export class ObjectBrowserClass extends Component {
|
|
|
2615
2647
|
this.state.columnsForAdmin &&
|
|
2616
2648
|
Object.keys(this.state.columnsForAdmin)
|
|
2617
2649
|
.sort()
|
|
2618
|
-
.map(adapter => this.state.columnsForAdmin
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
columns.splice(pos, 1);
|
|
2630
|
-
}
|
|
2631
|
-
this.calculateColumnsVisibility(null, columns);
|
|
2632
|
-
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2633
|
-
this.setState({ columns });
|
|
2650
|
+
.map(adapter => this.state.columnsForAdmin?.[adapter].map(column => (React.createElement(ListItemButton, { onClick: () => {
|
|
2651
|
+
if (!this.state.columnsAuto) {
|
|
2652
|
+
const columns = [...(this.state.columns || [])];
|
|
2653
|
+
const id = `_${adapter}_${column.path}`;
|
|
2654
|
+
const pos = columns.indexOf(id);
|
|
2655
|
+
if (pos === -1) {
|
|
2656
|
+
columns.push(id);
|
|
2657
|
+
columns.sort();
|
|
2658
|
+
}
|
|
2659
|
+
else {
|
|
2660
|
+
columns.splice(pos, 1);
|
|
2634
2661
|
}
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
|
|
2638
|
-
|
|
2639
|
-
|
|
2662
|
+
this.calculateColumnsVisibility(null, columns);
|
|
2663
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2664
|
+
this.setState({ columns });
|
|
2665
|
+
}
|
|
2666
|
+
}, key: `${adapter}_${column.name}` },
|
|
2667
|
+
React.createElement(ListItemIcon, null,
|
|
2668
|
+
React.createElement(Checkbox, { disabled: this.state.columnsAuto, edge: "start", checked: !this.state.columnsAuto &&
|
|
2669
|
+
this.state.columns?.includes(`_${adapter}_${column.path}`), disableRipple: true })),
|
|
2670
|
+
React.createElement(ListItemText, { primary: `${column.name} (${adapter})` }))))),
|
|
2640
2671
|
this._renderDefinedList(true))),
|
|
2641
2672
|
React.createElement(DialogActions, null,
|
|
2642
2673
|
React.createElement(Button, { variant: "contained", onClick: () => this.setState({ columnsSelectorShow: false }), color: "primary", startIcon: React.createElement(IconClose, null) }, this.texts.close))));
|
|
@@ -2669,8 +2700,8 @@ export class ObjectBrowserClass extends Component {
|
|
|
2669
2700
|
* Find an item.
|
|
2670
2701
|
*/
|
|
2671
2702
|
findItem(id, _parts, _root, _partyId) {
|
|
2672
|
-
_parts
|
|
2673
|
-
_root
|
|
2703
|
+
_parts ||= id.split('.');
|
|
2704
|
+
_root ||= this.root;
|
|
2674
2705
|
if (!_root || !_parts.length) {
|
|
2675
2706
|
return null;
|
|
2676
2707
|
}
|
|
@@ -2722,7 +2753,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2722
2753
|
}
|
|
2723
2754
|
};
|
|
2724
2755
|
parseObjectForAdmins(columnsForAdmin, obj) {
|
|
2725
|
-
if (obj.common
|
|
2756
|
+
if (obj.common?.adminColumns && obj.common.name) {
|
|
2726
2757
|
const columns = obj.common.adminColumns;
|
|
2727
2758
|
let aColumns;
|
|
2728
2759
|
if (columns && typeof columns !== 'object') {
|
|
@@ -2774,8 +2805,8 @@ export class ObjectBrowserClass extends Component {
|
|
|
2774
2805
|
else {
|
|
2775
2806
|
cColumns = null;
|
|
2776
2807
|
}
|
|
2777
|
-
if (cColumns
|
|
2778
|
-
columnsForAdmin
|
|
2808
|
+
if (cColumns?.length) {
|
|
2809
|
+
columnsForAdmin ||= {};
|
|
2779
2810
|
columnsForAdmin[obj.common.name] = cColumns.sort((a, b) => a.path > b.path ? -1 : a.path < b.path ? 1 : 0);
|
|
2780
2811
|
}
|
|
2781
2812
|
}
|
|
@@ -2908,7 +2939,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2908
2939
|
newInnerState = { columnsForAdmin };
|
|
2909
2940
|
}
|
|
2910
2941
|
}
|
|
2911
|
-
this.objects
|
|
2942
|
+
this.objects ||= {};
|
|
2912
2943
|
if (obj) {
|
|
2913
2944
|
this.objects[id] = obj;
|
|
2914
2945
|
}
|
|
@@ -2957,7 +2988,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2957
2988
|
this.filterTimer = null;
|
|
2958
2989
|
const filter = { ...this.state.filter };
|
|
2959
2990
|
Object.keys(this.filterRefs).forEach(_name => {
|
|
2960
|
-
if (this.filterRefs[_name]
|
|
2991
|
+
if (this.filterRefs[_name]?.current) {
|
|
2961
2992
|
const filterRef = this.filterRefs[_name].current;
|
|
2962
2993
|
for (let i = 0; i < filterRef.children.length; i++) {
|
|
2963
2994
|
if (filterRef.children[i].tagName === 'INPUT') {
|
|
@@ -2981,7 +3012,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2981
3012
|
clearFilter() {
|
|
2982
3013
|
const filter = { ...this.state.filter };
|
|
2983
3014
|
Object.keys(this.filterRefs).forEach(name => {
|
|
2984
|
-
if (this.filterRefs[name]
|
|
3015
|
+
if (this.filterRefs[name]?.current) {
|
|
2985
3016
|
const filterRef = this.filterRefs[name].current;
|
|
2986
3017
|
for (let i = 0; i < filterRef.childNodes.length; i++) {
|
|
2987
3018
|
const item = filterRef.childNodes[i];
|
|
@@ -2995,7 +3026,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
2995
3026
|
});
|
|
2996
3027
|
if (JSON.stringify(this.state.filter) !== JSON.stringify(filter)) {
|
|
2997
3028
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectFilter`, JSON.stringify(filter));
|
|
2998
|
-
this.setState({ filter, filterKey: this.state.filterKey + 1 }, () => this.props.onFilterChanged
|
|
3029
|
+
this.setState({ filter, filterKey: this.state.filterKey + 1 }, () => this.props.onFilterChanged?.(filter));
|
|
2999
3030
|
}
|
|
3000
3031
|
}
|
|
3001
3032
|
isFilterEmpty() {
|
|
@@ -3003,7 +3034,9 @@ export class ObjectBrowserClass extends Component {
|
|
|
3003
3034
|
return !someNotEmpty;
|
|
3004
3035
|
}
|
|
3005
3036
|
getFilterInput(filterName) {
|
|
3006
|
-
return (React.createElement(FormControl, { sx: this.styles.filterInput, key: `${filterName}_${this.state.filterKey}`,
|
|
3037
|
+
return (React.createElement(FormControl, { sx: this.styles.filterInput, key: `${filterName}_${this.state.filterKey}`, title: filterName === 'name' || filterName === 'id'
|
|
3038
|
+
? this.props.t('ra_You can use * as wildcard')
|
|
3039
|
+
: undefined,
|
|
3007
3040
|
// style={{ marginTop: 0, marginBottom: 0 }}
|
|
3008
3041
|
margin: "dense" },
|
|
3009
3042
|
React.createElement(Input, { ref: this.filterRefs[filterName], classes: { underline: 'no-underline' }, id: filterName, placeholder: this.texts[`filter_${filterName}`], defaultValue: this.state.filter[filterName] || '', onChange: () => {
|
|
@@ -3100,7 +3133,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
3100
3133
|
}
|
|
3101
3134
|
onExpandAll(root, expanded) {
|
|
3102
3135
|
const _root = root || this.root;
|
|
3103
|
-
expanded
|
|
3136
|
+
expanded ||= [];
|
|
3104
3137
|
_root?.children?.forEach((item) => {
|
|
3105
3138
|
if (item.data.sumVisibility) {
|
|
3106
3139
|
expanded.push(item.data.id);
|
|
@@ -3119,7 +3152,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
3119
3152
|
this.setState({ expanded: [], depth: 0, selected: [] }, () => this.onAfterSelect());
|
|
3120
3153
|
}
|
|
3121
3154
|
expandDepth(root, depth, expanded) {
|
|
3122
|
-
root
|
|
3155
|
+
root ||= this.root;
|
|
3123
3156
|
if (depth > 0) {
|
|
3124
3157
|
root.children?.forEach(item => {
|
|
3125
3158
|
if (item.data.sumVisibility) {
|
|
@@ -3210,15 +3243,15 @@ export class ObjectBrowserClass extends Component {
|
|
|
3210
3243
|
native: {},
|
|
3211
3244
|
type: 'enum',
|
|
3212
3245
|
};
|
|
3213
|
-
oldObj.common
|
|
3246
|
+
oldObj.common ||= {};
|
|
3214
3247
|
oldObj.common.members = [objId];
|
|
3215
3248
|
oldObj.type = 'enum';
|
|
3216
3249
|
await this.props.socket.setObject(id, oldObj);
|
|
3217
3250
|
}
|
|
3218
3251
|
else if (!oldObj.common?.members?.includes(objId)) {
|
|
3219
|
-
oldObj.common
|
|
3252
|
+
oldObj.common ||= {};
|
|
3220
3253
|
oldObj.type = 'enum';
|
|
3221
|
-
oldObj.common.members
|
|
3254
|
+
oldObj.common.members ||= [];
|
|
3222
3255
|
// add the missing object
|
|
3223
3256
|
oldObj.common.members.push(objId);
|
|
3224
3257
|
oldObj.common.members.sort();
|
|
@@ -3236,7 +3269,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
3236
3269
|
let enums = null;
|
|
3237
3270
|
let val;
|
|
3238
3271
|
let ack;
|
|
3239
|
-
if (obj
|
|
3272
|
+
if (obj?.common?.enums) {
|
|
3240
3273
|
enums = obj.common.enums;
|
|
3241
3274
|
delete obj.common.enums;
|
|
3242
3275
|
}
|
|
@@ -3759,7 +3792,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
3759
3792
|
...styles.cellButtonMinWidth,
|
|
3760
3793
|
}, onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3761
3794
|
React.createElement("div", { style: { height: 15 } }, "---"))) : null,
|
|
3762
|
-
this.props.onObjectDelete && item.children
|
|
3795
|
+
this.props.onObjectDelete && item.children?.length ? (React.createElement(IconButton, { sx: {
|
|
3763
3796
|
...styles.cellButtonsButton,
|
|
3764
3797
|
...styles.cellButtonsButtonAlone,
|
|
3765
3798
|
}, size: "small", "aria-label": "delete", title: this.texts.deleteObject, onClick: () => {
|
|
@@ -3947,6 +3980,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
3947
3980
|
}
|
|
3948
3981
|
/**
|
|
3949
3982
|
* This function renders the value in different forms in the table
|
|
3983
|
+
*
|
|
3950
3984
|
* @param id state ID
|
|
3951
3985
|
* @param item Item
|
|
3952
3986
|
* @param narrowStyleWithDetails if use mobile view
|
|
@@ -4045,7 +4079,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
4045
4079
|
} }, val)));
|
|
4046
4080
|
}
|
|
4047
4081
|
_syncEnum(id, enumIds, newArray, cb) {
|
|
4048
|
-
if (!enumIds
|
|
4082
|
+
if (!enumIds?.length) {
|
|
4049
4083
|
if (cb) {
|
|
4050
4084
|
cb();
|
|
4051
4085
|
}
|
|
@@ -4070,7 +4104,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
4070
4104
|
if (newArray.includes(enumId) && !this.info.objects[enumId].common.members?.includes(id)) {
|
|
4071
4105
|
// add to object
|
|
4072
4106
|
const obj = JSON.parse(JSON.stringify(this.info.objects[enumId]));
|
|
4073
|
-
obj.common.members
|
|
4107
|
+
obj.common.members ||= [];
|
|
4074
4108
|
obj.common.members.push(id);
|
|
4075
4109
|
obj.common.members.sort();
|
|
4076
4110
|
promises.push(this.props.socket
|
|
@@ -5324,7 +5358,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
5324
5358
|
};
|
|
5325
5359
|
resizerMouseDown = (e) => {
|
|
5326
5360
|
this.storedWidths ||= JSON.parse(JSON.stringify(SCREEN_WIDTHS[this.props.width || 'lg']));
|
|
5327
|
-
this.resizerCurrentWidths
|
|
5361
|
+
this.resizerCurrentWidths ||= {};
|
|
5328
5362
|
this.resizerActiveDiv = e.target.parentNode;
|
|
5329
5363
|
this.resizerActiveName = this.resizerActiveDiv.dataset.name || null;
|
|
5330
5364
|
if (this.resizerActiveName) {
|
|
@@ -5736,7 +5770,7 @@ export class ObjectBrowserClass extends Component {
|
|
|
5736
5770
|
onClick: () => {
|
|
5737
5771
|
this.edit = {
|
|
5738
5772
|
val: this.states[id] ? this.states[id].val : '',
|
|
5739
|
-
q: this.states[id]
|
|
5773
|
+
q: this.states[id]?.q || 0,
|
|
5740
5774
|
ack: false,
|
|
5741
5775
|
id,
|
|
5742
5776
|
};
|