@iobroker/dm-utils 0.6.10 → 1.0.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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023-2024 ioBroker Community Developers
3
+ Copyright (c) 2023-2025 ioBroker Community Developers
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -295,6 +295,15 @@ This method returns a promise that resolves to a `ProgressDialog` object.
295
295
  ### **WORK IN PROGRESS**
296
296
  -->
297
297
  ## Changelog
298
+ ### 1.0.0 (2025-01-08)
299
+
300
+ * (@GermanBluefox) Added `disabled` options for a device
301
+ * (@GermanBluefox) Major release just because is good enough. No breaking changes.
302
+
303
+ ### 0.6.11 (2024-12-11)
304
+
305
+ * (@GermanBluefox) Do not close handler for progress
306
+
298
307
  ### 0.6.10 (2024-12-10)
299
308
 
300
309
  * (@GermanBluefox) Export `BackEndCommandJsonFormOptions` type
@@ -362,7 +371,7 @@ This method returns a promise that resolves to a `ProgressDialog` object.
362
371
  ## License
363
372
  MIT License
364
373
 
365
- Copyright (c) 2023-2024 ioBroker Community Developers
374
+ Copyright (c) 2023-2025 ioBroker Community Developers
366
375
 
367
376
  Permission is hereby granted, free of charge, to any person obtaining a copy
368
377
  of this software and associated documentation files (the "Software"), to deal
@@ -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;
@@ -101,6 +101,8 @@ export interface DeviceInfo<T extends ActionType = 'api'> {
101
101
  actions?: DeviceAction<T>[];
102
102
  controls?: DeviceControl<T>[];
103
103
  hasDetails?: boolean;
104
+ /** undefined means, no "disabled" possibility, true means disabled, false means enabled */
105
+ disabled?: boolean;
104
106
  group?: {
105
107
  key: string;
106
108
  name?: ioBroker.StringOrTranslated;
@@ -854,7 +854,7 @@ export type BackEndCommand = BackEndCommandMessage | BackEndCommandOpenLink | Ba
854
854
  export type BackEndCommandJsonFormOptions = {
855
855
  data?: JsonFormData;
856
856
  title?: ioBroker.StringOrTranslated;
857
- buttons?: (ActionButton | 'apply' | 'cancel')[];
857
+ buttons?: (ActionButton | 'apply' | 'cancel' | 'close')[];
858
858
  maxWidth?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
859
859
  noTranslation?: boolean;
860
860
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "0.6.10",
3
+ "version": "1.0.0",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {
@@ -16,7 +16,7 @@
16
16
  "release-patch": "release-script patch --yes",
17
17
  "release-minor": "release-script minor --yes",
18
18
  "release-major": "release-script major --yes",
19
- "update-packages": "ncu --upgrade",
19
+ "update-packages": "npx -y npm-check-updates --upgrade",
20
20
  "npm": "npm i -f"
21
21
  },
22
22
  "author": "UncleSamSwiss",
@@ -28,7 +28,7 @@
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.10.1",
31
+ "@types/node": "^22.10.5",
32
32
  "axios": "^1.7.9",
33
33
  "typescript": "^5.7.2"
34
34
  },