@duke333/builder-ui 0.1.5 → 0.2.1
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 +20 -39
- package/dist/admin/index.js +2 -0
- package/dist/admin/index.js.map +1 -1
- package/dist/api/index.d.ts +5 -2
- package/dist/api/index.js +9 -1
- package/dist/api/index.js.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/hooks/index.js +2 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +2211 -6
- package/dist/index.js +3501 -2793
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +2 -0
- package/dist/integration/index.js +17 -2
- package/dist/integration/index.js.map +1 -1
- package/dist/styles.css +405 -0
- package/dist/styles.css.map +1 -0
- package/dist/styles.d.ts +2 -0
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -15,62 +15,43 @@ Use one frontend bind file:
|
|
|
15
15
|
```tsx
|
|
16
16
|
"use client";
|
|
17
17
|
|
|
18
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
BuilderProvider,
|
|
20
|
+
createBuilderClient,
|
|
21
|
+
} from "@duke333/builder-ui";
|
|
22
|
+
import "@duke333/builder-ui/styles.css";
|
|
19
23
|
import { api } from "@/lib/api/apiClient";
|
|
20
24
|
|
|
21
|
-
export const
|
|
25
|
+
export const builderClient = createBuilderClient({
|
|
22
26
|
transport: api,
|
|
23
|
-
adminBasePath: "/admin/dev/builder",
|
|
24
|
-
runtimeBasePath: "/admin/winu",
|
|
25
|
-
adminPages: {
|
|
26
|
-
permissionOptions: [{ value: "org:manage", label: "org:manage" }],
|
|
27
|
-
defaultPermission: "org:manage",
|
|
28
|
-
},
|
|
29
27
|
});
|
|
30
28
|
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
routes: builderRoutes,
|
|
35
|
-
adminPages,
|
|
36
|
-
} = builder;
|
|
29
|
+
export function AppBuilderProvider({ children }: { children: React.ReactNode }) {
|
|
30
|
+
return <BuilderProvider client={builderClient}>{children}</BuilderProvider>;
|
|
31
|
+
}
|
|
37
32
|
```
|
|
38
33
|
|
|
39
|
-
##
|
|
34
|
+
## Runtime Components
|
|
40
35
|
|
|
41
36
|
```tsx
|
|
42
|
-
import {
|
|
37
|
+
import { BuilderForm, BuilderGrid, BuilderView } from "@duke333/builder-ui";
|
|
43
38
|
|
|
44
39
|
export default function Page() {
|
|
45
|
-
|
|
46
|
-
return Component ? <Component /> : null;
|
|
40
|
+
return <BuilderView viewId="orders-view-id" />;
|
|
47
41
|
}
|
|
48
42
|
```
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
import { createDynamicViewComponent } from "@duke333/builder-ui/components";
|
|
54
|
-
import { builderHooks } from "@/features/builder/builder.config";
|
|
55
|
-
|
|
56
|
-
export const DynamicView = createDynamicViewComponent({
|
|
57
|
-
hooks: builderHooks,
|
|
58
|
-
notifications,
|
|
59
|
-
});
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Use:
|
|
44
|
+
The ready components are:
|
|
63
45
|
|
|
64
|
-
- `
|
|
65
|
-
- `
|
|
66
|
-
- `
|
|
46
|
+
- `BuilderForm` for form-only write flow
|
|
47
|
+
- `BuilderGrid` for list-only read flow
|
|
48
|
+
- `BuilderView` for full CRUD flow
|
|
67
49
|
|
|
68
|
-
|
|
69
|
-
|
|
50
|
+
They own fetching, fields, validation, search, sort, pagination, CRUD, Dialog/Drawer, subforms,
|
|
51
|
+
loading, empty, errors, focus restoration, and row action isolation. Runtime form schemas expose
|
|
52
|
+
`presentation: "dialog" | "drawer"`; no host shell mapping is required.
|
|
70
53
|
|
|
71
|
-
|
|
72
|
-
buttons should pass their click event to `actions.onEdit(row, event)` or
|
|
73
|
-
`actions.onDelete(row, event)` so an action click cannot also open the row editor.
|
|
54
|
+
The existing `createDynamic*Component` factories remain available as the advanced headless API.
|
|
74
55
|
|
|
75
56
|
## Validation
|
|
76
57
|
|