@teamkeel/functions-runtime 0.421.3 → 0.421.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.
package/dist/index.d.cts CHANGED
@@ -466,11 +466,11 @@ type ListItem = {
466
466
  description?: string;
467
467
  image?: ImageConfig;
468
468
  };
469
- type ListOptions$1<T> = {
469
+ type ListOptions<T> = {
470
470
  data: T[];
471
471
  render: (data: T) => ListItem;
472
472
  };
473
- type UiElementList = <T extends any>(options: ListOptions$1<T>) => DisplayElementResponse;
473
+ type UiElementList = <T extends any>(options: ListOptions<T>) => DisplayElementResponse;
474
474
  interface UiElementListApiResponse extends BaseUiDisplayResponse<"ui.display.list"> {
475
475
  data: ListItem[];
476
476
  }
@@ -624,7 +624,10 @@ interface UiElementPrintApiResponse extends BaseUiDisplayResponse<"ui.interactiv
624
624
  autoPrint: boolean;
625
625
  }
626
626
 
627
- type UiElementPickList = <N extends string, T extends Record<string, any>>(name: N, options: ListOptions<T>) => InputElementResponse<N, {
627
+ type UiElementPickList = <N extends string, T extends Record<string, any>, const M extends PickListInputModes = {
628
+ scanner: true;
629
+ manual: true;
630
+ }>(name: N, options: PickListOptions<M, T>) => InputElementResponse<N, {
628
631
  items: PickListResponseItem[];
629
632
  }>;
630
633
  type PickListResponseItem = {
@@ -641,13 +644,35 @@ type PickListItem = {
641
644
  image?: ImageConfig;
642
645
  barcodes?: string[];
643
646
  };
644
- type ListOptions<T> = {
647
+ /**
648
+ * Defines how duplicate scans should be handled.
649
+ * @default "increaseQuantity"
650
+ */
651
+ type ScanDuplicateMode$1 =
652
+ /** Increase quantity when duplicates are scanned */
653
+ "increaseQuantity"
654
+ /** Reject duplicate scans with an error message */
655
+ | "rejectDuplicates";
656
+ /**
657
+ * Defines how picking items should be handled. By default, all modes are enabled.
658
+ */
659
+ type PickListInputModes = {
660
+ /** Picking items can be done by scanning barcodes */
661
+ scanner: boolean;
662
+ /** Picking items can be done by using the add/remove buttons */
663
+ manual: boolean;
664
+ };
665
+ type PickListOptions<M extends PickListInputModes, T> = {
645
666
  data: T[];
646
667
  render: (data: T) => PickListItem;
647
- validate?: ValidateFn<PickListResponseItem[]>;
668
+ supportedInputs?: M;
669
+ validate?: ValidateFn<PickListResponseItem>;
670
+ duplicateHandling?: ScanDuplicateMode$1 | undefined;
648
671
  };
649
672
  interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.interactive.pickList"> {
650
673
  data: PickListItem[];
674
+ supportedInputs: PickListInputModes;
675
+ duplicateHandling?: ScanDuplicateMode$1 | undefined;
651
676
  }
652
677
 
653
678
  type UiElementScan = <N extends string, const M extends scanMode = "single", const D extends ScanDuplicateMode = "none">(name: N, options?: ScanOptions<M, D>) => InputElementResponse<N, M extends "single" ? string : ScanResponseItem<D>[]>;
package/dist/index.d.ts CHANGED
@@ -466,11 +466,11 @@ type ListItem = {
466
466
  description?: string;
467
467
  image?: ImageConfig;
468
468
  };
469
- type ListOptions$1<T> = {
469
+ type ListOptions<T> = {
470
470
  data: T[];
471
471
  render: (data: T) => ListItem;
472
472
  };
473
- type UiElementList = <T extends any>(options: ListOptions$1<T>) => DisplayElementResponse;
473
+ type UiElementList = <T extends any>(options: ListOptions<T>) => DisplayElementResponse;
474
474
  interface UiElementListApiResponse extends BaseUiDisplayResponse<"ui.display.list"> {
475
475
  data: ListItem[];
476
476
  }
@@ -624,7 +624,10 @@ interface UiElementPrintApiResponse extends BaseUiDisplayResponse<"ui.interactiv
624
624
  autoPrint: boolean;
625
625
  }
626
626
 
627
- type UiElementPickList = <N extends string, T extends Record<string, any>>(name: N, options: ListOptions<T>) => InputElementResponse<N, {
627
+ type UiElementPickList = <N extends string, T extends Record<string, any>, const M extends PickListInputModes = {
628
+ scanner: true;
629
+ manual: true;
630
+ }>(name: N, options: PickListOptions<M, T>) => InputElementResponse<N, {
628
631
  items: PickListResponseItem[];
629
632
  }>;
630
633
  type PickListResponseItem = {
@@ -641,13 +644,35 @@ type PickListItem = {
641
644
  image?: ImageConfig;
642
645
  barcodes?: string[];
643
646
  };
644
- type ListOptions<T> = {
647
+ /**
648
+ * Defines how duplicate scans should be handled.
649
+ * @default "increaseQuantity"
650
+ */
651
+ type ScanDuplicateMode$1 =
652
+ /** Increase quantity when duplicates are scanned */
653
+ "increaseQuantity"
654
+ /** Reject duplicate scans with an error message */
655
+ | "rejectDuplicates";
656
+ /**
657
+ * Defines how picking items should be handled. By default, all modes are enabled.
658
+ */
659
+ type PickListInputModes = {
660
+ /** Picking items can be done by scanning barcodes */
661
+ scanner: boolean;
662
+ /** Picking items can be done by using the add/remove buttons */
663
+ manual: boolean;
664
+ };
665
+ type PickListOptions<M extends PickListInputModes, T> = {
645
666
  data: T[];
646
667
  render: (data: T) => PickListItem;
647
- validate?: ValidateFn<PickListResponseItem[]>;
668
+ supportedInputs?: M;
669
+ validate?: ValidateFn<PickListResponseItem>;
670
+ duplicateHandling?: ScanDuplicateMode$1 | undefined;
648
671
  };
649
672
  interface UiElementPickListApiResponse extends BaseUiMinimalInputResponse<"ui.interactive.pickList"> {
650
673
  data: PickListItem[];
674
+ supportedInputs: PickListInputModes;
675
+ duplicateHandling?: ScanDuplicateMode$1 | undefined;
651
676
  }
652
677
 
653
678
  type UiElementScan = <N extends string, const M extends scanMode = "single", const D extends ScanDuplicateMode = "none">(name: N, options?: ScanOptions<M, D>) => InputElementResponse<N, M extends "single" ? string : ScanResponseItem<D>[]>;
package/dist/index.js CHANGED
@@ -2883,6 +2883,11 @@ var pickList = /* @__PURE__ */ __name((name, options) => {
2883
2883
  uiConfig: {
2884
2884
  __type: "ui.interactive.pickList",
2885
2885
  name,
2886
+ supportedInputs: options.supportedInputs || {
2887
+ scanner: true,
2888
+ manual: true
2889
+ },
2890
+ duplicateHandling: options.duplicateHandling,
2886
2891
  data: options.data.map((item) => {
2887
2892
  const rendered = options.render(item);
2888
2893
  return {