@iobroker/dm-utils 0.6.0 → 0.6.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 CHANGED
@@ -295,6 +295,10 @@ This method returns a promise that resolves to a `ProgressDialog` object.
295
295
  ### **WORK IN PROGRESS**
296
296
  -->
297
297
  ## Changelog
298
+ ### 0.6.2 (2024-11-18)
299
+
300
+ * (@GermanBluefox) Added configurable buttons for form
301
+
298
302
  ### 0.6.0 (2024-11-17)
299
303
 
300
304
  * (@GermanBluefox) used new ioBroker/eslint-config lib and changed prettifier settings
@@ -1,4 +1,4 @@
1
- import type { JsonFormData, JsonFormSchema } from '.';
1
+ import type { ActionButton, JsonFormData, JsonFormSchema } from '.';
2
2
  import type { ProgressDialog } from './ProgressDialog';
3
3
  export interface ActionContext {
4
4
  showMessage(text: ioBroker.StringOrTranslated): Promise<void>;
@@ -6,6 +6,7 @@ export interface ActionContext {
6
6
  showForm(schema: JsonFormSchema, options?: {
7
7
  data?: JsonFormData;
8
8
  title?: ioBroker.StringOrTranslated;
9
+ buttons?: ActionButton[];
9
10
  }): Promise<JsonFormData | undefined>;
10
11
  openProgress(title: string, options?: {
11
12
  indeterminate?: boolean;
@@ -1,7 +1,7 @@
1
1
  import type { AdapterInstance } from '@iobroker/adapter-core';
2
2
  import type { ActionContext } from './ActionContext';
3
3
  import type { ProgressDialog } from './ProgressDialog';
4
- import { type DeviceDetails, type DeviceInfo, type ErrorResponse, type InstanceDetails, type JsonFormData, type JsonFormSchema, type RefreshResponse, type RetVal } from './types';
4
+ import { type DeviceDetails, type DeviceInfo, type ErrorResponse, type InstanceDetails, type JsonFormData, type JsonFormSchema, type RefreshResponse, type RetVal, type ActionButton } from './types';
5
5
  import type { ControlState } from './types/base';
6
6
  export declare abstract class DeviceManagement<T extends AdapterInstance = AdapterInstance> {
7
7
  protected readonly adapter: T;
@@ -41,7 +41,8 @@ export declare class MessageContext implements ActionContext {
41
41
  showConfirmation(text: ioBroker.StringOrTranslated): Promise<boolean>;
42
42
  showForm(schema: JsonFormSchema, options?: {
43
43
  data?: JsonFormData;
44
- title?: string;
44
+ title?: ioBroker.StringOrTranslated;
45
+ buttons?: ActionButton[];
45
46
  }): Promise<JsonFormData | undefined>;
46
47
  openProgress(title: string, options?: {
47
48
  indeterminate?: boolean;
@@ -9,6 +9,14 @@ export type DeviceStatus = 'connected' | 'disconnected' | {
9
9
  rssi?: number;
10
10
  warning?: ioBroker.StringOrTranslated | boolean;
11
11
  };
12
+ export type ActionButton = {
13
+ label: ioBroker.StringOrTranslated;
14
+ type: 'apply' | 'cancel';
15
+ icon?: string;
16
+ variant?: 'contained' | 'outlined' | 'text';
17
+ style?: Record<string, number | string>;
18
+ color: 'primary' | 'secondary';
19
+ } | 'apply' | 'cancel';
12
20
  export type DeviceRefresh = 'device' | 'instance' | false | true;
13
21
  export type RefreshResponse = {
14
22
  refresh: DeviceRefresh;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@iobroker/dm-utils",
3
- "version": "0.6.0",
3
+ "version": "0.6.2",
4
4
  "description": "ioBroker Device Manager utilities for backend",
5
5
  "main": "build/index.js",
6
6
  "publishConfig": {