unifyedx-storybook-new 0.1.80 → 0.1.81
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.
|
@@ -75965,6 +75965,39 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
|
|
|
75965
75965
|
),
|
|
75966
75966
|
renderError(rowIndex)
|
|
75967
75967
|
] });
|
|
75968
|
+
case "selectDynamic":
|
|
75969
|
+
return (props, rowIndex) => {
|
|
75970
|
+
const getDynamicOptions = () => {
|
|
75971
|
+
if (field.optionsFrom && initialData) {
|
|
75972
|
+
const { config, valueField, labelField } = field.optionsFrom;
|
|
75973
|
+
const configData = initialData[config] || [];
|
|
75974
|
+
if (Array.isArray(configData)) {
|
|
75975
|
+
return configData.map((item2) => ({
|
|
75976
|
+
id: item2[valueField] || "",
|
|
75977
|
+
value: item2[valueField] || "",
|
|
75978
|
+
label: item2[labelField] || ""
|
|
75979
|
+
}));
|
|
75980
|
+
}
|
|
75981
|
+
}
|
|
75982
|
+
return field.options || [];
|
|
75983
|
+
};
|
|
75984
|
+
return /* @__PURE__ */ jsxs("div", { children: [
|
|
75985
|
+
/* @__PURE__ */ jsx(
|
|
75986
|
+
Select,
|
|
75987
|
+
{
|
|
75988
|
+
index: rowIndex,
|
|
75989
|
+
value: props[field.key] || "",
|
|
75990
|
+
onChange: (value) => updateFieldValue(rowIndex, value),
|
|
75991
|
+
options: getDynamicOptions(),
|
|
75992
|
+
placeholder: field.placeholder || `Select ${field.label}`,
|
|
75993
|
+
required: field.required,
|
|
75994
|
+
className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
|
|
75995
|
+
},
|
|
75996
|
+
Math.random()
|
|
75997
|
+
),
|
|
75998
|
+
renderError(rowIndex)
|
|
75999
|
+
] });
|
|
76000
|
+
};
|
|
75968
76001
|
case "multiselect":
|
|
75969
76002
|
return (props, rowIndex) => {
|
|
75970
76003
|
const currentValue = props[field.key] || [];
|