@_tc/template-core 0.0.2 → 0.1.0

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.
Files changed (177) hide show
  1. package/.skills/tc-generator/SKILL.md +62 -0
  2. package/.skills/tc-generator/reference/example.md +357 -0
  3. package/.skills/tc-generator/reference/model-schema.md +326 -0
  4. package/.skills/tc-generator/reference/project-template/app/controller/product.js +73 -0
  5. package/.skills/tc-generator/reference/project-template/app/router/product.js +9 -0
  6. package/.skills/tc-generator/reference/project-template/config/config.default.js +3 -0
  7. package/.skills/tc-generator/reference/project-template/index.js +17 -0
  8. package/.skills/tc-generator/reference/project-template/model/product/mode.js +179 -0
  9. package/.skills/tc-generator/reference/project-template/model/product/project/default.js +4 -0
  10. package/.skills/tc-generator/reference/project-template/package.json +10 -0
  11. package/README.md +239 -17
  12. package/cjs/_virtual/_rolldown/runtime.js +1 -1
  13. package/cjs/app/controller/base.js +1 -1
  14. package/cjs/app/controller/project.js +1 -1
  15. package/cjs/app/controller/view.js +1 -1
  16. package/cjs/app/extend/$fetch.js +1 -1
  17. package/cjs/app/extend/db.js +1 -1
  18. package/cjs/app/extend/generateErrorMessage.js +1 -1
  19. package/cjs/app/extend/logger.js +1 -1
  20. package/cjs/app/extend/parsingParamsOnUrl.js +1 -1
  21. package/cjs/app/middleware/api-sign-verify.js +1 -1
  22. package/cjs/app/middleware/error-handle.js +1 -1
  23. package/cjs/app/middleware/project-handler.js +1 -1
  24. package/cjs/app/middleware.js +1 -1
  25. package/cjs/app/router/project.js +1 -1
  26. package/cjs/app/router/view.js +1 -1
  27. package/cjs/app/router-schema/project.js +1 -1
  28. package/cjs/app/service/base.js +1 -1
  29. package/cjs/app/service/project.js +1 -1
  30. package/cjs/app/type.js +0 -1
  31. package/cjs/app/typings.js +0 -1
  32. package/cjs/app/view/entry.tpl +27 -28
  33. package/cjs/bundler/defaultAlias.js +1 -1
  34. package/cjs/bundler/dev.js +1 -1
  35. package/cjs/bundler/index.js +1 -1
  36. package/cjs/bundler/prod.js +1 -1
  37. package/cjs/bundler/state.js +1 -1
  38. package/cjs/config/config.default.js +1 -0
  39. package/cjs/index.js +1 -1
  40. package/cjs/packages/common/LRUCache.js +1 -1
  41. package/cjs/packages/common/array/index.js +1 -1
  42. package/cjs/packages/common/cache/LRUCache.js +1 -1
  43. package/cjs/packages/common/cache/index.js +1 -1
  44. package/cjs/packages/common/guards/index.js +1 -1
  45. package/cjs/packages/common/http/index.js +1 -1
  46. package/cjs/packages/common/i18n/default.js +1 -1
  47. package/cjs/packages/common/i18n/en-US.js +1 -1
  48. package/cjs/packages/common/i18n/index.js +1 -1
  49. package/cjs/packages/common/i18n/locales.js +1 -1
  50. package/cjs/packages/common/i18n/types.js +0 -1
  51. package/cjs/packages/common/index.js +1 -1
  52. package/cjs/packages/common/log/index.js +1 -1
  53. package/cjs/packages/common/number/index.js +1 -1
  54. package/cjs/packages/common/object/filterEmpty.js +1 -1
  55. package/cjs/packages/common/object/filtereEmpty.js +1 -1
  56. package/cjs/packages/common/object/index.js +1 -1
  57. package/cjs/packages/common/string/index.js +1 -1
  58. package/cjs/packages/common/types/index.js +0 -1
  59. package/cjs/packages/core/env.js +1 -1
  60. package/cjs/packages/core/index.js +1 -1
  61. package/cjs/packages/core/loader/config.js +1 -1
  62. package/cjs/packages/core/loader/controller.js +1 -1
  63. package/cjs/packages/core/loader/extend.js +1 -1
  64. package/cjs/packages/core/loader/middleware.js +1 -1
  65. package/cjs/packages/core/loader/router-schema.js +1 -1
  66. package/cjs/packages/core/loader/service.js +1 -1
  67. package/cjs/packages/core/paths.js +1 -1
  68. package/cjs/packages/core/types.js +0 -1
  69. package/cjs/packages/utils/getAllFnReturnValue.js +0 -1
  70. package/cjs/packages/utils/index.js +1 -1
  71. package/esm/_virtual/_rolldown/runtime.js +2 -15
  72. package/esm/app/controller/view.js +13 -11
  73. package/esm/app/middleware/api-sign-verify.js +9 -11
  74. package/esm/app/middleware.js +6 -6
  75. package/esm/app/view/entry.tpl +27 -28
  76. package/esm/config/config.default.js +9 -0
  77. package/esm/index.js +1 -1
  78. package/esm/packages/core/index.js +24 -26
  79. package/esm/packages/core/loader/config.js +11 -10
  80. package/esm/packages/core/loader/extend.js +13 -8
  81. package/fe/frontend/apps/dash/Dashboard.js +100 -1
  82. package/fe/frontend/apps/dash/dash.entry.js +2 -2
  83. package/fe/frontend/apps/ui-components/index.js +8 -0
  84. package/fe/frontend/apps/ui-components/ui-components.entry.d.ts +2 -0
  85. package/fe/frontend/src/api/baseInfo.d.ts +2 -2
  86. package/fe/frontend/src/common/fetchErrorShow.js +2 -1
  87. package/fe/frontend/src/common/generateMenuData.js +2 -1
  88. package/fe/frontend/src/common/importComponent.js +5 -2
  89. package/fe/frontend/src/common/language.d.ts +2 -1
  90. package/fe/frontend/src/common/language.js +7 -5
  91. package/fe/frontend/src/common/logFn/index.js +6 -4
  92. package/fe/frontend/src/common/request.js +6 -4
  93. package/fe/frontend/src/components/BasePage/HeaderView.d.ts +2 -1
  94. package/fe/frontend/src/components/BasePage/HeaderView.js +9 -4
  95. package/fe/frontend/src/defaultPages/Iframe/index.js +1 -7
  96. package/fe/frontend/src/defaultPages/NotFoundPage/index.d.ts +3 -0
  97. package/fe/frontend/src/defaultPages/NotFoundPage/index.js +7 -0
  98. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +3 -2
  99. package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +8 -2
  100. package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +4 -3
  101. package/fe/frontend/src/defaultPages/SchemaPage/index.css +0 -55
  102. package/fe/frontend/src/defaultPages/SchemaPage/index.js +3 -1
  103. package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +5 -1
  104. package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +142 -7
  105. package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +2 -1
  106. package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +1 -1
  107. package/fe/frontend/src/defaultPages/SlotPage/index.js +2 -1
  108. package/fe/frontend/src/hooks/useCurrentMenuData.js +1 -1
  109. package/fe/frontend/src/index.d.ts +4 -0
  110. package/fe/frontend/src/index.js +4 -0
  111. package/fe/frontend/src/language/en-US.d.ts +76 -0
  112. package/fe/frontend/src/language/en-US.js +75 -0
  113. package/fe/frontend/src/language/index.d.ts +66 -0
  114. package/fe/frontend/src/language/index.js +69 -0
  115. package/fe/frontend/src/language/zh-CN.d.ts +76 -0
  116. package/fe/frontend/src/language/zh-CN.js +75 -0
  117. package/fe/frontend/src/main.css +1 -1
  118. package/fe/frontend/src/typing/window.d.ts +2 -0
  119. package/fe/model/types/data/button.d.ts +2 -2
  120. package/fe/model/types/data/button.js +1 -1
  121. package/fe/model/types/model.d.ts +19 -12
  122. package/fe/packages/ui/react/components/Card/Card.d.ts +10 -0
  123. package/fe/packages/ui/react/components/Card/Card.js +8 -0
  124. package/fe/packages/ui/react/components/Card/index.d.ts +2 -0
  125. package/fe/packages/ui/react/components/Card/index.js +1 -0
  126. package/fe/packages/ui/react/components/DataTable/index.js +7 -3
  127. package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +3 -3
  128. package/fe/packages/ui/react/components/Layout/Layout.d.ts +11 -0
  129. package/fe/packages/ui/react/components/Layout/Layout.js +8 -0
  130. package/fe/packages/ui/react/components/Layout/index.d.ts +2 -0
  131. package/fe/packages/ui/react/components/Layout/index.js +1 -0
  132. package/fe/packages/ui/react/components/Loading/Loading.d.ts +9 -0
  133. package/fe/packages/ui/react/components/Loading/Loading.js +13 -0
  134. package/fe/packages/ui/react/components/Loading/index.d.ts +2 -0
  135. package/fe/packages/ui/react/components/Loading/index.js +1 -0
  136. package/fe/packages/ui/react/components/Menu/Menu.js +3 -2
  137. package/fe/packages/ui/react/components/Notification/Notification.d.ts +14 -0
  138. package/fe/packages/ui/react/components/Notification/Notification.js +29 -0
  139. package/fe/packages/ui/react/components/Notification/index.d.ts +2 -0
  140. package/fe/packages/ui/react/components/Notification/index.js +1 -0
  141. package/fe/packages/ui/react/components/Radio/Radio.d.ts +9 -0
  142. package/fe/packages/ui/react/components/Radio/Radio.js +20 -0
  143. package/fe/packages/ui/react/components/Radio/RadioGroup.d.ts +19 -0
  144. package/fe/packages/ui/react/components/Radio/RadioGroup.js +21 -0
  145. package/fe/packages/ui/react/components/Radio/index.d.ts +3 -0
  146. package/fe/packages/ui/react/components/Radio/index.js +2 -0
  147. package/fe/packages/ui/react/components/Search/Search.d.ts +1 -1
  148. package/fe/packages/ui/react/components/Search/Search.js +1 -5
  149. package/fe/packages/ui/react/components/Tabs/Tabs.d.ts +16 -0
  150. package/fe/packages/ui/react/components/Tabs/Tabs.js +19 -0
  151. package/fe/packages/ui/react/components/Tabs/index.d.ts +2 -0
  152. package/fe/packages/ui/react/components/Tabs/index.js +1 -0
  153. package/fe/packages/ui/react/components/hooks/useInputController.js +0 -1
  154. package/fe/packages/ui/react/components/index.d.ts +6 -0
  155. package/fe/packages/ui/react/components/index.js +6 -0
  156. package/fe/packages/ui/react/components/table/table.d.ts +3 -0
  157. package/fe/packages/ui/react/components/table/table.js +6 -6
  158. package/fe/packages/ui/react/components/testPage/index.js +54 -11
  159. package/fe/packages/ui/react/index.css +4 -0
  160. package/model/index.d.ts +1 -1
  161. package/model/types/data/button.d.ts +2 -2
  162. package/model/types/index.d.ts +1 -1
  163. package/model/types/model.d.ts +19 -12
  164. package/package.json +15 -16
  165. package/types/config/config.default.d.ts +2 -1
  166. package/types/index.d.ts +1 -1
  167. package/types/packages/core/index.d.ts +3 -3
  168. package/types/packages/core/loader/extend.d.ts +1 -1
  169. package/types/packages/core/paths.d.ts +4 -7
  170. package/types/packages/core/types.d.ts +31 -6
  171. package/cjs/app/data/signKey.js +0 -1
  172. package/esm/app/data/signKey.js +0 -8
  173. package/fe/frontend/apps/testPage/index.js +0 -6
  174. package/fe/frontend/apps/testPage/testPage.entry.d.ts +0 -2
  175. package/types/app/data/signKey.d.ts +0 -1
  176. /package/fe/frontend/apps/{testPage → ui-components}/index.d.ts +0 -0
  177. /package/fe/frontend/apps/{testPage/testPage.entry.js → ui-components/ui-components.entry.js} +0 -0
