unifyedx-storybook-new 0.1.75 → 0.1.77

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.
@@ -838,7 +838,7 @@ const Avatar = ({
838
838
  showIcon && /* @__PURE__ */ jsx("span", { className: "avatar-icon", children: /* @__PURE__ */ jsx(User, {}) })
839
839
  ] });
840
840
  };
841
- const AvatarGroup = ({ children, max = 4, truncatedMessage = "Members", ...props }) => {
841
+ const AvatarGroup$1 = ({ children, max = 4, truncatedMessage = "Members", ...props }) => {
842
842
  const avatars = React__default.Children.toArray(children);
843
843
  const visibleAvatars = avatars.slice(0, max);
844
844
  const hiddenCount = avatars.length - max;
@@ -75249,47 +75249,30 @@ function TreeView({
75249
75249
  }
75250
75250
 
75251
75251
  function SectionRenderer({ item, data: initialData, updateHandler, validationErrors = {} }) {
75252
+ console.log(item);
75252
75253
  const [section, setSection] = React__default.useState(item);
75253
75254
  const [data, setData] = React__default.useState(() => {
75254
- const sectionData = initialData && initialData[item.key] || (item.type === "datatable" ? [] : {});
75255
+ const sectionData = initialData && initialData[item.key] || {};
75256
+ console.log("Initial Section data for", item.key, sectionData);
75255
75257
  return sectionData;
75256
75258
  });
75257
- const getDynamicOptions = (field) => {
75258
- if (field.optionsFrom && initialData) {
75259
- const { config, valueField, labelField } = field.optionsFrom;
75260
- const configData = initialData[config] || [];
75261
- if (Array.isArray(configData)) {
75262
- return configData.map((item2) => ({
75263
- id: item2[valueField] || "",
75264
- value: item2[valueField] || "",
75265
- label: item2[labelField] || ""
75266
- }));
75267
- }
75268
- }
75269
- return field.options || [];
75270
- };
75271
- const handleFieldChange = React__default.useCallback((fieldKey, value) => {
75272
- setData((prevData) => {
75273
- const newData = { ...prevData, [fieldKey]: value };
75274
- if (updateHandler) {
75275
- updateHandler(section.key, newData);
75276
- }
75277
- return newData;
75278
- });
75279
- }, [updateHandler, section.key]);
75280
- React__default.useEffect(() => {
75281
- if (initialData && initialData[item.key]) {
75282
- setData(initialData[item.key]);
75283
- }
75284
- }, [initialData, item.key]);
75285
75259
  const prevInitialDataRef = useRef(initialData);
75286
75260
  useEffect(() => {
75287
75261
  if (prevInitialDataRef.current !== initialData) {
75288
75262
  prevInitialDataRef.current = initialData;
75289
75263
  const sectionData = initialData && initialData[item.key] || {};
75264
+ console.log("Updated Section data for", item.key, sectionData);
75290
75265
  setData(sectionData);
75291
75266
  }
75292
75267
  }, [initialData, item.key]);
75268
+ console.log("Section data", data);
75269
+ const prevDataRef = useRef(data);
75270
+ useEffect(() => {
75271
+ if (prevDataRef.current !== data && updateHandler && typeof updateHandler === "function") {
75272
+ prevDataRef.current = data;
75273
+ updateHandler(section.key, data);
75274
+ }
75275
+ }, [section.key, data, updateHandler]);
75293
75276
  const shouldShowField = (field) => {
75294
75277
  if (!field.dependsOn) return true;
75295
75278
  const { field: dependentField, value: requiredValue, operator = "equals" } = field.dependsOn;
@@ -75350,9 +75333,16 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75350
75333
  {
75351
75334
  type: "text",
75352
75335
  name: field.key,
75336
+ defaultValue: field.default,
75353
75337
  placeholder: field.placeholder,
75354
- value: data[field.key] || field.default || "",
75355
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75338
+ value: data[field.key] || "",
75339
+ onChange: (e) => {
75340
+ const newData = { ...data, [field.key]: e.target.value };
75341
+ setData(newData);
75342
+ if (updateHandler) {
75343
+ updateHandler(section.key, newData);
75344
+ }
75345
+ },
75356
75346
  required: field.required,
75357
75347
  disabled: field.disabled ? field.disabled : false,
75358
75348
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
@@ -75365,9 +75355,16 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75365
75355
  Textarea,
75366
75356
  {
75367
75357
  name: field.key,
75358
+ defaultValue: field.default,
75368
75359
  placeholder: field.placeholder,
75369
- value: data[field.key] || field.default || "",
75370
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75360
+ value: data[field.key] || "",
75361
+ onChange: (e) => {
75362
+ const newData = { ...data, [field.key]: e.target.value };
75363
+ setData(newData);
75364
+ if (updateHandler) {
75365
+ updateHandler(section.key, newData);
75366
+ }
75367
+ },
75371
75368
  rows: 3,
75372
75369
  required: field.required,
75373
75370
  disabled: field.disabled ? field.disabled : false,
@@ -75382,9 +75379,16 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75382
75379
  {
75383
75380
  type: "number",
75384
75381
  name: field.key,
75382
+ defaultValue: field.default,
75385
75383
  placeholder: field.placeholder,
75386
- value: data[field.key] || field.default || "",
75387
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75384
+ value: data[field.key] || "",
75385
+ onChange: (e) => {
75386
+ const newData = { ...data, [field.key]: e.target.value };
75387
+ setData(newData);
75388
+ if (updateHandler) {
75389
+ updateHandler(section.key, newData);
75390
+ }
75391
+ },
75388
75392
  required: field.required,
75389
75393
  disabled: field.disabled ? field.disabled : false,
75390
75394
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
@@ -75398,7 +75402,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75398
75402
  {
75399
75403
  name: field.key,
75400
75404
  checked: Boolean(data[field.key] || field.default),
75401
- onChange: (checked) => handleFieldChange(field.key, checked),
75405
+ onChange: (checked) => {
75406
+ const newData = { ...data, [field.key]: checked };
75407
+ setData(newData);
75408
+ if (updateHandler) {
75409
+ updateHandler(section.key, newData);
75410
+ }
75411
+ },
75402
75412
  label: field.placeholder || field.label,
75403
75413
  disabled: field.disabled ? field.disabled : false,
75404
75414
  className: "w-full"
@@ -75411,8 +75421,12 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75411
75421
  Select,
75412
75422
  {
75413
75423
  name: field.key,
75414
- value: data[field.key] || field.default || "",
75415
- onChange: (value) => handleFieldChange(field.key, value),
75424
+ defaultValue: field.default,
75425
+ value: data[field.key] || "",
75426
+ onChange: (value) => {
75427
+ const newData = { ...data, [field.key]: value };
75428
+ setData(newData);
75429
+ },
75416
75430
  options: field.options || [],
75417
75431
  placeholder: field.placeholder || `Select ${field.label}`,
75418
75432
  required: field.required,
@@ -75422,22 +75436,6 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75422
75436
  ),
75423
75437
  validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
75424
75438
  ] }),
75425
- field.fieldtype === "selectDynamic" && /* @__PURE__ */ jsxs("div", { children: [
75426
- /* @__PURE__ */ jsx(
75427
- Select,
75428
- {
75429
- name: field.key,
75430
- value: data[field.key] || field.default || "",
75431
- onChange: (value) => handleFieldChange(field.key, value),
75432
- options: getDynamicOptions(field),
75433
- placeholder: field.placeholder || `Select ${field.label}`,
75434
- required: field.required,
75435
- disabled: field.disabled ? field.disabled : false,
75436
- className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
75437
- }
75438
- ),
75439
- validationErrors[section.key]?.[field.key] && /* @__PURE__ */ jsx("div", { style: { color: "#ef4444", fontSize: "12px", marginTop: "2px" }, children: validationErrors[section.key][field.key] })
75440
- ] }),
75441
75439
  field.fieldtype === "email" && /* @__PURE__ */ jsxs("div", { children: [
75442
75440
  /* @__PURE__ */ jsx(
75443
75441
  Input$1,
@@ -75447,7 +75445,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75447
75445
  defaultValue: field.default,
75448
75446
  placeholder: field.placeholder || "Enter email address",
75449
75447
  value: data[field.key] || "",
75450
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75448
+ onChange: (e) => {
75449
+ const newData = { ...data, [field.key]: e.target.value };
75450
+ setData(newData);
75451
+ if (updateHandler) {
75452
+ updateHandler(section.key, newData);
75453
+ }
75454
+ },
75451
75455
  required: field.required,
75452
75456
  disabled: field.disabled ? field.disabled : false,
75453
75457
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
@@ -75464,7 +75468,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75464
75468
  defaultValue: field.default,
75465
75469
  placeholder: field.placeholder || "Enter URL",
75466
75470
  value: data[field.key] || "",
75467
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75471
+ onChange: (e) => {
75472
+ const newData = { ...data, [field.key]: e.target.value };
75473
+ setData(newData);
75474
+ if (updateHandler) {
75475
+ updateHandler(section.key, newData);
75476
+ }
75477
+ },
75468
75478
  required: field.required,
75469
75479
  disabled: field.disabled ? field.disabled : false,
75470
75480
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
@@ -75481,7 +75491,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75481
75491
  defaultValue: field.default,
75482
75492
  placeholder: field.placeholder || "Enter password",
75483
75493
  value: data[field.key] || "",
75484
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75494
+ onChange: (e) => {
75495
+ const newData = { ...data, [field.key]: e.target.value };
75496
+ setData(newData);
75497
+ if (updateHandler) {
75498
+ updateHandler(section.key, newData);
75499
+ }
75500
+ },
75485
75501
  required: field.required,
75486
75502
  disabled: field.disabled ? field.disabled : false,
75487
75503
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
@@ -75494,7 +75510,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75494
75510
  MultiSelect$1,
75495
75511
  {
75496
75512
  selectedItems: data[field.key] || [],
75497
- onSelectionChange: (selectedItems) => handleFieldChange(field.key, selectedItems),
75513
+ onSelectionChange: (selectedItems) => {
75514
+ const newData = { ...data, [field.key]: selectedItems };
75515
+ setData(newData);
75516
+ if (updateHandler) {
75517
+ updateHandler(section.key, newData);
75518
+ }
75519
+ },
75498
75520
  options: field.options || [],
75499
75521
  placeholder: field.placeholder || `Select ${field.label}`,
75500
75522
  disabled: field.disabled ? field.disabled : false,
@@ -75508,7 +75530,14 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75508
75530
  ToggleSwitch,
75509
75531
  {
75510
75532
  checked: typeof data[field.key] === "boolean" ? data[field.key] : field.default,
75511
- onChange: (isOn) => handleFieldChange(field.key, isOn),
75533
+ onChange: (isOn) => {
75534
+ console.log("Toggle changed:", field.key, isOn);
75535
+ const newData = { ...data, [field.key]: isOn };
75536
+ setData(newData);
75537
+ if (updateHandler) {
75538
+ updateHandler(section.key, newData);
75539
+ }
75540
+ },
75512
75541
  label: field.placeholder || field.label,
75513
75542
  disabled: field.disabled ? field.disabled : false
75514
75543
  }
@@ -75520,7 +75549,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75520
75549
  {
75521
75550
  label: field.label,
75522
75551
  value: data[field.key] ? new Date(data[field.key]) : null,
75523
- onChange: (date) => handleFieldChange(field.key, date ? date.toISOString().split("T")[0] : ""),
75552
+ onChange: (date) => {
75553
+ const newData = { ...data, [field.key]: date ? date.toISOString().split("T")[0] : "" };
75554
+ setData(newData);
75555
+ if (updateHandler) {
75556
+ updateHandler(section.key, newData);
75557
+ }
75558
+ },
75524
75559
  placeholder: field.placeholder || "Select date",
75525
75560
  disabled: field.disabled ? field.disabled : false,
75526
75561
  error: validationErrors[section.key]?.[field.key],
@@ -75532,7 +75567,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75532
75567
  {
75533
75568
  label: field.label,
75534
75569
  value: data[field.key] || { from: null, to: null },
75535
- onChange: (dateRange) => handleFieldChange(field.key, dateRange),
75570
+ onChange: (dateRange) => {
75571
+ const newData = { ...data, [field.key]: dateRange };
75572
+ setData(newData);
75573
+ if (updateHandler) {
75574
+ updateHandler(section.key, newData);
75575
+ }
75576
+ },
75536
75577
  placeholder: field.placeholder || "Select date range",
75537
75578
  disabled: field.disabled ? field.disabled : false,
75538
75579
  error: validationErrors[section.key]?.[field.key],
@@ -75590,7 +75631,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75590
75631
  SearchBar,
75591
75632
  {
75592
75633
  value: data[field.key] || "",
75593
- onChange: (value) => handleFieldChange(field.key, value),
75634
+ onChange: (value) => {
75635
+ const newData = { ...data, [field.key]: value };
75636
+ setData(newData);
75637
+ if (updateHandler) {
75638
+ updateHandler(section.key, newData);
75639
+ }
75640
+ },
75594
75641
  placeholder: field.placeholder || `Search ${field.label}`,
75595
75642
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
75596
75643
  }
@@ -75606,7 +75653,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75606
75653
  defaultValue: field.default,
75607
75654
  placeholder: field.placeholder || "Select date and time",
75608
75655
  value: data[field.key] || "",
75609
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75656
+ onChange: (e) => {
75657
+ const newData = { ...data, [field.key]: e.target.value };
75658
+ setData(newData);
75659
+ if (updateHandler) {
75660
+ updateHandler(section.key, newData);
75661
+ }
75662
+ },
75610
75663
  required: field.required,
75611
75664
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
75612
75665
  }
@@ -75622,7 +75675,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75622
75675
  defaultValue: field.default,
75623
75676
  placeholder: field.placeholder || "Select time",
75624
75677
  value: data[field.key] || "",
75625
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75678
+ onChange: (e) => {
75679
+ const newData = { ...data, [field.key]: e.target.value };
75680
+ setData(newData);
75681
+ if (updateHandler) {
75682
+ updateHandler(section.key, newData);
75683
+ }
75684
+ },
75626
75685
  required: field.required,
75627
75686
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
75628
75687
  }
@@ -75637,7 +75696,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75637
75696
  name: field.key,
75638
75697
  defaultValue: field.default || "#000000",
75639
75698
  value: data[field.key] || "#000000",
75640
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75699
+ onChange: (e) => {
75700
+ const newData = { ...data, [field.key]: e.target.value };
75701
+ setData(newData);
75702
+ if (updateHandler) {
75703
+ updateHandler(section.key, newData);
75704
+ }
75705
+ },
75641
75706
  className: `w-full h-10 ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
75642
75707
  }
75643
75708
  ),
@@ -75651,7 +75716,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75651
75716
  name: field.key,
75652
75717
  defaultValue: field.default || field.min || 0,
75653
75718
  value: data[field.key] || field.min || 0,
75654
- onChange: (e) => handleFieldChange(field.key, e.target.value),
75719
+ onChange: (e) => {
75720
+ const newData = { ...data, [field.key]: e.target.value };
75721
+ setData(newData);
75722
+ if (updateHandler) {
75723
+ updateHandler(section.key, newData);
75724
+ }
75725
+ },
75655
75726
  min: field.min || 0,
75656
75727
  max: field.max || 100,
75657
75728
  step: field.step || 1,
@@ -75676,7 +75747,11 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75676
75747
  name: field.key,
75677
75748
  onChange: (e) => {
75678
75749
  const file = e.target.files[0];
75679
- handleFieldChange(field.key, file ? file.name : "");
75750
+ const newData = { ...data, [field.key]: file ? file.name : "" };
75751
+ setData(newData);
75752
+ if (updateHandler) {
75753
+ updateHandler(section.key, newData);
75754
+ }
75680
75755
  },
75681
75756
  accept: field.accept,
75682
75757
  className: `w-full ${validationErrors[section.key]?.[field.key] ? "border-red-500" : ""}`
@@ -75691,7 +75766,13 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75691
75766
  endpoints: field.endpoints || {},
75692
75767
  initialData: data[field.key] || field.initialData || [],
75693
75768
  className: field.className || "",
75694
- onCollectionChange: (newCollections) => handleFieldChange(field.key, newCollections),
75769
+ onCollectionChange: (newCollections) => {
75770
+ const newData = { ...data, [field.key]: newCollections };
75771
+ setData(newData);
75772
+ if (updateHandler) {
75773
+ updateHandler(section.key, newData);
75774
+ }
75775
+ },
75695
75776
  showSearch: field.showSearch !== false,
75696
75777
  allowAdd: field.allowAdd !== false,
75697
75778
  allowEdit: field.allowEdit !== false,
@@ -75715,60 +75796,69 @@ function SectionRenderer({ item, data: initialData, updateHandler, validationErr
75715
75796
  ] }, idx)) })
75716
75797
  ] }) });
75717
75798
  }
75718
- const SectionRenderer$1 = React__default.memo(SectionRenderer, (prevProps, nextProps) => {
75719
- return prevProps.item === nextProps.item && prevProps.data === nextProps.data && prevProps.updateHandler === nextProps.updateHandler && JSON.stringify(prevProps.validationErrors) === JSON.stringify(nextProps.validationErrors);
75720
- });
75721
75799
 
75800
+ const AvatarGroup = ({ children }) => /* @__PURE__ */ jsx("div", { className: "flex -space-x-2", children });
75722
75801
  function DataTableRenderer({ item, data: initialData, updateHandler, validationErrors = {} }) {
75723
- item.key;
75802
+ console.log(`[DynamicConfig/DataTableRenderer] Component loaded for section: ${item.key}`);
75724
75803
  const [section, setSection] = useState(item);
75725
75804
  const [audienceRowId, setAudienceRowId] = useState(null);
75726
75805
  const [audienceFieldName, setAudienceFieldName] = useState(null);
75727
- const isStructuralChangeRef = useRef(false);
75806
+ console.log(`[DataTableRenderer] ${section.key} - Received props:`, { item, initialData });
75728
75807
  const [data, setData] = useState(() => {
75729
75808
  const existingData = initialData && initialData[section.key] || [];
75730
- return existingData.length > 0 ? existingData : [{ id: 0 }];
75809
+ const result = existingData.length > 0 ? existingData : [{ id: 0 }];
75810
+ console.log(`[DataTableRenderer] ${section.key} - Initial data:`, result);
75811
+ return result;
75731
75812
  });
75813
+ const prevInitialDataRef = useRef(initialData);
75732
75814
  useEffect(() => {
75733
- const existingData = initialData && initialData[section.key] || [];
75734
- const newData = existingData.length > 0 ? existingData : [{ id: 0 }];
75735
- setData((prevData) => JSON.stringify(prevData) !== JSON.stringify(newData) ? newData : prevData);
75815
+ console.log(`[DataTableRenderer] ${section.key} - Checking for initialData changes`);
75816
+ console.log(`[DataTableRenderer] ${section.key} - Previous:`, prevInitialDataRef.current);
75817
+ console.log(`[DataTableRenderer] ${section.key} - Current:`, initialData);
75818
+ if (prevInitialDataRef.current !== initialData) {
75819
+ prevInitialDataRef.current = initialData;
75820
+ const existingData = initialData && initialData[section.key] || [];
75821
+ const newData = existingData.length > 0 ? existingData : [{ id: 0 }];
75822
+ console.log(`[DataTableRenderer] ${section.key} - Setting new data:`, newData);
75823
+ setData(newData);
75824
+ }
75736
75825
  }, [initialData, section.key]);
75737
- const debounce = useCallback((func, delay) => {
75738
- let timeoutId;
75739
- return (...args) => {
75740
- clearTimeout(timeoutId);
75741
- timeoutId = setTimeout(() => func.apply(null, args), delay);
75742
- };
75743
- }, []);
75744
- const debouncedUpdate = useCallback(
75745
- debounce((newData) => {
75746
- if (updateHandler) updateHandler(section.key, newData);
75747
- }, 300),
75748
- [section.key, updateHandler, debounce]
75749
- );
75826
+ const prevDataRef = useRef(data);
75827
+ const updateTimeoutRef = useRef(null);
75750
75828
  useEffect(() => {
75751
- if (!isStructuralChangeRef.current) {
75752
- debouncedUpdate(data);
75753
- } else {
75754
- isStructuralChangeRef.current = false;
75829
+ if (prevDataRef.current !== data && updateHandler && typeof updateHandler === "function") {
75830
+ prevDataRef.current = data;
75831
+ if (updateTimeoutRef.current) {
75832
+ clearTimeout(updateTimeoutRef.current);
75833
+ }
75834
+ updateTimeoutRef.current = setTimeout(() => {
75835
+ updateHandler(section.key, data);
75836
+ }, 300);
75755
75837
  }
75756
- }, [data, debouncedUpdate]);
75757
- const updateFieldValue = useCallback((field, rowIndex, value) => {
75758
- setData((prevData) => {
75759
- const newData = [...prevData];
75760
- newData[rowIndex][field.key] = value;
75761
- return newData;
75762
- });
75838
+ }, [section.key, data, updateHandler]);
75839
+ useEffect(() => {
75840
+ return () => {
75841
+ if (updateTimeoutRef.current) {
75842
+ clearTimeout(updateTimeoutRef.current);
75843
+ }
75844
+ };
75763
75845
  }, []);
75764
- const getFieldError = useCallback((field, rowIndex) => {
75765
- return validationErrors[section.key]?.[rowIndex]?.[field.key];
75766
- }, [validationErrors, section.key]);
75767
- const renderError = useCallback((field, rowIndex) => {
75768
- const error = getFieldError(field, rowIndex);
75769
- return error ? /* @__PURE__ */ jsx("div", { className: "text-red-500 text-xs mt-1", children: error }) : null;
75770
- }, [getFieldError]);
75771
- const getFieldRenderer = useCallback((field) => {
75846
+ const getFieldRenderer = (field) => {
75847
+ const updateFieldValue = (rowIndex, value) => {
75848
+ console.log(`[DataTableRenderer] updateFieldValue called with:`, { rowIndex, value, type: typeof value });
75849
+ setData((prevData) => {
75850
+ const newData = [...prevData];
75851
+ newData[rowIndex][field.key] = value;
75852
+ return newData;
75853
+ });
75854
+ };
75855
+ const getFieldError = (rowIndex) => {
75856
+ return validationErrors[section.key]?.[rowIndex]?.[field.key];
75857
+ };
75858
+ const renderError = (rowIndex) => {
75859
+ const error = getFieldError(rowIndex);
75860
+ return error ? /* @__PURE__ */ jsx("div", { className: "text-red-500 text-xs mt-1", children: error }) : null;
75861
+ };
75772
75862
  switch (field.fieldtype) {
75773
75863
  case "text":
75774
75864
  return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
@@ -75776,13 +75866,13 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75776
75866
  Input$1,
75777
75867
  {
75778
75868
  value: props[field.key] || "",
75779
- onChange: (e) => updateFieldValue(field, rowIndex, e.target.value),
75869
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75780
75870
  placeholder: field.placeholder || `Enter ${field.label}`,
75781
75871
  required: field.required,
75782
- className: `w-full ${getFieldError(field, rowIndex) ? "border-red-500" : ""}`
75872
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75783
75873
  }
75784
75874
  ),
75785
- renderError(field, rowIndex)
75875
+ renderError(rowIndex)
75786
75876
  ] });
75787
75877
  case "textarea":
75788
75878
  return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
@@ -75790,14 +75880,14 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75790
75880
  Textarea,
75791
75881
  {
75792
75882
  value: props[field.key] || "",
75793
- onChange: (e) => updateFieldValue(field, rowIndex, e.target.value),
75883
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75794
75884
  placeholder: field.placeholder || `Enter ${field.label}`,
75795
75885
  required: field.required,
75796
- className: `w-full ${getFieldError(field, rowIndex) ? "border-red-500" : ""}`,
75886
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`,
75797
75887
  rows: 3
75798
75888
  }
75799
75889
  ),
75800
- renderError(field, rowIndex)
75890
+ renderError(rowIndex)
75801
75891
  ] });
75802
75892
  case "number":
75803
75893
  return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
@@ -75806,13 +75896,58 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75806
75896
  {
75807
75897
  type: "number",
75808
75898
  value: props[field.key] || "",
75809
- onChange: (e) => updateFieldValue(field, rowIndex, e.target.value),
75899
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75810
75900
  placeholder: field.placeholder || `Enter ${field.label}`,
75811
75901
  required: field.required,
75812
- className: `w-full ${getFieldError(field, rowIndex) ? "border-red-500" : ""}`
75902
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75903
+ }
75904
+ ),
75905
+ renderError(rowIndex)
75906
+ ] });
75907
+ case "email":
75908
+ return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
75909
+ /* @__PURE__ */ jsx(
75910
+ Input$1,
75911
+ {
75912
+ type: "email",
75913
+ value: props[field.key] || "",
75914
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75915
+ placeholder: field.placeholder || "Enter email address",
75916
+ required: field.required,
75917
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75918
+ }
75919
+ ),
75920
+ renderError(rowIndex)
75921
+ ] });
75922
+ case "url":
75923
+ return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
75924
+ /* @__PURE__ */ jsx(
75925
+ Input$1,
75926
+ {
75927
+ type: "url",
75928
+ value: props[field.key] || "",
75929
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75930
+ placeholder: field.placeholder || "Enter URL",
75931
+ required: field.required,
75932
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75933
+ }
75934
+ ),
75935
+ renderError(rowIndex)
75936
+ ] });
75937
+ case "password":
75938
+ return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
75939
+ /* @__PURE__ */ jsx(
75940
+ Input$1,
75941
+ {
75942
+ type: "password",
75943
+ value: props[field.key] || "",
75944
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75945
+ placeholder: field.placeholder || "Enter password",
75946
+ required: field.required,
75947
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75813
75948
  }
75814
75949
  ),
