@sustaina/shared-ui 1.62.0 → 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,17 +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.label }, f.value)) })
4518
- ] }) });
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
+ };
4519
4528
 
4520
4529
  // src/components/advanceSearch/types.ts
4521
4530
  var OPERATOR_LABEL = {
@@ -7191,6 +7200,7 @@ var ComboboxInner = ({
7191
7200
  virtual = true,
7192
7201
  isLoading,
7193
7202
  loadingContent,
7203
+ valueRender,
7194
7204
  popoverProps,
7195
7205
  popoverContentProps,
7196
7206
  ...props
@@ -7216,7 +7226,7 @@ var ComboboxInner = ({
7216
7226
  }
7217
7227
  if (!selectedValue) return placeholder2;
7218
7228
  if (currentSelectedOption) {
7219
- return getLabelField(currentSelectedOption);
7229
+ return valueRender ? valueRender(currentSelectedOption) : getLabelField(currentSelectedOption);
7220
7230
  }
7221
7231
  if (showValueWhenNoMatch) {
7222
7232
  return selectedValue;
@@ -7418,6 +7428,20 @@ var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
7418
7428
  showClear: hasValue,
7419
7429
  showSearch: true,
7420
7430
  virtual: false,
7431
+ labelRender: (option) => {
7432
+ const opt = option;
7433
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "flex items-center", children: [
7434
+ opt.decorator,
7435
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: cn(opt.labelStyle), children: opt.label })
7436
+ ] });
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
+ },
7421
7445
  onSelect: (val) => field.onChange(val),
7422
7446
  onClear: handleClear
7423
7447
  }