@@ -0,0 +1,326 @@
1
+ # TemplateCore Model Schema Reference
2
+
3
+ ## File Layout
4
+
5
+ The model loader reads the business root:
6
+
7
+ ```text
8
+ model/{modelKey}/mode.js
9
+ model/{modelKey}/project/{projectKey}.js
10
+ ```
11
+
12
+ `model/index.js` and `model/index.ts` are ignored.
13
+
14
+ Loader output shape:
15
+
16
+ ```js
17
+ [
18
+ {
19
+ model: {
20
+ key: "product",
21
+ ...modeConfig,
22
+ },
23
+ project: {
24
+ default: {
25
+ key: "default",
26
+ modelKey: "product",
27
+ ...mergedProjectConfig,
28
+ },
29
+ },
30
+ },
31
+ ]
32
+ ```
33
+
34
+ Project config inherits the model config. Arrays are merged by stable `key`:
35
+
36
+ - same `key`: recursively merge, project overrides model
37
+ - only in model: inherited
38
+ - only in project: appended
39
+
40
+ ## Top-Level Model
41
+
42
+ ```js
43
+ module.exports = {
44
+ mode: "MB",
45
+ name: "Product Admin",
46
+ desc: "Product management",
47
+ icon: "",
48
+ homePage: "/_sidebar_/product?projk=default",
49
+ menuLayout: "left",
50
+ menu: [],
51
+ };
52
+ ```
53
+
54
+ Fields:
55
+
56
+ | Field | Required | Notes |
57
+ | --- | --- | --- |
58
+ | `mode` | yes | Currently `"MB"` for admin backend. |
59
+ | `homePage` | no | Default page path. If omitted or not matched to a renderable menu route, Dashboard redirects to the first available menu item. |
60
+ | `name` | no | Model display name. |
61
+ | `desc` | no | Model description. Header title prefers `desc`, then falls back to `name`. |
62
+ | `icon` | no | Header brand icon. Image URL/path/data image renders as a logo; plain string renders as text; omitted uses the built-in default icon. |
63
+ | `menuLayout` | no | `"left"` default, or `"top"`. |
64
+ | `menu` | yes | Menu tree. |
65
+
66
+ For `left` layout, built-in menu routes are under `/_sidebar_/{menuKey}`. For `top` layout, built-in menu routes are `/{menuKey}`. Put project-specific query values, such as `projk`, in the project override when they differ per project.
67
+
68
+ ## Menu Types
69
+
70
+ Group menu:
71
+
72
+ ```js
73
+ {
74
+ key: "catalog",
75
+ name: "Catalog",
76
+ menuType: "group",
77
+ subMenu: [],
78
+ }
79
+ ```
80
+
81
+ Schema module:
82
+
83
+ ```js
84
+ {
85
+ key: "product",
86
+ name: "Products",
87
+ menuType: "module",
88
+ moduleType: "schema",
89
+ schemaConfig: {},
90
+ }
91
+ ```
92
+
93
+ Custom module:
94
+
95
+ ```js
96
+ {
97
+ key: "custom-dashboard",
98
+ name: "Dashboard",
99
+ menuType: "module",
100
+ moduleType: "custom",
101
+ customConfig: {
102
+ path: "/dashboard",
103
+ },
104
+ }
105
+ ```
106
+
107
+ Iframe module:
108
+
109
+ ```js
110
+ {
111
+ key: "docs",
112
+ name: "Docs",
113
+ menuType: "module",
114
+ moduleType: "iframe",
115
+ iframeConfig: {
116
+ path: "https://example.com",
117
+ },
118
+ }
119
+ ```
120
+
121
+ Sidebar module is only for top menu layouts:
122
+
123
+ ```js
124
+ {
125
+ key: "workspace",
126
+ name: "Workspace",
127
+ menuType: "module",
128
+ moduleType: "sidebar",
129
+ sidebarConfig: {
130
+ menuLayout: "left",
131
+ menu: [],
132
+ },
133
+ }
134
+ ```
135
+
136
+ ## Schema CRUD Config
137
+
138
+ Basic shape:
139
+
140
+ ```js
141
+ schemaConfig: {
142
+ api: "/api/product",
143
+ schema: {
144
+ type: "object",
145
+ properties: {},
146
+ required: [],
147
+ },
148
+ componentConfig: {},
149
+ tableConfig: {},
150
+ }
151
+ ```
152
+
153
+ `api` maps to:
154
+
155
+ | Action | Request |
156
+ | --- | --- |
157
+ | table list | `GET {api}/list` |
158
+ | detail | `GET {api}` |
159
+ | create | `POST {api}` |
160
+ | update | `PUT {api}` |
161
+ | remove | `DELETE {api}` |
162
+
163
+ Table list should return:
164
+
165
+ ```js
166
+ {
167
+ data: rows,
168
+ page: Number(page),
169
+ pageSize: Number(pageSize),
170
+ total: rows.length,
171
+ }
172
+ ```
173
+
174
+ Framework response wrapper is handled by `this.success(ctx, data)`.
175
+
176
+ ## Field Schema
177
+
178
+ Each field is JSON Schema plus TemplateCore options:
179
+
180
+ ```js
181
+ product_name: {
182
+ type: "string",
183
+ label: "Product Name",
184
+ minLength: 2,
185
+ tableOption: {
186
+ width: "220",
187
+ },
188
+ searchOption: {
189
+ comType: "input",
190
+ },
191
+ createFormOption: {
192
+ comType: "input",
193
+ },
194
+ editFormOption: {
195
+ comType: "input",
196
+ },
197
+ detailPanelOption: {},
198
+ }
199
+ ```
200
+
201
+ Option meaning:
202
+
203
+ | Option | Render target |
204
+ | --- | --- |
205
+ | `tableOption` | Table column. Omit to hide from table. |
206
+ | `searchOption` | Search form field. Omit to hide from search. |
207
+ | `createFormOption` | Create modal form field. Omit to hide from create. |
208
+ | `editFormOption` | Edit modal form field. Omit to hide from edit. |
209
+ | `detailPanelOption` | Detail drawer field. Omit to hide from detail. |
210
+
211
+ Common form `comType` values:
212
+
213
+ ```text
214
+ input
215
+ inputNumber
216
+ select
217
+ textarea
218
+ switch
219
+ date
220
+ checkbox
221
+ ```
222
+
223
+ Useful option fields:
224
+
225
+ ```js
226
+ {
227
+ comType: "select",
228
+ default: "enabled",
229
+ visible: true,
230
+ disabled: false,
231
+ options: [
232
+ { label: "Enabled", value: "enabled" },
233
+ { label: "Disabled", value: "disabled" },
234
+ ],
235
+ }
236
+ ```
237
+
238
+ Note: the type file contains a misspelled `disbaled`, but runtime form props use `disabled` in examples and should be preferred.
239
+
240
+ ## Component Config
241
+
242
+ Built-in call components:
243
+
244
+ ```js
245
+ componentConfig: {
246
+ createForm: {
247
+ title: "Create Product",
248
+ saveBtnText: "Create",
249
+ },
250
+ editForm: {
251
+ title: "Edit Product",
252
+ saveBtnText: "Save",
253
+ fetchKey: "product_id",
254
+ },
255
+ detailPanel: {
256
+ title: "Product Detail",
257
+ fetchKey: "product_id",
258
+ },
259
+ }
260
+ ```
261
+
262
+ `editForm` and `detailPanel` use `fetchKey` to request detail data. Optional fetch override:
263
+
264
+ ```js
265
+ fetchConfig: {
266
+ url: "/api/product/detail",
267
+ method: "get",
268
+ }
269
+ ```
270
+
271
+ ## Buttons
272
+
273
+ Header button opens a component:
274
+
275
+ ```js
276
+ {
277
+ label: "Create",
278
+ eventKey: "callComponent",
279
+ variant: "primary",
280
+ eventOption: {
281
+ comName: "createForm",
282
+ },
283
+ }
284
+ ```
285
+
286
+ Row buttons:
287
+
288
+ ```js
289
+ rowButtons: [
290
+ {
291
+ label: "Edit",
292
+ eventKey: "callComponent",
293
+ eventOption: {
294
+ comName: "editForm",
295
+ },
296
+ },
297
+ {
298
+ label: "Detail",
299
+ eventKey: "callComponent",
300
+ eventOption: {
301
+ comName: "detailPanel",
302
+ },
303
+ },
304
+ {
305
+ label: "Delete",
306
+ eventKey: "remove",
307
+ eventOption: {
308
+ params: {
309
+ product_id: "$schema::product_id",
310
+ },
311
+ },
312
+ },
313
+ ]
314
+ ```
315
+
316
+ `$schema::product_id` reads `product_id` from the current table row.
317
+
318
+ ## Practical Checklist
319
+
320
+ - Use `mode: "MB"`.
321
+ - Keep every menu `key` unique and stable.
322
+ - Use `menuType: "module"` with `moduleType: "schema"` for CRUD pages.
323
+ - Use `schema.type: "object"` and `schema.properties`.
324
+ - Put primary key in table/detail/edit schemas; hide it in create if generated server-side.
325
+ - Set `required` to match create/edit validation.
326
+ - Make backend query/body param names match schema field keys.
@@ -0,0 +1,73 @@
1
+ const { baseFn } = require("@_tc/template-core");
2
+
3
+ const products = [
4
+ {
5
+ product_id: "1",
6
+ product_name: "Product A",
7
+ price: 100,
8
+ inventory: 30,
9
+ status: "enabled",
10
+ create_time: "2026-05-18 10:00:00",
11
+ },
12
+ ];
13
+
14
+ module.exports = (app) => {
15
+ const BaseController = baseFn.baseControllerFn(app);
16
+
17
+ return class ProductController extends BaseController {
18
+ list = async (ctx) => {
19
+ const { product_name, status } = ctx.request.query;
20
+ const page = Number(ctx.request.query.page || 1);
21
+ const pageSize = Number(ctx.request.query.pageSize || 10);
22
+
23
+ const filtered = products.filter((item) => {
24
+ if (product_name && !item.product_name.includes(product_name)) return false;
25
+ if (status && item.status !== status) return false;
26
+ return true;
27
+ });
28
+
29
+ this.success(ctx, {
30
+ data: filtered.slice((page - 1) * pageSize, page * pageSize),
31
+ page,
32
+ pageSize,
33
+ total: filtered.length,
34
+ });
35
+ };
36
+
37
+ detail = async (ctx) => {
38
+ const item = products.find((product) => {
39
+ return product.product_id === ctx.request.query.product_id;
40
+ });
41
+
42
+ this.success(ctx, item || null);
43
+ };
44
+
45
+ create = async (ctx) => {
46
+ const item = {
47
+ ...ctx.request.body,
48
+ product_id: `${Date.now()}`,
49
+ create_time: new Date().toISOString(),
50
+ };
51
+
52
+ products.unshift(item);
53
+ this.success(ctx, item);
54
+ };
55
+
56
+ update = async (ctx) => {
57
+ const data = ctx.request.body;
58
+ const item = products.find((product) => product.product_id === data.product_id);
59
+
60
+ if (item) Object.assign(item, data);
61
+ this.success(ctx, item || data);
62
+ };
63
+
64
+ remove = async (ctx) => {
65
+ const index = products.findIndex((product) => {
66
+ return product.product_id === ctx.request.query.product_id;
67
+ });
68
+
69
+ if (index !== -1) products.splice(index, 1);
70
+ this.success(ctx, {});
71
+ };
72
+ };
73
+ };
@@ -0,0 +1,9 @@
1
+ module.exports = (app, router) => {
2
+ const { product } = app.controller;
3
+
4
+ router.get("/api/product/list", product.list);
5
+ router.get("/api/product", product.detail);
6
+ router.post("/api/product", product.create);
7
+ router.put("/api/product", product.update);
8
+ router.delete("/api/product", product.remove);
9
+ };
@@ -0,0 +1,3 @@
1
+ module.exports = {
2
+ port: 9000,
3
+ };
@@ -0,0 +1,17 @@
1
+ const { join } = require("path");
2
+ const { serverStart } = require("@_tc/template-core");
3
+ const { buildFE } = require("@_tc/template-core/bundler");
4
+
5
+ async function main() {
6
+ await serverStart({
7
+ name: "tc-business-project",
8
+ baseDir: join(__dirname, "."),
9
+ });
10
+
11
+ await buildFE("dev");
12
+ }
13
+
14
+ main().catch((error) => {
15
+ console.error(error);
16
+ process.exit(1);
17
+ });
@@ -0,0 +1,179 @@
1
+ module.exports = {
2
+ mode: "MB",
3
+ name: "Product Admin",
4
+ desc: "Product management scaffold",
5
+ icon: "",
6
+ homePage: "/_sidebar_/product",
7
+ menu: [
8
+ {
9
+ key: "product",
10
+ name: "Products",
11
+ menuType: "module",
12
+ moduleType: "schema",
13
+ schemaConfig: {
14
+ api: "/api/product",
15
+ schema: {
16
+ type: "object",
17
+ properties: {
18
+ product_id: {
19
+ type: "string",
20
+ label: "Product ID",
21
+ tableOption: {
22
+ width: "180",
23
+ },
24
+ editFormOption: {
25
+ comType: "input",
26
+ disabled: true,
27
+ },
28
+ detailPanelOption: {},
29
+ },
30
+ product_name: {
31
+ type: "string",
32
+ label: "Product Name",
33
+ minLength: 2,
34
+ tableOption: {
35
+ width: "220",
36
+ },
37
+ searchOption: {
38
+ comType: "input",
39
+ },
40
+ createFormOption: {
41
+ comType: "input",
42
+ },
43
+ editFormOption: {
44
+ comType: "input",
45
+ },
46
+ detailPanelOption: {},
47
+ },
48
+ price: {
49
+ type: "number",
50
+ label: "Price",
51
+ tableOption: {
52
+ width: "120",
53
+ toFixed: 2,
54
+ },
55
+ createFormOption: {
56
+ comType: "inputNumber",
57
+ },
58
+ editFormOption: {
59
+ comType: "inputNumber",
60
+ },
61
+ detailPanelOption: {},
62
+ },
63
+ inventory: {
64
+ type: "number",
65
+ label: "Inventory",
66
+ tableOption: {
67
+ width: "120",
68
+ },
69
+ createFormOption: {
70
+ comType: "inputNumber",
71
+ default: 0,
72
+ },
73
+ editFormOption: {
74
+ comType: "inputNumber",
75
+ },
76
+ detailPanelOption: {},
77
+ },
78
+ status: {
79
+ type: "string",
80
+ label: "Status",
81
+ tableOption: {
82
+ width: "120",
83
+ },
84
+ searchOption: {
85
+ comType: "select",
86
+ options: [
87
+ { label: "Enabled", value: "enabled" },
88
+ { label: "Disabled", value: "disabled" },
89
+ ],
90
+ },
91
+ createFormOption: {
92
+ comType: "select",
93
+ default: "enabled",
94
+ options: [
95
+ { label: "Enabled", value: "enabled" },
96
+ { label: "Disabled", value: "disabled" },
97
+ ],
98
+ },
99
+ editFormOption: {
100
+ comType: "select",
101
+ options: [
102
+ { label: "Enabled", value: "enabled" },
103
+ { label: "Disabled", value: "disabled" },
104
+ ],
105
+ },
106
+ detailPanelOption: {
107
+ options: [
108
+ { label: "Enabled", value: "enabled" },
109
+ { label: "Disabled", value: "disabled" },
110
+ ],
111
+ },
112
+ },
113
+ create_time: {
114
+ type: "string",
115
+ label: "Created At",
116
+ tableOption: {
117
+ width: "180",
118
+ },
119
+ detailPanelOption: {},
120
+ },
121
+ },
122
+ required: ["product_name", "price"],
123
+ },
124
+ componentConfig: {
125
+ createForm: {
126
+ title: "Create Product",
127
+ saveBtnText: "Create",
128
+ },
129
+ editForm: {
130
+ title: "Edit Product",
131
+ saveBtnText: "Save",
132
+ fetchKey: "product_id",
133
+ },
134
+ detailPanel: {
135
+ title: "Product Detail",
136
+ fetchKey: "product_id",
137
+ },
138
+ },
139
+ tableConfig: {
140
+ headerButtons: [
141
+ {
142
+ label: "Create Product",
143
+ eventKey: "callComponent",
144
+ variant: "primary",
145
+ eventOption: {
146
+ comName: "createForm",
147
+ },
148
+ },
149
+ ],
150
+ rowButtons: [
151
+ {
152
+ label: "Edit",
153
+ eventKey: "callComponent",
154
+ eventOption: {
155
+ comName: "editForm",
156
+ },
157
+ },
158
+ {
159
+ label: "Detail",
160
+ eventKey: "callComponent",
161
+ eventOption: {
162
+ comName: "detailPanel",
163
+ },
164
+ },
165
+ {
166
+ label: "Delete",
167
+ eventKey: "remove",
168
+ eventOption: {
169
+ params: {
170
+ product_id: "$schema::product_id",
171
+ },
172
+ },
173
+ },
174
+ ],
175
+ },
176
+ },
177
+ },
178
+ ],
179
+ };
@@ -0,0 +1,4 @@
1
+ module.exports = {
2
+ name: "Default Product Project",
3
+ desc: "Project-level overrides can be added here.",
4
+ };
@@ -0,0 +1,10 @@
1
+ {
2
+ "name": "tc-business-project",
3
+ "private": true,
4
+ "scripts": {
5
+ "dev": "node index.js"
6
+ },
7
+ "dependencies": {
8
+ "@_tc/template-core": "0.0.3"
9
+ }
10
+ }