@duke333/builder-ui 0.1.1 → 0.1.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 +38 -120
- package/dist/BuilderAdminPages-Buy2nvjs.d.ts +592 -0
- package/dist/admin/index.d.ts +7 -590
- package/dist/admin/index.js +39 -21
- package/dist/admin/index.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +61 -36
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +27 -2
- package/dist/integration/index.js +1843 -11
- package/dist/integration/index.js.map +1 -1
- package/package.json +17 -1
package/README.md
CHANGED
|
@@ -1,155 +1,73 @@
|
|
|
1
1
|
# @duke333/builder-ui
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
builder admin factory components, API client factory, React Query hook factory-уудыг
|
|
5
|
-
эзэмшинэ.
|
|
3
|
+
React Builder package for admin screens and runtime form/list/view UI.
|
|
6
4
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
This repository uses the package as a workspace dependency:
|
|
10
|
-
|
|
11
|
-
```json
|
|
12
|
-
{
|
|
13
|
-
"dependencies": {
|
|
14
|
-
"@duke333/builder-ui": "workspace:*"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Ажиллуулах:
|
|
5
|
+
## Install
|
|
20
6
|
|
|
21
7
|
```bash
|
|
22
|
-
pnpm
|
|
23
|
-
pnpm build
|
|
24
|
-
pnpm typecheck
|
|
25
|
-
pnpm test:run
|
|
8
|
+
pnpm add @duke333/builder-ui
|
|
26
9
|
```
|
|
27
10
|
|
|
28
|
-
##
|
|
29
|
-
|
|
30
|
-
Host app дээр package factory-уудыг host wrapper component болгон угсарна:
|
|
31
|
-
|
|
32
|
-
```text
|
|
33
|
-
src/features/builder/api.ts
|
|
34
|
-
src/features/builder/hooks/useBuilder.ts
|
|
35
|
-
src/features/builder/components/DynamicForm.tsx
|
|
36
|
-
src/features/builder/components/DynamicList.tsx
|
|
37
|
-
src/features/builder/components/DynamicView.tsx
|
|
38
|
-
```
|
|
11
|
+
## One File Setup
|
|
39
12
|
|
|
40
|
-
|
|
13
|
+
Use one frontend bind file:
|
|
41
14
|
|
|
42
15
|
```tsx
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
export default function RuntimePage() {
|
|
46
|
-
return <DynamicView viewId="..." />;
|
|
47
|
-
}
|
|
48
|
-
```
|
|
16
|
+
"use client";
|
|
49
17
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
```tsx
|
|
53
|
-
<DynamicForm formId="..." />
|
|
54
|
-
<DynamicList listId="..." />
|
|
55
|
-
<DynamicView viewId="..." />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`DynamicView` нь form + list нийлсэн CRUD screen. Харин зөвхөн form эсвэл зөвхөн
|
|
59
|
-
grid/list хэрэгтэй бол `DynamicForm`, `DynamicList`-ийг шууд ашиглана.
|
|
60
|
-
|
|
61
|
-
## Integration API
|
|
62
|
-
|
|
63
|
-
Host app нэг builder client object-оор API, hooks, route config-оо авах бол:
|
|
64
|
-
|
|
65
|
-
```ts
|
|
66
|
-
import { createBuilderIntegration } from "@duke333/builder-ui/integration";
|
|
18
|
+
import { createBuilderPortalIntegration } from "@duke333/builder-ui/integration";
|
|
67
19
|
import { api } from "@/lib/api/apiClient";
|
|
68
20
|
|
|
69
|
-
export const builder =
|
|
21
|
+
export const builder = createBuilderPortalIntegration({
|
|
70
22
|
transport: api,
|
|
71
23
|
adminBasePath: "/admin/dev/builder",
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- `builder.api`
|
|
78
|
-
- `builder.hooks`
|
|
79
|
-
- `builder.routes`
|
|
80
|
-
|
|
81
|
-
## Default Admin Pages
|
|
82
|
-
|
|
83
|
-
Admin home/forms/lists/views screen-үүдийг host app дотор олон wrapper файлгүйгээр
|
|
84
|
-
үүсгэх бол:
|
|
85
|
-
|
|
86
|
-
```tsx
|
|
87
|
-
import { createBuilderAdminPages } from "@duke333/builder-ui/admin";
|
|
88
|
-
import { createBuilderIntegration } from "@duke333/builder-ui/integration";
|
|
89
|
-
import { api } from "@/lib/api/apiClient";
|
|
90
|
-
|
|
91
|
-
const integration = createBuilderIntegration({
|
|
92
|
-
transport: api,
|
|
93
|
-
adminBasePath: "/admin/dev/builder",
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
export const builderAdmin = createBuilderAdminPages({
|
|
97
|
-
hooks: integration.hooks,
|
|
98
|
-
routes: {
|
|
99
|
-
adminBasePath: integration.routes.adminBasePath,
|
|
24
|
+
runtimeBasePath: "/admin/winu",
|
|
25
|
+
adminPages: {
|
|
26
|
+
permissionOptions: [{ value: "org:manage", label: "org:manage" }],
|
|
27
|
+
defaultPermission: "org:manage",
|
|
100
28
|
},
|
|
101
29
|
});
|
|
30
|
+
|
|
31
|
+
export const {
|
|
32
|
+
api: builderApi,
|
|
33
|
+
hooks: builderHooks,
|
|
34
|
+
routes: builderRoutes,
|
|
35
|
+
adminPages,
|
|
36
|
+
} = builder;
|
|
102
37
|
```
|
|
103
38
|
|
|
104
|
-
Route
|
|
39
|
+
## Route Example
|
|
105
40
|
|
|
106
41
|
```tsx
|
|
42
|
+
import { adminPages } from "@/features/builder/builder.config";
|
|
43
|
+
|
|
107
44
|
export default function Page() {
|
|
108
|
-
|
|
45
|
+
const Component = adminPages?.AdminFormsPage;
|
|
46
|
+
return Component ? <Component /> : null;
|
|
109
47
|
}
|
|
110
48
|
```
|
|
111
49
|
|
|
112
|
-
|
|
50
|
+
## Runtime Component Example
|
|
113
51
|
|
|
114
52
|
```tsx
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
53
|
+
import { createDynamicViewComponent } from "@duke333/builder-ui/components";
|
|
54
|
+
import { builderHooks } from "@/features/builder/builder.config";
|
|
118
55
|
|
|
119
|
-
export
|
|
120
|
-
|
|
121
|
-
|
|
56
|
+
export const DynamicView = createDynamicViewComponent({
|
|
57
|
+
hooks: builderHooks,
|
|
58
|
+
notifications,
|
|
59
|
+
});
|
|
122
60
|
```
|
|
123
61
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
- `AdminHomePage`
|
|
127
|
-
- `AdminFormsPage`, `AdminNewFormPage`, `AdminEditFormPage`
|
|
128
|
-
- `AdminListsPage`, `AdminNewListPage`, `AdminEditListPage`
|
|
129
|
-
- `AdminViewsPage`, `AdminNewViewPage`, `AdminEditViewPage`
|
|
130
|
-
|
|
131
|
-
## Host UI Adapter
|
|
132
|
-
|
|
133
|
-
Package нь shadcn/ui-г шууд эзэмшихгүй. Default admin pages нь dependency-free HTML
|
|
134
|
-
controls ашиглана. Host app өөрийн Button, Dialog, DataGrid, form renderer зэрэг
|
|
135
|
-
design-system component-уудаа adapter-аар өгвөл custom UI layer ашиглаж болно.
|
|
62
|
+
Use:
|
|
136
63
|
|
|
137
|
-
|
|
64
|
+
- `DynamicForm` for form-only write flow
|
|
65
|
+
- `DynamicList` for list-only read flow
|
|
66
|
+
- `DynamicView` for full CRUD flow
|
|
138
67
|
|
|
139
|
-
|
|
140
|
-
target registry. The package is configured for public npm publishing.
|
|
141
|
-
|
|
142
|
-
External portal project дээр:
|
|
68
|
+
## Validation
|
|
143
69
|
|
|
144
70
|
```bash
|
|
145
|
-
pnpm
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
Update:
|
|
149
|
-
|
|
150
|
-
```bash
|
|
151
|
-
pnpm update @duke333/builder-ui
|
|
71
|
+
pnpm typecheck
|
|
72
|
+
pnpm test:run
|
|
152
73
|
```
|
|
153
|
-
|
|
154
|
-
Package нь `dist` output publish хийнэ. `prepack` нь publish/pack хийхээс өмнө
|
|
155
|
-
`pnpm build` ажиллуулна.
|