@iobroker/adapter-react-v5 7.0.2 → 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 +3 -2
- 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 +135 -152
- 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 +21 -18
- 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 +20 -7
- package/Components/Loaders/Vendor.d.ts +2 -2
- package/Components/Loaders/Vendor.js +15 -7
- package/Components/Logo.js +16 -18
- package/Components/MDUtils.d.ts +1 -1
- package/Components/MDUtils.js +8 -4
- package/Components/ObjectBrowser.d.ts +40 -39
- package/Components/ObjectBrowser.js +550 -435
- 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 +25 -21
- 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 +128 -85
- package/LegacyConnection.d.ts +240 -248
- package/LegacyConnection.js +500 -525
- package/README.md +1234 -1170
- package/Theme.d.ts +1 -1
- package/Theme.js +9 -12
- package/assets/devices.json +1 -0
- package/assets/rooms.json +1 -0
- package/craco-module-federation.js +3 -12
- package/i18n/de.json +434 -434
- package/i18n/en.json +434 -434
- package/i18n/es.json +434 -434
- package/i18n/fr.json +434 -434
- package/i18n/it.json +434 -434
- package/i18n/nl.json +434 -434
- package/i18n/pl.json +434 -434
- package/i18n/pt.json +434 -434
- package/i18n/ru.json +434 -434
- package/i18n/uk.json +434 -434
- package/i18n/zh-cn.json +434 -434
- 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 +3 -2
- package/package.json +1 -1
- package/src/Components/404.tsx +32 -31
- package/src/Components/ColorPicker.tsx +142 -114
- package/src/Components/ComplexCron.tsx +174 -137
- package/src/Components/CopyToClipboard.tsx +22 -9
- package/src/Components/CustomModal.tsx +76 -69
- package/src/Components/FileBrowser.tsx +959 -852
- package/src/Components/FileViewer.tsx +146 -127
- package/src/Components/Icon.tsx +80 -52
- package/src/Components/IconPicker.tsx +83 -67
- package/src/Components/IconSelector.tsx +159 -141
- package/src/Components/Image.tsx +43 -26
- package/src/Components/Loader.tsx +56 -32
- package/src/Components/Logo.tsx +62 -52
- package/src/Components/MDUtils.tsx +10 -6
- package/src/Components/ObjectBrowser.tsx +3198 -2478
- package/src/Components/Router.tsx +11 -11
- package/src/Components/SaveCloseButtons.tsx +43 -39
- package/src/Components/Schedule.tsx +1091 -853
- package/src/Components/SelectWithIcon.tsx +135 -93
- package/src/Components/TabContainer.tsx +21 -19
- package/src/Components/TabContent.tsx +13 -12
- package/src/Components/TabHeader.tsx +10 -9
- package/src/Components/TableResize.tsx +52 -37
- package/src/Components/TextWithIcon.tsx +30 -19
- package/src/Components/ToggleThemeMenu.tsx +31 -13
- package/src/Components/TreeTable.tsx +468 -385
- package/src/Components/UploadImage.tsx +153 -121
- package/src/Components/Utils.tsx +135 -127
- package/src/Components/loader.css +40 -31
- package/src/Components/withWidth.tsx +23 -12
- package/src/Connection.tsx +1 -3
- package/src/Dialogs/ComplexCron.tsx +55 -61
- package/src/Dialogs/Confirm.tsx +88 -65
- package/src/Dialogs/Cron.tsx +122 -112
- package/src/Dialogs/Error.tsx +37 -42
- package/src/Dialogs/Message.tsx +39 -37
- package/src/Dialogs/SelectFile.tsx +95 -85
- package/src/Dialogs/SelectID.tsx +141 -129
- package/src/Dialogs/SimpleCron.tsx +44 -44
- package/src/Dialogs/TextInput.tsx +60 -68
- package/src/GenericApp.tsx +342 -242
- package/src/LegacyConnection.tsx +972 -842
- package/src/Prompt.tsx +3 -1
- package/src/Theme.tsx +19 -26
- package/src/icons/IconAdapter.tsx +16 -14
- package/src/icons/IconAlias.tsx +16 -14
- package/src/icons/IconChannel.tsx +55 -16
- package/src/icons/IconClearFilter.tsx +17 -15
- package/src/icons/IconClosed.tsx +16 -11
- package/src/icons/IconCopy.tsx +16 -11
- package/src/icons/IconDevice.tsx +121 -22
- package/src/icons/IconDocument.tsx +16 -11
- package/src/icons/IconDocumentReadOnly.tsx +21 -12
- package/src/icons/IconExpert.tsx +20 -12
- package/src/icons/IconFx.tsx +16 -14
- package/src/icons/IconInstance.tsx +16 -14
- package/src/icons/IconLogout.tsx +20 -18
- package/src/icons/IconNoIcon.tsx +16 -14
- package/src/icons/IconOpen.tsx +17 -12
- package/src/icons/IconProps.tsx +4 -3
- package/src/icons/IconState.tsx +34 -13
- package/src/index.css +3 -2
- package/tasks.js +91 -0
- package/types.d.ts +141 -0
- 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
package/Components/Utils.js
CHANGED
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
*
|
|
9
9
|
* MIT License
|
|
10
10
|
*
|
|
11
|
-
|
|
11
|
+
*/
|
|
12
12
|
const react_1 = __importDefault(require("react"));
|
|
13
13
|
const CopyToClipboard_1 = __importDefault(require("./CopyToClipboard"));
|
|
14
14
|
const i18n_1 = __importDefault(require("../i18n"));
|
|
@@ -365,10 +365,10 @@ class Utils {
|
|
|
365
365
|
return react_1.default.createElement("span", { style: style || {} }, settings.icon);
|
|
366
366
|
}
|
|
367
367
|
if (settings.icon.startsWith('data:image')) {
|
|
368
|
-
return react_1.default.createElement("img", { alt: settings.name, src: settings.icon, style: style || {} });
|
|
368
|
+
return (react_1.default.createElement("img", { alt: settings.name, src: settings.icon, style: style || {} }));
|
|
369
369
|
}
|
|
370
370
|
// maybe later some changes for a second type
|
|
371
|
-
return react_1.default.createElement("img", { alt: settings.name, src: (settings.prefix || '') + settings.icon, style: style });
|
|
371
|
+
return (react_1.default.createElement("img", { alt: settings.name, src: (settings.prefix || '') + settings.icon, style: style }));
|
|
372
372
|
}
|
|
373
373
|
return null;
|
|
374
374
|
}
|
|
@@ -499,7 +499,9 @@ class Utils {
|
|
|
499
499
|
return '--:--';
|
|
500
500
|
}
|
|
501
501
|
const hours = Math.floor(seconds / 3600);
|
|
502
|
-
const minutes = Math.floor((seconds % 3600) / 60)
|
|
502
|
+
const minutes = Math.floor((seconds % 3600) / 60)
|
|
503
|
+
.toString()
|
|
504
|
+
.padStart(2, '0');
|
|
503
505
|
const secs = (seconds % 60).toString().padStart(2, '0');
|
|
504
506
|
if (hours) {
|
|
505
507
|
return `${hours}:${minutes}:${secs}`;
|
|
@@ -672,8 +674,9 @@ class Utils {
|
|
|
672
674
|
const target = m[0].match(/target="([^"]+)"/) || m[0].match(/target='([^']+)'/);
|
|
673
675
|
const rel = m[0].match(/rel="([^"]+)"/) || m[0].match(/rel='([^']+)'/);
|
|
674
676
|
const title = m[0].match(/>([^<]*)</);
|
|
675
|
-
|
|
676
|
-
|
|
677
|
+
result.push(
|
|
678
|
+
// eslint-disable-next-line react/jsx-no-target-blank
|
|
679
|
+
react_1.default.createElement("a", { key: `a${key++}`, href: href ? href[1] : '', target: target ? target[1] : '_blank', rel: rel ? rel[1] : 'noreferrer', style: { color: 'inherit' } }, title ? title[1] : ''));
|
|
677
680
|
}
|
|
678
681
|
m = text ? text.match(/<a [^<]+<\/a>|<br\/?>|<b>[^<]+<\/b>|<i>[^<]+<\/i>/) : null;
|
|
679
682
|
if (!m) {
|
|
@@ -703,15 +706,17 @@ class Utils {
|
|
|
703
706
|
return states.smartName;
|
|
704
707
|
}
|
|
705
708
|
const obj = states;
|
|
706
|
-
return ((_a = obj === null || obj === void 0 ? void 0 : obj.common) === null || _a === void 0 ? void 0 : _a.custom) && obj.common.custom[instanceId]
|
|
707
|
-
obj.common.custom[instanceId].smartName
|
|
709
|
+
return ((_a = obj === null || obj === void 0 ? void 0 : obj.common) === null || _a === void 0 ? void 0 : _a.custom) && obj.common.custom[instanceId]
|
|
710
|
+
? obj.common.custom[instanceId].smartName
|
|
711
|
+
: undefined;
|
|
708
712
|
}
|
|
709
713
|
if (!noCommon) {
|
|
710
714
|
return states[id].common.smartName;
|
|
711
715
|
}
|
|
712
716
|
const obj = states[id];
|
|
713
|
-
return ((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.custom) && obj.common.custom[instanceId]
|
|
714
|
-
obj.common.custom[instanceId].smartName || null
|
|
717
|
+
return ((_b = obj === null || obj === void 0 ? void 0 : obj.common) === null || _b === void 0 ? void 0 : _b.custom) && obj.common.custom[instanceId]
|
|
718
|
+
? obj.common.custom[instanceId].smartName || null
|
|
719
|
+
: null;
|
|
715
720
|
}
|
|
716
721
|
/**
|
|
717
722
|
* Get the smart name from a state.
|
|
@@ -913,6 +918,7 @@ class Utils {
|
|
|
913
918
|
}
|
|
914
919
|
/**
|
|
915
920
|
* Gets the extension of a file name.
|
|
921
|
+
*
|
|
916
922
|
* @param fileName the file name.
|
|
917
923
|
* @returns The extension in lower case.
|
|
918
924
|
*/
|
|
@@ -926,11 +932,11 @@ class Utils {
|
|
|
926
932
|
/**
|
|
927
933
|
* Format number of bytes as a string with B, KB, MB or GB.
|
|
928
934
|
* The base for all calculations is 1024.
|
|
935
|
+
*
|
|
936
|
+
* @param bytes The number of bytes.
|
|
929
937
|
* @returns The formatted string (e.g. '723.5 KB')
|
|
930
938
|
*/
|
|
931
|
-
static formatBytes(
|
|
932
|
-
/** The number of bytes. */
|
|
933
|
-
bytes) {
|
|
939
|
+
static formatBytes(bytes) {
|
|
934
940
|
if (Math.abs(bytes) < 1024) {
|
|
935
941
|
return `${bytes} B`;
|
|
936
942
|
}
|
|
@@ -945,12 +951,12 @@ class Utils {
|
|
|
945
951
|
}
|
|
946
952
|
/**
|
|
947
953
|
* Invert the given color according to a theme type to get the inverted text color for background
|
|
954
|
+
*
|
|
955
|
+
* @param color Color in the format '#rrggbb' or '#rgb' (or without a hash)
|
|
956
|
+
* @param themeType 'light' or 'dark'
|
|
957
|
+
* @param invert If true, the dark theme has a light color in the control, or the dark theme has a light color in the control
|
|
948
958
|
*/
|
|
949
|
-
static getInvertedColor(
|
|
950
|
-
/** Color in the format '#rrggbb' or '#rgb' (or without a hash) */
|
|
951
|
-
color, themeType,
|
|
952
|
-
/** dark theme has light color in control, or light theme has light color in control */
|
|
953
|
-
invert) {
|
|
959
|
+
static getInvertedColor(color, themeType, invert) {
|
|
954
960
|
if (!color) {
|
|
955
961
|
return undefined;
|
|
956
962
|
}
|
|
@@ -966,7 +972,8 @@ class Utils {
|
|
|
966
972
|
// Big thanks to: https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
|
|
967
973
|
/**
|
|
968
974
|
* Invert the given color
|
|
969
|
-
*
|
|
975
|
+
*
|
|
976
|
+
* @param hex Color in the format '#rrggbb' or '#rgb' (or without a hash)
|
|
970
977
|
* @param bw Set to black or white.
|
|
971
978
|
*/
|
|
972
979
|
static invertColor(hex, bw) {
|
|
@@ -1012,9 +1019,7 @@ class Utils {
|
|
|
1012
1019
|
const b = parseInt(hex.slice(4, 6), 16);
|
|
1013
1020
|
if (bw) {
|
|
1014
1021
|
// http://stackoverflow.com/a/3943023/112731
|
|
1015
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 186
|
|
1016
|
-
? `#000000${alfa || ''}`
|
|
1017
|
-
: `#FFFFFF${alfa || ''}`;
|
|
1022
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? `#000000${alfa || ''}` : `#FFFFFF${alfa || ''}`;
|
|
1018
1023
|
}
|
|
1019
1024
|
// invert color components
|
|
1020
1025
|
const rs = (255 - r).toString(16);
|
|
@@ -1025,6 +1030,7 @@ class Utils {
|
|
|
1025
1030
|
}
|
|
1026
1031
|
/**
|
|
1027
1032
|
* Convert RGB to array [r, g, b]
|
|
1033
|
+
*
|
|
1028
1034
|
* @param hex Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
1029
1035
|
* @returns Array with 3 elements [r, g, b]
|
|
1030
1036
|
*/
|
|
@@ -1061,17 +1067,14 @@ class Utils {
|
|
|
1061
1067
|
console.warn(`Cannot invert color: ${hex}`);
|
|
1062
1068
|
return false;
|
|
1063
1069
|
}
|
|
1064
|
-
return [
|
|
1065
|
-
parseInt(hex.slice(0, 2), 16),
|
|
1066
|
-
parseInt(hex.slice(2, 4), 16),
|
|
1067
|
-
parseInt(hex.slice(4, 6), 16),
|
|
1068
|
-
];
|
|
1070
|
+
return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16)];
|
|
1069
1071
|
}
|
|
1070
1072
|
// Big thanks to: https://github.com/antimatter15/rgb-lab
|
|
1071
1073
|
/**
|
|
1072
1074
|
* Convert RGB to LAB
|
|
1073
|
-
*
|
|
1074
|
-
* @
|
|
1075
|
+
*
|
|
1076
|
+
* @param rgb color in format [r,g,b]
|
|
1077
|
+
* @returns lab color in format [l,a,b]
|
|
1075
1078
|
*/
|
|
1076
1079
|
static rgb2lab(rgb) {
|
|
1077
1080
|
let r = rgb[0] / 255;
|
|
@@ -1090,7 +1093,8 @@ class Utils {
|
|
|
1090
1093
|
}
|
|
1091
1094
|
/**
|
|
1092
1095
|
* Calculate the distance between two colors in LAB color space in the range 0-100^2
|
|
1093
|
-
* If distance is less than 1000, the colors are similar
|
|
1096
|
+
* If the distance is less than 1000, the colors are similar
|
|
1097
|
+
*
|
|
1094
1098
|
* @param color1 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
1095
1099
|
* @param color2 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
1096
1100
|
* @returns distance in the range 0-100^2
|
|
@@ -1122,9 +1126,6 @@ class Utils {
|
|
|
1122
1126
|
// https://github.com/lukeed/clsx/blob/master/src/index.js
|
|
1123
1127
|
// License
|
|
1124
1128
|
// MIT © Luke Edwards
|
|
1125
|
-
/**
|
|
1126
|
-
* @private
|
|
1127
|
-
*/
|
|
1128
1129
|
static _toVal(mix) {
|
|
1129
1130
|
let y;
|
|
1130
1131
|
let str = '';
|
|
@@ -1159,7 +1160,6 @@ class Utils {
|
|
|
1159
1160
|
// MIT © Luke Edwards
|
|
1160
1161
|
/**
|
|
1161
1162
|
* Convert any object to a string with its values.
|
|
1162
|
-
* @returns {string}
|
|
1163
1163
|
*/
|
|
1164
1164
|
static clsx(...inputs) {
|
|
1165
1165
|
let i = 0;
|
|
@@ -1167,7 +1167,6 @@ class Utils {
|
|
|
1167
1167
|
let x;
|
|
1168
1168
|
let str = '';
|
|
1169
1169
|
while (i < inputs.length) {
|
|
1170
|
-
// eslint-disable-next-line prefer-rest-params
|
|
1171
1170
|
tmp = inputs[i++];
|
|
1172
1171
|
if (tmp) {
|
|
1173
1172
|
x = Utils._toVal(tmp);
|
|
@@ -1183,7 +1182,9 @@ class Utils {
|
|
|
1183
1182
|
* Get the current theme name (either from local storage or the browser settings).
|
|
1184
1183
|
*/
|
|
1185
1184
|
static getThemeName(themeName) {
|
|
1186
|
-
if (window.vendorPrefix &&
|
|
1185
|
+
if (window.vendorPrefix &&
|
|
1186
|
+
window.vendorPrefix !== '@@vendorPrefix@@' &&
|
|
1187
|
+
window.vendorPrefix !== 'MV') {
|
|
1187
1188
|
return window.vendorPrefix;
|
|
1188
1189
|
}
|
|
1189
1190
|
themeName = (window._localStorage || window.localStorage).getItem('App.themeName');
|
|
@@ -1215,13 +1216,17 @@ class Utils {
|
|
|
1215
1216
|
}
|
|
1216
1217
|
/**
|
|
1217
1218
|
* Toggle the theme name between 'dark' and 'colored'.
|
|
1219
|
+
*
|
|
1218
1220
|
* @returns the new theme name.
|
|
1219
1221
|
*/
|
|
1220
1222
|
static toggleTheme(themeName) {
|
|
1221
|
-
if (window.vendorPrefix &&
|
|
1223
|
+
if (window.vendorPrefix &&
|
|
1224
|
+
window.vendorPrefix !== '@@vendorPrefix@@' &&
|
|
1225
|
+
window.vendorPrefix !== 'MV') {
|
|
1222
1226
|
return window.vendorPrefix;
|
|
1223
1227
|
}
|
|
1224
|
-
themeName =
|
|
1228
|
+
themeName =
|
|
1229
|
+
themeName || (window._localStorage || window.localStorage).getItem('App.themeName') || 'light';
|
|
1225
1230
|
// dark => blue => colored => light => dark
|
|
1226
1231
|
const themes = Utils.getThemeNames();
|
|
1227
1232
|
const pos = themeName ? themes.indexOf(themeName) : -1;
|
|
@@ -1237,13 +1242,16 @@ class Utils {
|
|
|
1237
1242
|
}
|
|
1238
1243
|
/**
|
|
1239
1244
|
* Get the list of themes
|
|
1245
|
+
*
|
|
1240
1246
|
* @returns list of possible themes
|
|
1241
1247
|
*/
|
|
1242
1248
|
static getThemeNames() {
|
|
1243
|
-
if (window.vendorPrefix &&
|
|
1249
|
+
if (window.vendorPrefix &&
|
|
1250
|
+
window.vendorPrefix !== '@@vendorPrefix@@' &&
|
|
1251
|
+
window.vendorPrefix !== 'MV') {
|
|
1244
1252
|
return [window.vendorPrefix];
|
|
1245
1253
|
}
|
|
1246
|
-
return ['light', 'dark'
|
|
1254
|
+
return ['light', 'dark'];
|
|
1247
1255
|
}
|
|
1248
1256
|
/**
|
|
1249
1257
|
* Parse a query string into its parts.
|
|
@@ -1283,6 +1291,7 @@ class Utils {
|
|
|
1283
1291
|
}
|
|
1284
1292
|
/**
|
|
1285
1293
|
* Returns parent ID.
|
|
1294
|
+
*
|
|
1286
1295
|
* @returns parent ID or null if no parent
|
|
1287
1296
|
*/
|
|
1288
1297
|
static getParentId(id) {
|
|
@@ -1311,9 +1320,9 @@ class Utils {
|
|
|
1311
1320
|
text += ` ${dateObj.getHours().toString().padStart(2, '0')}:${dateObj.getMinutes().toString().padStart(2, '0')}:${dateObj.getSeconds().toString().padStart(2, '0')}.${dateObj.getMilliseconds().toString().padStart(3, '0')}`;
|
|
1312
1321
|
return text;
|
|
1313
1322
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1323
|
+
/**
|
|
1324
|
+
* Format seconds to string like 'h:mm:ss' or 'd.hh:mm:ss'
|
|
1325
|
+
*/
|
|
1317
1326
|
static formatTime(seconds) {
|
|
1318
1327
|
if (seconds) {
|
|
1319
1328
|
seconds = Math.round(seconds);
|
|
@@ -1342,8 +1351,8 @@ class Utils {
|
|
|
1342
1351
|
.replace(/\s/g, '')
|
|
1343
1352
|
.toLowerCase();
|
|
1344
1353
|
}
|
|
1345
|
-
|
|
1346
|
-
|
|
1354
|
+
/**
|
|
1355
|
+
* Open url link in the new target window
|
|
1347
1356
|
*/
|
|
1348
1357
|
static openLink(url, target) {
|
|
1349
1358
|
// replace IPv6 Address with [ipv6]:port
|
|
@@ -1435,31 +1444,26 @@ class Utils {
|
|
|
1435
1444
|
}
|
|
1436
1445
|
/**
|
|
1437
1446
|
* Convert quality code into text
|
|
1447
|
+
*
|
|
1438
1448
|
* @returns lines that decode quality
|
|
1439
1449
|
*/
|
|
1440
1450
|
static quality2text(quality) {
|
|
1441
|
-
|
|
1442
|
-
const custom = quality & 0xFFFF0000;
|
|
1451
|
+
const custom = quality & 0xffff0000;
|
|
1443
1452
|
const text = QUALITY_BITS[quality];
|
|
1444
1453
|
let result;
|
|
1445
1454
|
if (text) {
|
|
1446
1455
|
result = [text];
|
|
1447
|
-
// eslint-disable-next-line no-bitwise
|
|
1448
1456
|
}
|
|
1449
1457
|
else if (quality & 0x01) {
|
|
1450
|
-
|
|
1451
|
-
result = [QUALITY_BITS[0x01], `0x${(quality & (0xFFFF & ~1)).toString(16)}`];
|
|
1452
|
-
// eslint-disable-next-line no-bitwise
|
|
1458
|
+
result = [QUALITY_BITS[0x01], `0x${(quality & (0xffff & ~1)).toString(16)}`];
|
|
1453
1459
|
}
|
|
1454
1460
|
else if (quality & 0x02) {
|
|
1455
|
-
|
|
1456
|
-
result = [QUALITY_BITS[0x02], `0x${(quality & (0xFFFF & ~2)).toString(16)}`];
|
|
1461
|
+
result = [QUALITY_BITS[0x02], `0x${(quality & (0xffff & ~2)).toString(16)}`];
|
|
1457
1462
|
}
|
|
1458
1463
|
else {
|
|
1459
1464
|
result = [`0x${quality.toString(16)}`];
|
|
1460
1465
|
}
|
|
1461
1466
|
if (custom) {
|
|
1462
|
-
// eslint-disable-next-line no-bitwise
|
|
1463
1467
|
result.push(`0x${(custom >> 16).toString(16).toUpperCase()}`);
|
|
1464
1468
|
}
|
|
1465
1469
|
return result;
|
|
@@ -1472,6 +1476,7 @@ class Utils {
|
|
|
1472
1476
|
}
|
|
1473
1477
|
/**
|
|
1474
1478
|
* Get states of object
|
|
1479
|
+
*
|
|
1475
1480
|
* @returns states as an object in form {"value1": "label1", "value2": "label2"} or null
|
|
1476
1481
|
*/
|
|
1477
1482
|
static getStates(obj) {
|
|
@@ -1483,7 +1488,7 @@ class Utils {
|
|
|
1483
1488
|
try {
|
|
1484
1489
|
result = JSON.parse(states);
|
|
1485
1490
|
}
|
|
1486
|
-
catch (
|
|
1491
|
+
catch (_b) {
|
|
1487
1492
|
console.error(`Cannot parse states: ${states}`);
|
|
1488
1493
|
result = null;
|
|
1489
1494
|
}
|
|
@@ -1518,6 +1523,7 @@ class Utils {
|
|
|
1518
1523
|
}
|
|
1519
1524
|
/**
|
|
1520
1525
|
* Get svg file as text
|
|
1526
|
+
*
|
|
1521
1527
|
* @param url URL of SVG file
|
|
1522
1528
|
* @returns Promise with "data:image..."
|
|
1523
1529
|
*/
|
|
@@ -1526,7 +1532,6 @@ class Utils {
|
|
|
1526
1532
|
const blob = await response.blob();
|
|
1527
1533
|
return new Promise(resolve => {
|
|
1528
1534
|
const reader = new FileReader();
|
|
1529
|
-
// eslint-disable-next-line func-names
|
|
1530
1535
|
reader.onload = function () {
|
|
1531
1536
|
var _a;
|
|
1532
1537
|
resolve(((_a = this.result) === null || _a === void 0 ? void 0 : _a.toString()) || '');
|
|
@@ -1535,8 +1540,9 @@ class Utils {
|
|
|
1535
1540
|
});
|
|
1536
1541
|
}
|
|
1537
1542
|
/**
|
|
1538
|
-
* Detect file extension by its content
|
|
1539
|
-
*
|
|
1543
|
+
* Detect a file extension by its content
|
|
1544
|
+
*
|
|
1545
|
+
* @returns The detected extension, like 'jpg'
|
|
1540
1546
|
*/
|
|
1541
1547
|
static detectMimeType(
|
|
1542
1548
|
/** Base64 encoded binary file */
|
|
@@ -1550,12 +1556,8 @@ class Utils {
|
|
|
1550
1556
|
static isStableRepository(
|
|
1551
1557
|
/** current configured repository or multi repository */
|
|
1552
1558
|
activeRepo) {
|
|
1553
|
-
return !!((typeof activeRepo === 'string' &&
|
|
1554
|
-
activeRepo.toLowerCase().startsWith('stable'))
|
|
1555
|
-
||
|
|
1556
|
-
(activeRepo &&
|
|
1557
|
-
typeof activeRepo !== 'string' &&
|
|
1558
|
-
activeRepo.find(r => r.toLowerCase().startsWith('stable'))));
|
|
1559
|
+
return !!((typeof activeRepo === 'string' && activeRepo.toLowerCase().startsWith('stable')) ||
|
|
1560
|
+
(activeRepo && typeof activeRepo !== 'string' && activeRepo.find(r => r.toLowerCase().startsWith('stable'))));
|
|
1559
1561
|
}
|
|
1560
1562
|
/**
|
|
1561
1563
|
* Check if a given string is an integer
|
|
@@ -1570,7 +1572,6 @@ class Utils {
|
|
|
1570
1572
|
* Check if the date is valid
|
|
1571
1573
|
*/
|
|
1572
1574
|
static isValidDate(date) {
|
|
1573
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1574
1575
|
return date instanceof Date && !isNaN(date);
|
|
1575
1576
|
}
|
|
1576
1577
|
static getStyle(theme, ...args) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
declare
|
|
1
|
+
import { type JSXElementConstructor, type JSX } from 'react';
|
|
2
|
+
declare function withWidth(): (WrappedComponent: JSXElementConstructor<any>) => (props: Record<string, any>) => JSX.Element;
|
|
3
3
|
export default withWidth;
|
package/Components/withWidth.js
CHANGED
|
@@ -9,15 +9,19 @@ const material_1 = require("@mui/material");
|
|
|
9
9
|
function useWidth() {
|
|
10
10
|
const theme = (0, styles_1.useTheme)();
|
|
11
11
|
const keys = [...theme.breakpoints.keys].reverse();
|
|
12
|
-
return keys.reduce((output, key) => {
|
|
12
|
+
return (keys.reduce((output, key) => {
|
|
13
13
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
14
14
|
const matches = (0, material_1.useMediaQuery)(theme.breakpoints.up(key));
|
|
15
15
|
return !output && matches ? key : output;
|
|
16
|
-
}, null) || 'xs';
|
|
16
|
+
}, null) || 'xs');
|
|
17
17
|
}
|
|
18
18
|
// FIXME checkout https://mui.com/components/use-media-query/#migrating-from-withwidth
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
function withWidth() {
|
|
20
|
+
return (WrappedComponent) => {
|
|
21
|
+
return function AnyComponent(props) {
|
|
22
|
+
const width = useWidth();
|
|
23
|
+
return (react_1.default.createElement(WrappedComponent, Object.assign({}, props, { width: width })));
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
23
27
|
exports.default = withWidth;
|
package/Dialogs/ComplexCron.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react';
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
2
|
interface DialogCronProps {
|
|
3
3
|
onClose: () => void;
|
|
4
4
|
onOk: (cron: string | false) => void;
|
|
@@ -17,6 +17,6 @@ declare class DialogComplexCron extends React.Component<DialogCronProps, DialogC
|
|
|
17
17
|
handleCancel(): void;
|
|
18
18
|
handleOk(): void;
|
|
19
19
|
handleClear(): void;
|
|
20
|
-
render():
|
|
20
|
+
render(): JSX.Element;
|
|
21
21
|
}
|
|
22
22
|
export default DialogComplexCron;
|
package/Dialogs/ComplexCron.js
CHANGED
|
@@ -50,14 +50,14 @@ class DialogComplexCron extends react_1.default.Component {
|
|
|
50
50
|
this.props.onClose();
|
|
51
51
|
}
|
|
52
52
|
render() {
|
|
53
|
-
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
53
|
+
return (react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
54
54
|
react_1.default.createElement(material_1.DialogTitle, { id: "cron-dialog-title" }, this.props.title || i18n_1.default.t('ra_Define schedule...')),
|
|
55
55
|
react_1.default.createElement(material_1.DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
56
56
|
react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
57
57
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
58
|
-
!!this.props.clearButton && react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.handleClear(), startIcon: react_1.default.createElement(icons_material_1.Delete, null) }, this.props.clear || i18n_1.default.t('ra_Clear')),
|
|
58
|
+
!!this.props.clearButton && (react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.handleClear(), startIcon: react_1.default.createElement(icons_material_1.Delete, null) }, this.props.clear || i18n_1.default.t('ra_Clear'))),
|
|
59
59
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
60
|
-
react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.handleCancel(), startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
60
|
+
react_1.default.createElement(material_1.Button, { color: "grey", variant: "contained", onClick: () => this.handleCancel(), startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel')))));
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
exports.default = DialogComplexCron;
|
package/Dialogs/Confirm.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright 2019-
|
|
2
|
+
* Copyright 2019-2024 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
|
-
|
|
7
|
-
import React, { Component } from 'react';
|
|
6
|
+
*/
|
|
7
|
+
import React, { Component, type JSX } from 'react';
|
|
8
8
|
interface DialogConfirmProps {
|
|
9
9
|
/** The dialog title; default: Are you sure? (translated) */
|
|
10
10
|
title?: string;
|
|
@@ -34,6 +34,6 @@ declare class DialogConfirm extends Component<DialogConfirmProps, DialogConfirmS
|
|
|
34
34
|
constructor(props: DialogConfirmProps);
|
|
35
35
|
handleOk(): void;
|
|
36
36
|
handleCancel(): void;
|
|
37
|
-
render():
|
|
37
|
+
render(): JSX.Element | null;
|
|
38
38
|
}
|
|
39
39
|
export default DialogConfirm;
|
package/Dialogs/Confirm.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright 2019-
|
|
3
|
+
* Copyright 2019-2024 Denis Haev (bluefox) <dogafox@gmail.com>
|
|
4
4
|
*
|
|
5
5
|
* MIT License
|
|
6
6
|
*
|
|
7
|
-
|
|
7
|
+
*/
|
|
8
8
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
9
|
if (k2 === undefined) k2 = k;
|
|
10
10
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -54,7 +54,9 @@ class DialogConfirm extends react_1.Component {
|
|
|
54
54
|
}
|
|
55
55
|
let suppress = false;
|
|
56
56
|
if (this.props.suppressQuestionMinutes) {
|
|
57
|
-
suppress =
|
|
57
|
+
suppress =
|
|
58
|
+
parseInt((window._localStorage || window.localStorage).getItem(this.props.dialogName), 10) ||
|
|
59
|
+
0;
|
|
58
60
|
if (!suppress) {
|
|
59
61
|
suppress = false;
|
|
60
62
|
}
|
|
@@ -71,17 +73,21 @@ class DialogConfirm extends react_1.Component {
|
|
|
71
73
|
if (this.state.suppress) {
|
|
72
74
|
(window._localStorage || window.localStorage).setItem(this.props.dialogName, Date.now() + (this.props.suppressQuestionMinutes || 2) * 60000);
|
|
73
75
|
}
|
|
74
|
-
|
|
76
|
+
if (this.props.onClose) {
|
|
77
|
+
this.props.onClose(true);
|
|
78
|
+
}
|
|
75
79
|
}
|
|
76
80
|
handleCancel() {
|
|
77
|
-
|
|
81
|
+
if (this.props.onClose) {
|
|
82
|
+
this.props.onClose(false);
|
|
83
|
+
}
|
|
78
84
|
}
|
|
79
85
|
render() {
|
|
80
86
|
if (typeof this.state.suppress === 'number') {
|
|
81
87
|
setTimeout(() => this.props.onClose && this.props.onClose(true), 100);
|
|
82
88
|
return null;
|
|
83
89
|
}
|
|
84
|
-
return react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "md", fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true, onClose: (event, reason) => {
|
|
90
|
+
return (react_1.default.createElement(material_1.Dialog, { open: !0, maxWidth: "md", fullWidth: this.props.fullWidth !== undefined ? this.props.fullWidth : true, onClose: (event, reason) => {
|
|
85
91
|
if (reason !== 'backdropClick' && reason !== 'escapeKeyDown') {
|
|
86
92
|
this.handleCancel();
|
|
87
93
|
}
|
|
@@ -92,10 +98,14 @@ class DialogConfirm extends react_1.Component {
|
|
|
92
98
|
this.props.icon || null,
|
|
93
99
|
this.props.text,
|
|
94
100
|
this.props.suppressQuestionMinutes ? react_1.default.createElement("br", null) : null,
|
|
95
|
-
this.props.suppressQuestionMinutes ? react_1.default.createElement(material_1.FormControlLabel, { sx: {
|
|
101
|
+
this.props.suppressQuestionMinutes ? (react_1.default.createElement(material_1.FormControlLabel, { sx: {
|
|
102
|
+
'& .FormControlLabel-label': styles.suppress,
|
|
103
|
+
'&.FormControlLabel-root': styles.suppressRoot,
|
|
104
|
+
}, control: react_1.default.createElement(material_1.Checkbox, { id: `ar_dialog_confirm_suppress_${this.props.dialogName || ''}`, checked: !!this.state.suppress, onChange: () => this.setState({ suppress: !this.state.suppress }) }), label: this.props.suppressText ||
|
|
105
|
+
i18n_1.default.t('ra_Suppress question for next %s minutes', (this.props.suppressQuestionMinutes || 2).toString()) })) : null)),
|
|
96
106
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
97
107
|
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_ok_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleOk(), color: "primary", autoFocus: true, startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
98
|
-
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_cancel_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleCancel(), color: "grey", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
108
|
+
react_1.default.createElement(material_1.Button, { id: `ar_dialog_confirm_cancel_${this.props.dialogName || ''}`, variant: "contained", onClick: () => this.handleCancel(), color: "grey", startIcon: react_1.default.createElement(icons_material_1.Close, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel')))));
|
|
99
109
|
}
|
|
100
110
|
}
|
|
101
111
|
exports.default = DialogConfirm;
|
package/Dialogs/Cron.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { IobTheme } from '../types';
|
|
1
|
+
import React, { type JSX } from 'react';
|
|
2
|
+
import type { IobTheme } from '../types';
|
|
3
3
|
interface DialogCronProps {
|
|
4
4
|
onClose: () => void;
|
|
5
5
|
onOk: (cron: string) => void;
|
|
@@ -24,6 +24,6 @@ declare class DialogCron extends React.Component<DialogCronProps, DialogCronStat
|
|
|
24
24
|
handleCancel(): void;
|
|
25
25
|
handleOk(): void;
|
|
26
26
|
setMode(mode: 'simple' | 'complex' | 'wizard'): void;
|
|
27
|
-
render():
|
|
27
|
+
render(): JSX.Element;
|
|
28
28
|
}
|
|
29
29
|
export default DialogCron;
|
package/Dialogs/Cron.js
CHANGED
|
@@ -54,11 +54,15 @@ class DialogCron extends react_1.default.Component {
|
|
|
54
54
|
}
|
|
55
55
|
this.state = {
|
|
56
56
|
cron,
|
|
57
|
-
mode: this.props.simple
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
57
|
+
mode: this.props.simple
|
|
58
|
+
? 'simple'
|
|
59
|
+
: this.props.complex
|
|
60
|
+
? 'complex'
|
|
61
|
+
: (typeof cron === 'object' || cron[0] === '{') && !this.props.noWizard
|
|
62
|
+
? 'wizard'
|
|
63
|
+
: (0, SimpleCron_1.cron2state)(this.props.cron || '* * * * *')
|
|
64
|
+
? 'simple'
|
|
65
|
+
: 'complex',
|
|
62
66
|
};
|
|
63
67
|
}
|
|
64
68
|
handleCancel() {
|
|
@@ -72,25 +76,25 @@ class DialogCron extends react_1.default.Component {
|
|
|
72
76
|
this.setState({ mode });
|
|
73
77
|
}
|
|
74
78
|
render() {
|
|
75
|
-
return react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
79
|
+
return (react_1.default.createElement(material_1.Dialog, { onClose: () => { }, maxWidth: "md", fullWidth: true, sx: { '& .MuiDialog-paper': styles.dialogPaper }, open: !0, "aria-labelledby": "cron-dialog-title" },
|
|
76
80
|
react_1.default.createElement(material_1.DialogTitle, { id: "cron-dialog-title" }, this.props.title || i18n_1.default.t('ra_Define schedule...')),
|
|
77
81
|
react_1.default.createElement(material_1.DialogContent, { style: { height: '100%', overflow: 'hidden' } },
|
|
78
|
-
(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? react_1.default.createElement("div", null,
|
|
79
|
-
!this.props.simple && !this.props.complex && !this.props.noWizard && react_1.default.createElement(react_1.default.Fragment, null,
|
|
82
|
+
(this.props.simple && this.props.complex) || (!this.props.simple && !this.props.complex) ? (react_1.default.createElement("div", null,
|
|
83
|
+
!this.props.simple && !this.props.complex && !this.props.noWizard && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
80
84
|
react_1.default.createElement(material_1.Radio, { key: "wizard", checked: this.state.mode === 'wizard', onChange: () => this.setMode('wizard') }),
|
|
81
|
-
react_1.default.createElement("label", { onClick: () => this.setMode('wizard'), style: this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_wizard'))),
|
|
82
|
-
((!this.props.simple && !this.props.complex) || this.props.simple) && react_1.default.createElement(react_1.default.Fragment, null,
|
|
85
|
+
react_1.default.createElement("label", { onClick: () => this.setMode('wizard'), style: this.state.mode !== 'wizard' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_wizard')))),
|
|
86
|
+
((!this.props.simple && !this.props.complex) || this.props.simple) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
83
87
|
react_1.default.createElement(material_1.Radio, { key: "simple", checked: this.state.mode === 'simple', onChange: () => this.setMode('simple') }),
|
|
84
|
-
react_1.default.createElement("label", { onClick: () => this.setMode('simple'), style: this.state.mode !== 'simple' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_simple'))),
|
|
85
|
-
((!this.props.simple && !this.props.complex) || this.props.complex) && react_1.default.createElement(react_1.default.Fragment, null,
|
|
88
|
+
react_1.default.createElement("label", { onClick: () => this.setMode('simple'), style: this.state.mode !== 'simple' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_simple')))),
|
|
89
|
+
((!this.props.simple && !this.props.complex) || this.props.complex) && (react_1.default.createElement(react_1.default.Fragment, null,
|
|
86
90
|
react_1.default.createElement(material_1.Radio, { key: "complex", checked: this.state.mode === 'complex', onChange: () => this.setMode('complex') }),
|
|
87
|
-
react_1.default.createElement("label", { onClick: () => this.setMode('complex'), style: this.state.mode !== 'complex' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_cron')))) : null,
|
|
88
|
-
this.state.mode === 'simple' && react_1.default.createElement(SimpleCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() }),
|
|
89
|
-
this.state.mode === 'wizard' && react_1.default.createElement(Schedule_1.default, { theme: this.props.theme, schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) }),
|
|
90
|
-
this.state.mode === 'complex' && react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
91
|
+
react_1.default.createElement("label", { onClick: () => this.setMode('complex'), style: this.state.mode !== 'complex' ? { color: 'lightgrey' } : {} }, i18n_1.default.t('sc_cron')))))) : null,
|
|
92
|
+
this.state.mode === 'simple' && (react_1.default.createElement(SimpleCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() })),
|
|
93
|
+
this.state.mode === 'wizard' && (react_1.default.createElement(Schedule_1.default, { theme: this.props.theme, schedule: this.state.cron, onChange: (cron) => this.setState({ cron }) })),
|
|
94
|
+
this.state.mode === 'complex' && (react_1.default.createElement(ComplexCron_1.default, { cronExpression: this.state.cron, onChange: cron => this.setState({ cron }), language: i18n_1.default.getLanguage() }))),
|
|
91
95
|
react_1.default.createElement(material_1.DialogActions, null,
|
|
92
96
|
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleOk(), color: "primary", startIcon: react_1.default.createElement(icons_material_1.Check, null) }, this.props.ok || i18n_1.default.t('ra_Ok')),
|
|
93
|
-
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleCancel(), color: "grey", startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel'))));
|
|
97
|
+
react_1.default.createElement(material_1.Button, { variant: "contained", onClick: () => this.handleCancel(), color: "grey", startIcon: react_1.default.createElement(icons_material_1.Cancel, null) }, this.props.cancel || i18n_1.default.t('ra_Cancel')))));
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
exports.default = DialogCron;
|
package/Dialogs/Error.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
|
-
|
|
7
|
-
import React, { Component } from 'react';
|
|
6
|
+
*/
|
|
7
|
+
import React, { Component, type JSX } from 'react';
|
|
8
8
|
interface DialogErrorProps {
|
|
9
9
|
title?: string;
|
|
10
10
|
text: string | React.JSX.Element;
|
|
@@ -13,6 +13,6 @@ interface DialogErrorProps {
|
|
|
13
13
|
}
|
|
14
14
|
declare class DialogError extends Component<DialogErrorProps> {
|
|
15
15
|
handleOk(): void;
|
|
16
|
-
render():
|
|
16
|
+
render(): JSX.Element;
|
|
17
17
|
}
|
|
18
18
|
export default DialogError;
|