75815
- renderError(field, rowIndex)
75950
+ renderError(rowIndex)
75816
75951
  ] });
75817
75952
  case "select":
75818
75953
  case "dropdown":
@@ -75821,62 +75956,232 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75821
75956
  Select,
75822
75957
  {
75823
75958
  value: props[field.key] || "",
75824
- onChange: (value) => updateFieldValue(field, rowIndex, value),
75959
+ onChange: (value) => updateFieldValue(rowIndex, value),
75825
75960
  options: field.options || [],
75826
75961
  placeholder: field.placeholder || `Select ${field.label}`,
75827
75962
  required: field.required,
75828
- className: `w-full ${getFieldError(field, rowIndex) ? "border-red-500" : ""}`
75963
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75829
75964
  }
75830
75965
  ),
75831
- renderError(field, rowIndex)
75966
+ renderError(rowIndex)
75832
75967
  ] });
75968
+ case "multiselect":
75969
+ return (props, rowIndex) => {
75970
+ const currentValue = props[field.key] || [];
75971
+ return /* @__PURE__ */ jsx(
75972
+ MultiSelect$1,
75973
+ {
75974
+ selectedItems: currentValue,
75975
+ onSelectionChange: (selectedItems) => updateFieldValue(rowIndex, selectedItems),
75976
+ options: field.options || [],
75977
+ placeholder: field.placeholder || `Select ${field.label}`,
75978
+ className: "w-full"
75979
+ }
75980
+ );
75981
+ };
75833
75982
  case "checkbox":
