@iobroker/dm-utils 0.6.9 → 0.6.11

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 CHANGED
@@ -295,6 +295,14 @@ This method returns a promise that resolves to a `ProgressDialog` object.
295
295
  ### **WORK IN PROGRESS**
296
296
  -->
297
297
  ## Changelog
298
+ ### 0.6.11 (2024-12-11)
299
+
300
+ * (@GermanBluefox) Do not close handler for progress
301
+
302
+ ### 0.6.10 (2024-12-10)
303
+
304
+ * (@GermanBluefox) Export `BackEndCommandJsonFormOptions` type
305
+
298
306
  ### 0.6.9 (2024-11-22)
299
307
 
300
308
  * (@GermanBluefox) Added max-width option for form
@@ -1,14 +1,9 @@
1
- import type { ActionButton, JsonFormData, JsonFormSchema } from '.';
1
+ import type { BackEndCommandJsonFormOptions, JsonFormData, JsonFormSchema } from '.';
2
2
  import type { ProgressDialog } from './ProgressDialog';
3
3
  export interface ActionContext {
4
4
  showMessage(text: ioBroker.StringOrTranslated): Promise<void>;
5
5
  showConfirmation(text: ioBroker.StringOrTranslated): Promise<boolean>;
6
- showForm(schema: JsonFormSchema, options?: {
7
- data?: JsonFormData;
8
- title?: ioBroker.StringOrTranslated;
9
- buttons?: (ActionButton | 'apply' | 'cancel')[];
10
- maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
11
- }): Promise<JsonFormData | undefined>;
6
+ showForm(schema: JsonFormSchema, options?: BackEndCommandJsonFormOptions): Promise<JsonFormData | undefined>;
12
7
  openProgress(title: string, options?: {
13
8
  indeterminate?: boolean;
14
9
  value?: number;
@@ -42,7 +42,7 @@ export declare class MessageContext implements ActionContext {
42
42
  showForm(schema: JsonFormSchema, options?: {
43
43
  data?: JsonFormData;
44
44
  title?: ioBroker.StringOrTranslated;
45
- buttons?: (ActionButton | 'apply' | 'cancel')[];
45
+ buttons?: (ActionButton | 'apply' | 'cancel' | 'close')[];
46
46
  }): Promise<JsonFormData | undefined>;
47
47
  openProgress(title: string, options?: {
48
48
  indeterminate?: boolean;
@@ -341,7 +341,7 @@ class MessageContext {
341
341
  });
342
342
  this.send('progress', {
343
343
  progress: Object.assign(Object.assign(Object.assign({ title }, options), update), { open: true }),
344
- });
344
+ }, true);
345
345
  return promise;
346
346
  },
347
347
  close: () => {
@@ -362,7 +362,7 @@ class MessageContext {
362
362
  });
363
363
  this.send('progress', {
364
364
  progress: Object.assign(Object.assign({ title }, options), { open: true }),
365
- });
365
+ }, true);
366
366
  return promise;
367
367
  }
368
368
  sendFinalResult(result) {
@@ -403,12 +403,15 @@ class MessageContext {
403
403
  throw new Error("Can't show another dialog while a progress dialog is open. Please call 'close()' on the dialog before opening another dialog.");
404
404
  }
405
405
  }
406
- send(type, message) {
406
+ send(type, message, doNotClose) {
407
407
  if (!this.lastMessage) {
408
408
  throw new Error("No outstanding message, can't send a new one");
409
409
  }
410
410
  this.adapter.sendTo(this.lastMessage.from, this.lastMessage.command, Object.assign(Object.assign({}, message), { type, origin: this.lastMessage.message.origin || this.lastMessage._id }), this.lastMessage.callback);
411
- this.lastMessage = undefined;
411
+ if (!doNotClose) {
412
+ // "progress" is exception. It will be closed with "close" flag
413
+ this.lastMessage = undefined;
414
+ }
412
415
  }
413
416
  }
414
417
  exports.MessageContext = MessageContext;
@@ -103,6 +103,8 @@ export interface ConfigItem {
103
103
  ignoreOwnChanges?: boolean;
104
104
  };
105
105
  doNotSave?: boolean;
106
+ /** If the control should be shown ONLY in the expert mode */
107
+ expertMode?: boolean;
106
108
  noMultiEdit?: boolean;
107
109
  confirm?: ConfigItemConfirmData;
108
110
  icon?: ConfigIconType;
@@ -817,7 +819,7 @@ export type BackEndCommandType = 'nop' | 'refresh' | 'link' | 'message';
817
819
  export interface BackEndCommandGeneric {
818
820
  command: BackEndCommandType;
819
821
  /** New GUI schema */
820
- schema?: ConfigItemPanel;
822
+ schema?: ConfigItemPanel | ConfigItemTabs;
821
823
  /** New GUI data */
822
824
  data?: Record<string, any>;
823
825
  refresh?: boolean;
@@ -849,6 +851,13 @@ export interface BackEndCommandMessage extends BackEndCommandGeneric {
849
851
  variant: 'popup' | 'dialog';
850
852
  }
851
853
  export type BackEndCommand = BackEndCommandMessage | BackEndCommandOpenLink | BackEndCommandRefresh;
854
+ export type BackEndCommandJsonFormOptions = {
855
+ data?: JsonFormData;
856
+ title?: ioBroker.StringOrTranslated;
857
+ buttons?: (ActionButton | 'apply' | 'cancel' | 'close')[];
858
+ maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
859
+ noTranslation?: boolean;
860
+ };
852
861
  export type JsonFormSchema = ConfigItemPanel | ConfigItemTabs;
853
862
  export type JsonFormData = Record<string, any>;
854
863
  export interface DeviceDetails {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {
@@ -22,15 +22,15 @@
22
22
  "author": "UncleSamSwiss",
23
23
  "license": "MIT",
24
24
  "dependencies": {
25
- "@iobroker/adapter-core": "^3.2.2"
25
+ "@iobroker/adapter-core": "^3.2.3"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@alcalzone/release-script": "^3.8.0",
29
29
  "@alcalzone/release-script-plugin-license": "^3.7.0",
30
30
  "@iobroker/eslint-config": "^1.0.0",
31
- "@types/node": "^22.9.1",
32
- "axios": "^1.7.7",
33
- "typescript": "^5.6.3"
31
+ "@types/node": "^22.10.2",
32
+ "axios": "^1.7.9",
33
+ "typescript": "^5.7.2"
34
34
  },
35
35
  "files": [
36
36
  "LICENSE",