@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.mjs CHANGED
@@ -4462,17 +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.label }, f.value)) })
4475
- ] }) });
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
+ };
4476
4485
 
4477
4486
  // src/components/advanceSearch/types.ts
4478
4487
  var OPERATOR_LABEL = {
@@ -7148,6 +7157,7 @@ var ComboboxInner = ({
7148
7157
  virtual = true,
7149
7158
  isLoading,
7150
7159
  loadingContent,
7160
+ valueRender,
7151
7161
  popoverProps,
7152
7162
  popoverContentProps,
7153
7163
  ...props
@@ -7173,7 +7183,7 @@ var ComboboxInner = ({
7173
7183
  }
7174
7184
  if (!selectedValue) return placeholder2;
7175
7185
  if (currentSelectedOption) {
7176
- return getLabelField(currentSelectedOption);
7186
+ return valueRender ? valueRender(currentSelectedOption) : getLabelField(currentSelectedOption);
7177
7187
  }
7178
7188
  if (showValueWhenNoMatch) {
7179
7189
  return selectedValue;
@@ -7375,6 +7385,20 @@ var ConditionDropdownInput = ({ row, control, fieldSchema, onClear }) => {
7375
7385
  showClear: hasValue,
7376
7386
  showSearch: true,
7377
7387
  virtual: false,
7388
+ labelRender: (option) => {
7389
+ const opt = option;
7390
+ return /* @__PURE__ */ jsxs("span", { className: "flex items-center", children: [
7391
+ opt.decorator,
7392
+ /* @__PURE__ */ jsx("span", { className: cn(opt.labelStyle), children: opt.label })
7393
+ ] });
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
+ },
7378
7402
  onSelect: (val) => field.onChange(val),
7379
7403
  onClear: handleClear
7380
7404
  }