@open-mercato/ui 0.6.5-develop.4732.1.732f6c67a5 → 0.6.5-develop.4769.1.cff51e0b40
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/backend/CrudForm.js
CHANGED
|
@@ -3334,6 +3334,12 @@ const FieldControl = React.memo(
|
|
|
3334
3334
|
const placeholder = builtin?.placeholder;
|
|
3335
3335
|
const rootClassName = wrapperClassName ? `space-y-1 ${wrapperClassName}` : "space-y-1";
|
|
3336
3336
|
const validateOnWrapperBlur = supportsWrapperBlurValidation(field);
|
|
3337
|
+
const singleSelectValue = Array.isArray(value) ? String(value[0] ?? "") : value == null ? "" : String(value);
|
|
3338
|
+
const singleSelectOptionsKey = React.useMemo(
|
|
3339
|
+
() => options.map((opt) => `${opt.value}:${opt.label}`).join("\0"),
|
|
3340
|
+
[options]
|
|
3341
|
+
);
|
|
3342
|
+
const singleSelectLabel = singleSelectValue ? options.find((option) => option.value === singleSelectValue)?.label : void 0;
|
|
3337
3343
|
return /* @__PURE__ */ jsxs(
|
|
3338
3344
|
"div",
|
|
3339
3345
|
{
|
|
@@ -3519,7 +3525,7 @@ const FieldControl = React.memo(
|
|
|
3519
3525
|
field.type === "select" && !builtin?.multiple && /* @__PURE__ */ jsxs(
|
|
3520
3526
|
Select,
|
|
3521
3527
|
{
|
|
3522
|
-
value:
|
|
3528
|
+
value: singleSelectValue,
|
|
3523
3529
|
onValueChange: (next) => {
|
|
3524
3530
|
if (!next || next === SELECT_CLEAR_SENTINEL) {
|
|
3525
3531
|
const isCustomField = field.id.startsWith("cf_") || field.id.startsWith("cf:");
|
|
@@ -3530,13 +3536,14 @@ const FieldControl = React.memo(
|
|
|
3530
3536
|
},
|
|
3531
3537
|
disabled,
|
|
3532
3538
|
children: [
|
|
3533
|
-
/* @__PURE__ */ jsx(SelectTrigger, { "data-crud-focus-target": "", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("ui.forms.select.emptyOption", "\u2014") }) }),
|
|
3539
|
+
/* @__PURE__ */ jsx(SelectTrigger, { "data-crud-focus-target": "", children: /* @__PURE__ */ jsx(SelectValue, { placeholder: t("ui.forms.select.emptyOption", "\u2014"), children: singleSelectLabel }) }),
|
|
3534
3540
|
/* @__PURE__ */ jsxs(SelectContent, { children: [
|
|
3535
3541
|
!field.required && value != null && value !== "" && /* @__PURE__ */ jsx(SelectItem, { value: SELECT_CLEAR_SENTINEL, children: t("ui.forms.select.clearOption", "\u2014 Clear \u2014") }),
|
|
3536
3542
|
options.filter((opt) => opt.value !== "").map((opt) => /* @__PURE__ */ jsx(SelectItem, { value: opt.value, children: opt.label }, opt.value))
|
|
3537
3543
|
] })
|
|
3538
3544
|
]
|
|
3539
|
-
}
|
|
3545
|
+
},
|
|
3546
|
+
`${field.id}:${singleSelectValue}:${singleSelectOptionsKey}`
|
|
3540
3547
|
),
|
|
3541
3548
|
field.type === "select" && builtin?.multiple && builtin.listbox === true && /* @__PURE__ */ jsx(
|
|
3542
3549
|
ListboxMultiSelect,
|