unifyedx-storybook-new 0.1.57 → 0.1.59
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.
|
@@ -75253,6 +75253,12 @@ const getOptionsFromConfig = (optionsFrom, configData) => {
|
|
|
75253
75253
|
function SectionRenderer({ item, data: initialData, updateHandler, validationErrors = {} }) {
|
|
75254
75254
|
console.log(item);
|
|
75255
75255
|
const [section, setSection] = React__default.useState(item);
|
|
75256
|
+
const getOptions = React__default.useCallback((field) => {
|
|
75257
|
+
if (field.optionsFrom) {
|
|
75258
|
+
return getOptionsFromConfig(field.optionsFrom, initialData);
|
|
75259
|
+
}
|
|
75260
|
+
return field.options || [];
|
|
75261
|
+
}, [initialData]);
|
|
75256
75262
|
const [data, setData] = React__default.useState(() => {
|
|
75257
75263
|
const sectionData = initialData && initialData[item.key] || {};
|
|
75258
75264
|
console.log("Initial Section data for", item.key, sectionData);
|
|
@@ -75428,8 +75434,11 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
|
|
|
75428
75434
|
onChange: (value) => {
|
|
75429
75435
|
const newData = { ...data, [field.key]: value };
|
|
75430
75436
|
setData(newData);
|
|
75437
|
+
if (updateHandler) {
|
|
75438
|
+
updateHandler(section.key, newData);
|
|
75439
|
+
}
|
|
75431
75440
|
},
|
|
75432
|
-
options:
|
|
75441
|
+
options: getOptions(field),
|
|
75433
75442
|
placeholder: field.placeholder || `Select ${field.label}`,
|
|
75434
75443
|
required: field.required,
|
|
75435
75444
|
disabled: field.disabled ? field.disabled : false,
|