@duke333/builder-ui 0.1.0 → 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 +47 -59
- package/dist/BuilderAdminPages-Buy2nvjs.d.ts +592 -0
- package/dist/admin/index.d.ts +89 -430
- package/dist/admin/index.js +1588 -49
- package/dist/admin/index.js.map +1 -1
- package/dist/hooks/index.d.ts +3 -0
- package/dist/hooks/index.js +9 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1686 -93
- package/dist/index.js.map +1 -1
- package/dist/integration/index.d.ts +52 -0
- package/dist/integration/index.js +2267 -0
- package/dist/integration/index.js.map +1 -0
- package/package.json +21 -1
package/README.md
CHANGED
|
@@ -1,85 +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
|
-
##
|
|
11
|
+
## One File Setup
|
|
29
12
|
|
|
30
|
-
|
|
13
|
+
Use one frontend bind file:
|
|
31
14
|
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
15
|
+
```tsx
|
|
16
|
+
"use client";
|
|
17
|
+
|
|
18
|
+
import { createBuilderPortalIntegration } from "@duke333/builder-ui/integration";
|
|
19
|
+
import { api } from "@/lib/api/apiClient";
|
|
20
|
+
|
|
21
|
+
export const builder = createBuilderPortalIntegration({
|
|
22
|
+
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
|
+
});
|
|
30
|
+
|
|
31
|
+
export const {
|
|
32
|
+
api: builderApi,
|
|
33
|
+
hooks: builderHooks,
|
|
34
|
+
routes: builderRoutes,
|
|
35
|
+
adminPages,
|
|
36
|
+
} = builder;
|
|
38
37
|
```
|
|
39
38
|
|
|
40
|
-
|
|
39
|
+
## Route Example
|
|
41
40
|
|
|
42
41
|
```tsx
|
|
43
|
-
import {
|
|
42
|
+
import { adminPages } from "@/features/builder/builder.config";
|
|
44
43
|
|
|
45
|
-
export default function
|
|
46
|
-
|
|
44
|
+
export default function Page() {
|
|
45
|
+
const Component = adminPages?.AdminFormsPage;
|
|
46
|
+
return Component ? <Component /> : null;
|
|
47
47
|
}
|
|
48
48
|
```
|
|
49
49
|
|
|
50
|
-
|
|
50
|
+
## Runtime Component Example
|
|
51
51
|
|
|
52
52
|
```tsx
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<DynamicView viewId="..." />
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
`DynamicView` нь form + list нийлсэн CRUD screen. Харин зөвхөн form эсвэл зөвхөн
|
|
59
|
-
grid/list хэрэгтэй бол `DynamicForm`, `DynamicList`-ийг шууд ашиглана.
|
|
53
|
+
import { createDynamicViewComponent } from "@duke333/builder-ui/components";
|
|
54
|
+
import { builderHooks } from "@/features/builder/builder.config";
|
|
60
55
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
## Publish / Update
|
|
68
|
-
|
|
69
|
-
Publish after `@duke333/builder-contracts` and `@duke333/builder-backend` are available in the
|
|
70
|
-
target registry. The package is configured for public npm publishing.
|
|
56
|
+
export const DynamicView = createDynamicViewComponent({
|
|
57
|
+
hooks: builderHooks,
|
|
58
|
+
notifications,
|
|
59
|
+
});
|
|
60
|
+
```
|
|
71
61
|
|
|
72
|
-
|
|
62
|
+
Use:
|
|
73
63
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
- `DynamicForm` for form-only write flow
|
|
65
|
+
- `DynamicList` for list-only read flow
|
|
66
|
+
- `DynamicView` for full CRUD flow
|
|
77
67
|
|
|
78
|
-
|
|
68
|
+
## Validation
|
|
79
69
|
|
|
80
70
|
```bash
|
|
81
|
-
pnpm
|
|
71
|
+
pnpm typecheck
|
|
72
|
+
pnpm test:run
|
|
82
73
|
```
|
|
83
|
-
|
|
84
|
-
Package нь `dist` output publish хийнэ. `prepack` нь publish/pack хийхээс өмнө
|
|
85
|
-
`pnpm build` ажиллуулна.
|