@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/src/Components/Utils.tsx
CHANGED
|
@@ -3,15 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* MIT License
|
|
5
5
|
*
|
|
6
|
-
|
|
6
|
+
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import copy from './CopyToClipboard';
|
|
9
9
|
import I18n from '../i18n';
|
|
10
|
-
import { IobTheme, ThemeName, ThemeType } from '../types';
|
|
10
|
+
import type { IobTheme, ThemeName, ThemeType } from '../types';
|
|
11
11
|
|
|
12
|
-
const NAMESPACE
|
|
13
|
-
const days
|
|
14
|
-
const months
|
|
12
|
+
const NAMESPACE = 'material';
|
|
13
|
+
const days = ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'];
|
|
14
|
+
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
|
|
15
15
|
const QUALITY_BITS: Record<ioBroker.STATE_QUALITY[keyof ioBroker.STATE_QUALITY], string> = {
|
|
16
16
|
0x00: '0x00 - good',
|
|
17
17
|
|
|
@@ -45,18 +45,18 @@ const SIGNATURES: Record<string, string> = {
|
|
|
45
45
|
AAABAA: 'ico', // 00 00 01 00 according to https://en.wikipedia.org/wiki/List_of_file_signatures
|
|
46
46
|
};
|
|
47
47
|
|
|
48
|
-
type SmartName =
|
|
48
|
+
type SmartName =
|
|
49
|
+
| null
|
|
49
50
|
| false
|
|
50
51
|
| string
|
|
51
52
|
| ({ [lang in ioBroker.Languages]?: string } & {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
});
|
|
53
|
+
/** Which kind of device it is */
|
|
54
|
+
smartType?: string | null;
|
|
55
|
+
/** Which value to set when the ON command is issued */
|
|
56
|
+
byON?: string | null;
|
|
57
|
+
});
|
|
57
58
|
|
|
58
59
|
type ClassDictionary = Record<string, any>;
|
|
59
|
-
// eslint-disable-next-line no-use-before-define
|
|
60
60
|
type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
|
|
61
61
|
type ClassArray = ClassValue[];
|
|
62
62
|
|
|
@@ -138,14 +138,14 @@ class Utils {
|
|
|
138
138
|
if (typeof textObj === 'object') {
|
|
139
139
|
text = (options.language && textObj[options.language]) || textObj.en;
|
|
140
140
|
} else {
|
|
141
|
-
text = textObj
|
|
141
|
+
text = textObj;
|
|
142
142
|
}
|
|
143
143
|
} else if (isDesc && item?.common?.desc) {
|
|
144
144
|
const textObj = item.common.desc;
|
|
145
145
|
if (typeof textObj === 'object') {
|
|
146
146
|
text = (options.language && textObj[options.language]) || textObj.en || textObj.de || textObj.ru || '';
|
|
147
147
|
} else {
|
|
148
|
-
text = textObj
|
|
148
|
+
text = textObj;
|
|
149
149
|
}
|
|
150
150
|
text = (text || '').toString().replace(/[_.]/g, ' ');
|
|
151
151
|
|
|
@@ -299,11 +299,7 @@ class Utils {
|
|
|
299
299
|
/**
|
|
300
300
|
* Reorder the array items in list between source and dest.
|
|
301
301
|
*/
|
|
302
|
-
static reorder(
|
|
303
|
-
list: Iterable<any> | ArrayLike<any>,
|
|
304
|
-
source: number,
|
|
305
|
-
dest: number,
|
|
306
|
-
): Iterable<any> | ArrayLike<any> {
|
|
302
|
+
static reorder(list: Iterable<any> | ArrayLike<any>, source: number, dest: number): Iterable<any> | ArrayLike<any> {
|
|
307
303
|
const result = Array.from(list);
|
|
308
304
|
const [removed] = result.splice(source, 1);
|
|
309
305
|
result.splice(dest, 0, removed);
|
|
@@ -324,7 +320,13 @@ class Utils {
|
|
|
324
320
|
language?: ioBroker.Languages;
|
|
325
321
|
},
|
|
326
322
|
defaultEnabling?: boolean,
|
|
327
|
-
) {
|
|
323
|
+
): {
|
|
324
|
+
name: string;
|
|
325
|
+
enabled?: boolean;
|
|
326
|
+
useCustom?: boolean;
|
|
327
|
+
icon?: string;
|
|
328
|
+
color?: string;
|
|
329
|
+
} {
|
|
328
330
|
let settings;
|
|
329
331
|
const id = (obj as ioBroker.StateObject)?._id || options?.id;
|
|
330
332
|
let common: ioBroker.StateCommon | undefined;
|
|
@@ -442,10 +444,22 @@ class Utils {
|
|
|
442
444
|
return <span style={style || {}}>{settings.icon}</span>;
|
|
443
445
|
}
|
|
444
446
|
if (settings.icon.startsWith('data:image')) {
|
|
445
|
-
return
|
|
447
|
+
return (
|
|
448
|
+
<img
|
|
449
|
+
alt={settings.name}
|
|
450
|
+
src={settings.icon}
|
|
451
|
+
style={style || {}}
|
|
452
|
+
/>
|
|
453
|
+
);
|
|
446
454
|
}
|
|
447
455
|
// maybe later some changes for a second type
|
|
448
|
-
return
|
|
456
|
+
return (
|
|
457
|
+
<img
|
|
458
|
+
alt={settings.name}
|
|
459
|
+
src={(settings.prefix || '') + settings.icon}
|
|
460
|
+
style={style}
|
|
461
|
+
/>
|
|
462
|
+
);
|
|
449
463
|
}
|
|
450
464
|
return null;
|
|
451
465
|
}
|
|
@@ -456,7 +470,7 @@ class Utils {
|
|
|
456
470
|
static getObjectIcon(id: string | ioBroker.PartialObject, obj?: ioBroker.PartialObject): string | null {
|
|
457
471
|
// If id is Object
|
|
458
472
|
if (typeof id === 'object') {
|
|
459
|
-
obj = id
|
|
473
|
+
obj = id;
|
|
460
474
|
id = obj?._id as string;
|
|
461
475
|
}
|
|
462
476
|
|
|
@@ -581,7 +595,9 @@ class Utils {
|
|
|
581
595
|
return '--:--';
|
|
582
596
|
}
|
|
583
597
|
const hours = Math.floor(seconds / 3600);
|
|
584
|
-
const minutes = Math.floor((seconds % 3600) / 60)
|
|
598
|
+
const minutes = Math.floor((seconds % 3600) / 60)
|
|
599
|
+
.toString()
|
|
600
|
+
.padStart(2, '0');
|
|
585
601
|
const secs = (seconds % 60).toString().padStart(2, '0');
|
|
586
602
|
if (hours) {
|
|
587
603
|
return `${hours}:${minutes}:${secs}`;
|
|
@@ -756,16 +772,18 @@ class Utils {
|
|
|
756
772
|
const rel = m[0].match(/rel="([^"]+)"/) || m[0].match(/rel='([^']+)'/);
|
|
757
773
|
const title = m[0].match(/>([^<]*)</);
|
|
758
774
|
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
775
|
+
result.push(
|
|
776
|
+
// eslint-disable-next-line react/jsx-no-target-blank
|
|
777
|
+
<a
|
|
778
|
+
key={`a${key++}`}
|
|
779
|
+
href={href ? href[1] : ''}
|
|
780
|
+
target={target ? target[1] : '_blank'}
|
|
781
|
+
rel={rel ? rel[1] : 'noreferrer'}
|
|
782
|
+
style={{ color: 'inherit' }}
|
|
783
|
+
>
|
|
784
|
+
{title ? title[1] : ''}
|
|
785
|
+
</a>,
|
|
786
|
+
);
|
|
769
787
|
}
|
|
770
788
|
|
|
771
789
|
m = text ? text.match(/<a [^<]+<\/a>|<br\/?>|<b>[^<]+<\/b>|<i>[^<]+<\/i>/) : null;
|
|
@@ -803,16 +821,18 @@ class Utils {
|
|
|
803
821
|
return (states as ioBroker.StateCommon).smartName;
|
|
804
822
|
}
|
|
805
823
|
const obj = states as ioBroker.StateObject;
|
|
806
|
-
return obj?.common?.custom && obj.common.custom[instanceId]
|
|
807
|
-
obj.common.custom[instanceId].smartName
|
|
824
|
+
return obj?.common?.custom && obj.common.custom[instanceId]
|
|
825
|
+
? obj.common.custom[instanceId].smartName
|
|
826
|
+
: undefined;
|
|
808
827
|
}
|
|
809
828
|
if (!noCommon) {
|
|
810
829
|
return (states as Record<string, ioBroker.StateObject>)[id].common.smartName;
|
|
811
830
|
}
|
|
812
831
|
const obj = (states as Record<string, ioBroker.StateObject>)[id];
|
|
813
832
|
|
|
814
|
-
return obj?.common?.custom && obj.common.custom[instanceId]
|
|
815
|
-
obj.common.custom[instanceId].smartName || null
|
|
833
|
+
return obj?.common?.custom && obj.common.custom[instanceId]
|
|
834
|
+
? obj.common.custom[instanceId].smartName || null
|
|
835
|
+
: null;
|
|
816
836
|
}
|
|
817
837
|
|
|
818
838
|
/**
|
|
@@ -837,7 +857,9 @@ class Utils {
|
|
|
837
857
|
return (obj as ioBroker.StateCommon).smartName;
|
|
838
858
|
}
|
|
839
859
|
|
|
840
|
-
const custom: Record<string, string> | undefined | null = (obj as ioBroker.StateObject)?.common?.custom?.[
|
|
860
|
+
const custom: Record<string, string> | undefined | null = (obj as ioBroker.StateObject)?.common?.custom?.[
|
|
861
|
+
instanceId
|
|
862
|
+
];
|
|
841
863
|
|
|
842
864
|
return custom ? custom.smartName : undefined;
|
|
843
865
|
}
|
|
@@ -845,11 +867,7 @@ class Utils {
|
|
|
845
867
|
/**
|
|
846
868
|
* Enable smart name for a state.
|
|
847
869
|
*/
|
|
848
|
-
static enableSmartName(
|
|
849
|
-
obj: ioBroker.StateObject,
|
|
850
|
-
instanceId: string,
|
|
851
|
-
noCommon?: boolean,
|
|
852
|
-
): void {
|
|
870
|
+
static enableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void {
|
|
853
871
|
if (noCommon) {
|
|
854
872
|
obj.common.custom = obj.common.custom || {};
|
|
855
873
|
obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
|
|
@@ -862,11 +880,7 @@ class Utils {
|
|
|
862
880
|
/**
|
|
863
881
|
* Completely remove smart name from a state.
|
|
864
882
|
*/
|
|
865
|
-
static removeSmartName(
|
|
866
|
-
obj: ioBroker.StateObject,
|
|
867
|
-
instanceId: string,
|
|
868
|
-
noCommon?: boolean,
|
|
869
|
-
) {
|
|
883
|
+
static removeSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void {
|
|
870
884
|
if (noCommon) {
|
|
871
885
|
if (obj.common && obj.common.custom && obj.common.custom[instanceId]) {
|
|
872
886
|
obj.common.custom[instanceId] = null;
|
|
@@ -886,7 +900,7 @@ class Utils {
|
|
|
886
900
|
smartType: string | null,
|
|
887
901
|
instanceId: string,
|
|
888
902
|
noCommon?: boolean,
|
|
889
|
-
) {
|
|
903
|
+
): void {
|
|
890
904
|
const language = I18n.getLanguage();
|
|
891
905
|
|
|
892
906
|
// convert the old format
|
|
@@ -903,8 +917,8 @@ class Utils {
|
|
|
903
917
|
|
|
904
918
|
if (_smartName && typeof _smartName !== 'object') {
|
|
905
919
|
_smartName = {
|
|
906
|
-
en: _smartName
|
|
907
|
-
[language]: _smartName
|
|
920
|
+
en: _smartName,
|
|
921
|
+
[language]: _smartName,
|
|
908
922
|
};
|
|
909
923
|
}
|
|
910
924
|
obj.common.smartName = _smartName;
|
|
@@ -993,7 +1007,9 @@ class Utils {
|
|
|
993
1007
|
}
|
|
994
1008
|
// @ts-expect-error fixed in js-controller
|
|
995
1009
|
} else if (obj.common.smartName && (obj.common.smartName as SmartName).byON !== undefined) {
|
|
996
|
-
const _smartName: { [lang in ioBroker.Languages]?: string } = obj.common.smartName as {
|
|
1010
|
+
const _smartName: { [lang in ioBroker.Languages]?: string } = obj.common.smartName as {
|
|
1011
|
+
[lang in ioBroker.Languages]?: string;
|
|
1012
|
+
};
|
|
997
1013
|
delete _smartName.en;
|
|
998
1014
|
delete _smartName.de;
|
|
999
1015
|
delete _smartName.ru;
|
|
@@ -1016,11 +1032,7 @@ class Utils {
|
|
|
1016
1032
|
/**
|
|
1017
1033
|
* Disable the smart name of a state.
|
|
1018
1034
|
*/
|
|
1019
|
-
static disableSmartName(
|
|
1020
|
-
obj: ioBroker.StateObject,
|
|
1021
|
-
instanceId: string,
|
|
1022
|
-
noCommon?: boolean,
|
|
1023
|
-
): void {
|
|
1035
|
+
static disableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void {
|
|
1024
1036
|
if (noCommon) {
|
|
1025
1037
|
obj.common.custom = obj.common.custom || {};
|
|
1026
1038
|
obj.common.custom[instanceId] = obj.common.custom[instanceId] || {};
|
|
@@ -1033,10 +1045,7 @@ class Utils {
|
|
|
1033
1045
|
/**
|
|
1034
1046
|
* Copy text to the clipboard.
|
|
1035
1047
|
*/
|
|
1036
|
-
static copyToClipboard(
|
|
1037
|
-
text: string,
|
|
1038
|
-
e?: Event,
|
|
1039
|
-
): boolean {
|
|
1048
|
+
static copyToClipboard(text: string, e?: Event): boolean {
|
|
1040
1049
|
if (e) {
|
|
1041
1050
|
e.stopPropagation();
|
|
1042
1051
|
e.preventDefault();
|
|
@@ -1046,6 +1055,7 @@ class Utils {
|
|
|
1046
1055
|
|
|
1047
1056
|
/**
|
|
1048
1057
|
* Gets the extension of a file name.
|
|
1058
|
+
*
|
|
1049
1059
|
* @param fileName the file name.
|
|
1050
1060
|
* @returns The extension in lower case.
|
|
1051
1061
|
*/
|
|
@@ -1060,12 +1070,11 @@ class Utils {
|
|
|
1060
1070
|
/**
|
|
1061
1071
|
* Format number of bytes as a string with B, KB, MB or GB.
|
|
1062
1072
|
* The base for all calculations is 1024.
|
|
1073
|
+
*
|
|
1074
|
+
* @param bytes The number of bytes.
|
|
1063
1075
|
* @returns The formatted string (e.g. '723.5 KB')
|
|
1064
1076
|
*/
|
|
1065
|
-
static formatBytes(
|
|
1066
|
-
/** The number of bytes. */
|
|
1067
|
-
bytes: number,
|
|
1068
|
-
): string {
|
|
1077
|
+
static formatBytes(bytes: number): string {
|
|
1069
1078
|
if (Math.abs(bytes) < 1024) {
|
|
1070
1079
|
return `${bytes} B`;
|
|
1071
1080
|
}
|
|
@@ -1084,14 +1093,12 @@ class Utils {
|
|
|
1084
1093
|
|
|
1085
1094
|
/**
|
|
1086
1095
|
* Invert the given color according to a theme type to get the inverted text color for background
|
|
1096
|
+
*
|
|
1097
|
+
* @param color Color in the format '#rrggbb' or '#rgb' (or without a hash)
|
|
1098
|
+
* @param themeType 'light' or 'dark'
|
|
1099
|
+
* @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
|
|
1087
1100
|
*/
|
|
1088
|
-
static getInvertedColor(
|
|
1089
|
-
/** Color in the format '#rrggbb' or '#rgb' (or without a hash) */
|
|
1090
|
-
color: string,
|
|
1091
|
-
themeType: ThemeType,
|
|
1092
|
-
/** dark theme has light color in control, or light theme has light color in control */
|
|
1093
|
-
invert?: boolean,
|
|
1094
|
-
): string | undefined {
|
|
1101
|
+
static getInvertedColor(color: string, themeType: ThemeType, invert?: boolean): string | undefined {
|
|
1095
1102
|
if (!color) {
|
|
1096
1103
|
return undefined;
|
|
1097
1104
|
}
|
|
@@ -1109,7 +1116,8 @@ class Utils {
|
|
|
1109
1116
|
// Big thanks to: https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
|
|
1110
1117
|
/**
|
|
1111
1118
|
* Invert the given color
|
|
1112
|
-
*
|
|
1119
|
+
*
|
|
1120
|
+
* @param hex Color in the format '#rrggbb' or '#rgb' (or without a hash)
|
|
1113
1121
|
* @param bw Set to black or white.
|
|
1114
1122
|
*/
|
|
1115
1123
|
static invertColor(hex: string, bw?: boolean): string {
|
|
@@ -1153,9 +1161,7 @@ class Utils {
|
|
|
1153
1161
|
|
|
1154
1162
|
if (bw) {
|
|
1155
1163
|
// http://stackoverflow.com/a/3943023/112731
|
|
1156
|
-
return r * 0.299 + g * 0.587 + b * 0.114 > 186
|
|
1157
|
-
? `#000000${alfa || ''}`
|
|
1158
|
-
: `#FFFFFF${alfa || ''}`;
|
|
1164
|
+
return r * 0.299 + g * 0.587 + b * 0.114 > 186 ? `#000000${alfa || ''}` : `#FFFFFF${alfa || ''}`;
|
|
1159
1165
|
}
|
|
1160
1166
|
// invert color components
|
|
1161
1167
|
const rs = (255 - r).toString(16);
|
|
@@ -1167,6 +1173,7 @@ class Utils {
|
|
|
1167
1173
|
|
|
1168
1174
|
/**
|
|
1169
1175
|
* Convert RGB to array [r, g, b]
|
|
1176
|
+
*
|
|
1170
1177
|
* @param hex Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
1171
1178
|
* @returns Array with 3 elements [r, g, b]
|
|
1172
1179
|
*/
|
|
@@ -1202,18 +1209,15 @@ class Utils {
|
|
|
1202
1209
|
return false;
|
|
1203
1210
|
}
|
|
1204
1211
|
|
|
1205
|
-
return [
|
|
1206
|
-
parseInt(hex.slice(0, 2), 16),
|
|
1207
|
-
parseInt(hex.slice(2, 4), 16),
|
|
1208
|
-
parseInt(hex.slice(4, 6), 16),
|
|
1209
|
-
];
|
|
1212
|
+
return [parseInt(hex.slice(0, 2), 16), parseInt(hex.slice(2, 4), 16), parseInt(hex.slice(4, 6), 16)];
|
|
1210
1213
|
}
|
|
1211
1214
|
|
|
1212
1215
|
// Big thanks to: https://github.com/antimatter15/rgb-lab
|
|
1213
1216
|
/**
|
|
1214
1217
|
* Convert RGB to LAB
|
|
1215
|
-
*
|
|
1216
|
-
* @
|
|
1218
|
+
*
|
|
1219
|
+
* @param rgb color in format [r,g,b]
|
|
1220
|
+
* @returns lab color in format [l,a,b]
|
|
1217
1221
|
*/
|
|
1218
1222
|
static rgb2lab(rgb: [number, number, number]): [number, number, number] {
|
|
1219
1223
|
let r = rgb[0] / 255;
|
|
@@ -1237,7 +1241,8 @@ class Utils {
|
|
|
1237
1241
|
|
|
1238
1242
|
/**
|
|
1239
1243
|
* Calculate the distance between two colors in LAB color space in the range 0-100^2
|
|
1240
|
-
* If distance is less than 1000, the colors are similar
|
|
1244
|
+
* If the distance is less than 1000, the colors are similar
|
|
1245
|
+
*
|
|
1241
1246
|
* @param color1 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
1242
1247
|
* @param color2 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
1243
1248
|
* @returns distance in the range 0-100^2
|
|
@@ -1271,10 +1276,7 @@ class Utils {
|
|
|
1271
1276
|
// https://github.com/lukeed/clsx/blob/master/src/index.js
|
|
1272
1277
|
// License
|
|
1273
1278
|
// MIT © Luke Edwards
|
|
1274
|
-
|
|
1275
|
-
* @private
|
|
1276
|
-
*/
|
|
1277
|
-
static _toVal(mix: ClassValue): string {
|
|
1279
|
+
private static _toVal(mix: ClassValue): string {
|
|
1278
1280
|
let y;
|
|
1279
1281
|
let str = '';
|
|
1280
1282
|
|
|
@@ -1309,7 +1311,6 @@ class Utils {
|
|
|
1309
1311
|
// MIT © Luke Edwards
|
|
1310
1312
|
/**
|
|
1311
1313
|
* Convert any object to a string with its values.
|
|
1312
|
-
* @returns {string}
|
|
1313
1314
|
*/
|
|
1314
1315
|
static clsx(...inputs: ClassValue[]): string {
|
|
1315
1316
|
let i = 0;
|
|
@@ -1317,7 +1318,6 @@ class Utils {
|
|
|
1317
1318
|
let x;
|
|
1318
1319
|
let str = '';
|
|
1319
1320
|
while (i < inputs.length) {
|
|
1320
|
-
// eslint-disable-next-line prefer-rest-params
|
|
1321
1321
|
tmp = inputs[i++];
|
|
1322
1322
|
if (tmp) {
|
|
1323
1323
|
x = Utils._toVal(tmp);
|
|
@@ -1334,7 +1334,11 @@ class Utils {
|
|
|
1334
1334
|
* Get the current theme name (either from local storage or the browser settings).
|
|
1335
1335
|
*/
|
|
1336
1336
|
static getThemeName(themeName?: ThemeName | null): ThemeName {
|
|
1337
|
-
if (
|
|
1337
|
+
if (
|
|
1338
|
+
(window as any).vendorPrefix &&
|
|
1339
|
+
(window as any).vendorPrefix !== '@@vendorPrefix@@' &&
|
|
1340
|
+
(window as any).vendorPrefix !== 'MV'
|
|
1341
|
+
) {
|
|
1338
1342
|
return (window as any).vendorPrefix;
|
|
1339
1343
|
}
|
|
1340
1344
|
|
|
@@ -1374,13 +1378,19 @@ class Utils {
|
|
|
1374
1378
|
|
|
1375
1379
|
/**
|
|
1376
1380
|
* Toggle the theme name between 'dark' and 'colored'.
|
|
1381
|
+
*
|
|
1377
1382
|
* @returns the new theme name.
|
|
1378
1383
|
*/
|
|
1379
1384
|
static toggleTheme(themeName?: ThemeName | null): ThemeName {
|
|
1380
|
-
if (
|
|
1385
|
+
if (
|
|
1386
|
+
(window as any).vendorPrefix &&
|
|
1387
|
+
(window as any).vendorPrefix !== '@@vendorPrefix@@' &&
|
|
1388
|
+
(window as any).vendorPrefix !== 'MV'
|
|
1389
|
+
) {
|
|
1381
1390
|
return (window as any).vendorPrefix as ThemeName;
|
|
1382
1391
|
}
|
|
1383
|
-
themeName =
|
|
1392
|
+
themeName =
|
|
1393
|
+
themeName || ((window as any)._localStorage || window.localStorage).getItem('App.themeName') || 'light';
|
|
1384
1394
|
|
|
1385
1395
|
// dark => blue => colored => light => dark
|
|
1386
1396
|
const themes = Utils.getThemeNames();
|
|
@@ -1398,14 +1408,19 @@ class Utils {
|
|
|
1398
1408
|
|
|
1399
1409
|
/**
|
|
1400
1410
|
* Get the list of themes
|
|
1411
|
+
*
|
|
1401
1412
|
* @returns list of possible themes
|
|
1402
1413
|
*/
|
|
1403
1414
|
static getThemeNames(): ThemeName[] {
|
|
1404
|
-
if (
|
|
1415
|
+
if (
|
|
1416
|
+
(window as any).vendorPrefix &&
|
|
1417
|
+
(window as any).vendorPrefix !== '@@vendorPrefix@@' &&
|
|
1418
|
+
(window as any).vendorPrefix !== 'MV'
|
|
1419
|
+
) {
|
|
1405
1420
|
return [(window as any).vendorPrefix as ThemeName];
|
|
1406
1421
|
}
|
|
1407
1422
|
|
|
1408
|
-
return ['light', 'dark'
|
|
1423
|
+
return ['light', 'dark'];
|
|
1409
1424
|
}
|
|
1410
1425
|
|
|
1411
1426
|
/**
|
|
@@ -1443,6 +1458,7 @@ class Utils {
|
|
|
1443
1458
|
|
|
1444
1459
|
/**
|
|
1445
1460
|
* Returns parent ID.
|
|
1461
|
+
*
|
|
1446
1462
|
* @returns parent ID or null if no parent
|
|
1447
1463
|
*/
|
|
1448
1464
|
static getParentId(id: string): string | null {
|
|
@@ -1478,9 +1494,9 @@ class Utils {
|
|
|
1478
1494
|
return text;
|
|
1479
1495
|
}
|
|
1480
1496
|
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1497
|
+
/**
|
|
1498
|
+
* Format seconds to string like 'h:mm:ss' or 'd.hh:mm:ss'
|
|
1499
|
+
*/
|
|
1484
1500
|
static formatTime(seconds: number): string {
|
|
1485
1501
|
if (seconds) {
|
|
1486
1502
|
seconds = Math.round(seconds);
|
|
@@ -1513,8 +1529,8 @@ class Utils {
|
|
|
1513
1529
|
.toLowerCase();
|
|
1514
1530
|
}
|
|
1515
1531
|
|
|
1516
|
-
|
|
1517
|
-
|
|
1532
|
+
/**
|
|
1533
|
+
* Open url link in the new target window
|
|
1518
1534
|
*/
|
|
1519
1535
|
static openLink(url: string, target?: string): void {
|
|
1520
1536
|
// replace IPv6 Address with [ipv6]:port
|
|
@@ -1615,28 +1631,23 @@ class Utils {
|
|
|
1615
1631
|
|
|
1616
1632
|
/**
|
|
1617
1633
|
* Convert quality code into text
|
|
1634
|
+
*
|
|
1618
1635
|
* @returns lines that decode quality
|
|
1619
1636
|
*/
|
|
1620
1637
|
static quality2text(quality: ioBroker.STATE_QUALITY[keyof ioBroker.STATE_QUALITY]): string[] {
|
|
1621
|
-
|
|
1622
|
-
const custom = quality & 0xFFFF0000;
|
|
1638
|
+
const custom = quality & 0xffff0000;
|
|
1623
1639
|
const text: string = QUALITY_BITS[quality];
|
|
1624
1640
|
let result;
|
|
1625
1641
|
if (text) {
|
|
1626
1642
|
result = [text];
|
|
1627
|
-
// eslint-disable-next-line no-bitwise
|
|
1628
1643
|
} else if (quality & 0x01) {
|
|
1629
|
-
|
|
1630
|
-
result = [QUALITY_BITS[0x01], `0x${(quality & (0xFFFF & ~1)).toString(16)}`];
|
|
1631
|
-
// eslint-disable-next-line no-bitwise
|
|
1644
|
+
result = [QUALITY_BITS[0x01], `0x${(quality & (0xffff & ~1)).toString(16)}`];
|
|
1632
1645
|
} else if (quality & 0x02) {
|
|
1633
|
-
|
|
1634
|
-
result = [QUALITY_BITS[0x02], `0x${(quality & (0xFFFF & ~2)).toString(16)}`];
|
|
1646
|
+
result = [QUALITY_BITS[0x02], `0x${(quality & (0xffff & ~2)).toString(16)}`];
|
|
1635
1647
|
} else {
|
|
1636
1648
|
result = [`0x${quality.toString(16)}`];
|
|
1637
1649
|
}
|
|
1638
1650
|
if (custom) {
|
|
1639
|
-
// eslint-disable-next-line no-bitwise
|
|
1640
1651
|
result.push(`0x${(custom >> 16).toString(16).toUpperCase()}`);
|
|
1641
1652
|
}
|
|
1642
1653
|
return result;
|
|
@@ -1651,6 +1662,7 @@ class Utils {
|
|
|
1651
1662
|
|
|
1652
1663
|
/**
|
|
1653
1664
|
* Get states of object
|
|
1665
|
+
*
|
|
1654
1666
|
* @returns states as an object in form {"value1": "label1", "value2": "label2"} or null
|
|
1655
1667
|
*/
|
|
1656
1668
|
static getStates(obj: ioBroker.StateObject | null | undefined): Record<string, string> | null {
|
|
@@ -1660,7 +1672,7 @@ class Utils {
|
|
|
1660
1672
|
if (typeof states === 'string' && states[0] === '{') {
|
|
1661
1673
|
try {
|
|
1662
1674
|
result = JSON.parse(states) as Record<string, string>;
|
|
1663
|
-
} catch
|
|
1675
|
+
} catch {
|
|
1664
1676
|
console.error(`Cannot parse states: ${states}`);
|
|
1665
1677
|
result = null;
|
|
1666
1678
|
}
|
|
@@ -1683,7 +1695,7 @@ class Utils {
|
|
|
1683
1695
|
result.true = states[1];
|
|
1684
1696
|
}
|
|
1685
1697
|
} else if (typeof states === 'object') {
|
|
1686
|
-
result = states
|
|
1698
|
+
result = states;
|
|
1687
1699
|
}
|
|
1688
1700
|
}
|
|
1689
1701
|
|
|
@@ -1692,6 +1704,7 @@ class Utils {
|
|
|
1692
1704
|
|
|
1693
1705
|
/**
|
|
1694
1706
|
* Get svg file as text
|
|
1707
|
+
*
|
|
1695
1708
|
* @param url URL of SVG file
|
|
1696
1709
|
* @returns Promise with "data:image..."
|
|
1697
1710
|
*/
|
|
@@ -1700,7 +1713,6 @@ class Utils {
|
|
|
1700
1713
|
const blob = await response.blob();
|
|
1701
1714
|
return new Promise(resolve => {
|
|
1702
1715
|
const reader = new FileReader();
|
|
1703
|
-
// eslint-disable-next-line func-names
|
|
1704
1716
|
reader.onload = function () {
|
|
1705
1717
|
resolve(this.result?.toString() || '');
|
|
1706
1718
|
};
|
|
@@ -1709,8 +1721,9 @@ class Utils {
|
|
|
1709
1721
|
}
|
|
1710
1722
|
|
|
1711
1723
|
/**
|
|
1712
|
-
* Detect file extension by its content
|
|
1713
|
-
*
|
|
1724
|
+
* Detect a file extension by its content
|
|
1725
|
+
*
|
|
1726
|
+
* @returns The detected extension, like 'jpg'
|
|
1714
1727
|
*/
|
|
1715
1728
|
static detectMimeType(
|
|
1716
1729
|
/** Base64 encoded binary file */
|
|
@@ -1727,16 +1740,10 @@ class Utils {
|
|
|
1727
1740
|
/** current configured repository or multi repository */
|
|
1728
1741
|
activeRepo: string | string[],
|
|
1729
1742
|
): boolean {
|
|
1730
|
-
return !!(
|
|
1731
|
-
typeof activeRepo === 'string' &&
|
|
1732
|
-
activeRepo.toLowerCase().startsWith('stable')
|
|
1733
|
-
)
|
|
1734
|
-
||
|
|
1735
|
-
(
|
|
1736
|
-
activeRepo &&
|
|
1737
|
-
typeof activeRepo !== 'string' &&
|
|
1738
|
-
activeRepo.find(r => r.toLowerCase().startsWith('stable'))
|
|
1739
|
-
));
|
|
1743
|
+
return !!(
|
|
1744
|
+
(typeof activeRepo === 'string' && activeRepo.toLowerCase().startsWith('stable')) ||
|
|
1745
|
+
(activeRepo && typeof activeRepo !== 'string' && activeRepo.find(r => r.toLowerCase().startsWith('stable')))
|
|
1746
|
+
);
|
|
1740
1747
|
}
|
|
1741
1748
|
|
|
1742
1749
|
/**
|
|
@@ -1753,7 +1760,6 @@ class Utils {
|
|
|
1753
1760
|
* Check if the date is valid
|
|
1754
1761
|
*/
|
|
1755
1762
|
static isValidDate(date: any): boolean {
|
|
1756
|
-
// eslint-disable-next-line no-restricted-globals
|
|
1757
1763
|
return date instanceof Date && !isNaN(date as any as number);
|
|
1758
1764
|
}
|
|
1759
1765
|
|
|
@@ -1769,7 +1775,9 @@ class Utils {
|
|
|
1769
1775
|
} else if (args[a] && typeof args[a] === 'object') {
|
|
1770
1776
|
Object.keys(args[a] as Record<string, any>).forEach((attr: string) => {
|
|
1771
1777
|
if (typeof (args[a] as Record<string, any>)[attr] === 'function') {
|
|
1772
|
-
result[attr] = (
|
|
1778
|
+
result[attr] = (
|
|
1779
|
+
(args[a] as Record<string, any>)[attr] as (_theme: IobTheme) => Record<string, any>
|
|
1780
|
+
)(theme);
|
|
1773
1781
|
} else if (typeof (args[a] as Record<string, any>)[attr] === 'object') {
|
|
1774
1782
|
const obj = (args[a] as Record<string, any>)[attr];
|
|
1775
1783
|
result[attr] = {};
|