75834
75983
  case "boolean":
75835
75984
  return (props, rowIndex) => /* @__PURE__ */ jsx(
75836
75985
  Checkbox,
75837
75986
  {
75838
75987
  checked: Boolean(props[field.key]),
75839
- onChange: (checked) => updateFieldValue(field, rowIndex, checked),
75988
+ onChange: (checked) => updateFieldValue(rowIndex, checked),
75840
75989
  label: field.placeholder || field.label,
75841
75990
  className: "w-full"
75842
75991
  }
75843
75992
  );
75993
+ case "toggle":
75994
+ case "switch":
75995
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
75996
+ ToggleSwitch,
75997
+ {
75998
+ isOn: Boolean(props[field.key]),
75999
+ onToggle: (isOn) => updateFieldValue(rowIndex, isOn),
76000
+ label: field.placeholder || field.label,
76001
+ className: "w-full"
76002
+ }
76003
+ );
76004
+ case "date":
76005
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76006
+ DatePicker$1,
76007
+ {
76008
+ selectedDate: props[field.key] ? new Date(props[field.key]) : null,
76009
+ onDateChange: (date) => updateFieldValue(rowIndex, date ? date.toISOString().split("T")[0] : ""),
76010
+ placeholder: field.placeholder || "Select date",
76011
+ className: "w-full"
76012
+ }
76013
+ );
76014
+ case "datetime":
76015
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76016
+ Input$1,
76017
+ {
76018
+ type: "datetime-local",
76019
+ value: props[field.key] || "",
76020
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
76021
+ placeholder: field.placeholder || "Select date and time",
76022
+ required: field.required,
76023
+ className: "w-full"
76024
+ }
76025
+ );
76026
+ case "time":
76027
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76028
+ Input$1,
76029
+ {
76030
+ type: "time",
76031
+ value: props[field.key] || "",
76032
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
76033
+ placeholder: field.placeholder || "Select time",
76034
+ required: field.required,
76035
+ className: "w-full"
76036
+ }
76037
+ );
76038
+ case "radio":
76039
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76040
+ RadioGroup,
76041
+ {
76042
+ selectedValue: props[field.key] || "",
76043
+ onValueChange: (value) => updateFieldValue(rowIndex, value),
76044
+ options: field.options || [],
76045
+ className: "w-full"
76046
+ }
76047
+ );
76048
+ case "search":
76049
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76050
+ SearchBar,
76051
+ {
76052
+ value: props[field.key] || "",
76053
+ onChange: (value) => updateFieldValue(rowIndex, value),
76054
+ placeholder: field.placeholder || `Search ${field.label}`,
76055
+ className: "w-full"
76056
+ }
76057
+ );
76058
+ case "audience":
76059
+ return (props, rowIndex) => {
76060
+ const audienceData = props[field.key] || { users: [], groups: [], roles: [] };
76061
+ const allAudience = [
76062
+ ...audienceData.users || [],
76063
+ ...audienceData.groups || [],
76064
+ ...audienceData.roles || []
76065
+ ];
76066
+ return /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
76067
+ /* @__PURE__ */ jsx(AvatarGroup, { children: allAudience.length > 0 ? allAudience.slice(0, 3).map((aud, idx) => /* @__PURE__ */ jsx(
76068
+ Avatar,
76069
+ {
76070
+ size: "small",
76071
+ name: aud.name || aud.displayName || aud.id,
76072
+ src: aud.avatarUrl
76073
+ },
76074
+ idx
76075
+ )) : null }),
76076
+ /* @__PURE__ */ jsx(
76077
+ "button",
76078
+ {
76079
+ className: "text-blue-600 font-semibold hover:text-blue-800",
76080
+ onClick: () => {
76081
+ setAudienceFieldName(field.key);
76082
+ setAudienceRowId(rowIndex);
76083
+ },
76084
+ children: allAudience.length > 0 ? "Edit" : "Assign"
76085
+ }
76086
+ )
76087
+ ] });
76088
+ };
76089
+ case "color":
76090
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76091
+ Input$1,
76092
+ {
76093
+ type: "color",
76094
+ value: props[field.key] || "#000000",
76095
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
76096
+ className: "w-full h-10"
76097
+ }
76098
+ );
76099
+ case "range":
76100
+ return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { className: "w-full", children: [
76101
+ /* @__PURE__ */ jsx(
76102
+ Input$1,
76103
+ {
76104
+ type: "range",
76105
+ value: props[field.key] || field.min || 0,
76106
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
76107
+ min: field.min || 0,
76108
+ max: field.max || 100,
76109
+ step: field.step || 1,
76110
+ className: "w-full"
76111
+ }
76112
+ ),
76113
+ /* @__PURE__ */ jsx("span", { className: "text-sm text-gray-500", children: props[field.key] || field.min || 0 })
76114
+ ] });
76115
+ case "file":
76116
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76117
+ Input$1,
76118
+ {
76119
+ type: "file",
76120
+ onChange: (e) => {
76121
+ const file = e.target.files[0];
76122
+ updateFieldValue(rowIndex, file ? file.name : "");
76123
+ },
76124
+ accept: field.accept,
76125
+ className: "w-full"
76126
+ }
76127
+ );
76128
+ case "hidden":
76129
+ return (props, rowIndex) => /* @__PURE__ */ jsx(
76130
+ Input$1,
76131
+ {
76132
+ type: "hidden",
76133
+ value: props[field.key] || "",
76134
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value)
76135
+ }
76136
+ );
76137
+ // Default fallback for unknown field types
75844
76138
  default:
