@duke333/builder-ui 0.2.4 → 0.2.5
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 +18 -0
- package/dist/{BuilderAdminPages-DwwdA8Dv.d.ts → BuilderAdminPages-bV-lwDOp.d.ts} +3 -0
- package/dist/admin/index.d.ts +2 -2
- package/dist/admin/index.js +10 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/index.d.ts +17 -2
- package/dist/index.js +90 -38
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +1 -1
- package/dist/integration/index.js +10 -0
- package/dist/integration/index.js.map +1 -1
- package/dist/styles.css +43 -0
- package/dist/styles.css.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -53,6 +53,24 @@ loading, empty, errors, focus restoration, and row action isolation. Runtime for
|
|
|
53
53
|
|
|
54
54
|
The existing `createDynamic*Component` factories remain available as the advanced headless API.
|
|
55
55
|
|
|
56
|
+
## Form Layout Presentation
|
|
57
|
+
|
|
58
|
+
Form layout groups stay backward-compatible and render as stacked sections by default. Set the
|
|
59
|
+
layout presentation to `tabs` when each group should be shown as a tab:
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
layout: {
|
|
63
|
+
presentation: "tabs",
|
|
64
|
+
groups: [
|
|
65
|
+
{ id: "general", title: "General", columns: 12, fields: [] },
|
|
66
|
+
{ id: "content", title: "Content", columns: 12, fields: [] },
|
|
67
|
+
],
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
The ready runtime keeps inactive tab fields mounted so their form state and validation remain
|
|
72
|
+
intact. Headless consumers should preserve the same behavior in their form adapter.
|
|
73
|
+
|
|
56
74
|
## Validation
|
|
57
75
|
|
|
58
76
|
```bash
|
|
@@ -87,6 +87,7 @@ type BuilderEditorFormLayoutGroup = {
|
|
|
87
87
|
fields?: BuilderEditorFormLayoutField[];
|
|
88
88
|
};
|
|
89
89
|
type BuilderEditorFormLayout = {
|
|
90
|
+
presentation?: "stacked" | "tabs";
|
|
90
91
|
groups?: BuilderEditorFormLayoutGroup[];
|
|
91
92
|
};
|
|
92
93
|
type BuilderEditorColumn = {
|
|
@@ -189,6 +190,7 @@ type BuilderFormEditorValues<TFieldType extends string = string, TTriggerEvent e
|
|
|
189
190
|
sourceTable: string;
|
|
190
191
|
apiBasePath?: string;
|
|
191
192
|
fields: BuilderFormEditorFieldValues<TFieldType>[];
|
|
193
|
+
layoutPresentation: "stacked" | "tabs";
|
|
192
194
|
layoutGroups: BuilderFormEditorLayoutGroupValues[];
|
|
193
195
|
subforms?: BuilderFormEditorSubformValues[];
|
|
194
196
|
triggers: BuilderEditorTriggerValues<TTriggerEvent>[];
|
|
@@ -295,6 +297,7 @@ declare function builderFormEditorInputFromValues<TFieldType extends string, TTr
|
|
|
295
297
|
}[];
|
|
296
298
|
}[];
|
|
297
299
|
layout: {
|
|
300
|
+
presentation: "stacked" | "tabs";
|
|
298
301
|
groups: BuilderFormEditorLayoutGroupValues[];
|
|
299
302
|
};
|
|
300
303
|
subforms: {
|
package/dist/admin/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as BuilderViewEditorEntity, D as BuilderViewEditorValues, X as BuilderFormEditorLayoutGroupValues, u as BuilderFormEditorValues, s as BuilderFormEditorFieldValues, Y as BuilderFormEditorSubformValues } from '../BuilderAdminPages-
|
|
2
|
-
export { B as BUILDER_EDITOR_NONE_VALUE, a as BuilderAdminPageContracts, b as BuilderAdminPagesOptions, c as BuilderAdminPagesRoutes, d as BuilderDefaultEntity, e as BuilderDefaultEntityListResult, f as BuilderDefaultEntityManagerDependencies, g as BuilderDefaultEntityManagerLabels, h as BuilderDefaultEntityManagerState, i as BuilderDefaultEntityMutation, j as BuilderDefaultEntityQueryResult, k as BuilderDefaultFormEditorBodyOptions, l as BuilderDefaultListEditorBodyOptions, m as BuilderDefaultOption, n as BuilderEditorDbTable, o as BuilderEditorSelectOption, p as BuilderEditorTriggerValues, q as BuilderFormEditorBodyProps, r as BuilderFormEditorEntity, t as BuilderFormEditorPageDependencies, v as BuilderListEditorBodyProps, w as BuilderListEditorColumnValues, x as BuilderListEditorEntity, y as BuilderListEditorOrderByValues, z as BuilderListEditorPageDependencies, A as BuilderListEditorValues, E as builderEditorOptionsToText, F as builderEditorSearchFieldsToText, G as builderEditorTextToOptions, H as builderEditorTextToSearchFields, Z as builderFormEditorDefaultLayoutGroups, _ as builderFormEditorDefaultSpan, I as builderFormEditorFieldsFromTable, J as builderFormEditorInputFromValues, K as builderFormEditorValuesFromEntity, L as builderListEditorColumnsFromTable, M as builderListEditorInputFromValues, N as builderListEditorValuesFromEntity, O as builderViewEditorInputFromValues, P as builderViewEditorValuesFromEntity, Q as createBuilderAdminPages, R as createBuilderDefaultEntityManagerComponent, S as createBuilderDefaultFormEditorBody, T as createBuilderDefaultListEditorBody, U as createBuilderFormEditorPageComponent, V as createBuilderListEditorPageComponent, W as getBuilderEditorTriggerRoute } from '../BuilderAdminPages-
|
|
1
|
+
import { C as BuilderViewEditorEntity, D as BuilderViewEditorValues, X as BuilderFormEditorLayoutGroupValues, u as BuilderFormEditorValues, s as BuilderFormEditorFieldValues, Y as BuilderFormEditorSubformValues } from '../BuilderAdminPages-bV-lwDOp.js';
|
|
2
|
+
export { B as BUILDER_EDITOR_NONE_VALUE, a as BuilderAdminPageContracts, b as BuilderAdminPagesOptions, c as BuilderAdminPagesRoutes, d as BuilderDefaultEntity, e as BuilderDefaultEntityListResult, f as BuilderDefaultEntityManagerDependencies, g as BuilderDefaultEntityManagerLabels, h as BuilderDefaultEntityManagerState, i as BuilderDefaultEntityMutation, j as BuilderDefaultEntityQueryResult, k as BuilderDefaultFormEditorBodyOptions, l as BuilderDefaultListEditorBodyOptions, m as BuilderDefaultOption, n as BuilderEditorDbTable, o as BuilderEditorSelectOption, p as BuilderEditorTriggerValues, q as BuilderFormEditorBodyProps, r as BuilderFormEditorEntity, t as BuilderFormEditorPageDependencies, v as BuilderListEditorBodyProps, w as BuilderListEditorColumnValues, x as BuilderListEditorEntity, y as BuilderListEditorOrderByValues, z as BuilderListEditorPageDependencies, A as BuilderListEditorValues, E as builderEditorOptionsToText, F as builderEditorSearchFieldsToText, G as builderEditorTextToOptions, H as builderEditorTextToSearchFields, Z as builderFormEditorDefaultLayoutGroups, _ as builderFormEditorDefaultSpan, I as builderFormEditorFieldsFromTable, J as builderFormEditorInputFromValues, K as builderFormEditorValuesFromEntity, L as builderListEditorColumnsFromTable, M as builderListEditorInputFromValues, N as builderListEditorValuesFromEntity, O as builderViewEditorInputFromValues, P as builderViewEditorValuesFromEntity, Q as createBuilderAdminPages, R as createBuilderDefaultEntityManagerComponent, S as createBuilderDefaultFormEditorBody, T as createBuilderDefaultListEditorBody, U as createBuilderFormEditorPageComponent, V as createBuilderListEditorPageComponent, W as getBuilderEditorTriggerRoute } from '../BuilderAdminPages-bV-lwDOp.js';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ComponentType, ReactNode } from 'react';
|
|
5
5
|
import { BuilderApiContracts } from '../api/index.js';
|
package/dist/admin/index.js
CHANGED
|
@@ -145,6 +145,7 @@ function builderFormEditorValuesFromEntity(form, emptyValues) {
|
|
|
145
145
|
sourceTable: source?.type === "dbTable" ? source.tableName : BUILDER_EDITOR_NONE_VALUE,
|
|
146
146
|
apiBasePath: source?.type === "apiEndpoint" ? source.basePath : "",
|
|
147
147
|
fields,
|
|
148
|
+
layoutPresentation: form.schema.layout?.presentation ?? "stacked",
|
|
148
149
|
layoutGroups: normalizeBuilderFormEditorLayoutGroups(
|
|
149
150
|
form.schema.layout?.groups,
|
|
150
151
|
fields,
|
|
@@ -264,6 +265,7 @@ function builderFormEditorInputFromValues(values) {
|
|
|
264
265
|
}))
|
|
265
266
|
})),
|
|
266
267
|
layout: {
|
|
268
|
+
presentation: values.layoutPresentation,
|
|
267
269
|
groups: normalizeBuilderFormEditorLayoutGroups(
|
|
268
270
|
values.layoutGroups,
|
|
269
271
|
values.fields,
|
|
@@ -657,6 +659,13 @@ function createBuilderDefaultFormEditorBody(options) {
|
|
|
657
659
|
}
|
|
658
660
|
)
|
|
659
661
|
] }),
|
|
662
|
+
/* @__PURE__ */ jsx("div", { style: styles.grid, children: /* @__PURE__ */ jsxs("label", { style: styles.field, children: [
|
|
663
|
+
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Group presentation" }),
|
|
664
|
+
/* @__PURE__ */ jsxs("select", { style: styles.input, ...form.register("layoutPresentation"), children: [
|
|
665
|
+
/* @__PURE__ */ jsx("option", { value: "stacked", children: "Stacked sections" }),
|
|
666
|
+
/* @__PURE__ */ jsx("option", { value: "tabs", children: "Tabs" })
|
|
667
|
+
] })
|
|
668
|
+
] }) }),
|
|
660
669
|
form.watch("layoutGroups").map((group, groupIndex) => /* @__PURE__ */ jsxs("div", { style: styles.row, children: [
|
|
661
670
|
/* @__PURE__ */ jsxs("label", { style: styles.field, children: [
|
|
662
671
|
/* @__PURE__ */ jsx("span", { style: styles.label, children: "Group title" }),
|
|
@@ -1714,6 +1723,7 @@ function createBuilderAdminPages({
|
|
|
1714
1723
|
sourceTable: BUILDER_EDITOR_NONE_VALUE,
|
|
1715
1724
|
apiBasePath: "",
|
|
1716
1725
|
fields: [emptyField],
|
|
1726
|
+
layoutPresentation: "stacked",
|
|
1717
1727
|
layoutGroups: builderFormEditorDefaultLayoutGroups([emptyField]),
|
|
1718
1728
|
subforms: [],
|
|
1719
1729
|
triggers: [],
|