@uniform-ts/core 0.0.2 → 0.0.3
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/README.md +39 -4
- package/dist/index.d.mts +21 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.js +19 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -376,9 +376,10 @@ function DefaultFormWrapper({ children }) {
|
|
|
376
376
|
}
|
|
377
377
|
function DefaultSectionWrapper({
|
|
378
378
|
children,
|
|
379
|
-
title
|
|
379
|
+
title,
|
|
380
|
+
className
|
|
380
381
|
}) {
|
|
381
|
-
return /* @__PURE__ */ jsxs("fieldset", { children: [
|
|
382
|
+
return /* @__PURE__ */ jsxs("fieldset", { className, children: [
|
|
382
383
|
/* @__PURE__ */ jsx("legend", { children: title }),
|
|
383
384
|
children
|
|
384
385
|
] });
|
|
@@ -1503,7 +1504,17 @@ function AutoForm(props) {
|
|
|
1503
1504
|
if (section.title === null) {
|
|
1504
1505
|
return /* @__PURE__ */ jsx(React3.Fragment, { children: renderedFields }, "__ungrouped");
|
|
1505
1506
|
}
|
|
1506
|
-
|
|
1507
|
+
const sectionConfig = layout?.sections?.[section.title];
|
|
1508
|
+
const PerSectionWrapper = sectionConfig?.component ?? SectionWrapper;
|
|
1509
|
+
return /* @__PURE__ */ jsx(
|
|
1510
|
+
PerSectionWrapper,
|
|
1511
|
+
{
|
|
1512
|
+
title: section.title,
|
|
1513
|
+
className: sectionConfig?.className,
|
|
1514
|
+
children: renderedFields
|
|
1515
|
+
},
|
|
1516
|
+
section.title
|
|
1517
|
+
);
|
|
1507
1518
|
}),
|
|
1508
1519
|
/* @__PURE__ */ jsx(
|
|
1509
1520
|
SubmitButton,
|
|
@@ -1523,7 +1534,11 @@ function createAutoForm(config) {
|
|
|
1523
1534
|
[props.components]
|
|
1524
1535
|
);
|
|
1525
1536
|
const mergedLayout = React3.useMemo(
|
|
1526
|
-
() => ({
|
|
1537
|
+
() => ({
|
|
1538
|
+
...config.layout,
|
|
1539
|
+
...props.layout,
|
|
1540
|
+
sections: config.layout?.sections || props.layout?.sections ? { ...config.layout?.sections, ...props.layout?.sections } : void 0
|
|
1541
|
+
}),
|
|
1527
1542
|
[props.layout]
|
|
1528
1543
|
);
|
|
1529
1544
|
const mergedClassNames = React3.useMemo(
|