75845
76139
  return (props, rowIndex) => /* @__PURE__ */ jsxs("div", { children: [
75846
76140
  /* @__PURE__ */ jsx(
75847
76141
  Input$1,
75848
76142
  {
75849
76143
  value: props[field.key] || "",
75850
- onChange: (e) => updateFieldValue(field, rowIndex, e.target.value),
76144
+ onChange: (e) => updateFieldValue(rowIndex, e.target.value),
75851
76145
  placeholder: field.placeholder || `Enter ${field.label}`,
75852
76146
  required: field.required,
75853
- className: `w-full ${getFieldError(field, rowIndex) ? "border-red-500" : ""}`
76147
+ className: `w-full ${getFieldError(rowIndex) ? "border-red-500" : ""}`
75854
76148
  }
75855
76149
  ),
75856
- renderError(field, rowIndex)
76150
+ renderError(rowIndex)
75857
76151
  ] });
75858
76152
  }
75859
- }, [updateFieldValue, getFieldError, renderError]);
76153
+ };
75860
76154
  const addBlankRow = useCallback(() => {
75861
- isStructuralChangeRef.current = true;
76155
+ console.log("[DataTableRenderer] Adding blank row");
75862
76156
  setData((prevData) => {
75863
- const blankRow = { id: prevData.length };
75864
- section.fields.forEach((field) => blankRow[field.key] = field.fieldtype === "audience" ? { users: [], groups: [], roles: [] } : "");
76157
+ console.log("[DataTableRenderer] Current data before add:", prevData);
76158
+ const blankRow = {
76159
+ id: prevData.length
76160
+ // Assign next available ID
76161
+ };
76162
+ section.fields.forEach((field) => {
76163
+ if (field.fieldtype === "audience") {
76164
+ blankRow[field.key] = { users: [], groups: [], roles: [] };
76165
+ } else {
76166
+ blankRow[field.key] = field.default || "";
76167
+ }
76168
+ });
76169
+ console.log("[DataTableRenderer] New blank row:", blankRow);
75865
76170
  const newData = [...prevData, blankRow];
75866
- setTimeout(() => updateHandler?.(section.key, newData), 0);
76171
+ console.log("[DataTableRenderer] Updated data:", newData);
75867
76172
  return newData;
75868
76173
  });
75869
- }, [section.fields, updateHandler, section.key]);
76174
+ }, [section.fields]);
75870
76175
  const removeRow = useCallback((index) => {
75871
- isStructuralChangeRef.current = true;
75872
76176
  setData((prevData) => {
75873
- if (prevData.length <= 1) return prevData;
76177
+ if (prevData.length <= 1) {
76178
+ return prevData;
76179
+ }
75874
76180
  const newData = [...prevData];
75875
76181
  newData.splice(index, 1);
75876
- setTimeout(() => updateHandler?.(section.key, newData), 0);
75877
76182
  return newData;
75878
76183
  });
75879
- }, [updateHandler, section.key]);
76184
+ }, []);
75880
76185
  const [draggedIndex, setDraggedIndex] = useState(null);
