@iobroker/adapter-react-v5 4.9.0 → 4.9.2
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/CopyToClipboard.d.ts +6 -0
- package/Components/CopyToClipboard.js +158 -0
- package/Components/Image.d.ts +17 -57
- package/Components/Image.js +125 -162
- package/Components/MDUtils.d.ts +9 -9
- package/Components/MDUtils.js +82 -109
- package/Components/ObjectBrowser.d.ts +1 -1
- package/Components/TextWithIcon.d.ts +1 -1
- package/Components/Utils.d.ts +123 -187
- package/Components/Utils.js +1300 -1502
- package/Dialogs/SelectID.d.ts +0 -25
- package/Dialogs/SelectID.js +0 -25
- package/LegacyConnection.d.ts +3 -3
- package/Prompt.d.ts +1 -1
- package/Prompt.js +14 -12
- package/README.md +6 -0
- package/i18n.d.ts +6 -6
- package/index.d.ts +1 -1
- package/index.js +2 -2
- package/package.json +2 -1
- package/Components/Image.js.map +0 -1
- package/Components/MDUtils.js.map +0 -1
- package/Components/Utils.js.map +0 -1
- package/Components/copy-to-clipboard.d.ts +0 -2
- package/Components/copy-to-clipboard.js +0 -161
- package/Components/copy-to-clipboard.js.map +0 -1
- package/Prompt.js.map +0 -1
package/Components/Utils.d.ts
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2018-2023 Denis Haev <dogafox@gmail.com>
|
|
3
|
+
*
|
|
4
|
+
* MIT License
|
|
5
|
+
*
|
|
6
|
+
**/
|
|
7
|
+
import React from 'react';
|
|
8
|
+
interface GetObjectNameOptions {
|
|
9
|
+
name?: ioBroker.StringOrTranslated;
|
|
10
|
+
language?: ioBroker.Languages;
|
|
11
|
+
}
|
|
12
|
+
type SmartName = null | (ioBroker.StringOrTranslated & {
|
|
13
|
+
/** Which kind of device it is */
|
|
14
|
+
smartType?: string | null;
|
|
15
|
+
/** Which value to set when the ON command is issued */
|
|
16
|
+
byOn?: string | null;
|
|
17
|
+
});
|
|
18
|
+
declare namespace clsx {
|
|
19
|
+
type ClassValue = ClassArray | ClassDictionary | string | number | null | boolean | undefined;
|
|
20
|
+
type ClassDictionary = Record<string, any>;
|
|
21
|
+
type ClassArray = ClassValue[];
|
|
22
|
+
}
|
|
2
23
|
declare class Utils {
|
|
3
24
|
static namespace: string;
|
|
4
25
|
static INSTANCES: string;
|
|
@@ -6,280 +27,202 @@ declare class Utils {
|
|
|
6
27
|
static FORBIDDEN_CHARS: RegExp;
|
|
7
28
|
/**
|
|
8
29
|
* Capitalize words.
|
|
9
|
-
* @param {string | undefined} name
|
|
10
|
-
* @returns {string}
|
|
11
30
|
*/
|
|
12
|
-
static CapitalWords(name: string
|
|
13
|
-
static formatSeconds(seconds:
|
|
31
|
+
static CapitalWords(name: string): string;
|
|
32
|
+
static formatSeconds(seconds: number): string;
|
|
14
33
|
/**
|
|
15
34
|
* Get the name of the object by id from the name or description.
|
|
16
|
-
* @param
|
|
17
|
-
* @param
|
|
18
|
-
* @param
|
|
19
|
-
* @param
|
|
20
|
-
* @param
|
|
21
|
-
* @returns {string}
|
|
35
|
+
* @param objects
|
|
36
|
+
* @param id
|
|
37
|
+
* @param settings
|
|
38
|
+
* @param options
|
|
39
|
+
* @param isDesc Set to true to get the description.
|
|
22
40
|
*/
|
|
23
|
-
static getObjectName(objects: Record<string, ioBroker.Object>, id: string, settings:
|
|
24
|
-
name: any;
|
|
25
|
-
} | ioBroker.Languages | null, options: {
|
|
26
|
-
language?: ioBroker.Languages;
|
|
27
|
-
}, isDesc?: boolean): string;
|
|
41
|
+
static getObjectName(objects: Record<string, ioBroker.Object>, id: string, settings?: GetObjectNameOptions | ioBroker.Languages | null, options?: GetObjectNameOptions, isDesc?: boolean): string;
|
|
28
42
|
/**
|
|
29
43
|
* Get the name of the object from the name or description.
|
|
30
|
-
* @param
|
|
31
|
-
* @param
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @returns {string}
|
|
44
|
+
* @param obj
|
|
45
|
+
* @param settings or language
|
|
46
|
+
* @param options
|
|
47
|
+
* @param isDesc Set to true to get the description.
|
|
48
|
+
* @param noTrim Allow to use spaces in name (by edit)
|
|
36
49
|
*/
|
|
37
|
-
static getObjectNameFromObj(obj: ioBroker.
|
|
38
|
-
name: any;
|
|
39
|
-
} | ioBroker.Languages | null, options: {
|
|
40
|
-
language?: ioBroker.Languages;
|
|
41
|
-
}, isDesc?: boolean, noTrim?: boolean): string;
|
|
50
|
+
static getObjectNameFromObj(obj: ioBroker.Object, settings?: GetObjectNameOptions | ioBroker.Languages | null, options?: GetObjectNameOptions, isDesc?: boolean, noTrim?: boolean): string;
|
|
42
51
|
/**
|
|
43
|
-
*
|
|
44
|
-
* @param {string} forEnumId
|
|
45
|
-
* @param {{ user: string; }} options
|
|
46
|
-
* @returns {string | null}
|
|
52
|
+
* Extracts from the object material settings, depends on username
|
|
47
53
|
*/
|
|
48
|
-
static getSettingsOrder(obj: ioBroker.
|
|
54
|
+
static getSettingsOrder(obj: ioBroker.StateObject | ioBroker.StateCommon, forEnumId: string, options: {
|
|
49
55
|
user: string;
|
|
50
56
|
}): string | null;
|
|
51
57
|
/**
|
|
52
|
-
|
|
53
|
-
* @param {string} forEnumId
|
|
54
|
-
* @param {{ user: string; }} options
|
|
58
|
+
Used in material
|
|
55
59
|
*/
|
|
56
|
-
static getSettingsCustomURLs(obj: ioBroker.
|
|
60
|
+
static getSettingsCustomURLs(obj: ioBroker.StateObject | ioBroker.StateCommon, forEnumId: string, options: {
|
|
57
61
|
user: string;
|
|
58
|
-
}):
|
|
62
|
+
}): string | null;
|
|
59
63
|
/**
|
|
60
64
|
* Reorder the array items in list between source and dest.
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
user: any;
|
|
74
|
-
name: any;
|
|
75
|
-
icon: any;
|
|
76
|
-
color: any;
|
|
77
|
-
language: ioBroker.Languages;
|
|
65
|
+
*/
|
|
66
|
+
static reorder(list: Iterable<any> | ArrayLike<any>, source: number, dest: number): Iterable<any> | ArrayLike<any>;
|
|
67
|
+
/**
|
|
68
|
+
Get smart name settings for the given object.
|
|
69
|
+
*/
|
|
70
|
+
static getSettings(obj: ioBroker.StateObject | ioBroker.StateCommon, options: {
|
|
71
|
+
id?: string;
|
|
72
|
+
user?: string;
|
|
73
|
+
name?: ioBroker.StringOrTranslated;
|
|
74
|
+
icon?: string;
|
|
75
|
+
color?: string;
|
|
76
|
+
language?: ioBroker.Languages;
|
|
78
77
|
}, defaultEnabling?: boolean): any;
|
|
79
78
|
/**
|
|
80
|
-
|
|
81
|
-
* @param {any} settings
|
|
82
|
-
* @param {{ user: any; language: ioBroker.Languages; }} options
|
|
79
|
+
Sets smartName settings for the given object.
|
|
83
80
|
*/
|
|
84
|
-
static setSettings(obj:
|
|
85
|
-
user
|
|
86
|
-
language
|
|
81
|
+
static setSettings(obj: ioBroker.StateObject, settings: any, options: {
|
|
82
|
+
user?: string;
|
|
83
|
+
language?: ioBroker.Languages;
|
|
87
84
|
}): boolean;
|
|
88
85
|
/**
|
|
89
86
|
* Get the icon for the given settings.
|
|
90
|
-
* @param {{ icon: string | undefined; name: string | undefined; prefix: string | undefined}} settings
|
|
91
|
-
* @param {any} style
|
|
92
|
-
* @returns {JSX.Element | null}
|
|
93
87
|
*/
|
|
94
88
|
static getIcon(settings: {
|
|
95
|
-
icon
|
|
96
|
-
name
|
|
97
|
-
prefix
|
|
98
|
-
}, style
|
|
89
|
+
icon?: string;
|
|
90
|
+
name?: string;
|
|
91
|
+
prefix?: string;
|
|
92
|
+
}, style?: React.CSSProperties): React.JSX.Element | null;
|
|
99
93
|
/**
|
|
100
94
|
* Get the icon for the given object.
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
* @returns {string | null}
|
|
104
|
-
*/
|
|
105
|
-
static getObjectIcon(id: string, obj: {
|
|
106
|
-
common: {
|
|
107
|
-
icon: any;
|
|
108
|
-
};
|
|
109
|
-
}): string | null;
|
|
95
|
+
*/
|
|
96
|
+
static getObjectIcon(id: string | ioBroker.PartialObject, obj?: ioBroker.PartialObject): string | null;
|
|
110
97
|
/**
|
|
111
98
|
* Splits CamelCase into words.
|
|
112
|
-
* @param {string | undefined} text
|
|
113
|
-
* @returns {string}
|
|
114
99
|
*/
|
|
115
100
|
static splitCamelCase(text: string | undefined): string;
|
|
116
101
|
/**
|
|
117
102
|
* Check if the given color is bright.
|
|
118
103
|
* https://stackoverflow.com/questions/35969656/how-can-i-generate-the-opposite-color-according-to-current-color
|
|
119
|
-
* @param {string | null | undefined} color
|
|
120
|
-
* @param {boolean} [defaultValue]
|
|
121
|
-
* @returns {boolean}
|
|
122
104
|
*/
|
|
123
105
|
static isUseBright(color: string | null | undefined, defaultValue?: boolean): boolean;
|
|
124
106
|
/**
|
|
125
107
|
* Get the time string in the format 00:00.
|
|
126
|
-
* @param {string | number} seconds
|
|
127
108
|
*/
|
|
128
109
|
static getTimeString(seconds: string | number): string;
|
|
129
110
|
/**
|
|
130
111
|
* Gets the wind direction with the given angle (degrees).
|
|
131
|
-
* @param
|
|
132
|
-
* @returns {string | undefined}
|
|
112
|
+
* @param angle in degrees.
|
|
133
113
|
*/
|
|
134
|
-
static getWindDirection(angle: number): string
|
|
114
|
+
static getWindDirection(angle: number): string;
|
|
135
115
|
/**
|
|
136
|
-
* Pad the given number with a zero if it's not
|
|
137
|
-
* @param {string | number} num
|
|
116
|
+
* Pad the given number with a zero if it's not two digits long.
|
|
138
117
|
*/
|
|
139
|
-
static padding(num: string | number): string
|
|
118
|
+
static padding(num: string | number): string;
|
|
140
119
|
/**
|
|
141
120
|
* Sets the date format.
|
|
142
|
-
* @param {string} format
|
|
143
121
|
*/
|
|
144
122
|
static setDataFormat(format: string): void;
|
|
145
123
|
/**
|
|
146
124
|
* Converts the date to a string.
|
|
147
|
-
* @param {string | number | Date} now
|
|
148
|
-
* @returns {string}
|
|
149
125
|
*/
|
|
150
126
|
static date2string(now: string | number | Date): string;
|
|
151
127
|
/**
|
|
152
128
|
* Render a text as a link.
|
|
153
|
-
* @param {string} text
|
|
154
|
-
* @returns {string | JSX.Element[]}
|
|
155
129
|
*/
|
|
156
|
-
static renderTextWithA(text: string):
|
|
130
|
+
static renderTextWithA(text: string): React.JSX.Element[] | string;
|
|
157
131
|
/**
|
|
158
132
|
* Get the smart name of the given state.
|
|
159
|
-
* @param {Record<string, ioBroker.StateObject> | ioBroker.StateObject} states
|
|
160
|
-
* @param {string} id
|
|
161
|
-
* @param {string} instanceId
|
|
162
|
-
* @param {boolean} [noCommon]
|
|
163
133
|
*/
|
|
164
|
-
static getSmartName(states: Record<string, ioBroker.StateObject> | ioBroker.StateObject, id: string, instanceId: string, noCommon?: boolean):
|
|
134
|
+
static getSmartName(states: Record<string, ioBroker.StateObject> | ioBroker.StateObject | ioBroker.StateCommon, id: string, instanceId: string, noCommon?: boolean): SmartName | undefined;
|
|
165
135
|
/**
|
|
166
136
|
* Get the smart name from a state.
|
|
167
|
-
* @param {ioBroker.StateObject} obj
|
|
168
|
-
* @param {string} instanceId
|
|
169
|
-
* @param {boolean} [noCommon]
|
|
170
137
|
*/
|
|
171
|
-
static getSmartNameFromObj(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean):
|
|
138
|
+
static getSmartNameFromObj(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): SmartName | undefined;
|
|
172
139
|
/**
|
|
173
140
|
* Enable smart name for a state.
|
|
174
|
-
* @param {ioBroker.StateObject} obj
|
|
175
|
-
* @param {string} instanceId
|
|
176
|
-
* @param {boolean} [noCommon]
|
|
177
141
|
*/
|
|
178
142
|
static enableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
|
|
179
143
|
/**
|
|
180
144
|
* Completely remove smart name from a state.
|
|
181
|
-
* @param {ioBroker.StateObject} obj
|
|
182
|
-
* @param {string | number} instanceId
|
|
183
|
-
* @param {boolean} [noCommon]
|
|
184
145
|
*/
|
|
185
|
-
static removeSmartName(obj: ioBroker.StateObject, instanceId: string
|
|
146
|
+
static removeSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
|
|
186
147
|
/**
|
|
187
148
|
* Update the smartname of a state.
|
|
188
|
-
* @param {ioBroker.StateObject} obj
|
|
189
|
-
* @param {string} newSmartName
|
|
190
|
-
* @param {string | undefined} byON
|
|
191
|
-
* @param {string | undefined} smartType
|
|
192
|
-
* @param {string} instanceId
|
|
193
|
-
* @param {boolean} [noCommon]
|
|
194
149
|
*/
|
|
195
|
-
static updateSmartName(obj: ioBroker.StateObject, newSmartName:
|
|
150
|
+
static updateSmartName(obj: ioBroker.StateObject, newSmartName: ioBroker.StringOrTranslated, byON: string | null, smartType: string | null, instanceId: string, noCommon?: boolean): void;
|
|
196
151
|
/**
|
|
197
152
|
* Disable the smart name of a state.
|
|
198
|
-
* @param {ioBroker.StateObject} obj
|
|
199
|
-
* @param {string} instanceId
|
|
200
|
-
* @param {boolean} [noCommon]
|
|
201
153
|
*/
|
|
202
154
|
static disableSmartName(obj: ioBroker.StateObject, instanceId: string, noCommon?: boolean): void;
|
|
203
155
|
/**
|
|
204
156
|
* Copy text to the clipboard.
|
|
205
|
-
* @param {string} text
|
|
206
|
-
* @param {Event} [e]
|
|
207
157
|
*/
|
|
208
|
-
static copyToClipboard(text: string, e
|
|
158
|
+
static copyToClipboard(text: string, e: Event): boolean;
|
|
209
159
|
/**
|
|
210
160
|
* Gets the extension of a file name.
|
|
211
|
-
* @param
|
|
212
|
-
* @returns
|
|
161
|
+
* @param fileName the file name.
|
|
162
|
+
* @returns The extension in lower case.
|
|
213
163
|
*/
|
|
214
|
-
static getFileExtension(fileName
|
|
164
|
+
static getFileExtension(fileName: string): string | null;
|
|
215
165
|
/**
|
|
216
166
|
* Format number of bytes as a string with B, KB, MB or GB.
|
|
217
167
|
* The base for all calculations is 1024.
|
|
218
|
-
* @param
|
|
219
|
-
* @returns
|
|
168
|
+
* @param bytes The number of bytes.
|
|
169
|
+
* @returns The formatted string (e.g. '723.5 KB')
|
|
220
170
|
*/
|
|
221
171
|
static formatBytes(bytes: number): string;
|
|
222
172
|
/**
|
|
223
173
|
* Invert the given color according to a theme type to get the inverted text color for background
|
|
224
|
-
* @param
|
|
225
|
-
* @param
|
|
226
|
-
* @param
|
|
227
|
-
* @returns {string | undefined}
|
|
174
|
+
* @param color Color in the format '#rrggbb' or '#rgb' (or without a hash)
|
|
175
|
+
* @param themeType theme type
|
|
176
|
+
* @param invert dark theme has light color in control or light theme has light color in control
|
|
228
177
|
*/
|
|
229
|
-
static getInvertedColor(color: string, themeType
|
|
178
|
+
static getInvertedColor(color: string, themeType?: string, invert?: boolean): string | undefined;
|
|
230
179
|
/**
|
|
231
180
|
* Invert the given color
|
|
232
|
-
* @param
|
|
233
|
-
* @param
|
|
234
|
-
* @returns {string}
|
|
181
|
+
* @param hex Color in the format '#rrggbb' or '#rgb' (or without hash)
|
|
182
|
+
* @param bw Set to black or white.
|
|
235
183
|
*/
|
|
236
|
-
static invertColor(hex: string, bw
|
|
184
|
+
static invertColor(hex: string, bw?: boolean): string;
|
|
237
185
|
/**
|
|
238
186
|
* Convert RGB to array [r, g, b]
|
|
239
|
-
* @param
|
|
240
|
-
* @returns
|
|
187
|
+
* @param hex Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
188
|
+
* @returns Array with 3 elements [r, g, b]
|
|
241
189
|
*/
|
|
242
|
-
static color2rgb(hex: string):
|
|
190
|
+
static color2rgb(hex: string): false | [number, number, number] | '';
|
|
243
191
|
/**
|
|
244
192
|
* Convert RGB to LAB
|
|
245
193
|
* @param {Array<number>} rgb color in format [r,g,b]
|
|
246
194
|
* @returns {Array<number>} lab color in format [l,a,b]
|
|
247
195
|
*/
|
|
248
|
-
static rgb2lab(rgb:
|
|
196
|
+
static rgb2lab(rgb: [number, number, number]): [number, number, number];
|
|
249
197
|
/**
|
|
250
198
|
* Calculate the distance between two colors in LAB color space in the range 0-100^2
|
|
251
199
|
* If distance is less than 1000, the colors are similar
|
|
252
|
-
* @param
|
|
253
|
-
* @param
|
|
254
|
-
* @returns
|
|
200
|
+
* @param color1 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
201
|
+
* @param color2 Color in the format '#rrggbb' or '#rgb' (or without hash) or rgb(r,g,b) or rgba(r,g,b,a)
|
|
202
|
+
* @returns distance in the range 0-100^2
|
|
255
203
|
*/
|
|
256
204
|
static colorDistance(color1: string, color2: string): number;
|
|
257
205
|
/**
|
|
258
206
|
* @private
|
|
259
|
-
* @param {any} mix
|
|
260
|
-
* @returns {string}
|
|
261
207
|
*/
|
|
262
|
-
|
|
208
|
+
static _toVal(mix: clsx.ClassValue): string;
|
|
263
209
|
/**
|
|
264
210
|
* Convert any object to a string with its values.
|
|
265
211
|
* @returns {string}
|
|
266
212
|
*/
|
|
267
|
-
static clsx(...
|
|
213
|
+
static clsx(...inputs: clsx.ClassValue[]): string;
|
|
268
214
|
/**
|
|
269
215
|
* Get the current theme name (either from local storage or the browser settings).
|
|
270
216
|
* @param {string} [themeName]
|
|
271
217
|
* @returns {string}
|
|
272
218
|
*/
|
|
273
|
-
static getThemeName(themeName?: string):
|
|
219
|
+
static getThemeName(themeName?: string): any;
|
|
274
220
|
/**
|
|
275
221
|
* Get the type of theme.
|
|
276
|
-
* @param {string} [themeName]
|
|
277
|
-
* @returns {'dark' | 'light'}
|
|
278
222
|
*/
|
|
279
223
|
static getThemeType(themeName?: string): 'dark' | 'light';
|
|
280
224
|
/**
|
|
281
225
|
* Set the theme name and theme type.
|
|
282
|
-
* @param {string} themeName
|
|
283
226
|
*/
|
|
284
227
|
static setThemeName(themeName: string): void;
|
|
285
228
|
/**
|
|
@@ -290,80 +233,72 @@ declare class Utils {
|
|
|
290
233
|
static toggleTheme(themeName: string | null): string;
|
|
291
234
|
/**
|
|
292
235
|
* Get the list of themes
|
|
293
|
-
* @returns
|
|
236
|
+
* @returns list of possible themes
|
|
294
237
|
*/
|
|
295
|
-
static getThemeNames():
|
|
238
|
+
static getThemeNames(): string[];
|
|
296
239
|
/**
|
|
297
240
|
* Parse a query string into its parts.
|
|
298
|
-
* @param {string} query
|
|
299
|
-
* @returns {Record<string, string | boolean | number>}
|
|
300
241
|
*/
|
|
301
242
|
static parseQuery(query: string): Record<string, string | boolean | number>;
|
|
302
243
|
/**
|
|
303
244
|
* Returns parent ID.
|
|
304
|
-
* @
|
|
305
|
-
* @returns {string | null} parent ID or null if no parent
|
|
245
|
+
* @returns parent ID or null if no parent
|
|
306
246
|
*/
|
|
307
247
|
static getParentId(id: string): string | null;
|
|
308
|
-
static formatDate(dateObj:
|
|
309
|
-
static formatTime(seconds:
|
|
310
|
-
static MDtext2link(text:
|
|
311
|
-
static openLink(url:
|
|
312
|
-
static MDgetTitle(text:
|
|
313
|
-
static MDextractHeader(text:
|
|
314
|
-
header:
|
|
315
|
-
body:
|
|
248
|
+
static formatDate(dateObj: Date, dateFormat: string): string;
|
|
249
|
+
static formatTime(seconds: number): string;
|
|
250
|
+
static MDtext2link(text: string): string;
|
|
251
|
+
static openLink(url: string, target?: string): void;
|
|
252
|
+
static MDgetTitle(text: string): string;
|
|
253
|
+
static MDextractHeader(text: string): {
|
|
254
|
+
header: Record<string, string | boolean | number>;
|
|
255
|
+
body: string;
|
|
316
256
|
};
|
|
317
|
-
static MDremoveDocsify(text:
|
|
257
|
+
static MDremoveDocsify(text: string): string;
|
|
318
258
|
/**
|
|
319
259
|
* Generate the json file on the file for download.
|
|
320
|
-
* @param
|
|
321
|
-
* @param
|
|
260
|
+
* @param fileName file name
|
|
261
|
+
* @param json file data
|
|
322
262
|
* @returns {object} json structure (not stringified)
|
|
323
263
|
*/
|
|
324
|
-
static generateFile(
|
|
264
|
+
static generateFile(fileName: string, json: string): void;
|
|
325
265
|
/**
|
|
326
266
|
* Convert quality code into text
|
|
327
267
|
* @param {number} quality code
|
|
328
268
|
* @returns {array<string>} lines that decode quality
|
|
329
269
|
*/
|
|
330
|
-
static quality2text(quality: number):
|
|
270
|
+
static quality2text(quality: number): string[];
|
|
331
271
|
/**
|
|
332
272
|
* Deep copy object
|
|
333
|
-
* @param {object} object
|
|
334
|
-
* @returns {object}
|
|
335
273
|
*/
|
|
336
|
-
static clone(object:
|
|
274
|
+
static clone(object: any): any;
|
|
337
275
|
/**
|
|
338
276
|
* Get states of object
|
|
339
|
-
* @
|
|
340
|
-
* @returns {object} states as an object in form {"value1": "label1", "value2": "label2"} or null
|
|
277
|
+
* @returns states as an object in form {"value1": "label1", "value2": "label2"} or null
|
|
341
278
|
*/
|
|
342
|
-
static getStates(obj:
|
|
279
|
+
static getStates(obj: ioBroker.StateObject | null | undefined): Record<string, string> | null;
|
|
343
280
|
/**
|
|
344
281
|
* Get svg file as text
|
|
345
|
-
* @param
|
|
346
|
-
* @returns
|
|
282
|
+
* @param url URL of SVG file
|
|
283
|
+
* @returns Promise with "data:image..."
|
|
347
284
|
*/
|
|
348
|
-
static getSvg(url: string):
|
|
285
|
+
static getSvg(url: string): Promise<string>;
|
|
349
286
|
/**
|
|
350
287
|
* Detect file extension by its content
|
|
351
288
|
* @param {string} base64 Base64 encoded binary file
|
|
352
289
|
* @returns {string} Detected extension, like 'jpg'
|
|
353
290
|
*/
|
|
354
|
-
static detectMimeType(base64: string): string;
|
|
291
|
+
static detectMimeType(base64: string): string | null;
|
|
355
292
|
/**
|
|
356
293
|
* Check if configured repository is the stable repository
|
|
357
294
|
*
|
|
358
|
-
* @param
|
|
359
|
-
* @return {boolean}
|
|
295
|
+
* @param activeRepo current configured repository or multi repository
|
|
360
296
|
*/
|
|
361
297
|
static isStableRepository(activeRepo: string | string[]): boolean;
|
|
362
298
|
/**
|
|
363
|
-
* Check if given string is an integer
|
|
299
|
+
* Check if a given string is an integer
|
|
364
300
|
*
|
|
365
|
-
* @param
|
|
366
|
-
* @return {boolean}
|
|
301
|
+
* @param str string to check
|
|
367
302
|
*/
|
|
368
303
|
static isStringInteger(str: string): boolean;
|
|
369
304
|
/**
|
|
@@ -372,5 +307,6 @@ declare class Utils {
|
|
|
372
307
|
* @param {Date} date
|
|
373
308
|
* @return {boolean}
|
|
374
309
|
*/
|
|
375
|
-
static isValidDate(date:
|
|
310
|
+
static isValidDate(date: any): boolean;
|
|
376
311
|
}
|
|
312
|
+
export default Utils;
|