@iobroker/dm-utils 1.0.2 → 1.0.5

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
@@ -301,9 +301,9 @@ This method returns a promise that resolves to a `ProgressDialog` object.
301
301
  ### **WORK IN PROGRESS**
302
302
  -->
303
303
  ## Changelog
304
- ### 1.0.2 (2025-01-09)
304
+ ### 1.0.5 (2025-01-11)
305
305
 
306
- * (@GermanBluefox) Added description for `disabled` control and `status` action.
306
+ * (@GermanBluefox) Added action ENABLE_DISABLE and `enabled` status
307
307
 
308
308
  ### 1.0.0 (2025-01-08)
309
309
 
@@ -320,11 +320,11 @@ This method returns a promise that resolves to a `ProgressDialog` object.
320
320
 
321
321
  ### 0.6.9 (2024-11-22)
322
322
 
323
- * (@GermanBluefox) Added max-width option for form
323
+ * (@GermanBluefox) Added a max-width option for form
324
324
 
325
325
  ### 0.6.8 (2024-11-22)
326
326
 
327
- * (@GermanBluefox) Allow grouping of devices
327
+ * (@GermanBluefox) Allowed grouping of devices
328
328
 
329
329
  ### 0.6.7 (2024-11-20)
330
330
 
@@ -7,9 +7,8 @@ export type ControlState = string | number | boolean | null;
7
7
  export declare const ACTIONS: {
8
8
  /** This action will be called when user clicks on connection icon */
9
9
  STATUS: string;
10
- /** This action will be called when user clicks on connection icon */
11
- DISABLE: string;
12
- ENABLE: string;
10
+ /** This action will be called when the user clicks on enabled/disabled icon. The enabled/disabled icon will be shown only if the node status has "enabled" flag set to false or true */
11
+ ENABLE_DISABLE: string;
13
12
  };