75881
76186
  const handleDragStart = useCallback((e, index) => {
75882
76187
  setDraggedIndex(index);
@@ -75892,9 +76197,9 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75892
76197
  if (draggedIndex === null || draggedIndex === dropIndex) return;
75893
76198
  setData((prevData) => {
75894
76199
  const newData = [...prevData];
75895
- const item2 = newData[draggedIndex];
76200
+ const draggedItem = newData[draggedIndex];
75896
76201
  newData.splice(draggedIndex, 1);
75897
- newData.splice(dropIndex, 0, item2);
76202
+ newData.splice(dropIndex, 0, draggedItem);
75898
76203
  return newData;
75899
76204
  });
75900
76205
  setDraggedIndex(null);
@@ -75903,18 +76208,20 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75903
76208
  setDraggedIndex(null);
75904
76209
  }, []);
75905
76210
  const handleAddAudience = useCallback((selectedEntities) => {
76211
+ console.log("[DataTableRenderer] handleAddAudience called with:", selectedEntities);
75906
76212
  setData((prevData) => {
75907
76213
  const newData = [...prevData];
75908
76214
  if (audienceRowId !== null && audienceFieldName && newData[audienceRowId]) {
75909
76215
  const pendingInvites = selectedEntities.pendingInvites || [];
75910
- const users = pendingInvites.filter((i) => i.type === "User");
75911
- const groups = pendingInvites.filter((i) => i.type === "Group");
75912
- const roles = pendingInvites.filter((i) => i.type === "Role");
76216
+ const users = pendingInvites.filter((invite) => invite.type === "User");
76217
+ const groups = pendingInvites.filter((invite) => invite.type === "Group");
76218
+ const roles = pendingInvites.filter((invite) => invite.type === "Role");
75913
76219
  newData[audienceRowId][audienceFieldName] = {
75914
76220
  users: [...newData[audienceRowId][audienceFieldName]?.users || [], ...users],
75915
76221
  groups: [...newData[audienceRowId][audienceFieldName]?.groups || [], ...groups],
75916
76222
  roles: [...newData[audienceRowId][audienceFieldName]?.roles || [], ...roles]
75917
76223
  };
76224
+ console.log("[DataTableRenderer] Updated audience data:", newData[audienceRowId][audienceFieldName]);
75918
76225
  }
75919
76226
  return newData;
75920
76227
  });
@@ -75939,7 +76246,14 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75939
76246
  /* @__PURE__ */ jsx("div", { className: "overflow-x-auto", children: /* @__PURE__ */ jsxs("table", { className: "min-w-full bg-white border border-gray-300", style: { marginBottom: "20px" }, children: [
75940
76247
  /* @__PURE__ */ jsx("thead", { children: /* @__PURE__ */ jsxs("tr", { className: "bg-gray-50", children: [
75941
76248
  /* @__PURE__ */ jsx("th", { className: "px-4 py-2 w-10" }),
75942
- section.fields.map((field, idx) => /* @__PURE__ */ jsx("th", { className: "px-4 py-2 text-left text-sm font-medium text-gray-700", children: field.label || field.key }, idx)),
76249
+ section.fields.map((field, idx) => /* @__PURE__ */ jsx(
76250
+ "th",
76251
+ {
76252
+ className: "px-4 py-2 text-left text-sm font-medium text-gray-700",
76253
+ children: field.label || field.key
76254
+ },
76255
+ idx
76256
+ )),
75943
76257
  /* @__PURE__ */ jsx("th", { className: "px-4 py-2 w-16" })
75944
76258
  ] }) }),
75945
76259
  /* @__PURE__ */ jsx("tbody", { children: data.map((row, rowIndex) => /* @__PURE__ */ jsxs(
@@ -75952,16 +76266,31 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75952
76266
  onDrop: (e) => handleDrop(e, rowIndex),
75953
76267
  onDragEnd: handleDragEnd,
75954
76268
  children: [
75955
- /* @__PURE__ */ jsx("td", { className: "px-4 py-2", children: /* @__PURE__ */ jsx("div", { className: "cursor-move text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx(GripVertical, { size: 16 }) }) }),
75956
- section.fields.map((field, fieldIndex) => /* @__PURE__ */ jsx("td", { className: "px-4 py-2", children: getFieldRenderer(field)(row, rowIndex) }, `field-${rowIndex}-${fieldIndex}-${field.key}`)),
75957
- /* @__PURE__ */ jsx("td", { className: "px-4 py-2", children: /* @__PURE__ */ jsx("button", { onClick: () => removeRow(rowIndex), className: "text-red-500 hover:text-red-700", title: "Delete row", children: /* @__PURE__ */ jsx(Trash, { size: 16 }) }) })
76269
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-2 ", children: /* @__PURE__ */ jsx("div", { className: "cursor-move text-gray-400 hover:text-gray-600", children: /* @__PURE__ */ jsx(GripVertical, { size: 16 }) }) }),
76270
+ section.fields.map((field, fieldIndex) => /* @__PURE__ */ jsx("td", { className: "px-4 py-2 ", children: getFieldRenderer(field)(row, rowIndex) }, fieldIndex)),
76271
+ /* @__PURE__ */ jsx("td", { className: "px-4 py-2 ", children: /* @__PURE__ */ jsx(
76272
+ "button",
76273
+ {
76274
+ onClick: () => removeRow(rowIndex),
76275
+ className: "text-red-500 hover:text-red-700",
76276
+ title: "Delete row",
76277
+ children: /* @__PURE__ */ jsx(Trash, { size: 16 })
76278
+ }
76279
+ ) })
75958
76280
  ]
75959
76281
  },
75960
- `row-${rowIndex}-${row.id || "empty"}`
76282
+ rowIndex
75961
76283
  )) })
75962
76284
  ] }) }),
75963
76285
  audienceRowId !== null && (() => {
75964
- const existingAudienceData = data[audienceRowId]?.[audienceFieldName] || { users: [], groups: [], roles: [] };
76286
+ const existingAudienceData = data[audienceRowId] && data[audienceRowId][audienceFieldName] ? {
76287
+ users: data[audienceRowId][audienceFieldName].users || [],
76288
+ groups: data[audienceRowId][audienceFieldName].groups || [],
76289
+ roles: data[audienceRowId][audienceFieldName].roles || []
76290
+ } : { users: [], groups: [], roles: [] };
76291
+ console.log("[DataTableRenderer] Opening modal with existing data:", existingAudienceData);
76292
+ console.log("[DataTableRenderer] Row data:", data[audienceRowId]);
76293
+ console.log("[DataTableRenderer] Field name:", audienceFieldName);
75965
76294
  return /* @__PURE__ */ jsx(
75966
76295
  AddUserGroupsRolesModal,
75967
76296
  {
@@ -75978,7 +76307,6 @@ function DataTableRenderer({ item, data: initialData, updateHandler, validationE
75978
76307
  })()
75979
76308
  ] });
75980
76309
  }
75981
- const DataTableRenderer$1 = React__default.memo(DataTableRenderer, (prevProps, nextProps) => prevProps.item === nextProps.item && prevProps.initialData === nextProps.initialData && prevProps.validationErrors === nextProps.validationErrors);
75982
76310
 
75983
76311
  function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);}else for(f in e)e[f]&&(n&&(n+=" "),n+=f);return n}function clsx(){for(var e,t,f=0,n="",o=arguments.length;f<o;f++)(e=arguments[f])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
75984
76312
 
@@ -76415,8 +76743,8 @@ const UnknownType = ({ item }) => /* @__PURE__ */ jsxs("div", { className: "p-3
76415
76743
  /* @__PURE__ */ jsx("span", { className: "font-mono", children: String(item?.type ?? "N/A") })
76416
76744
  ] });
76417
76745
  const REGISTRY = /* @__PURE__ */ Object.create(null);
76418
- REGISTRY.section = SectionRenderer$1;
76419
- REGISTRY.datatable = DataTableRenderer$1;
76746
+ REGISTRY.section = SectionRenderer;
76747
+ REGISTRY.datatable = DataTableRenderer;
76420
76748
  REGISTRY.managecollectionlist = ManageCollectionListRenderer;
76421
76749
  REGISTRY["manage-collection-list"] = ManageCollectionListRenderer;
76422
76750
  function toType(input) {
@@ -76585,10 +76913,12 @@ function DynamicConfig({
76585
76913
  }
76586
76914
  }
76587
76915
  }, [configdata, reload, appid, disableApi]);
76588
- const handleSectionChange = React__default.useCallback((name, sectiondata) => {
76916
+ const handleSectionChange = (name, sectiondata) => {
76589
76917
  setData((prev) => {
76590
- const newData = JSON.parse(JSON.stringify(prev || {}));
76591
- newData[name] = sectiondata;
76918
+ const newData = {
76919
+ ...prev,
76920
+ [name]: sectiondata
76921
+ };
76592
76922
  return newData;
76593
76923
  });
76594
76924
  setValidationErrors((prevErrors) => {
@@ -76598,7 +76928,7 @@ function DynamicConfig({
76598
76928
  }
76599
76929
  return newErrors;
76600
76930
  });
76601
- }, []);
76931
+ };
76602
76932
  const validateRequiredFields = () => {
76603
76933
  const errors = {};
76604
76934
  if (!config || !data) {
@@ -76801,7 +77131,7 @@ function DynamicConfig({
76801
77131
  category: "primary",
76802
77132
  onClick: handleSave,
76803
77133
  disabled: saving,
76804
- label: "Apply",
77134
+ label: saving ? "Saving..." : "Apply",
76805
77135
  type: "submit"
76806
77136
  }
76807
77137
  )
@@ -215269,5 +215599,5 @@ function CustomDataGrid({
215269
215599
  );
215270
215600
  }
215271
215601
 
215272
- export { AddUserGroupsRolesModal, Avatar, AvatarGroup, Badge, Breadcrumbs, Button$2 as Button, Checkbox, CustomDataGrid, CustomDialog, CustomGridToolbar, DatePicker$1 as DatePicker, DateRangePicker$1 as DateRangePicker, DynamicConfig, FileUploadModal, FullConfigPage, FullScreenLoader, GenericFilter, Input$1 as Input, ManageCollectionList, Modal, MultiSelect$1 as MultiSelect, OptionsMenu, PageHeader, PageLayout, Pagination, RadioGroup, SearchBar, Select, Sidebar, Spinner, Textarea, ToastProvider, ToggleSwitch, Tooltip$1 as Tooltip, TreeView, UnifyedCoreButton, WizardModal, adGroupsListSearchApi, axiosDelete, axiosGet, axiosPatch, axiosPost, axiosPut, cookies$1 as cookies, createHttpClient, directoryPermissionsApi, filePermissionsApi, gateWayUrl, gatewayBase, getBaseUrl, getSnapshot, http, localStore, myDriveGatewayBaseV2, notify, provisioningBase, rbacBase, searchRolesApi, sessionStore, userSearchBase };
215602
+ export { AddUserGroupsRolesModal, Avatar, AvatarGroup$1 as AvatarGroup, Badge, Breadcrumbs, Button$2 as Button, Checkbox, CustomDataGrid, CustomDialog, CustomGridToolbar, DatePicker$1 as DatePicker, DateRangePicker$1 as DateRangePicker, DynamicConfig, FileUploadModal, FullConfigPage, FullScreenLoader, GenericFilter, Input$1 as Input, ManageCollectionList, Modal, MultiSelect$1 as MultiSelect, OptionsMenu, PageHeader, PageLayout, Pagination, RadioGroup, SearchBar, Select, Sidebar, Spinner, Textarea, ToastProvider, ToggleSwitch, Tooltip$1 as Tooltip, TreeView, UnifyedCoreButton, WizardModal, adGroupsListSearchApi, axiosDelete, axiosGet, axiosPatch, axiosPost, axiosPut, cookies$1 as cookies, createHttpClient, directoryPermissionsApi, filePermissionsApi, gateWayUrl, gatewayBase, getBaseUrl, getSnapshot, http, localStore, myDriveGatewayBaseV2, notify, provisioningBase, rbacBase, searchRolesApi, sessionStore, userSearchBase };
215273
215603
  //# sourceMappingURL=unifyedx-storybook-new.es.js.map