@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.mjs CHANGED
@@ -4462,20 +4462,26 @@ function SelectScrollDownButton({
4462
4462
  }
4463
4463
  );
4464
4464
  }
4465
- var FieldSelect = ({ row, fieldOptions, onChangeField }) => /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(Select, { value: row.fieldName, onValueChange: (value) => onChangeField(value), children: [
4466
- /* @__PURE__ */ jsx(
4467
- SelectTrigger,
4468
- {
4469
- className: "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
4470
- "data-testid": "advsearch-dropdown-selectfield",
4471
- children: /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select field" })
4472
- }
4473
- ),
4474
- /* @__PURE__ */ jsx(SelectContent, { className: "w-full min-w-[unset]", children: fieldOptions.map((f) => /* @__PURE__ */ jsx(SelectItem, { value: f.value, children: f.decorator ? /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
4475
- f.decorator,
4476
- /* @__PURE__ */ jsx("span", { className: cn(f.labelStyle), children: f.label })
4477
- ] }) : f.label }, f.value)) })
4478
- ] }) });
4465
+ var FieldSelect = ({ row, fieldOptions, onChangeField }) => {
4466
+ const selected = fieldOptions.find((f) => f.value === row.fieldName);
4467
+ return /* @__PURE__ */ jsx("div", { className: "w-full", children: /* @__PURE__ */ jsxs(Select, { value: row.fieldName, onValueChange: (value) => onChangeField(value), children: [
4468
+ /* @__PURE__ */ jsx(
4469
+ SelectTrigger,
4470
+ {
4471
+ className: "w-full justify-between rounded-md bg-white px-4 text-sm font-medium text-gray-700 shadow-none focus:ring-0",
4472
+ "data-testid": "advsearch-dropdown-selectfield",
4473
+ children: selected ? selected.decorator ? /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
4474
+ selected.decorator,
4475
+ /* @__PURE__ */ jsx("span", { className: cn(selected.labelStyle), children: selected.label })
4476
+ ] }) : /* @__PURE__ */ jsx("span", { className: cn(selected.labelStyle), children: selected.label }) : /* @__PURE__ */ jsx(SelectValue, { placeholder: "Select field" })
4477
+ }
4478
+ ),
4479
+ /* @__PURE__ */ jsx(SelectContent, { className: "w-full min-w-[unset]", children: fieldOptions.map((f) => /* @__PURE__ */ jsx(SelectItem, { value: f.value, children: f.decorator ? /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
4480
+ f.decorator,
4481
+ /* @__PURE__ */ jsx("span", { className: cn(f.labelStyle), children: f.label })
4482
+ ] }) : f.label }, f.value)) })
4483
+ ] }) });
4484
+ };
4479
4485
 
4480
4486
  // src/components/advanceSearch/types.ts
4481
4487
  var OPERATOR_LABEL = {
@@ -7151,6 +7157,7 @@ var ComboboxInner = ({
7151
7157
  virtual = true,
7152
7158
  isLoading,
7153
7159
  loadingContent,
7160
+ valueRender,
7154
7161
  popoverProps,
7155
7162
  popoverContentProps,
7156
7163
  ...props
@@ -7176,7 +7183,7 @@ var ComboboxInner = ({
7176
7183
  }
7177
7184
  if (!selectedValue) return placeholder2;
7178
7185
  if (currentSelectedOption) {
7179
- return getLabelField(currentSelectedOption);
7186
+ return valueRender ? valueRender(currentSelectedOption) : getLabelField(currentSelectedOption);
7180
7187
  }
7181
7188
  if (showValueWhenNoMatch) {
7182
7189
  return selectedValue;
@@ -7385,6 +7392,13 @@ var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
7385
7392
  /* @__PURE__ */ jsx("span", { className: cn(opt.labelStyle), children: opt.label })
7386
7393
  ] });
7387
7394
  },
7395
+ valueRender: (option) => {
7396
+ const opt = option;
7397
+ return opt.decorator ? /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
7398
+ opt.decorator,
7399
+ /* @__PURE__ */ jsx("span", { className: cn(opt.labelStyle), children: opt.label })
7400
+ ] }) : /* @__PURE__ */ jsx("span", { className: cn(opt.labelStyle), children: opt.label });
7401
+ },
7388
7402
  onSelect: (val) => field.onChange(val),
7389
7403
  onClear: handleClear
7390
7404
  }