@_tc/template-core 0.1.16 → 0.2.0-bate.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.
- package/.skills/tc-component-usage-skills/SKILL.md +9 -2
- package/.skills/tc-component-usage-skills/reference/component-api.md +6 -3
- package/.skills/tc-component-usage-skills/reference/patterns.md +3 -3
- package/.skills/tc-component-usage-skills/reference/template-core-frontend.md +3 -1
- package/.skills/tc-generator/SKILL.md +1 -1
- package/.skills/tc-generator/reference/example.md +4 -0
- package/.skills/tc-generator/reference/project-template/config/config.default.js +4 -0
- package/.skills/tc-generator/reference/project-template/model/product/project/default.js +2 -0
- package/.skills/tc-generator/reference/runtime-extensions.md +110 -0
- package/AGENT_README.md +632 -0
- package/README.md +443 -37
- package/cjs/app/controller/project.js +1 -1
- package/cjs/app/controller/view.js +1 -1
- package/cjs/app/extend/crypto.js +1 -0
- package/cjs/app/extend/render-view.js +1 -1
- package/cjs/app/middleware.js +1 -1
- package/cjs/app/middlewares/api-params-verify.js +1 -0
- package/cjs/app/middlewares/api-sign-verify.js +1 -0
- package/cjs/app/{middleware → middlewares}/error-handle.js +1 -1
- package/cjs/app/middlewares/project-handler.js +1 -0
- package/cjs/app/middlewares/request-parameter-parsing.js +1 -0
- package/cjs/app/router/project.js +1 -1
- package/cjs/app/view/entry.tpl +19 -0
- package/cjs/bundler/buildBE.js +1 -0
- package/cjs/bundler/defaultRouteGuard.js +1 -0
- package/cjs/bundler/index.js +1 -1
- package/cjs/bundler/utils.js +3 -1
- package/cjs/config/config.default.js +1 -1
- package/cjs/packages/core/env.js +1 -1
- package/cjs/packages/core/index.js +1 -1
- package/cjs/packages/core/loader/middleware.js +1 -1
- package/cjs/packages/core/loader/router.js +1 -1
- package/cjs/scripts/vite-build/build.js +3 -0
- package/cjs/scripts/vite-build/collect.js +1 -0
- package/cjs/scripts/vite-build/constants.js +1 -0
- package/cjs/scripts/vite-build/dts.js +1 -0
- package/cjs/scripts/vite-build/index.js +1 -0
- package/cjs/scripts/vite-build/normalize.js +1 -0
- package/cjs/scripts/vite-build/plugins.js +1 -0
- package/cjs/scripts/vite-build/resolve.js +1 -0
- package/cjs/scripts/vite-build/types.js +0 -0
- package/cjs/scripts/vite-build/utils.js +1 -0
- package/esm/app/controller/project.js +7 -2
- package/esm/app/controller/view.js +21 -18
- package/esm/app/extend/crypto.js +31 -0
- package/esm/app/extend/render-view.js +5 -3
- package/esm/app/middleware.js +7 -2
- package/esm/app/{middleware → middlewares}/api-params-verify.js +2 -2
- package/esm/app/{middleware → middlewares}/api-sign-verify.js +2 -2
- package/esm/app/{middleware → middlewares}/error-handle.js +2 -2
- package/esm/app/middlewares/project-handler.js +15 -0
- package/esm/app/middlewares/request-parameter-parsing.js +18 -0
- package/esm/app/router/project.js +2 -2
- package/esm/app/view/entry.tpl +19 -0
- package/esm/bundler/buildBE.js +54 -0
- package/esm/bundler/defaultRouteGuard.js +4 -0
- package/esm/bundler/index.js +11 -14
- package/esm/bundler/utils.js +103 -60
- package/esm/config/config.default.js +4 -0
- package/esm/packages/core/env.js +1 -1
- package/esm/packages/core/index.js +37 -33
- package/esm/packages/core/loader/middleware.js +1 -1
- package/esm/packages/core/loader/router.js +5 -2
- package/esm/scripts/vite-build/build.js +141 -0
- package/esm/scripts/vite-build/collect.js +79 -0
- package/esm/scripts/vite-build/constants.js +34 -0
- package/esm/scripts/vite-build/dts.js +132 -0
- package/esm/scripts/vite-build/index.js +3 -0
- package/esm/scripts/vite-build/normalize.js +78 -0
- package/esm/scripts/vite-build/plugins.js +106 -0
- package/esm/scripts/vite-build/resolve.js +46 -0
- package/esm/scripts/vite-build/types.js +0 -0
- package/esm/scripts/vite-build/utils.js +24 -0
- package/fe/frontend/apps/dash/Dashboard.d.ts +0 -1
- package/fe/frontend/apps/dash/Dashboard.js +178 -169
- package/fe/frontend/apps/dash/dash.entry.d.ts +0 -1
- package/fe/frontend/apps/dash/dash.entry.js +58 -78
- package/fe/frontend/apps/dash/types.d.ts +16 -14
- package/fe/frontend/apps/dash/types.js +0 -1
- package/fe/frontend/apps/ui-components/index.d.ts +0 -1
- package/fe/frontend/apps/ui-components/index.js +7 -7
- package/fe/frontend/apps/ui-components/ui-components.entry.d.ts +0 -1
- package/fe/frontend/apps/ui-components/ui-components.entry.js +7 -5
- package/fe/frontend/extended/SchemaForm/data.d.ts +1 -5
- package/fe/frontend/extended/SchemaForm/data.js +7 -7
- package/fe/frontend/src/api/baseInfo.d.ts +1 -2
- package/fe/frontend/src/api/baseInfo.js +12 -13
- package/fe/frontend/src/common/CRUD/CRUD.d.ts +2 -3
- package/fe/frontend/src/common/CRUD/CRUD.js +2 -2
- package/fe/frontend/src/common/CRUD/index.d.ts +1 -2
- package/fe/frontend/src/common/CRUD/index.js +2 -1
- package/fe/frontend/src/common/auth/index.d.ts +6 -2
- package/fe/frontend/src/common/auth/index.js +23 -16
- package/fe/frontend/src/common/fetchErrorShow.d.ts +1 -2
- package/fe/frontend/src/common/fetchErrorShow.js +10 -8
- package/fe/frontend/src/common/generateMenuData.d.ts +2 -3
- package/fe/frontend/src/common/generateMenuData.js +15 -12
- package/fe/frontend/src/common/importComponent.d.ts +1 -2
- package/fe/frontend/src/common/importComponent.js +21 -9
- package/fe/frontend/src/common/language.d.ts +1 -2
- package/fe/frontend/src/common/language.js +11 -10
- package/fe/frontend/src/common/logFn/index.d.ts +0 -1
- package/fe/frontend/src/common/logFn/index.js +11 -8
- package/fe/frontend/src/common/menu.d.ts +1 -14
- package/fe/frontend/src/common/menu.js +94 -98
- package/fe/frontend/src/common/request.d.ts +2 -6
- package/fe/frontend/src/common/request.js +159 -195
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +3 -4
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.js +35 -31
- package/fe/frontend/src/components/AsyncSelect/index.d.ts +2 -3
- package/fe/frontend/src/components/AsyncSelect/index.js +5 -3
- package/fe/frontend/src/components/BasePage/HeaderView.d.ts +1 -2
- package/fe/frontend/src/components/BasePage/HeaderView.js +53 -17
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.d.ts +14 -5
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +80 -31
- package/fe/frontend/src/components/LanguageSwitch/index.d.ts +2 -3
- package/fe/frontend/src/components/LanguageSwitch/index.js +5 -3
- package/fe/frontend/src/components/Router/index.d.ts +2 -3
- package/fe/frontend/src/components/Router/index.js +20 -10
- package/fe/frontend/src/components/Router/type.d.ts +0 -1
- package/fe/frontend/src/components/Router/type.js +0 -1
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.d.ts +0 -1
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.js +83 -55
- package/fe/frontend/src/components/ThemeSwitch/index.d.ts +2 -3
- package/fe/frontend/src/components/ThemeSwitch/index.js +5 -3
- package/fe/frontend/src/components/index.d.ts +10 -11
- package/fe/frontend/src/components/index.js +7 -10
- package/fe/frontend/src/defaultPages/Iframe/index.d.ts +0 -1
- package/fe/frontend/src/defaultPages/Iframe/index.js +14 -7
- package/fe/frontend/src/defaultPages/NotFoundPage/index.d.ts +0 -1
- package/fe/frontend/src/defaultPages/NotFoundPage/index.js +27 -6
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.d.ts +1 -2
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +97 -90
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.d.ts +1 -2
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +116 -127
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.d.ts +2 -18
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.js +9 -6
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.d.ts +1 -2
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.js +8 -5
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +60 -61
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.d.ts +2 -3
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +199 -186
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.js +8 -5
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.js +4 -1
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.d.ts +1 -2
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.js +16 -13
- package/fe/frontend/src/defaultPages/SchemaPage/index.css +1 -26
- package/fe/frontend/src/defaultPages/SchemaPage/index.d.ts +1 -2
- package/fe/frontend/src/defaultPages/SchemaPage/index.js +89 -76
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.d.ts +4 -14
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.js +7 -4
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.js +6 -3
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.d.ts +1 -2
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.js +63 -112
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +1 -5
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +116 -165
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +2 -3
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +54 -37
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +20 -16
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +20 -16
- package/fe/frontend/src/defaultPages/SlotPage/index.d.ts +0 -1
- package/fe/frontend/src/defaultPages/SlotPage/index.js +21 -26
- package/fe/frontend/src/exportStore.d.ts +4 -17
- package/fe/frontend/src/exportStore.js +5 -16
- package/fe/frontend/src/hooks/useCurrentMenuData.d.ts +1 -10
- package/fe/frontend/src/hooks/useCurrentMenuData.js +28 -26
- package/fe/frontend/src/hooks/useRouterParams.d.ts +0 -1
- package/fe/frontend/src/hooks/useRouterParams.js +15 -10
- package/fe/frontend/src/index.d.ts +13 -21
- package/fe/frontend/src/index.js +20 -18
- package/fe/frontend/src/language/en-US.d.ts +0 -1
- package/fe/frontend/src/language/en-US.js +89 -88
- package/fe/frontend/src/language/index.d.ts +1 -2
- package/fe/frontend/src/language/index.js +77 -74
- package/fe/frontend/src/language/zh-CN.d.ts +0 -1
- package/fe/frontend/src/language/zh-CN.js +89 -88
- package/fe/frontend/src/main.css +1 -1
- package/fe/frontend/src/main.d.ts +13 -20
- package/fe/frontend/src/main.js +75 -70
- package/fe/frontend/src/stores/apiFreezer.d.ts +1 -68
- package/fe/frontend/src/stores/apiFreezer.js +50 -46
- package/fe/frontend/src/stores/mode.d.ts +2 -6
- package/fe/frontend/src/stores/mode.js +35 -36
- package/fe/frontend/src/stores/schemaEventBus.d.ts +1 -21
- package/fe/frontend/src/stores/schemaEventBus.js +52 -69
- package/fe/frontend/src/stores/schemaStore.d.ts +5 -20
- package/fe/frontend/src/stores/schemaStore.js +27 -25
- package/fe/frontend/src/typing/scalability.d.ts +3 -35
- package/fe/frontend/src/typing/scalability.js +0 -1
- package/fe/frontend/src/typing/window.d.ts +0 -1
- package/fe/frontend/src/typing/window.js +0 -1
- package/fe/model/types/data/button.d.ts +2 -12
- package/fe/model/types/data/component.d.ts +4 -14
- package/fe/model/types/data/fetchInfo.d.ts +0 -13
- package/fe/model/types/data/schema.d.ts +6 -58
- package/fe/model/types/data/search.d.ts +1 -2
- package/{model → fe/model}/types/index.d.ts +2 -3
- package/fe/model/types/menuType.d.ts +0 -30
- package/fe/model/types/model.d.ts +1 -15
- package/fe/packages/common/LRUCache.d.ts +1 -0
- package/fe/packages/common/array/index.d.ts +0 -1
- package/fe/packages/common/cache/LRUCache.d.ts +0 -1
- package/fe/packages/common/cache/LRUCache.js +43 -47
- package/fe/packages/common/cache/index.d.ts +0 -1
- package/fe/packages/common/guards/index.d.ts +0 -1
- package/fe/packages/common/guards/index.js +8 -24
- package/fe/packages/common/http/index.d.ts +0 -1
- package/fe/packages/common/http/index.js +272 -282
- package/fe/packages/common/i18n/default.d.ts +0 -6
- package/fe/packages/common/i18n/default.js +91 -88
- package/fe/packages/common/i18n/en-US.d.ts +0 -6
- package/fe/packages/common/i18n/en-US.js +91 -88
- package/fe/packages/common/i18n/index.d.ts +3 -28
- package/fe/packages/common/i18n/index.js +142 -153
- package/fe/packages/common/i18n/locales.d.ts +3 -4
- package/fe/packages/common/i18n/locales.js +10 -9
- package/fe/packages/common/i18n/types.d.ts +0 -25
- package/fe/packages/common/index.d.ts +0 -1
- package/fe/packages/common/log/index.d.ts +0 -1
- package/fe/packages/common/number/index.d.ts +0 -1
- package/fe/packages/common/object/filterEmpty.d.ts +0 -1
- package/fe/packages/common/object/filterEmpty.js +25 -30
- package/fe/packages/common/object/filtereEmpty.d.ts +1 -0
- package/fe/packages/common/object/index.d.ts +0 -1
- package/fe/packages/common/string/index.d.ts +0 -1
- package/fe/packages/common/types/index.d.ts +0 -1
- package/fe/packages/{ui/react → react}/hooks/useBreadcrumb.d.ts +3 -4
- package/fe/packages/react/hooks/useBreadcrumb.js +5 -0
- package/fe/packages/react/hooks/useExecuteOnce.d.ts +11 -0
- package/fe/packages/react/hooks/useExecuteOnce.js +47 -0
- package/fe/packages/{ui/react → react}/hooks/useInit.d.ts +0 -1
- package/fe/packages/react/hooks/useInit.js +11 -0
- package/fe/packages/react/hooks/useLanguage.d.ts +1 -0
- package/fe/packages/react/hooks/useLanguage.js +8 -0
- package/fe/packages/{ui/react → react}/hooks/usePagination.d.ts +0 -1
- package/fe/packages/react/hooks/usePagination.js +30 -0
- package/fe/packages/{ui/react → react}/hooks/useRefState.d.ts +1 -14
- package/fe/packages/react/hooks/useRefState.js +35 -0
- package/fe/packages/{ui/react → react}/hooks/useWatch.d.ts +0 -9
- package/fe/packages/react/hooks/useWatch.js +60 -0
- package/fe/packages/react/hooks/useWatch.test.js +24 -0
- package/fe/packages/react/ui/assets/table/no-result.js +4 -0
- package/fe/packages/{ui/react → react/ui}/components/Button/Button.d.ts +1 -35
- package/fe/packages/react/ui/components/Button/Button.js +88 -0
- package/fe/packages/{ui/react → react/ui}/components/Button/SubmitButton.d.ts +2 -7
- package/fe/packages/react/ui/components/Button/SubmitButton.js +30 -0
- package/fe/packages/react/ui/components/Button/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Button/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/Card/Card.d.ts +1 -6
- package/fe/packages/react/ui/components/Card/Card.js +31 -0
- package/fe/packages/react/ui/components/Card/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Card/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Checkbox/Checkbox.d.ts +1 -2
- package/fe/packages/react/ui/components/Checkbox/Checkbox.js +52 -0
- package/fe/packages/react/ui/components/Checkbox/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Checkbox/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/ConfirmDialog/ConfirmDialog.d.ts +0 -9
- package/fe/packages/react/ui/components/ConfirmDialog/ConfirmDialog.js +41 -0
- package/fe/packages/react/ui/components/ConfirmDialog/index.d.ts +1 -0
- package/fe/packages/react/ui/components/ConfirmDialog/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/DataTable/ActionBtn.d.ts +1 -2
- package/fe/packages/react/ui/components/DataTable/ActionBtn.js +116 -0
- package/fe/packages/{ui/react → react/ui}/components/DataTable/index.d.ts +8 -28
- package/fe/packages/react/ui/components/DataTable/index.js +235 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/Calendar.d.ts +2 -16
- package/fe/packages/react/ui/components/Date/Calendar.js +351 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/Date.d.ts +0 -12
- package/fe/packages/react/ui/components/Date/Date.js +210 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/DateTestPage.d.ts +0 -1
- package/fe/packages/react/ui/components/Date/DateTestPage.js +340 -0
- package/fe/packages/react/ui/components/Date/LocaleContext.d.ts +1 -0
- package/fe/packages/react/ui/components/Date/LocaleContext.js +11 -0
- package/fe/packages/react/ui/components/Date/LocaleProvider.d.ts +7 -0
- package/fe/packages/react/ui/components/Date/LocaleProvider.js +31 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/TimePicker.d.ts +0 -1
- package/fe/packages/react/ui/components/Date/TimePicker.js +136 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/data.d.ts +0 -1
- package/fe/packages/react/ui/components/Date/data.js +7 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/dateLocaleStore.d.ts +1 -8
- package/fe/packages/react/ui/components/Date/dateLocaleStore.js +14 -0
- package/fe/packages/react/ui/components/Date/dropdownPositioning.d.ts +2 -0
- package/fe/packages/react/ui/components/Date/dropdownPositioning.js +12 -0
- package/fe/packages/react/ui/components/Date/index.d.ts +5 -0
- package/fe/packages/react/ui/components/Date/index.js +6 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/locales.d.ts +0 -20
- package/fe/packages/react/ui/components/Date/locales.js +25 -0
- package/fe/packages/{ui/react → react/ui}/components/Drawer/Drawer.d.ts +1 -8
- package/fe/packages/react/ui/components/Drawer/Drawer.js +151 -0
- package/fe/packages/react/ui/components/Drawer/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Drawer/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Dropdown/Dropdown.d.ts +2 -4
- package/fe/packages/react/ui/components/Dropdown/Dropdown.js +105 -0
- package/fe/packages/react/ui/components/Dropdown/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Dropdown/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/Form.d.ts +2 -9
- package/fe/packages/react/ui/components/Form/Form.js +15 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/FormItem.d.ts +3 -25
- package/fe/packages/react/ui/components/Form/FormItem.js +60 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/SchemaForm/data.d.ts +8 -9
- package/fe/packages/react/ui/components/Form/SchemaForm/data.js +16 -0
- package/fe/packages/react/ui/components/Form/SchemaForm/defaultComponentsMap.d.ts +3 -0
- package/fe/packages/react/ui/components/Form/SchemaForm/defaultComponentsMap.js +4 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/SchemaForm/index.d.ts +9 -103
- package/fe/packages/react/ui/components/Form/SchemaForm/index.js +119 -0
- package/fe/packages/react/ui/components/Form/index.d.ts +4 -0
- package/fe/packages/react/ui/components/Form/index.js +5 -0
- package/fe/packages/react/ui/components/Form/useForm.d.ts +2 -0
- package/fe/packages/react/ui/components/Form/useForm.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/ImagePreview/ImagePreview.d.ts +0 -1
- package/fe/packages/react/ui/components/ImagePreview/ImagePreview.js +307 -0
- package/fe/packages/{ui/react → react/ui}/components/ImagePreview/PreviewImage.d.ts +2 -6
- package/fe/packages/react/ui/components/ImagePreview/PreviewImage.js +56 -0
- package/fe/packages/react/ui/components/ImagePreview/index.d.ts +2 -0
- package/fe/packages/react/ui/components/ImagePreview/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/Input/Input.d.ts +1 -24
- package/fe/packages/react/ui/components/Input/Input.js +142 -0
- package/fe/packages/react/ui/components/Input/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Input/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/InputNumber/InputNumber.d.ts +2 -5
- package/fe/packages/react/ui/components/InputNumber/InputNumber.js +207 -0
- package/fe/packages/react/ui/components/InputNumber/index.d.ts +1 -0
- package/fe/packages/react/ui/components/InputNumber/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/InputNumber/inputNumberUtils.d.ts +0 -1
- package/fe/packages/react/ui/components/InputNumber/inputNumberUtils.js +45 -0
- package/fe/packages/react/ui/components/InputNumber/inputNumberUtils.test.js +59 -0
- package/fe/packages/{ui/react → react/ui}/components/Label/Label.d.ts +1 -31
- package/fe/packages/react/ui/components/Label/Label.js +58 -0
- package/fe/packages/react/ui/components/Label/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Label/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Layout/Layout.d.ts +1 -2
- package/fe/packages/react/ui/components/Layout/Layout.js +33 -0
- package/fe/packages/react/ui/components/Layout/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Layout/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Loading/Loading.d.ts +1 -13
- package/fe/packages/react/ui/components/Loading/Loading.js +48 -0
- package/fe/packages/react/ui/components/Loading/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Loading/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Menu/Menu.d.ts +0 -1
- package/fe/packages/react/ui/components/Menu/Menu.js +147 -0
- package/fe/packages/{ui/react → react/ui}/components/Menu/MenuContext.d.ts +0 -1
- package/fe/packages/react/ui/components/Menu/MenuContext.js +88 -0
- package/fe/packages/{ui/react → react/ui}/components/Menu/MenuItem.d.ts +0 -1
- package/fe/packages/react/ui/components/Menu/MenuItem.js +78 -0
- package/fe/packages/react/ui/components/Menu/SubMenu.d.ts +2 -0
- package/fe/packages/react/ui/components/Menu/SubMenu.js +207 -0
- package/fe/packages/react/ui/components/Menu/index.d.ts +8 -0
- package/fe/packages/react/ui/components/Menu/index.js +5 -0
- package/fe/packages/{ui/react → react/ui}/components/Menu/menuTypes.d.ts +1 -3
- package/fe/packages/react/ui/components/Menu/menuTypes.js +0 -0
- package/fe/packages/{ui/react → react/ui}/components/Menu/utils.d.ts +0 -1
- package/fe/packages/react/ui/components/Menu/utils.js +8 -0
- package/fe/packages/{ui/react → react/ui}/components/Message/Message.d.ts +1 -9
- package/fe/packages/react/ui/components/Message/Message.js +76 -0
- package/fe/packages/{ui/react → react/ui}/components/Message/MessageManager.d.ts +2 -3
- package/fe/packages/react/ui/components/Message/MessageManager.js +104 -0
- package/fe/packages/{ui/react → react/ui}/components/Message/data.d.ts +0 -1
- package/fe/packages/react/ui/components/Message/data.js +4 -0
- package/fe/packages/react/ui/components/Message/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Message/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Modal/Modal.d.ts +1 -8
- package/fe/packages/react/ui/components/Modal/Modal.js +59 -0
- package/fe/packages/{ui/react → react/ui}/components/Modal/ModalManager.d.ts +3 -16
- package/fe/packages/react/ui/components/Modal/ModalManager.js +106 -0
- package/fe/packages/react/ui/components/Modal/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Modal/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/Notification/Notification.d.ts +1 -2
- package/fe/packages/react/ui/components/Notification/Notification.js +56 -0
- package/fe/packages/react/ui/components/Notification/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Notification/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Overlay/Overlay.d.ts +1 -5
- package/fe/packages/react/ui/components/Overlay/Overlay.js +61 -0
- package/fe/packages/react/ui/components/Overlay/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Overlay/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Pagination/Pagination.d.ts +0 -8
- package/fe/packages/react/ui/components/Pagination/Pagination.js +115 -0
- package/fe/packages/react/ui/components/Pagination/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Pagination/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Popup/Popup.d.ts +0 -1
- package/fe/packages/react/ui/components/Popup/Popup.js +86 -0
- package/fe/packages/react/ui/components/Popup/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Popup/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Radio/Radio.d.ts +1 -2
- package/fe/packages/react/ui/components/Radio/Radio.js +36 -0
- package/fe/packages/{ui/react → react/ui}/components/Radio/RadioGroup.d.ts +1 -2
- package/fe/packages/react/ui/components/Radio/RadioGroup.js +33 -0
- package/fe/packages/react/ui/components/Radio/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Radio/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/Search/Search.d.ts +4 -8
- package/fe/packages/react/ui/components/Search/Search.js +24 -0
- package/fe/packages/react/ui/components/Search/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Search/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Select/Select.d.ts +2 -7
- package/fe/packages/react/ui/components/Select/Select.js +282 -0
- package/fe/packages/react/ui/components/Select/dropdownPositioning.d.ts +2 -0
- package/fe/packages/react/ui/components/Select/dropdownPositioning.js +16 -0
- package/fe/packages/react/ui/components/Select/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Select/index.js +2 -0
- package/fe/packages/react/ui/components/Skeleton/Skeleton.d.ts +12 -0
- package/fe/packages/react/ui/components/Skeleton/Skeleton.js +101 -0
- package/fe/packages/react/ui/components/Skeleton/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Skeleton/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Switch/Switch.d.ts +1 -2
- package/fe/packages/react/ui/components/Switch/Switch.js +28 -0
- package/fe/packages/react/ui/components/Switch/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Switch/index.js +2 -0
- package/fe/packages/react/ui/components/TableSearch/TableSearch.d.ts +30 -0
- package/fe/packages/react/ui/components/TableSearch/TableSearch.js +146 -0
- package/fe/packages/react/ui/components/TableSearch/index.d.ts +2 -0
- package/fe/packages/react/ui/components/TableSearch/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/TableSearch/lang.d.ts +0 -1
- package/fe/packages/react/ui/components/TableSearch/lang.js +14 -0
- package/fe/packages/{ui/react → react/ui}/components/TableSearch/tableSearchLocaleStore.d.ts +1 -2
- package/fe/packages/react/ui/components/TableSearch/tableSearchLocaleStore.js +10 -0
- package/fe/packages/{ui/react → react/ui}/components/Tabs/Tabs.d.ts +1 -2
- package/fe/packages/react/ui/components/Tabs/Tabs.js +33 -0
- package/fe/packages/react/ui/components/Tabs/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Tabs/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Textarea/Textarea.d.ts +0 -47
- package/fe/packages/react/ui/components/Textarea/Textarea.js +58 -0
- package/fe/packages/react/ui/components/Textarea/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Textarea/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Tooltip/Tooltip.d.ts +0 -17
- package/fe/packages/react/ui/components/Tooltip/Tooltip.js +77 -0
- package/fe/packages/react/ui/components/Tooltip/index.d.ts +1 -0
- package/fe/packages/react/ui/components/Tooltip/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/TreeSelect/TreeSelect.d.ts +0 -7
- package/fe/packages/react/ui/components/TreeSelect/TreeSelect.js +190 -0
- package/fe/packages/react/ui/components/TreeSelect/index.d.ts +1 -0
- package/fe/packages/react/ui/components/TreeSelect/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Upload/ImageUpload.d.ts +0 -1
- package/fe/packages/react/ui/components/Upload/ImageUpload.js +101 -0
- package/fe/packages/react/ui/components/Upload/Upload.d.ts +13 -0
- package/fe/packages/react/ui/components/Upload/Upload.js +29 -0
- package/fe/packages/react/ui/components/Upload/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Upload/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/breadcrumb/breadcrumb.d.ts +0 -1
- package/fe/packages/react/ui/components/breadcrumb/breadcrumb.js +155 -0
- package/fe/packages/react/ui/components/breadcrumb/index.d.ts +1 -0
- package/fe/packages/react/ui/components/breadcrumb/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/hooks/useDropdownPositioning.d.ts +0 -7
- package/fe/packages/react/ui/components/hooks/useDropdownPositioning.js +121 -0
- package/fe/packages/{ui/react → react/ui}/components/hooks/useInputController.d.ts +0 -4
- package/fe/packages/react/ui/components/hooks/useInputController.js +39 -0
- package/fe/packages/react/ui/components/index.d.ts +35 -0
- package/fe/packages/react/ui/components/index.js +81 -0
- package/fe/packages/react/ui/components/table/index.d.ts +1 -0
- package/fe/packages/react/ui/components/table/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/table/table.d.ts +1 -2
- package/fe/packages/react/ui/components/table/table.js +166 -0
- package/fe/packages/{ui/react → react/ui}/components/testPage/MenuTestPage.d.ts +0 -1
- package/fe/packages/react/ui/components/testPage/MenuTestPage.js +397 -0
- package/fe/packages/{ui/react → react/ui}/components/testPage/index.d.ts +0 -1
- package/fe/packages/react/ui/components/testPage/index.js +1638 -0
- package/fe/packages/react/ui/i18n/I18nProvider.d.ts +12 -0
- package/fe/packages/react/ui/i18n/I18nProvider.js +38 -0
- package/fe/packages/react/ui/i18n/index.d.ts +3 -0
- package/fe/packages/react/ui/i18n/index.js +7 -0
- package/fe/packages/react/ui/i18n/useI18n.d.ts +8 -0
- package/fe/packages/react/ui/i18n/useI18n.js +25 -0
- package/fe/packages/react/ui/index.d.ts +4 -0
- package/fe/packages/react/ui/index.js +58 -0
- package/fe/packages/{ui/react → react/ui}/lib/createStoreHook.d.ts +1 -2
- package/fe/packages/react/ui/lib/createStoreHook.js +9 -0
- package/fe/packages/react/ui/lib/export.d.ts +21 -0
- package/fe/packages/react/ui/lib/export.js +112 -0
- package/fe/packages/react/ui/lib/utils.d.ts +9 -0
- package/fe/packages/react/ui/lib/utils.js +64 -0
- package/fe/packages/{ui/react → react/ui}/stores/breadcrumb.d.ts +1 -2
- package/fe/packages/react/ui/stores/breadcrumb.js +52 -0
- package/fe/packages/react/ui/stores/language.d.ts +3 -0
- package/fe/packages/react/ui/stores/language.js +4 -0
- package/fe/packages/{ui/react → react/ui}/types/index.d.ts +0 -1
- package/fe/packages/react/ui/types/index.js +0 -0
- package/fe/typings/type.d.ts +0 -1
- package/model/frontend/extended/SchemaForm/data.d.ts +9 -0
- package/model/frontend/src/common/auth/index.d.ts +11 -0
- package/model/frontend/src/common/fetchErrorShow.d.ts +2 -0
- package/model/frontend/src/common/language.d.ts +2 -0
- package/model/frontend/src/common/logFn/index.d.ts +4 -0
- package/model/frontend/src/common/request.d.ts +33 -0
- package/model/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +7 -0
- package/model/frontend/src/components/AsyncSelect/index.d.ts +3 -0
- package/model/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.d.ts +6 -0
- package/model/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.d.ts +12 -0
- package/model/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.d.ts +28 -0
- package/model/frontend/src/defaultPages/SchemaPage/data/eventInfo.d.ts +7 -0
- package/model/frontend/src/defaultPages/SchemaPage/data/index.d.ts +2 -0
- package/model/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.d.ts +9 -0
- package/model/frontend/src/defaultPages/SchemaPage/schemaType.d.ts +41 -0
- package/model/frontend/src/defaultPages/SchemaPage/utils/permissions.d.ts +2 -0
- package/model/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +7 -0
- package/model/frontend/src/language/en-US.d.ts +88 -0
- package/model/frontend/src/language/index.d.ts +72 -0
- package/model/frontend/src/language/zh-CN.d.ts +88 -0
- package/model/frontend/src/stores/apiFreezer.d.ts +26 -0
- package/model/frontend/src/stores/schemaEventBus.d.ts +22 -0
- package/model/frontend/src/stores/schemaStore.d.ts +32 -0
- package/model/frontend/src/typing/scalability.d.ts +15 -0
- package/model/frontend/src/typing/window.d.ts +8 -0
- package/model/{index.d.ts → model/index.d.ts} +1 -2
- package/model/{types → model/types}/data/button.d.ts +2 -12
- package/model/{types → model/types}/data/component.d.ts +4 -14
- package/model/model/types/data/fetchInfo.d.ts +7 -0
- package/model/model/types/data/schema.d.ts +46 -0
- package/model/{types → model/types}/data/search.d.ts +1 -2
- package/model/model/types/index.d.ts +2 -0
- package/model/{types → model/types}/menuType.d.ts +0 -30
- package/model/{types → model/types}/model.d.ts +1 -15
- package/model/packages/common/array/index.d.ts +6 -0
- package/model/packages/common/cache/LRUCache.d.ts +12 -0
- package/model/packages/common/guards/index.d.ts +8 -0
- package/model/packages/common/http/index.d.ts +89 -0
- package/model/packages/common/i18n/default.d.ts +86 -0
- package/model/packages/common/i18n/en-US.d.ts +86 -0
- package/model/packages/common/i18n/index.d.ts +18 -0
- package/model/packages/common/i18n/locales.d.ts +7 -0
- package/model/packages/common/i18n/types.d.ts +46 -0
- package/model/packages/common/log/index.d.ts +32 -0
- package/model/packages/common/number/index.d.ts +2 -0
- package/model/packages/common/object/filterEmpty.d.ts +2 -0
- package/model/packages/common/object/index.d.ts +4 -0
- package/model/packages/common/string/index.d.ts +3 -0
- package/model/packages/common/types/index.d.ts +3 -0
- package/model/packages/react/hooks/useBreadcrumb.d.ts +9 -0
- package/model/packages/react/hooks/useExecuteOnce.d.ts +11 -0
- package/model/packages/react/hooks/useLanguage.d.ts +1 -0
- package/model/packages/react/ui/components/Button/Button.d.ts +24 -0
- package/model/packages/react/ui/components/Button/SubmitButton.d.ts +8 -0
- package/model/packages/react/ui/components/Button/index.d.ts +3 -0
- package/model/packages/react/ui/components/Card/Card.d.ts +10 -0
- package/model/packages/react/ui/components/Card/index.d.ts +1 -0
- package/model/packages/react/ui/components/Checkbox/Checkbox.d.ts +16 -0
- package/model/packages/react/ui/components/Checkbox/index.d.ts +1 -0
- package/model/packages/react/ui/components/ConfirmDialog/ConfirmDialog.d.ts +11 -0
- package/model/packages/react/ui/components/ConfirmDialog/index.d.ts +1 -0
- package/model/packages/react/ui/components/DataTable/ActionBtn.d.ts +7 -0
- package/model/packages/react/ui/components/DataTable/index.d.ts +32 -0
- package/model/packages/react/ui/components/Date/Calendar.d.ts +21 -0
- package/model/packages/react/ui/components/Date/Date.d.ts +26 -0
- package/model/packages/react/ui/components/Date/LocaleContext.d.ts +1 -0
- package/model/packages/react/ui/components/Date/LocaleProvider.d.ts +7 -0
- package/model/packages/react/ui/components/Date/TimePicker.d.ts +6 -0
- package/model/packages/react/ui/components/Date/data.d.ts +5 -0
- package/model/packages/react/ui/components/Date/dateLocaleStore.d.ts +9 -0
- package/model/packages/react/ui/components/Date/dropdownPositioning.d.ts +2 -0
- package/model/packages/react/ui/components/Date/index.d.ts +5 -0
- package/model/packages/react/ui/components/Date/locales.d.ts +23 -0
- package/model/packages/react/ui/components/Drawer/Drawer.d.ts +22 -0
- package/model/packages/react/ui/components/Drawer/index.d.ts +2 -0
- package/model/packages/react/ui/components/Dropdown/Dropdown.d.ts +24 -0
- package/model/packages/react/ui/components/Dropdown/index.d.ts +1 -0
- package/model/packages/react/ui/components/Form/Form.d.ts +11 -0
- package/model/packages/react/ui/components/Form/FormItem.d.ts +19 -0
- package/model/packages/react/ui/components/Form/SchemaForm/data.d.ts +39 -0
- package/model/packages/react/ui/components/Form/SchemaForm/index.d.ts +59 -0
- package/model/packages/react/ui/components/Form/index.d.ts +4 -0
- package/model/packages/react/ui/components/Form/useForm.d.ts +2 -0
- package/model/packages/react/ui/components/ImagePreview/ImagePreview.d.ts +7 -0
- package/model/packages/react/ui/components/ImagePreview/PreviewImage.d.ts +7 -0
- package/model/packages/react/ui/components/ImagePreview/index.d.ts +2 -0
- package/model/packages/react/ui/components/Input/Input.d.ts +22 -0
- package/model/packages/react/ui/components/Input/index.d.ts +1 -0
- package/model/packages/react/ui/components/InputNumber/InputNumber.d.ts +25 -0
- package/model/packages/react/ui/components/InputNumber/index.d.ts +1 -0
- package/model/packages/react/ui/components/InputNumber/inputNumberUtils.d.ts +29 -0
- package/model/packages/react/ui/components/Label/Label.d.ts +21 -0
- package/model/packages/react/ui/components/Label/index.d.ts +2 -0
- package/model/packages/react/ui/components/Layout/Layout.d.ts +10 -0
- package/model/packages/react/ui/components/Layout/index.d.ts +1 -0
- package/model/packages/react/ui/components/Loading/Loading.d.ts +13 -0
- package/model/packages/react/ui/components/Loading/index.d.ts +1 -0
- package/model/packages/react/ui/components/Menu/Menu.d.ts +17 -0
- package/model/packages/react/ui/components/Menu/MenuContext.d.ts +38 -0
- package/model/packages/react/ui/components/Menu/MenuItem.d.ts +2 -0
- package/model/packages/react/ui/components/Menu/SubMenu.d.ts +2 -0
- package/model/packages/react/ui/components/Menu/index.d.ts +8 -0
- package/model/packages/react/ui/components/Menu/menuTypes.d.ts +57 -0
- package/model/packages/react/ui/components/Menu/utils.d.ts +1 -0
- package/model/packages/react/ui/components/Message/Message.d.ts +12 -0
- package/model/packages/react/ui/components/Message/MessageManager.d.ts +36 -0
- package/model/packages/react/ui/components/Message/data.d.ts +1 -0
- package/model/packages/react/ui/components/Message/index.d.ts +2 -0
- package/model/packages/react/ui/components/Modal/Modal.d.ts +20 -0
- package/model/packages/react/ui/components/Modal/ModalManager.d.ts +46 -0
- package/model/packages/react/ui/components/Modal/index.d.ts +3 -0
- package/model/packages/react/ui/components/Notification/Notification.d.ts +13 -0
- package/model/packages/react/ui/components/Notification/index.d.ts +1 -0
- package/model/packages/react/ui/components/Overlay/Overlay.d.ts +19 -0
- package/model/packages/react/ui/components/Overlay/index.d.ts +2 -0
- package/model/packages/react/ui/components/Pagination/Pagination.d.ts +10 -0
- package/model/packages/react/ui/components/Pagination/index.d.ts +1 -0
- package/model/packages/react/ui/components/Popup/Popup.d.ts +25 -0
- package/model/packages/react/ui/components/Popup/index.d.ts +1 -0
- package/model/packages/react/ui/components/Radio/Radio.d.ts +8 -0
- package/model/packages/react/ui/components/Radio/RadioGroup.d.ts +18 -0
- package/model/packages/react/ui/components/Radio/index.d.ts +2 -0
- package/model/packages/react/ui/components/Search/Search.d.ts +13 -0
- package/model/packages/react/ui/components/Search/index.d.ts +1 -0
- package/model/packages/react/ui/components/Select/Select.d.ts +21 -0
- package/model/packages/react/ui/components/Select/dropdownPositioning.d.ts +2 -0
- package/model/packages/react/ui/components/Select/index.d.ts +1 -0
- package/model/packages/react/ui/components/Skeleton/Skeleton.d.ts +12 -0
- package/model/packages/react/ui/components/Skeleton/index.d.ts +2 -0
- package/model/packages/react/ui/components/Switch/Switch.d.ts +10 -0
- package/model/packages/react/ui/components/Switch/index.d.ts +1 -0
- package/model/packages/react/ui/components/TableSearch/TableSearch.d.ts +30 -0
- package/model/packages/react/ui/components/TableSearch/index.d.ts +2 -0
- package/model/packages/react/ui/components/TableSearch/lang.d.ts +14 -0
- package/model/packages/react/ui/components/TableSearch/tableSearchLocaleStore.d.ts +8 -0
- package/model/packages/react/ui/components/Tabs/Tabs.d.ts +15 -0
- package/model/packages/react/ui/components/Tabs/index.d.ts +1 -0
- package/model/packages/react/ui/components/Textarea/Textarea.d.ts +20 -0
- package/model/packages/react/ui/components/Textarea/index.d.ts +1 -0
- package/model/packages/react/ui/components/Tooltip/Tooltip.d.ts +8 -0
- package/model/packages/react/ui/components/Tooltip/index.d.ts +1 -0
- package/model/packages/react/ui/components/TreeSelect/TreeSelect.d.ts +18 -0
- package/model/packages/react/ui/components/TreeSelect/index.d.ts +1 -0
- package/model/packages/react/ui/components/Upload/ImageUpload.d.ts +8 -0
- package/model/packages/react/ui/components/Upload/Upload.d.ts +13 -0
- package/model/packages/react/ui/components/Upload/index.d.ts +2 -0
- package/model/packages/react/ui/components/breadcrumb/breadcrumb.d.ts +34 -0
- package/model/packages/react/ui/components/breadcrumb/index.d.ts +1 -0
- package/model/packages/react/ui/components/hooks/useDropdownPositioning.d.ts +42 -0
- package/model/packages/react/ui/components/hooks/useInputController.d.ts +20 -0
- package/model/packages/react/ui/components/index.d.ts +35 -0
- package/model/packages/react/ui/components/table/index.d.ts +1 -0
- package/model/packages/react/ui/components/table/table.d.ts +29 -0
- package/model/packages/react/ui/i18n/I18nProvider.d.ts +12 -0
- package/model/packages/react/ui/i18n/index.d.ts +3 -0
- package/model/packages/react/ui/i18n/useI18n.d.ts +8 -0
- package/model/packages/react/ui/index.d.ts +4 -0
- package/model/packages/react/ui/lib/createStoreHook.d.ts +8 -0
- package/model/packages/react/ui/lib/export.d.ts +21 -0
- package/model/packages/react/ui/lib/utils.d.ts +9 -0
- package/model/packages/react/ui/stores/breadcrumb.d.ts +14 -0
- package/model/packages/react/ui/stores/language.d.ts +3 -0
- package/model/packages/react/ui/types/index.d.ts +1 -0
- package/model/typings/type.d.ts +4 -0
- package/package.json +24 -9
- package/types/app/controller/view.d.ts +2 -1
- package/types/app/extend/crypto.d.ts +64 -0
- package/types/app/extend/render-view.d.ts +2 -1
- package/types/app/middlewares/project-handler.d.ts +4 -0
- package/types/app/middlewares/request-parameter-parsing.d.ts +7 -0
- package/types/app/router/project.d.ts +1 -1
- package/types/app/type.d.ts +30 -1
- package/types/app/typings.d.ts +3 -0
- package/types/bundler/buildBE.d.ts +13 -0
- package/types/bundler/defaultRouteGuard.d.ts +2 -0
- package/types/bundler/index.d.ts +3 -1
- package/types/config/config.default.d.ts +27 -1
- package/types/index.d.ts +2 -1
- package/types/packages/core/loader/config.d.ts +1 -1
- package/types/packages/core/loader/middleware.d.ts +1 -1
- package/types/packages/core/types.d.ts +7 -0
- package/types/scripts/vite-build/build.d.ts +24 -0
- package/types/scripts/vite-build/collect.d.ts +57 -0
- package/types/scripts/vite-build/constants.d.ts +6 -0
- package/types/scripts/vite-build/dts.d.ts +53 -0
- package/types/scripts/vite-build/index.d.ts +2 -0
- package/types/scripts/vite-build/normalize.d.ts +66 -0
- package/types/scripts/vite-build/plugins.d.ts +67 -0
- package/types/scripts/vite-build/resolve.d.ts +61 -0
- package/types/scripts/vite-build/types.d.ts +174 -0
- package/types/scripts/vite-build/utils.d.ts +35 -0
- package/cjs/app/middleware/api-params-verify.js +0 -1
- package/cjs/app/middleware/api-sign-verify.js +0 -1
- package/cjs/app/middleware/project-handler.js +0 -1
- package/esm/app/middleware/project-handler.js +0 -15
- package/fe/model/types/data/button.js +0 -16
- package/fe/model/types/data/component.js +0 -11
- package/fe/model/types/data/schema.js +0 -1
- package/fe/model/types/data/search.js +0 -1
- package/fe/model/types/menuType.js +0 -1
- package/fe/model/types/model.js +0 -1
- package/fe/packages/common/array/index.js +0 -40
- package/fe/packages/common/i18n/types.js +0 -1
- package/fe/packages/common/log/index.js +0 -176
- package/fe/packages/common/number/index.js +0 -10
- package/fe/packages/common/object/index.js +0 -25
- package/fe/packages/common/string/index.js +0 -17
- package/fe/packages/common/types/index.js +0 -1
- package/fe/packages/ui/react/components/Button/Button.js +0 -73
- package/fe/packages/ui/react/components/Button/SubmitButton.js +0 -25
- package/fe/packages/ui/react/components/Button/index.d.ts +0 -4
- package/fe/packages/ui/react/components/Button/index.js +0 -2
- package/fe/packages/ui/react/components/Card/Card.js +0 -12
- package/fe/packages/ui/react/components/Card/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Card/index.js +0 -1
- package/fe/packages/ui/react/components/Checkbox/Checkbox.js +0 -39
- package/fe/packages/ui/react/components/Checkbox/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Checkbox/index.js +0 -1
- package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +0 -11
- package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +0 -2
- package/fe/packages/ui/react/components/ConfirmDialog/index.js +0 -1
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +0 -96
- package/fe/packages/ui/react/components/DataTable/index.js +0 -191
- package/fe/packages/ui/react/components/Date/Calendar.js +0 -216
- package/fe/packages/ui/react/components/Date/Date.js +0 -201
- package/fe/packages/ui/react/components/Date/DateTestPage.js +0 -29
- package/fe/packages/ui/react/components/Date/LocaleContext.d.ts +0 -6
- package/fe/packages/ui/react/components/Date/LocaleContext.js +0 -8
- package/fe/packages/ui/react/components/Date/LocaleProvider.d.ts +0 -19
- package/fe/packages/ui/react/components/Date/LocaleProvider.js +0 -24
- package/fe/packages/ui/react/components/Date/TimePicker.js +0 -78
- package/fe/packages/ui/react/components/Date/data.js +0 -4
- package/fe/packages/ui/react/components/Date/dateLocaleStore.js +0 -14
- package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +0 -3
- package/fe/packages/ui/react/components/Date/dropdownPositioning.js +0 -12
- package/fe/packages/ui/react/components/Date/index.d.ts +0 -6
- package/fe/packages/ui/react/components/Date/index.js +0 -5
- package/fe/packages/ui/react/components/Date/locales.js +0 -21
- package/fe/packages/ui/react/components/Drawer/Drawer.js +0 -109
- package/fe/packages/ui/react/components/Drawer/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Drawer/index.js +0 -1
- package/fe/packages/ui/react/components/Dropdown/Dropdown.js +0 -89
- package/fe/packages/ui/react/components/Dropdown/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Dropdown/index.js +0 -1
- package/fe/packages/ui/react/components/Form/Form.js +0 -8
- package/fe/packages/ui/react/components/Form/FormItem.js +0 -43
- package/fe/packages/ui/react/components/Form/SchemaForm/data.js +0 -18
- package/fe/packages/ui/react/components/Form/SchemaForm/index.js +0 -79
- package/fe/packages/ui/react/components/Form/index.d.ts +0 -5
- package/fe/packages/ui/react/components/Form/index.js +0 -4
- package/fe/packages/ui/react/components/Form/useForm.d.ts +0 -3
- package/fe/packages/ui/react/components/Form/useForm.js +0 -1
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +0 -171
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +0 -28
- package/fe/packages/ui/react/components/ImagePreview/index.d.ts +0 -3
- package/fe/packages/ui/react/components/ImagePreview/index.js +0 -2
- package/fe/packages/ui/react/components/Input/Input.js +0 -61
- package/fe/packages/ui/react/components/Input/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Input/index.js +0 -1
- package/fe/packages/ui/react/components/InputNumber/InputNumber.js +0 -144
- package/fe/packages/ui/react/components/InputNumber/index.d.ts +0 -2
- package/fe/packages/ui/react/components/InputNumber/index.js +0 -1
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +0 -63
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +0 -2
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +0 -27
- package/fe/packages/ui/react/components/Label/Label.js +0 -35
- package/fe/packages/ui/react/components/Label/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Label/index.js +0 -2
- package/fe/packages/ui/react/components/Layout/Layout.js +0 -8
- package/fe/packages/ui/react/components/Layout/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Layout/index.js +0 -1
- package/fe/packages/ui/react/components/Loading/Loading.js +0 -21
- package/fe/packages/ui/react/components/Loading/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Loading/index.js +0 -1
- package/fe/packages/ui/react/components/Menu/Menu.js +0 -110
- package/fe/packages/ui/react/components/Menu/MenuContext.js +0 -97
- package/fe/packages/ui/react/components/Menu/MenuItem.js +0 -33
- package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +0 -10
- package/fe/packages/ui/react/components/Menu/SubMenu.js +0 -169
- package/fe/packages/ui/react/components/Menu/index.d.ts +0 -9
- package/fe/packages/ui/react/components/Menu/index.js +0 -5
- package/fe/packages/ui/react/components/Menu/menuTypes.js +0 -1
- package/fe/packages/ui/react/components/Menu/utils.js +0 -7
- package/fe/packages/ui/react/components/Message/Message.js +0 -58
- package/fe/packages/ui/react/components/Message/MessageManager.js +0 -90
- package/fe/packages/ui/react/components/Message/data.js +0 -1
- package/fe/packages/ui/react/components/Message/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Message/index.js +0 -1
- package/fe/packages/ui/react/components/Modal/Modal.js +0 -14
- package/fe/packages/ui/react/components/Modal/ModalManager.js +0 -90
- package/fe/packages/ui/react/components/Modal/index.d.ts +0 -4
- package/fe/packages/ui/react/components/Modal/index.js +0 -2
- package/fe/packages/ui/react/components/Notification/Notification.js +0 -29
- package/fe/packages/ui/react/components/Notification/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Notification/index.js +0 -1
- package/fe/packages/ui/react/components/Overlay/Overlay.js +0 -53
- package/fe/packages/ui/react/components/Overlay/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Overlay/index.js +0 -1
- package/fe/packages/ui/react/components/Pagination/Pagination.js +0 -96
- package/fe/packages/ui/react/components/Pagination/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Pagination/index.js +0 -1
- package/fe/packages/ui/react/components/Popup/Popup.js +0 -81
- package/fe/packages/ui/react/components/Popup/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Popup/index.js +0 -1
- package/fe/packages/ui/react/components/Radio/Radio.js +0 -20
- package/fe/packages/ui/react/components/Radio/RadioGroup.js +0 -21
- package/fe/packages/ui/react/components/Radio/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Radio/index.js +0 -2
- package/fe/packages/ui/react/components/Search/Search.js +0 -8
- package/fe/packages/ui/react/components/Search/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Search/index.js +0 -1
- package/fe/packages/ui/react/components/Select/Select.js +0 -220
- package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +0 -3
- package/fe/packages/ui/react/components/Select/dropdownPositioning.js +0 -13
- package/fe/packages/ui/react/components/Select/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Select/index.js +0 -1
- package/fe/packages/ui/react/components/Skeleton/Skeleton.d.ts +0 -28
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +0 -31
- package/fe/packages/ui/react/components/Skeleton/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Skeleton/index.js +0 -1
- package/fe/packages/ui/react/components/Switch/Switch.js +0 -22
- package/fe/packages/ui/react/components/Switch/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Switch/index.js +0 -1
- package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +0 -68
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +0 -121
- package/fe/packages/ui/react/components/TableSearch/index.d.ts +0 -3
- package/fe/packages/ui/react/components/TableSearch/index.js +0 -1
- package/fe/packages/ui/react/components/TableSearch/lang.js +0 -14
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +0 -11
- package/fe/packages/ui/react/components/Tabs/Tabs.js +0 -19
- package/fe/packages/ui/react/components/Tabs/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Tabs/index.js +0 -1
- package/fe/packages/ui/react/components/Textarea/Textarea.js +0 -37
- package/fe/packages/ui/react/components/Textarea/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Textarea/index.js +0 -1
- package/fe/packages/ui/react/components/Tooltip/Tooltip.js +0 -79
- package/fe/packages/ui/react/components/Tooltip/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Tooltip/index.js +0 -1
- package/fe/packages/ui/react/components/TreeSelect/TreeSelect.js +0 -160
- package/fe/packages/ui/react/components/TreeSelect/index.d.ts +0 -2
- package/fe/packages/ui/react/components/TreeSelect/index.js +0 -1
- package/fe/packages/ui/react/components/Upload/ImageUpload.js +0 -75
- package/fe/packages/ui/react/components/Upload/Upload.d.ts +0 -41
- package/fe/packages/ui/react/components/Upload/Upload.js +0 -7
- package/fe/packages/ui/react/components/Upload/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Upload/index.js +0 -2
- package/fe/packages/ui/react/components/breadcrumb/breadcrumb.js +0 -81
- package/fe/packages/ui/react/components/breadcrumb/index.d.ts +0 -2
- package/fe/packages/ui/react/components/breadcrumb/index.js +0 -1
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +0 -137
- package/fe/packages/ui/react/components/hooks/useInputController.js +0 -44
- package/fe/packages/ui/react/components/index.d.ts +0 -36
- package/fe/packages/ui/react/components/index.js +0 -35
- package/fe/packages/ui/react/components/table/index.d.ts +0 -2
- package/fe/packages/ui/react/components/table/index.js +0 -1
- package/fe/packages/ui/react/components/table/table.js +0 -116
- package/fe/packages/ui/react/components/testPage/MenuTestPage.js +0 -104
- package/fe/packages/ui/react/components/testPage/index.js +0 -475
- package/fe/packages/ui/react/hooks/useBreadcrumb.js +0 -2
- package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +0 -30
- package/fe/packages/ui/react/hooks/useExecuteOnce.js +0 -57
- package/fe/packages/ui/react/hooks/useInit.js +0 -9
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +0 -2
- package/fe/packages/ui/react/hooks/useLanguage.js +0 -4
- package/fe/packages/ui/react/hooks/usePagination.js +0 -27
- package/fe/packages/ui/react/hooks/useRefState.js +0 -29
- package/fe/packages/ui/react/hooks/useWatch.js +0 -87
- package/fe/packages/ui/react/hooks/useWatch.test.d.ts +0 -2
- package/fe/packages/ui/react/hooks/useWatch.test.js +0 -22
- package/fe/packages/ui/react/i18n/I18nProvider.d.ts +0 -31
- package/fe/packages/ui/react/i18n/I18nProvider.js +0 -25
- package/fe/packages/ui/react/i18n/index.d.ts +0 -4
- package/fe/packages/ui/react/i18n/index.js +0 -3
- package/fe/packages/ui/react/i18n/useI18n.d.ts +0 -13
- package/fe/packages/ui/react/i18n/useI18n.js +0 -18
- package/fe/packages/ui/react/index.d.ts +0 -5
- package/fe/packages/ui/react/index.js +0 -6
- package/fe/packages/ui/react/lib/createStoreHook.js +0 -6
- package/fe/packages/ui/react/lib/export.d.ts +0 -66
- package/fe/packages/ui/react/lib/export.js +0 -138
- package/fe/packages/ui/react/lib/utils.d.ts +0 -34
- package/fe/packages/ui/react/lib/utils.js +0 -70
- package/fe/packages/ui/react/stores/breadcrumb.js +0 -66
- package/fe/packages/ui/react/stores/language.d.ts +0 -4
- package/fe/packages/ui/react/stores/language.js +0 -2
- package/fe/packages/ui/react/types/index.js +0 -1
- package/fe/typings/type.js +0 -1
- package/model/test.d.ts +0 -2
- package/model/types/data/fetchInfo.d.ts +0 -20
- package/model/types/data/schema.d.ts +0 -98
- package/types/app/middleware/project-handler.d.ts +0 -4
- /package/fe/packages/{ui/react → react/ui}/assets/table/no-result.svg +0 -0
- /package/fe/packages/{ui/react → react/ui}/index.css +0 -0
- /package/{fe/model/types/data/fetchInfo.js → model/model/test.d.ts} +0 -0
- /package/{fe/packages/common/cache/index.js → model/packages/common/cache/index.d.ts} +0 -0
- /package/{fe/packages/common/index.js → model/packages/common/index.d.ts} +0 -0
- /package/types/app/{middleware → middlewares}/api-params-verify.d.ts +0 -0
- /package/types/app/{middleware → middlewares}/api-sign-verify.d.ts +0 -0
- /package/types/app/{middleware → middlewares}/error-handle.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @_tc/template-core
|
|
2
2
|
|
|
3
|
-
TemplateCore 是一个基于 TypeScript、Koa、React 的后台框架包。它把后端约定式加载、前端 Dashboard、Schema CRUD
|
|
3
|
+
TemplateCore 是一个基于 TypeScript、Koa、React 的后台框架包。它把后端约定式加载、前端 Dashboard、Schema CRUD 页面、model 类型和类型扩展放到同一个 npm 包里,项目只需要按目录补充自己的 `app/`、`model/`、`frontend/`。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -12,9 +12,11 @@ pnpm add @_tc/template-core
|
|
|
12
12
|
|
|
13
13
|
- Node.js >= 18
|
|
14
14
|
- pnpm >= 8
|
|
15
|
-
- 使用内置前端时,需要安装 React、Vite
|
|
15
|
+
- 使用内置前端时,需要安装 peer dependencies;完整清单以包内 `package.json` 的 `peerDependencies` 为准,包括 Koa、React、Vite、路由、状态、表单和 UI 相关依赖。
|
|
16
16
|
|
|
17
|
-
##
|
|
17
|
+
## 可选:给项目 AI 助手的文档与 Skill
|
|
18
|
+
|
|
19
|
+
如果你在项目中让 AI 助手协助开发,可以让它优先读取 npm 包内的 `AGENT_README.md`。安装后的路径通常是 `node_modules/@_tc/template-core/AGENT_README.md`。这份文档面向“协助使用 TemplateCore 的 AI 助手”,覆盖公开入口、最小启动、目录约定、model 配置、前端使用和构建方式。
|
|
18
20
|
|
|
19
21
|
包内附带两份 Agent Skill,本质是可复用的 Agent 指令包,采用渐进式披露(SKILL.md + reference/)结构。
|
|
20
22
|
|
|
@@ -26,9 +28,9 @@ pnpm add @_tc/template-core
|
|
|
26
28
|
如果你的 Agent 支持本地 skills 目录,可以从已安装的 npm 包复制安装。以 Codex 为例:
|
|
27
29
|
|
|
28
30
|
```bash
|
|
29
|
-
mkdir -p
|
|
30
|
-
cp -R node_modules/@_tc/template-core/.skills/tc-generator
|
|
31
|
-
cp -R node_modules/@_tc/template-core/.skills/tc-component-usage-skills
|
|
31
|
+
mkdir -p "${CODEX_HOME:-$HOME/.codex}/skills"
|
|
32
|
+
cp -R node_modules/@_tc/template-core/.skills/tc-generator "${CODEX_HOME:-$HOME/.codex}/skills/tc-generator"
|
|
33
|
+
cp -R node_modules/@_tc/template-core/.skills/tc-component-usage-skills "${CODEX_HOME:-$HOME/.codex}/skills/tc-component-usage-skills"
|
|
32
34
|
```
|
|
33
35
|
|
|
34
36
|
安装后重启对应 Agent,让新 skill 生效。使用时可以直接说”用 tc-generator 生成一个商品管理模块”或”用 tc-component-usage-skills 帮我写一个带搜索的分页表格”。
|
|
@@ -75,7 +77,7 @@ async function main() {
|
|
|
75
77
|
name: 'my-admin',
|
|
76
78
|
baseDir: join(__dirname, '.'),
|
|
77
79
|
pageBasePage: '/',
|
|
78
|
-
additionalPublicPaths: join(__dirname, 'dist/public'),
|
|
80
|
+
additionalPublicPaths: [join(__dirname, 'dist/public')],
|
|
79
81
|
})
|
|
80
82
|
|
|
81
83
|
await buildFE('dev')
|
|
@@ -97,12 +99,26 @@ main().catch((error) => {
|
|
|
97
99
|
| `baseDir` | `string` | 否 | - | 项目根目录,通常为 `join(__dirname, '.')` |
|
|
98
100
|
| `pageBasePage` | `string` | 否 | `'/'` | 页面访问前缀,所有前端页面路由的基础路径 |
|
|
99
101
|
| `homePage` | `string` | 否 | - | 应用首页路径 |
|
|
100
|
-
| `
|
|
101
|
-
|
|
102
|
+
| `additionalPublicPaths` | `string | string[]` | 否 | - | 追加静态资源目录;如需同时作为 Nunjucks 模板查找目录,建议传绝对路径数组 |
|
|
103
|
+
|
|
104
|
+
框架会自动读取 `config/config.default.ts` 中的配置(如 `port`、`env`、`auth` 等)。
|
|
105
|
+
|
|
106
|
+
常用默认配置示例:
|
|
107
|
+
|
|
108
|
+
```ts
|
|
109
|
+
// config/config.default.ts
|
|
110
|
+
export default {
|
|
111
|
+
port: 9000,
|
|
112
|
+
auth: {
|
|
113
|
+
ATKey: 'Authorization',
|
|
114
|
+
RTKey: 'RT',
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
```
|
|
102
118
|
|
|
103
|
-
|
|
119
|
+
`auth.ATKey` / `auth.RTKey` 用于约定业务鉴权中间件读取短 token 和刷新 token 的 header 名;默认分别为 `Authorization` 和 `RT`。
|
|
104
120
|
|
|
105
|
-
|
|
121
|
+
静态资源挂载顺序为:框架 `app/public`、项目 `app/public`、`additionalPublicPaths`。Nunjucks 模板查找顺序为:框架 `app/public/dist`、项目 `app/public/dist`、`additionalPublicPaths`。当 `buildFE` 输出到自定义目录时,可以用 `additionalPublicPaths` 把该目录交给 Koa 提供静态资源访问和模板渲染;如果需要模板查找也命中追加目录,请传绝对路径数组。
|
|
106
122
|
|
|
107
123
|
### buildFE 参数说明
|
|
108
124
|
|
|
@@ -111,25 +127,25 @@ buildFE(mode: 'dev' | 'prod', options?: BuildFEOptions)
|
|
|
111
127
|
```
|
|
112
128
|
|
|
113
129
|
**mode**:构建模式
|
|
114
|
-
- `'dev'
|
|
130
|
+
- `'dev'`:开发模式,构建一次并监听业务 `frontend/` 变化后重建
|
|
115
131
|
- `'prod'`:生产模式,构建优化后的静态资源
|
|
116
132
|
|
|
117
133
|
**options.output**:构建输出位置
|
|
118
|
-
- `'frame'
|
|
134
|
+
- `'frame'`(默认):输出到当前导入格式对应的框架静态目录,例如 `node_modules/@_tc/template-core/esm/app/public/dist` 或 `node_modules/@_tc/template-core/cjs/app/public/dist`
|
|
119
135
|
- `'run'`:输出到项目根目录的 `app/public/dist`,适合 TypeScript 编译后的项目
|
|
120
|
-
- `() => string
|
|
136
|
+
- `() => string`:自定义函数,返回输出目录;建议返回绝对路径
|
|
121
137
|
|
|
122
138
|
示例:
|
|
123
139
|
|
|
124
140
|
```ts
|
|
125
141
|
// 开发模式,默认输出到框架包
|
|
126
|
-
buildFE('dev')
|
|
142
|
+
await buildFE('dev')
|
|
127
143
|
|
|
128
144
|
// 生产模式,输出到项目目录
|
|
129
|
-
buildFE('prod', { output: 'run' })
|
|
145
|
+
await buildFE('prod', { output: 'run' })
|
|
130
146
|
|
|
131
147
|
// 自定义输出路径
|
|
132
|
-
buildFE('prod', {
|
|
148
|
+
await buildFE('prod', {
|
|
133
149
|
output: () => join(__dirname, 'dist/public')
|
|
134
150
|
})
|
|
135
151
|
```
|
|
@@ -151,17 +167,62 @@ http://localhost:9000/dash?projk=demo
|
|
|
151
167
|
|
|
152
168
|
`projk` 对应 `model/{modelKey}/project/{projectKey}.ts` 里的 `projectKey`。
|
|
153
169
|
|
|
154
|
-
##
|
|
170
|
+
## 常用公开入口
|
|
171
|
+
|
|
172
|
+
完整 exports 以发布包内 `package.json` 为准,除下表外还包含 `./fe/main`、`./fe/*`、`./fe/rc/*`、`./fe/rc/hooks/*` 等子路径。
|
|
155
173
|
|
|
156
174
|
| 入口 | 用途 |
|
|
157
175
|
| --- | --- |
|
|
158
176
|
| `@_tc/template-core` | 服务启动、基础 Controller/Service、Koa 类型 |
|
|
159
|
-
| `@_tc/template-core/bundler` |
|
|
177
|
+
| `@_tc/template-core/bundler` | 构建入口,提供前端资源构建 `buildFE` 和消费方 Node/backend 构建 `buildBE` |
|
|
160
178
|
| `@_tc/template-core/fe` | 前端初始化、Dash 路由扩展、请求方法、SchemaPage 事件、共享状态和内置前端组件 |
|
|
161
179
|
| `@_tc/template-core/fe/rc` | UI/SchemaForm 组件和类型 |
|
|
162
180
|
| `@_tc/template-core/fe/tailwind_ui.css` | 前端全局样式入口,源码对应 `frontend/src/main.css` |
|
|
163
181
|
| `@_tc/template-core/model` | model 配置类型 |
|
|
164
182
|
|
|
183
|
+
### 后端类型
|
|
184
|
+
|
|
185
|
+
`@_tc/template-core` 会导出常用 Node 侧类型,业务项目写 `app/*` 文件时建议优先复用这些类型。
|
|
186
|
+
|
|
187
|
+
| 类型 | 使用场景 |
|
|
188
|
+
| --- | --- |
|
|
189
|
+
| `Ctx` | Controller、middleware、router handler 的 Koa 请求上下文类型,包含框架补充的 `ctx.params` 和可选 `ctx.reqData`。 |
|
|
190
|
+
| `ControllerFN` | `app/controller/*.ts` 默认导出工厂函数的约束类型,适合配合 `satisfies ControllerFN` 保留 controller 实例方法类型。 |
|
|
191
|
+
| `ServiceFN` | `app/service/*.ts` 默认导出工厂函数的约束类型,适合配合 `satisfies ServiceFN` 约束 service class 工厂。 |
|
|
192
|
+
| `MiddlewareFN` | `app/middlewares/*.ts` 默认导出工厂函数的约束类型,返回标准 Koa middleware。 |
|
|
193
|
+
| `RouterFN` | `app/router/*.ts` 默认导出函数的约束类型,用于接收 `app` 和 `router` 并注册路由。 |
|
|
194
|
+
|
|
195
|
+
示例:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import { baseFn, type ControllerFN, type Ctx, type MiddlewareFN, type RouterFN, type ServiceFN } from '@_tc/template-core'
|
|
199
|
+
|
|
200
|
+
export const getDemoController = ((app) => {
|
|
201
|
+
const BaseController = baseFn.baseControllerFn(app)
|
|
202
|
+
|
|
203
|
+
return class DemoController extends BaseController {
|
|
204
|
+
list = async (ctx: Ctx) => {
|
|
205
|
+
this.success(ctx, ctx.reqData?.data ?? {})
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}) satisfies ControllerFN
|
|
209
|
+
|
|
210
|
+
export const getDemoService = ((app) => {
|
|
211
|
+
return class DemoService {
|
|
212
|
+
readonly app = app
|
|
213
|
+
}
|
|
214
|
+
}) satisfies ServiceFN
|
|
215
|
+
|
|
216
|
+
export const demoMiddleware = ((app) => async (ctx, next) => {
|
|
217
|
+
app.extends.logger?.info(ctx.path)
|
|
218
|
+
await next()
|
|
219
|
+
}) satisfies MiddlewareFN
|
|
220
|
+
|
|
221
|
+
export const demoRouter = ((app, router) => {
|
|
222
|
+
router.get(`${app.options.apiPrefix}/demo/list`, app.controller.demo.list)
|
|
223
|
+
}) satisfies RouterFN
|
|
224
|
+
```
|
|
225
|
+
|
|
165
226
|
## 样式与 Tailwind V4
|
|
166
227
|
|
|
167
228
|
使用内置前端或 UI 组件时,需要引入包内样式。默认 `@_tc/template-core/fe` 的 `initApp` 会经过源码入口 `frontend/src/main.tsx` 引入 `frontend/src/main.css`;如果项目侧自定义入口、只使用 `fe/rc` 组件,或希望样式入口更明确,建议显式引入:
|
|
@@ -219,7 +280,7 @@ VS Code 建议安装官方 Tailwind CSS IntelliSense 插件,并在工作区 `.
|
|
|
219
280
|
## 内置功能
|
|
220
281
|
|
|
221
282
|
- Koa 服务启动:`serverStart(options)`。
|
|
222
|
-
- 约定式加载:自动加载 `config`、`extend`、`router-schema`、`service`、`controller`、`middleware`、`router`。
|
|
283
|
+
- 约定式加载:自动加载 `config`、`extend`、`router-schema`、`service`、`controller`、`middlewares`、根级 `middleware`、`router`。
|
|
223
284
|
- 双层 app:框架内置 `app/` 和项目 `app/` 一起加载。
|
|
224
285
|
- 默认项目接口:
|
|
225
286
|
- `GET /api/project/model_list`
|
|
@@ -231,7 +292,7 @@ VS Code 建议安装官方 Tailwind CSS IntelliSense 插件,并在工作区 `.
|
|
|
231
292
|
- Schema CRUD:根据 `model` 中的 `schemaConfig` 生成搜索、表格、新增、编辑、详情。
|
|
232
293
|
- 内置 UI 组件:提供丰富的 React 组件库,详见下方"内置 UI 组件"章节。
|
|
233
294
|
- API 中间件:错误处理、静态资源、body parser、项目上下文、接口签名、参数校验。
|
|
234
|
-
-
|
|
295
|
+
- 前端构建:扫描框架和项目的 `frontend/**/*.entry.{ts,tsx,js,jsx}`,输出服务端可渲染的 `.entry.tpl` 和对应 `.entry.html`。
|
|
235
296
|
- 类型扩展:支持扩展 SchemaForm、CallCom、KoaApp。
|
|
236
297
|
|
|
237
298
|
## 前端公共能力
|
|
@@ -240,6 +301,7 @@ VS Code 建议安装官方 Tailwind CSS IntelliSense 插件,并在工作区 `.
|
|
|
240
301
|
|
|
241
302
|
```ts
|
|
242
303
|
import {
|
|
304
|
+
api,
|
|
243
305
|
apiFreezerStore,
|
|
244
306
|
AsyncSelect,
|
|
245
307
|
eventsInfo,
|
|
@@ -259,12 +321,18 @@ import {
|
|
|
259
321
|
} from '@_tc/template-core/fe'
|
|
260
322
|
|
|
261
323
|
import type {
|
|
324
|
+
BaseResponse,
|
|
262
325
|
CallComComponentsMap,
|
|
263
326
|
CallComRenderer,
|
|
264
327
|
DashComponentsMap,
|
|
328
|
+
DashRouteGuard,
|
|
265
329
|
DashRoutesExtender,
|
|
266
330
|
FormFieldSchema,
|
|
267
331
|
ApiFreezerRequestMatcher,
|
|
332
|
+
PageParams,
|
|
333
|
+
PageResponse,
|
|
334
|
+
RequestConfig,
|
|
335
|
+
ResponseConfig,
|
|
268
336
|
SchemaFormComponentsMap,
|
|
269
337
|
SchemaFormNamespace,
|
|
270
338
|
SelectProps,
|
|
@@ -277,24 +345,27 @@ import type {
|
|
|
277
345
|
| --- | --- |
|
|
278
346
|
| 应用启动 | `initApp` |
|
|
279
347
|
| 内置前端组件 | `AsyncSelect`、`LanguageSwitch`、`ThemeSwitch` |
|
|
280
|
-
| Dash 扩展类型 | `DashRoutesExtender`、`DashRoutesContext`、`DashComponentsMap`、`DashHeaderUserAreaProps` |
|
|
348
|
+
| Dash 扩展类型 | `DashRoutesExtender`、`DashRoutesContext`、`DashComponentsMap`、`DashHeaderUserAreaProps`、`DashRouteGuard` |
|
|
281
349
|
| SchemaPage 类型 | `CallComComponentsMap`、`CallComRenderer` |
|
|
282
350
|
| SchemaForm 类型 | `FormFieldSchema`、`SchemaFormComponentsMap`、`SchemaFormNamespace`、`SelectProps` |
|
|
283
|
-
| 请求方法 | `request`、`get`、`post`、`put`、`patch`、`del` |
|
|
351
|
+
| 请求方法 | `api`、`request`、`get`、`post`、`put`、`patch`、`del` |
|
|
352
|
+
| 请求类型 | `BaseResponse`、`PageParams`、`PageResponse`、`RequestConfig`、`ResponseConfig`、`AxiosError` |
|
|
284
353
|
| 请求冻结 | `apiFreezerStore`、`useApiFreezer`、`FreezeState`、`ApiFreezerRequestMatcher` |
|
|
285
354
|
| 事件工具 | `eventsInfo`、`merge` |
|
|
286
355
|
| 共享状态 | `modeStore`、`useModeStore`、`schemaStore`、`useSchemaStore`、`schemaEventBus` |
|
|
287
356
|
|
|
288
357
|
`modeStore` 管项目模型和当前项目数据,`schemaStore` 管当前 Schema 页面的 schema/cache,`schemaEventBus` 用来在 Search、Table、CallCom 之间通信。
|
|
289
358
|
|
|
359
|
+
只使用请求层时,也可以从 `@_tc/template-core/fe/common/request` 导入 `api`、请求方法和请求类型;这是发布包显式子路径,不要下钻到 `frontend/src/common/request`。
|
|
360
|
+
|
|
290
361
|
### 前端多语言
|
|
291
362
|
|
|
292
|
-
TemplateCore
|
|
363
|
+
TemplateCore 前端通过 `@_tc/template-core/fe` 暴露 i18n 能力。框架内置中文、英文资源,项目可以继续追加自己的资源。
|
|
293
364
|
|
|
294
365
|
**追加自定义语言资源**:
|
|
295
366
|
|
|
296
367
|
```ts
|
|
297
|
-
import { i18nStore } from '@
|
|
368
|
+
import { i18nStore } from '@_tc/template-core/fe'
|
|
298
369
|
|
|
299
370
|
i18nStore.getState().addResources('zh-CN', {
|
|
300
371
|
business: {
|
|
@@ -380,7 +451,7 @@ const title = '$i18n::business.product.createTitle'
|
|
|
380
451
|
**切换语言**:
|
|
381
452
|
|
|
382
453
|
```ts
|
|
383
|
-
import { i18nStore } from '@
|
|
454
|
+
import { i18nStore } from '@_tc/template-core/fe'
|
|
384
455
|
|
|
385
456
|
i18nStore.getState().setLanguage('en-US')
|
|
386
457
|
i18nStore.getState().setLanguage('zh-CN')
|
|
@@ -459,6 +530,8 @@ export function Toolbar() {
|
|
|
459
530
|
}
|
|
460
531
|
```
|
|
461
532
|
|
|
533
|
+
`Authorization` 默认对应服务端配置 `config.auth.ATKey`。前端本地 token 存在 `localStorage.auth_token`,项目 key 存在 `localStorage.p_J_k`;刷新 token header 名预留为 `config.auth.RTKey`,默认是 `RT`。
|
|
534
|
+
|
|
462
535
|
**签名机制**:
|
|
463
536
|
- 签名密钥:服务端从 `app.config.signKey` 读取,并在页面渲染时注入为 `window._signKey`
|
|
464
537
|
- 签名算法:`md5(签名密钥_${时间戳})`
|
|
@@ -474,7 +547,8 @@ export function Toolbar() {
|
|
|
474
547
|
**使用示例**:
|
|
475
548
|
|
|
476
549
|
```ts
|
|
477
|
-
import { get, post, put, del } from '@_tc/template-core/fe'
|
|
550
|
+
import { api, get, post, put, del } from '@_tc/template-core/fe'
|
|
551
|
+
import type { BaseResponse, RequestConfig, ResponseConfig } from '@_tc/template-core/fe'
|
|
478
552
|
|
|
479
553
|
// GET 请求
|
|
480
554
|
const data = await get('/product/list', { page: 1, pageSize: 10 })
|
|
@@ -489,6 +563,22 @@ await put('/product', { id: 1, name: '新名称' })
|
|
|
489
563
|
await del('/product', { id: 1 })
|
|
490
564
|
```
|
|
491
565
|
|
|
566
|
+
如果希望把请求能力单独拆出来导入:
|
|
567
|
+
|
|
568
|
+
```ts
|
|
569
|
+
import {
|
|
570
|
+
api,
|
|
571
|
+
get,
|
|
572
|
+
post,
|
|
573
|
+
request,
|
|
574
|
+
} from '@_tc/template-core/fe/common/request'
|
|
575
|
+
import type {
|
|
576
|
+
BaseResponse,
|
|
577
|
+
RequestConfig,
|
|
578
|
+
ResponseConfig,
|
|
579
|
+
} from '@_tc/template-core/fe/common/request'
|
|
580
|
+
```
|
|
581
|
+
|
|
492
582
|
**请求冻结器**:
|
|
493
583
|
|
|
494
584
|
请求冻结器用于在某段流程中暂停普通 API 请求,典型场景是 RT 刷新 token:刷新期间冻结其它请求,刷新接口本身走白名单放行,刷新完成后再解冻并回放队列。
|
|
@@ -536,7 +626,7 @@ try {
|
|
|
536
626
|
| 组件 | 用途 | 导入路径 |
|
|
537
627
|
| --- | --- | --- |
|
|
538
628
|
| `Button` | 按钮组件,支持多种样式和尺寸 | `@_tc/template-core/fe/rc` |
|
|
539
|
-
| `Input` |
|
|
629
|
+
| `Input` | 输入框组件,支持清空、右侧附加内容和密码显隐 | `@_tc/template-core/fe/rc` |
|
|
540
630
|
| `InputNumber` | 数字输入框组件 | `@_tc/template-core/fe/rc` |
|
|
541
631
|
| `Textarea` | 多行文本输入框组件 | `@_tc/template-core/fe/rc` |
|
|
542
632
|
| `Select` | 下拉选择组件,支持单选和多选 | `@_tc/template-core/fe/rc` |
|
|
@@ -579,7 +669,7 @@ try {
|
|
|
579
669
|
| --- | --- | --- |
|
|
580
670
|
| `Modal` | 模态框组件 | `@_tc/template-core/fe/rc` |
|
|
581
671
|
| `Drawer` | 抽屉组件 | `@_tc/template-core/fe/rc` |
|
|
582
|
-
| `
|
|
672
|
+
| `message` | 消息提示方法 | `@_tc/template-core/fe/rc` |
|
|
583
673
|
| `Notification` | 通知组件 | `@_tc/template-core/fe/rc` |
|
|
584
674
|
| `ConfirmDialog` | 确认对话框组件 | `@_tc/template-core/fe/rc` |
|
|
585
675
|
| `Popup` | 弹出层组件 | `@_tc/template-core/fe/rc` |
|
|
@@ -619,6 +709,7 @@ function MyComponent() {
|
|
|
619
709
|
</Button>
|
|
620
710
|
|
|
621
711
|
<Input placeholder="请输入内容" />
|
|
712
|
+
<Input type="password" placeholder="请输入密码" />
|
|
622
713
|
|
|
623
714
|
<Select
|
|
624
715
|
options={[
|
|
@@ -643,20 +734,40 @@ function MyComponent() {
|
|
|
643
734
|
```text
|
|
644
735
|
app/controller/**/*.(js|ts) -> app.controller
|
|
645
736
|
app/service/**/*.(js|ts) -> app.service
|
|
646
|
-
app/
|
|
737
|
+
app/middlewares/**/*.(js|ts) -> app.middlewares
|
|
738
|
+
app/middleware.(js|ts) -> 全局中间件编排,按框架 -> 项目顺序执行
|
|
647
739
|
app/router/**/*.(js|ts) -> Koa router
|
|
648
740
|
app/router-schema/**/*.(js|ts) -> app.routerSchema
|
|
649
741
|
app/extend/*.(js|ts) -> app.extends
|
|
650
742
|
config/config.default.(js|ts) -> app.config
|
|
651
743
|
config/config.{env}.(js|ts) -> app.config
|
|
652
|
-
model/**/*.(js|ts) ->
|
|
744
|
+
model/**/*.(js|ts) -> 内置 project service 按需读取的项目模型配置
|
|
653
745
|
```
|
|
654
746
|
|
|
655
747
|
内置扩展:
|
|
656
748
|
|
|
657
749
|
- `app.extends.$fetch`:Node 侧基于 `fetch` 的 axios 风格请求实例,支持 `get/post/put/patch/delete` 和 `create(config)`。
|
|
750
|
+
- `app.extends.crypto`:Node 侧加密辅助方法,支持 base64url 编解码、HMAC 签名、签名 payload 和常量时间比较。
|
|
658
751
|
- `app.extends.db`:默认 SQLite 框架数据库,提供 `getDBData/setDBData` 等通用数据方法。
|
|
659
752
|
|
|
753
|
+
API controller 可以通过 `ctx.reqData` 读取统一请求参数:
|
|
754
|
+
|
|
755
|
+
```ts
|
|
756
|
+
const { query, body, headers, data } = ctx.reqData ?? {
|
|
757
|
+
query: {},
|
|
758
|
+
body: undefined,
|
|
759
|
+
headers: {},
|
|
760
|
+
data: {},
|
|
761
|
+
}
|
|
762
|
+
```
|
|
763
|
+
|
|
764
|
+
- `query` 来自 `ctx.query`。
|
|
765
|
+
- `body` 来自 `ctx.request.body`。
|
|
766
|
+
- `headers` 来自 `ctx.headers`。
|
|
767
|
+
- `data` 是便捷合并层,当前按 `query -> body` 顺序合并;字段冲突时 body 覆盖 query。
|
|
768
|
+
|
|
769
|
+
`ctx.reqData` 只在 API 请求中由内置中间件注入,类型上是可选字段。router params 不在 `reqData` 里,仍然从 `ctx.params` 获取。
|
|
770
|
+
|
|
660
771
|
### 数据库扩展
|
|
661
772
|
|
|
662
773
|
默认 `app.extends.db` 使用 SQLite 保存数据,数据库文件位于项目根目录 `.template-core/template-core.sqlite`。可以在配置中调整路径:
|
|
@@ -718,6 +829,36 @@ SQL 注入边界:
|
|
|
718
829
|
- `queryDB`、`runDB`、`getDBFirst` 是原始 SQL 入口,用户输入必须放到 `params`,不要拼接到 SQL 字符串里。
|
|
719
830
|
- `execDB` 没有参数绑定能力,只建议用于固定 SQL,例如建表或迁移。
|
|
720
831
|
|
|
832
|
+
### 加密扩展
|
|
833
|
+
|
|
834
|
+
`app.extends.crypto` 默认使用 `app.config.signKey` 作为签名密钥,适合生成登录 token、接口签名和安全比较。
|
|
835
|
+
|
|
836
|
+
常用方法:
|
|
837
|
+
|
|
838
|
+
- `base64urlEncode(value)`:把字符串或二进制数据编码为 base64url。
|
|
839
|
+
- `base64urlDecode(value)`:把 base64url 解码回 UTF-8 字符串。
|
|
840
|
+
- `base64urlDecodeToBuffer(value)`:把 base64url 解码回 Buffer。
|
|
841
|
+
- `hmacSign(payload, options)`:对文本做 HMAC 签名,默认算法 `sha256`。
|
|
842
|
+
- `safeEqual(left, right)`:常量时间比较字符串。
|
|
843
|
+
- `createSignedPayload(payload, options)`:生成 `payload.signature` 形式的签名串。
|
|
844
|
+
- `verifySignedPayload(token, options)`:验证并解析签名串,失败返回 `null`。
|
|
845
|
+
|
|
846
|
+
```ts
|
|
847
|
+
const token = app.extends.crypto.createSignedPayload({
|
|
848
|
+
account: 'admin',
|
|
849
|
+
exp: Date.now() + 1000 * 60 * 60 * 24 * 7,
|
|
850
|
+
iat: Date.now(),
|
|
851
|
+
})
|
|
852
|
+
|
|
853
|
+
const payload = app.extends.crypto.verifySignedPayload<{
|
|
854
|
+
account: string
|
|
855
|
+
exp: number
|
|
856
|
+
iat: number
|
|
857
|
+
}>(token)
|
|
858
|
+
|
|
859
|
+
const same = app.extends.crypto.safeEqual('abc', 'abc')
|
|
860
|
+
```
|
|
861
|
+
|
|
721
862
|
```ts
|
|
722
863
|
// 推荐:参数绑定
|
|
723
864
|
const users = app.extends.db.queryDB(
|
|
@@ -842,6 +983,22 @@ export default (app: KoaApp, router: Router) => {
|
|
|
842
983
|
}
|
|
843
984
|
```
|
|
844
985
|
|
|
986
|
+
路由挂载顺序:
|
|
987
|
+
|
|
988
|
+
- 每个 `app/router/*.ts` 文件都会获得独立的 `koa-router` 实例。
|
|
989
|
+
- 可以通过 `router.level = number` 控制挂载顺序,数值越小越早挂载。
|
|
990
|
+
- 默认 `level` 是 `0`,框架兜底 router 是 `99`。
|
|
991
|
+
- 通配、兜底、重定向类路由建议设置较大的 `level`,避免抢先匹配业务 API。
|
|
992
|
+
|
|
993
|
+
```ts
|
|
994
|
+
import type { KoaApp, Router } from '@_tc/template-core'
|
|
995
|
+
|
|
996
|
+
export default (app: KoaApp, router: Router) => {
|
|
997
|
+
router.level = 10
|
|
998
|
+
router.get('/api/fallback/:id', app.controller.fallback.detail)
|
|
999
|
+
}
|
|
1000
|
+
```
|
|
1001
|
+
|
|
845
1002
|
## model 数据如何配置
|
|
846
1003
|
|
|
847
1004
|
`model` 是后台菜单、项目和 Schema 页面的数据源。框架会读取:
|
|
@@ -1118,6 +1275,29 @@ DELETE {api} -> 删除
|
|
|
1118
1275
|
|
|
1119
1276
|
`$schema::字段名` 表示从当前表格行读取字段值,常用于删除按钮参数。
|
|
1120
1277
|
|
|
1278
|
+
### 服务端兜底路由守卫
|
|
1279
|
+
|
|
1280
|
+
业务项目可以创建 `app/router-guard.ts` 或 `app/router-guard.js`。它只在所有正常 `app/router/*` 路由都没有命中时执行。
|
|
1281
|
+
|
|
1282
|
+
```ts
|
|
1283
|
+
import type { Ctx, KoaApp } from '@_tc/template-core'
|
|
1284
|
+
|
|
1285
|
+
export default (_app: KoaApp) => {
|
|
1286
|
+
return (ctx: Ctx) => {
|
|
1287
|
+
if (ctx.path.startsWith('/api/')) {
|
|
1288
|
+
return {
|
|
1289
|
+
status: 404,
|
|
1290
|
+
body: { code: 404, message: `${ctx.path} not found` },
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
|
|
1294
|
+
return '/dash'
|
|
1295
|
+
}
|
|
1296
|
+
}
|
|
1297
|
+
```
|
|
1298
|
+
|
|
1299
|
+
返回字符串会 `ctx.redirect()`;返回 `{ status, body }` 会直接设置响应;无返回则使用框架默认兜底:API 路径返回 HTTP 200 + `{ code: 404, message }`,非 API 路径返回 HTTP 404 + `notFound`。
|
|
1300
|
+
|
|
1121
1301
|
## 如何扩展组件
|
|
1122
1302
|
|
|
1123
1303
|
### 扩展 Dashboard 顶部用户区域
|
|
@@ -1141,6 +1321,28 @@ export default components
|
|
|
1141
1321
|
|
|
1142
1322
|
- `HeaderView.userArea`:Dashboard 顶部右侧区域。
|
|
1143
1323
|
|
|
1324
|
+
### 扩展 Dashboard 登录守卫
|
|
1325
|
+
|
|
1326
|
+
业务项目可以创建 `frontend/extended/dash/routeGuard.ts`,用于在 Dashboard 内置 `homePage` / 首菜单重定向前做登录判断。
|
|
1327
|
+
|
|
1328
|
+
```ts
|
|
1329
|
+
// frontend/extended/dash/routeGuard.ts
|
|
1330
|
+
import type { DashRouteGuard } from '@_tc/template-core/fe'
|
|
1331
|
+
|
|
1332
|
+
const dashRouteGuard: DashRouteGuard = ({ isLoggedIn }) => {
|
|
1333
|
+
if (!isLoggedIn) return '/login'
|
|
1334
|
+
}
|
|
1335
|
+
|
|
1336
|
+
export default dashRouteGuard
|
|
1337
|
+
```
|
|
1338
|
+
|
|
1339
|
+
返回值规则:
|
|
1340
|
+
|
|
1341
|
+
- 返回 `string`:框架使用 `window.location.href` 跳转,登录页不需要在 Dash 路由下。
|
|
1342
|
+
- 返回非 `string`:中断 Dashboard 内置重定向,业务方可自行跳转或处理提示。
|
|
1343
|
+
- `DashRouteGuardResult` 是 `string | undefined`;`undefined`(包括已登录分支的隐式返回)也会打断 Dashboard 内置重定向。
|
|
1344
|
+
- 没有业务 `routeGuard` 文件时,框架使用兜底空对象,不影响默认 Dashboard 重定向。
|
|
1345
|
+
|
|
1144
1346
|
### 扩展 SchemaForm 字段组件
|
|
1145
1347
|
|
|
1146
1348
|
1. 声明字段类型。
|
|
@@ -1472,6 +1674,55 @@ frontend/admin/admin.entry.tsx
|
|
|
1472
1674
|
|
|
1473
1675
|
入口文件名必须包含 `.entry.`,构建器才会扫描。
|
|
1474
1676
|
|
|
1677
|
+
最小入口示例:
|
|
1678
|
+
|
|
1679
|
+
```tsx
|
|
1680
|
+
// frontend/admin/admin.entry.tsx
|
|
1681
|
+
import { initApp } from '@_tc/template-core/fe'
|
|
1682
|
+
import type { ReactNode } from 'react'
|
|
1683
|
+
|
|
1684
|
+
const AdminApp = ({ children }: { children: ReactNode }) => (
|
|
1685
|
+
<main>{children}</main>
|
|
1686
|
+
)
|
|
1687
|
+
|
|
1688
|
+
initApp(AdminApp, {
|
|
1689
|
+
initModeData: false,
|
|
1690
|
+
})
|
|
1691
|
+
```
|
|
1692
|
+
|
|
1693
|
+
如果需要给页面加额外 `meta`、预连接资源或启动脚本,可以在入口同目录放 `.html` 插槽文件。这个文件不是完整 HTML,只能包含 `tc-slot` 块:
|
|
1694
|
+
|
|
1695
|
+
```html
|
|
1696
|
+
<!-- frontend/admin/admin.html -->
|
|
1697
|
+
<!-- tc-slot:head -->
|
|
1698
|
+
<meta name="description" content="Admin Console" />
|
|
1699
|
+
<link rel="preconnect" href="https://example.com" />
|
|
1700
|
+
<!-- /tc-slot:head -->
|
|
1701
|
+
|
|
1702
|
+
<!-- tc-slot:body-before-root -->
|
|
1703
|
+
<div id="boot-mask"></div>
|
|
1704
|
+
<!-- /tc-slot:body-before-root -->
|
|
1705
|
+
|
|
1706
|
+
<!-- tc-slot:body-after-root -->
|
|
1707
|
+
<script>
|
|
1708
|
+
window.__ADMIN_BOOT_TIME__ = Date.now()
|
|
1709
|
+
</script>
|
|
1710
|
+
<!-- /tc-slot:body-after-root -->
|
|
1711
|
+
```
|
|
1712
|
+
|
|
1713
|
+
命名规则:
|
|
1714
|
+
|
|
1715
|
+
```text
|
|
1716
|
+
frontend/admin/admin.entry.tsx
|
|
1717
|
+
frontend/admin/admin.html yes
|
|
1718
|
+
|
|
1719
|
+
frontend/report/index.entry.tsx
|
|
1720
|
+
frontend/report/index.html yes
|
|
1721
|
+
frontend/report/report.html yes
|
|
1722
|
+
```
|
|
1723
|
+
|
|
1724
|
+
不要在插槽文件里写 `<!DOCTYPE html>`、`<html>`、`<body>` 或 `<div id="root"></div>`。页面外壳由 TemplateCore 的 `app/view/entry.tpl` 统一生成,`window._basePath`、`window._projKey`、`window._signKey`、`window.appOptions` 也由它注入。
|
|
1725
|
+
|
|
1475
1726
|
扩展 Dashboard 路由:
|
|
1476
1727
|
|
|
1477
1728
|
```tsx
|
|
@@ -1517,30 +1768,183 @@ model 中用 `custom` 菜单指向自定义路径:
|
|
|
1517
1768
|
}
|
|
1518
1769
|
```
|
|
1519
1770
|
|
|
1520
|
-
##
|
|
1771
|
+
## 前端构建 buildFE
|
|
1521
1772
|
|
|
1522
1773
|
开发构建:
|
|
1523
1774
|
|
|
1524
1775
|
```ts
|
|
1525
1776
|
import { buildFE } from '@_tc/template-core/bundler'
|
|
1526
1777
|
|
|
1527
|
-
buildFE('dev')
|
|
1778
|
+
await buildFE('dev')
|
|
1528
1779
|
```
|
|
1529
1780
|
|
|
1530
1781
|
生产构建:
|
|
1531
1782
|
|
|
1532
1783
|
```ts
|
|
1533
|
-
buildFE('prod')
|
|
1784
|
+
await buildFE('prod')
|
|
1534
1785
|
```
|
|
1535
1786
|
|
|
1536
|
-
|
|
1787
|
+
默认输出到当前导入格式对应的框架静态目录,例如 `esm/app/public/dist` 或 `cjs/app/public/dist`。如果要输出到项目:
|
|
1537
1788
|
|
|
1538
1789
|
```ts
|
|
1539
|
-
buildFE('prod', {
|
|
1790
|
+
await buildFE('prod', {
|
|
1540
1791
|
output: 'run',
|
|
1541
1792
|
})
|
|
1542
1793
|
```
|
|
1543
1794
|
|
|
1795
|
+
## Node/backend 构建 buildBE
|
|
1796
|
+
|
|
1797
|
+
消费方 Node/backend 侧构建使用 `buildBE()`。它复用发布包内的 `scripts/vite-build/buildEntries`,只是提供消费方默认配置。
|
|
1798
|
+
|
|
1799
|
+
最小用法:
|
|
1800
|
+
|
|
1801
|
+
```ts
|
|
1802
|
+
import { buildBE } from '@_tc/template-core/bundler'
|
|
1803
|
+
|
|
1804
|
+
await buildBE()
|
|
1805
|
+
```
|
|
1806
|
+
|
|
1807
|
+
消费方脚本示例:
|
|
1808
|
+
|
|
1809
|
+
```js
|
|
1810
|
+
// scripts/build-be.mjs
|
|
1811
|
+
import { buildBE } from '@_tc/template-core/bundler'
|
|
1812
|
+
|
|
1813
|
+
await buildBE({
|
|
1814
|
+
rootDir: process.cwd(),
|
|
1815
|
+
input: ['index.ts', 'index.js', 'app', 'config', 'model'],
|
|
1816
|
+
outDir: 'dist',
|
|
1817
|
+
format: 'cjs',
|
|
1818
|
+
alias: {
|
|
1819
|
+
'@app': './app',
|
|
1820
|
+
'@model': './model',
|
|
1821
|
+
},
|
|
1822
|
+
})
|
|
1823
|
+
```
|
|
1824
|
+
|
|
1825
|
+
```json
|
|
1826
|
+
{
|
|
1827
|
+
"scripts": {
|
|
1828
|
+
"build:be": "node scripts/build-be.mjs"
|
|
1829
|
+
}
|
|
1830
|
+
}
|
|
1831
|
+
```
|
|
1832
|
+
|
|
1833
|
+
监听文件变化并重新构建:
|
|
1834
|
+
|
|
1835
|
+
```js
|
|
1836
|
+
// scripts/watch-be.mjs
|
|
1837
|
+
import chokidar from 'chokidar'
|
|
1838
|
+
import { buildBE } from '@_tc/template-core/bundler'
|
|
1839
|
+
|
|
1840
|
+
const input = ['index.ts', 'index.js', 'app', 'config', 'model']
|
|
1841
|
+
|
|
1842
|
+
let building = false
|
|
1843
|
+
let pending = false
|
|
1844
|
+
|
|
1845
|
+
async function runBuild() {
|
|
1846
|
+
if (building) {
|
|
1847
|
+
pending = true
|
|
1848
|
+
return
|
|
1849
|
+
}
|
|
1850
|
+
|
|
1851
|
+
building = true
|
|
1852
|
+
|
|
1853
|
+
try {
|
|
1854
|
+
console.log('[buildBE] building...')
|
|
1855
|
+
await buildBE({
|
|
1856
|
+
rootDir: process.cwd(),
|
|
1857
|
+
input,
|
|
1858
|
+
outDir: 'dist',
|
|
1859
|
+
format: 'cjs',
|
|
1860
|
+
alias: {
|
|
1861
|
+
'@app': './app',
|
|
1862
|
+
'@model': './model',
|
|
1863
|
+
},
|
|
1864
|
+
})
|
|
1865
|
+
console.log('[buildBE] done')
|
|
1866
|
+
} catch (error) {
|
|
1867
|
+
console.error('[buildBE] failed')
|
|
1868
|
+
console.error(error)
|
|
1869
|
+
} finally {
|
|
1870
|
+
building = false
|
|
1871
|
+
|
|
1872
|
+
if (pending) {
|
|
1873
|
+
pending = false
|
|
1874
|
+
await runBuild()
|
|
1875
|
+
}
|
|
1876
|
+
}
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
await runBuild()
|
|
1880
|
+
|
|
1881
|
+
chokidar
|
|
1882
|
+
.watch(input, {
|
|
1883
|
+
ignored: ['dist/**', 'node_modules/**'],
|
|
1884
|
+
ignoreInitial: true,
|
|
1885
|
+
})
|
|
1886
|
+
.on('all', async (_event, filePath) => {
|
|
1887
|
+
console.log(`[buildBE] changed: ${filePath}`)
|
|
1888
|
+
await runBuild()
|
|
1889
|
+
})
|
|
1890
|
+
```
|
|
1891
|
+
|
|
1892
|
+
```json
|
|
1893
|
+
{
|
|
1894
|
+
"scripts": {
|
|
1895
|
+
"build:be": "node scripts/build-be.mjs",
|
|
1896
|
+
"build:be:watch": "node scripts/watch-be.mjs"
|
|
1897
|
+
},
|
|
1898
|
+
"devDependencies": {
|
|
1899
|
+
"chokidar": "^4.0.3"
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1902
|
+
```
|
|
1903
|
+
|
|
1904
|
+
默认会在当前工作目录构建这些入口:
|
|
1905
|
+
|
|
1906
|
+
```ts
|
|
1907
|
+
['index.ts', 'index.js', 'app', 'config', 'model']
|
|
1908
|
+
```
|
|
1909
|
+
|
|
1910
|
+
不存在的默认入口会自动跳过;如果没有任何匹配源码,构建仍会失败。输出到 `dist`,格式为 `cjs`。默认 `outputStructure: "preserve"` 按源路径输出,`bundleDependencies: false` 会 external Node 内置模块和 npm 包,不会把依赖打进产物。`buildBE` 会按同一组 input 扫描并复制内置白名单资源扩展,主要覆盖 `app`、`config`、`model` 目录。
|
|
1911
|
+
|
|
1912
|
+
常见配置:
|
|
1913
|
+
|
|
1914
|
+
```ts
|
|
1915
|
+
await buildBE({
|
|
1916
|
+
input: ['app', 'config', 'model'],
|
|
1917
|
+
outDir: 'dist',
|
|
1918
|
+
format: ['es', 'cjs'],
|
|
1919
|
+
alias: {
|
|
1920
|
+
'@app': './app',
|
|
1921
|
+
'@model': './model',
|
|
1922
|
+
},
|
|
1923
|
+
})
|
|
1924
|
+
```
|
|
1925
|
+
|
|
1926
|
+
如果需要声明文件:
|
|
1927
|
+
|
|
1928
|
+
```ts
|
|
1929
|
+
await buildBE({
|
|
1930
|
+
dts: {
|
|
1931
|
+
outDir: 'types',
|
|
1932
|
+
tsconfig: 'tsconfig.json',
|
|
1933
|
+
},
|
|
1934
|
+
})
|
|
1935
|
+
```
|
|
1936
|
+
|
|
1937
|
+
`buildEntries()` 底层默认生成 d.ts,但 `buildBE()` 默认关闭声明文件;需要时按上面这样显式传 `dts`。
|
|
1938
|
+
|
|
1939
|
+
如果传入自定义 `input`,缺失路径默认会报错;需要跳过时显式打开:
|
|
1940
|
+
|
|
1941
|
+
```ts
|
|
1942
|
+
await buildBE({
|
|
1943
|
+
input: ['app', 'config', 'model'],
|
|
1944
|
+
allowMissingInput: true,
|
|
1945
|
+
})
|
|
1946
|
+
```
|
|
1947
|
+
|
|
1544
1948
|
## 注意事项
|
|
1545
1949
|
|
|
1546
1950
|
- 不要在项目代码里引用 `dist/fe/*`、`dist/model/*` 这类构建产物路径。
|
|
@@ -1548,5 +1952,7 @@ buildFE('prod', {
|
|
|
1548
1952
|
- SchemaForm 和 CallCom 的类型扩展、运行时注册都要做,少一个就只会“类型通过但页面不显示”或“页面能配但类型报错”。
|
|
1549
1953
|
- `model` 数组合并依赖稳定 `key`。
|
|
1550
1954
|
- Dashboard 默认需要 URL 带 `?projk=项目key`。
|
|
1955
|
+
- Dashboard 登录守卫放在 `frontend/extended/dash/routeGuard.ts`;登录页通常不在 Dash 路由下,返回登录页 URL 即可。
|
|
1956
|
+
- 服务端兜底守卫放在业务 `app/router-guard.ts|js`,不是 `app/business` 子目录。
|
|
1551
1957
|
- 前端入口必须命名为 `.entry.tsx`、`.entry.ts`、`.entry.jsx` 或 `.entry.js`。
|
|
1552
|
-
-
|
|
1958
|
+
- 入口同目录的 `.html` 只能作为插槽文件使用,不能写完整 HTML 文档;页面外壳始终由 `app/view/entry.tpl` 生成。
|