@iobroker/dm-utils 1.0.1 → 1.0.3

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
@@ -206,9 +206,6 @@ The returned object must contain:
206
206
 
207
207
  This method can be implemented asynchronously and can take a lot of time to complete.
208
208
 
209
- Reserved control names:
210
- - `disabled` - The disabled control has its own pre-defined place on the device card and is used to disable the device. The state of this control is boolean.
211
-
212
209
  ### `handleDeviceControlState(deviceId: string, controlId: string, context: MessageContext)
213
210
 
214
211
  This method is called when GUI requests the update of the state.
@@ -234,6 +231,8 @@ For interactions, there are methods you can call on `context`:
234
231
 
235
232
  There are some reserved action names, you can find the list below:
236
233
  - `status` - This action is called when the user clicks on the status icon. So to implement the "click-on-status" functionality, the developer has to implement this action.
234
+ - `disable` - This action will be called when the user clicks on the `enabled` icon. `disable` and `enable` actions cannot be together.
235
+ - `enable` - This action will be called when the user clicks on the `disabled` icon. `disable` and `enable` actions cannot be together.
237
236
 
238
237
  ### `showMessage(text: ioBroker.StringOrTranslated)`
239
238
 
@@ -302,7 +301,7 @@ This method returns a promise that resolves to a `ProgressDialog` object.
302
301
  ### **WORK IN PROGRESS**
303
302
  -->
304
303
  ## Changelog
305
- ### 1.0.1 (2025-01-09)
304
+ ### 1.0.3 (2025-01-09)
306
305
 
307
306
  * (@GermanBluefox) Added description for `disabled` control and `status` action.
308
307
 
@@ -3,7 +3,16 @@ import type { ApiVersion, DeviceRefresh, DeviceStatus, RetVal } from './common';
3
3
  type ActionType = 'api' | 'adapter';
4
4
  export type Color = 'primary' | 'secondary' | (string & {});
5
5
  export type ControlState = string | number | boolean | null;
6
+ /** Reserved action names */
7
+ export declare const ACTIONS: {
8
+ /** This action will be called when user clicks on connection icon */
9
+ STATUS: string;
10
+ /** This action will be called when user clicks on connection icon */
11
+ DISABLE: string;
12
+ ENABLE: string;
13
+ };
6
14
  export interface ActionBase<T extends ActionType> {
15
+ /** Unique (for this adapter) action ID. It could be the name from ACTIONS too, but in this case some predefined appearance will be applied */
7
16
  id: string;
8
17
  /**
9
18
  * This can either be base64 or the URL to an icon.
@@ -1,2 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ACTIONS = void 0;
4
+ /** Reserved action names */
5
+ exports.ACTIONS = {
6
+ /** This action will be called when user clicks on connection icon */
7
+ STATUS: 'status',
8
+ /** This action will be called when user clicks on connection icon */
9
+ DISABLE: 'disable',
10
+ ENABLE: 'enable',
11
+ };
@@ -1,4 +1,4 @@
1
1
  export type * from './adapter';
2
2
  export type * from './common';
3
3
  export * from './errorCodes';
4
- export type { ChannelInfo, Color, ControlState, ControlBase } from './base';
4
+ export { type ChannelInfo, type Color, type ControlState, type ControlBase, ACTIONS } from './base';
@@ -14,4 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.ACTIONS = void 0;
17
18
  __exportStar(require("./errorCodes"), exports);
19
+ var base_1 = require("./base");
20
+ Object.defineProperty(exports, "ACTIONS", { enumerable: true, get: function () { return base_1.ACTIONS; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {