chayns-api 2.4.2 → 2.4.4

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.
@@ -315,7 +315,10 @@ class FrameWrapper {
315
315
  value
316
316
  }) => {
317
317
  if (this.initialized) {
318
- this.values[type] = value;
318
+ this.values = {
319
+ ...this.values,
320
+ [type]: value
321
+ };
319
322
  }
320
323
  document.dispatchEvent(new CustomEvent('chayns_api_data', {
321
324
  detail: {
@@ -324,7 +324,10 @@ export class FrameWrapper {
324
324
  value
325
325
  } = _ref;
326
326
  if (this.initialized) {
327
- this.values[type] = value;
327
+ this.values = {
328
+ ...this.values,
329
+ [type]: value
330
+ };
328
331
  }
329
332
  document.dispatchEvent(new CustomEvent('chayns_api_data', {
330
333
  detail: {
@@ -132,8 +132,8 @@ export declare enum DialogSelectType {
132
132
  IMAGE = 2,
133
133
  SIMPLE = 3
134
134
  }
135
- export type DialogSelectListItemType = {
136
- id: number | string;
135
+ export type DialogSelectListItemType<T extends number | string = number | string> = {
136
+ id: T;
137
137
  name: string;
138
138
  subtitle?: string;
139
139
  disabled?: boolean;
@@ -145,10 +145,10 @@ export type DialogSelectListItemType = {
145
145
  className?: string;
146
146
  icon?: string;
147
147
  };
148
- export interface DialogSelect {
148
+ export interface DialogSelect<T extends number | string = number | string> {
149
149
  type: DialogType.SELECT;
150
- list: DialogSelectListItemType[];
151
- fixedItem?: DialogSelectListItemType & {
150
+ list: DialogSelectListItemType<T>[];
151
+ fixedItem?: DialogSelectListItemType<T> & {
152
152
  position?: 'top' | 'bottom';
153
153
  };
154
154
  multiselect?: boolean;
@@ -410,7 +410,7 @@ export interface ChaynsReactFunctions {
410
410
  setOverlay: (value: ShowOverlay, callback: () => void) => Promise<void>;
411
411
  createDialog(config: BaseDialog & (DialogAlert | DialogConfirm | DialogToast)): DialogHandler<void>;
412
412
  createDialog(config: BaseDialog & (DialogInput | DialogSignature)): DialogHandler<string>;
413
- createDialog(config: BaseDialog & DialogSelect): DialogHandler<(number | string)[]>;
413
+ createDialog<T extends number | string = number | string>(config: BaseDialog & DialogSelect<T>): DialogHandler<T[]>;
414
414
  createDialog(config: BaseDialog & DialogDate & ({
415
415
  multiselect: true;
416
416
  } | {
@@ -418,7 +418,8 @@ export interface ChaynsReactFunctions {
418
418
  })): DialogHandler<Date[]>;
419
419
  createDialog(config: BaseDialog & DialogDate): DialogHandler<Date>;
420
420
  createDialog(config: BaseDialog & DialogFileSelect): DialogHandler<DialogResultFile[]>;
421
- createDialog<I = any, R = unknown>(config: BaseDialog & (DialogModule<I> | DialogIFrame<I>)): DialogHandler<R>;
421
+ createDialog<Input = any, Result = unknown>(config: BaseDialog & (DialogModule<Input> | DialogIFrame<Input>)): DialogHandler<Result>;
422
+ createDialog<Input = any, Result = unknown>(config: BaseDialog & (DialogAlert | DialogConfirm | DialogToast | DialogInput | DialogSignature | DialogSelect | DialogDate | DialogFileSelect | DialogIFrame<Input> | DialogModule<Input>)): any;
422
423
  openDialog: (value: any, callback: (data: any) => any) => Promise<any>;
423
424
  closeDialog: (dialogId: number) => Promise<void>;
424
425
  setDialogResult: (buttonType: DialogButtonType, result: any) => Promise<void>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "chayns-api",
3
- "version": "2.4.2",
3
+ "version": "2.4.4",
4
4
  "description": "new chayns api",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",