14
13
  export interface ActionBase<T extends ActionType> {
15
14
  /** Unique (for this adapter) action ID. It could be the name from ACTIONS too, but in this case some predefined appearance will be applied */
@@ -99,16 +98,26 @@ export interface InstanceDetails<T extends ActionType = 'api'> {
99
98
  actions?: InstanceAction<T>[];
100
99
  }
101
100
  export interface DeviceInfo<T extends ActionType = 'api'> {
101
+ /** ID of the action. Should be unique only in one adapter. Other adapters could have same names */
102
102
  id: string;
103
+ /** Name of the device. It will be shown in the card header */
104
+ name: ioBroker.StringOrTranslated;
105
+ /** base64 or url icon for device card */
103
106
  icon?: string;
104
107
  manufacturer?: ioBroker.StringOrTranslated;
105
108
  model?: ioBroker.StringOrTranslated;
109
+ /** Color or 'primary', 'secondary' for the text in the card header */
106
110
  color?: Color;
111
+ /** Background color of card header (you can use primary, secondary or color rgb value or hex) */
107
112
  backgroundColor?: Color;
108
- name: ioBroker.StringOrTranslated;
109
113
  status?: DeviceStatus | DeviceStatus[];
114
+ /** If this flag is true or false, the according indication will be shown. Additionally, if ACTIONS.ENABLE_DISABLE is implemented, this action will be sent to backend by clicking on this indication */
115
+ enabled?: boolean;
116
+ /** List of actions on the card */
110
117
  actions?: DeviceAction<T>[];
118
+ /** List of controls on the card. The difference of controls and actions is that the controls can show status (e.g. on/off) and can work directly with states */
111
119
  controls?: DeviceControl<T>[];
120
+ /** If true, the button `more` will be shown on the card and called `dm:deviceDetails` action to get the details */
112
121
  hasDetails?: boolean;
113
122
  /** Device type for grouping */
114
123
  group?: {
@@ -5,7 +5,6 @@ exports.ACTIONS = void 0;
5
5
  exports.ACTIONS = {
6
6
  /** This action will be called when user clicks on connection icon */
7
7
  STATUS: 'status',
8
- /** This action will be called when user clicks on connection icon */
9
- DISABLE: 'disable',
10
- ENABLE: 'enable',
8
+ /** This action will be called when the user clicks on enabled/disabled icon. The enabled/disabled icon will be shown only if the node status has "enabled" flag set to false or true */
9
+ ENABLE_DISABLE: 'enable/disable',
11
10
  };
@@ -1,9 +1,6 @@
1
1
  export type ApiVersion = 'v1';
2
+ export type ConfigIconType = 'add' | 'backlight' | 'delete' | 'dimmer' | 'edit' | 'group' | 'identify' | 'info' | 'light' | 'lines' | 'next' | 'pair' | 'pause' | 'play' | 'previous' | 'qrcode' | 'refresh' | 'search' | 'settings' | 'socket' | 'stop' | 'unpair' | 'user' | string;
2
3
  export type DeviceStatus = 'connected' | 'disconnected' | {
3
- /**
4
- * This can either be the name of a font awesome icon (e.g. "fa-signal") or the URL to an icon.
5
- */
6
- icon?: string;
7
4
  battery?: number | boolean | 'charging' | string;
8
5
  connection?: 'connected' | 'disconnected';
9
6
  rssi?: number;
@@ -13,7 +10,8 @@ export type ActionButton = {
13
10
  label: ioBroker.StringOrTranslated;
14
11
  type: 'apply' | 'cancel';
15
12
  noTranslation?: boolean;
16
- icon?: string;
13
+ /** base64 or icon name */
14
+ icon?: ConfigIconType;
17
15
  variant?: 'contained' | 'outlined' | 'text';
18
16
  style?: Record<string, number | string>;
19
17
  color?: 'primary' | 'secondary';
@@ -40,7 +38,6 @@ interface ObjectBrowserCustomFilter {
40
38
  }
41
39
  export type ObjectBrowserType = 'state' | 'instance' | 'channel' | 'device' | 'chart';
42
40
  export type ConfigItemType = 'tabs' | 'panel' | 'text' | 'number' | 'color' | 'checkbox' | 'slider' | 'ip' | 'user' | 'room' | 'func' | 'select' | 'autocomplete' | 'image' | 'objectId' | 'password' | 'instance' | 'chips' | 'alive' | 'pattern' | 'sendto' | 'setState' | 'staticInfo' | 'staticText' | 'staticLink' | 'staticImage' | 'table' | 'accordion' | 'jsonEditor' | 'language' | 'certificate' | 'certificates' | 'certCollection' | 'custom' | 'datePicker' | 'timePicker' | 'divider' | 'header' | 'cron' | 'fileSelector' | 'file' | 'imageSendTo' | 'selectSendTo' | 'autocompleteSendTo' | 'textSendTo' | 'coordinates' | 'interface' | 'license' | 'checkLicense' | 'uuid' | 'port' | 'deviceManager' | 'topic' | 'qrCode' | 'state';
43
- type ConfigIconType = 'edit' | 'auth' | 'send' | 'web' | 'warning' | 'error' | 'info' | 'search' | 'book' | 'help' | 'upload' | 'user' | 'group' | 'delete' | 'refresh' | 'add' | 'unpair' | 'pair' | string;
44
41
  export interface ConfigItemConfirmData {
45
42
  condition: string;
46
43
  text?: ioBroker.StringOrTranslated;
@@ -358,7 +355,7 @@ export interface ConfigItemStaticInfo extends Omit<ConfigItem, 'data'> {
358
355
  labelIcon?: string;
359
356
  /** Unit */
360
357
  unit?: ioBroker.StringOrTranslated;
361
- /** 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*/
358
+ /** 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*/
362
359
  narrow?: boolean;
363
360
  /** Add to label the colon at the end if not exist in label */
364
361
  addColon?: boolean;
@@ -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.2",
3
+ "version": "1.0.5",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {