@sustaina/shared-ui 1.62.1 → 1.62.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/dist/index.d.mts CHANGED
@@ -2014,6 +2014,7 @@ type ComboboxProps<TData extends OptionData> = React$1.AriaAttributes & Omit<Vir
2014
2014
  virtual?: boolean;
2015
2015
  isLoading?: boolean;
2016
2016
  loadingContent?: React$1.ReactNode;
2017
+ valueRender?: (option: VirtualizedCommandOption<TData>) => React$1.ReactNode;
2017
2018
  popoverProps?: Omit<React$1.ComponentProps<typeof Popover>, "open" | "onOpenChange">;
2018
2019
  popoverContentProps?: Omit<React$1.ComponentProps<typeof PopoverContent>, "children">;
2019
2020
  };
package/dist/index.d.ts CHANGED
@@ -2014,6 +2014,7 @@ type ComboboxProps<TData extends OptionData> = React$1.AriaAttributes & Omit<Vir
2014
2014
  virtual?: boolean;
2015
2015
  isLoading?: boolean;
2016
2016
  loadingContent?: React$1.ReactNode;
2017
+ valueRender?: (option: VirtualizedCommandOption<TData>) => React$1.ReactNode;
2017
2018
  popoverProps?: Omit<React$1.ComponentProps<typeof Popover>, "open" | "onOpenChange">;
2018
2019
  popoverContentProps?: Omit<React$1.ComponentProps<typeof PopoverContent>, "children">;
2019
2020
  };
package/dist/index.js CHANGED
@@ -4505,20 +4505,26 @@ function SelectScrollDownButton({
4505
4505
  }
4506
4506
  );
4507
4507
  }
4508
- var FieldSelect = ({ row, fieldOptions, onChangeField }) => /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: row.fieldName, onValueChange: (value) => onChangeField(value), children: [
4509
- /* @__PURE__ */ jsxRuntime.jsx(
4510
- SelectTrigger,
4511
- {
4512
- className: "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
4513
- "data-testid": "advsearch-dropdown-selectfield",
4514
- children: /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select field" })
4515
- }
4516
- ),
4517
- /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "w-full min-w-[unset]", children: fieldOptions.map((f) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: f.value, children: f.decorator ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
4518
- f.decorator,
4519
- /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(f.labelStyle), children: f.label })
4520
- ] }) : f.label }, f.value)) })
4521
- ] }) });
4508
+ var FieldSelect = ({ row, fieldOptions, onChangeField }) => {
4509
+ const selected = fieldOptions.find((f) => f.value === row.fieldName);
4510
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxRuntime.jsxs(Select, { value: row.fieldName, onValueChange: (value) => onChangeField(value), children: [
4511
+ /* @__PURE__ */ jsxRuntime.jsx(
4512
+ SelectTrigger,
4513
+ {
4514
+ className: "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
4515
+ "data-testid": "advsearch-dropdown-selectfield",
4516
+ children: selected ? selected.decorator ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
4517
+ selected.decorator,
4518
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(selected.labelStyle), children: selected.label })
4519
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(selected.labelStyle), children: selected.label }) : /* @__PURE__ */ jsxRuntime.jsx(SelectValue, { placeholder: "Select field" })
4520
+ }
4521
+ ),
4522
+ /* @__PURE__ */ jsxRuntime.jsx(SelectContent, { className: "w-full min-w-[unset]", children: fieldOptions.map((f) => /* @__PURE__ */ jsxRuntime.jsx(SelectItem, { value: f.value, children: f.decorator ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
4523
+ f.decorator,
4524
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(f.labelStyle), children: f.label })
4525
+ ] }) : f.label }, f.value)) })
4526
+ ] }) });
4527
+ };
4522
4528
 
4523
4529
  // src/components/advanceSearch/types.ts
4524
4530
  var OPERATOR_LABEL = {
@@ -7194,6 +7200,7 @@ var ComboboxInner = ({
7194
7200
  virtual = true,
7195
7201
  isLoading,
7196
7202
  loadingContent,
7203
+ valueRender,
7197
7204
  popoverProps,
7198
7205
  popoverContentProps,
7199
7206
  ...props
@@ -7219,7 +7226,7 @@ var ComboboxInner = ({
7219
7226
  }
7220
7227
  if (!selectedValue) return placeholder2;
7221
7228
  if (currentSelectedOption) {
7222
- return getLabelField(currentSelectedOption);
7229
+ return valueRender ? valueRender(currentSelectedOption) : getLabelField(currentSelectedOption);
7223
7230
  }
7224
7231
  if (showValueWhenNoMatch) {
7225
7232
  return selectedValue;
@@ -7428,6 +7435,13 @@ var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
7428
7435
  /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(opt.labelStyle), children: opt.label })
7429
7436
  ] });
7430
7437
  },
7438
+ valueRender: (option) => {
7439
+ const opt = option;
7440
+ return opt.decorator ? /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
7441
+ opt.decorator,
7442
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(opt.labelStyle), children: opt.label })
7443
+ ] }) : /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(opt.labelStyle), children: opt.label });
7444
+ },
7431
7445
  onSelect: (val) => field.onChange(val),
7432
7446
  onClear: handleClear
7433
7447
  }