@iobroker/dm-utils 2.0.1 → 3.0.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/README.md +204 -124
- package/build/ActionContext.d.ts +2 -6
- package/build/DeviceManagement.d.ts +25 -29
- package/build/DeviceManagement.js +190 -106
- package/build/ProgressDialog.d.ts +2 -6
- package/build/index.d.ts +1 -1
- package/build/index.js +0 -2
- package/build/types/adapter.d.ts +4 -3
- package/build/types/api.d.ts +65 -0
- package/build/types/base.d.ts +49 -34
- package/build/types/base.js +2 -2
- package/build/types/common.d.ts +108 -106
- package/build/types/index.d.ts +1 -1
- package/build/types/index.js +1 -1
- package/package.json +10 -6
package/build/types/common.d.ts
CHANGED
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
export type ApiVersion = '
|
|
1
|
+
export type ApiVersion = 'v3';
|
|
2
2
|
export type ConfigConnectionType = 'lan' | 'wifi' | 'bluetooth' | 'thread' | 'z-wave' | 'zigbee' | 'other';
|
|
3
|
+
export interface ComplexDeviceId {
|
|
4
|
+
[key: string | number]: string | number | ComplexDeviceId;
|
|
5
|
+
}
|
|
6
|
+
export type DeviceId = string | number | ComplexDeviceId;
|
|
3
7
|
export type ValueOrObject<T> = T | {
|
|
4
8
|
objectId: string;
|
|
5
9
|
property: string;
|
|
6
10
|
};
|
|
7
|
-
export type ValueOrState<T
|
|
8
|
-
[value: string | number]: string;
|
|
9
|
-
}> = T | {
|
|
11
|
+
export type ValueOrState<T> = T | {
|
|
10
12
|
stateId: string;
|
|
11
|
-
mapping?:
|
|
13
|
+
mapping?: Record<string | number, T>;
|
|
12
14
|
};
|
|
13
15
|
export type ValueOrStateOrObject<T> = T | ValueOrObject<T> | ValueOrState<T>;
|
|
14
16
|
export type DeviceStatus = 'connected' | 'disconnected' | {
|
|
15
|
-
battery?: ValueOrState<number | boolean | 'charging' | string>;
|
|
16
|
-
connection?: ValueOrState<'connected' | 'disconnected'
|
|
17
|
-
[value: string]: 'connected' | 'disconnected';
|
|
18
|
-
}>;
|
|
17
|
+
battery?: ValueOrState<number | boolean | 'charging' | (string & {})>;
|
|
18
|
+
connection?: ValueOrState<'connected' | 'disconnected'>;
|
|
19
19
|
rssi?: ValueOrState<number>;
|
|
20
20
|
warning?: ValueOrState<ioBroker.StringOrTranslated | boolean>;
|
|
21
21
|
};
|
|
22
|
-
export type DeviceRefresh = 'device' | 'instance' | false | true;
|
|
23
|
-
export type RefreshResponse = {
|
|
24
|
-
refresh: DeviceRefresh;
|
|
25
|
-
};
|
|
26
22
|
export type ErrorResponse = {
|
|
27
23
|
error: {
|
|
28
24
|
code: number;
|
|
@@ -30,18 +26,26 @@ export type ErrorResponse = {
|
|
|
30
26
|
};
|
|
31
27
|
};
|
|
32
28
|
export type RetVal<T> = T | Promise<T>;
|
|
29
|
+
export interface ProgressOptions {
|
|
30
|
+
indeterminate?: boolean;
|
|
31
|
+
value?: number;
|
|
32
|
+
label?: ioBroker.StringOrTranslated;
|
|
33
|
+
}
|
|
34
|
+
export interface ProgressUpdate extends ProgressOptions {
|
|
35
|
+
title?: ioBroker.StringOrTranslated;
|
|
36
|
+
}
|
|
33
37
|
type CustomCSSProperties = Record<string, any>;
|
|
34
38
|
interface ObjectBrowserCustomFilter {
|
|
35
39
|
type?: ioBroker.ObjectType | ioBroker.ObjectType[];
|
|
36
40
|
common?: {
|
|
37
41
|
type?: ioBroker.CommonType | ioBroker.CommonType[];
|
|
38
42
|
role?: string | string[];
|
|
39
|
-
custom?: '_' | '_dataSources' | true | string | string[];
|
|
43
|
+
custom?: '_' | '_dataSources' | true | (string & {}) | string[];
|
|
40
44
|
};
|
|
41
45
|
}
|
|
42
46
|
export type ObjectBrowserType = 'state' | 'instance' | 'channel' | 'device' | 'chart';
|
|
43
|
-
export type ConfigItemType = 'accordion' | 'alive' | 'autocomplete' | 'autocompleteSendTo' | 'certCollection' | 'certificate' | 'certificates' | 'checkDocker' | 'checkLicense' | 'checkbox' | 'chips' | 'color' | 'coordinates' | 'cron' | 'custom' | 'datePicker' | 'deviceManager' | 'divider' | 'file' | 'fileSelector' | 'func' | 'header' | 'image' | 'imageSendTo' | 'infoBox' | 'instance' | 'interface' | 'ip' | 'jsonEditor' | 'language' | 'license' | 'number' | 'oauth2' | 'objectId' | 'panel' | 'password' | 'pattern' | 'port' | 'qrCode' | 'room' | 'select' | 'selectSendTo' | 'sendto' | 'setState' | 'slider' | 'state' | 'staticImage' | 'staticInfo' | 'staticLink' | 'staticText' | 'table' | 'tabs' | 'text' | 'textSendTo' | 'timePicker' | 'topic' | 'user' | 'uuid';
|
|
44
|
-
export type ConfigIconType = 'add' | 'backlight' | 'book' | 'delete' | 'dimmer' | 'edit' | 'error' | 'group' | 'help' | 'identify' | 'info' | 'light' | 'lines' | 'next' | 'pair' | 'pause' | 'play' | 'previous' | 'qrcode' | 'refresh' | 'search' | 'send' | 'settings' | 'socket' | 'stop' | 'unpair' | '
|
|
47
|
+
export type ConfigItemType = 'accordion' | 'alive' | 'autocomplete' | 'autocompleteSendTo' | 'certCollection' | 'certificate' | 'certificates' | 'checkDocker' | 'checkLicense' | 'checkbox' | 'chips' | 'color' | 'coordinates' | 'cron' | 'custom' | 'datePicker' | 'deviceManager' | 'divider' | 'file' | 'fileSelector' | 'func' | 'header' | 'iframe' | 'iframeSendTo' | 'image' | 'imageSendTo' | 'infoBox' | 'instance' | 'interface' | 'ip' | 'jsonEditor' | 'language' | 'license' | 'number' | 'oauth2' | 'objectId' | 'panel' | 'password' | 'pattern' | 'port' | 'qrCode' | 'room' | 'select' | 'selectSendTo' | 'sendto' | 'setState' | 'slider' | 'state' | 'staticImage' | 'staticInfo' | 'staticLink' | 'staticText' | 'table' | 'tabs' | 'text' | 'textSendTo' | 'timePicker' | 'topic' | 'user' | 'uuid' | 'yamlEditor';
|
|
48
|
+
export type ConfigIconType = 'add' | 'backlight' | 'book' | 'delete' | 'dimmer' | 'edit' | 'error' | 'group' | 'help' | 'identify' | 'info' | 'light' | 'lines' | 'next' | 'pair' | 'pause' | 'play' | 'previous' | 'qrcode' | 'refresh' | 'search' | 'send' | 'settings' | 'socket' | 'stop' | 'unpair' | 'upload' | 'user' | 'warning' | 'web' | string;
|
|
45
49
|
export interface ConfigItemConfirmData {
|
|
46
50
|
condition: string;
|
|
47
51
|
text?: ioBroker.StringOrTranslated;
|
|
@@ -89,7 +93,7 @@ export interface ConfigItem {
|
|
|
89
93
|
default?: boolean | number | string;
|
|
90
94
|
defaultFunc?: string;
|
|
91
95
|
defaultSendTo?: string;
|
|
92
|
-
/** Allow saving of configuration even with error */
|
|
96
|
+
/** Allow saving of configuration even with an error */
|
|
93
97
|
allowSaveWithError?: boolean;
|
|
94
98
|
data?: string | number | boolean;
|
|
95
99
|
jsonData?: string;
|
|
@@ -121,20 +125,20 @@ interface ConfigItemIndexed extends ConfigItem {
|
|
|
121
125
|
}
|
|
122
126
|
interface ConfigItemTableIndexed extends ConfigItem {
|
|
123
127
|
attr?: string;
|
|
124
|
-
/** show filter options in the header of table */
|
|
128
|
+
/** show filter options in the header of the table */
|
|
125
129
|
filter?: boolean;
|
|
126
|
-
/** show sorting options in the header of table */
|
|
130
|
+
/** show sorting options in the header of the table */
|
|
127
131
|
sort?: boolean;
|
|
128
|
-
/** tooltip in the header of table */
|
|
132
|
+
/** tooltip in the header of the table */
|
|
129
133
|
title?: string;
|
|
130
134
|
}
|
|
131
135
|
export interface ConfigItemAlive extends ConfigItem {
|
|
132
136
|
type: 'alive';
|
|
133
|
-
/** check if the instance is alive. If not defined, it will be used current instance. You can use
|
|
137
|
+
/** check if the instance is alive. If not defined, it will be used current instance. You can use the ` $ {data.number} ` pattern in the text. */
|
|
134
138
|
instance?: string;
|
|
135
|
-
/** default text is `Instance %s is alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
139
|
+
/** the default text is `Instance %s is alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
136
140
|
textAlive?: string;
|
|
137
|
-
/** default text is `Instance %s is not alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
141
|
+
/** the default text is `Instance %s is not alive`, where %s will be replaced by `ADAPTER.0`. The translation must exist in i18n files. */
|
|
138
142
|
textNotAlive?: string;
|
|
139
143
|
}
|
|
140
144
|
export interface ConfigItemSelectOption {
|
|
@@ -188,17 +192,17 @@ export interface ConfigItemTabs extends ConfigItem {
|
|
|
188
192
|
}
|
|
189
193
|
export interface ConfigItemText extends ConfigItem {
|
|
190
194
|
type: 'text';
|
|
191
|
-
/** max length of the text in field */
|
|
195
|
+
/** max length of the text in the field */
|
|
192
196
|
maxLength?: number;
|
|
193
197
|
/** @deprecated use maxLength */
|
|
194
198
|
max?: number;
|
|
195
199
|
/** read-only field */
|
|
196
200
|
readOnly?: boolean;
|
|
197
|
-
/** show copy
|
|
201
|
+
/** show copy-to-clipboard button, but only if disabled or read-only */
|
|
198
202
|
copyToClipboard?: boolean;
|
|
199
203
|
/** default is true. Set this attribute to `false` if trim is not desired. */
|
|
200
204
|
trim?: boolean;
|
|
201
|
-
/** default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. */
|
|
205
|
+
/** the default is 1. Set this attribute to `2` or more if you want to have a textarea with more than one row. */
|
|
202
206
|
minRows?: number;
|
|
203
207
|
/** max rows of textarea. Used only if `minRows` > 1. */
|
|
204
208
|
maxRows?: number;
|
|
@@ -258,7 +262,7 @@ export interface ConfigItemPassword extends ConfigItem {
|
|
|
258
262
|
visible?: boolean;
|
|
259
263
|
/** The read-only flag. Visible is automatically true if readOnly is true */
|
|
260
264
|
readOnly?: boolean;
|
|
261
|
-
/** max length of the text in field */
|
|
265
|
+
/** max length of the text in the field */
|
|
262
266
|
maxLength?: number;
|
|
263
267
|
/** @deprecated use maxLength */
|
|
264
268
|
max?: number;
|
|
@@ -306,7 +310,7 @@ export interface ConfigItemSlider extends ConfigItem {
|
|
|
306
310
|
}
|
|
307
311
|
export interface ConfigItemTopic extends ConfigItem {
|
|
308
312
|
type: 'topic';
|
|
309
|
-
/** max length of the text in field */
|
|
313
|
+
/** max length of the text in the field */
|
|
310
314
|
maxLength?: number;
|
|
311
315
|
/** @deprecated use maxLength */
|
|
312
316
|
max?: number;
|
|
@@ -349,11 +353,11 @@ export interface ConfigItemStaticText extends Omit<ConfigItem, 'button'> {
|
|
|
349
353
|
label?: ioBroker.StringOrTranslated;
|
|
350
354
|
/** link. Link could be dynamic like `#tab-objects/customs/${data.parentId} */
|
|
351
355
|
href?: string;
|
|
352
|
-
/** target of the link: _self, _blank or window name. For relative links default is _self and for absolute - _blank */
|
|
356
|
+
/** target of the link: _self, _blank or window name. For relative links the default is _self and for absolute - _blank */
|
|
353
357
|
target?: string;
|
|
354
358
|
/** If the GUI should be closed after a link was opened (only if the target is equal to '_self') */
|
|
355
359
|
close?: boolean;
|
|
356
|
-
/** show a link as button */
|
|
360
|
+
/** show a link as a button */
|
|
357
361
|
button?: boolean;
|
|
358
362
|
/** type of button (`outlined`, `contained`, `text`) */
|
|
359
363
|
variant?: 'contained' | 'outlined' | 'text';
|
|
@@ -374,13 +378,13 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
|
|
|
374
378
|
unit?: ioBroker.StringOrTranslated;
|
|
375
379
|
/** Normally, the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
|
|
376
380
|
narrow?: boolean;
|
|
377
|
-
/** Add to label the colon at the end if not exist in label */
|
|
381
|
+
/** Add to the label the colon at the end if not exist in the label */
|
|
378
382
|
addColon?: boolean;
|
|
379
383
|
/** Value should blink when updated (true or color) */
|
|
380
384
|
blinkOnUpdate?: boolean | string;
|
|
381
385
|
/** Value should blink continuously (true or color) */
|
|
382
386
|
blink?: boolean | string;
|
|
383
|
-
/** Show copy
|
|
387
|
+
/** Show a copy-to-clipboard button for value */
|
|
384
388
|
copyToClipboard?: boolean;
|
|
385
389
|
/** Label style */
|
|
386
390
|
styleLabel?: CustomCSSProperties;
|
|
@@ -392,7 +396,7 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
|
|
|
392
396
|
size?: number | 'small' | 'normal' | 'large';
|
|
393
397
|
/** Highlight line on mouse over */
|
|
394
398
|
highlight?: boolean;
|
|
395
|
-
/** Show boolean values as checkbox */
|
|
399
|
+
/** Show boolean values as a checkbox */
|
|
396
400
|
booleanAsCheckbox?: boolean;
|
|
397
401
|
/** Show string values as HTML */
|
|
398
402
|
html?: boolean;
|
|
@@ -438,7 +442,7 @@ export interface ConfigItemSelect extends ConfigItem {
|
|
|
438
442
|
attr?: string;
|
|
439
443
|
/** If multiple selection is possible. In this case, the value will be an array */
|
|
440
444
|
multiple?: boolean;
|
|
441
|
-
/** show item even if no label was found for it (by multiple), default=`true` */
|
|
445
|
+
/** show an item even if no label was found for it (by multiple), default=`true` */
|
|
442
446
|
showAllValues?: boolean;
|
|
443
447
|
}
|
|
444
448
|
export interface ConfigItemAutocomplete extends ConfigItem {
|
|
@@ -454,7 +458,7 @@ export interface ConfigItemSetState extends ConfigItem {
|
|
|
454
458
|
ack?: boolean;
|
|
455
459
|
/** '${data.myText}_test' or number. Type will be detected automatically from the state type and converting done too */
|
|
456
460
|
val: ioBroker.StateValue;
|
|
457
|
-
/** Alert which will be shown by pressing the button */
|
|
461
|
+
/** Alert, which will be shown by pressing the button */
|
|
458
462
|
okText?: ioBroker.StringOrTranslated;
|
|
459
463
|
variant?: 'contained' | 'outlined';
|
|
460
464
|
color?: 'primary' | 'secondary' | 'grey';
|
|
@@ -470,7 +474,7 @@ export interface ConfigItemAutocompleteSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
470
474
|
options?: (string | ConfigItemSelectOption)[];
|
|
471
475
|
data?: Record<string, any>;
|
|
472
476
|
freeSolo?: boolean;
|
|
473
|
-
/** max length of the text in field */
|
|
477
|
+
/** max length of the text in the field */
|
|
474
478
|
maxLength?: number;
|
|
475
479
|
/** @deprecated use maxLength */
|
|
476
480
|
max?: string;
|
|
@@ -482,7 +486,7 @@ export interface ConfigItemAccordion extends ConfigItem {
|
|
|
482
486
|
titleAttr?: string;
|
|
483
487
|
/** If delete or add disabled, If noDelete is false, add, delete and move up/down should work */
|
|
484
488
|
noDelete?: boolean;
|
|
485
|
-
/** If clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
489
|
+
/** If the clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
486
490
|
clone?: boolean | string;
|
|
487
491
|
/** Items of accordion */
|
|
488
492
|
items: ConfigItemIndexed[];
|
|
@@ -509,7 +513,7 @@ export interface ConfigItemCoordinates extends ConfigItem {
|
|
|
509
513
|
latitudeName?: string;
|
|
510
514
|
/** if defined, the checkbox with "Use system settings" will be shown and latitude, longitude will be read from system.config, a boolean will be saved to the given name */
|
|
511
515
|
useSystemName?: string;
|
|
512
|
-
/** max length of the text in field */
|
|
516
|
+
/** max length of the text in the field */
|
|
513
517
|
maxLength?: number;
|
|
514
518
|
/** @deprecated use maxLength */
|
|
515
519
|
max?: number;
|
|
@@ -531,7 +535,7 @@ export interface ConfigItemCustom extends ConfigItem {
|
|
|
531
535
|
}
|
|
532
536
|
export interface ConfigItemDatePicker extends ConfigItem {
|
|
533
537
|
type: 'datePicker';
|
|
534
|
-
/** max length of the text in field */
|
|
538
|
+
/** max length of the text in the field */
|
|
535
539
|
maxLength?: number;
|
|
536
540
|
/** @deprecated use maxLength */
|
|
537
541
|
max?: number;
|
|
@@ -550,6 +554,25 @@ export interface ConfigItemPort extends ConfigItem {
|
|
|
550
554
|
max?: number;
|
|
551
555
|
readOnly?: boolean;
|
|
552
556
|
}
|
|
557
|
+
export interface ConfigItemIFrame extends ConfigItem {
|
|
558
|
+
type: 'iframe';
|
|
559
|
+
url?: string;
|
|
560
|
+
sandbox?: string;
|
|
561
|
+
allowFullscreen?: boolean;
|
|
562
|
+
frameBorder?: number | string;
|
|
563
|
+
/** if true, the iframe will be loaded only when it becomes visible */
|
|
564
|
+
lazyLoad?: 'lazy' | 'eager';
|
|
565
|
+
/** if true, the iframe will be reloaded every time it becomes visible */
|
|
566
|
+
reloadOnShow?: boolean;
|
|
567
|
+
/** CSS Styles in React format (`marginLeft` and not `margin-left`) for the IFrame component */
|
|
568
|
+
innerStyle?: CustomCSSProperties;
|
|
569
|
+
}
|
|
570
|
+
export interface ConfigItemIFrameSendTo extends Omit<ConfigItemIFrame, 'data' | 'url' | 'type'> {
|
|
571
|
+
type: 'iframeSendTo';
|
|
572
|
+
command?: string;
|
|
573
|
+
alsoDependsOn?: string[];
|
|
574
|
+
data?: Record<string, any>;
|
|
575
|
+
}
|
|
553
576
|
export interface ConfigItemImageSendTo extends Omit<ConfigItem, 'data'> {
|
|
554
577
|
type: 'imageSendTo';
|
|
555
578
|
command?: string;
|
|
@@ -562,8 +585,10 @@ export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
562
585
|
command?: string;
|
|
563
586
|
jsonData?: string;
|
|
564
587
|
data?: Record<string, any>;
|
|
565
|
-
result
|
|
566
|
-
|
|
588
|
+
/** Translations for possible result codes. E.g. `{"RESULT_OK": "Operation successful"}`. The translation must exist in i18n files. */
|
|
589
|
+
result?: Record<string, ioBroker.StringOrTranslated>;
|
|
590
|
+
/** Translations for possible error codes. E.g. `{"ERR_NO_OBJECT": "Object not found"}`. The translation must exist in i18n files. */
|
|
591
|
+
error?: Record<string, ioBroker.StringOrTranslated>;
|
|
567
592
|
variant?: 'contained' | 'outlined';
|
|
568
593
|
openUrl?: boolean;
|
|
569
594
|
reloadBrowser?: boolean;
|
|
@@ -579,12 +604,12 @@ export interface ConfigItemSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
579
604
|
alsoDependsOn?: string[];
|
|
580
605
|
container?: 'text' | 'div' | 'html';
|
|
581
606
|
copyToClipboard?: boolean;
|
|
582
|
-
/** Styles for button itself */
|
|
607
|
+
/** Styles for the button itself */
|
|
583
608
|
controlStyle?: CustomCSSProperties;
|
|
584
609
|
}
|
|
585
610
|
export interface ConfigItemState extends ConfigItem {
|
|
586
611
|
type: 'state';
|
|
587
|
-
/** Describes
|
|
612
|
+
/** Describes which object ID should be taken for the controlling. The ID is without `ADAPTER.I.` prefix */
|
|
588
613
|
oid: string;
|
|
589
614
|
/** The `oid` is absolute and no need to add `ADAPTER.I` or `system.adapter.ADAPTER.I.` to oid */
|
|
590
615
|
foreign?: boolean;
|
|
@@ -594,7 +619,7 @@ export interface ConfigItemState extends ConfigItem {
|
|
|
594
619
|
control?: 'text' | 'html' | 'input' | 'slider' | 'select' | 'button' | 'switch' | 'number';
|
|
595
620
|
/** If true, the state will be shown as switch, select, button, slider or text input. Used only if no control property is defined */
|
|
596
621
|
controlled?: boolean;
|
|
597
|
-
/** Add unit to the value */
|
|
622
|
+
/** Add a unit to the value */
|
|
598
623
|
unit?: string;
|
|
599
624
|
/** this text will be shown if the value is true */
|
|
600
625
|
trueText?: string;
|
|
@@ -624,15 +649,15 @@ export interface ConfigItemState extends ConfigItem {
|
|
|
624
649
|
labelIcon?: string;
|
|
625
650
|
/** Normally, the title and value are shown on the left and right of the line. With this flag, the value will appear just after the label*/
|
|
626
651
|
narrow?: boolean;
|
|
627
|
-
/** Add to label the colon at the end if not exist in label */
|
|
652
|
+
/** Add to the label the colon at the end if not exist in the label */
|
|
628
653
|
addColon?: boolean;
|
|
629
654
|
/** Value should blink when updated (true or color) */
|
|
630
655
|
blinkOnUpdate?: boolean | string;
|
|
631
656
|
/** Font size */
|
|
632
657
|
size?: number | 'small' | 'normal' | 'large';
|
|
633
|
-
/** Optional value
|
|
658
|
+
/** Optional value that will be sent for the button */
|
|
634
659
|
buttonValue?: ioBroker.StateValue;
|
|
635
|
-
/** Show SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button.
|
|
660
|
+
/** Show the SET button. The value in this case will be sent only when the button is pressed. You can define the text of the button. The default text is "Set" */
|
|
636
661
|
showEnterButton?: boolean | ioBroker.StringOrTranslated;
|
|
637
662
|
/** The value in this case will be sent only when the "Enter" button is pressed. It can be combined with `showEnterButton` */
|
|
638
663
|
setOnEnterKey?: boolean;
|
|
@@ -642,7 +667,7 @@ export interface ConfigItemState extends ConfigItem {
|
|
|
642
667
|
export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
|
|
643
668
|
type: 'textSendTo';
|
|
644
669
|
container?: 'text' | 'div';
|
|
645
|
-
/** if true - show copy
|
|
670
|
+
/** if true - show copy-to-clipboard button */
|
|
646
671
|
copyToClipboard?: boolean;
|
|
647
672
|
/** by change of which attributes, the command must be resent */
|
|
648
673
|
alsoDependsOn?: string[];
|
|
@@ -655,11 +680,11 @@ export interface ConfigItemTextSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
655
680
|
}
|
|
656
681
|
export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
|
|
657
682
|
type: 'selectSendTo';
|
|
658
|
-
/** allow manual editing. Without drop-down menu (if instance is offline). Default `true`. */
|
|
683
|
+
/** allow manual editing. Without a drop-down menu (if the instance is offline). Default `true`. */
|
|
659
684
|
manual?: boolean;
|
|
660
685
|
/** Multiple choice select */
|
|
661
686
|
multiple?: boolean;
|
|
662
|
-
/** show item even if no label was found for it (by multiple), default=`true` */
|
|
687
|
+
/** show an item even if no label was found for it (by multiple), default=`true` */
|
|
663
688
|
showAllValues?: boolean;
|
|
664
689
|
/** if true, the clear button will not be shown */
|
|
665
690
|
noClearButton?: boolean;
|
|
@@ -675,21 +700,23 @@ export interface ConfigItemSelectSendTo extends Omit<ConfigItem, 'data'> {
|
|
|
675
700
|
export interface ConfigItemTable extends ConfigItem {
|
|
676
701
|
type: 'table';
|
|
677
702
|
items?: ConfigItemTableIndexed[];
|
|
703
|
+
/** Define the name of the attribute of the item which should be shown as a title of the item in cards mode. */
|
|
704
|
+
titleAttribute?: string;
|
|
678
705
|
/** If delete or add disabled, If noDelete is false, add, delete and move up/down should work */
|
|
679
706
|
noDelete?: boolean;
|
|
680
707
|
/** @deprecated don't use */
|
|
681
708
|
objKeyName?: string;
|
|
682
709
|
/** @deprecated don't use */
|
|
683
710
|
objValueName?: string;
|
|
684
|
-
/** If add allowed even if filter is set */
|
|
711
|
+
/** If add allowed even if a filter is set */
|
|
685
712
|
allowAddByFilter?: boolean;
|
|
686
|
-
/** The number of lines from which the second
|
|
713
|
+
/** The number of lines from which the second adding button at the bottom of the table will be shown. Default 5 */
|
|
687
714
|
showSecondAddAt?: number;
|
|
688
|
-
/** Show first plus button on top of the first column and not on the left. */
|
|
715
|
+
/** Show the first plus button on top of the first column and not on the left. */
|
|
689
716
|
showFirstAddOnTop?: boolean;
|
|
690
|
-
/** If clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
717
|
+
/** If the clone button should be shown. If true, the clone button will be shown. If attribute name, this name will be unique. */
|
|
691
718
|
clone?: boolean | string;
|
|
692
|
-
/** If export button should be shown. Export as csv file. */
|
|
719
|
+
/** If export button should be shown. Export as a csv file. */
|
|
693
720
|
export?: boolean;
|
|
694
721
|
/** If import button should be shown. Import from csv file. */
|
|
695
722
|
import?: boolean;
|
|
@@ -697,7 +724,7 @@ export interface ConfigItemTable extends ConfigItem {
|
|
|
697
724
|
compact?: boolean;
|
|
698
725
|
/** Specify the 'attr' name of columns which need to be unique */
|
|
699
726
|
uniqueColumns?: string[];
|
|
700
|
-
/** These items will be encrypted before saving with simple (not SHA) encryption method */
|
|
727
|
+
/** These items will be encrypted before saving with a simple (not SHA) encryption method */
|
|
701
728
|
encryptedAttributes?: string[];
|
|
702
729
|
/** Breakpoint that will be rendered as cards */
|
|
703
730
|
useCardFor?: ('xs' | 'sm' | 'md' | 'lg' | 'xl')[];
|
|
@@ -781,7 +808,18 @@ export interface ConfigItemJsonEditor extends ConfigItem {
|
|
|
781
808
|
allowEmpty?: boolean;
|
|
782
809
|
/** Allow JSON5 format. Default is disabled */
|
|
783
810
|
json5?: boolean;
|
|
784
|
-
/** Do not allow
|
|
811
|
+
/** Do not allow saving the value if error in JSON or JSON5 */
|
|
812
|
+
doNotApplyWithError?: boolean;
|
|
813
|
+
/** Open the editor in read-only mode - editor can be opened but content cannot be modified */
|
|
814
|
+
readOnly?: boolean;
|
|
815
|
+
}
|
|
816
|
+
export interface ConfigItemYamlEditor extends ConfigItem {
|
|
817
|
+
type: 'yamlEditor';
|
|
818
|
+
/** if false, the text will be not validated as YAML */
|
|
819
|
+
validateYaml?: boolean;
|
|
820
|
+
/** if true, the YAML will be validated only if the value is not empty */
|
|
821
|
+
allowEmpty?: boolean;
|
|
822
|
+
/** Do not allow saving the value if error in YAML */
|
|
785
823
|
doNotApplyWithError?: boolean;
|
|
786
824
|
/** Open the editor in read-only mode - editor can be opened but content cannot be modified */
|
|
787
825
|
readOnly?: boolean;
|
|
@@ -795,7 +833,7 @@ export interface ConfigItemInterface extends ConfigItem {
|
|
|
795
833
|
}
|
|
796
834
|
export interface ConfigItemImageUpload extends ConfigItem {
|
|
797
835
|
type: 'image';
|
|
798
|
-
/** name of a file is structure name. In the below example `login-bg.png` is file name for `writeFile("myAdapter.INSTANCE", "login-bg.png")` */
|
|
836
|
+
/** the name of a file is the structure name. In the below example `login-bg.png` is the file name for `writeFile("myAdapter.INSTANCE", "login-bg.png")` */
|
|
799
837
|
filename?: string;
|
|
800
838
|
/** HTML accept attribute, like `{ 'image/**': [], 'application/pdf': ['.pdf'] }`, default `{ 'image/*': [] }` */
|
|
801
839
|
accept?: Record<string, string[]>;
|
|
@@ -803,16 +841,16 @@ export interface ConfigItemImageUpload extends ConfigItem {
|
|
|
803
841
|
maxSize?: number;
|
|
804
842
|
/** if true, the image will be saved as data-url in attribute, elsewise as binary in file storage */
|
|
805
843
|
base64?: boolean;
|
|
806
|
-
/** if true, allow user to crop the image */
|
|
844
|
+
/** if true, allow the user to crop the image */
|
|
807
845
|
crop?: boolean;
|
|
808
846
|
}
|
|
809
847
|
export interface ConfigItemInstanceSelect extends ConfigItem {
|
|
810
848
|
type: 'instance';
|
|
811
|
-
/** name of adapter. With special name `_dataSources` you can get all adapters with flag `common.getHistory`. */
|
|
849
|
+
/** name of adapter. With the special name `_dataSources` you can get all adapters with the flag `common.getHistory`. */
|
|
812
850
|
adapter?: string;
|
|
813
|
-
/** optional list of adapters
|
|
851
|
+
/** optional list of adapters that should be shown. If not defined, all adapters will be shown. Only active if the ` adapter ` attribute is not defined. */
|
|
814
852
|
adapters?: string[];
|
|
815
|
-
/** if true.
|
|
853
|
+
/** if true. The additional option "deactivate" is shown */
|
|
816
854
|
allowDeactivate?: boolean;
|
|
817
855
|
/** if true. Only enabled instances will be shown */
|
|
818
856
|
onlyEnabled?: boolean;
|
|
@@ -825,7 +863,7 @@ export interface ConfigItemInstanceSelect extends ConfigItem {
|
|
|
825
863
|
}
|
|
826
864
|
export interface ConfigItemFile extends ConfigItem {
|
|
827
865
|
type: 'file';
|
|
828
|
-
/** if a user can manually enter the file name and not only through select dialog */
|
|
866
|
+
/** if a user can manually enter the file name and not only through a select dialog */
|
|
829
867
|
disableEdit?: boolean;
|
|
830
868
|
/** limit selection to one specific object of type `meta` and the following path (not mandatory) */
|
|
831
869
|
limitPath?: string;
|
|
@@ -841,7 +879,7 @@ export interface ConfigItemFile extends ConfigItem {
|
|
|
841
879
|
allowView?: boolean;
|
|
842
880
|
/** show toolbar (default true) */
|
|
843
881
|
showToolbar?: boolean;
|
|
844
|
-
/** user can select only folders (e.g., for uploading path) */
|
|
882
|
+
/** user can select only folders (e.g., for the uploading path) */
|
|
845
883
|
selectOnlyFolders?: boolean;
|
|
846
884
|
/** trim the filename */
|
|
847
885
|
trim?: boolean;
|
|
@@ -852,15 +890,15 @@ export interface ConfigItemFile extends ConfigItem {
|
|
|
852
890
|
}
|
|
853
891
|
export interface ConfigItemFileSelector extends ConfigItem {
|
|
854
892
|
type: 'fileSelector';
|
|
855
|
-
/** File extension pattern. Allowed `**\/*.ext` to show all files from subfolders too, `*.ext` to show from root folder or `folderName\/*.ext` to show all files in
|
|
893
|
+
/** File extension pattern. Allowed `**\/*.ext` to show all files from subfolders too, `*.ext` to show from the root folder or `folderName\/*.ext` to show all files in subfolder `folderName`. Default `**\/*.*`. */
|
|
856
894
|
pattern: string;
|
|
857
895
|
/** type of files: `audio`, `image`, `text` */
|
|
858
896
|
fileTypes?: 'audio' | 'image' | 'text';
|
|
859
|
-
/** Object ID of type `meta`. You can use special placeholder `%INSTANCE%`: like `myAdapter.%INSTANCE%.files` */
|
|
897
|
+
/** Object ID of the type `meta`. You can use special placeholder `%INSTANCE%`: like `myAdapter.%INSTANCE%.files` */
|
|
860
898
|
objectID?: string;
|
|
861
899
|
/** path, where the uploaded files will be stored. Like `folderName`. If not defined, no upload field will be shown. To upload in the root, set this field to `/`. */
|
|
862
900
|
upload?: string;
|
|
863
|
-
/** Show refresh button near the select. */
|
|
901
|
+
/** Show the refresh button near the select. */
|
|
864
902
|
refresh?: boolean;
|
|
865
903
|
/** max file size (default 2MB) */
|
|
866
904
|
maxSize?: number;
|
|
@@ -873,43 +911,7 @@ export interface ConfigItemFileSelector extends ConfigItem {
|
|
|
873
911
|
/** Do not show the size of files */
|
|
874
912
|
noSize?: boolean;
|
|
875
913
|
}
|
|
876
|
-
export type ConfigItemAny = ConfigItemAlive | ConfigItemAutocomplete | ConfigItemAutocompleteSendTo | ConfigItemPanel | ConfigItemTabs | ConfigItemText | ConfigItemNumber | ConfigItemOAuth2 | ConfigItemColor | ConfigItemCheckbox | ConfigItemSlider | ConfigItemIP | ConfigItemInfoBox | ConfigItemUser | ConfigItemRoom | ConfigItemFunc | ConfigItemSelect | ConfigItemAccordion | ConfigItemCoordinates | ConfigItemDivider | ConfigItemHeader | ConfigItemCustom | ConfigItemDatePicker | ConfigItemDeviceManager | ConfigItemLanguage | ConfigItemPort | ConfigItemSendTo | ConfigItemState | ConfigItemTable | ConfigItemTimePicker | ConfigItemTextSendTo | ConfigItemSelectSendTo | ConfigItemCertCollection | ConfigItemCertificateSelect | ConfigItemCertificates | ConfigItemUUID | ConfigItemCheckDocker | ConfigItemCheckLicense | ConfigItemPattern | ConfigItemChip | ConfigItemCRON | ConfigItemFile | ConfigItemFileSelector | ConfigItemImageSendTo | ConfigItemInstanceSelect | ConfigItemImageUpload | ConfigItemInterface | ConfigItemJsonEditor | ConfigItemLicense | ConfigItemPassword | ConfigItemSetState | ConfigItemStaticDivider | ConfigItemStaticHeader | ConfigItemStaticInfo | ConfigItemStaticImage | ConfigItemStaticText | ConfigItemTopic | ConfigItemObjectId | ConfigItemQrCode;
|
|
877
|
-
export type BackEndCommandType = 'nop' | 'refresh' | 'link' | 'message';
|
|
878
|
-
export interface BackEndCommandGeneric {
|
|
879
|
-
command: BackEndCommandType;
|
|
880
|
-
/** New GUI schema */
|
|
881
|
-
schema?: ConfigItemPanel | ConfigItemTabs;
|
|
882
|
-
/** New GUI data */
|
|
883
|
-
data?: Record<string, any>;
|
|
884
|
-
refresh?: boolean;
|
|
885
|
-
}
|
|
886
|
-
export interface BackEndCommandNoOperation extends BackEndCommandGeneric {
|
|
887
|
-
command: 'nop';
|
|
888
|
-
}
|
|
889
|
-
export interface BackEndCommandRefresh extends BackEndCommandGeneric {
|
|
890
|
-
command: 'refresh';
|
|
891
|
-
/** If refresh the GUI */
|
|
892
|
-
fullRefresh?: boolean;
|
|
893
|
-
}
|
|
894
|
-
export interface BackEndCommandOpenLink extends BackEndCommandGeneric {
|
|
895
|
-
command: 'link';
|
|
896
|
-
/** Link url. Could be relative ('#blabla') or absolute ('https://blabla') */
|
|
897
|
-
url: string;
|
|
898
|
-
/** Target of the link. Default is `_self` for relative and '_blank' for absolute links */
|
|
899
|
-
target?: '_self' | '_blank' | string;
|
|
900
|
-
/** If GUI should be closed after the link was opened (Only for target='_self') */
|
|
901
|
-
close?: boolean;
|
|
902
|
-
}
|
|
903
|
-
export interface BackEndCommandMessage extends BackEndCommandGeneric {
|
|
904
|
-
command: 'message';
|
|
905
|
-
/** Message text */
|
|
906
|
-
message: ioBroker.StringOrTranslated;
|
|
907
|
-
/** If GUI should be closed after the message shown */
|
|
908
|
-
close?: boolean;
|
|
909
|
-
/** Type of message. Default is 'popup' */
|
|
910
|
-
variant: 'popup' | 'dialog';
|
|
911
|
-
}
|
|
912
|
-
export type BackEndCommand = BackEndCommandMessage | BackEndCommandOpenLink | BackEndCommandRefresh;
|
|
914
|
+
export type ConfigItemAny = ConfigItemAlive | ConfigItemAutocomplete | ConfigItemAutocompleteSendTo | ConfigItemPanel | ConfigItemTabs | ConfigItemText | ConfigItemNumber | ConfigItemOAuth2 | ConfigItemColor | ConfigItemCheckbox | ConfigItemSlider | ConfigItemIP | ConfigItemInfoBox | ConfigItemUser | ConfigItemRoom | ConfigItemFunc | ConfigItemSelect | ConfigItemAccordion | ConfigItemCoordinates | ConfigItemDivider | ConfigItemHeader | ConfigItemCustom | ConfigItemDatePicker | ConfigItemDeviceManager | ConfigItemLanguage | ConfigItemPort | ConfigItemSendTo | ConfigItemState | ConfigItemTable | ConfigItemTimePicker | ConfigItemTextSendTo | ConfigItemSelectSendTo | ConfigItemCertCollection | ConfigItemCertificateSelect | ConfigItemCertificates | ConfigItemUUID | ConfigItemCheckDocker | ConfigItemCheckLicense | ConfigItemPattern | ConfigItemChip | ConfigItemCRON | ConfigItemFile | ConfigItemFileSelector | ConfigItemIFrame | ConfigItemIFrameSendTo | ConfigItemImageSendTo | ConfigItemInstanceSelect | ConfigItemImageUpload | ConfigItemInterface | ConfigItemJsonEditor | ConfigItemYamlEditor | ConfigItemLicense | ConfigItemPassword | ConfigItemSetState | ConfigItemStaticDivider | ConfigItemStaticHeader | ConfigItemStaticInfo | ConfigItemStaticImage | ConfigItemStaticText | ConfigItemTopic | ConfigItemObjectId | ConfigItemQrCode;
|
|
913
915
|
export type ActionButton = {
|
|
914
916
|
label: ioBroker.StringOrTranslated;
|
|
915
917
|
type: 'apply' | 'cancel' | 'copyToClipboard';
|
|
@@ -941,8 +943,8 @@ export type BackEndCommandJsonFormOptions = {
|
|
|
941
943
|
};
|
|
942
944
|
export type JsonFormSchema = ConfigItemPanel | ConfigItemTabs;
|
|
943
945
|
export type JsonFormData = Record<string, any>;
|
|
944
|
-
export interface DeviceDetails {
|
|
945
|
-
id:
|
|
946
|
+
export interface DeviceDetails<TId extends DeviceId = DeviceId> {
|
|
947
|
+
id: TId;
|
|
946
948
|
schema: JsonFormSchema;
|
|
947
949
|
data?: JsonFormData;
|
|
948
950
|
}
|
package/build/types/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type * from './adapter';
|
|
2
|
+
export { ACTIONS, type ChannelInfo, type Color, type ControlBase, type ControlState, type BackendToGuiCommand, type BackendToGuiCommandAllUpdate, type BackendToGuiCommandDeviceDelete, type BackendToGuiCommandDeviceStatusUpdate, type BackendToGuiCommandDeviceInfoUpdate, type DeviceRefresh, } from './base';
|
|
2
3
|
export type * from './common';
|
|
3
4
|
export * from './errorCodes';
|
|
4
|
-
export { type ChannelInfo, type Color, type ControlState, type ControlBase, ACTIONS } from './base';
|
package/build/types/index.js
CHANGED
|
@@ -15,6 +15,6 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
exports.ACTIONS = void 0;
|
|
18
|
-
__exportStar(require("./errorCodes"), exports);
|
|
19
18
|
var base_1 = require("./base");
|
|
20
19
|
Object.defineProperty(exports, "ACTIONS", { enumerable: true, get: function () { return base_1.ACTIONS; } });
|
|
20
|
+
__exportStar(require("./errorCodes"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@iobroker/dm-utils",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "ioBroker Device Manager utilities for backend",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"publishConfig": {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"build": "tsc -p tsconfig.json",
|
|
16
16
|
"test:package": "node -e \"process.exit(0)\"",
|
|
17
17
|
"lint": "eslint -c eslint.config.mjs src",
|
|
18
|
-
"updateCommonTs": "
|
|
18
|
+
"updateCommonTs": "npx -y tsx tasks.ts",
|
|
19
19
|
"prettier": "prettier -u -w examples src",
|
|
20
20
|
"release": "release-script",
|
|
21
21
|
"release-patch": "release-script patch --yes",
|
|
@@ -30,13 +30,17 @@
|
|
|
30
30
|
"@iobroker/adapter-core": "^3.3.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@
|
|
34
|
-
"@alcalzone/release-script
|
|
33
|
+
"@iobroker/types": "^7.1.1-alpha.0-20260127-997e40b73",
|
|
34
|
+
"@alcalzone/release-script": "^5.1.1",
|
|
35
|
+
"@alcalzone/release-script-plugin-license": "^5.1.1",
|
|
35
36
|
"@iobroker/eslint-config": "^2.2.0",
|
|
36
|
-
"@types/node": "^25.0
|
|
37
|
-
"axios": "^1.13.
|
|
37
|
+
"@types/node": "^25.5.0",
|
|
38
|
+
"axios": "^1.13.6",
|
|
38
39
|
"typescript": "~5.9.3"
|
|
39
40
|
},
|
|
41
|
+
"overrides": {
|
|
42
|
+
"@iobroker/types": "$@iobroker/types"
|
|
43
|
+
},
|
|
40
44
|
"files": [
|
|
41
45
|
"LICENSE",
|
|
42
46
|
"README.md",
|