@iobroker/adapter-react-v5 7.0.1 → 7.1.0
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/404.d.ts +3 -2
- package/Components/404.js +16 -15
- package/Components/ColorPicker.d.ts +22 -8
- package/Components/ColorPicker.js +34 -17
- package/Components/ComplexCron.js +24 -24
- package/Components/CopyToClipboard.d.ts +10 -1
- package/Components/CopyToClipboard.js +17 -8
- package/Components/CustomModal.d.ts +1 -1
- package/Components/CustomModal.js +8 -8
- package/Components/FileBrowser.d.ts +11 -11
- package/Components/FileBrowser.js +173 -164
- package/Components/FileViewer.js +34 -23
- package/Components/Icon.d.ts +16 -2
- package/Components/Icon.js +19 -8
- package/Components/IconPicker.js +10 -14
- package/Components/IconSelector.d.ts +1 -1
- package/Components/IconSelector.js +64 -74
- package/Components/Image.d.ts +8 -4
- package/Components/Image.js +13 -32
- package/Components/Loader.d.ts +2 -2
- package/Components/Loader.js +244 -241
- package/Components/Loaders/MV.d.ts +6 -1
- package/Components/Loaders/MV.js +23 -7
- package/Components/Loaders/PT.d.ts +7 -2
- package/Components/Loaders/PT.js +123 -110
- package/Components/Loaders/Vendor.d.ts +2 -2
- package/Components/Loaders/Vendor.js +22 -14
- package/Components/Logo.js +16 -18
- package/Components/MDUtils.d.ts +1 -1
- package/Components/MDUtils.js +8 -4
- package/Components/ObjectBrowser.d.ts +49 -38
- package/Components/ObjectBrowser.js +757 -494
- package/Components/Router.d.ts +1 -3
- package/Components/Router.js +3 -1
- package/Components/SaveCloseButtons.d.ts +3 -3
- package/Components/SaveCloseButtons.js +3 -3
- package/Components/Schedule.d.ts +15 -15
- package/Components/Schedule.js +177 -154
- package/Components/SelectWithIcon.d.ts +2 -2
- package/Components/SelectWithIcon.js +45 -34
- package/Components/SimpleCron/index.js +83 -43
- package/Components/TabContainer.js +2 -2
- package/Components/TabContent.js +1 -1
- package/Components/TabHeader.js +1 -1
- package/Components/TableResize.d.ts +2 -2
- package/Components/TableResize.js +5 -5
- package/Components/TextWithIcon.d.ts +1 -1
- package/Components/TextWithIcon.js +10 -8
- package/Components/ToggleThemeMenu.d.ts +2 -2
- package/Components/ToggleThemeMenu.js +3 -3
- package/Components/TreeTable.d.ts +18 -18
- package/Components/TreeTable.js +76 -72
- package/Components/UploadImage.d.ts +2 -2
- package/Components/UploadImage.js +330 -326
- package/Components/Utils.d.ts +42 -22
- package/Components/Utils.js +66 -65
- package/Components/withWidth.d.ts +2 -2
- package/Components/withWidth.js +10 -6
- package/Dialogs/ComplexCron.d.ts +2 -2
- package/Dialogs/ComplexCron.js +3 -3
- package/Dialogs/Confirm.d.ts +4 -4
- package/Dialogs/Confirm.js +18 -8
- package/Dialogs/Cron.d.ts +3 -3
- package/Dialogs/Cron.js +21 -17
- package/Dialogs/Error.d.ts +3 -3
- package/Dialogs/Error.js +6 -4
- package/Dialogs/Message.d.ts +3 -3
- package/Dialogs/Message.js +6 -4
- package/Dialogs/SelectFile.d.ts +4 -4
- package/Dialogs/SelectFile.js +6 -4
- package/Dialogs/SelectID.d.ts +12 -10
- package/Dialogs/SelectID.js +12 -8
- package/Dialogs/SimpleCron.d.ts +2 -2
- package/Dialogs/SimpleCron.js +2 -2
- package/Dialogs/TextInput.d.ts +2 -2
- package/Dialogs/TextInput.js +3 -3
- package/GenericApp.d.ts +19 -13
- package/GenericApp.js +177 -134
- package/LICENSE +22 -22
- package/LegacyConnection.d.ts +240 -248
- package/LegacyConnection.js +500 -525
- package/Prompt.js +7 -7
- package/README.md +1239 -1166
- package/Theme.d.ts +1 -1
- package/Theme.js +9 -12
- package/assets/devices.json +1 -0
- package/assets/lamp_ceiling.svg +8 -8
- package/assets/lamp_table.svg +7 -7
- package/assets/no_icon.svg +9 -9
- package/assets/rooms.json +1 -0
- package/craco-module-federation.js +62 -71
- package/i18n/de.json +434 -431
- package/i18n/en.json +434 -431
- package/i18n/es.json +434 -431
- package/i18n/fr.json +434 -431
- package/i18n/it.json +434 -431
- package/i18n/nl.json +434 -431
- package/i18n/pl.json +434 -431
- package/i18n/pt.json +434 -431
- package/i18n/ru.json +434 -431
- package/i18n/uk.json +434 -431
- package/i18n/zh-cn.json +434 -431
- package/i18n.d.ts +26 -19
- package/i18n.js +28 -22
- package/icons/IconAdapter.js +2 -2
- package/icons/IconAlias.js +2 -2
- package/icons/IconChannel.js +2 -2
- package/icons/IconClearFilter.js +2 -2
- package/icons/IconClosed.js +2 -2
- package/icons/IconCopy.js +2 -2
- package/icons/IconDevice.js +2 -2
- package/icons/IconDocument.js +2 -2
- package/icons/IconDocumentReadOnly.js +2 -2
- package/icons/IconExpert.js +2 -2
- package/icons/IconFx.js +2 -2
- package/icons/IconInstance.js +2 -2
- package/icons/IconLogout.js +2 -2
- package/icons/IconNoIcon.js +2 -2
- package/icons/IconOpen.d.ts +2 -2
- package/icons/IconOpen.js +2 -2
- package/icons/IconProps.d.ts +4 -3
- package/icons/IconState.d.ts +2 -2
- package/icons/IconState.js +2 -2
- package/index.css +56 -55
- package/modulefederation.admin.config.js +31 -31
- package/package.json +5 -5
- package/src/AdminConnection.tsx +3 -3
- package/src/Components/404.tsx +122 -121
- package/src/Components/ColorPicker.tsx +343 -315
- package/src/Components/ComplexCron.tsx +544 -507
- package/src/Components/CopyToClipboard.tsx +178 -165
- package/src/Components/CustomModal.tsx +170 -163
- package/src/Components/FileBrowser.tsx +2550 -2414
- package/src/Components/FileViewer.tsx +412 -393
- package/src/Components/Icon.tsx +238 -210
- package/src/Components/IconPicker.tsx +165 -149
- package/src/Components/IconSelector.tsx +2220 -2202
- package/src/Components/Image.tsx +193 -176
- package/src/Components/Loader.tsx +328 -304
- package/src/Components/Logo.tsx +176 -166
- package/src/Components/MDUtils.tsx +104 -100
- package/src/Components/ObjectBrowser.tsx +8935 -8032
- package/src/Components/Router.tsx +90 -90
- package/src/Components/SaveCloseButtons.tsx +117 -113
- package/src/Components/Schedule.tsx +1962 -1724
- package/src/Components/SelectWithIcon.tsx +239 -197
- package/src/Components/TabContainer.tsx +57 -55
- package/src/Components/TabContent.tsx +38 -37
- package/src/Components/TabHeader.tsx +20 -19
- package/src/Components/TableResize.tsx +274 -259
- package/src/Components/TextWithIcon.tsx +159 -148
- package/src/Components/ToggleThemeMenu.tsx +52 -34
- package/src/Components/TreeTable.tsx +1002 -919
- package/src/Components/UploadImage.tsx +631 -599
- package/src/Components/Utils.tsx +1802 -1794
- package/src/Components/loader.css +231 -222
- package/src/Components/withWidth.tsx +32 -21
- package/src/Connection.tsx +5 -7
- package/src/Dialogs/ComplexCron.tsx +123 -129
- package/src/Dialogs/Confirm.tsx +185 -162
- package/src/Dialogs/Cron.tsx +192 -182
- package/src/Dialogs/Error.tsx +67 -72
- package/src/Dialogs/Message.tsx +73 -71
- package/src/Dialogs/SelectFile.tsx +280 -270
- package/src/Dialogs/SelectID.tsx +310 -298
- package/src/Dialogs/SimpleCron.tsx +100 -100
- package/src/Dialogs/TextInput.tsx +99 -107
- package/src/GenericApp.tsx +1076 -976
- package/src/LegacyConnection.tsx +3719 -3589
- package/src/Prompt.tsx +22 -20
- package/src/Theme.tsx +472 -479
- package/src/icons/IconAdapter.tsx +22 -20
- package/src/icons/IconAlias.tsx +22 -20
- package/src/icons/IconChannel.tsx +60 -21
- package/src/icons/IconClearFilter.tsx +24 -22
- package/src/icons/IconClosed.tsx +22 -17
- package/src/icons/IconCopy.tsx +21 -16
- package/src/icons/IconDevice.tsx +126 -27
- package/src/icons/IconDocument.tsx +22 -17
- package/src/icons/IconDocumentReadOnly.tsx +27 -18
- package/src/icons/IconExpert.tsx +26 -18
- package/src/icons/IconFx.tsx +38 -36
- package/src/icons/IconInstance.tsx +22 -20
- package/src/icons/IconLogout.tsx +32 -30
- package/src/icons/IconNoIcon.tsx +21 -19
- package/src/icons/IconOpen.tsx +22 -17
- package/src/icons/IconProps.tsx +16 -15
- package/src/icons/IconState.tsx +38 -17
- package/src/index.css +56 -55
- package/tasks.js +91 -0
- package/types.d.ts +141 -134
- package/Components/Loaders/PT.css +0 -109
- package/Components/Loaders/Vendor.css +0 -13
- package/Components/loader.css +0 -222
- package/Components/types.d.ts +0 -82
- package/assets/devices/Alarm Systems.svg +0 -19
- package/assets/devices/Amplifier.svg +0 -22
- package/assets/devices/Awnings.svg +0 -5
- package/assets/devices/Battery Status.svg +0 -5
- package/assets/devices/Ceiling Spotlights.svg +0 -16
- package/assets/devices/Chandelier.svg +0 -7
- package/assets/devices/Climate.svg +0 -12
- package/assets/devices/Coffee Makers.svg +0 -6
- package/assets/devices/Cold Water.svg +0 -31
- package/assets/devices/Computer.svg +0 -21
- package/assets/devices/Consumption.svg +0 -8
- package/assets/devices/Curtains.svg +0 -43
- package/assets/devices/Dishwashers.svg +0 -12
- package/assets/devices/Doors.svg +0 -6
- package/assets/devices/Doorstep.svg +0 -35
- package/assets/devices/Dryer.svg +0 -14
- package/assets/devices/Fan.svg +0 -20
- package/assets/devices/Floor Lamps.svg +0 -5
- package/assets/devices/Garage Doors.svg +0 -9
- package/assets/devices/Gates.svg +0 -32
- package/assets/devices/Hairdryer.svg +0 -23
- package/assets/devices/Handle.svg +0 -6
- package/assets/devices/Hanging Lamps.svg +0 -9
- package/assets/devices/Heater.svg +0 -44
- package/assets/devices/Hoods.svg +0 -12
- package/assets/devices/Hot Water.svg +0 -10
- package/assets/devices/Humidity.svg +0 -41
- package/assets/devices/Iron.svg +0 -5
- package/assets/devices/Irrigation.svg +0 -23
- package/assets/devices/Led Strip.svg +0 -31
- package/assets/devices/Light.svg +0 -30
- package/assets/devices/Lightings.svg +0 -46
- package/assets/devices/Lock.svg +0 -19
- package/assets/devices/Louvre.svg +0 -7
- package/assets/devices/Mowing Machine.svg +0 -9
- package/assets/devices/Music.svg +0 -13
- package/assets/devices/Outdoor Blinds.svg +0 -7
- package/assets/devices/People.svg +0 -19
- package/assets/devices/Pool.svg +0 -8
- package/assets/devices/Power Consumption.svg +0 -13
- package/assets/devices/Printer.svg +0 -10
- package/assets/devices/Pump.svg +0 -10
- package/assets/devices/Receiver.svg +0 -19
- package/assets/devices/Sconces.svg +0 -10
- package/assets/devices/Security.svg +0 -34
- package/assets/devices/Shading.svg +0 -5
- package/assets/devices/Shutters.svg +0 -11
- package/assets/devices/SmokeDetector.svg +0 -13
- package/assets/devices/Sockets.svg +0 -13
- package/assets/devices/Speaker.svg +0 -35
- package/assets/devices/Stove.svg +0 -12
- package/assets/devices/Table Lamps.svg +0 -12
- package/assets/devices/Temperature Sensors.svg +0 -28
- package/assets/devices/Tv.svg +0 -8
- package/assets/devices/Vacuum Cleaner.svg +0 -16
- package/assets/devices/Ventilation.svg +0 -12
- package/assets/devices/Washing Machines.svg +0 -16
- package/assets/devices/Water Consumption.svg +0 -6
- package/assets/devices/Water Heater.svg +0 -8
- package/assets/devices/Water.svg +0 -40
- package/assets/devices/Weather.svg +0 -28
- package/assets/devices/Window.svg +0 -8
- package/assets/rooms/Anteroom.svg +0 -53
- package/assets/rooms/Attic.svg +0 -21
- package/assets/rooms/Balcony.svg +0 -13
- package/assets/rooms/Barn.svg +0 -6
- package/assets/rooms/Basement.svg +0 -5
- package/assets/rooms/Bathroom.svg +0 -38
- package/assets/rooms/Bedroom.svg +0 -5
- package/assets/rooms/Boiler Room.svg +0 -13
- package/assets/rooms/Carport.svg +0 -17
- package/assets/rooms/Cellar.svg +0 -89
- package/assets/rooms/Chamber.svg +0 -9
- package/assets/rooms/Corridor.svg +0 -53
- package/assets/rooms/Dining Area.svg +0 -37
- package/assets/rooms/Dining Room.svg +0 -37
- package/assets/rooms/Dining.svg +0 -37
- package/assets/rooms/Dressing Room.svg +0 -5
- package/assets/rooms/Driveway.svg +0 -15
- package/assets/rooms/Entrance.svg +0 -44
- package/assets/rooms/Equipment Room.svg +0 -15
- package/assets/rooms/Front Yard.svg +0 -64
- package/assets/rooms/Gallery.svg +0 -14
- package/assets/rooms/Garage.svg +0 -20
- package/assets/rooms/Garden.svg +0 -13
- package/assets/rooms/Ground Floor.svg +0 -95
- package/assets/rooms/Guest Bathroom.svg +0 -33
- package/assets/rooms/Guest Room.svg +0 -5
- package/assets/rooms/Gym.svg +0 -5
- package/assets/rooms/Hall.svg +0 -19
- package/assets/rooms/Home Theater.svg +0 -8
- package/assets/rooms/Kitchen.svg +0 -18
- package/assets/rooms/Laundry Room.svg +0 -12
- package/assets/rooms/Living Area.svg +0 -11
- package/assets/rooms/Living Room.svg +0 -10
- package/assets/rooms/Locker Room.svg +0 -17
- package/assets/rooms/Nursery.svg +0 -5
- package/assets/rooms/Office.svg +0 -8
- package/assets/rooms/Outdoors.svg +0 -7
- package/assets/rooms/Playroom.svg +0 -6
- package/assets/rooms/Pool.svg +0 -8
- package/assets/rooms/Rear Wall.svg +0 -30
- package/assets/rooms/Second Floor.svg +0 -95
- package/assets/rooms/Shed.svg +0 -16
- package/assets/rooms/Sleeping Area.svg +0 -22
- package/assets/rooms/Stairway.svg +0 -5
- package/assets/rooms/Stairwell.svg +0 -15
- package/assets/rooms/Storeroom.svg +0 -5
- package/assets/rooms/Summer House.svg +0 -27
- package/assets/rooms/Swimming Pool.svg +0 -21
- package/assets/rooms/Terrace.svg +0 -7
- package/assets/rooms/Toilet.svg +0 -10
- package/assets/rooms/Upstairs.svg +0 -6
- package/assets/rooms/Wardrobe.svg +0 -60
- package/assets/rooms/Washroom.svg +0 -20
- package/assets/rooms/Wc.svg +0 -10
- package/assets/rooms/Windscreen.svg +0 -60
- package/assets/rooms/Workshop.svg +0 -23
- package/assets/rooms/Workspace.svg +0 -8
|
@@ -39,7 +39,7 @@ exports.getSelectIdIconFromObjects = getSelectIdIconFromObjects;
|
|
|
39
39
|
*
|
|
40
40
|
* MIT License
|
|
41
41
|
*
|
|
42
|
-
|
|
42
|
+
*/
|
|
43
43
|
const react_1 = __importStar(require("react"));
|
|
44
44
|
const react_inlinesvg_1 = __importDefault(require("react-inlinesvg"));
|
|
45
45
|
const material_1 = require("@mui/material");
|
|
@@ -515,7 +515,7 @@ const styles = {
|
|
|
515
515
|
cursor: 'pointer',
|
|
516
516
|
},
|
|
517
517
|
cellButtonsValueButtonEdit: {
|
|
518
|
-
right:
|
|
518
|
+
right: SMALL_BUTTON_SIZE / 2 + 16,
|
|
519
519
|
},
|
|
520
520
|
cellDetailsLine: {
|
|
521
521
|
display: 'flex',
|
|
@@ -749,10 +749,10 @@ const styles = {
|
|
|
749
749
|
},
|
|
750
750
|
};
|
|
751
751
|
function ButtonIcon(props) {
|
|
752
|
-
return react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 436 436", style: props === null || props === void 0 ? void 0 : props.style, width: "24", height: "24", className: "admin-button" },
|
|
752
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 436 436", style: props === null || props === void 0 ? void 0 : props.style, width: "24", height: "24", className: "admin-button" },
|
|
753
753
|
react_1.default.createElement("g", { fill: "currentColor" },
|
|
754
754
|
react_1.default.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" }),
|
|
755
|
-
react_1.default.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" })));
|
|
755
|
+
react_1.default.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" }))));
|
|
756
756
|
}
|
|
757
757
|
/**
|
|
758
758
|
* Function that walks through all keys of an object or array and applies a function to each key.
|
|
@@ -835,7 +835,9 @@ options) {
|
|
|
835
835
|
if (options.excludeSystemRepositories) {
|
|
836
836
|
filterKeys.push('system.repositories');
|
|
837
837
|
}
|
|
838
|
-
const filteredObject = filterKeys.length > 0 || options.excludeTranslations
|
|
838
|
+
const filteredObject = filterKeys.length > 0 || options.excludeTranslations
|
|
839
|
+
? filterObject(obj, filterKeys, options.excludeTranslations)
|
|
840
|
+
: obj;
|
|
839
841
|
const data = options.beautify ? JSON.stringify(filteredObject, null, 2) : JSON.stringify(filteredObject);
|
|
840
842
|
el.setAttribute('href', `data:application/json;charset=utf-8,${encodeURIComponent(data)}`);
|
|
841
843
|
el.setAttribute('download', fileName);
|
|
@@ -874,7 +876,7 @@ function getName(name, lang) {
|
|
|
874
876
|
}
|
|
875
877
|
return (name || '').toString();
|
|
876
878
|
}
|
|
877
|
-
function getSelectIdIconFromObjects(objects, id, imagePrefix) {
|
|
879
|
+
function getSelectIdIconFromObjects(objects, id, lang, imagePrefix) {
|
|
878
880
|
// `admin` has prefix '.' and `web` has '../..'
|
|
879
881
|
imagePrefix = imagePrefix || '.'; // http://localhost:8081';
|
|
880
882
|
let src = '';
|
|
@@ -884,7 +886,13 @@ function getSelectIdIconFromObjects(objects, id, imagePrefix) {
|
|
|
884
886
|
// if not BASE64
|
|
885
887
|
if (!aIcon.startsWith('data:image/')) {
|
|
886
888
|
if (aIcon.includes('.')) {
|
|
887
|
-
|
|
889
|
+
const name = objects[_id_].common.name;
|
|
890
|
+
if (typeof name === 'object') {
|
|
891
|
+
src = `${imagePrefix}/adapter/${name[lang] || name.en}/${aIcon}`;
|
|
892
|
+
}
|
|
893
|
+
else {
|
|
894
|
+
src = `${imagePrefix}/adapter/${name}/${aIcon}`;
|
|
895
|
+
}
|
|
888
896
|
}
|
|
889
897
|
else if (aIcon && aIcon.length < 3) {
|
|
890
898
|
return aIcon; // utf-8
|
|
@@ -894,7 +902,7 @@ function getSelectIdIconFromObjects(objects, id, imagePrefix) {
|
|
|
894
902
|
}
|
|
895
903
|
}
|
|
896
904
|
else if (aIcon.startsWith('data:image/svg')) {
|
|
897
|
-
src = react_1.default.createElement(react_inlinesvg_1.default, { className: "iconOwn", src: aIcon, width: 28, height: 28 });
|
|
905
|
+
src = (react_1.default.createElement(react_inlinesvg_1.default, { className: "iconOwn", src: aIcon, width: 28, height: 28 }));
|
|
898
906
|
}
|
|
899
907
|
else {
|
|
900
908
|
src = aIcon;
|
|
@@ -909,7 +917,12 @@ function getSelectIdIconFromObjects(objects, id, imagePrefix) {
|
|
|
909
917
|
if (cIcon.includes('.')) {
|
|
910
918
|
let instance;
|
|
911
919
|
if (objects[id].type === 'instance' || objects[id].type === 'adapter') {
|
|
912
|
-
|
|
920
|
+
if (typeof common.name === 'object') {
|
|
921
|
+
src = `${imagePrefix}/adapter/${common.name[lang] || common.name.en}/${cIcon}`;
|
|
922
|
+
}
|
|
923
|
+
else {
|
|
924
|
+
src = `${imagePrefix}/adapter/${common.name}/${cIcon}`;
|
|
925
|
+
}
|
|
913
926
|
}
|
|
914
927
|
else if (id && id.startsWith('system.adapter.')) {
|
|
915
928
|
instance = id.split('.', 3);
|
|
@@ -941,7 +954,7 @@ function getSelectIdIconFromObjects(objects, id, imagePrefix) {
|
|
|
941
954
|
}
|
|
942
955
|
else if (cIcon.startsWith('data:image/svg')) {
|
|
943
956
|
// if base 64 image
|
|
944
|
-
src = react_1.default.createElement(react_inlinesvg_1.default, { className: "iconOwn", src: cIcon, width: 28, height: 28 });
|
|
957
|
+
src = (react_1.default.createElement(react_inlinesvg_1.default, { className: "iconOwn", src: cIcon, width: 28, height: 28 }));
|
|
945
958
|
}
|
|
946
959
|
else {
|
|
947
960
|
src = cIcon;
|
|
@@ -1039,7 +1052,8 @@ function applyFilter(item, filters, lang, objects, context, counter, customFilte
|
|
|
1039
1052
|
filteredOut = true;
|
|
1040
1053
|
}
|
|
1041
1054
|
}
|
|
1042
|
-
else if (Array.isArray(filterOfCustom)) {
|
|
1055
|
+
else if (Array.isArray(filterOfCustom)) {
|
|
1056
|
+
// here are ['influxdb.', 'telegram.']
|
|
1043
1057
|
const customs = Object.keys(common.custom); // here are ['influxdb.0', 'telegram.2']
|
|
1044
1058
|
if (filterOfCustom.find(cst => customs.find(id => id.startsWith(cst)))) {
|
|
1045
1059
|
filteredOut = true;
|
|
@@ -1147,20 +1161,20 @@ function getVisibleItems(item, type, objects, _result) {
|
|
|
1147
1161
|
}
|
|
1148
1162
|
return _result;
|
|
1149
1163
|
}
|
|
1150
|
-
function getSystemIcon(objects, id, level, themeType, imagePrefix) {
|
|
1164
|
+
function getSystemIcon(objects, id, level, themeType, lang, imagePrefix) {
|
|
1151
1165
|
let icon;
|
|
1152
1166
|
// system or design has special icons
|
|
1153
1167
|
if (id === 'alias' || id === 'alias.0') {
|
|
1154
|
-
icon = react_1.default.createElement(icons_material_1.Link, { className: "iconOwn", style: { color: COLOR_NAME_ALIAS(themeType) } });
|
|
1168
|
+
icon = (react_1.default.createElement(icons_material_1.Link, { className: "iconOwn", style: { color: COLOR_NAME_ALIAS(themeType) } }));
|
|
1155
1169
|
}
|
|
1156
1170
|
else if (id === '0_userdata' || id === '0_userdata.0') {
|
|
1157
|
-
icon = react_1.default.createElement(icons_material_1.DataObject, { className: "iconOwn", style: { color: COLOR_NAME_USERDATA(themeType) } });
|
|
1171
|
+
icon = (react_1.default.createElement(icons_material_1.DataObject, { className: "iconOwn", style: { color: COLOR_NAME_USERDATA(themeType) } }));
|
|
1158
1172
|
}
|
|
1159
1173
|
else if (id.startsWith('_design/') || id === 'system') {
|
|
1160
|
-
icon = react_1.default.createElement(icons_material_1.SettingsApplications, { className: "iconOwn", style: { color: COLOR_NAME_SYSTEM(themeType) } });
|
|
1174
|
+
icon = (react_1.default.createElement(icons_material_1.SettingsApplications, { className: "iconOwn", style: { color: COLOR_NAME_SYSTEM(themeType) } }));
|
|
1161
1175
|
}
|
|
1162
1176
|
else if (id === 'system.adapter') {
|
|
1163
|
-
icon = react_1.default.createElement(icons_material_1.SettingsApplications, { className: "iconOwn", style: { color: COLOR_NAME_SYSTEM_ADAPTER(themeType) } });
|
|
1177
|
+
icon = (react_1.default.createElement(icons_material_1.SettingsApplications, { className: "iconOwn", style: { color: COLOR_NAME_SYSTEM_ADAPTER(themeType) } }));
|
|
1164
1178
|
}
|
|
1165
1179
|
else if (id === 'system.group') {
|
|
1166
1180
|
icon = react_1.default.createElement(icons_material_1.SupervisedUserCircle, { className: "iconOwn" });
|
|
@@ -1183,7 +1197,7 @@ function getSystemIcon(objects, id, level, themeType, imagePrefix) {
|
|
|
1183
1197
|
else if (level < 2) {
|
|
1184
1198
|
// detect "cloud.0"
|
|
1185
1199
|
if (objects[`system.adapter.${id}`]) {
|
|
1186
|
-
icon = getSelectIdIconFromObjects(objects, `system.adapter.${id}`, imagePrefix);
|
|
1200
|
+
icon = getSelectIdIconFromObjects(objects, `system.adapter.${id}`, lang, imagePrefix);
|
|
1187
1201
|
}
|
|
1188
1202
|
}
|
|
1189
1203
|
return icon || null;
|
|
@@ -1198,12 +1212,12 @@ function getObjectTooltip(data, lang) {
|
|
|
1198
1212
|
function getIdFieldTooltip(data, lang) {
|
|
1199
1213
|
const tooltip = getObjectTooltip(data, lang);
|
|
1200
1214
|
if (tooltip === null || tooltip === void 0 ? void 0 : tooltip.startsWith('http')) {
|
|
1201
|
-
return react_1.default.createElement(material_1.Box, { component: "a", sx: styles.cellIdTooltipLink, href: tooltip, target: "_blank", rel: "noreferrer" }, tooltip);
|
|
1215
|
+
return (react_1.default.createElement(material_1.Box, { component: "a", sx: styles.cellIdTooltipLink, href: tooltip, target: "_blank", rel: "noreferrer" }, tooltip));
|
|
1202
1216
|
}
|
|
1203
1217
|
return react_1.default.createElement("span", { style: styles.cellIdTooltip }, tooltip || data.id || '');
|
|
1204
1218
|
}
|
|
1205
1219
|
function buildTree(objects, options) {
|
|
1206
|
-
var _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1220
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k;
|
|
1207
1221
|
const imagePrefix = options.imagePrefix || '.';
|
|
1208
1222
|
let ids = Object.keys(objects);
|
|
1209
1223
|
ids.sort((a, b) => {
|
|
@@ -1241,6 +1255,7 @@ function buildTree(objects, options) {
|
|
|
1241
1255
|
customs: ['_'],
|
|
1242
1256
|
enums: [],
|
|
1243
1257
|
hasSomeCustoms: false,
|
|
1258
|
+
aliasesMap: {},
|
|
1244
1259
|
};
|
|
1245
1260
|
let cRoot = root;
|
|
1246
1261
|
for (let i = 0; i < ids.length; i++) {
|
|
@@ -1274,6 +1289,38 @@ function buildTree(objects, options) {
|
|
|
1274
1289
|
info.hasSomeCustoms = true;
|
|
1275
1290
|
info.customs.push(id.substring('system.adapter.'.length));
|
|
1276
1291
|
}
|
|
1292
|
+
// Build a map of aliases
|
|
1293
|
+
if (id.startsWith('alias.') && ((_c = obj.common.alias) === null || _c === void 0 ? void 0 : _c.id)) {
|
|
1294
|
+
if (typeof obj.common.alias.id === 'string') {
|
|
1295
|
+
const usedId = obj.common.alias.id;
|
|
1296
|
+
if (!info.aliasesMap[usedId]) {
|
|
1297
|
+
info.aliasesMap[usedId] = [id];
|
|
1298
|
+
}
|
|
1299
|
+
else if (!info.aliasesMap[usedId].includes(id)) {
|
|
1300
|
+
info.aliasesMap[usedId].push(id);
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1303
|
+
else {
|
|
1304
|
+
const readId = obj.common.alias.id.read;
|
|
1305
|
+
if (readId) {
|
|
1306
|
+
if (!info.aliasesMap[readId]) {
|
|
1307
|
+
info.aliasesMap[readId] = [id];
|
|
1308
|
+
}
|
|
1309
|
+
else if (!info.aliasesMap[readId].includes(id)) {
|
|
1310
|
+
info.aliasesMap[readId].push(id);
|
|
1311
|
+
}
|
|
1312
|
+
}
|
|
1313
|
+
const writeId = obj.common.alias.id.write;
|
|
1314
|
+
if (writeId) {
|
|
1315
|
+
if (!info.aliasesMap[writeId]) {
|
|
1316
|
+
info.aliasesMap[writeId] = [id];
|
|
1317
|
+
}
|
|
1318
|
+
else if (!info.aliasesMap[writeId].includes(id)) {
|
|
1319
|
+
info.aliasesMap[writeId].push(id);
|
|
1320
|
+
}
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
}
|
|
1277
1324
|
}
|
|
1278
1325
|
info.ids.push(id);
|
|
1279
1326
|
let repeat;
|
|
@@ -1297,7 +1344,7 @@ function buildTree(objects, options) {
|
|
|
1297
1344
|
id: curPath,
|
|
1298
1345
|
obj: objects[curPath],
|
|
1299
1346
|
level: k,
|
|
1300
|
-
icon: getSystemIcon(objects, curPath, k, options.themeType, imagePrefix),
|
|
1347
|
+
icon: getSystemIcon(objects, curPath, k, options.themeType, options.lang, imagePrefix),
|
|
1301
1348
|
generated: true,
|
|
1302
1349
|
},
|
|
1303
1350
|
};
|
|
@@ -1314,22 +1361,24 @@ function buildTree(objects, options) {
|
|
|
1314
1361
|
const _cRoot = {
|
|
1315
1362
|
data: {
|
|
1316
1363
|
name: parts[parts.length - 1],
|
|
1317
|
-
title: getName((
|
|
1364
|
+
title: getName((_d = obj === null || obj === void 0 ? void 0 : obj.common) === null || _d === void 0 ? void 0 : _d.name, options.lang),
|
|
1318
1365
|
obj,
|
|
1319
1366
|
parent: cRoot,
|
|
1320
|
-
icon: getSelectIdIconFromObjects(objects, id, imagePrefix) ||
|
|
1321
|
-
getSystemIcon(objects, id, 0, options.themeType, imagePrefix),
|
|
1367
|
+
icon: getSelectIdIconFromObjects(objects, id, options.lang, imagePrefix) ||
|
|
1368
|
+
getSystemIcon(objects, id, 0, options.themeType, options.lang, imagePrefix),
|
|
1322
1369
|
id,
|
|
1323
|
-
hasCustoms: !!(((
|
|
1370
|
+
hasCustoms: !!(((_e = obj.common) === null || _e === void 0 ? void 0 : _e.custom) && Object.keys(obj.common.custom).length),
|
|
1324
1371
|
level: parts.length - 1,
|
|
1325
1372
|
generated: false,
|
|
1326
1373
|
button: obj.type === 'state' &&
|
|
1327
|
-
!!((
|
|
1374
|
+
!!((_f = obj.common) === null || _f === void 0 ? void 0 : _f.role) &&
|
|
1328
1375
|
typeof obj.common.role === 'string' &&
|
|
1329
1376
|
obj.common.role.startsWith('button') &&
|
|
1330
|
-
((
|
|
1331
|
-
switch: obj.type === 'state' &&
|
|
1332
|
-
((_h = obj.common) === null || _h === void 0 ? void 0 : _h.
|
|
1377
|
+
((_g = obj.common) === null || _g === void 0 ? void 0 : _g.write) !== false,
|
|
1378
|
+
switch: obj.type === 'state' &&
|
|
1379
|
+
((_h = obj.common) === null || _h === void 0 ? void 0 : _h.type) === 'boolean' &&
|
|
1380
|
+
((_j = obj.common) === null || _j === void 0 ? void 0 : _j.write) !== false &&
|
|
1381
|
+
((_k = obj.common) === null || _k === void 0 ? void 0 : _k.read) !== false,
|
|
1333
1382
|
},
|
|
1334
1383
|
};
|
|
1335
1384
|
cRoot.children = cRoot.children || [];
|
|
@@ -1517,7 +1566,7 @@ function quality2text(q) {
|
|
|
1517
1566
|
* Format a state value for visualization
|
|
1518
1567
|
*/
|
|
1519
1568
|
function formatValue(options) {
|
|
1520
|
-
const { dateFormat, state, isFloatComma, texts, obj
|
|
1569
|
+
const { dateFormat, state, isFloatComma, texts, obj } = options;
|
|
1521
1570
|
const states = Utils_1.default.getStates(obj);
|
|
1522
1571
|
const isCommon = obj.common;
|
|
1523
1572
|
let fileViewer;
|
|
@@ -1636,11 +1685,12 @@ function formatValue(options) {
|
|
|
1636
1685
|
* Get CSS style for given state value
|
|
1637
1686
|
*/
|
|
1638
1687
|
function getValueStyle(options) {
|
|
1639
|
-
const { state, isExpertMode, isButton } = options;
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1688
|
+
const { state /* , isExpertMode, isButton */ } = options;
|
|
1689
|
+
const color = (state === null || state === void 0 ? void 0 : state.ack) ? (state.q ? '#ffa500' : '') : '#ff2222c9';
|
|
1690
|
+
// do not show the color of the button in non-expert mode
|
|
1691
|
+
// if (!isExpertMode && isButton) {
|
|
1692
|
+
// color = '';
|
|
1693
|
+
// }
|
|
1644
1694
|
return { color };
|
|
1645
1695
|
}
|
|
1646
1696
|
function prepareSparkData(values, from) {
|
|
@@ -1677,21 +1727,21 @@ function prepareSparkData(values, from) {
|
|
|
1677
1727
|
return v;
|
|
1678
1728
|
}
|
|
1679
1729
|
exports.ITEM_IMAGES = {
|
|
1680
|
-
state: react_1.default.createElement(IconState_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1681
|
-
channel: react_1.default.createElement(IconChannel_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1682
|
-
device: react_1.default.createElement(IconDevice_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1683
|
-
adapter: react_1.default.createElement(IconAdapter_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1684
|
-
meta: react_1.default.createElement(icons_material_1.Description, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1685
|
-
instance: react_1.default.createElement(IconInstance_1.default, { className: "itemIcon", style: { color: '#7da7ff', verticalAlign: 'middle' } }),
|
|
1686
|
-
enum: react_1.default.createElement(icons_material_1.ListAlt, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1687
|
-
chart: react_1.default.createElement(icons_material_1.ShowChart, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1688
|
-
config: react_1.default.createElement(icons_material_1.Settings, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1689
|
-
group: react_1.default.createElement(icons_material_1.SupervisedUserCircle, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1690
|
-
user: react_1.default.createElement(icons_material_1.PersonOutlined, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1691
|
-
host: react_1.default.createElement(icons_material_1.Router, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1692
|
-
schedule: react_1.default.createElement(icons_material_1.CalendarToday, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1693
|
-
script: react_1.default.createElement(icons_material_1.Code, { className: "itemIcon", style: { verticalAlign: 'middle' } }),
|
|
1694
|
-
folder: react_1.default.createElement(IconClosed_1.default, { className: "itemIcon itemIconFolder", style: { verticalAlign: 'middle' } }),
|
|
1730
|
+
state: (react_1.default.createElement(IconState_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1731
|
+
channel: (react_1.default.createElement(IconChannel_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1732
|
+
device: (react_1.default.createElement(IconDevice_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1733
|
+
adapter: (react_1.default.createElement(IconAdapter_1.default, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1734
|
+
meta: (react_1.default.createElement(icons_material_1.Description, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1735
|
+
instance: (react_1.default.createElement(IconInstance_1.default, { className: "itemIcon", style: { color: '#7da7ff', verticalAlign: 'middle' } })),
|
|
1736
|
+
enum: (react_1.default.createElement(icons_material_1.ListAlt, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1737
|
+
chart: (react_1.default.createElement(icons_material_1.ShowChart, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1738
|
+
config: (react_1.default.createElement(icons_material_1.Settings, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1739
|
+
group: (react_1.default.createElement(icons_material_1.SupervisedUserCircle, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1740
|
+
user: (react_1.default.createElement(icons_material_1.PersonOutlined, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1741
|
+
host: (react_1.default.createElement(icons_material_1.Router, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1742
|
+
schedule: (react_1.default.createElement(icons_material_1.CalendarToday, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1743
|
+
script: (react_1.default.createElement(icons_material_1.Code, { className: "itemIcon", style: { verticalAlign: 'middle' } })),
|
|
1744
|
+
folder: (react_1.default.createElement(IconClosed_1.default, { className: "itemIcon itemIconFolder", style: { verticalAlign: 'middle' } })),
|
|
1695
1745
|
};
|
|
1696
1746
|
const SCREEN_WIDTHS = {
|
|
1697
1747
|
// extra-small: 0px
|
|
@@ -1786,6 +1836,19 @@ const DEFAULT_FILTER = {
|
|
|
1786
1836
|
class ObjectBrowserClass extends react_1.Component {
|
|
1787
1837
|
constructor(props) {
|
|
1788
1838
|
super(props);
|
|
1839
|
+
// do not define the type as null to save the performance, so we must check it every time
|
|
1840
|
+
this.info = {
|
|
1841
|
+
funcEnums: [],
|
|
1842
|
+
roomEnums: [],
|
|
1843
|
+
roles: [],
|
|
1844
|
+
ids: [],
|
|
1845
|
+
types: [],
|
|
1846
|
+
objects: {},
|
|
1847
|
+
customs: [],
|
|
1848
|
+
enums: [],
|
|
1849
|
+
hasSomeCustoms: false,
|
|
1850
|
+
aliasesMap: {},
|
|
1851
|
+
};
|
|
1789
1852
|
this.localStorage = window._localStorage || window.localStorage;
|
|
1790
1853
|
this.lastAppliedFilter = null;
|
|
1791
1854
|
this.pausedSubscribes = false;
|
|
@@ -1819,6 +1882,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
1819
1882
|
this.resizerNextDiv = null;
|
|
1820
1883
|
this.storedWidths = null;
|
|
1821
1884
|
this.defaultHistory = '';
|
|
1885
|
+
this.columnsVisibility = {};
|
|
1822
1886
|
this.changedIds = null;
|
|
1823
1887
|
this.contextMenu = null;
|
|
1824
1888
|
this.recordStates = [];
|
|
@@ -1831,7 +1895,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
1831
1895
|
// console.log(`CONTEXT MENU: ${this.contextMenu ? Date.now() - this.contextMenu.ts : 'false'}`);
|
|
1832
1896
|
if (this.contextMenu && Date.now() - this.contextMenu.ts < 2000) {
|
|
1833
1897
|
e.preventDefault();
|
|
1834
|
-
this.setState({
|
|
1898
|
+
this.setState({
|
|
1899
|
+
showContextMenu: {
|
|
1900
|
+
item: this.contextMenu.item,
|
|
1901
|
+
position: { left: e.clientX + 2, top: e.clientY - 6 },
|
|
1902
|
+
},
|
|
1903
|
+
});
|
|
1835
1904
|
}
|
|
1836
1905
|
else if (this.state.showContextMenu) {
|
|
1837
1906
|
e.preventDefault();
|
|
@@ -1940,15 +2009,17 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
1940
2009
|
// if enum does not exist
|
|
1941
2010
|
if (!oldObj) {
|
|
1942
2011
|
// create a new one
|
|
1943
|
-
oldObj =
|
|
1944
|
-
|
|
1945
|
-
|
|
1946
|
-
|
|
1947
|
-
|
|
1948
|
-
|
|
1949
|
-
|
|
1950
|
-
|
|
1951
|
-
|
|
2012
|
+
oldObj =
|
|
2013
|
+
newObj ||
|
|
2014
|
+
{
|
|
2015
|
+
_id: id,
|
|
2016
|
+
common: {
|
|
2017
|
+
name: id.split('.').pop(),
|
|
2018
|
+
members: [],
|
|
2019
|
+
},
|
|
2020
|
+
native: {},
|
|
2021
|
+
type: 'enum',
|
|
2022
|
+
};
|
|
1952
2023
|
oldObj.common = oldObj.common || {};
|
|
1953
2024
|
oldObj.common.members = [objId];
|
|
1954
2025
|
oldObj.type = 'enum';
|
|
@@ -2082,14 +2153,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2082
2153
|
const funcRenderStateObject = (value) => {
|
|
2083
2154
|
const rights = acl[value];
|
|
2084
2155
|
check.forEach((el, i) => {
|
|
2085
|
-
// eslint-disable-next-line no-bitwise
|
|
2086
2156
|
if (rights & el.valueNum) {
|
|
2087
2157
|
arrayTooltipText.push(react_1.default.createElement("span", { key: value + i },
|
|
2088
2158
|
this.texts[`acl${el.group}_${el.title}_${value}`],
|
|
2089
2159
|
",",
|
|
2090
|
-
react_1.default.createElement("span", { style: value === 'object'
|
|
2091
|
-
? styles.rightsObject
|
|
2092
|
-
: styles.rightsState }, el.value)));
|
|
2160
|
+
react_1.default.createElement("span", { style: value === 'object' ? styles.rightsObject : styles.rightsState }, el.value)));
|
|
2093
2161
|
}
|
|
2094
2162
|
});
|
|
2095
2163
|
};
|
|
@@ -2099,7 +2167,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2099
2167
|
if (acl.state) {
|
|
2100
2168
|
funcRenderStateObject('state');
|
|
2101
2169
|
}
|
|
2102
|
-
return arrayTooltipText.length ? react_1.default.createElement("span", { style: styles.tooltipAccessControl }, arrayTooltipText.map(el => el)) : null;
|
|
2170
|
+
return arrayTooltipText.length ? (react_1.default.createElement("span", { style: styles.tooltipAccessControl }, arrayTooltipText.map(el => el))) : null;
|
|
2103
2171
|
};
|
|
2104
2172
|
this.resizerMouseMove = (e) => {
|
|
2105
2173
|
if (this.resizerActiveDiv) {
|
|
@@ -2113,7 +2181,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2113
2181
|
width = this.resizerOldWidth + e.clientX - this.resizerPosition;
|
|
2114
2182
|
widthNext = this.resizerOldWidthNext - e.clientX + this.resizerPosition;
|
|
2115
2183
|
}
|
|
2116
|
-
if (this.resizerActiveName &&
|
|
2184
|
+
if (this.resizerActiveName &&
|
|
2185
|
+
this.resizerNextName &&
|
|
2117
2186
|
(!this.resizerMin || width > this.resizerMin) &&
|
|
2118
2187
|
(!this.resizerNextMin || widthNext > this.resizerNextMin)) {
|
|
2119
2188
|
this.resizerCurrentWidths[this.resizerActiveName] = width;
|
|
@@ -2153,7 +2222,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2153
2222
|
window.removeEventListener('mouseup', this.resizerMouseUp);
|
|
2154
2223
|
};
|
|
2155
2224
|
this.resizerMouseDown = (e) => {
|
|
2156
|
-
this.storedWidths =
|
|
2225
|
+
this.storedWidths =
|
|
2226
|
+
this.storedWidths ||
|
|
2227
|
+
JSON.parse(JSON.stringify(SCREEN_WIDTHS[this.props.width || 'lg']));
|
|
2157
2228
|
this.resizerCurrentWidths = this.resizerCurrentWidths || {};
|
|
2158
2229
|
this.resizerActiveDiv = e.target.parentNode;
|
|
2159
2230
|
this.resizerActiveName = this.resizerActiveDiv.dataset.name || null;
|
|
@@ -2202,6 +2273,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2202
2273
|
this.forceUpdate();
|
|
2203
2274
|
};
|
|
2204
2275
|
const lastSelectedItemStr = this.localStorage.getItem(`${props.dialogName || 'App'}.objectSelected`) || '';
|
|
2276
|
+
this.selectFirst = '';
|
|
2205
2277
|
if (lastSelectedItemStr.startsWith('[')) {
|
|
2206
2278
|
try {
|
|
2207
2279
|
const lastSelectedItems = JSON.parse(lastSelectedItemStr);
|
|
@@ -2243,7 +2315,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2243
2315
|
filter.expertMode =
|
|
2244
2316
|
props.expertMode !== undefined
|
|
2245
2317
|
? props.expertMode
|
|
2246
|
-
: (window._sessionStorage || window.sessionStorage).getItem('App.expertMode') ===
|
|
2318
|
+
: (window._sessionStorage || window.sessionStorage).getItem('App.expertMode') ===
|
|
2319
|
+
'true';
|
|
2247
2320
|
this.tableRef = (0, react_1.createRef)();
|
|
2248
2321
|
this.filterRefs = {};
|
|
2249
2322
|
Object.keys(DEFAULT_FILTER).forEach(name => (this.filterRefs[name] = (0, react_1.createRef)()));
|
|
@@ -2348,6 +2421,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2348
2421
|
excludeSystemRepositoriesFromExport: true,
|
|
2349
2422
|
excludeTranslations: false,
|
|
2350
2423
|
tooltipInfo: null,
|
|
2424
|
+
aliasMenu: '',
|
|
2351
2425
|
};
|
|
2352
2426
|
this.texts = {
|
|
2353
2427
|
name: props.t('ra_Name'),
|
|
@@ -2420,8 +2494,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2420
2494
|
SCREEN_WIDTHS[width].widths.name = resizerCurrentWidths[id];
|
|
2421
2495
|
}
|
|
2422
2496
|
else if (SCREEN_WIDTHS[width].widths[id] !== undefined) {
|
|
2423
|
-
SCREEN_WIDTHS[width].widths[id] =
|
|
2424
|
-
resizerCurrentWidths[id];
|
|
2497
|
+
SCREEN_WIDTHS[width].widths[id] = resizerCurrentWidths[id];
|
|
2425
2498
|
}
|
|
2426
2499
|
});
|
|
2427
2500
|
this.customWidth = true;
|
|
@@ -2613,7 +2686,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2613
2686
|
this.selectFirst = '';
|
|
2614
2687
|
}
|
|
2615
2688
|
if (this.state.selected.length === 1 && this.objects[this.state.selected[0]]) {
|
|
2616
|
-
const name = Utils_1.default.getObjectName(this.objects, this.state.selected[0], null, {
|
|
2689
|
+
const name = Utils_1.default.getObjectName(this.objects, this.state.selected[0], null, {
|
|
2690
|
+
language: this.props.lang,
|
|
2691
|
+
});
|
|
2617
2692
|
if (this.props.onSelect) {
|
|
2618
2693
|
this.props.onSelect(this.state.selected, name, isDouble);
|
|
2619
2694
|
}
|
|
@@ -2666,7 +2741,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2666
2741
|
this.props.objectsWorker.unregisterHandler(this.onObjectChangeFromWorker, true);
|
|
2667
2742
|
}
|
|
2668
2743
|
else {
|
|
2669
|
-
this.props.socket
|
|
2744
|
+
void this.props.socket
|
|
2745
|
+
.unsubscribeObject('*', this.onObjectChange)
|
|
2746
|
+
.catch(e => console.error(`Cannot unsubscribe *: ${e}`));
|
|
2670
2747
|
}
|
|
2671
2748
|
// remove all subscribes
|
|
2672
2749
|
this.subscribes.forEach(pattern => {
|
|
@@ -2709,18 +2786,20 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2709
2786
|
this.props.socket.unsubscribeState(pattern, this.onStateChange);
|
|
2710
2787
|
});
|
|
2711
2788
|
this.subscribes = [];
|
|
2712
|
-
this.loadAllObjects(true)
|
|
2789
|
+
this.loadAllObjects(true)
|
|
2790
|
+
.then(() => console.log('updated!'))
|
|
2791
|
+
.catch(e => this.showError(e));
|
|
2713
2792
|
}
|
|
2714
2793
|
/**
|
|
2715
2794
|
* Renders the error dialog.
|
|
2716
2795
|
*/
|
|
2717
2796
|
renderErrorDialog() {
|
|
2718
|
-
return this.state.error ? react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "sm", fullWidth: true, onClose: () => this.setState({ error: '' }), "aria-labelledby": "error-dialog-title", "aria-describedby": "error-dialog-description" },
|
|
2797
|
+
return this.state.error ? (react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "sm", fullWidth: true, onClose: () => this.setState({ error: '' }), "aria-labelledby": "error-dialog-title", "aria-describedby": "error-dialog-description" },
|
|
2719
2798
|
react_1.default.createElement(material_1.DialogTitle, { id: "alert-dialog-title" }, this.props.t('ra_Error')),
|
|
2720
2799
|
react_1.default.createElement(material_1.DialogContent, null,
|
|
2721
2800
|
react_1.default.createElement(material_1.DialogContentText, { id: "alert-dialog-description" }, this.state.error)),
|
|
2722
2801
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
2723
|
-
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.setState({ error: '' }), color: "primary", autoFocus: true, startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.t('ra_Ok')))) : null;
|
|
2802
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.setState({ error: '' }), color: "primary", autoFocus: true, startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.t('ra_Ok'))))) : null;
|
|
2724
2803
|
}
|
|
2725
2804
|
/**
|
|
2726
2805
|
* Show the error dialog.
|
|
@@ -2795,11 +2874,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2795
2874
|
}
|
|
2796
2875
|
}
|
|
2797
2876
|
return cols
|
|
2798
|
-
.filter(id => (isLast && (id === 'val' || id === 'buttons')) ||
|
|
2799
|
-
(!isLast && id !== 'val' && id !== 'buttons'))
|
|
2877
|
+
.filter(id => (isLast && (id === 'val' || id === 'buttons')) || (!isLast && id !== 'val' && id !== 'buttons'))
|
|
2800
2878
|
.map(id => {
|
|
2801
2879
|
var _b;
|
|
2802
|
-
return react_1.default.createElement(material_1.ListItemButton, { onClick: () => {
|
|
2880
|
+
return (react_1.default.createElement(material_1.ListItemButton, { onClick: () => {
|
|
2803
2881
|
if (!this.state.columnsAuto && id !== 'id') {
|
|
2804
2882
|
const columns = [...(this.state.columns || [])];
|
|
2805
2883
|
const pos = columns.indexOf(id);
|
|
@@ -2819,7 +2897,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2819
2897
|
!!(this.state.columnsAuto
|
|
2820
2898
|
? this.visibleCols.includes(id)
|
|
2821
2899
|
: (_b = this.state.columns) === null || _b === void 0 ? void 0 : _b.includes(id)), disableRipple: true }),
|
|
2822
|
-
react_1.default.createElement(material_1.ListItemText, { primary: this.texts[`filter_${id}`] || this.props.t(`ra_${id}`) }));
|
|
2900
|
+
react_1.default.createElement(material_1.ListItemText, { primary: this.texts[`filter_${id}`] || this.props.t(`ra_${id}`) })));
|
|
2823
2901
|
});
|
|
2824
2902
|
}
|
|
2825
2903
|
/**
|
|
@@ -2829,7 +2907,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2829
2907
|
if (!this.state.columnsSelectorShow) {
|
|
2830
2908
|
return null;
|
|
2831
2909
|
}
|
|
2832
|
-
return react_1.default.createElement(material_1.Dialog, { onClose: () => this.setState({ columnsSelectorShow: false }), open: !0, sx: {
|
|
2910
|
+
return (react_1.default.createElement(material_1.Dialog, { onClose: () => this.setState({ columnsSelectorShow: false }), open: !0, sx: {
|
|
2833
2911
|
'& .MuiPaper-root': Utils_1.default.getStyle(this.props.theme, styles.dialogColumns, styles[`transparent_${this.state.columnsDialogTransparent}`]),
|
|
2834
2912
|
} },
|
|
2835
2913
|
react_1.default.createElement(material_1.DialogTitle, { sx: styles.fontSizeTitle }, this.props.t('ra_Configure')),
|
|
@@ -2859,40 +2937,41 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2859
2937
|
} }), label: this.props.t('ra_Auto (no custom columns)') }),
|
|
2860
2938
|
react_1.default.createElement(material_1.List, null,
|
|
2861
2939
|
this._renderDefinedList(false),
|
|
2862
|
-
this.state.columnsForAdmin &&
|
|
2863
|
-
.
|
|
2864
|
-
|
|
2865
|
-
|
|
2866
|
-
|
|
2867
|
-
|
|
2868
|
-
|
|
2869
|
-
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
|
|
2873
|
-
|
|
2874
|
-
|
|
2875
|
-
|
|
2876
|
-
|
|
2877
|
-
|
|
2878
|
-
|
|
2879
|
-
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
2940
|
+
this.state.columnsForAdmin &&
|
|
2941
|
+
Object.keys(this.state.columnsForAdmin)
|
|
2942
|
+
.sort()
|
|
2943
|
+
.map(adapter => this.state.columnsForAdmin &&
|
|
2944
|
+
this.state.columnsForAdmin[adapter].map(column => {
|
|
2945
|
+
var _b;
|
|
2946
|
+
return (react_1.default.createElement(material_1.ListItemButton, { onClick: () => {
|
|
2947
|
+
if (!this.state.columnsAuto) {
|
|
2948
|
+
const columns = [...(this.state.columns || [])];
|
|
2949
|
+
const id = `_${adapter}_${column.path}`;
|
|
2950
|
+
const pos = columns.indexOf(id);
|
|
2951
|
+
if (pos === -1) {
|
|
2952
|
+
columns.push(id);
|
|
2953
|
+
columns.sort();
|
|
2954
|
+
}
|
|
2955
|
+
else {
|
|
2956
|
+
columns.splice(pos, 1);
|
|
2957
|
+
}
|
|
2958
|
+
this.calculateColumnsVisibility(null, columns);
|
|
2959
|
+
this.localStorage.setItem(`${this.props.dialogName || 'App'}.columns`, JSON.stringify(columns));
|
|
2960
|
+
this.setState({ columns });
|
|
2961
|
+
}
|
|
2962
|
+
}, key: `${adapter}_${column.name}` },
|
|
2963
|
+
react_1.default.createElement(material_1.ListItemIcon, null,
|
|
2964
|
+
react_1.default.createElement(material_1.Checkbox, { disabled: this.state.columnsAuto, edge: "start", checked: !this.state.columnsAuto &&
|
|
2965
|
+
((_b = this.state.columns) === null || _b === void 0 ? void 0 : _b.includes(`_${adapter}_${column.path}`)), disableRipple: true })),
|
|
2966
|
+
react_1.default.createElement(material_1.ListItemText, { primary: `${column.name} (${adapter})` })));
|
|
2967
|
+
})),
|
|
2888
2968
|
this._renderDefinedList(true))),
|
|
2889
2969
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
2890
|
-
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.setState({ columnsSelectorShow: false }), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.texts.close)));
|
|
2970
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.setState({ columnsSelectorShow: false }), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.texts.close))));
|
|
2891
2971
|
}
|
|
2892
2972
|
async getAdditionalColumns() {
|
|
2893
2973
|
try {
|
|
2894
|
-
const instances = await this.props.socket
|
|
2895
|
-
.getAdapters();
|
|
2974
|
+
const instances = await this.props.socket.getAdapters();
|
|
2896
2975
|
let columnsForAdmin = null;
|
|
2897
2976
|
// find all additional columns
|
|
2898
2977
|
instances.forEach(obj => (columnsForAdmin = this.parseObjectForAdmins(columnsForAdmin, obj)));
|
|
@@ -2989,9 +3068,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
2989
3068
|
else {
|
|
2990
3069
|
cColumns = null;
|
|
2991
3070
|
}
|
|
2992
|
-
if (cColumns
|
|
3071
|
+
if (cColumns && cColumns.length) {
|
|
2993
3072
|
columnsForAdmin = columnsForAdmin || {};
|
|
2994
|
-
columnsForAdmin[obj.common.name] = cColumns.sort((a, b) =>
|
|
3073
|
+
columnsForAdmin[obj.common.name] = cColumns.sort((a, b) => a.path > b.path ? -1 : a.path < b.path ? 1 : 0);
|
|
2995
3074
|
}
|
|
2996
3075
|
}
|
|
2997
3076
|
else if (obj.common && obj.common.name && columnsForAdmin && columnsForAdmin[obj.common.name]) {
|
|
@@ -3019,17 +3098,62 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3019
3098
|
}, 500);
|
|
3020
3099
|
}
|
|
3021
3100
|
}
|
|
3101
|
+
// This function is called when the user changes the alias of an object.
|
|
3102
|
+
// It updates the aliasMap and returns true if the aliasMap has changed.
|
|
3103
|
+
updateAliases(aliasId) {
|
|
3104
|
+
var _b, _c, _d;
|
|
3105
|
+
if (!this.objects || !((_b = this.info) === null || _b === void 0 ? void 0 : _b.aliasesMap) || !(aliasId === null || aliasId === void 0 ? void 0 : aliasId.startsWith('alias.'))) {
|
|
3106
|
+
return;
|
|
3107
|
+
}
|
|
3108
|
+
// Rebuild aliases map
|
|
3109
|
+
const aliasesIds = Object.keys(this.objects).filter(id => id.startsWith('alias.0'));
|
|
3110
|
+
this.info.aliasesMap = {};
|
|
3111
|
+
for (const id of aliasesIds) {
|
|
3112
|
+
const obj = this.objects[id];
|
|
3113
|
+
if ((_d = (_c = obj === null || obj === void 0 ? void 0 : obj.common) === null || _c === void 0 ? void 0 : _c.alias) === null || _d === void 0 ? void 0 : _d.id) {
|
|
3114
|
+
if (typeof obj.common.alias.id === 'string') {
|
|
3115
|
+
const usedId = obj.common.alias.id;
|
|
3116
|
+
if (!this.info.aliasesMap[usedId]) {
|
|
3117
|
+
this.info.aliasesMap[usedId] = [id];
|
|
3118
|
+
}
|
|
3119
|
+
else if (!this.info.aliasesMap[usedId].includes(id)) {
|
|
3120
|
+
this.info.aliasesMap[usedId].push(id);
|
|
3121
|
+
}
|
|
3122
|
+
}
|
|
3123
|
+
else {
|
|
3124
|
+
const readId = obj.common.alias.id.read;
|
|
3125
|
+
if (readId) {
|
|
3126
|
+
if (!this.info.aliasesMap[readId]) {
|
|
3127
|
+
this.info.aliasesMap[readId] = [id];
|
|
3128
|
+
}
|
|
3129
|
+
else if (!this.info.aliasesMap[readId].includes(id)) {
|
|
3130
|
+
this.info.aliasesMap[readId].push(id);
|
|
3131
|
+
}
|
|
3132
|
+
}
|
|
3133
|
+
const writeId = obj.common.alias.id.write;
|
|
3134
|
+
if (writeId) {
|
|
3135
|
+
if (!this.info.aliasesMap[writeId]) {
|
|
3136
|
+
this.info.aliasesMap[writeId] = [id];
|
|
3137
|
+
}
|
|
3138
|
+
else if (!this.info.aliasesMap[writeId].includes(id)) {
|
|
3139
|
+
this.info.aliasesMap[writeId].push(id);
|
|
3140
|
+
}
|
|
3141
|
+
}
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
}
|
|
3145
|
+
}
|
|
3022
3146
|
/**
|
|
3023
3147
|
* Processes a single element in regard to certain filters, columns for admin and updates object dict
|
|
3148
|
+
*
|
|
3149
|
+
* @param id The id of the object
|
|
3150
|
+
* @param obj The object itself
|
|
3024
3151
|
* @returns Returns an object containing the new state (if any) and whether the object was filtered.
|
|
3025
3152
|
*/
|
|
3026
|
-
processOnObjectChangeElement(
|
|
3027
|
-
/** The id of the object */
|
|
3028
|
-
id,
|
|
3029
|
-
/** The object itself */
|
|
3030
|
-
obj) {
|
|
3153
|
+
processOnObjectChangeElement(id, obj) {
|
|
3031
3154
|
console.log(`> objectChange ${id}`);
|
|
3032
3155
|
const type = obj === null || obj === void 0 ? void 0 : obj.type;
|
|
3156
|
+
// If the object is filtered out, we don't need to update the React state
|
|
3033
3157
|
if (obj &&
|
|
3034
3158
|
typeof this.props.filterFunc === 'function' &&
|
|
3035
3159
|
!this.props.filterFunc(obj) &&
|
|
@@ -3041,7 +3165,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3041
3165
|
return { newInnerState: null, filtered: true };
|
|
3042
3166
|
}
|
|
3043
3167
|
let newInnerState = null;
|
|
3044
|
-
if (id.startsWith('system.adapter.') && obj
|
|
3168
|
+
if (id.startsWith('system.adapter.') && (obj === null || obj === void 0 ? void 0 : obj.type) === 'adapter') {
|
|
3045
3169
|
const columnsForAdmin = JSON.parse(JSON.stringify(this.state.columnsForAdmin));
|
|
3046
3170
|
this.parseObjectForAdmins(columnsForAdmin, obj);
|
|
3047
3171
|
if (JSON.stringify(this.state.columnsForAdmin) !== JSON.stringify(columnsForAdmin)) {
|
|
@@ -3055,6 +3179,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3055
3179
|
else if (this.objects[id]) {
|
|
3056
3180
|
delete this.objects[id];
|
|
3057
3181
|
}
|
|
3182
|
+
this.updateAliases(id);
|
|
3058
3183
|
return { newInnerState, filtered: false };
|
|
3059
3184
|
}
|
|
3060
3185
|
subscribe(id) {
|
|
@@ -3062,7 +3187,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3062
3187
|
this.subscribes.push(id);
|
|
3063
3188
|
console.log(`+ subscribe ${id}`);
|
|
3064
3189
|
if (!this.pausedSubscribes) {
|
|
3065
|
-
this.props.socket
|
|
3190
|
+
this.props.socket
|
|
3191
|
+
.subscribeState(id, this.onStateChange)
|
|
3192
|
+
.catch(e => console.error(`Cannot subscribe on state ${id}: ${e}`));
|
|
3066
3193
|
}
|
|
3067
3194
|
}
|
|
3068
3195
|
}
|
|
@@ -3136,13 +3263,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3136
3263
|
}
|
|
3137
3264
|
}
|
|
3138
3265
|
isFilterEmpty() {
|
|
3139
|
-
const someNotEmpty = Object.keys(this.state.filter)
|
|
3140
|
-
.find(attr => attr !== 'expertMode' && this.state.filter[attr]);
|
|
3266
|
+
const someNotEmpty = Object.keys(this.state.filter).find(attr => attr !== 'expertMode' && this.state.filter[attr]);
|
|
3141
3267
|
return !someNotEmpty;
|
|
3142
3268
|
}
|
|
3143
3269
|
getFilterInput(filterName) {
|
|
3144
3270
|
var _b, _c, _d;
|
|
3145
|
-
return react_1.default.createElement(material_1.FormControl, { sx: this.styles.filterInput, key: `${filterName}_${this.state.filterKey}`,
|
|
3271
|
+
return (react_1.default.createElement(material_1.FormControl, { sx: this.styles.filterInput, key: `${filterName}_${this.state.filterKey}`,
|
|
3146
3272
|
// style={{ marginTop: 0, marginBottom: 0 }}
|
|
3147
3273
|
margin: "dense" },
|
|
3148
3274
|
react_1.default.createElement(material_1.Input, { ref: this.filterRefs[filterName], classes: { underline: 'no-underline' }, id: filterName, placeholder: this.texts[`filter_${filterName}`], defaultValue: this.state.filter[filterName] || '', onChange: () => {
|
|
@@ -3151,7 +3277,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3151
3277
|
}
|
|
3152
3278
|
this.filterTimer = setTimeout(() => this.onFilter(), 400);
|
|
3153
3279
|
}, autoComplete: "off" }),
|
|
3154
|
-
((_d = (_c = (_b = this.filterRefs[filterName]) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.firstChild) === null || _d === void 0 ? void 0 : _d.value) ? react_1.default.createElement("div", { style: {
|
|
3280
|
+
((_d = (_c = (_b = this.filterRefs[filterName]) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.firstChild) === null || _d === void 0 ? void 0 : _d.value) ? (react_1.default.createElement("div", { style: {
|
|
3155
3281
|
position: 'absolute',
|
|
3156
3282
|
right: 0,
|
|
3157
3283
|
} },
|
|
@@ -3160,12 +3286,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3160
3286
|
((_b = this.filterRefs[filterName].current) === null || _b === void 0 ? void 0 : _b.firstChild).value = '';
|
|
3161
3287
|
this.onFilter(filterName, '');
|
|
3162
3288
|
} },
|
|
3163
|
-
react_1.default.createElement(icons_material_1.Close, null))) : null);
|
|
3289
|
+
react_1.default.createElement(icons_material_1.Close, null)))) : null));
|
|
3164
3290
|
}
|
|
3165
3291
|
getFilterSelect(name, values) {
|
|
3166
3292
|
var _b, _c, _d;
|
|
3167
3293
|
const hasIcons = !!(values === null || values === void 0 ? void 0 : values.find(item => item.icon));
|
|
3168
|
-
return react_1.default.createElement("div", { style: { position: 'relative' } },
|
|
3294
|
+
return (react_1.default.createElement("div", { style: { position: 'relative' } },
|
|
3169
3295
|
react_1.default.createElement(material_1.Select, { variant: "standard", key: `${name}_${this.state.filterKey}`, ref: this.filterRefs[name], sx: styles.headerCellInput, className: "no-underline", onChange: () => {
|
|
3170
3296
|
if (this.filterTimer) {
|
|
3171
3297
|
clearTimeout(this.filterTimer);
|
|
@@ -3187,11 +3313,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3187
3313
|
id = item;
|
|
3188
3314
|
_name = item;
|
|
3189
3315
|
}
|
|
3190
|
-
return react_1.default.createElement(material_1.MenuItem, { sx: styles.headerCellSelectItem, key: id, value: id },
|
|
3316
|
+
return (react_1.default.createElement(material_1.MenuItem, { sx: styles.headerCellSelectItem, key: id, value: id },
|
|
3191
3317
|
icon || (hasIcons ? react_1.default.createElement("div", { className: "itemIcon" }) : null),
|
|
3192
|
-
_name);
|
|
3318
|
+
_name));
|
|
3193
3319
|
})),
|
|
3194
|
-
((_d = (_c = (_b = this.filterRefs[name]) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.childNodes[1]) === null || _d === void 0 ? void 0 : _d.value) ? react_1.default.createElement(material_1.Box, { component: "div", sx: styles.selectClearButton },
|
|
3320
|
+
((_d = (_c = (_b = this.filterRefs[name]) === null || _b === void 0 ? void 0 : _b.current) === null || _c === void 0 ? void 0 : _c.childNodes[1]) === null || _d === void 0 ? void 0 : _d.value) ? (react_1.default.createElement(material_1.Box, { component: "div", sx: styles.selectClearButton },
|
|
3195
3321
|
react_1.default.createElement(material_1.IconButton, { size: "small", onClick: () => {
|
|
3196
3322
|
var _b;
|
|
3197
3323
|
const newFilter = Object.assign({}, this.state.filter);
|
|
@@ -3200,7 +3326,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3200
3326
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectFilter`, JSON.stringify(newFilter));
|
|
3201
3327
|
this.setState({ filter: newFilter, filterKey: this.state.filterKey + 1 }, () => this.props.onFilterChanged && this.props.onFilterChanged(newFilter));
|
|
3202
3328
|
} },
|
|
3203
|
-
react_1.default.createElement(icons_material_1.Close, null))) : null);
|
|
3329
|
+
react_1.default.createElement(icons_material_1.Close, null)))) : null));
|
|
3204
3330
|
}
|
|
3205
3331
|
getFilterSelectRole() {
|
|
3206
3332
|
return this.getFilterSelect('role', this.info.roles);
|
|
@@ -3211,7 +3337,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3211
3337
|
return ({
|
|
3212
3338
|
name: getName((_c = (_b = this.objects[id]) === null || _b === void 0 ? void 0 : _b.common) === null || _c === void 0 ? void 0 : _c.name, this.props.lang) || id.split('.').pop(),
|
|
3213
3339
|
value: id,
|
|
3214
|
-
icon: react_1.default.createElement(Icon_1.default, { src: ((_e = (_d = this.objects[id]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.icon) || '', style: styles.selectIcon }),
|
|
3340
|
+
icon: (react_1.default.createElement(Icon_1.default, { src: ((_e = (_d = this.objects[id]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.icon) || '', style: styles.selectIcon })),
|
|
3215
3341
|
});
|
|
3216
3342
|
});
|
|
3217
3343
|
return this.getFilterSelect('room', rooms);
|
|
@@ -3222,7 +3348,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3222
3348
|
return ({
|
|
3223
3349
|
name: getName((_c = (_b = this.objects[id]) === null || _b === void 0 ? void 0 : _b.common) === null || _c === void 0 ? void 0 : _c.name, this.props.lang) || id.split('.').pop(),
|
|
3224
3350
|
value: id,
|
|
3225
|
-
icon: react_1.default.createElement(Icon_1.default, { src: ((_e = (_d = this.objects[id]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.icon) || '', style: styles.selectIcon }),
|
|
3351
|
+
icon: (react_1.default.createElement(Icon_1.default, { src: ((_e = (_d = this.objects[id]) === null || _d === void 0 ? void 0 : _d.common) === null || _e === void 0 ? void 0 : _e.icon) || '', style: styles.selectIcon })),
|
|
3226
3352
|
});
|
|
3227
3353
|
});
|
|
3228
3354
|
return this.getFilterSelect('func', func);
|
|
@@ -3240,7 +3366,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3240
3366
|
const customs = this.info.customs.map(id => ({
|
|
3241
3367
|
name: id === '_' ? this.texts.filterCustomsWithout : id,
|
|
3242
3368
|
value: id,
|
|
3243
|
-
icon: id === '_' ? null : react_1.default.createElement(Icon_1.default, { src: getSelectIdIconFromObjects(this.objects, id, this.imagePrefix) || '', style: styles.selectIcon }),
|
|
3369
|
+
icon: id === '_' ? null : (react_1.default.createElement(Icon_1.default, { src: getSelectIdIconFromObjects(this.objects, id, this.props.lang, this.imagePrefix) || '', style: styles.selectIcon })),
|
|
3244
3370
|
}));
|
|
3245
3371
|
return this.getFilterSelect('custom', customs);
|
|
3246
3372
|
}
|
|
@@ -3437,10 +3563,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3437
3563
|
if (this.state.showExportDialog === false) {
|
|
3438
3564
|
return null;
|
|
3439
3565
|
}
|
|
3440
|
-
return react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "lg" },
|
|
3566
|
+
return (react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "lg" },
|
|
3441
3567
|
react_1.default.createElement(material_1.DialogTitle, null, this.props.t('ra_Select type of export')),
|
|
3442
3568
|
react_1.default.createElement(material_1.DialogContent, null,
|
|
3443
|
-
react_1.default.createElement(material_1.DialogContentText, null, this.state.filter.expertMode || this.state.showAllExportOptions ? react_1.default.createElement(react_1.default.Fragment, null,
|
|
3569
|
+
react_1.default.createElement(material_1.DialogContentText, null, this.state.filter.expertMode || this.state.showAllExportOptions ? (react_1.default.createElement(react_1.default.Fragment, null,
|
|
3444
3570
|
this.props.t('ra_You can export all objects or just the selected branch.'),
|
|
3445
3571
|
react_1.default.createElement("br", null),
|
|
3446
3572
|
this.props.t('ra_Selected %s object(s)', this.state.showExportDialog),
|
|
@@ -3451,9 +3577,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3451
3577
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: this.state.beautifyJsonExport, onChange: e => this.setState({ beautifyJsonExport: e.target.checked }) }), label: this.props.t('Beautify JSON output') }),
|
|
3452
3578
|
react_1.default.createElement("br", null),
|
|
3453
3579
|
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: this.state.excludeSystemRepositoriesFromExport, onChange: e => this.setState({ excludeSystemRepositoriesFromExport: e.target.checked }) }), label: this.props.t('Exclude system repositories from export JSON') }),
|
|
3454
|
-
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: this.state.excludeTranslations, onChange: e => this.setState({ excludeTranslations: e.target.checked }) }), label: this.props.t('Exclude translations (except english) from export JSON') })) : null)),
|
|
3580
|
+
react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { checked: this.state.excludeTranslations, onChange: e => this.setState({ excludeTranslations: e.target.checked }) }), label: this.props.t('Exclude translations (except english) from export JSON') }))) : null)),
|
|
3455
3581
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
3456
|
-
this.state.filter.expertMode || this.state.showAllExportOptions ? react_1.default.createElement(material_1.Button, { color: "grey", variant: "outlined", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
|
|
3582
|
+
this.state.filter.expertMode || this.state.showAllExportOptions ? (react_1.default.createElement(material_1.Button, { color: "grey", variant: "outlined", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
|
|
3457
3583
|
isAll: true,
|
|
3458
3584
|
noStatesByExportImport: this.state.noStatesByExportImport,
|
|
3459
3585
|
beautify: this.state.beautifyJsonExport,
|
|
@@ -3463,7 +3589,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3463
3589
|
react_1.default.createElement("span", { style: { marginRight: 8 } }, this.props.t('ra_All objects')),
|
|
3464
3590
|
"(",
|
|
3465
3591
|
Object.keys(this.objects).length,
|
|
3466
|
-
")") : react_1.default.createElement(material_1.Button, { color: "grey", variant: "outlined", startIcon: react_1.default.createElement(IconExpert_1.default, null), onClick: () => this.setState({ showAllExportOptions: true }) }, this.props.t('ra_Advanced options')),
|
|
3592
|
+
")")) : (react_1.default.createElement(material_1.Button, { color: "grey", variant: "outlined", startIcon: react_1.default.createElement(IconExpert_1.default, null), onClick: () => this.setState({ showAllExportOptions: true }) }, this.props.t('ra_Advanced options'))),
|
|
3467
3593
|
react_1.default.createElement(material_1.Button, { color: "primary", variant: "contained", autoFocus: true, onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }, () => this._exportObjects({
|
|
3468
3594
|
isAll: false,
|
|
3469
3595
|
noStatesByExportImport: this.state.noStatesByExportImport,
|
|
@@ -3475,7 +3601,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3475
3601
|
"(",
|
|
3476
3602
|
this.state.showExportDialog,
|
|
3477
3603
|
")"),
|
|
3478
|
-
react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel'))));
|
|
3604
|
+
react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.setState({ showExportDialog: false, showAllExportOptions: false }), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel')))));
|
|
3479
3605
|
}
|
|
3480
3606
|
handleJsonUpload(evt) {
|
|
3481
3607
|
var _b;
|
|
@@ -3574,7 +3700,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3574
3700
|
allowObjectCreation = true;
|
|
3575
3701
|
}
|
|
3576
3702
|
}
|
|
3577
|
-
return react_1.default.createElement("div", { style: {
|
|
3703
|
+
return (react_1.default.createElement("div", { style: {
|
|
3578
3704
|
display: 'flex',
|
|
3579
3705
|
width: '100%',
|
|
3580
3706
|
alignItems: 'center',
|
|
@@ -3585,23 +3711,23 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3585
3711
|
width: '100%',
|
|
3586
3712
|
alignItems: 'center',
|
|
3587
3713
|
} },
|
|
3588
|
-
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Refresh tree'),
|
|
3714
|
+
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Refresh tree'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3589
3715
|
react_1.default.createElement("div", null,
|
|
3590
3716
|
react_1.default.createElement(material_1.IconButton, { onClick: () => this.refreshComponent(), disabled: this.state.updating, size: "large" },
|
|
3591
3717
|
react_1.default.createElement(icons_material_1.Refresh, null)))),
|
|
3592
|
-
this.props.showExpertButton && !this.props.expertMode && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_expertMode'),
|
|
3718
|
+
this.props.showExpertButton && !this.props.expertMode && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_expertMode'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3593
3719
|
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" },
|
|
3594
|
-
react_1.default.createElement(IconExpert_1.default, null))),
|
|
3595
|
-
!this.props.disableColumnSelector && this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Configure'),
|
|
3720
|
+
react_1.default.createElement(IconExpert_1.default, null)))),
|
|
3721
|
+
!this.props.disableColumnSelector && this.props.width !== 'xs' && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Configure'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3596
3722
|
react_1.default.createElement(material_1.IconButton, { key: "columnSelector", color: this.state.columnsAuto ? 'primary' : 'default', onClick: () => this.setState({ columnsSelectorShow: true }), size: "large" },
|
|
3597
|
-
react_1.default.createElement(icons_material_1.ViewColumn, null))),
|
|
3598
|
-
this.props.width !== 'xs' && this.state.expandAllVisible && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand all nodes'),
|
|
3723
|
+
react_1.default.createElement(icons_material_1.ViewColumn, null)))),
|
|
3724
|
+
this.props.width !== 'xs' && this.state.expandAllVisible && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand all nodes'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3599
3725
|
react_1.default.createElement(material_1.IconButton, { key: "expandAll", onClick: () => this.onExpandAll(), size: "large" },
|
|
3600
|
-
react_1.default.createElement(IconOpen_1.default, null))),
|
|
3601
|
-
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse all nodes'),
|
|
3726
|
+
react_1.default.createElement(IconOpen_1.default, null)))),
|
|
3727
|
+
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse all nodes'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3602
3728
|
react_1.default.createElement(material_1.IconButton, { key: "collapseAll", onClick: () => this.onCollapseAll(), size: "large" },
|
|
3603
3729
|
react_1.default.createElement(IconClosed_1.default, null))),
|
|
3604
|
-
this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand one step node'),
|
|
3730
|
+
this.props.width !== 'xs' && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Expand one step node'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3605
3731
|
react_1.default.createElement(material_1.IconButton, { key: "expandVisible", color: "primary", onClick: () => this.onExpandVisible(), size: "large" },
|
|
3606
3732
|
react_1.default.createElement(material_1.Badge, { badgeContent: this.state.depth, color: "secondary", sx: (theme) => ({
|
|
3607
3733
|
badge: {
|
|
@@ -3611,8 +3737,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3611
3737
|
padding: '0 4px',
|
|
3612
3738
|
},
|
|
3613
3739
|
}) },
|
|
3614
|
-
react_1.default.createElement(IconOpen_1.default, null)))),
|
|
3615
|
-
this.props.width !== 'xs' && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse one step node'),
|
|
3740
|
+
react_1.default.createElement(IconOpen_1.default, null))))),
|
|
3741
|
+
this.props.width !== 'xs' && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Collapse one step node'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3616
3742
|
react_1.default.createElement(material_1.IconButton, { key: "collapseVisible", color: "primary", onClick: () => this.onCollapseVisible(), size: "large" },
|
|
3617
3743
|
react_1.default.createElement(material_1.Badge, { sx: (theme) => ({
|
|
3618
3744
|
badge: {
|
|
@@ -3622,25 +3748,25 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3622
3748
|
padding: '0 4px',
|
|
3623
3749
|
},
|
|
3624
3750
|
}), badgeContent: this.state.depth, color: "secondary" },
|
|
3625
|
-
react_1.default.createElement(IconClosed_1.default, null)))),
|
|
3626
|
-
this.props.objectStatesView && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Toggle the states view'),
|
|
3751
|
+
react_1.default.createElement(IconClosed_1.default, null))))),
|
|
3752
|
+
this.props.objectStatesView && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Toggle the states view'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3627
3753
|
react_1.default.createElement(material_1.IconButton, { onClick: () => this.onStatesViewVisible(), size: "large" },
|
|
3628
|
-
react_1.default.createElement(icons_material_1.LooksOne, { color: this.state.statesView ? 'primary' : 'inherit' }))),
|
|
3629
|
-
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Show/Hide object descriptions'),
|
|
3754
|
+
react_1.default.createElement(icons_material_1.LooksOne, { color: this.state.statesView ? 'primary' : 'inherit' })))),
|
|
3755
|
+
react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Show/Hide object descriptions'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3630
3756
|
react_1.default.createElement(material_1.IconButton, { onClick: () => {
|
|
3631
3757
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.desc`, this.state.showDescription ? 'false' : 'true');
|
|
3632
3758
|
this.setState({ showDescription: !this.state.showDescription });
|
|
3633
3759
|
}, size: "large" },
|
|
3634
3760
|
react_1.default.createElement(icons_material_1.TextFields, { color: this.state.showDescription ? 'primary' : 'inherit' }))),
|
|
3635
|
-
this.props.objectAddBoolean ? react_1.default.createElement(material_1.Tooltip, { title: this.toolTipObjectCreating(),
|
|
3761
|
+
this.props.objectAddBoolean ? (react_1.default.createElement(material_1.Tooltip, { title: this.toolTipObjectCreating(), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3636
3762
|
react_1.default.createElement("div", null,
|
|
3637
3763
|
react_1.default.createElement(material_1.IconButton, { disabled: !allowObjectCreation, onClick: () => this.setState({
|
|
3638
3764
|
modalNewObj: {
|
|
3639
3765
|
id: this.state.selected[0] || this.state.selectedNonObject,
|
|
3640
3766
|
},
|
|
3641
3767
|
}), size: "large" },
|
|
3642
|
-
react_1.default.createElement(icons_material_1.Add, null)))) : null,
|
|
3643
|
-
this.props.objectImportExport && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Add objects tree from JSON file'),
|
|
3768
|
+
react_1.default.createElement(icons_material_1.Add, null))))) : null,
|
|
3769
|
+
this.props.objectImportExport && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Add objects tree from JSON file'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3644
3770
|
react_1.default.createElement(material_1.IconButton, { onClick: () => {
|
|
3645
3771
|
const input = document.createElement('input');
|
|
3646
3772
|
input.setAttribute('type', 'file');
|
|
@@ -3649,14 +3775,13 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3649
3775
|
input.addEventListener('change', (e) => this.handleJsonUpload(e), false);
|
|
3650
3776
|
input.click();
|
|
3651
3777
|
}, size: "large" },
|
|
3652
|
-
react_1.default.createElement(icons_material_1.Publish, null))),
|
|
3778
|
+
react_1.default.createElement(icons_material_1.Publish, null)))),
|
|
3653
3779
|
this.props.objectImportExport &&
|
|
3654
|
-
(!!this.state.selected.length || this.state.selectedNonObject) &&
|
|
3655
|
-
react_1.default.createElement(material_1.
|
|
3656
|
-
react_1.default.createElement(
|
|
3657
|
-
|
|
3658
|
-
|
|
3659
|
-
this.props.objectEditBoolean && react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Edit custom config'), componentsProps: { popper: { sx: styles.tooltip } } },
|
|
3780
|
+
(!!this.state.selected.length || this.state.selectedNonObject) && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Save objects tree as JSON file'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3781
|
+
react_1.default.createElement(material_1.IconButton, { onClick: () => this.setState({ showExportDialog: this._getSelectedIdsForExport().length }), size: "large" },
|
|
3782
|
+
react_1.default.createElement(icons_material_1.Publish, { style: { transform: 'rotate(180deg)' } }))))),
|
|
3783
|
+
!!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}`)),
|
|
3784
|
+
this.props.objectEditBoolean && (react_1.default.createElement(material_1.Tooltip, { title: this.props.t('ra_Edit custom config'), slotProps: { popper: { sx: styles.tooltip } } },
|
|
3660
3785
|
react_1.default.createElement(material_1.IconButton, { onClick: () => {
|
|
3661
3786
|
var _b;
|
|
3662
3787
|
// get all visible states
|
|
@@ -3673,7 +3798,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3673
3798
|
this.setState({ toast: this.props.t('ra_please select object') });
|
|
3674
3799
|
}
|
|
3675
3800
|
}, size: "large" },
|
|
3676
|
-
react_1.default.createElement(icons_material_1.Build, null))));
|
|
3801
|
+
react_1.default.createElement(icons_material_1.Build, null))))));
|
|
3677
3802
|
}
|
|
3678
3803
|
toggleExpanded(id) {
|
|
3679
3804
|
const expanded = JSON.parse(JSON.stringify(this.state.expanded));
|
|
@@ -3702,10 +3827,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3702
3827
|
renderColumnButtons(id, item) {
|
|
3703
3828
|
var _b, _c, _d;
|
|
3704
3829
|
if (!item.data.obj) {
|
|
3705
|
-
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? react_1.default.createElement("div", { style: styles.buttonDiv },
|
|
3706
|
-
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign(Object.assign({}, styles.cellButtonsButton), styles.cellButtonsEmptyButton), styles.cellButtonMinWidth), onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3707
|
-
react_1.default.createElement("div", { style: { height: 15 } }, "---")) : null,
|
|
3708
|
-
this.props.onObjectDelete && item.children && item.children.length ? react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign({}, styles.cellButtonsButton), styles.cellButtonsButtonAlone), size: "small", "aria-label": "delete", title: this.texts.deleteObject, onClick: () => {
|
|
3830
|
+
return this.props.onObjectDelete || this.props.objectEditOfAccessControl ? (react_1.default.createElement("div", { style: styles.buttonDiv },
|
|
3831
|
+
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign(Object.assign({}, styles.cellButtonsButton), styles.cellButtonsEmptyButton), styles.cellButtonMinWidth), onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3832
|
+
react_1.default.createElement("div", { style: { height: 15 } }, "---"))) : null,
|
|
3833
|
+
this.props.onObjectDelete && item.children && item.children.length ? (react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign({}, styles.cellButtonsButton), styles.cellButtonsButtonAlone), size: "small", "aria-label": "delete", title: this.texts.deleteObject, onClick: () => {
|
|
3709
3834
|
var _b;
|
|
3710
3835
|
// calculate the number of children
|
|
3711
3836
|
const keys = Object.keys(this.objects);
|
|
@@ -3724,9 +3849,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3724
3849
|
this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), false, count + 1);
|
|
3725
3850
|
}
|
|
3726
3851
|
} },
|
|
3727
|
-
react_1.default.createElement(icons_material_1.Delete, { style: styles.cellButtonsButtonIcon })) : null) : null;
|
|
3852
|
+
react_1.default.createElement(icons_material_1.Delete, { style: styles.cellButtonsButtonIcon }))) : null)) : null;
|
|
3728
3853
|
}
|
|
3729
|
-
item.data.aclTooltip =
|
|
3854
|
+
item.data.aclTooltip =
|
|
3855
|
+
item.data.aclTooltip || this.renderTooltipAccessControl(item.data.obj.acl);
|
|
3730
3856
|
const acl = item.data.obj.acl
|
|
3731
3857
|
? item.data.obj.type === 'state'
|
|
3732
3858
|
? item.data.obj.acl.state
|
|
@@ -3738,19 +3864,17 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3738
3864
|
: this.systemConfig.common.defaultNewAcl.object);
|
|
3739
3865
|
const showEdit = this.state.filter.expertMode || _a.isNonExpertId(item.data.id);
|
|
3740
3866
|
return [
|
|
3741
|
-
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? react_1.default.createElement(material_1.Tooltip, { key: "acl", title: item.data.aclTooltip,
|
|
3867
|
+
this.state.filter.expertMode && this.props.objectEditOfAccessControl ? (react_1.default.createElement(material_1.Tooltip, { key: "acl", title: item.data.aclTooltip, slotProps: { popper: { sx: styles.tooltip } } },
|
|
3742
3868
|
react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign(Object.assign({}, styles.cellButtonsButton), styles.cellButtonMinWidth), { opacity: 1 }), onClick: () => this.setState({ modalEditOfAccess: true, modalEditOfAccessObjData: item.data }), size: "large" },
|
|
3743
3869
|
react_1.default.createElement("div", { style: styles.aclText }, Number.isNaN(Number(acl))
|
|
3744
3870
|
? Number(aclSystemConfig).toString(16)
|
|
3745
|
-
: Number(acl).toString(16)))) :
|
|
3746
|
-
|
|
3747
|
-
showEdit ? react_1.default.createElement(material_1.IconButton, { key: "edit", sx: Object.assign({ marginRight: '2px' }, styles.cellButtonsButton), size: "small", "aria-label": "edit", title: this.texts.editObject, onClick: () => {
|
|
3871
|
+
: Number(acl).toString(16))))) : (react_1.default.createElement("div", { key: "aclEmpty", style: styles.cellButtonMinWidth })),
|
|
3872
|
+
showEdit ? (react_1.default.createElement(material_1.IconButton, { key: "edit", sx: Object.assign({ marginRight: '2px' }, styles.cellButtonsButton), size: "small", "aria-label": "edit", title: this.texts.editObject, onClick: () => {
|
|
3748
3873
|
this.localStorage.setItem(`${this.props.dialogName || 'App'}.objectSelected`, id);
|
|
3749
3874
|
this.setState({ editObjectDialog: id, editObjectAlias: false });
|
|
3750
3875
|
} },
|
|
3751
|
-
react_1.default.createElement(icons_material_1.Edit, { style: styles.cellButtonsButtonIcon })) :
|
|
3752
|
-
|
|
3753
|
-
this.props.onObjectDelete && (((_b = item.children) === null || _b === void 0 ? void 0 : _b.length) || !((_c = item.data.obj.common) === null || _c === void 0 ? void 0 : _c.dontDelete)) ? react_1.default.createElement(material_1.IconButton, { key: "delete", sx: styles.cellButtonsButton, size: "small", "aria-label": "delete", onClick: () => {
|
|
3876
|
+
react_1.default.createElement(icons_material_1.Edit, { style: styles.cellButtonsButtonIcon }))) : (react_1.default.createElement(material_1.Box, { component: "div", key: "editDisabled", sx: styles.cellButtonsButton })),
|
|
3877
|
+
this.props.onObjectDelete && (((_b = item.children) === null || _b === void 0 ? void 0 : _b.length) || !((_c = item.data.obj.common) === null || _c === void 0 ? void 0 : _c.dontDelete)) ? (react_1.default.createElement(material_1.IconButton, { key: "delete", sx: styles.cellButtonsButton, size: "small", "aria-label": "delete", onClick: () => {
|
|
3754
3878
|
var _b, _c, _d;
|
|
3755
3879
|
const keys = Object.keys(this.objects);
|
|
3756
3880
|
keys.sort();
|
|
@@ -3768,12 +3892,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3768
3892
|
this.props.onObjectDelete(id, !!((_b = item.children) === null || _b === void 0 ? void 0 : _b.length), !((_d = (_c = item.data.obj) === null || _c === void 0 ? void 0 : _c.common) === null || _d === void 0 ? void 0 : _d.dontDelete), count);
|
|
3769
3893
|
}
|
|
3770
3894
|
}, title: this.texts.deleteObject },
|
|
3771
|
-
react_1.default.createElement(icons_material_1.Delete, { style: styles.cellButtonsButtonIcon })) : null,
|
|
3895
|
+
react_1.default.createElement(icons_material_1.Delete, { style: styles.cellButtonsButtonIcon }))) : null,
|
|
3772
3896
|
this.props.objectCustomDialog &&
|
|
3773
3897
|
this.info.hasSomeCustoms &&
|
|
3774
3898
|
item.data.obj.type === 'state' &&
|
|
3775
3899
|
// @ts-expect-error deprecated from js-controller 6
|
|
3776
|
-
((_d = item.data.obj.common) === null || _d === void 0 ? void 0 : _d.type) !== 'file' ? react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign({}, styles.cellButtonsButton), (item.data.hasCustoms
|
|
3900
|
+
((_d = item.data.obj.common) === null || _d === void 0 ? void 0 : _d.type) !== 'file' ? (react_1.default.createElement(material_1.IconButton, { sx: Object.assign(Object.assign({}, styles.cellButtonsButton), (item.data.hasCustoms
|
|
3777
3901
|
? this.styles.cellButtonsButtonWithCustoms
|
|
3778
3902
|
: styles.cellButtonsButtonWithoutCustoms)), key: "custom", size: "small", "aria-label": "config", title: this.texts.customConfig, onClick: () => {
|
|
3779
3903
|
var _b;
|
|
@@ -3782,7 +3906,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3782
3906
|
(_b = this.props.router) === null || _b === void 0 ? void 0 : _b.doNavigate(null, 'customs', id);
|
|
3783
3907
|
this.setState({ customDialog: [id], customDialogAll: false });
|
|
3784
3908
|
} },
|
|
3785
|
-
react_1.default.createElement(icons_material_1.Settings, { style: styles.cellButtonsButtonIcon })) : null,
|
|
3909
|
+
react_1.default.createElement(icons_material_1.Settings, { style: styles.cellButtonsButtonIcon }))) : null,
|
|
3786
3910
|
];
|
|
3787
3911
|
}
|
|
3788
3912
|
readHistory(id) {
|
|
@@ -3888,7 +4012,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3888
4012
|
return null;
|
|
3889
4013
|
}
|
|
3890
4014
|
if (((_b = obj.common) === null || _b === void 0 ? void 0 : _b.type) === 'file') {
|
|
3891
|
-
return react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign({}, styles.cellValueText), styles.cellValueFile) }, "[file]");
|
|
4015
|
+
return (react_1.default.createElement(material_1.Box, { component: "div", sx: Object.assign(Object.assign({}, styles.cellValueText), styles.cellValueFile) }, "[file]"));
|
|
3892
4016
|
}
|
|
3893
4017
|
if (!this.states[id]) {
|
|
3894
4018
|
if (obj.type === 'state') {
|
|
@@ -3912,7 +4036,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3912
4036
|
obj: obj,
|
|
3913
4037
|
texts: this.texts,
|
|
3914
4038
|
dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat,
|
|
3915
|
-
isFloatComma: this.props.isFloatComma === undefined
|
|
4039
|
+
isFloatComma: this.props.isFloatComma === undefined
|
|
4040
|
+
? this.systemConfig.common.isFloatComma
|
|
4041
|
+
: this.props.isFloatComma,
|
|
3916
4042
|
});
|
|
3917
4043
|
const valTextRx = [];
|
|
3918
4044
|
item.data.state = { valTextRx };
|
|
@@ -3942,23 +4068,32 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3942
4068
|
let val = info.valTextRx;
|
|
3943
4069
|
if (!this.state.filter.expertMode) {
|
|
3944
4070
|
if (item.data.button) {
|
|
3945
|
-
val = [
|
|
4071
|
+
val = [
|
|
4072
|
+
react_1.default.createElement(ButtonIcon, { key: "button", style: Object.assign({ color: info.style.color }, styles.cellValueButton) }),
|
|
4073
|
+
];
|
|
3946
4074
|
}
|
|
3947
4075
|
else if (item.data.switch) {
|
|
3948
|
-
val = [
|
|
4076
|
+
val = [
|
|
4077
|
+
react_1.default.createElement(material_1.Switch, { key: "switch", sx: {
|
|
3949
4078
|
'& .MuiSwitch-thumb': { color: info.style.color },
|
|
3950
|
-
'& .MuiSwitch-track':
|
|
3951
|
-
|
|
3952
|
-
|
|
4079
|
+
'& .MuiSwitch-track': {
|
|
4080
|
+
backgroundColor: !!this.states[id].val && this.state.selected.includes(id)
|
|
4081
|
+
? this.props.themeType === 'dark'
|
|
4082
|
+
? '#FFF !important'
|
|
4083
|
+
: '#111 !important'
|
|
4084
|
+
: undefined,
|
|
4085
|
+
},
|
|
4086
|
+
}, checked: !!this.states[id].val }),
|
|
4087
|
+
];
|
|
3953
4088
|
}
|
|
3954
4089
|
}
|
|
3955
|
-
return react_1.default.createElement(material_1.Tooltip, { key: "value", title: (_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el,
|
|
4090
|
+
return (react_1.default.createElement(material_1.Tooltip, { key: "value", title: (_c = this.state.tooltipInfo) === null || _c === void 0 ? void 0 : _c.el, slotProps: {
|
|
3956
4091
|
popper: { sx: styles.cellValueTooltipBox },
|
|
3957
4092
|
tooltip: { sx: styles.cellValueTooltip },
|
|
3958
4093
|
}, 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 }); } },
|
|
3959
4094
|
react_1.default.createElement(material_1.Box, { component: "div", style: info.style, sx: Object.assign(Object.assign({}, styles.cellValueText), { height: narrowStyleWithDetails ? undefined : ROW_HEIGHT, '& .admin-button:active': {
|
|
3960
4095
|
transform: 'translate(0, 2px)',
|
|
3961
|
-
} }) }, val));
|
|
4096
|
+
} }) }, val)));
|
|
3962
4097
|
}
|
|
3963
4098
|
_syncEnum(id, enumIds, newArray, cb) {
|
|
3964
4099
|
var _b, _c, _d;
|
|
@@ -3996,8 +4131,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
3996
4131
|
.catch(e => this.showError(e)));
|
|
3997
4132
|
}
|
|
3998
4133
|
}
|
|
3999
|
-
Promise.all(promises)
|
|
4000
|
-
.then(() => {
|
|
4134
|
+
void Promise.all(promises).then(() => {
|
|
4001
4135
|
setTimeout(() => this._syncEnum(id, enumIds, newArray, cb), 0);
|
|
4002
4136
|
});
|
|
4003
4137
|
}
|
|
@@ -4024,18 +4158,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4024
4158
|
return ({
|
|
4025
4159
|
name: getName(((_c = (_b = this.objects[id]) === null || _b === void 0 ? void 0 : _b.common) === null || _c === void 0 ? void 0 : _c.name) || id.split('.').pop() || '', this.props.lang),
|
|
4026
4160
|
value: id,
|
|
4027
|
-
icon: getSelectIdIconFromObjects(this.objects, id, this.imagePrefix),
|
|
4161
|
+
icon: getSelectIdIconFromObjects(this.objects, id, this.props.lang, this.imagePrefix),
|
|
4028
4162
|
});
|
|
4029
4163
|
})
|
|
4030
4164
|
.sort((a, b) => (a.name > b.name ? 1 : -1));
|
|
4031
4165
|
enums.forEach(_item => {
|
|
4032
4166
|
if (_item.icon && typeof _item.icon === 'string') {
|
|
4033
|
-
_item.icon = react_1.default.createElement(material_1.Box, { style: styles.enumIconDiv },
|
|
4034
|
-
react_1.default.createElement("img", { src: _item.icon, style: styles.enumIcon, alt: _item.name }));
|
|
4167
|
+
_item.icon = (react_1.default.createElement(material_1.Box, { style: styles.enumIconDiv },
|
|
4168
|
+
react_1.default.createElement("img", { src: _item.icon, style: styles.enumIcon, alt: _item.name })));
|
|
4035
4169
|
}
|
|
4036
4170
|
});
|
|
4037
4171
|
// const hasIcons = !!enums.find(item => item.icon);
|
|
4038
|
-
return react_1.default.createElement(material_1.Dialog, { sx: { '& .MuiPaper-root': styles.enumDialog }, onClose: () => this.setState({ enumDialog: null }), "aria-labelledby": "enum-dialog-title", open: !0 },
|
|
4172
|
+
return (react_1.default.createElement(material_1.Dialog, { sx: { '& .MuiPaper-root': styles.enumDialog }, onClose: () => this.setState({ enumDialog: null }), "aria-labelledby": "enum-dialog-title", open: !0 },
|
|
4039
4173
|
react_1.default.createElement(material_1.DialogTitle, { id: "enum-dialog-title" },
|
|
4040
4174
|
type === 'func' ? this.props.t('ra_Define functions') : this.props.t('ra_Define rooms'),
|
|
4041
4175
|
react_1.default.createElement(material_1.Fab, { sx: styles.enumButton, color: "primary", disabled: enumsOriginal === JSON.stringify(itemEnums), size: "small", onClick: () => this.syncEnum(item.data.id, type, itemEnums).then(() => this.setState({ enumDialog: null, enumDialogEnums: null })) },
|
|
@@ -4054,7 +4188,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4054
4188
|
name = _item;
|
|
4055
4189
|
}
|
|
4056
4190
|
const labelId = `checkbox-list-label-${id}`;
|
|
4057
|
-
return react_1.default.createElement(material_1.ListItem, { sx: styles.headerCellSelectItem, key: id, onClick: () => {
|
|
4191
|
+
return (react_1.default.createElement(material_1.ListItem, { sx: styles.headerCellSelectItem, key: id, onClick: () => {
|
|
4058
4192
|
const pos = itemEnums.indexOf(id);
|
|
4059
4193
|
const enumDialogEnums = JSON.parse(JSON.stringify(this.state.enumDialogEnums));
|
|
4060
4194
|
if (pos === -1) {
|
|
@@ -4065,12 +4199,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4065
4199
|
enumDialogEnums.splice(pos, 1);
|
|
4066
4200
|
}
|
|
4067
4201
|
this.setState({ enumDialogEnums });
|
|
4068
|
-
} },
|
|
4202
|
+
}, secondaryAction: icon },
|
|
4069
4203
|
react_1.default.createElement(material_1.ListItemIcon, { sx: { '&.MuiListItemIcon-root': styles.enumCheckbox } },
|
|
4070
4204
|
react_1.default.createElement(material_1.Checkbox, { edge: "start", checked: itemEnums.includes(id), tabIndex: -1, disableRipple: true, inputProps: { 'aria-labelledby': labelId } })),
|
|
4071
|
-
react_1.default.createElement(material_1.ListItemText, { id: labelId }, name)
|
|
4072
|
-
|
|
4073
|
-
})));
|
|
4205
|
+
react_1.default.createElement(material_1.ListItemText, { id: labelId }, name)));
|
|
4206
|
+
}))));
|
|
4074
4207
|
}
|
|
4075
4208
|
renderEditRoleDialog() {
|
|
4076
4209
|
if (!this.state.roleDialog || !this.props.objectBrowserEditRole) {
|
|
@@ -4078,12 +4211,12 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4078
4211
|
}
|
|
4079
4212
|
if (this.state.roleDialog && this.props.objectBrowserEditRole) {
|
|
4080
4213
|
const ObjectBrowserEditRole = this.props.objectBrowserEditRole;
|
|
4081
|
-
return react_1.default.createElement(ObjectBrowserEditRole, { key: "objectBrowserEditRole", id: this.state.roleDialog, socket: this.props.socket, t: this.props.t, roles: this.info.roles, onClose: (obj) => {
|
|
4214
|
+
return (react_1.default.createElement(ObjectBrowserEditRole, { key: "objectBrowserEditRole", id: this.state.roleDialog, socket: this.props.socket, t: this.props.t, roles: this.info.roles, onClose: (obj) => {
|
|
4082
4215
|
if (obj) {
|
|
4083
4216
|
this.info.objects[this.state.roleDialog] = obj;
|
|
4084
4217
|
}
|
|
4085
4218
|
this.setState({ roleDialog: null });
|
|
4086
|
-
} });
|
|
4219
|
+
} }));
|
|
4087
4220
|
}
|
|
4088
4221
|
return null;
|
|
4089
4222
|
}
|
|
@@ -4104,7 +4237,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4104
4237
|
.getObject(((_c = (_b = this.state.columnsEditCustomDialog) === null || _b === void 0 ? void 0 : _b.obj) === null || _c === void 0 ? void 0 : _c._id) || '')
|
|
4105
4238
|
.then(obj => {
|
|
4106
4239
|
var _b;
|
|
4107
|
-
if (obj &&
|
|
4240
|
+
if (obj &&
|
|
4241
|
+
_a.setCustomValue(obj, (_b = this.state.columnsEditCustomDialog) === null || _b === void 0 ? void 0 : _b.it, value)) {
|
|
4108
4242
|
return this.props.socket.setObject(obj._id, obj);
|
|
4109
4243
|
}
|
|
4110
4244
|
throw new Error(this.props.t('ra_Cannot update attribute, because not found in the object'));
|
|
@@ -4129,27 +4263,27 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4129
4263
|
value: (value === null || value === undefined ? '' : value).toString(),
|
|
4130
4264
|
};
|
|
4131
4265
|
}
|
|
4132
|
-
return react_1.default.createElement(material_1.Dialog, { onClose: () => this.setState({ columnsEditCustomDialog: null }), maxWidth: "md", "aria-labelledby": "custom-dialog-title", open: !0 },
|
|
4266
|
+
return (react_1.default.createElement(material_1.Dialog, { onClose: () => this.setState({ columnsEditCustomDialog: null }), maxWidth: "md", "aria-labelledby": "custom-dialog-title", open: !0 },
|
|
4133
4267
|
react_1.default.createElement(material_1.DialogTitle, { id: "custom-dialog-title" }, `${this.props.t('ra_Edit object field')}: ${this.state.columnsEditCustomDialog.obj._id}`),
|
|
4134
4268
|
react_1.default.createElement(material_1.DialogContent, null,
|
|
4135
|
-
react_1.default.createElement(material_1.DialogContentText, { id: "alert-dialog-description" }, this.customColumnDialog.type === 'boolean' ? react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { onKeyUp: e => e.key === 'Enter' && this.onColumnsEditCustomDialogClose(true), defaultChecked: this.customColumnDialog.value === 'true', onChange: e => {
|
|
4269
|
+
react_1.default.createElement(material_1.DialogContentText, { id: "alert-dialog-description" }, this.customColumnDialog.type === 'boolean' ? (react_1.default.createElement(material_1.FormControlLabel, { control: react_1.default.createElement(material_1.Checkbox, { onKeyUp: e => e.key === 'Enter' && this.onColumnsEditCustomDialogClose(true), defaultChecked: this.customColumnDialog.value === 'true', onChange: e => {
|
|
4136
4270
|
const customColumnDialog = this.customColumnDialog;
|
|
4137
4271
|
customColumnDialog.value = e.target.checked.toString();
|
|
4138
4272
|
const changed = customColumnDialog.value !== customColumnDialog.initValue;
|
|
4139
4273
|
if (changed === !this.state.customColumnDialogValueChanged) {
|
|
4140
4274
|
this.setState({ customColumnDialogValueChanged: changed });
|
|
4141
4275
|
}
|
|
4142
|
-
} }), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})` }) : react_1.default.createElement(material_1.TextField, { variant: "standard", defaultValue: this.customColumnDialog.value, fullWidth: true, onKeyUp: e => e.key === 'Enter' && this.onColumnsEditCustomDialogClose(true), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`, onChange: e => {
|
|
4276
|
+
} }), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})` })) : (react_1.default.createElement(material_1.TextField, { variant: "standard", defaultValue: this.customColumnDialog.value, fullWidth: true, onKeyUp: e => e.key === 'Enter' && this.onColumnsEditCustomDialogClose(true), label: `${this.state.columnsEditCustomDialog.it.name} (${this.state.columnsEditCustomDialog.it.pathText})`, onChange: e => {
|
|
4143
4277
|
const customColumnDialog = this.customColumnDialog;
|
|
4144
4278
|
customColumnDialog.value = e.target.value;
|
|
4145
4279
|
const changed = customColumnDialog.value !== customColumnDialog.initValue;
|
|
4146
4280
|
if (changed === !this.state.customColumnDialogValueChanged) {
|
|
4147
4281
|
this.setState({ customColumnDialogValueChanged: changed });
|
|
4148
4282
|
}
|
|
4149
|
-
}, autoFocus: true }))),
|
|
4283
|
+
}, autoFocus: true })))),
|
|
4150
4284
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
4151
4285
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(true), disabled: !this.state.customColumnDialogValueChanged, color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.t('ra_Update')),
|
|
4152
|
-
react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel'))));
|
|
4286
|
+
react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.onColumnsEditCustomDialogClose(), startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.t('ra_Cancel')))));
|
|
4153
4287
|
}
|
|
4154
4288
|
static getCustomValue(obj, it) {
|
|
4155
4289
|
var _b;
|
|
@@ -4163,7 +4297,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4163
4297
|
value = anyObj[p[0]][p[1]];
|
|
4164
4298
|
}
|
|
4165
4299
|
else if (p.length === 3) {
|
|
4166
|
-
value =
|
|
4300
|
+
value =
|
|
4301
|
+
anyObj[p[0]][p[1]] && typeof anyObj[p[0]][p[1]] === 'object' ? anyObj[p[0]][p[1]][p[2]] : null;
|
|
4167
4302
|
}
|
|
4168
4303
|
else if (p.length === 4) {
|
|
4169
4304
|
value =
|
|
@@ -4259,12 +4394,37 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4259
4394
|
const text = _a.getCustomValue(obj, it);
|
|
4260
4395
|
if (text !== null && text !== undefined) {
|
|
4261
4396
|
if (it.edit && !this.props.notEditable && (!it.objTypes || it.objTypes.includes(obj.type))) {
|
|
4262
|
-
return react_1.default.createElement(material_1.Box, { component: "div", style: Object.assign(Object.assign(Object.assign({}, styles.columnCustom), styles.columnCustomEditable), styles[`columnCustom_${it.align}`]), onClick: () => this.setState({
|
|
4397
|
+
return (react_1.default.createElement(material_1.Box, { component: "div", style: Object.assign(Object.assign(Object.assign({}, styles.columnCustom), styles.columnCustomEditable), styles[`columnCustom_${it.align}`]), onClick: () => this.setState({
|
|
4263
4398
|
columnsEditCustomDialog: { item, it, obj },
|
|
4264
4399
|
customColumnDialogValueChanged: false,
|
|
4265
|
-
}) }, text);
|
|
4400
|
+
}) }, text));
|
|
4266
4401
|
}
|
|
4267
|
-
return react_1.default.createElement(material_1.Box, { component: "div", style: Object.assign(Object.assign({}, styles.columnCustom), styles[`columnCustom_${it.align}`]) }, text);
|
|
4402
|
+
return (react_1.default.createElement(material_1.Box, { component: "div", style: Object.assign(Object.assign({}, styles.columnCustom), styles[`columnCustom_${it.align}`]) }, text));
|
|
4403
|
+
}
|
|
4404
|
+
return null;
|
|
4405
|
+
}
|
|
4406
|
+
renderAliasLink(id, index, customStyle) {
|
|
4407
|
+
const _index = index || 0;
|
|
4408
|
+
// read the type of operation
|
|
4409
|
+
const aliasObj = this.objects[this.info.aliasesMap[id][_index]].common.alias.id;
|
|
4410
|
+
if (aliasObj) {
|
|
4411
|
+
return (react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
|
|
4412
|
+
e.stopPropagation();
|
|
4413
|
+
e.preventDefault();
|
|
4414
|
+
const aliasId = this.info.aliasesMap[id][_index];
|
|
4415
|
+
// if more than one alias, close the menu
|
|
4416
|
+
if (this.info.aliasesMap[id].length > 1) {
|
|
4417
|
+
this.setState({ aliasMenu: '' });
|
|
4418
|
+
}
|
|
4419
|
+
this.onSelect(aliasId);
|
|
4420
|
+
setTimeout(() => this.expandAllSelected(() => this.scrollToItem(aliasId)), 100);
|
|
4421
|
+
}, sx: customStyle || this.styles.aliasAlone },
|
|
4422
|
+
react_1.default.createElement("span", { className: "admin-browser-arrow" }, typeof aliasObj === 'string' || (aliasObj.read === id && aliasObj.write === id)
|
|
4423
|
+
? '↔'
|
|
4424
|
+
: aliasObj.read === id
|
|
4425
|
+
? '→'
|
|
4426
|
+
: '←'),
|
|
4427
|
+
this.info.aliasesMap[id][_index]));
|
|
4268
4428
|
}
|
|
4269
4429
|
return null;
|
|
4270
4430
|
}
|
|
@@ -4272,7 +4432,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4272
4432
|
* Renders a leaf.
|
|
4273
4433
|
*/
|
|
4274
4434
|
renderLeaf(item, isExpanded, counter) {
|
|
4275
|
-
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q
|
|
4435
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
|
|
4276
4436
|
const id = item.data.id;
|
|
4277
4437
|
counter.count++;
|
|
4278
4438
|
isExpanded = isExpanded === undefined ? this.state.expanded.includes(id) : isExpanded;
|
|
@@ -4285,9 +4445,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4285
4445
|
itemType === 'device' ||
|
|
4286
4446
|
itemType === 'channel' ||
|
|
4287
4447
|
itemType === 'meta') {
|
|
4288
|
-
iconFolder = isExpanded ?
|
|
4289
|
-
react_1.default.createElement(IconOpen_1.default, { style: this.styles.cellIdIconFolder, onClick: () => this.toggleExpanded(id) }) :
|
|
4290
|
-
react_1.default.createElement(IconClosed_1.default, { style: this.styles.cellIdIconFolder, onClick: () => this.toggleExpanded(id) });
|
|
4448
|
+
iconFolder = isExpanded ? (react_1.default.createElement(IconOpen_1.default, { style: this.styles.cellIdIconFolder, onClick: () => this.toggleExpanded(id) })) : (react_1.default.createElement(IconClosed_1.default, { style: this.styles.cellIdIconFolder, onClick: () => this.toggleExpanded(id) }));
|
|
4291
4449
|
}
|
|
4292
4450
|
else if (obj && obj.common && obj.common.write === false && obj.type === 'state') {
|
|
4293
4451
|
iconFolder = react_1.default.createElement(IconDocumentReadOnly_1.default, { style: this.styles.cellIdIconDocument });
|
|
@@ -4299,10 +4457,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4299
4457
|
if (item.data.icon) {
|
|
4300
4458
|
if (typeof item.data.icon === 'string') {
|
|
4301
4459
|
if (item.data.icon.length < 3) {
|
|
4302
|
-
iconItem = react_1.default.createElement("span", { className: "iconOwn", style: styles.cellIdIconOwn }, item.data.icon); // utf-8 char
|
|
4460
|
+
iconItem = (react_1.default.createElement("span", { className: "iconOwn", style: styles.cellIdIconOwn }, item.data.icon)); // utf-8 char
|
|
4303
4461
|
}
|
|
4304
4462
|
else {
|
|
4305
|
-
iconItem = react_1.default.createElement(Icon_1.default, { style: styles.cellIdIconOwn, className: "iconOwn", src: item.data.icon, alt: "" });
|
|
4463
|
+
iconItem = (react_1.default.createElement(Icon_1.default, { style: styles.cellIdIconOwn, className: "iconOwn", src: item.data.icon, alt: "" }));
|
|
4306
4464
|
}
|
|
4307
4465
|
}
|
|
4308
4466
|
else {
|
|
@@ -4324,8 +4482,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4324
4482
|
}
|
|
4325
4483
|
const checkbox = this.props.multiSelect &&
|
|
4326
4484
|
this.objects[id] &&
|
|
4327
|
-
(!this.props.types || this.props.types.includes(this.objects[id].type)) ?
|
|
4328
|
-
react_1.default.createElement(material_1.Checkbox, { style: styles.checkBox, checked: this.state.selected.includes(id) }) : null;
|
|
4485
|
+
(!this.props.types || this.props.types.includes(this.objects[id].type)) ? (react_1.default.createElement(material_1.Checkbox, { style: styles.checkBox, checked: this.state.selected.includes(id) })) : null;
|
|
4329
4486
|
let valueEditable = !this.props.notEditable &&
|
|
4330
4487
|
itemType === 'state' &&
|
|
4331
4488
|
(this.state.filter.expertMode || (common === null || common === void 0 ? void 0 : common.write) !== false);
|
|
@@ -4364,34 +4521,55 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4364
4521
|
newValueTitle.push(`${this.texts.objectChangedByUser} ${Utils_1.default.formatDate(new Date(obj.ts), this.props.dateFormat || this.systemConfig.common.dateFormat)}`);
|
|
4365
4522
|
}
|
|
4366
4523
|
}
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4377
|
-
|
|
4378
|
-
|
|
4379
|
-
|
|
4380
|
-
|
|
4381
|
-
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4524
|
+
let readWriteAlias = false;
|
|
4525
|
+
let alias = null;
|
|
4526
|
+
if (id.startsWith('alias.') && ((_c = common === null || common === void 0 ? void 0 : common.alias) === null || _c === void 0 ? void 0 : _c.id)) {
|
|
4527
|
+
readWriteAlias = typeof common.alias.id === 'object';
|
|
4528
|
+
if (readWriteAlias) {
|
|
4529
|
+
alias = (react_1.default.createElement("div", { style: styles.cellIdAliasReadWriteDiv },
|
|
4530
|
+
common.alias.id.read ? (react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
|
|
4531
|
+
e.stopPropagation();
|
|
4532
|
+
e.preventDefault();
|
|
4533
|
+
this.onSelect(common.alias.id.read);
|
|
4534
|
+
setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id.read)), 100);
|
|
4535
|
+
}, sx: this.styles.aliasReadWrite },
|
|
4536
|
+
"\u2190",
|
|
4537
|
+
common.alias.id.read)) : null,
|
|
4538
|
+
common.alias.id.write ? (react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
|
|
4539
|
+
e.stopPropagation();
|
|
4540
|
+
e.preventDefault();
|
|
4541
|
+
this.onSelect(common.alias.id.write);
|
|
4542
|
+
setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id.write)), 100);
|
|
4543
|
+
}, sx: this.styles.aliasReadWrite },
|
|
4544
|
+
"\u2192",
|
|
4545
|
+
common.alias.id.write)) : null));
|
|
4546
|
+
}
|
|
4547
|
+
else {
|
|
4548
|
+
alias = (react_1.default.createElement(material_1.Box, { component: "div", onClick: e => {
|
|
4388
4549
|
e.stopPropagation();
|
|
4389
4550
|
e.preventDefault();
|
|
4390
4551
|
this.onSelect(common.alias.id);
|
|
4391
4552
|
setTimeout(() => this.expandAllSelected(() => this.scrollToItem(common.alias.id)), 100);
|
|
4392
4553
|
}, sx: this.styles.aliasAlone },
|
|
4393
4554
|
"\u2192",
|
|
4394
|
-
common.alias.id))
|
|
4555
|
+
common.alias.id));
|
|
4556
|
+
}
|
|
4557
|
+
}
|
|
4558
|
+
else if (this.info.aliasesMap[id]) {
|
|
4559
|
+
// Some alias points to this object. It can be more than one
|
|
4560
|
+
if (this.info.aliasesMap[id].length > 1) {
|
|
4561
|
+
// Show number of aliases and open a menu by click
|
|
4562
|
+
alias = (react_1.default.createElement(material_1.Box, { component: "div", id: `alias_${id}`, onClick: e => {
|
|
4563
|
+
e.stopPropagation();
|
|
4564
|
+
e.preventDefault();
|
|
4565
|
+
this.setState({ aliasMenu: id });
|
|
4566
|
+
}, sx: this.styles.aliasAlone }, this.props.t('ra_%s links from aliases', this.info.aliasesMap[id].length)));
|
|
4567
|
+
}
|
|
4568
|
+
else {
|
|
4569
|
+
// Show name of alias and open it by click
|
|
4570
|
+
alias = this.renderAliasLink(id, 0);
|
|
4571
|
+
}
|
|
4572
|
+
}
|
|
4395
4573
|
let checkColor = common === null || common === void 0 ? void 0 : common.color;
|
|
4396
4574
|
let invertBackground;
|
|
4397
4575
|
if (checkColor && !this.state.selected.includes(id)) {
|
|
@@ -4519,8 +4697,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4519
4697
|
}
|
|
4520
4698
|
}
|
|
4521
4699
|
}
|
|
4522
|
-
const q = checkVisibleObjectType ? Utils_1.default.quality2text(((
|
|
4523
|
-
let name = ((
|
|
4700
|
+
const q = checkVisibleObjectType ? Utils_1.default.quality2text(((_d = this.states[id]) === null || _d === void 0 ? void 0 : _d.q) || 0).join(', ') : null;
|
|
4701
|
+
let name = ((_e = item.data) === null || _e === void 0 ? void 0 : _e.title) || '';
|
|
4524
4702
|
let useDesc = false;
|
|
4525
4703
|
if (this.state.showDescription) {
|
|
4526
4704
|
const oTooltip = getObjectTooltip(item.data, this.props.lang);
|
|
@@ -4533,154 +4711,199 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4533
4711
|
}
|
|
4534
4712
|
}
|
|
4535
4713
|
const narrowStyleWithDetails = this.props.width === 'xs' && this.state.focused === id;
|
|
4536
|
-
const colID = react_1.default.createElement(material_1.
|
|
4537
|
-
react_1.default.createElement(material_1.
|
|
4714
|
+
const colID = (react_1.default.createElement(material_1.Grid2, { container: true, wrap: "nowrap", direction: "row", sx: styles.cellId, style: { width: this.columnsVisibility.id, paddingLeft } },
|
|
4715
|
+
react_1.default.createElement(material_1.Grid2, { container: true, alignItems: "center" },
|
|
4538
4716
|
checkbox,
|
|
4539
4717
|
iconFolder),
|
|
4540
|
-
react_1.default.createElement(material_1.
|
|
4541
|
-
react_1.default.createElement(material_1.Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang),
|
|
4718
|
+
react_1.default.createElement(material_1.Grid2, { style: Object.assign(Object.assign(Object.assign({}, styles.cellIdSpan), (invertBackground ? this.styles.invertedBackground : undefined)), { color: checkColor, fontWeight: bold ? 'bold' : undefined }) },
|
|
4719
|
+
react_1.default.createElement(material_1.Tooltip, { title: getIdFieldTooltip(item.data, this.props.lang), slotProps: { popper: { sx: styles.tooltip } } },
|
|
4542
4720
|
react_1.default.createElement("div", null, item.data.name)),
|
|
4543
4721
|
alias,
|
|
4544
4722
|
icons),
|
|
4545
4723
|
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.grow), (invertBackground ? this.styles.invertedBackgroundFlex : {})) }),
|
|
4546
|
-
react_1.default.createElement(material_1.
|
|
4547
|
-
this.props.width !== 'xs' ? react_1.default.createElement("div", null,
|
|
4548
|
-
react_1.default.createElement(IconCopy_1.default, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) })) : null);
|
|
4549
|
-
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' }) },
|
|
4724
|
+
react_1.default.createElement(material_1.Grid2, { container: true, alignItems: "center" }, iconItem),
|
|
4725
|
+
this.props.width !== 'xs' ? (react_1.default.createElement("div", null,
|
|
4726
|
+
react_1.default.createElement(IconCopy_1.default, { className: narrowStyleWithDetails ? '' : 'copyButton', style: styles.cellCopyButton, onClick: e => this.onCopy(e, id) }))) : null));
|
|
4727
|
+
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' }) },
|
|
4550
4728
|
name,
|
|
4551
|
-
!narrowStyleWithDetails && ((
|
|
4552
|
-
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;
|
|
4729
|
+
!narrowStyleWithDetails && ((_f = item.data) === null || _f === void 0 ? void 0 : _f.title) ? (react_1.default.createElement(material_1.Box, { style: { color: checkColor } },
|
|
4730
|
+
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;
|
|
4553
4731
|
let colMiddle;
|
|
4554
4732
|
if (!this.state.statesView) {
|
|
4555
4733
|
colMiddle = [
|
|
4556
|
-
(narrowStyleWithDetails && (obj === null || obj === void 0 ? void 0 : obj.type)) || this.columnsVisibility.type
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
|
|
4565
|
-
|
|
4566
|
-
|
|
4567
|
-
|
|
4734
|
+
(narrowStyleWithDetails && (obj === null || obj === void 0 ? void 0 : obj.type)) || this.columnsVisibility.type
|
|
4735
|
+
? {
|
|
4736
|
+
el: (react_1.default.createElement("div", { key: "type", style: Object.assign(Object.assign({}, styles.cellType), { width: this.props.width !== 'xs' ? this.columnsVisibility.type : undefined }) },
|
|
4737
|
+
typeImg,
|
|
4738
|
+
"\u00A0", obj === null || obj === void 0 ? void 0 :
|
|
4739
|
+
obj.type)),
|
|
4740
|
+
type: 'filter_type',
|
|
4741
|
+
}
|
|
4742
|
+
: null,
|
|
4743
|
+
(narrowStyleWithDetails && common) || this.columnsVisibility.role
|
|
4744
|
+
? {
|
|
4745
|
+
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 &&
|
|
4746
|
+
enumEditable &&
|
|
4747
|
+
this.props.objectBrowserEditRole
|
|
4748
|
+
? 'text'
|
|
4749
|
+
: 'default' }), onClick: !narrowStyleWithDetails &&
|
|
4750
|
+
this.state.filter.expertMode &&
|
|
4751
|
+
enumEditable &&
|
|
4752
|
+
this.props.objectBrowserEditRole
|
|
4753
|
+
? () => this.setState({ roleDialog: item.data.id })
|
|
4754
|
+
: undefined }, common === null || common === void 0 ? void 0 : common.role)),
|
|
4755
|
+
type: 'filter_role',
|
|
4756
|
+
onClick: narrowStyleWithDetails &&
|
|
4757
|
+
this.state.filter.expertMode &&
|
|
4758
|
+
enumEditable &&
|
|
4759
|
+
this.props.objectBrowserEditRole
|
|
4568
4760
|
? () => this.setState({ roleDialog: item.data.id })
|
|
4569
|
-
: undefined
|
|
4570
|
-
|
|
4571
|
-
|
|
4572
|
-
|
|
4573
|
-
|
|
4574
|
-
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
|
|
4578
|
-
|
|
4579
|
-
|
|
4580
|
-
|
|
4581
|
-
|
|
4582
|
-
|
|
4583
|
-
|
|
4584
|
-
|
|
4585
|
-
|
|
4586
|
-
|
|
4587
|
-
|
|
4588
|
-
|
|
4589
|
-
|
|
4590
|
-
|
|
4591
|
-
|
|
4592
|
-
|
|
4593
|
-
|
|
4594
|
-
|
|
4595
|
-
|
|
4596
|
-
|
|
4597
|
-
|
|
4598
|
-
|
|
4599
|
-
|
|
4600
|
-
|
|
4601
|
-
|
|
4602
|
-
|
|
4603
|
-
|
|
4604
|
-
|
|
4605
|
-
|
|
4606
|
-
|
|
4607
|
-
|
|
4608
|
-
|
|
4609
|
-
|
|
4610
|
-
|
|
4611
|
-
|
|
4612
|
-
|
|
4613
|
-
|
|
4614
|
-
|
|
4615
|
-
|
|
4616
|
-
|
|
4617
|
-
|
|
4618
|
-
|
|
4619
|
-
|
|
4620
|
-
|
|
4621
|
-
|
|
4622
|
-
|
|
4623
|
-
|
|
4624
|
-
|
|
4761
|
+
: undefined,
|
|
4762
|
+
}
|
|
4763
|
+
: null,
|
|
4764
|
+
(narrowStyleWithDetails && common) || this.columnsVisibility.room
|
|
4765
|
+
? {
|
|
4766
|
+
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
|
|
4767
|
+
? () => {
|
|
4768
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4769
|
+
this.setState({
|
|
4770
|
+
enumDialogEnums: enums,
|
|
4771
|
+
enumDialog: {
|
|
4772
|
+
item,
|
|
4773
|
+
type: 'room',
|
|
4774
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4775
|
+
},
|
|
4776
|
+
});
|
|
4777
|
+
}
|
|
4778
|
+
: undefined }, item.data.rooms)),
|
|
4779
|
+
type: 'filter_room',
|
|
4780
|
+
onClick: narrowStyleWithDetails && enumEditable
|
|
4781
|
+
? () => {
|
|
4782
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
4783
|
+
this.setState({
|
|
4784
|
+
enumDialogEnums: enums,
|
|
4785
|
+
enumDialog: {
|
|
4786
|
+
item,
|
|
4787
|
+
type: 'room',
|
|
4788
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4789
|
+
},
|
|
4790
|
+
});
|
|
4791
|
+
}
|
|
4792
|
+
: undefined,
|
|
4793
|
+
}
|
|
4794
|
+
: null,
|
|
4795
|
+
(narrowStyleWithDetails && common) || this.columnsVisibility.func
|
|
4796
|
+
? {
|
|
4797
|
+
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
|
|
4798
|
+
? () => {
|
|
4799
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4800
|
+
this.setState({
|
|
4801
|
+
enumDialogEnums: enums,
|
|
4802
|
+
enumDialog: {
|
|
4803
|
+
item,
|
|
4804
|
+
type: 'func',
|
|
4805
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4806
|
+
},
|
|
4807
|
+
});
|
|
4808
|
+
}
|
|
4809
|
+
: undefined }, item.data.funcs)),
|
|
4810
|
+
type: 'filter_func',
|
|
4811
|
+
onClick: narrowStyleWithDetails && enumEditable
|
|
4812
|
+
? () => {
|
|
4813
|
+
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
4814
|
+
this.setState({
|
|
4815
|
+
enumDialogEnums: enums,
|
|
4816
|
+
enumDialog: {
|
|
4817
|
+
item,
|
|
4818
|
+
type: 'func',
|
|
4819
|
+
enumsOriginal: JSON.stringify(enums),
|
|
4820
|
+
},
|
|
4821
|
+
});
|
|
4822
|
+
}
|
|
4823
|
+
: undefined,
|
|
4824
|
+
}
|
|
4825
|
+
: null,
|
|
4625
4826
|
];
|
|
4626
4827
|
}
|
|
4627
4828
|
else {
|
|
4628
4829
|
colMiddle = [
|
|
4629
|
-
(narrowStyleWithDetails && checkVisibleObjectType && ((
|
|
4630
|
-
|
|
4631
|
-
|
|
4632
|
-
|
|
4633
|
-
|
|
4634
|
-
|
|
4635
|
-
|
|
4636
|
-
|
|
4637
|
-
|
|
4638
|
-
|
|
4639
|
-
|
|
4640
|
-
|
|
4641
|
-
|
|
4642
|
-
|
|
4643
|
-
|
|
4644
|
-
|
|
4645
|
-
|
|
4646
|
-
|
|
4647
|
-
|
|
4648
|
-
|
|
4830
|
+
(narrowStyleWithDetails && checkVisibleObjectType && ((_g = this.states[id]) === null || _g === void 0 ? void 0 : _g.from)) ||
|
|
4831
|
+
this.columnsVisibility.changedFrom
|
|
4832
|
+
? {
|
|
4833
|
+
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 && ((_h = this.states[id]) === null || _h === void 0 ? void 0 : _h.from) ? newValue : null)),
|
|
4834
|
+
type: 'from',
|
|
4835
|
+
}
|
|
4836
|
+
: null,
|
|
4837
|
+
(narrowStyleWithDetails && q) || this.columnsVisibility.qualityCode
|
|
4838
|
+
? {
|
|
4839
|
+
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)),
|
|
4840
|
+
type: 'quality',
|
|
4841
|
+
}
|
|
4842
|
+
: null,
|
|
4843
|
+
(narrowStyleWithDetails && checkVisibleObjectType && ((_j = this.states[id]) === null || _j === void 0 ? void 0 : _j.ts)) ||
|
|
4844
|
+
this.columnsVisibility.timestamp
|
|
4845
|
+
? {
|
|
4846
|
+
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 && ((_k = this.states[id]) === null || _k === void 0 ? void 0 : _k.ts)
|
|
4847
|
+
? Utils_1.default.formatDate(new Date(this.states[id].ts), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4848
|
+
: null)),
|
|
4849
|
+
type: 'ts',
|
|
4850
|
+
}
|
|
4851
|
+
: null,
|
|
4852
|
+
(narrowStyleWithDetails && checkVisibleObjectType && ((_l = this.states[id]) === null || _l === void 0 ? void 0 : _l.lc)) ||
|
|
4853
|
+
this.columnsVisibility.lastChange
|
|
4854
|
+
? {
|
|
4855
|
+
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 && ((_m = this.states[id]) === null || _m === void 0 ? void 0 : _m.lc)
|
|
4856
|
+
? Utils_1.default.formatDate(new Date(this.states[id].lc), this.props.dateFormat || this.systemConfig.common.dateFormat)
|
|
4857
|
+
: null)),
|
|
4858
|
+
type: 'lc',
|
|
4859
|
+
}
|
|
4860
|
+
: null,
|
|
4649
4861
|
];
|
|
4650
4862
|
}
|
|
4651
|
-
let colCustom = ((
|
|
4652
|
-
|
|
4653
|
-
|
|
4654
|
-
|
|
4655
|
-
|
|
4656
|
-
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
|
|
4662
|
-
|
|
4663
|
-
|
|
4664
|
-
|
|
4665
|
-
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4863
|
+
let colCustom = ((_o = this.adapterColumns) === null || _o === void 0 ? void 0 : _o.map(it => (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellAdapter), { width: this.props.width !== 'xs'
|
|
4864
|
+
? this.columnsVisibility[it.id]
|
|
4865
|
+
: undefined }), key: it.id, title: `${it.adapter} => ${it.pathText}` }, obj ? this.renderCustomValue(obj, it, item) : null)))) || null;
|
|
4866
|
+
const columnValue = narrowStyleWithDetails || this.columnsVisibility.val
|
|
4867
|
+
? this.renderColumnValue(id, item, narrowStyleWithDetails)
|
|
4868
|
+
: null;
|
|
4869
|
+
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 : 'calc(100% - 100px)', cursor: valueEditable
|
|
4870
|
+
? (common === null || common === void 0 ? void 0 : common.type) === 'file'
|
|
4871
|
+
? 'zoom-in'
|
|
4872
|
+
: item.data.button
|
|
4873
|
+
? 'grab'
|
|
4874
|
+
: 'text'
|
|
4875
|
+
: 'default' }), onClick: valueEditable
|
|
4876
|
+
? () => {
|
|
4877
|
+
if (!obj || !this.states) {
|
|
4878
|
+
// return;
|
|
4879
|
+
}
|
|
4880
|
+
else if ((common === null || common === void 0 ? void 0 : common.type) === 'file') {
|
|
4881
|
+
this.setState({ viewFileDialog: id });
|
|
4882
|
+
}
|
|
4883
|
+
else if (!this.state.filter.expertMode && item.data.button) {
|
|
4884
|
+
// in non-expert mode control button directly
|
|
4885
|
+
this.props.socket
|
|
4886
|
+
.setState(id, true)
|
|
4887
|
+
.catch(e => window.alert(`Cannot write state "${id}": ${e}`));
|
|
4888
|
+
}
|
|
4889
|
+
else if (!this.state.filter.expertMode && item.data.switch) {
|
|
4890
|
+
// in non-expert mode control switch directly
|
|
4891
|
+
this.props.socket
|
|
4892
|
+
.setState(id, !this.states[id].val)
|
|
4893
|
+
.catch(e => window.alert(`Cannot write state "${id}": ${e}`));
|
|
4894
|
+
}
|
|
4895
|
+
else {
|
|
4896
|
+
this.edit = {
|
|
4897
|
+
val: this.states[id] ? this.states[id].val : '',
|
|
4898
|
+
q: this.states[id] ? this.states[id].q || 0 : 0,
|
|
4899
|
+
ack: false,
|
|
4900
|
+
id,
|
|
4901
|
+
};
|
|
4902
|
+
this.setState({ updateOpened: true });
|
|
4903
|
+
}
|
|
4681
4904
|
}
|
|
4682
|
-
|
|
4683
|
-
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;
|
|
4905
|
+
: undefined }, columnValue)) : null;
|
|
4906
|
+
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;
|
|
4684
4907
|
let colDetails = null;
|
|
4685
4908
|
if (this.props.width === 'xs' && this.state.focused === id) {
|
|
4686
4909
|
colMiddle = colMiddle.filter(a => a);
|
|
@@ -4689,18 +4912,27 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4689
4912
|
renderedMiddle = null;
|
|
4690
4913
|
}
|
|
4691
4914
|
else {
|
|
4692
|
-
renderedMiddle = colMiddle.map(it =>
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
it.
|
|
4697
|
-
|
|
4698
|
-
|
|
4915
|
+
renderedMiddle = colMiddle.map(it => {
|
|
4916
|
+
if (!it) {
|
|
4917
|
+
return null;
|
|
4918
|
+
}
|
|
4919
|
+
return (react_1.default.createElement("div", { key: it.type, style: styles.cellDetailsLine },
|
|
4920
|
+
react_1.default.createElement("span", { style: styles.cellDetailsName },
|
|
4921
|
+
this.texts[it.type],
|
|
4922
|
+
":"),
|
|
4923
|
+
it.el,
|
|
4924
|
+
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
4925
|
+
it.onClick ? (react_1.default.createElement(icons_material_1.Edit, { style: styles.cellCopyButtonInDetails, onClick: () => {
|
|
4926
|
+
if (it === null || it === void 0 ? void 0 : it.onClick) {
|
|
4927
|
+
it.onClick();
|
|
4928
|
+
}
|
|
4929
|
+
} })) : null));
|
|
4930
|
+
});
|
|
4699
4931
|
}
|
|
4700
4932
|
if (!colCustom.length) {
|
|
4701
4933
|
colCustom = null;
|
|
4702
4934
|
}
|
|
4703
|
-
colDetails = react_1.default.createElement(material_1.Paper, { style: {
|
|
4935
|
+
colDetails = (react_1.default.createElement(material_1.Paper, { style: {
|
|
4704
4936
|
width: '100%',
|
|
4705
4937
|
display: 'flex',
|
|
4706
4938
|
flexDirection: 'column',
|
|
@@ -4710,16 +4942,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4710
4942
|
react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4711
4943
|
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
4712
4944
|
react_1.default.createElement(IconCopy_1.default, { style: styles.cellCopyButtonInDetails, onClick: e => this.onCopy(e, id) })),
|
|
4713
|
-
colName && react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4945
|
+
colName && (react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4714
4946
|
react_1.default.createElement("span", { style: styles.cellDetailsName },
|
|
4715
4947
|
this.texts.name,
|
|
4716
4948
|
":"),
|
|
4717
4949
|
colName,
|
|
4718
4950
|
react_1.default.createElement("div", { style: { flexGrow: 1 } }),
|
|
4719
|
-
((
|
|
4951
|
+
((_p = item.data) === null || _p === void 0 ? void 0 : _p.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)),
|
|
4720
4952
|
renderedMiddle,
|
|
4721
4953
|
colCustom && react_1.default.createElement("div", { style: styles.cellDetailsLine }, colCustom),
|
|
4722
|
-
((
|
|
4954
|
+
((_q = this.objects[id]) === null || _q === void 0 ? void 0 : _q.type) === 'state' && (react_1.default.createElement("div", { style: styles.cellDetailsLine },
|
|
4723
4955
|
react_1.default.createElement("span", { style: styles.cellDetailsName },
|
|
4724
4956
|
this.texts.value,
|
|
4725
4957
|
":"),
|
|
@@ -4731,18 +4963,20 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4731
4963
|
obj: this.objects[id],
|
|
4732
4964
|
texts: this.texts,
|
|
4733
4965
|
dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat,
|
|
4734
|
-
isFloatComma: this.props.isFloatComma === undefined
|
|
4966
|
+
isFloatComma: this.props.isFloatComma === undefined
|
|
4967
|
+
? this.systemConfig.common.isFloatComma
|
|
4968
|
+
: this.props.isFloatComma,
|
|
4735
4969
|
});
|
|
4736
4970
|
this.onCopy(e, valText.v.toString());
|
|
4737
|
-
}, key: "cc" })),
|
|
4738
|
-
colButtons && react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellDetailsLine), { justifyContent: 'right' }) }, colButtons));
|
|
4971
|
+
}, key: "cc" }))),
|
|
4972
|
+
colButtons && (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.cellDetailsLine), { justifyContent: 'right' }) }, colButtons))));
|
|
4739
4973
|
colName = null;
|
|
4740
4974
|
colMiddle = null;
|
|
4741
4975
|
colCustom = null;
|
|
4742
4976
|
colValue = null;
|
|
4743
4977
|
colButtons = null;
|
|
4744
4978
|
}
|
|
4745
|
-
const row = react_1.default.createElement(material_1.
|
|
4979
|
+
const row = (react_1.default.createElement(material_1.Grid2, { 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 &&
|
|
4746
4980
|
!item.data.visible &&
|
|
4747
4981
|
!item.data.hasVisibleChildren &&
|
|
4748
4982
|
styles.filteredParentOut, this.state.selected.includes(id) && styles.itemSelected, this.state.selectedNonObject === id && styles.itemSelected), key: id, id: id, onMouseDown: e => {
|
|
@@ -4778,7 +5012,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4778
5012
|
colMiddle.map(it => it === null || it === void 0 ? void 0 : it.el),
|
|
4779
5013
|
colCustom,
|
|
4780
5014
|
colValue,
|
|
4781
|
-
colButtons);
|
|
5015
|
+
colButtons));
|
|
4782
5016
|
return { row, details: colDetails };
|
|
4783
5017
|
}
|
|
4784
5018
|
/**
|
|
@@ -4792,11 +5026,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4792
5026
|
const DragWrapper = this.props.DragWrapper;
|
|
4793
5027
|
if (this.props.dragEnabled && DragWrapper) {
|
|
4794
5028
|
if (root.data.sumVisibility) {
|
|
4795
|
-
leaf = react_1.default.createElement(DragWrapper, { key: root.data.id, item: root, style: styles.draggable }, result.row);
|
|
5029
|
+
leaf = (react_1.default.createElement(DragWrapper, { key: root.data.id, item: root, style: styles.draggable }, result.row));
|
|
4796
5030
|
}
|
|
4797
5031
|
else {
|
|
4798
5032
|
// change cursor
|
|
4799
|
-
leaf = react_1.default.createElement("div", { key: root.data.id, style: styles.nonDraggable }, result.row);
|
|
5033
|
+
leaf = (react_1.default.createElement("div", { key: root.data.id, style: styles.nonDraggable }, result.row));
|
|
4800
5034
|
}
|
|
4801
5035
|
}
|
|
4802
5036
|
else {
|
|
@@ -4951,8 +5185,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4951
5185
|
if (columnsForAdmin && columns) {
|
|
4952
5186
|
Object.keys(columnsForAdmin)
|
|
4953
5187
|
.sort()
|
|
4954
|
-
.forEach(adapter => columnsForAdmin[adapter]
|
|
4955
|
-
.forEach(column => {
|
|
5188
|
+
.forEach(adapter => columnsForAdmin[adapter].forEach(column => {
|
|
4956
5189
|
const id = `_${adapter}_${column.path}`;
|
|
4957
5190
|
if (columns.includes(id)) {
|
|
4958
5191
|
const item = {
|
|
@@ -4976,7 +5209,8 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
4976
5209
|
columnsWidths[item.id] ||
|
|
4977
5210
|
column.width ||
|
|
4978
5211
|
SCREEN_WIDTHS[width].widths.func ||
|
|
4979
|
-
SCREEN_WIDTHS.xl.widths.func ||
|
|
5212
|
+
SCREEN_WIDTHS.xl.widths.func ||
|
|
5213
|
+
0;
|
|
4980
5214
|
widthSum += this.columnsVisibility[id];
|
|
4981
5215
|
}
|
|
4982
5216
|
else {
|
|
@@ -5001,8 +5235,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5001
5235
|
this.columnsVisibility.nameHeader = `calc(100% - ${widthSum + 5 + this.state.scrollBarWidth}px)`;
|
|
5002
5236
|
}
|
|
5003
5237
|
else {
|
|
5004
|
-
const newWidth = Object.keys(this.columnsVisibility)
|
|
5005
|
-
.reduce((accumulator, name) => {
|
|
5238
|
+
const newWidth = Object.keys(this.columnsVisibility).reduce((accumulator, name) => {
|
|
5006
5239
|
// do not summarize strings
|
|
5007
5240
|
if (name === 'id' ||
|
|
5008
5241
|
typeof this.columnsVisibility[name] === 'string' ||
|
|
@@ -5072,40 +5305,40 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5072
5305
|
* Render the right handle for resizing
|
|
5073
5306
|
*/
|
|
5074
5307
|
renderHandleRight() {
|
|
5075
|
-
return react_1.default.createElement(material_1.Box, { component: "div", className: "iob-ob-resize-handler", sx: Object.assign(Object.assign({}, styles.resizeHandle), styles.resizeHandleRight), onMouseDown: this.resizerMouseDown, onDoubleClick: this.resizerReset, title: this.props.t('ra_Double click to reset table layout') });
|
|
5308
|
+
return (react_1.default.createElement(material_1.Box, { component: "div", className: "iob-ob-resize-handler", sx: Object.assign(Object.assign({}, styles.resizeHandle), styles.resizeHandleRight), onMouseDown: this.resizerMouseDown, onDoubleClick: this.resizerReset, title: this.props.t('ra_Double click to reset table layout') }));
|
|
5076
5309
|
}
|
|
5077
5310
|
renderHeader() {
|
|
5078
5311
|
let filterClearInValue = null;
|
|
5079
5312
|
if (!this.columnsVisibility.buttons && !this.isFilterEmpty()) {
|
|
5080
|
-
filterClearInValue = react_1.default.createElement(material_1.IconButton, { onClick: () => this.clearFilter(), style: styles.buttonClearFilter, title: this.props.t('ra_Clear filter'), size: "large" },
|
|
5313
|
+
filterClearInValue = (react_1.default.createElement(material_1.IconButton, { onClick: () => this.clearFilter(), style: styles.buttonClearFilter, title: this.props.t('ra_Clear filter'), size: "large" },
|
|
5081
5314
|
react_1.default.createElement(IconClearFilter_1.default, null),
|
|
5082
|
-
react_1.default.createElement(icons_material_1.Close, { style: styles.buttonClearFilterIcon }));
|
|
5315
|
+
react_1.default.createElement(icons_material_1.Close, { style: styles.buttonClearFilterIcon })));
|
|
5083
5316
|
}
|
|
5084
5317
|
if (this.props.width === 'xs') {
|
|
5085
|
-
return react_1.default.createElement("div", { style: styles.headerRow },
|
|
5086
|
-
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: '100%' }) }, this.getFilterInput('id')));
|
|
5318
|
+
return (react_1.default.createElement("div", { style: styles.headerRow },
|
|
5319
|
+
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: '100%' }) }, this.getFilterInput('id'))));
|
|
5087
5320
|
}
|
|
5088
|
-
return react_1.default.createElement("div", { style: styles.headerRow },
|
|
5321
|
+
return (react_1.default.createElement("div", { style: styles.headerRow },
|
|
5089
5322
|
react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.id, position: 'relative' }), "data-min": 240, "data-name": "id" },
|
|
5090
5323
|
this.getFilterInput('id'),
|
|
5091
5324
|
this.renderHandleRight()),
|
|
5092
|
-
this.columnsVisibility.name ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.nameHeader, position: 'relative' }), "data-min": 100, "data-name": "nameHeader" },
|
|
5325
|
+
this.columnsVisibility.name ? (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.nameHeader, position: 'relative' }), "data-min": 100, "data-name": "nameHeader" },
|
|
5093
5326
|
this.getFilterInput('name'),
|
|
5094
|
-
this.renderHandleRight()) : null,
|
|
5095
|
-
!this.state.statesView && react_1.default.createElement(react_1.default.Fragment, null,
|
|
5096
|
-
this.columnsVisibility.type ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.type, position: 'relative' }), "data-min": 100, "data-name": "type" },
|
|
5327
|
+
this.renderHandleRight())) : null,
|
|
5328
|
+
!this.state.statesView && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
5329
|
+
this.columnsVisibility.type ? (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.type, position: 'relative' }), "data-min": 100, "data-name": "type" },
|
|
5097
5330
|
this.getFilterSelectType(),
|
|
5098
|
-
this.renderHandleRight()) : null,
|
|
5099
|
-
this.columnsVisibility.role ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.role, position: 'relative' }), "data-min": 100, "data-name": "role" },
|
|
5331
|
+
this.renderHandleRight())) : null,
|
|
5332
|
+
this.columnsVisibility.role ? (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.role, position: 'relative' }), "data-min": 100, "data-name": "role" },
|
|
5100
5333
|
this.getFilterSelectRole(),
|
|
5101
|
-
this.renderHandleRight()) : null,
|
|
5102
|
-
this.columnsVisibility.room ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.room, position: 'relative' }), "data-min": 100, "data-name": "room" },
|
|
5334
|
+
this.renderHandleRight())) : null,
|
|
5335
|
+
this.columnsVisibility.room ? (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.room, position: 'relative' }), "data-min": 100, "data-name": "room" },
|
|
5103
5336
|
this.getFilterSelectRoom(),
|
|
5104
|
-
this.renderHandleRight()) : null,
|
|
5105
|
-
this.columnsVisibility.func ? react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.func, position: 'relative' }), "data-min": 100, "data-name": "func" },
|
|
5337
|
+
this.renderHandleRight())) : null,
|
|
5338
|
+
this.columnsVisibility.func ? (react_1.default.createElement("div", { style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.func, position: 'relative' }), "data-min": 100, "data-name": "func" },
|
|
5106
5339
|
this.getFilterSelectFunction(),
|
|
5107
|
-
this.renderHandleRight()) : null),
|
|
5108
|
-
this.state.statesView && react_1.default.createElement(react_1.default.Fragment, null,
|
|
5340
|
+
this.renderHandleRight())) : null)),
|
|
5341
|
+
this.state.statesView && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
5109
5342
|
react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.headerCell), styles.headerCellValue), { width: this.columnsVisibility.changedFrom, position: 'relative' }), "data-min": 100, "data-name": "changedFrom" },
|
|
5110
5343
|
this.props.t('ra_Changed from'),
|
|
5111
5344
|
this.renderHandleRight()),
|
|
@@ -5117,18 +5350,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5117
5350
|
this.renderHandleRight()),
|
|
5118
5351
|
react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.headerCell), styles.headerCellValue), { width: this.columnsVisibility.lastChange, position: 'relative' }), "data-min": 100, "data-name": "lastChange" },
|
|
5119
5352
|
this.props.t('ra_Last change'),
|
|
5120
|
-
this.renderHandleRight())),
|
|
5121
|
-
this.adapterColumns.map(item => react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.headerCell), styles.headerCellValue), { width: this.columnsVisibility[item.id] }), title: item.adapter, key: item.id, "data-min": 100, "data-name": item.id }, item.name)),
|
|
5122
|
-
this.columnsVisibility.val ? react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.headerCell), styles.headerCellValue), { width: this.columnsVisibility.val, position: 'relative' }), "data-min": 120, "data-name": "val" },
|
|
5353
|
+
this.renderHandleRight()))),
|
|
5354
|
+
this.adapterColumns.map(item => (react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.headerCell), styles.headerCellValue), { width: this.columnsVisibility[item.id] }), title: item.adapter, key: item.id, "data-min": 100, "data-name": item.id }, item.name))),
|
|
5355
|
+
this.columnsVisibility.val ? (react_1.default.createElement("div", { style: Object.assign(Object.assign(Object.assign({}, styles.headerCell), styles.headerCellValue), { width: this.columnsVisibility.val, position: 'relative' }), "data-min": 120, "data-name": "val" },
|
|
5123
5356
|
this.props.t('ra_Value'),
|
|
5124
|
-
filterClearInValue) : null,
|
|
5125
|
-
this.columnsVisibility.buttons ? react_1.default.createElement("div", { title: this.texts.filter_custom, style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.buttons }) },
|
|
5357
|
+
filterClearInValue)) : null,
|
|
5358
|
+
this.columnsVisibility.buttons ? (react_1.default.createElement("div", { title: this.texts.filter_custom, style: Object.assign(Object.assign({}, styles.headerCell), { width: this.columnsVisibility.buttons }) },
|
|
5126
5359
|
' ',
|
|
5127
|
-
this.getFilterSelectCustoms()) : null);
|
|
5360
|
+
this.getFilterSelectCustoms())) : null));
|
|
5128
5361
|
}
|
|
5129
5362
|
renderToast() {
|
|
5130
|
-
return react_1.default.createElement(material_1.Snackbar, { open: !!this.state.toast, autoHideDuration: 3000, onClick: () => this.setState({ toast: '' }), onClose: () => this.setState({ toast: '' }), message: this.state.toast, action: react_1.default.createElement(material_1.IconButton, { size: "small", "aria-label": "close", color: "inherit", onClick: () => this.setState({ toast: '' }) },
|
|
5131
|
-
react_1.default.createElement(icons_material_1.Close, { fontSize: "small" })) });
|
|
5363
|
+
return (react_1.default.createElement(material_1.Snackbar, { open: !!this.state.toast, autoHideDuration: 3000, onClick: () => this.setState({ toast: '' }), onClose: () => this.setState({ toast: '' }), message: this.state.toast, action: react_1.default.createElement(material_1.IconButton, { size: "small", "aria-label": "close", color: "inherit", onClick: () => this.setState({ toast: '' }) },
|
|
5364
|
+
react_1.default.createElement(icons_material_1.Close, { fontSize: "small" })) }));
|
|
5132
5365
|
}
|
|
5133
5366
|
/**
|
|
5134
5367
|
* Called when component is updated.
|
|
@@ -5156,7 +5389,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5156
5389
|
renderCustomDialog() {
|
|
5157
5390
|
if (this.state.customDialog && this.props.objectCustomDialog) {
|
|
5158
5391
|
const ObjectCustomDialog = this.props.objectCustomDialog;
|
|
5159
|
-
return react_1.default.createElement(ObjectCustomDialog, { reportChangedIds: (changedIds) => (this.changedIds = [...changedIds]), objectIDs: this.state.customDialog, allVisibleObjects: !!this.state.customDialogAll, expertMode: this.state.filter.expertMode, isFloatComma: this.props.isFloatComma === undefined
|
|
5392
|
+
return (react_1.default.createElement(ObjectCustomDialog, { reportChangedIds: (changedIds) => (this.changedIds = [...changedIds]), objectIDs: this.state.customDialog, allVisibleObjects: !!this.state.customDialogAll, expertMode: this.state.filter.expertMode, isFloatComma: this.props.isFloatComma === undefined
|
|
5393
|
+
? this.systemConfig.common.isFloatComma
|
|
5394
|
+
: this.props.isFloatComma, t: this.props.t, lang: this.props.lang, socket: this.props.socket, themeName: this.props.themeName, themeType: this.props.themeType, theme: this.props.theme, objects: this.objects, customsInstances: this.info.customs, onClose: () => {
|
|
5160
5395
|
var _b;
|
|
5161
5396
|
this.pauseSubscribe(false);
|
|
5162
5397
|
this.setState({ customDialog: null });
|
|
@@ -5166,7 +5401,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5166
5401
|
this.forceUpdate();
|
|
5167
5402
|
}
|
|
5168
5403
|
(_b = this.props.router) === null || _b === void 0 ? void 0 : _b.doNavigate('tab-objects');
|
|
5169
|
-
}, systemConfig: this.systemConfig });
|
|
5404
|
+
}, systemConfig: this.systemConfig }));
|
|
5170
5405
|
}
|
|
5171
5406
|
return null;
|
|
5172
5407
|
}
|
|
@@ -5185,7 +5420,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5185
5420
|
return null;
|
|
5186
5421
|
}
|
|
5187
5422
|
const ObjectBrowserEditObject = this.props.objectBrowserEditObject;
|
|
5188
|
-
return react_1.default.createElement(ObjectBrowserEditObject, { key: this.state.editObjectDialog, obj: this.objects[this.state.editObjectDialog], roleArray: this.info.roles, objects: this.objects, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined
|
|
5423
|
+
return (react_1.default.createElement(ObjectBrowserEditObject, { key: this.state.editObjectDialog, obj: this.objects[this.state.editObjectDialog], roleArray: this.info.roles, objects: this.objects, dateFormat: this.props.dateFormat || this.systemConfig.common.dateFormat, isFloatComma: this.props.isFloatComma === undefined
|
|
5424
|
+
? this.systemConfig.common.isFloatComma
|
|
5425
|
+
: this.props.isFloatComma, themeType: this.props.themeType, theme: this.props.theme, socket: this.props.socket, dialogName: this.props.dialogName, aliasTab: this.state.editObjectAlias, t: this.props.t, expertMode: !!this.state.filter.expertMode, onNewObject: (obj) => this.props.socket
|
|
5189
5426
|
.setObject(obj._id, obj)
|
|
5190
5427
|
.then(() => this.setState({ editObjectDialog: obj._id, editObjectAlias: false }, () => this.onSelect(obj._id)))
|
|
5191
5428
|
.catch(e => this.showError(`Cannot write object: ${e}`)), onClose: (obj) => {
|
|
@@ -5209,28 +5446,28 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5209
5446
|
.catch(e => this.showError(`Cannot write object: ${e}`));
|
|
5210
5447
|
}
|
|
5211
5448
|
this.setState({ editObjectDialog: '', editObjectAlias: false });
|
|
5212
|
-
}, width: this.props.width });
|
|
5449
|
+
}, width: this.props.width }));
|
|
5213
5450
|
}
|
|
5214
5451
|
renderViewObjectFileDialog() {
|
|
5215
5452
|
if (!this.state.viewFileDialog || !this.props.objectBrowserViewFile) {
|
|
5216
5453
|
return null;
|
|
5217
5454
|
}
|
|
5218
5455
|
const ObjectBrowserViewFile = this.props.objectBrowserViewFile;
|
|
5219
|
-
return react_1.default.createElement(ObjectBrowserViewFile, { key: "viewFile", obj: this.objects[this.state.viewFileDialog], socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ viewFileDialog: '' }) });
|
|
5456
|
+
return (react_1.default.createElement(ObjectBrowserViewFile, { key: "viewFile", obj: this.objects[this.state.viewFileDialog], socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ viewFileDialog: '' }) }));
|
|
5220
5457
|
}
|
|
5221
5458
|
renderAliasEditorDialog() {
|
|
5222
5459
|
if (!this.props.objectBrowserAliasEditor || !this.state.showAliasEditor) {
|
|
5223
5460
|
return null;
|
|
5224
5461
|
}
|
|
5225
5462
|
const ObjectBrowserAliasEditor = this.props.objectBrowserAliasEditor;
|
|
5226
|
-
return react_1.default.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], objects: this.objects, socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
5463
|
+
return (react_1.default.createElement(ObjectBrowserAliasEditor, { key: "editAlias", obj: this.objects[this.state.showAliasEditor], objects: this.objects, socket: this.props.socket, t: this.props.t, onClose: () => this.setState({ showAliasEditor: '' }), onRedirect: (id, timeout) => setTimeout(() => this.onSelect(id, false, () => this.expandAllSelected(() => {
|
|
5227
5464
|
this.scrollToItem(id);
|
|
5228
5465
|
setTimeout(() => this.setState({
|
|
5229
5466
|
editObjectDialog: id,
|
|
5230
5467
|
showAliasEditor: '',
|
|
5231
5468
|
editObjectAlias: true,
|
|
5232
5469
|
}), 300);
|
|
5233
|
-
})), timeout || 0) });
|
|
5470
|
+
})), timeout || 0) }));
|
|
5234
5471
|
}
|
|
5235
5472
|
showAddDataPointDialog(id, initialType, initialStateType) {
|
|
5236
5473
|
this.setState({
|
|
@@ -5242,6 +5479,18 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5242
5479
|
},
|
|
5243
5480
|
});
|
|
5244
5481
|
}
|
|
5482
|
+
/** Renders the aliases list for one state (if more than 2) */
|
|
5483
|
+
renderAliasMenu() {
|
|
5484
|
+
if (!this.state.aliasMenu) {
|
|
5485
|
+
return null;
|
|
5486
|
+
}
|
|
5487
|
+
return (react_1.default.createElement(material_1.Menu, { key: "aliasmenu", open: !0, anchorEl: window.document.getElementById(`alias_${this.state.aliasMenu}`), onClose: () => this.setState({ aliasMenu: '' }) }, this.info.aliasesMap[this.state.aliasMenu].map((aliasId, i) => (react_1.default.createElement(material_1.MenuItem, { key: aliasId, onClick: () => this.onSelect(aliasId) },
|
|
5488
|
+
react_1.default.createElement(material_1.ListItemText, null, this.renderAliasLink(this.state.aliasMenu, i, {
|
|
5489
|
+
'& .admin-browser-arrow': {
|
|
5490
|
+
mr: '8px',
|
|
5491
|
+
},
|
|
5492
|
+
})))))));
|
|
5493
|
+
}
|
|
5245
5494
|
/**
|
|
5246
5495
|
* Renders the right mouse button context menu
|
|
5247
5496
|
*/
|
|
@@ -5297,7 +5546,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5297
5546
|
visibility: !!(this.props.objectBrowserEditObject &&
|
|
5298
5547
|
obj &&
|
|
5299
5548
|
(this.state.filter.expertMode || _a.isNonExpertId(id))),
|
|
5300
|
-
icon: react_1.default.createElement(icons_material_1.Edit, { fontSize: "small", style: this.styles.contextMenuEdit }),
|
|
5549
|
+
icon: (react_1.default.createElement(icons_material_1.Edit, { fontSize: "small", style: this.styles.contextMenuEdit })),
|
|
5301
5550
|
label: this.texts.editObject,
|
|
5302
5551
|
onClick: () => this.setState({ editObjectDialog: item.data.id, showContextMenu: null, editObjectAlias: false }),
|
|
5303
5552
|
},
|
|
@@ -5310,7 +5559,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5310
5559
|
// @ts-expect-error deprecated from js-controller 6
|
|
5311
5560
|
((_b = obj.common) === null || _b === void 0 ? void 0 : _b.type) !== 'file' &&
|
|
5312
5561
|
(this.state.filter.expertMode || obj.common.write !== false)),
|
|
5313
|
-
icon: react_1.default.createElement(icons_material_1.FormatItalic, { fontSize: "small", style: this.styles.contextMenuEditValue }),
|
|
5562
|
+
icon: (react_1.default.createElement(icons_material_1.FormatItalic, { fontSize: "small", style: this.styles.contextMenuEditValue })),
|
|
5314
5563
|
label: this.props.t('ra_Edit value'),
|
|
5315
5564
|
onClick: () => {
|
|
5316
5565
|
this.edit = {
|
|
@@ -5323,10 +5572,11 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5323
5572
|
},
|
|
5324
5573
|
},
|
|
5325
5574
|
VIEW: {
|
|
5326
|
-
visibility: !!this.props.objectBrowserViewFile &&
|
|
5575
|
+
visibility: !!this.props.objectBrowserViewFile &&
|
|
5576
|
+
(obj === null || obj === void 0 ? void 0 : obj.type) === 'state' &&
|
|
5327
5577
|
// @ts-expect-error deprecated from js-controller 6
|
|
5328
5578
|
((_c = obj.common) === null || _c === void 0 ? void 0 : _c.type) === 'file',
|
|
5329
|
-
icon: react_1.default.createElement(icons_material_1.FindInPage, { fontSize: "small", style: this.styles.contextMenuView }),
|
|
5579
|
+
icon: (react_1.default.createElement(icons_material_1.FindInPage, { fontSize: "small", style: this.styles.contextMenuView })),
|
|
5330
5580
|
label: this.props.t('ra_View file'),
|
|
5331
5581
|
onClick: () => this.setState({ viewFileDialog: (obj === null || obj === void 0 ? void 0 : obj._id) || '', showContextMenu: null }),
|
|
5332
5582
|
},
|
|
@@ -5338,9 +5588,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5338
5588
|
obj.type === 'state' &&
|
|
5339
5589
|
// @ts-expect-error deprecated from js-controller 6
|
|
5340
5590
|
((_d = obj.common) === null || _d === void 0 ? void 0 : _d.type) !== 'file'),
|
|
5341
|
-
icon: react_1.default.createElement(icons_material_1.Settings, { fontSize: "small", style: item.data.hasCustoms
|
|
5591
|
+
icon: (react_1.default.createElement(icons_material_1.Settings, { fontSize: "small", style: item.data.hasCustoms
|
|
5342
5592
|
? this.styles.cellButtonsButtonWithCustoms
|
|
5343
|
-
: styles.cellButtonsButtonWithoutCustoms }),
|
|
5593
|
+
: styles.cellButtonsButtonWithoutCustoms })),
|
|
5344
5594
|
style: this.styles.contextMenuCustom,
|
|
5345
5595
|
label: this.texts.customConfig,
|
|
5346
5596
|
onClick: () => {
|
|
@@ -5367,14 +5617,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5367
5617
|
ROLE: {
|
|
5368
5618
|
key: '4',
|
|
5369
5619
|
visibility: !!(this.state.filter.expertMode && enumEditable && this.props.objectBrowserEditRole),
|
|
5370
|
-
icon: react_1.default.createElement(icons_material_1.BorderColor, { fontSize: "small", style: this.styles.contextMenuRole }),
|
|
5620
|
+
icon: (react_1.default.createElement(icons_material_1.BorderColor, { fontSize: "small", style: this.styles.contextMenuRole })),
|
|
5371
5621
|
label: this.props.t('ra_Edit role'),
|
|
5372
5622
|
onClick: () => this.setState({ roleDialog: item.data.id, showContextMenu: null }),
|
|
5373
5623
|
},
|
|
5374
5624
|
FUNCTION: {
|
|
5375
5625
|
key: '5',
|
|
5376
5626
|
visibility: !!enumEditable,
|
|
5377
|
-
icon: react_1.default.createElement(icons_material_1.BedroomParent, { fontSize: "small", style: this.styles.contextMenuRole }),
|
|
5627
|
+
icon: (react_1.default.createElement(icons_material_1.BedroomParent, { fontSize: "small", style: this.styles.contextMenuRole })),
|
|
5378
5628
|
label: this.props.t('ra_Edit function'),
|
|
5379
5629
|
onClick: () => {
|
|
5380
5630
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'funcEnums');
|
|
@@ -5392,7 +5642,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5392
5642
|
ROOM: {
|
|
5393
5643
|
key: '6',
|
|
5394
5644
|
visibility: !!enumEditable,
|
|
5395
|
-
icon: react_1.default.createElement(icons_material_1.Construction, { fontSize: "small", style: this.styles.contextMenuRoom }),
|
|
5645
|
+
icon: (react_1.default.createElement(icons_material_1.Construction, { fontSize: "small", style: this.styles.contextMenuRoom })),
|
|
5396
5646
|
label: this.props.t('ra_Edit room'),
|
|
5397
5647
|
onClick: () => {
|
|
5398
5648
|
const enums = findEnumsForObjectAsIds(this.info, item.data.id, 'roomEnums');
|
|
@@ -5416,14 +5666,16 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5416
5666
|
(obj === null || obj === void 0 ? void 0 : obj.type) === 'state' &&
|
|
5417
5667
|
// @ts-expect-error deprecated from js-controller 6
|
|
5418
5668
|
((_e = obj.common) === null || _e === void 0 ? void 0 : _e.type) !== 'file'),
|
|
5419
|
-
icon: react_1.default.createElement(icons_material_1.Link, { style: ((_f = obj === null || obj === void 0 ? void 0 : obj.common) === null || _f === void 0 ? void 0 : _f.alias)
|
|
5669
|
+
icon: (react_1.default.createElement(icons_material_1.Link, { style: ((_f = obj === null || obj === void 0 ? void 0 : obj.common) === null || _f === void 0 ? void 0 : _f.alias)
|
|
5420
5670
|
? this.styles.cellButtonsButtonWithCustoms
|
|
5421
|
-
: styles.cellButtonsButtonWithoutCustoms }),
|
|
5422
|
-
label: this.
|
|
5671
|
+
: styles.cellButtonsButtonWithoutCustoms })),
|
|
5672
|
+
label: this.info.aliasesMap[item.data.id]
|
|
5673
|
+
? this.props.t('ra_Edit alias')
|
|
5674
|
+
: this.props.t('ra_Create alias'),
|
|
5423
5675
|
onClick: () => {
|
|
5424
5676
|
var _b;
|
|
5425
5677
|
if ((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.alias) {
|
|
5426
|
-
this.setState({ editObjectDialog: item.data.id,
|
|
5678
|
+
this.setState({ showContextMenu: null, editObjectDialog: item.data.id, editObjectAlias: true });
|
|
5427
5679
|
}
|
|
5428
5680
|
else {
|
|
5429
5681
|
this.setState({ showContextMenu: null, showAliasEditor: item.data.id });
|
|
@@ -5434,7 +5686,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5434
5686
|
key: '+',
|
|
5435
5687
|
visibility: (item.data.id.startsWith('0_userdata.0') || item.data.id.startsWith('javascript.')) &&
|
|
5436
5688
|
(createStateVisible || createChannelVisible || createDeviceVisible || createFolderVisible),
|
|
5437
|
-
icon: react_1.default.createElement(icons_material_1.Add, { fontSize: "small", style: this.styles.cellButtonsButtonWithCustoms }),
|
|
5689
|
+
icon: (react_1.default.createElement(icons_material_1.Add, { fontSize: "small", style: this.styles.cellButtonsButtonWithCustoms })),
|
|
5438
5690
|
style: styles.contextMenuWithSubMenu,
|
|
5439
5691
|
label: this.texts.create,
|
|
5440
5692
|
subMenu: [
|
|
@@ -5484,8 +5736,9 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5484
5736
|
},
|
|
5485
5737
|
DELETE: {
|
|
5486
5738
|
key: 'Delete',
|
|
5487
|
-
visibility: !!(this.props.onObjectDelete &&
|
|
5488
|
-
|
|
5739
|
+
visibility: !!(this.props.onObjectDelete &&
|
|
5740
|
+
(((_g = item.children) === null || _g === void 0 ? void 0 : _g.length) || (obj && !((_h = obj.common) === null || _h === void 0 ? void 0 : _h.dontDelete)))),
|
|
5741
|
+
icon: (react_1.default.createElement(icons_material_1.Delete, { fontSize: "small", style: this.styles.contextMenuDelete })),
|
|
5489
5742
|
style: this.styles.contextMenuDelete,
|
|
5490
5743
|
label: this.texts.deleteObject,
|
|
5491
5744
|
onClick: () => this.setState({ showContextMenu: null }, () => this.showDeleteDialog({
|
|
@@ -5499,13 +5752,15 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5499
5752
|
var _b, _c;
|
|
5500
5753
|
if (ITEMS[key].visibility) {
|
|
5501
5754
|
if (ITEMS[key].subMenu) {
|
|
5502
|
-
items.push(react_1.default.createElement(material_1.MenuItem, { key: key, onClick: (e) => this.state.showContextMenu &&
|
|
5503
|
-
|
|
5504
|
-
|
|
5505
|
-
|
|
5506
|
-
|
|
5507
|
-
|
|
5508
|
-
|
|
5755
|
+
items.push(react_1.default.createElement(material_1.MenuItem, { key: key, href: "", onClick: (e) => this.state.showContextMenu &&
|
|
5756
|
+
this.setState({
|
|
5757
|
+
showContextMenu: {
|
|
5758
|
+
item: this.state.showContextMenu.item,
|
|
5759
|
+
position: this.state.showContextMenu.position,
|
|
5760
|
+
subItem: key,
|
|
5761
|
+
subAnchor: e.target,
|
|
5762
|
+
},
|
|
5763
|
+
}), style: ITEMS[key].style },
|
|
5509
5764
|
react_1.default.createElement(material_1.ListItemIcon, { style: Object.assign(Object.assign({}, ITEMS[key].iconStyle), ITEMS[key].listItemIconStyle) }, ITEMS[key].icon),
|
|
5510
5765
|
react_1.default.createElement(material_1.ListItemText, null,
|
|
5511
5766
|
ITEMS[key].label,
|
|
@@ -5515,19 +5770,24 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5515
5770
|
if (((_b = this.state.showContextMenu) === null || _b === void 0 ? void 0 : _b.subItem) === key) {
|
|
5516
5771
|
items.push(react_1.default.createElement(material_1.Menu, { key: "subContextMenu", open: !0, anchorEl: this.state.showContextMenu.subAnchor, onClose: () => {
|
|
5517
5772
|
if (this.state.showContextMenu) {
|
|
5518
|
-
this.setState({
|
|
5773
|
+
this.setState({
|
|
5774
|
+
showContextMenu: {
|
|
5775
|
+
item: this.state.showContextMenu.item,
|
|
5776
|
+
position: this.state.showContextMenu.position,
|
|
5777
|
+
},
|
|
5778
|
+
});
|
|
5519
5779
|
}
|
|
5520
5780
|
this.contextMenu = null;
|
|
5521
|
-
} }, (_c = ITEMS[key].subMenu) === null || _c === void 0 ? void 0 : _c.map(subItem =>
|
|
5781
|
+
} }, (_c = ITEMS[key].subMenu) === null || _c === void 0 ? void 0 : _c.map(subItem => subItem.visibility ? (react_1.default.createElement(material_1.MenuItem, { key: subItem.label, onClick: subItem.onClick, style: subItem.style },
|
|
5522
5782
|
react_1.default.createElement(material_1.ListItemIcon, { style: Object.assign(Object.assign({}, subItem.iconStyle), (subItem.listItemIconStyle || undefined)) }, subItem.icon),
|
|
5523
|
-
react_1.default.createElement(material_1.ListItemText, null, subItem.label)) : null)))
|
|
5783
|
+
react_1.default.createElement(material_1.ListItemText, null, subItem.label))) : null)));
|
|
5524
5784
|
}
|
|
5525
5785
|
}
|
|
5526
5786
|
else {
|
|
5527
5787
|
items.push(react_1.default.createElement(material_1.MenuItem, { key: key, onClick: ITEMS[key].onClick, sx: ITEMS[key].style },
|
|
5528
5788
|
react_1.default.createElement(material_1.ListItemIcon, { style: Object.assign(Object.assign({}, ITEMS[key].iconStyle), ITEMS[key].listItemIconStyle) }, ITEMS[key].icon),
|
|
5529
5789
|
react_1.default.createElement(material_1.ListItemText, null, ITEMS[key].label),
|
|
5530
|
-
ITEMS[key].key ? react_1.default.createElement("div", { style: styles.contextMenuKeys }, `Alt+${ITEMS[key].key === 'Delete' ? this.props.t('ra_Del') : ITEMS[key].key}`) : null));
|
|
5790
|
+
ITEMS[key].key ? (react_1.default.createElement("div", { style: styles.contextMenuKeys }, `Alt+${ITEMS[key].key === 'Delete' ? this.props.t('ra_Del') : ITEMS[key].key}`)) : null));
|
|
5531
5791
|
}
|
|
5532
5792
|
}
|
|
5533
5793
|
});
|
|
@@ -5535,8 +5795,7 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5535
5795
|
setTimeout(() => this.setState({ showContextMenu: null }), 100);
|
|
5536
5796
|
return null;
|
|
5537
5797
|
}
|
|
5538
|
-
|
|
5539
|
-
return react_1.default.createElement(material_1.Menu, { key: "contextMenu", open: !0, onKeyUp: e => {
|
|
5798
|
+
return (react_1.default.createElement(material_1.Menu, { key: "contextMenu", open: !0, onKeyUp: e => {
|
|
5540
5799
|
e.preventDefault();
|
|
5541
5800
|
if (e.altKey) {
|
|
5542
5801
|
Object.keys(ITEMS).forEach(key => {
|
|
@@ -5545,10 +5804,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5545
5804
|
}
|
|
5546
5805
|
});
|
|
5547
5806
|
}
|
|
5548
|
-
},
|
|
5807
|
+
}, anchorReference: "anchorPosition", anchorPosition: this.state.showContextMenu.position, onClose: () => {
|
|
5549
5808
|
this.setState({ showContextMenu: null });
|
|
5550
5809
|
this.contextMenu = null;
|
|
5551
|
-
} }, items);
|
|
5810
|
+
} }, items));
|
|
5552
5811
|
}
|
|
5553
5812
|
renderEditValueDialog() {
|
|
5554
5813
|
var _b;
|
|
@@ -5568,12 +5827,14 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5568
5827
|
: typeof this.edit.val;
|
|
5569
5828
|
const role = this.objects[this.edit.id].common.role;
|
|
5570
5829
|
const ObjectBrowserValue = this.props.objectBrowserValue;
|
|
5571
|
-
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
|
|
5830
|
+
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
|
|
5831
|
+
? this.systemConfig.common.isFloatComma
|
|
5832
|
+
: this.props.isFloatComma, onClose: (res) => {
|
|
5572
5833
|
this.setState({ updateOpened: false });
|
|
5573
5834
|
if (res) {
|
|
5574
5835
|
this.onUpdate(res);
|
|
5575
5836
|
}
|
|
5576
|
-
}, width: this.props.width });
|
|
5837
|
+
}, width: this.props.width }));
|
|
5577
5838
|
}
|
|
5578
5839
|
/**
|
|
5579
5840
|
* The rendering method of this component.
|
|
@@ -5629,42 +5890,43 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5629
5890
|
return react_1.default.createElement(material_1.CircularProgress, { key: `${this.props.dialogName}_c` });
|
|
5630
5891
|
}
|
|
5631
5892
|
const items = this.root ? this.renderItem(this.root, undefined) : null;
|
|
5632
|
-
return react_1.default.createElement(TabContainer_1.default, { key: this.props.dialogName },
|
|
5633
|
-
react_1.default.createElement("style", null, `
|
|
5634
|
-
@keyframes newValueAnimation-light {
|
|
5635
|
-
0% {
|
|
5636
|
-
color: #00f900;
|
|
5637
|
-
}
|
|
5638
|
-
80% {
|
|
5639
|
-
color: #008000;
|
|
5640
|
-
}
|
|
5641
|
-
100% {
|
|
5642
|
-
color: #000;
|
|
5643
|
-
}
|
|
5644
|
-
}
|
|
5645
|
-
@keyframes newValueAnimation-dark {
|
|
5646
|
-
0% {
|
|
5647
|
-
color: #00f900;
|
|
5648
|
-
}
|
|
5649
|
-
80% {
|
|
5650
|
-
color: #008000;
|
|
5651
|
-
}
|
|
5652
|
-
100% {
|
|
5653
|
-
color: #fff;
|
|
5654
|
-
}
|
|
5655
|
-
}
|
|
5656
|
-
.newValueBrowser-dark {
|
|
5657
|
-
animation: newValueAnimation-dark 2s ease-in-out;
|
|
5658
|
-
}
|
|
5659
|
-
.newValueBrowser-light {
|
|
5660
|
-
animation: newValueAnimation-light 2s ease-in-out;
|
|
5661
|
-
}
|
|
5893
|
+
return (react_1.default.createElement(TabContainer_1.default, { key: this.props.dialogName },
|
|
5894
|
+
react_1.default.createElement("style", null, `
|
|
5895
|
+
@keyframes newValueAnimation-light {
|
|
5896
|
+
0% {
|
|
5897
|
+
color: #00f900;
|
|
5898
|
+
}
|
|
5899
|
+
80% {
|
|
5900
|
+
color: #008000;
|
|
5901
|
+
}
|
|
5902
|
+
100% {
|
|
5903
|
+
color: #000;
|
|
5904
|
+
}
|
|
5905
|
+
}
|
|
5906
|
+
@keyframes newValueAnimation-dark {
|
|
5907
|
+
0% {
|
|
5908
|
+
color: #00f900;
|
|
5909
|
+
}
|
|
5910
|
+
80% {
|
|
5911
|
+
color: #008000;
|
|
5912
|
+
}
|
|
5913
|
+
100% {
|
|
5914
|
+
color: #fff;
|
|
5915
|
+
}
|
|
5916
|
+
}
|
|
5917
|
+
.newValueBrowser-dark {
|
|
5918
|
+
animation: newValueAnimation-dark 2s ease-in-out;
|
|
5919
|
+
}
|
|
5920
|
+
.newValueBrowser-light {
|
|
5921
|
+
animation: newValueAnimation-light 2s ease-in-out;
|
|
5922
|
+
}
|
|
5662
5923
|
`),
|
|
5663
5924
|
react_1.default.createElement(TabHeader_1.default, null, this.getToolbar()),
|
|
5664
5925
|
react_1.default.createElement(TabContent_1.default, null,
|
|
5665
5926
|
this.renderHeader(),
|
|
5666
5927
|
react_1.default.createElement("div", { style: styles.tableDiv, ref: this.tableRef, onKeyDown: event => this.navigateKeyPress(event) }, items)),
|
|
5667
5928
|
this.renderContextMenu(),
|
|
5929
|
+
this.renderAliasMenu(),
|
|
5668
5930
|
this.renderToast(),
|
|
5669
5931
|
this.renderColumnsEditCustomDialog(),
|
|
5670
5932
|
this.renderColumnsSelectorDialog(),
|
|
@@ -5678,9 +5940,10 @@ class ObjectBrowserClass extends react_1.Component {
|
|
|
5678
5940
|
this.renderErrorDialog(),
|
|
5679
5941
|
this.renderExportDialog(),
|
|
5680
5942
|
this.state.modalNewObj && this.props.modalNewObject && this.props.modalNewObject(this),
|
|
5681
|
-
this.state.modalEditOfAccess &&
|
|
5943
|
+
this.state.modalEditOfAccess &&
|
|
5944
|
+
this.state.modalEditOfAccessObjData &&
|
|
5682
5945
|
this.props.modalEditOfAccessControl &&
|
|
5683
|
-
this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData));
|
|
5946
|
+
this.props.modalEditOfAccessControl(this, this.state.modalEditOfAccessObjData)));
|
|
5684
5947
|
}
|
|
5685
5948
|
}
|
|
5686
5949
|
exports.ObjectBrowserClass = ObjectBrowserClass;
|