@_tc/template-core 0.0.1-bate.6 → 0.0.1-bate.60
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 +139 -0
- package/.skills/tc-component-usage-skills/reference/component-api.md +804 -0
- package/.skills/tc-component-usage-skills/reference/examples.md +435 -0
- package/.skills/tc-component-usage-skills/reference/patterns.md +392 -0
- package/.skills/tc-component-usage-skills/reference/template-core-frontend.md +106 -0
- package/.skills/tc-generator/SKILL.md +70 -0
- package/.skills/tc-generator/reference/example.md +361 -0
- package/.skills/tc-generator/reference/model-schema.md +328 -0
- package/.skills/tc-generator/reference/project-template/app/controller/product.js +73 -0
- package/.skills/tc-generator/reference/project-template/app/router/product.js +9 -0
- package/.skills/tc-generator/reference/project-template/config/config.default.js +11 -0
- package/.skills/tc-generator/reference/project-template/index.js +17 -0
- package/.skills/tc-generator/reference/project-template/model/product/mode.js +179 -0
- package/.skills/tc-generator/reference/project-template/model/product/project/default.js +7 -0
- package/.skills/tc-generator/reference/project-template/package.json +25 -0
- package/.skills/tc-generator/reference/runtime-extensions.md +300 -0
- package/AGENT_README.md +632 -0
- package/README.md +1958 -0
- package/cjs/_virtual/_rolldown/runtime.js +1 -0
- package/cjs/app/controller/base.js +1 -0
- package/cjs/app/controller/project.js +1 -0
- package/cjs/app/controller/view.js +1 -0
- package/cjs/app/extend/$fetch.js +1 -0
- package/cjs/app/extend/crypto.js +1 -0
- package/cjs/app/extend/db.js +20 -0
- package/cjs/app/extend/generateErrorMessage.js +1 -0
- package/cjs/app/extend/logger.js +1 -0
- package/cjs/app/extend/parsingParamsOnUrl.js +1 -0
- package/cjs/app/extend/render-view.js +1 -0
- package/cjs/app/middleware.js +1 -0
- package/cjs/app/middlewares/api-params-verify.js +1 -0
- package/cjs/app/middlewares/api-sign-verify.js +1 -0
- package/cjs/app/middlewares/error-handle.js +1 -0
- 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 -0
- package/cjs/app/router/view.js +1 -0
- package/cjs/app/router-schema/project.js +1 -0
- package/cjs/app/service/base.js +1 -0
- package/cjs/app/service/project.js +1 -0
- package/cjs/app/type.js +0 -0
- package/cjs/app/typings.js +0 -0
- package/cjs/app/view/entry.tpl +32 -0
- package/cjs/bundler/buildBE.js +1 -0
- package/cjs/bundler/defaultAlias.js +1 -0
- package/cjs/bundler/defaultRouteGuard.js +1 -0
- package/cjs/bundler/dev.js +1 -0
- package/cjs/bundler/index.js +1 -0
- package/cjs/bundler/prod.js +1 -0
- package/cjs/bundler/state.js +1 -0
- package/cjs/bundler/utils.js +3 -0
- package/cjs/config/config.default.js +1 -0
- package/cjs/index.js +1 -0
- package/cjs/packages/common/LRUCache.js +1 -0
- package/cjs/packages/common/array/index.js +1 -0
- package/cjs/packages/common/cache/LRUCache.js +1 -0
- package/cjs/packages/common/cache/index.js +1 -0
- package/cjs/packages/common/guards/index.js +1 -0
- package/cjs/packages/common/http/index.js +1 -0
- package/cjs/packages/common/i18n/default.js +1 -0
- package/cjs/packages/common/i18n/en-US.js +1 -0
- package/cjs/packages/common/i18n/index.js +1 -0
- package/cjs/packages/common/i18n/locales.js +1 -0
- package/cjs/packages/common/i18n/types.js +0 -0
- package/cjs/packages/common/index.js +1 -0
- package/cjs/packages/common/log/index.js +2 -0
- package/cjs/packages/common/number/index.js +1 -0
- package/cjs/packages/common/object/filterEmpty.js +1 -0
- package/cjs/packages/common/object/filtereEmpty.js +1 -0
- package/cjs/packages/common/object/index.js +1 -0
- package/cjs/packages/common/string/index.js +1 -0
- package/cjs/packages/common/types/index.js +0 -0
- package/cjs/packages/core/env.js +1 -0
- package/cjs/packages/core/index.js +1 -0
- package/cjs/packages/core/loader/config.js +1 -0
- package/cjs/packages/core/loader/controller.js +1 -0
- package/cjs/packages/core/loader/extend.js +1 -0
- package/cjs/packages/core/loader/middleware.js +1 -0
- package/cjs/packages/core/loader/model.js +1 -0
- package/cjs/packages/core/loader/router-schema.js +1 -0
- package/cjs/packages/core/loader/router.js +1 -0
- package/cjs/packages/core/loader/service.js +1 -0
- package/cjs/packages/core/paths.js +1 -0
- package/cjs/packages/core/types.js +0 -0
- package/cjs/packages/utils/getAllFilesInFolder.js +1 -0
- package/cjs/packages/utils/getAllFnReturnValue.js +0 -0
- package/cjs/packages/utils/index.js +1 -0
- package/cjs/packages/utils/loadFile.js +1 -0
- package/cjs/packages/utils/path.js +1 -0
- package/cjs/packages/utils/runFileFn.js +1 -0
- 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/_virtual/_rolldown/runtime.js +7 -0
- package/esm/app/controller/base.js +26 -0
- package/esm/app/controller/project.js +57 -0
- package/esm/app/controller/view.js +28 -0
- package/esm/app/extend/$fetch.js +15 -0
- package/esm/app/extend/crypto.js +31 -0
- package/esm/app/extend/db.js +141 -0
- package/esm/app/extend/generateErrorMessage.js +7 -0
- package/esm/app/extend/logger.js +26 -0
- package/esm/app/extend/parsingParamsOnUrl.js +14 -0
- package/esm/app/extend/render-view.js +25 -0
- package/esm/app/middleware.js +26 -0
- package/esm/app/middlewares/api-params-verify.js +56 -0
- package/esm/app/middlewares/api-sign-verify.js +16 -0
- package/esm/app/middlewares/error-handle.js +24 -0
- 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 +7 -0
- package/esm/app/router/view.js +7 -0
- package/esm/app/router-schema/project.js +15 -0
- package/esm/app/service/base.js +14 -0
- package/esm/app/service/project.js +23 -0
- package/esm/app/type.js +0 -0
- package/esm/app/typings.js +0 -0
- package/esm/app/view/entry.tpl +32 -0
- package/esm/bundler/buildBE.js +54 -0
- package/esm/bundler/defaultAlias.js +4 -0
- package/esm/bundler/defaultRouteGuard.js +4 -0
- package/esm/bundler/dev.js +12 -0
- package/esm/bundler/index.js +15 -0
- package/esm/bundler/prod.js +14 -0
- package/esm/bundler/state.js +10 -0
- package/esm/bundler/utils.js +247 -0
- package/esm/config/config.default.js +13 -0
- package/esm/index.js +16 -0
- package/esm/packages/common/LRUCache.js +2 -0
- package/esm/packages/common/array/index.js +27 -0
- package/esm/packages/common/cache/LRUCache.js +39 -0
- package/esm/packages/common/cache/index.js +2 -0
- package/esm/packages/common/guards/index.js +8 -0
- package/esm/packages/common/http/index.js +256 -0
- package/esm/packages/common/i18n/default.js +88 -0
- package/esm/packages/common/i18n/en-US.js +88 -0
- package/esm/packages/common/i18n/index.js +91 -0
- package/esm/packages/common/i18n/locales.js +9 -0
- package/esm/packages/common/i18n/types.js +0 -0
- package/esm/packages/common/index.js +14 -0
- package/esm/packages/common/log/index.js +93 -0
- package/esm/packages/common/number/index.js +10 -0
- package/esm/packages/common/object/filterEmpty.js +23 -0
- package/esm/packages/common/object/filtereEmpty.js +2 -0
- package/esm/packages/common/object/index.js +17 -0
- package/esm/packages/common/string/index.js +4 -0
- package/esm/packages/common/types/index.js +0 -0
- package/esm/packages/core/env.js +24 -0
- package/esm/packages/core/index.js +54 -0
- package/esm/packages/core/loader/config.js +28 -0
- package/esm/packages/core/loader/controller.js +13 -0
- package/esm/packages/core/loader/extend.js +28 -0
- package/esm/packages/core/loader/middleware.js +16 -0
- package/esm/packages/core/loader/model.js +68 -0
- package/esm/packages/core/loader/router-schema.js +19 -0
- package/esm/packages/core/loader/router.js +39 -0
- package/esm/packages/core/loader/service.js +13 -0
- package/esm/packages/core/paths.js +9 -0
- package/esm/packages/core/types.js +0 -0
- package/esm/packages/utils/getAllFilesInFolder.js +9 -0
- package/esm/packages/utils/getAllFnReturnValue.js +0 -0
- package/esm/packages/utils/index.js +5 -0
- package/esm/packages/utils/loadFile.js +34 -0
- package/esm/packages/utils/path.js +16 -0
- package/esm/packages/utils/runFileFn.js +45 -0
- 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/bundler/defaultAlias.js +4 -0
- package/fe/bundler/defaultRouteGuard.js +4 -0
- package/fe/frontend/apps/dash/Dashboard.d.ts +5 -0
- package/fe/frontend/apps/dash/Dashboard.js +185 -0
- package/fe/frontend/apps/dash/dash.entry.d.ts +1 -0
- package/fe/frontend/apps/dash/dash.entry.js +59 -0
- package/fe/frontend/apps/dash/types.d.ts +27 -0
- package/fe/frontend/apps/dash/types.js +0 -0
- package/fe/frontend/apps/ui-components/index.d.ts +2 -0
- package/fe/frontend/apps/ui-components/index.js +8 -0
- package/fe/frontend/apps/ui-components/ui-components.entry.d.ts +1 -0
- package/fe/frontend/apps/ui-components/ui-components.entry.js +8 -0
- package/fe/frontend/extended/SchemaForm/data.d.ts +9 -0
- package/fe/frontend/extended/SchemaForm/data.js +8 -0
- package/fe/frontend/src/api/baseInfo.d.ts +30 -0
- package/fe/frontend/src/api/baseInfo.js +14 -0
- package/fe/frontend/src/common/CRUD/CRUD.d.ts +2 -0
- package/fe/frontend/src/common/CRUD/CRUD.js +2 -0
- package/fe/frontend/src/common/CRUD/index.d.ts +1 -0
- package/fe/frontend/src/common/CRUD/index.js +2 -0
- package/fe/frontend/src/common/auth/index.d.ts +11 -0
- package/fe/frontend/src/common/auth/index.js +27 -0
- package/fe/frontend/src/common/fetchErrorShow.d.ts +2 -0
- package/fe/frontend/src/common/fetchErrorShow.js +11 -0
- package/fe/frontend/src/common/generateMenuData.d.ts +3 -0
- package/fe/frontend/src/common/generateMenuData.js +16 -0
- package/fe/frontend/src/common/importComponent.d.ts +4 -0
- package/fe/frontend/src/common/importComponent.js +23 -0
- package/fe/frontend/src/common/language.d.ts +2 -0
- package/fe/frontend/src/common/language.js +12 -0
- package/fe/frontend/src/common/logFn/index.d.ts +4 -0
- package/fe/frontend/src/common/logFn/index.js +14 -0
- package/fe/frontend/src/common/menu.d.ts +21 -0
- package/fe/frontend/src/common/menu.js +97 -0
- package/fe/frontend/src/common/request.d.ts +33 -0
- package/fe/frontend/src/common/request.js +183 -0
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.d.ts +7 -0
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.js +36 -0
- package/fe/frontend/src/components/AsyncSelect/index.d.ts +3 -0
- package/fe/frontend/src/components/AsyncSelect/index.js +5 -0
- package/fe/frontend/src/components/BasePage/HeaderView.d.ts +9 -0
- package/fe/frontend/src/components/BasePage/HeaderView.js +55 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.d.ts +13 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +44 -0
- package/fe/frontend/src/components/LanguageSwitch/index.d.ts +3 -0
- package/fe/frontend/src/components/LanguageSwitch/index.js +5 -0
- package/fe/frontend/src/components/Router/index.d.ts +8 -0
- package/fe/frontend/src/components/Router/index.js +21 -0
- package/fe/frontend/src/components/Router/type.d.ts +1 -0
- package/fe/frontend/src/components/Router/type.js +0 -0
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.d.ts +14 -0
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.js +83 -0
- package/fe/frontend/src/components/ThemeSwitch/index.d.ts +3 -0
- package/fe/frontend/src/components/ThemeSwitch/index.js +5 -0
- package/fe/frontend/src/components/index.d.ts +10 -0
- package/fe/frontend/src/components/index.js +7 -0
- package/fe/frontend/src/defaultPages/Iframe/index.d.ts +2 -0
- package/fe/frontend/src/defaultPages/Iframe/index.js +15 -0
- package/fe/frontend/src/defaultPages/NotFoundPage/index.d.ts +2 -0
- package/fe/frontend/src/defaultPages/NotFoundPage/index.js +28 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.d.ts +6 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +102 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.d.ts +12 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +119 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.d.ts +28 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.js +10 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.js +9 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +62 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.d.ts +10 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +202 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.d.ts +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.js +9 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.js +4 -0
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.d.ts +9 -0
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.js +17 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.css +87 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.js +90 -0
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.d.ts +41 -0
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.js +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.js +6 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.js +66 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +122 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +9 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +55 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +21 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +21 -0
- package/fe/frontend/src/defaultPages/SlotPage/index.d.ts +2 -0
- package/fe/frontend/src/defaultPages/SlotPage/index.js +22 -0
- package/fe/frontend/src/exportStore.d.ts +4 -0
- package/fe/frontend/src/exportStore.js +5 -0
- package/fe/frontend/src/hooks/useCurrentMenuData.d.ts +10 -0
- package/fe/frontend/src/hooks/useCurrentMenuData.js +30 -0
- package/fe/frontend/src/hooks/useRouterParams.d.ts +4 -0
- package/fe/frontend/src/hooks/useRouterParams.js +16 -0
- package/fe/frontend/src/index.d.ts +13 -0
- package/fe/frontend/src/index.js +20 -0
- package/fe/frontend/src/language/en-US.d.ts +88 -0
- package/fe/frontend/src/language/en-US.js +89 -0
- package/fe/frontend/src/language/index.d.ts +72 -0
- package/fe/frontend/src/language/index.js +79 -0
- package/fe/frontend/src/language/zh-CN.d.ts +88 -0
- package/fe/frontend/src/language/zh-CN.js +89 -0
- package/fe/frontend/src/main.css +96 -0
- package/fe/frontend/src/main.d.ts +20 -0
- package/fe/frontend/src/main.js +77 -0
- package/fe/frontend/src/stores/apiFreezer.d.ts +26 -0
- package/fe/frontend/src/stores/apiFreezer.js +53 -0
- package/fe/frontend/src/stores/mode.d.ts +15 -0
- package/fe/frontend/src/stores/mode.js +36 -0
- package/fe/frontend/src/stores/schemaEventBus.d.ts +22 -0
- package/fe/frontend/src/stores/schemaEventBus.js +53 -0
- package/fe/frontend/src/stores/schemaStore.d.ts +32 -0
- package/fe/frontend/src/stores/schemaStore.js +28 -0
- package/fe/frontend/src/typing/scalability.d.ts +15 -0
- package/fe/frontend/src/typing/scalability.js +0 -0
- package/fe/frontend/src/typing/window.d.ts +8 -0
- package/fe/frontend/src/typing/window.js +0 -0
- package/fe/model/types/data/button.d.ts +22 -0
- package/fe/model/types/data/component.d.ts +30 -0
- package/fe/model/types/data/fetchInfo.d.ts +7 -0
- package/fe/model/types/data/schema.d.ts +46 -0
- package/fe/model/types/data/search.d.ts +6 -0
- package/fe/model/types/index.d.ts +2 -0
- package/fe/model/types/menuType.d.ts +43 -0
- package/fe/model/types/model.d.ts +26 -0
- package/fe/packages/common/LRUCache.d.ts +1 -0
- package/fe/packages/common/array/index.d.ts +6 -0
- package/fe/packages/common/cache/LRUCache.d.ts +12 -0
- package/fe/packages/common/cache/LRUCache.js +43 -0
- package/fe/packages/common/cache/index.d.ts +1 -0
- package/fe/packages/common/guards/index.d.ts +8 -0
- package/fe/packages/common/guards/index.js +8 -0
- package/fe/packages/common/http/index.d.ts +89 -0
- package/fe/packages/common/http/index.js +300 -0
- package/fe/packages/common/i18n/default.d.ts +86 -0
- package/fe/packages/common/i18n/default.js +93 -0
- package/fe/packages/common/i18n/en-US.d.ts +86 -0
- package/fe/packages/common/i18n/en-US.js +93 -0
- package/fe/packages/common/i18n/index.d.ts +18 -0
- package/fe/packages/common/i18n/index.js +162 -0
- package/fe/packages/common/i18n/locales.d.ts +7 -0
- package/fe/packages/common/i18n/locales.js +11 -0
- package/fe/packages/common/i18n/types.d.ts +46 -0
- package/fe/packages/common/index.d.ts +10 -0
- package/fe/packages/common/log/index.d.ts +32 -0
- package/fe/packages/common/number/index.d.ts +2 -0
- package/fe/packages/common/object/filterEmpty.d.ts +2 -0
- package/fe/packages/common/object/filterEmpty.js +28 -0
- package/fe/packages/common/object/filtereEmpty.d.ts +1 -0
- package/fe/packages/common/object/index.d.ts +4 -0
- package/fe/packages/common/string/index.d.ts +3 -0
- package/fe/packages/common/types/index.d.ts +3 -0
- package/fe/packages/react/hooks/useBreadcrumb.d.ts +9 -0
- 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/react/hooks/useInit.d.ts +2 -0
- 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/react/hooks/usePagination.d.ts +15 -0
- package/fe/packages/react/hooks/usePagination.js +30 -0
- package/fe/packages/react/hooks/useRefState.d.ts +17 -0
- package/fe/packages/react/hooks/useRefState.js +35 -0
- package/fe/packages/react/hooks/useWatch.d.ts +14 -0
- 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/react/ui/assets/table/no-result.svg +5 -0
- package/fe/packages/react/ui/components/Button/Button.d.ts +24 -0
- package/fe/packages/react/ui/components/Button/Button.js +88 -0
- package/fe/packages/react/ui/components/Button/SubmitButton.d.ts +8 -0
- 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/react/ui/components/Card/Card.d.ts +10 -0
- 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/react/ui/components/Checkbox/Checkbox.d.ts +16 -0
- 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/react/ui/components/ConfirmDialog/ConfirmDialog.d.ts +11 -0
- 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/react/ui/components/DataTable/ActionBtn.d.ts +7 -0
- package/fe/packages/react/ui/components/DataTable/ActionBtn.js +116 -0
- package/fe/packages/react/ui/components/DataTable/index.d.ts +32 -0
- package/fe/packages/react/ui/components/DataTable/index.js +235 -0
- package/fe/packages/react/ui/components/Date/Calendar.d.ts +21 -0
- package/fe/packages/react/ui/components/Date/Calendar.js +351 -0
- package/fe/packages/react/ui/components/Date/Date.d.ts +26 -0
- package/fe/packages/react/ui/components/Date/Date.js +210 -0
- package/fe/packages/react/ui/components/Date/DateTestPage.d.ts +1 -0
- 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/react/ui/components/Date/TimePicker.d.ts +6 -0
- package/fe/packages/react/ui/components/Date/TimePicker.js +136 -0
- package/fe/packages/react/ui/components/Date/data.d.ts +5 -0
- package/fe/packages/react/ui/components/Date/data.js +7 -0
- package/fe/packages/react/ui/components/Date/dateLocaleStore.d.ts +9 -0
- 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/react/ui/components/Date/locales.d.ts +23 -0
- package/fe/packages/react/ui/components/Date/locales.js +25 -0
- package/fe/packages/react/ui/components/Drawer/Drawer.d.ts +22 -0
- 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/react/ui/components/Dropdown/Dropdown.d.ts +24 -0
- 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/react/ui/components/Form/Form.d.ts +11 -0
- package/fe/packages/react/ui/components/Form/Form.js +15 -0
- package/fe/packages/react/ui/components/Form/FormItem.d.ts +19 -0
- package/fe/packages/react/ui/components/Form/FormItem.js +60 -0
- package/fe/packages/react/ui/components/Form/SchemaForm/data.d.ts +39 -0
- 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/react/ui/components/Form/SchemaForm/index.d.ts +59 -0
- 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/react/ui/components/ImagePreview/ImagePreview.d.ts +7 -0
- package/fe/packages/react/ui/components/ImagePreview/ImagePreview.js +307 -0
- package/fe/packages/react/ui/components/ImagePreview/PreviewImage.d.ts +7 -0
- 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/react/ui/components/Input/Input.d.ts +22 -0
- 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/react/ui/components/InputNumber/InputNumber.d.ts +25 -0
- 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/react/ui/components/InputNumber/inputNumberUtils.d.ts +29 -0
- 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/react/ui/components/Label/Label.d.ts +21 -0
- 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/react/ui/components/Layout/Layout.d.ts +10 -0
- 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/react/ui/components/Loading/Loading.d.ts +13 -0
- 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/react/ui/components/Menu/Menu.d.ts +17 -0
- package/fe/packages/react/ui/components/Menu/Menu.js +147 -0
- package/fe/packages/react/ui/components/Menu/MenuContext.d.ts +38 -0
- package/fe/packages/react/ui/components/Menu/MenuContext.js +88 -0
- package/fe/packages/react/ui/components/Menu/MenuItem.d.ts +2 -0
- 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/react/ui/components/Menu/menuTypes.d.ts +57 -0
- package/fe/packages/react/ui/components/Menu/menuTypes.js +0 -0
- package/fe/packages/react/ui/components/Menu/utils.d.ts +1 -0
- package/fe/packages/react/ui/components/Menu/utils.js +8 -0
- package/fe/packages/react/ui/components/Message/Message.d.ts +12 -0
- package/fe/packages/react/ui/components/Message/Message.js +76 -0
- package/fe/packages/react/ui/components/Message/MessageManager.d.ts +36 -0
- package/fe/packages/react/ui/components/Message/MessageManager.js +104 -0
- package/fe/packages/react/ui/components/Message/data.d.ts +1 -0
- 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/react/ui/components/Modal/Modal.d.ts +20 -0
- package/fe/packages/react/ui/components/Modal/Modal.js +59 -0
- package/fe/packages/react/ui/components/Modal/ModalManager.d.ts +46 -0
- 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/react/ui/components/Notification/Notification.d.ts +13 -0
- 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/react/ui/components/Overlay/Overlay.d.ts +19 -0
- 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/react/ui/components/Pagination/Pagination.d.ts +10 -0
- 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/react/ui/components/Popup/Popup.d.ts +25 -0
- 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/react/ui/components/Radio/Radio.d.ts +8 -0
- package/fe/packages/react/ui/components/Radio/Radio.js +36 -0
- package/fe/packages/react/ui/components/Radio/RadioGroup.d.ts +18 -0
- 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/react/ui/components/Search/Search.d.ts +13 -0
- 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/react/ui/components/Select/Select.d.ts +21 -0
- 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/react/ui/components/Switch/Switch.d.ts +10 -0
- 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/react/ui/components/TableSearch/lang.d.ts +14 -0
- package/fe/packages/react/ui/components/TableSearch/lang.js +14 -0
- package/fe/packages/react/ui/components/TableSearch/tableSearchLocaleStore.d.ts +8 -0
- package/fe/packages/react/ui/components/TableSearch/tableSearchLocaleStore.js +10 -0
- package/fe/packages/react/ui/components/Tabs/Tabs.d.ts +15 -0
- 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/react/ui/components/Textarea/Textarea.d.ts +20 -0
- 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/react/ui/components/Tooltip/Tooltip.d.ts +8 -0
- 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/react/ui/components/TreeSelect/TreeSelect.d.ts +18 -0
- 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/react/ui/components/Upload/ImageUpload.d.ts +8 -0
- 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/react/ui/components/breadcrumb/breadcrumb.d.ts +34 -0
- 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/react/ui/components/hooks/useDropdownPositioning.d.ts +42 -0
- package/fe/packages/react/ui/components/hooks/useDropdownPositioning.js +121 -0
- package/fe/packages/react/ui/components/hooks/useInputController.d.ts +20 -0
- 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/react/ui/components/table/table.d.ts +29 -0
- package/fe/packages/react/ui/components/table/table.js +166 -0
- package/fe/packages/react/ui/components/testPage/MenuTestPage.d.ts +1 -0
- package/fe/packages/react/ui/components/testPage/MenuTestPage.js +397 -0
- package/fe/packages/react/ui/components/testPage/index.d.ts +2 -0
- 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.css +299 -0
- package/fe/packages/react/ui/index.d.ts +4 -0
- package/fe/packages/react/ui/index.js +58 -0
- package/fe/packages/react/ui/lib/createStoreHook.d.ts +8 -0
- 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/react/ui/stores/breadcrumb.d.ts +14 -0
- 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/react/ui/types/index.d.ts +1 -0
- package/fe/packages/react/ui/types/index.js +0 -0
- package/fe/typings/type.d.ts +4 -0
- 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/model/index.d.ts +1 -0
- package/model/model/test.d.ts +1 -0
- package/model/model/types/data/button.d.ts +22 -0
- package/model/model/types/data/component.d.ts +30 -0
- package/model/model/types/data/fetchInfo.d.ts +7 -0
- package/model/model/types/data/schema.d.ts +46 -0
- package/model/model/types/data/search.d.ts +6 -0
- package/model/model/types/index.d.ts +2 -0
- package/model/model/types/menuType.d.ts +43 -0
- package/model/model/types/model.d.ts +26 -0
- package/model/packages/common/array/index.d.ts +6 -0
- package/model/packages/common/cache/LRUCache.d.ts +12 -0
- package/model/packages/common/cache/index.d.ts +1 -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/index.d.ts +10 -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 +82 -24
- package/types/app/controller/base.d.ts +12 -0
- package/types/app/controller/project.d.ts +22 -0
- package/types/app/controller/view.d.ts +8 -0
- package/types/app/extend/$fetch.d.ts +8 -0
- package/types/app/extend/crypto.d.ts +64 -0
- package/types/app/extend/db.d.ts +55 -0
- package/types/app/extend/generateErrorMessage.d.ts +7 -0
- package/types/app/extend/logger.d.ts +11 -0
- package/types/app/extend/parsingParamsOnUrl.d.ts +2 -0
- package/types/app/extend/render-view.d.ts +7 -0
- package/types/app/middleware.d.ts +3 -0
- package/types/app/middlewares/api-params-verify.d.ts +4 -0
- package/types/app/middlewares/api-sign-verify.d.ts +4 -0
- package/types/app/middlewares/error-handle.d.ts +4 -0
- 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 +4 -0
- package/types/app/router/view.d.ts +3 -0
- package/types/app/router-schema/project.d.ts +3 -0
- package/types/app/service/base.d.ts +9 -0
- package/types/app/service/project.d.ts +57 -0
- package/types/app/type.d.ts +34 -0
- package/types/app/typings.d.ts +46 -0
- package/types/bundler/buildBE.d.ts +13 -0
- package/types/bundler/defaultAlias.d.ts +3 -0
- package/types/bundler/defaultRouteGuard.d.ts +2 -0
- package/types/bundler/dev.d.ts +1 -0
- package/types/bundler/index.d.ts +4 -0
- package/types/bundler/prod.d.ts +1 -0
- package/types/bundler/state.d.ts +18 -0
- package/types/bundler/utils.d.ts +9 -0
- package/types/config/config.default.d.ts +71 -0
- package/types/index.d.ts +30 -0
- package/types/packages/common/LRUCache.d.ts +1 -0
- package/types/packages/common/array/index.d.ts +6 -0
- package/types/packages/common/cache/LRUCache.d.ts +12 -0
- package/types/packages/common/cache/index.d.ts +1 -0
- package/types/packages/common/guards/index.d.ts +8 -0
- package/types/packages/common/http/index.d.ts +89 -0
- package/types/packages/common/i18n/default.d.ts +91 -0
- package/types/packages/common/i18n/en-US.d.ts +91 -0
- package/types/packages/common/i18n/index.d.ts +42 -0
- package/types/packages/common/i18n/locales.d.ts +7 -0
- package/types/packages/common/i18n/types.d.ts +70 -0
- package/types/packages/common/index.d.ts +10 -0
- package/types/packages/common/log/index.d.ts +32 -0
- package/types/packages/common/number/index.d.ts +2 -0
- package/types/packages/common/object/filterEmpty.d.ts +2 -0
- package/types/packages/common/object/filtereEmpty.d.ts +1 -0
- package/types/packages/common/object/index.d.ts +4 -0
- package/types/packages/common/string/index.d.ts +3 -0
- package/types/packages/common/types/index.d.ts +3 -0
- package/types/packages/core/env.d.ts +15 -0
- package/types/packages/core/index.d.ts +6 -0
- package/types/packages/core/loader/config.d.ts +9 -0
- package/types/packages/core/loader/controller.d.ts +17 -0
- package/types/packages/core/loader/extend.d.ts +8 -0
- package/types/packages/core/loader/middleware.d.ts +11 -0
- package/types/packages/core/loader/model.d.ts +36 -0
- package/types/packages/core/loader/router-schema.d.ts +18 -0
- package/types/packages/core/loader/router.d.ts +8 -0
- package/types/packages/core/loader/service.d.ts +17 -0
- package/types/packages/core/paths.d.ts +14 -0
- package/types/packages/core/types.d.ts +145 -0
- package/types/packages/utils/getAllFilesInFolder.d.ts +9 -0
- package/types/packages/utils/getAllFnReturnValue.d.ts +0 -0
- package/types/packages/utils/index.d.ts +4 -0
- package/types/packages/utils/loadFile.d.ts +20 -0
- package/types/packages/utils/path.d.ts +24 -0
- package/types/packages/utils/runFileFn.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/types/typings/type.d.ts +4 -0
- package/app/controller/base.d.ts +0 -14
- package/app/controller/base.d.ts.map +0 -1
- package/app/controller/base.js +0 -24
- package/app/controller/base.js.map +0 -1
- package/app/controller/project.d.ts +0 -12
- package/app/controller/project.d.ts.map +0 -1
- package/app/controller/project.js +0 -48
- package/app/controller/project.js.map +0 -1
- package/app/controller/view.d.ts +0 -9
- package/app/controller/view.d.ts.map +0 -1
- package/app/controller/view.js +0 -15
- package/app/controller/view.js.map +0 -1
- package/app/data/signKey.d.ts +0 -2
- package/app/data/signKey.d.ts.map +0 -1
- package/app/data/signKey.js +0 -5
- package/app/data/signKey.js.map +0 -1
- package/app/extend/db.d.ts +0 -3
- package/app/extend/db.d.ts.map +0 -1
- package/app/extend/db.js +0 -8
- package/app/extend/db.js.map +0 -1
- package/app/extend/generateErrorMessage.d.ts +0 -8
- package/app/extend/generateErrorMessage.d.ts.map +0 -1
- package/app/extend/generateErrorMessage.js +0 -12
- package/app/extend/generateErrorMessage.js.map +0 -1
- package/app/extend/logger.d.ts +0 -12
- package/app/extend/logger.d.ts.map +0 -1
- package/app/extend/logger.js +0 -73
- package/app/extend/logger.js.map +0 -1
- package/app/extend/parsingParamsOnUrl.d.ts +0 -3
- package/app/extend/parsingParamsOnUrl.d.ts.map +0 -1
- package/app/extend/parsingParamsOnUrl.js +0 -23
- package/app/extend/parsingParamsOnUrl.js.map +0 -1
- package/app/extend/render-view.d.ts +0 -5
- package/app/extend/render-view.d.ts.map +0 -1
- package/app/extend/render-view.js +0 -22
- package/app/extend/render-view.js.map +0 -1
- package/app/middleware/api-params-verify.d.ts +0 -6
- package/app/middleware/api-params-verify.d.ts.map +0 -1
- package/app/middleware/api-params-verify.js +0 -64
- package/app/middleware/api-params-verify.js.map +0 -1
- package/app/middleware/api-sign-verify.d.ts +0 -6
- package/app/middleware/api-sign-verify.d.ts.map +0 -1
- package/app/middleware/api-sign-verify.js +0 -29
- package/app/middleware/api-sign-verify.js.map +0 -1
- package/app/middleware/error-handle.d.ts +0 -6
- package/app/middleware/error-handle.d.ts.map +0 -1
- package/app/middleware/error-handle.js +0 -34
- package/app/middleware/error-handle.js.map +0 -1
- package/app/middleware/project-handler.d.ts +0 -5
- package/app/middleware/project-handler.d.ts.map +0 -1
- package/app/middleware/project-handler.js +0 -22
- package/app/middleware/project-handler.js.map +0 -1
- package/app/middleware.d.ts +0 -6
- package/app/middleware.d.ts.map +0 -1
- package/app/middleware.js +0 -39
- package/app/middleware.js.map +0 -1
- package/app/pages/main.d.ts +0 -3
- package/app/pages/main.d.ts.map +0 -1
- package/app/pages/main.js +0 -10
- package/app/pages/main.js.map +0 -1
- package/app/router/project.d.ts +0 -5
- package/app/router/project.d.ts.map +0 -1
- package/app/router/project.js +0 -9
- package/app/router/project.js.map +0 -1
- package/app/router/view.d.ts +0 -5
- package/app/router/view.d.ts.map +0 -1
- package/app/router/view.js +0 -6
- package/app/router/view.js.map +0 -1
- package/app/router-schema/project.d.ts +0 -4
- package/app/router-schema/project.d.ts.map +0 -1
- package/app/router-schema/project.js +0 -34
- package/app/router-schema/project.js.map +0 -1
- package/app/service/bese.d.ts +0 -11
- package/app/service/bese.d.ts.map +0 -1
- package/app/service/bese.js +0 -18
- package/app/service/bese.js.map +0 -1
- package/app/service/project.d.ts +0 -28
- package/app/service/project.d.ts.map +0 -1
- package/app/service/project.js +0 -39
- package/app/service/project.js.map +0 -1
- package/app/type.d.ts +0 -3
- package/app/type.d.ts.map +0 -1
- package/app/type.js +0 -3
- package/app/type.js.map +0 -1
- package/app/typings.d.ts +0 -50
- package/app/typings.d.ts.map +0 -1
- package/app/typings.js +0 -3
- package/app/typings.js.map +0 -1
- package/app/vite/config/base.d.ts +0 -6
- package/app/vite/config/base.js +0 -96
- package/app/vite/config/data.d.ts +0 -3
- package/app/vite/config/data.js +0 -11
- package/app/vite/config/dev.d.ts +0 -11
- package/app/vite/config/dev.js +0 -15
- package/app/vite/config/prod.d.ts +0 -17
- package/app/vite/config/prod.js +0 -34
- package/app/vite/dev.d.ts +0 -2
- package/app/vite/dev.js +0 -29
- package/app/vite/index.d.ts +0 -1
- package/app/vite/index.js +0 -13
- package/app/vite/package.json +0 -11
- package/app/vite/prod.d.ts +0 -1
- package/app/vite/prod.js +0 -82
- package/index.d.ts +0 -29
- package/index.d.ts.map +0 -1
- package/index.js +0 -22
- package/index.js.map +0 -1
- package/model/index.d.ts +0 -2
- package/model/index.d.ts.map +0 -1
- package/model/index.js +0 -7
- package/model/index.js.map +0 -1
- package/model/test.d.ts +0 -6
- package/model/test.d.ts.map +0 -1
- package/model/test.js +0 -6
- package/model/test.js.map +0 -1
- package/model/test2.d.ts +0 -6
- package/model/test2.d.ts.map +0 -1
- package/model/test2.js +0 -6
- package/model/test2.js.map +0 -1
- package/packages/core/env.d.ts +0 -16
- package/packages/core/env.d.ts.map +0 -1
- package/packages/core/env.js +0 -26
- package/packages/core/env.js.map +0 -1
- package/packages/core/index.d.ts +0 -7
- package/packages/core/index.d.ts.map +0 -1
- package/packages/core/index.js +0 -93
- package/packages/core/index.js.map +0 -1
- package/packages/core/loader/config.d.ts +0 -4
- package/packages/core/loader/config.d.ts.map +0 -1
- package/packages/core/loader/config.js +0 -32
- package/packages/core/loader/config.js.map +0 -1
- package/packages/core/loader/controller.d.ts +0 -4
- package/packages/core/loader/controller.d.ts.map +0 -1
- package/packages/core/loader/controller.js +0 -18
- package/packages/core/loader/controller.js.map +0 -1
- package/packages/core/loader/extend.d.ts +0 -4
- package/packages/core/loader/extend.d.ts.map +0 -1
- package/packages/core/loader/extend.js +0 -34
- package/packages/core/loader/extend.js.map +0 -1
- package/packages/core/loader/middleware.d.ts +0 -4
- package/packages/core/loader/middleware.d.ts.map +0 -1
- package/packages/core/loader/middleware.js +0 -16
- package/packages/core/loader/middleware.js.map +0 -1
- package/packages/core/loader/model.d.ts +0 -15
- package/packages/core/loader/model.d.ts.map +0 -1
- package/packages/core/loader/model.js +0 -90
- package/packages/core/loader/model.js.map +0 -1
- package/packages/core/loader/router-schema.d.ts +0 -4
- package/packages/core/loader/router-schema.d.ts.map +0 -1
- package/packages/core/loader/router-schema.js +0 -20
- package/packages/core/loader/router-schema.js.map +0 -1
- package/packages/core/loader/router.d.ts +0 -4
- package/packages/core/loader/router.d.ts.map +0 -1
- package/packages/core/loader/router.js +0 -46
- package/packages/core/loader/router.js.map +0 -1
- package/packages/core/loader/service.d.ts +0 -4
- package/packages/core/loader/service.d.ts.map +0 -1
- package/packages/core/loader/service.js +0 -17
- package/packages/core/loader/service.js.map +0 -1
- package/packages/core/paths.d.ts +0 -12
- package/packages/core/paths.d.ts.map +0 -1
- package/packages/core/paths.js +0 -11
- package/packages/core/paths.js.map +0 -1
- package/packages/core/types.d.ts +0 -74
- package/packages/core/types.d.ts.map +0 -1
- package/packages/core/types.js +0 -3
- package/packages/core/types.js.map +0 -1
- package/packages/ui/react/components/Button/Button.d.ts +0 -15
- package/packages/ui/react/components/Button/Button.d.ts.map +0 -1
- package/packages/ui/react/components/Button/Button.js +0 -36
- package/packages/ui/react/components/Button/Button.js.map +0 -1
- package/packages/ui/react/components/Button/SumbitButton.d.ts +0 -9
- package/packages/ui/react/components/Button/SumbitButton.d.ts.map +0 -1
- package/packages/ui/react/components/Button/SumbitButton.js +0 -32
- package/packages/ui/react/components/Button/SumbitButton.js.map +0 -1
- package/packages/ui/react/components/Button/index.d.ts +0 -4
- package/packages/ui/react/components/Button/index.d.ts.map +0 -1
- package/packages/ui/react/components/Button/index.js +0 -21
- package/packages/ui/react/components/Button/index.js.map +0 -1
- package/packages/ui/react/components/Checkbox/Checkbox.d.ts +0 -17
- package/packages/ui/react/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/packages/ui/react/components/Checkbox/Checkbox.js +0 -41
- package/packages/ui/react/components/Checkbox/Checkbox.js.map +0 -1
- package/packages/ui/react/components/Checkbox/index.d.ts +0 -2
- package/packages/ui/react/components/Checkbox/index.d.ts.map +0 -1
- package/packages/ui/react/components/Checkbox/index.js +0 -18
- package/packages/ui/react/components/Checkbox/index.js.map +0 -1
- package/packages/ui/react/components/ConfirmDialog.d.ts +0 -12
- package/packages/ui/react/components/ConfirmDialog.d.ts.map +0 -1
- package/packages/ui/react/components/ConfirmDialog.js +0 -13
- package/packages/ui/react/components/ConfirmDialog.js.map +0 -1
- package/packages/ui/react/components/DataTable/ActionBtn.d.ts +0 -6
- package/packages/ui/react/components/DataTable/ActionBtn.d.ts.map +0 -1
- package/packages/ui/react/components/DataTable/ActionBtn.js +0 -18
- package/packages/ui/react/components/DataTable/ActionBtn.js.map +0 -1
- package/packages/ui/react/components/DataTable/data-table.d.ts +0 -25
- package/packages/ui/react/components/DataTable/data-table.d.ts.map +0 -1
- package/packages/ui/react/components/DataTable/data-table.js +0 -145
- package/packages/ui/react/components/DataTable/data-table.js.map +0 -1
- package/packages/ui/react/components/Date/Calendar.d.ts +0 -22
- package/packages/ui/react/components/Date/Calendar.d.ts.map +0 -1
- package/packages/ui/react/components/Date/Calendar.js +0 -210
- package/packages/ui/react/components/Date/Calendar.js.map +0 -1
- package/packages/ui/react/components/Date/Date.d.ts +0 -26
- package/packages/ui/react/components/Date/Date.d.ts.map +0 -1
- package/packages/ui/react/components/Date/Date.js +0 -161
- package/packages/ui/react/components/Date/Date.js.map +0 -1
- package/packages/ui/react/components/Date/DateTestPage.d.ts +0 -2
- package/packages/ui/react/components/Date/DateTestPage.d.ts.map +0 -1
- package/packages/ui/react/components/Date/DateTestPage.js +0 -33
- package/packages/ui/react/components/Date/DateTestPage.js.map +0 -1
- package/packages/ui/react/components/Date/LocaleContext.d.ts +0 -2
- package/packages/ui/react/components/Date/LocaleContext.d.ts.map +0 -1
- package/packages/ui/react/components/Date/LocaleContext.js +0 -9
- package/packages/ui/react/components/Date/LocaleContext.js.map +0 -1
- package/packages/ui/react/components/Date/LocaleProvider.d.ts +0 -8
- package/packages/ui/react/components/Date/LocaleProvider.d.ts.map +0 -1
- package/packages/ui/react/components/Date/LocaleProvider.js +0 -17
- package/packages/ui/react/components/Date/LocaleProvider.js.map +0 -1
- package/packages/ui/react/components/Date/TimePicker.d.ts +0 -7
- package/packages/ui/react/components/Date/TimePicker.d.ts.map +0 -1
- package/packages/ui/react/components/Date/TimePicker.js +0 -79
- package/packages/ui/react/components/Date/TimePicker.js.map +0 -1
- package/packages/ui/react/components/Date/data.d.ts +0 -6
- package/packages/ui/react/components/Date/data.d.ts.map +0 -1
- package/packages/ui/react/components/Date/data.js +0 -8
- package/packages/ui/react/components/Date/data.js.map +0 -1
- package/packages/ui/react/components/Date/dateLocaleStore.d.ts +0 -10
- package/packages/ui/react/components/Date/dateLocaleStore.d.ts.map +0 -1
- package/packages/ui/react/components/Date/dateLocaleStore.js +0 -18
- package/packages/ui/react/components/Date/dateLocaleStore.js.map +0 -1
- package/packages/ui/react/components/Date/index.d.ts +0 -6
- package/packages/ui/react/components/Date/index.d.ts.map +0 -1
- package/packages/ui/react/components/Date/index.js +0 -24
- package/packages/ui/react/components/Date/index.js.map +0 -1
- package/packages/ui/react/components/Date/locales.d.ts +0 -23
- package/packages/ui/react/components/Date/locales.d.ts.map +0 -1
- package/packages/ui/react/components/Date/locales.js +0 -43
- package/packages/ui/react/components/Date/locales.js.map +0 -1
- package/packages/ui/react/components/Dropdown.d.ts +0 -16
- package/packages/ui/react/components/Dropdown.d.ts.map +0 -1
- package/packages/ui/react/components/Dropdown.js +0 -56
- package/packages/ui/react/components/Dropdown.js.map +0 -1
- package/packages/ui/react/components/Form/Form.d.ts +0 -12
- package/packages/ui/react/components/Form/Form.d.ts.map +0 -1
- package/packages/ui/react/components/Form/Form.js +0 -15
- package/packages/ui/react/components/Form/Form.js.map +0 -1
- package/packages/ui/react/components/Form/FormItem.d.ts +0 -20
- package/packages/ui/react/components/Form/FormItem.d.ts.map +0 -1
- package/packages/ui/react/components/Form/FormItem.js +0 -76
- package/packages/ui/react/components/Form/FormItem.js.map +0 -1
- package/packages/ui/react/components/Form/SchemeForm/data.d.ts +0 -51
- package/packages/ui/react/components/Form/SchemeForm/data.d.ts.map +0 -1
- package/packages/ui/react/components/Form/SchemeForm/data.js +0 -48
- package/packages/ui/react/components/Form/SchemeForm/data.js.map +0 -1
- package/packages/ui/react/components/Form/SchemeForm/index.d.ts +0 -59
- package/packages/ui/react/components/Form/SchemeForm/index.d.ts.map +0 -1
- package/packages/ui/react/components/Form/SchemeForm/index.js +0 -70
- package/packages/ui/react/components/Form/SchemeForm/index.js.map +0 -1
- package/packages/ui/react/components/Form/index.d.ts +0 -5
- package/packages/ui/react/components/Form/index.d.ts.map +0 -1
- package/packages/ui/react/components/Form/index.js +0 -21
- package/packages/ui/react/components/Form/index.js.map +0 -1
- package/packages/ui/react/components/Form/useForm.d.ts +0 -3
- package/packages/ui/react/components/Form/useForm.d.ts.map +0 -1
- package/packages/ui/react/components/Form/useForm.js +0 -6
- package/packages/ui/react/components/Form/useForm.js.map +0 -1
- package/packages/ui/react/components/ImagePreview/ImagePreview.d.ts +0 -8
- package/packages/ui/react/components/ImagePreview/ImagePreview.d.ts.map +0 -1
- package/packages/ui/react/components/ImagePreview/ImagePreview.js +0 -162
- package/packages/ui/react/components/ImagePreview/ImagePreview.js.map +0 -1
- package/packages/ui/react/components/ImagePreview/PreviewImage.d.ts +0 -8
- package/packages/ui/react/components/ImagePreview/PreviewImage.d.ts.map +0 -1
- package/packages/ui/react/components/ImagePreview/PreviewImage.js +0 -29
- package/packages/ui/react/components/ImagePreview/PreviewImage.js.map +0 -1
- package/packages/ui/react/components/ImagePreview/index.d.ts +0 -3
- package/packages/ui/react/components/ImagePreview/index.d.ts.map +0 -1
- package/packages/ui/react/components/ImagePreview/index.js +0 -19
- package/packages/ui/react/components/ImagePreview/index.js.map +0 -1
- package/packages/ui/react/components/Input/Input.d.ts +0 -21
- package/packages/ui/react/components/Input/Input.d.ts.map +0 -1
- package/packages/ui/react/components/Input/Input.js +0 -61
- package/packages/ui/react/components/Input/Input.js.map +0 -1
- package/packages/ui/react/components/Input/index.d.ts +0 -2
- package/packages/ui/react/components/Input/index.d.ts.map +0 -1
- package/packages/ui/react/components/Input/index.js +0 -18
- package/packages/ui/react/components/Input/index.js.map +0 -1
- package/packages/ui/react/components/Label/Label.d.ts +0 -22
- package/packages/ui/react/components/Label/Label.d.ts.map +0 -1
- package/packages/ui/react/components/Label/Label.js +0 -37
- package/packages/ui/react/components/Label/Label.js.map +0 -1
- package/packages/ui/react/components/Label/index.d.ts +0 -3
- package/packages/ui/react/components/Label/index.d.ts.map +0 -1
- package/packages/ui/react/components/Label/index.js +0 -21
- package/packages/ui/react/components/Label/index.js.map +0 -1
- package/packages/ui/react/components/Message/Message.d.ts +0 -13
- package/packages/ui/react/components/Message/Message.d.ts.map +0 -1
- package/packages/ui/react/components/Message/Message.js +0 -56
- package/packages/ui/react/components/Message/Message.js.map +0 -1
- package/packages/ui/react/components/Message/MessageManager.d.ts +0 -37
- package/packages/ui/react/components/Message/MessageManager.d.ts.map +0 -1
- package/packages/ui/react/components/Message/MessageManager.js +0 -86
- package/packages/ui/react/components/Message/MessageManager.js.map +0 -1
- package/packages/ui/react/components/Message/data.d.ts +0 -2
- package/packages/ui/react/components/Message/data.d.ts.map +0 -1
- package/packages/ui/react/components/Message/data.js +0 -5
- package/packages/ui/react/components/Message/data.js.map +0 -1
- package/packages/ui/react/components/Message/index.d.ts +0 -3
- package/packages/ui/react/components/Message/index.d.ts.map +0 -1
- package/packages/ui/react/components/Message/index.js +0 -6
- package/packages/ui/react/components/Message/index.js.map +0 -1
- package/packages/ui/react/components/Modal/Modal.d.ts +0 -19
- package/packages/ui/react/components/Modal/Modal.d.ts.map +0 -1
- package/packages/ui/react/components/Modal/Modal.js +0 -51
- package/packages/ui/react/components/Modal/Modal.js.map +0 -1
- package/packages/ui/react/components/Modal/ModalManager.d.ts +0 -47
- package/packages/ui/react/components/Modal/ModalManager.d.ts.map +0 -1
- package/packages/ui/react/components/Modal/ModalManager.js +0 -91
- package/packages/ui/react/components/Modal/ModalManager.js.map +0 -1
- package/packages/ui/react/components/Modal/index.d.ts +0 -4
- package/packages/ui/react/components/Modal/index.d.ts.map +0 -1
- package/packages/ui/react/components/Modal/index.js +0 -8
- package/packages/ui/react/components/Modal/index.js.map +0 -1
- package/packages/ui/react/components/Pagination.d.ts +0 -11
- package/packages/ui/react/components/Pagination.d.ts.map +0 -1
- package/packages/ui/react/components/Pagination.js +0 -85
- package/packages/ui/react/components/Pagination.js.map +0 -1
- package/packages/ui/react/components/Search/Search.d.ts +0 -14
- package/packages/ui/react/components/Search/Search.d.ts.map +0 -1
- package/packages/ui/react/components/Search/Search.js +0 -15
- package/packages/ui/react/components/Search/Search.js.map +0 -1
- package/packages/ui/react/components/Search/index.d.ts +0 -2
- package/packages/ui/react/components/Search/index.d.ts.map +0 -1
- package/packages/ui/react/components/Search/index.js +0 -9
- package/packages/ui/react/components/Search/index.js.map +0 -1
- package/packages/ui/react/components/Select/Select.d.ts +0 -19
- package/packages/ui/react/components/Select/Select.d.ts.map +0 -1
- package/packages/ui/react/components/Select/Select.js +0 -167
- package/packages/ui/react/components/Select/Select.js.map +0 -1
- package/packages/ui/react/components/Select/index.d.ts +0 -2
- package/packages/ui/react/components/Select/index.d.ts.map +0 -1
- package/packages/ui/react/components/Select/index.js +0 -18
- package/packages/ui/react/components/Select/index.js.map +0 -1
- package/packages/ui/react/components/Skeleton/Skeleton.d.ts +0 -13
- package/packages/ui/react/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/packages/ui/react/components/Skeleton/Skeleton.js +0 -36
- package/packages/ui/react/components/Skeleton/Skeleton.js.map +0 -1
- package/packages/ui/react/components/Skeleton/index.d.ts +0 -3
- package/packages/ui/react/components/Skeleton/index.d.ts.map +0 -1
- package/packages/ui/react/components/Skeleton/index.js +0 -6
- package/packages/ui/react/components/Skeleton/index.js.map +0 -1
- package/packages/ui/react/components/Switch/Switch.d.ts +0 -11
- package/packages/ui/react/components/Switch/Switch.d.ts.map +0 -1
- package/packages/ui/react/components/Switch/Switch.js +0 -57
- package/packages/ui/react/components/Switch/Switch.js.map +0 -1
- package/packages/ui/react/components/Switch/index.d.ts +0 -2
- package/packages/ui/react/components/Switch/index.d.ts.map +0 -1
- package/packages/ui/react/components/Switch/index.js +0 -18
- package/packages/ui/react/components/Switch/index.js.map +0 -1
- package/packages/ui/react/components/TableSearch/TableSearch.d.ts +0 -30
- package/packages/ui/react/components/TableSearch/TableSearch.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/TableSearch.js +0 -121
- package/packages/ui/react/components/TableSearch/TableSearch.js.map +0 -1
- package/packages/ui/react/components/TableSearch/index.d.ts +0 -2
- package/packages/ui/react/components/TableSearch/index.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/index.js +0 -9
- package/packages/ui/react/components/TableSearch/index.js.map +0 -1
- package/packages/ui/react/components/TableSearch/lang.d.ts +0 -15
- package/packages/ui/react/components/TableSearch/lang.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/lang.js +0 -28
- package/packages/ui/react/components/TableSearch/lang.js.map +0 -1
- package/packages/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts +0 -9
- package/packages/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +0 -15
- package/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js.map +0 -1
- package/packages/ui/react/components/Textarea.d.ts +0 -19
- package/packages/ui/react/components/Textarea.d.ts.map +0 -1
- package/packages/ui/react/components/Textarea.js +0 -38
- package/packages/ui/react/components/Textarea.js.map +0 -1
- package/packages/ui/react/components/Tooltip.d.ts +0 -9
- package/packages/ui/react/components/Tooltip.d.ts.map +0 -1
- package/packages/ui/react/components/Tooltip.js +0 -109
- package/packages/ui/react/components/Tooltip.js.map +0 -1
- package/packages/ui/react/components/TreeSelect.d.ts +0 -19
- package/packages/ui/react/components/TreeSelect.d.ts.map +0 -1
- package/packages/ui/react/components/TreeSelect.js +0 -160
- package/packages/ui/react/components/TreeSelect.js.map +0 -1
- package/packages/ui/react/components/Upload/ImageUpload.d.ts +0 -9
- package/packages/ui/react/components/Upload/ImageUpload.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/ImageUpload.js +0 -67
- package/packages/ui/react/components/Upload/ImageUpload.js.map +0 -1
- package/packages/ui/react/components/Upload/Upload.d.ts +0 -14
- package/packages/ui/react/components/Upload/Upload.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/Upload.js +0 -9
- package/packages/ui/react/components/Upload/Upload.js.map +0 -1
- package/packages/ui/react/components/Upload/index.d.ts +0 -3
- package/packages/ui/react/components/Upload/index.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/index.js +0 -19
- package/packages/ui/react/components/Upload/index.js.map +0 -1
- package/packages/ui/react/components/breadcrumb.d.ts +0 -35
- package/packages/ui/react/components/breadcrumb.d.ts.map +0 -1
- package/packages/ui/react/components/breadcrumb.js +0 -80
- package/packages/ui/react/components/breadcrumb.js.map +0 -1
- package/packages/ui/react/components/hooks/useInputController.d.ts +0 -21
- package/packages/ui/react/components/hooks/useInputController.d.ts.map +0 -1
- package/packages/ui/react/components/hooks/useInputController.js +0 -43
- package/packages/ui/react/components/hooks/useInputController.js.map +0 -1
- package/packages/ui/react/components/index.d.ts +0 -24
- package/packages/ui/react/components/index.d.ts.map +0 -1
- package/packages/ui/react/components/index.js +0 -40
- package/packages/ui/react/components/index.js.map +0 -1
- package/packages/ui/react/components/table.d.ts +0 -17
- package/packages/ui/react/components/table.d.ts.map +0 -1
- package/packages/ui/react/components/table.js +0 -64
- package/packages/ui/react/components/table.js.map +0 -1
- package/packages/ui/react/components/testPage/index.d.ts +0 -3
- package/packages/ui/react/components/testPage/index.d.ts.map +0 -1
- package/packages/ui/react/components/testPage/index.js +0 -124
- package/packages/ui/react/components/testPage/index.js.map +0 -1
- package/packages/ui/react/hooks/useBreadcrumb.d.ts +0 -10
- package/packages/ui/react/hooks/useBreadcrumb.d.ts.map +0 -1
- package/packages/ui/react/hooks/useBreadcrumb.js +0 -6
- package/packages/ui/react/hooks/useBreadcrumb.js.map +0 -1
- package/packages/ui/react/hooks/useInit.d.ts +0 -3
- package/packages/ui/react/hooks/useInit.d.ts.map +0 -1
- package/packages/ui/react/hooks/useInit.js +0 -12
- package/packages/ui/react/hooks/useInit.js.map +0 -1
- package/packages/ui/react/hooks/useLanguage.d.ts +0 -7
- package/packages/ui/react/hooks/useLanguage.d.ts.map +0 -1
- package/packages/ui/react/hooks/useLanguage.js +0 -8
- package/packages/ui/react/hooks/useLanguage.js.map +0 -1
- package/packages/ui/react/hooks/usePagination.d.ts +0 -16
- package/packages/ui/react/hooks/usePagination.d.ts.map +0 -1
- package/packages/ui/react/hooks/usePagination.js +0 -34
- package/packages/ui/react/hooks/usePagination.js.map +0 -1
- package/packages/ui/react/index.d.ts +0 -3
- package/packages/ui/react/index.d.ts.map +0 -1
- package/packages/ui/react/index.js +0 -19
- package/packages/ui/react/index.js.map +0 -1
- package/packages/ui/react/lib/export.d.ts +0 -22
- package/packages/ui/react/lib/export.d.ts.map +0 -1
- package/packages/ui/react/lib/export.js +0 -136
- package/packages/ui/react/lib/export.js.map +0 -1
- package/packages/ui/react/lib/utils.d.ts +0 -10
- package/packages/ui/react/lib/utils.d.ts.map +0 -1
- package/packages/ui/react/lib/utils.js +0 -53
- package/packages/ui/react/lib/utils.js.map +0 -1
- package/packages/ui/react/locales/index.d.ts +0 -8
- package/packages/ui/react/locales/index.d.ts.map +0 -1
- package/packages/ui/react/locales/index.js +0 -10
- package/packages/ui/react/locales/index.js.map +0 -1
- package/packages/ui/react/stores/breadcrumb.d.ts +0 -15
- package/packages/ui/react/stores/breadcrumb.d.ts.map +0 -1
- package/packages/ui/react/stores/breadcrumb.js +0 -68
- package/packages/ui/react/stores/breadcrumb.js.map +0 -1
- package/packages/ui/react/stores/language.d.ts +0 -13
- package/packages/ui/react/stores/language.d.ts.map +0 -1
- package/packages/ui/react/stores/language.js +0 -55
- package/packages/ui/react/stores/language.js.map +0 -1
- package/packages/ui/react/types/index.d.ts +0 -2
- package/packages/ui/react/types/index.d.ts.map +0 -1
- package/packages/ui/react/types/index.js +0 -3
- package/packages/ui/react/types/index.js.map +0 -1
- package/packages/utils/getAllFilesInFolder.d.ts +0 -5
- package/packages/utils/getAllFilesInFolder.d.ts.map +0 -1
- package/packages/utils/getAllFilesInFolder.js +0 -46
- package/packages/utils/getAllFilesInFolder.js.map +0 -1
- package/packages/utils/getAllFnReturnValue.d.ts +0 -1
- package/packages/utils/getAllFnReturnValue.d.ts.map +0 -1
- package/packages/utils/getAllFnReturnValue.js +0 -2
- package/packages/utils/getAllFnReturnValue.js.map +0 -1
- package/packages/utils/index.d.ts +0 -5
- package/packages/utils/index.d.ts.map +0 -1
- package/packages/utils/index.js +0 -21
- package/packages/utils/index.js.map +0 -1
- package/packages/utils/loadFile.d.ts +0 -15
- package/packages/utils/loadFile.d.ts.map +0 -1
- package/packages/utils/loadFile.js +0 -57
- package/packages/utils/loadFile.js.map +0 -1
- package/packages/utils/path.d.ts +0 -7
- package/packages/utils/path.d.ts.map +0 -1
- package/packages/utils/path.js +0 -51
- package/packages/utils/path.js.map +0 -1
- package/packages/utils/runFileFn.d.ts +0 -6
- package/packages/utils/runFileFn.d.ts.map +0 -1
- package/packages/utils/runFileFn.js +0 -6
- package/packages/utils/runFileFn.js.map +0 -1
- package/typings/type.d.ts +0 -2
- package/typings/type.d.ts.map +0 -1
- package/typings/type.js +0 -3
- package/typings/type.js.map +0 -1
package/README.md
ADDED
|
@@ -0,0 +1,1958 @@
|
|
|
1
|
+
# @_tc/template-core
|
|
2
|
+
|
|
3
|
+
TemplateCore 是一个基于 TypeScript、Koa、React 的后台框架包。它把后端约定式加载、前端 Dashboard、Schema CRUD 页面、模型配置和类型扩展放到同一个 npm 包里,项目只需要按目录补充自己的 `app/`、`model/`、`frontend/`。
|
|
4
|
+
|
|
5
|
+
## 安装
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pnpm add @_tc/template-core
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
要求:
|
|
12
|
+
|
|
13
|
+
- Node.js >= 18
|
|
14
|
+
- pnpm >= 8
|
|
15
|
+
- 使用内置前端时,需要安装 peer dependencies;完整清单以包内 `package.json` 的 `peerDependencies` 为准,包括 Koa、React、Vite、路由、状态、表单和 UI 相关依赖。
|
|
16
|
+
|
|
17
|
+
## 可选:给项目 AI 助手的文档与 Skill
|
|
18
|
+
|
|
19
|
+
如果你在项目中让 AI 助手协助开发,可以让它优先读取 npm 包内的 `AGENT_README.md`。安装后的路径通常是 `node_modules/@_tc/template-core/AGENT_README.md`。这份文档面向“协助使用 TemplateCore 的 AI 助手”,覆盖公开入口、最小启动、目录约定、model 配置、前端使用和构建方式。
|
|
20
|
+
|
|
21
|
+
包内附带两份 Agent Skill,本质是可复用的 Agent 指令包,采用渐进式披露(SKILL.md + reference/)结构。
|
|
22
|
+
|
|
23
|
+
| Skill | 用途 |
|
|
24
|
+
| --- | --- |
|
|
25
|
+
| `tc-generator` | 按 TemplateCore 约定生成项目、model 配置、Schema CRUD、controller 和 router。 |
|
|
26
|
+
| `tc-component-usage-skills` | 指导 Agent 选用和正确使用内置 React 组件库(Button、Form、DataTable、Modal 等)。 |
|
|
27
|
+
|
|
28
|
+
如果你的 Agent 支持本地 skills 目录,可以从已安装的 npm 包复制安装。以 Codex 为例:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
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"
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
安装后重启对应 Agent,让新 skill 生效。使用时可以直接说”用 tc-generator 生成一个商品管理模块”或”用 tc-component-usage-skills 帮我写一个带搜索的分页表格”。
|
|
37
|
+
|
|
38
|
+
其他 Agent 如果不支持自动安装 skill,也可以直接读取 `.skills/tc-generator/SKILL.md` 或 `.skills/tc-component-usage-skills/SKILL.md`,再按需读取 `reference/` 下的参考文件。
|
|
39
|
+
|
|
40
|
+
## 快速使用
|
|
41
|
+
|
|
42
|
+
项目建议结构:
|
|
43
|
+
|
|
44
|
+
```text
|
|
45
|
+
my-admin/
|
|
46
|
+
├── app/
|
|
47
|
+
│ ├── controller/
|
|
48
|
+
│ │ └── product.ts
|
|
49
|
+
│ ├── router/
|
|
50
|
+
│ │ └── product.ts
|
|
51
|
+
│ └── service/
|
|
52
|
+
├── config/
|
|
53
|
+
│ └── config.default.ts
|
|
54
|
+
├── frontend/
|
|
55
|
+
│ ├── src/ # 库代码
|
|
56
|
+
│ ├── apps/ # 应用入口
|
|
57
|
+
│ └── extended/ # 扩展点
|
|
58
|
+
├── model/
|
|
59
|
+
│ └── product/
|
|
60
|
+
│ ├── mode.ts
|
|
61
|
+
│ └── project/
|
|
62
|
+
│ └── demo.ts
|
|
63
|
+
├── typing/
|
|
64
|
+
│ └── template-core.d.ts
|
|
65
|
+
└── index.ts
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
启动入口:
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
import { join } from 'path'
|
|
72
|
+
import { serverStart } from '@_tc/template-core'
|
|
73
|
+
import { buildFE } from '@_tc/template-core/bundler'
|
|
74
|
+
|
|
75
|
+
async function main() {
|
|
76
|
+
await serverStart({
|
|
77
|
+
name: 'my-admin',
|
|
78
|
+
baseDir: join(__dirname, '.'),
|
|
79
|
+
pageBasePage: '/',
|
|
80
|
+
additionalPublicPaths: join(__dirname, 'dist/public'),
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
await buildFE('dev')
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
main().catch((error) => {
|
|
87
|
+
console.error(error)
|
|
88
|
+
process.exit(1)
|
|
89
|
+
})
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
只用后端能力时,可以不调用 `buildFE('dev')`。
|
|
93
|
+
|
|
94
|
+
### serverStart 参数说明
|
|
95
|
+
|
|
96
|
+
| 参数 | 类型 | 必填 | 默认值 | 说明 |
|
|
97
|
+
| --- | --- | --- | --- | --- |
|
|
98
|
+
| `name` | `string` | 否 | - | 应用名称 |
|
|
99
|
+
| `baseDir` | `string` | 否 | - | 项目根目录,通常为 `join(__dirname, '.')` |
|
|
100
|
+
| `pageBasePage` | `string` | 否 | `'/'` | 页面访问前缀,所有前端页面路由的基础路径 |
|
|
101
|
+
| `homePage` | `string` | 否 | - | 应用首页路径 |
|
|
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
|
+
```
|
|
118
|
+
|
|
119
|
+
`auth.ATKey` / `auth.RTKey` 用于约定业务鉴权中间件读取短 token 和刷新 token 的 header 名;默认分别为 `Authorization` 和 `RT`。
|
|
120
|
+
|
|
121
|
+
静态资源挂载和 Nunjucks 模板查找顺序均为:框架 `app/public`、项目 `app/public`、`additionalPublicPaths`。当 `buildFE` 输出到自定义目录时,可以用 `additionalPublicPaths` 把该目录交给 Koa 提供静态资源访问和模板渲染。
|
|
122
|
+
|
|
123
|
+
### buildFE 参数说明
|
|
124
|
+
|
|
125
|
+
```ts
|
|
126
|
+
buildFE(mode: 'dev' | 'prod', options?: BuildFEOptions)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**mode**:构建模式
|
|
130
|
+
- `'dev'`:开发模式,构建一次并监听业务 `frontend/` 变化后重建
|
|
131
|
+
- `'prod'`:生产模式,构建优化后的静态资源
|
|
132
|
+
|
|
133
|
+
**options.output**:构建输出位置
|
|
134
|
+
- `'frame'`(默认):输出到当前导入格式对应的框架静态目录,例如 `node_modules/@_tc/template-core/esm/app/public/dist` 或 `node_modules/@_tc/template-core/cjs/app/public/dist`
|
|
135
|
+
- `'run'`:输出到项目根目录的 `app/public/dist`,适合 TypeScript 编译后的项目
|
|
136
|
+
- `() => string`:自定义函数,返回输出目录的绝对路径
|
|
137
|
+
|
|
138
|
+
示例:
|
|
139
|
+
|
|
140
|
+
```ts
|
|
141
|
+
// 开发模式,默认输出到框架包
|
|
142
|
+
buildFE('dev')
|
|
143
|
+
|
|
144
|
+
// 生产模式,输出到项目目录
|
|
145
|
+
buildFE('prod', { output: 'run' })
|
|
146
|
+
|
|
147
|
+
// 自定义输出路径
|
|
148
|
+
buildFE('prod', {
|
|
149
|
+
output: () => join(__dirname, 'dist/public')
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
配置文件:
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
// config/config.default.ts
|
|
157
|
+
export default {
|
|
158
|
+
port: 9000,
|
|
159
|
+
}
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
访问默认后台:
|
|
163
|
+
|
|
164
|
+
```text
|
|
165
|
+
http://localhost:9000/dash?projk=demo
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
`projk` 对应 `model/{modelKey}/project/{projectKey}.ts` 里的 `projectKey`。
|
|
169
|
+
|
|
170
|
+
## 常用公开入口
|
|
171
|
+
|
|
172
|
+
完整 exports 以发布包内 `package.json` 为准,除下表外还包含 `./fe/main`、`./fe/*`、`./fe/rc/*`、`./fe/rc/hooks/*` 等子路径。
|
|
173
|
+
|
|
174
|
+
| 入口 | 用途 |
|
|
175
|
+
| --- | --- |
|
|
176
|
+
| `@_tc/template-core` | 服务启动、基础 Controller/Service、Koa 类型 |
|
|
177
|
+
| `@_tc/template-core/bundler` | 构建入口,提供前端资源构建 `buildFE` 和消费方 Node/backend 构建 `buildBE` |
|
|
178
|
+
| `@_tc/template-core/fe` | 前端初始化、Dash 路由扩展、请求方法、SchemaPage 事件、共享状态和内置前端组件 |
|
|
179
|
+
| `@_tc/template-core/fe/rc` | UI/SchemaForm 组件和类型 |
|
|
180
|
+
| `@_tc/template-core/fe/tailwind_ui.css` | 前端全局样式入口,源码对应 `frontend/src/main.css` |
|
|
181
|
+
| `@_tc/template-core/model` | model 配置类型 |
|
|
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
|
+
|
|
226
|
+
## 样式与 Tailwind V4
|
|
227
|
+
|
|
228
|
+
使用内置前端或 UI 组件时,需要引入包内样式。默认 `@_tc/template-core/fe` 的 `initApp` 会经过源码入口 `frontend/src/main.tsx` 引入 `frontend/src/main.css`;如果项目侧自定义入口、只使用 `fe/rc` 组件,或希望样式入口更明确,建议显式引入:
|
|
229
|
+
|
|
230
|
+
```ts
|
|
231
|
+
// frontend/xxx/xxx.entry.tsx
|
|
232
|
+
import '@_tc/template-core/fe/tailwind_ui.css'
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
如果项目有自己的全局样式入口,也可以在 CSS 中引入:
|
|
236
|
+
|
|
237
|
+
```css
|
|
238
|
+
/* frontend/main.css */
|
|
239
|
+
@import "@_tc/template-core/fe/tailwind_ui.css";
|
|
240
|
+
|
|
241
|
+
/* 扫描项目源码 */
|
|
242
|
+
@source "./**/*.{js,ts,jsx,tsx}";
|
|
243
|
+
@source "../model/**/*.{js,ts,jsx,tsx}";
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
Tailwind V4 默认会忽略 `node_modules` 和 `.gitignore` 中的文件。如果没有使用上面的 `tailwind_ui.css`,或者项目侧构建链路绕过了 TemplateCore 的样式入口,需要手动把包加入 Tailwind 扫描:
|
|
247
|
+
|
|
248
|
+
```css
|
|
249
|
+
/* frontend/main.css */
|
|
250
|
+
@import "tailwindcss";
|
|
251
|
+
|
|
252
|
+
@source "./**/*.{js,ts,jsx,tsx}";
|
|
253
|
+
@source "../model/**/*.{js,ts,jsx,tsx}";
|
|
254
|
+
@source "../node_modules/@_tc/template-core";
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
VS Code 建议安装官方 Tailwind CSS IntelliSense 插件,并在工作区 `.vscode/settings.json` 指向项目 CSS 入口:
|
|
258
|
+
|
|
259
|
+
```json
|
|
260
|
+
{
|
|
261
|
+
"tailwindCSS.experimental.configFile": "frontend/main.css",
|
|
262
|
+
"files.associations": {
|
|
263
|
+
"*.css": "tailwindcss"
|
|
264
|
+
},
|
|
265
|
+
"css.lint.unknownAtRules": "ignore"
|
|
266
|
+
}
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
多入口项目可以写成对象:
|
|
270
|
+
|
|
271
|
+
```json
|
|
272
|
+
{
|
|
273
|
+
"tailwindCSS.experimental.configFile": {
|
|
274
|
+
"frontend/main.css": "frontend/**/*.{ts,tsx,js,jsx}",
|
|
275
|
+
"frontend/admin/admin.css": "frontend/admin/**/*.{ts,tsx,js,jsx}"
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## 内置功能
|
|
281
|
+
|
|
282
|
+
- Koa 服务启动:`serverStart(options)`。
|
|
283
|
+
- 约定式加载:自动加载 `config`、`extend`、`router-schema`、`service`、`controller`、`middleware`、`router`。
|
|
284
|
+
- 双层 app:框架内置 `app/` 和项目 `app/` 一起加载。
|
|
285
|
+
- 默认项目接口:
|
|
286
|
+
- `GET /api/project/model_list`
|
|
287
|
+
- `GET /api/project/list`
|
|
288
|
+
- `GET /api/project/:key`
|
|
289
|
+
- React Dashboard:内置 `/dash` 页面入口。
|
|
290
|
+
- 组件预览页面:内置 `/ui-components` 页面,用于查看和测试框架内置的 UI 组件。
|
|
291
|
+
- 菜单渲染:支持 `schema`、`custom`、`iframe`、`sidebar`。
|
|
292
|
+
- Schema CRUD:根据 `model` 中的 `schemaConfig` 生成搜索、表格、新增、编辑、详情。
|
|
293
|
+
- 内置 UI 组件:提供丰富的 React 组件库,详见下方"内置 UI 组件"章节。
|
|
294
|
+
- API 中间件:错误处理、静态资源、body parser、项目上下文、接口签名、参数校验。
|
|
295
|
+
- 前端构建:扫描 `frontend/**/*.entry.{ts,tsx,js,jsx}`,输出服务端可渲染的 `.entry.tpl`。
|
|
296
|
+
- 类型扩展:支持扩展 SchemaForm、CallCom、KoaApp。
|
|
297
|
+
|
|
298
|
+
## 前端公共能力
|
|
299
|
+
|
|
300
|
+
项目侧需要 TemplateCore 前端能力时,优先从 `@_tc/template-core/fe` 导入,不要直接依赖 `frontend/src/common/...`、`frontend/src/defaultPages/...`、`frontend/src/stores/...` 这类内部路径。
|
|
301
|
+
|
|
302
|
+
```ts
|
|
303
|
+
import {
|
|
304
|
+
api,
|
|
305
|
+
apiFreezerStore,
|
|
306
|
+
AsyncSelect,
|
|
307
|
+
eventsInfo,
|
|
308
|
+
FreezeState,
|
|
309
|
+
get,
|
|
310
|
+
LanguageSwitch,
|
|
311
|
+
merge,
|
|
312
|
+
modeStore,
|
|
313
|
+
post,
|
|
314
|
+
request,
|
|
315
|
+
schemaEventBus,
|
|
316
|
+
schemaStore,
|
|
317
|
+
ThemeSwitch,
|
|
318
|
+
useApiFreezer,
|
|
319
|
+
useModeStore,
|
|
320
|
+
useSchemaStore,
|
|
321
|
+
} from '@_tc/template-core/fe'
|
|
322
|
+
|
|
323
|
+
import type {
|
|
324
|
+
BaseResponse,
|
|
325
|
+
CallComComponentsMap,
|
|
326
|
+
CallComRenderer,
|
|
327
|
+
DashComponentsMap,
|
|
328
|
+
DashRouteGuard,
|
|
329
|
+
DashRoutesExtender,
|
|
330
|
+
FormFieldSchema,
|
|
331
|
+
ApiFreezerRequestMatcher,
|
|
332
|
+
PageParams,
|
|
333
|
+
PageResponse,
|
|
334
|
+
RequestConfig,
|
|
335
|
+
ResponseConfig,
|
|
336
|
+
SchemaFormComponentsMap,
|
|
337
|
+
SchemaFormNamespace,
|
|
338
|
+
SelectProps,
|
|
339
|
+
} from '@_tc/template-core/fe'
|
|
340
|
+
```
|
|
341
|
+
|
|
342
|
+
当前公共入口包含:
|
|
343
|
+
|
|
344
|
+
| 类型 | 导出内容 |
|
|
345
|
+
| --- | --- |
|
|
346
|
+
| 应用启动 | `initApp` |
|
|
347
|
+
| 内置前端组件 | `AsyncSelect`、`LanguageSwitch`、`ThemeSwitch` |
|
|
348
|
+
| Dash 扩展类型 | `DashRoutesExtender`、`DashRoutesContext`、`DashComponentsMap`、`DashHeaderUserAreaProps`、`DashRouteGuard` |
|
|
349
|
+
| SchemaPage 类型 | `CallComComponentsMap`、`CallComRenderer` |
|
|
350
|
+
| SchemaForm 类型 | `FormFieldSchema`、`SchemaFormComponentsMap`、`SchemaFormNamespace`、`SelectProps` |
|
|
351
|
+
| 请求方法 | `api`、`request`、`get`、`post`、`put`、`patch`、`del` |
|
|
352
|
+
| 请求类型 | `BaseResponse`、`PageParams`、`PageResponse`、`RequestConfig`、`ResponseConfig`、`AxiosError` |
|
|
353
|
+
| 请求冻结 | `apiFreezerStore`、`useApiFreezer`、`FreezeState`、`ApiFreezerRequestMatcher` |
|
|
354
|
+
| 事件工具 | `eventsInfo`、`merge` |
|
|
355
|
+
| 共享状态 | `modeStore`、`useModeStore`、`schemaStore`、`useSchemaStore`、`schemaEventBus` |
|
|
356
|
+
|
|
357
|
+
`modeStore` 管项目模型和当前项目数据,`schemaStore` 管当前 Schema 页面的 schema/cache,`schemaEventBus` 用来在 Search、Table、CallCom 之间通信。
|
|
358
|
+
|
|
359
|
+
只使用请求层时,也可以从 `@_tc/template-core/fe/common/request` 导入 `api`、请求方法和请求类型;这是发布包显式子路径,不要下钻到 `frontend/src/common/request`。
|
|
360
|
+
|
|
361
|
+
### 前端多语言
|
|
362
|
+
|
|
363
|
+
TemplateCore 前端通过 `@_tc/template-core/fe` 暴露 i18n 能力。框架内置中文、英文资源,项目可以继续追加自己的资源。
|
|
364
|
+
|
|
365
|
+
**追加自定义语言资源**:
|
|
366
|
+
|
|
367
|
+
```ts
|
|
368
|
+
import { i18nStore } from '@_tc/template-core/fe'
|
|
369
|
+
|
|
370
|
+
i18nStore.getState().addResources('zh-CN', {
|
|
371
|
+
business: {
|
|
372
|
+
product: {
|
|
373
|
+
menu: '商品管理',
|
|
374
|
+
name: '商品名称',
|
|
375
|
+
create: '新增商品',
|
|
376
|
+
createTitle: '新增商品',
|
|
377
|
+
},
|
|
378
|
+
},
|
|
379
|
+
})
|
|
380
|
+
|
|
381
|
+
i18nStore.getState().addResources('en-US', {
|
|
382
|
+
business: {
|
|
383
|
+
product: {
|
|
384
|
+
menu: 'Products',
|
|
385
|
+
name: 'Product name',
|
|
386
|
+
create: 'Create product',
|
|
387
|
+
createTitle: 'Create product',
|
|
388
|
+
},
|
|
389
|
+
},
|
|
390
|
+
})
|
|
391
|
+
```
|
|
392
|
+
|
|
393
|
+
资源注册时不写 `$i18n::` 前缀,配置中使用时才写:
|
|
394
|
+
|
|
395
|
+
```ts
|
|
396
|
+
const title = '$i18n::business.product.createTitle'
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
**在 model / Schema 配置中使用**:
|
|
400
|
+
|
|
401
|
+
```ts
|
|
402
|
+
{
|
|
403
|
+
name: '$i18n::business.product.menu',
|
|
404
|
+
moduleType: 'schema',
|
|
405
|
+
schemaConfig: {
|
|
406
|
+
schema: {
|
|
407
|
+
type: 'object',
|
|
408
|
+
properties: {
|
|
409
|
+
name: {
|
|
410
|
+
type: 'string',
|
|
411
|
+
label: '$i18n::business.product.name',
|
|
412
|
+
minLength: 2,
|
|
413
|
+
createFormOption: {
|
|
414
|
+
comType: 'input',
|
|
415
|
+
},
|
|
416
|
+
tableOption: {},
|
|
417
|
+
searchOption: {},
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
required: ['name'],
|
|
421
|
+
},
|
|
422
|
+
tableConfig: {
|
|
423
|
+
headerButtons: [
|
|
424
|
+
{
|
|
425
|
+
label: '$i18n::business.product.create',
|
|
426
|
+
eventKey: 'callComponent',
|
|
427
|
+
eventOption: { comName: 'createForm' },
|
|
428
|
+
},
|
|
429
|
+
],
|
|
430
|
+
},
|
|
431
|
+
componentConfig: {
|
|
432
|
+
createForm: {
|
|
433
|
+
title: '$i18n::business.product.createTitle',
|
|
434
|
+
saveBtnText: '$i18n::common.submit',
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
},
|
|
438
|
+
}
|
|
439
|
+
```
|
|
440
|
+
|
|
441
|
+
已支持 `$i18n::...` 的常用位置:
|
|
442
|
+
|
|
443
|
+
- 菜单名:`menu.name`
|
|
444
|
+
- 项目标题:`projectInfo.desc` 或回退的 `projectInfo.name`
|
|
445
|
+
- Schema 字段名:`schema.properties.*.label`
|
|
446
|
+
- 表格按钮和行按钮:`headerButtons.*.label`、`rowButtons.*.label`
|
|
447
|
+
- 弹窗、抽屉标题:`componentConfig.*.title`
|
|
448
|
+
- 表单保存按钮:`componentConfig.*.saveBtnText`
|
|
449
|
+
- 接口错误提示:`BaseResponse.message`
|
|
450
|
+
|
|
451
|
+
**切换语言**:
|
|
452
|
+
|
|
453
|
+
```ts
|
|
454
|
+
import { i18nStore } from '@_tc/template-core/fe'
|
|
455
|
+
|
|
456
|
+
i18nStore.getState().setLanguage('en-US')
|
|
457
|
+
i18nStore.getState().setLanguage('zh-CN')
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
默认会写入 localStorage,key 是 `tc_language`。刷新页面后会继续使用上次语言。
|
|
461
|
+
|
|
462
|
+
项目页面可以直接使用语言选择组件:
|
|
463
|
+
|
|
464
|
+
```tsx
|
|
465
|
+
import { LanguageSwitch } from '@_tc/template-core/fe'
|
|
466
|
+
|
|
467
|
+
export function Toolbar() {
|
|
468
|
+
return <LanguageSwitch />
|
|
469
|
+
}
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
`LanguageSwitch` 默认提供 `zh-CN` 和 `en-US`,也支持传入 `options` 覆盖语言列表。组件内部会调用 `i18nStore.getState().setLanguage()`,因此会沿用 `tc_language` 的持久化行为。
|
|
473
|
+
|
|
474
|
+
**AJV 校验文案**:
|
|
475
|
+
|
|
476
|
+
Schema 表单校验会把 AJV keyword 映射到内置语言 key,覆盖 `required`、`type`、`format`、`minimum`、`maximum`、`minLength`、`maxLength`、`pattern`、`enum`、`oneOf`、`anyOf` 等常见规则。
|
|
477
|
+
|
|
478
|
+
非必填字段为空时会跳过 AJV 校验,空值包括 `undefined`、`null`、空字符串、空数组和空对象。
|
|
479
|
+
|
|
480
|
+
如果需要扩展更多 AJV 文案,在源码项目中同步增加:
|
|
481
|
+
|
|
482
|
+
1. `frontend/src/defaultPages/SchemaPage/utils/validator.ts` 的 `formatError()` 映射。
|
|
483
|
+
2. `frontend/src/language/zh-CN.ts` 和 `frontend/src/language/en-US.ts` 文案。
|
|
484
|
+
3. `frontend/src/language/index.ts` 的 `frontendLangKeys`。
|
|
485
|
+
|
|
486
|
+
### 前端主题切换
|
|
487
|
+
|
|
488
|
+
项目页面可以使用 `ThemeSwitch` 切换浅色和深色模式:
|
|
489
|
+
|
|
490
|
+
```tsx
|
|
491
|
+
import { ThemeSwitch } from '@_tc/template-core/fe'
|
|
492
|
+
|
|
493
|
+
export function Toolbar() {
|
|
494
|
+
return <ThemeSwitch />
|
|
495
|
+
}
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
`ThemeSwitch` 会切换 `document.documentElement` 上的 `dark` class,并同步 `color-scheme`。默认写入 localStorage,key 是 `tc_theme`。刷新页面后会优先读取本地主题;没有本地主题时,读取当前根节点是否已有 `dark` class。
|
|
499
|
+
|
|
500
|
+
常用参数:
|
|
501
|
+
|
|
502
|
+
| 参数 | 说明 |
|
|
503
|
+
| --- | --- |
|
|
504
|
+
| `value` / `onChange` | 受控模式,值为 `light` 或 `dark`。 |
|
|
505
|
+
| `defaultValue` | 非受控初始主题。 |
|
|
506
|
+
| `showLabel` | 是否展示当前主题文本。 |
|
|
507
|
+
| `persist` | 是否写入 localStorage,默认 `true`。 |
|
|
508
|
+
| `storageKey` | 自定义本地存储 key,默认 `tc_theme`。 |
|
|
509
|
+
|
|
510
|
+
### 前端请求封装详解
|
|
511
|
+
|
|
512
|
+
框架内置的请求封装基于 `@tc/common/http`,底层使用原生 `fetch` API,实现了类似 Axios 的接口和拦截器机制,提供了签名、鉴权、错误处理等能力。
|
|
513
|
+
|
|
514
|
+
**基础配置**:
|
|
515
|
+
- `BASE_URL`:固定为 `/api`
|
|
516
|
+
- `timeout`:15000ms(15秒)
|
|
517
|
+
- `credentials`:`'include'`,支持跨域携带 cookie
|
|
518
|
+
- `window._signKey`:由服务端页面模板从 `app.config.signKey` 注入
|
|
519
|
+
|
|
520
|
+
**请求拦截器**:
|
|
521
|
+
|
|
522
|
+
每个请求会自动添加以下 headers:
|
|
523
|
+
|
|
524
|
+
```ts
|
|
525
|
+
{
|
|
526
|
+
's_t': '当前时间戳',
|
|
527
|
+
's_sign': 'md5(签名密钥_时间戳)',
|
|
528
|
+
'projk': '当前项目 key(从 localStorage 读取)',
|
|
529
|
+
'Authorization': 'Bearer token(如果已登录)'
|
|
530
|
+
}
|
|
531
|
+
```
|
|
532
|
+
|
|
533
|
+
`Authorization` 默认对应服务端配置 `config.auth.ATKey`。前端本地 token 存在 `localStorage.auth_token`,项目 key 存在 `localStorage.p_J_k`;刷新 token header 名预留为 `config.auth.RTKey`,默认是 `RT`。
|
|
534
|
+
|
|
535
|
+
**签名机制**:
|
|
536
|
+
- 签名密钥:服务端从 `app.config.signKey` 读取,并在页面渲染时注入为 `window._signKey`
|
|
537
|
+
- 签名算法:`md5(签名密钥_${时间戳})`
|
|
538
|
+
- 服务端会在非 local 环境下校验签名和时间戳
|
|
539
|
+
|
|
540
|
+
**响应拦截器**:
|
|
541
|
+
|
|
542
|
+
- **401 处理**:自动清空 token 并跳转到 `/login`
|
|
543
|
+
- **错误提取**:自动从响应中提取 `message`、`msg` 或 `errors` 字段
|
|
544
|
+
- **超时处理**:请求超时会返回当前语言的超时提示
|
|
545
|
+
- **网络错误**:网络异常会返回当前语言的网络错误提示
|
|
546
|
+
|
|
547
|
+
**使用示例**:
|
|
548
|
+
|
|
549
|
+
```ts
|
|
550
|
+
import { api, get, post, put, del } from '@_tc/template-core/fe'
|
|
551
|
+
import type { BaseResponse, RequestConfig, ResponseConfig } from '@_tc/template-core/fe'
|
|
552
|
+
|
|
553
|
+
// GET 请求
|
|
554
|
+
const data = await get('/product/list', { page: 1, pageSize: 10 })
|
|
555
|
+
|
|
556
|
+
// POST 请求
|
|
557
|
+
const result = await post('/product', { name: '商品名称', price: 100 })
|
|
558
|
+
|
|
559
|
+
// PUT 请求
|
|
560
|
+
await put('/product', { id: 1, name: '新名称' })
|
|
561
|
+
|
|
562
|
+
// DELETE 请求
|
|
563
|
+
await del('/product', { id: 1 })
|
|
564
|
+
```
|
|
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
|
+
|
|
582
|
+
**请求冻结器**:
|
|
583
|
+
|
|
584
|
+
请求冻结器用于在某段流程中暂停普通 API 请求,典型场景是 RT 刷新 token:刷新期间冻结其它请求,刷新接口本身走白名单放行,刷新完成后再解冻并回放队列。
|
|
585
|
+
|
|
586
|
+
冻结器只在 `Freeze` 状态拦截请求;`Hibernation` 和 `Thawing` 状态都会直接放行。解冻时会按最多 4 个并发回放已冻结的请求;相同序列化参数的请求只会实际发送一次,多个调用方共享同一份响应或错误。
|
|
587
|
+
|
|
588
|
+
```ts
|
|
589
|
+
import { apiFreezerStore } from '@_tc/template-core/fe'
|
|
590
|
+
|
|
591
|
+
const { freezing, thawing, setRequestWhitelist } = apiFreezerStore.getState()
|
|
592
|
+
|
|
593
|
+
setRequestWhitelist([
|
|
594
|
+
'/auth/refresh',
|
|
595
|
+
/^\/auth\//,
|
|
596
|
+
(api) => api.includes('/refresh-token'),
|
|
597
|
+
])
|
|
598
|
+
|
|
599
|
+
freezing()
|
|
600
|
+
|
|
601
|
+
try {
|
|
602
|
+
await refreshToken()
|
|
603
|
+
} finally {
|
|
604
|
+
thawing()
|
|
605
|
+
}
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
白名单支持三种 matcher:
|
|
609
|
+
|
|
610
|
+
- `string`:精确匹配 API 路径
|
|
611
|
+
- `RegExp`:正则匹配 API 路径
|
|
612
|
+
- `(api, params) => boolean`:自定义判断,`params` 是请求函数收到的完整参数
|
|
613
|
+
|
|
614
|
+
**注意事项**:
|
|
615
|
+
- `get` 和 `del` 方法的参数会自动转为 query string
|
|
616
|
+
- `post`、`put`、`patch` 方法的参数会作为 request body
|
|
617
|
+
- 所有请求方法都会自动处理错误,无需手动 try-catch(除非需要自定义错误处理)
|
|
618
|
+
- 底层使用原生 `fetch` API,但提供了类似 Axios 的拦截器和配置接口
|
|
619
|
+
|
|
620
|
+
## 内置 UI 组件
|
|
621
|
+
|
|
622
|
+
框架通过 `@_tc/template-core/fe/rc` 提供了丰富的 React 组件库,可在项目中直接使用。
|
|
623
|
+
|
|
624
|
+
### 基础组件
|
|
625
|
+
|
|
626
|
+
| 组件 | 用途 | 导入路径 |
|
|
627
|
+
| --- | --- | --- |
|
|
628
|
+
| `Button` | 按钮组件,支持多种样式和尺寸 | `@_tc/template-core/fe/rc` |
|
|
629
|
+
| `Input` | 输入框组件,支持清空、右侧附加内容和密码显隐 | `@_tc/template-core/fe/rc` |
|
|
630
|
+
| `InputNumber` | 数字输入框组件 | `@_tc/template-core/fe/rc` |
|
|
631
|
+
| `Textarea` | 多行文本输入框组件 | `@_tc/template-core/fe/rc` |
|
|
632
|
+
| `Select` | 下拉选择组件,支持单选和多选 | `@_tc/template-core/fe/rc` |
|
|
633
|
+
| `Search` | 搜索输入组件 | `@_tc/template-core/fe/rc` |
|
|
634
|
+
| `TreeSelect` | 树形选择组件 | `@_tc/template-core/fe/rc` |
|
|
635
|
+
| `Dropdown` | 下拉菜单组件 | `@_tc/template-core/fe/rc` |
|
|
636
|
+
| `DatePicker` | 日期选择器 | `@_tc/template-core/fe/rc` |
|
|
637
|
+
| `Upload` | 文件上传组件 | `@_tc/template-core/fe/rc` |
|
|
638
|
+
| `FileUpload` | 通用文件上传组件 | `@_tc/template-core/fe/rc` |
|
|
639
|
+
| `ImageUpload` | 图片上传组件 | `@_tc/template-core/fe/rc` |
|
|
640
|
+
| `ImagePreview` | 图片预览组件 | `@_tc/template-core/fe/rc` |
|
|
641
|
+
| `Checkbox` | 复选框组件 | `@_tc/template-core/fe/rc` |
|
|
642
|
+
| `Radio` | 单选框组件 | `@_tc/template-core/fe/rc` |
|
|
643
|
+
| `Switch` | 开关组件 | `@_tc/template-core/fe/rc` |
|
|
644
|
+
|
|
645
|
+
### 表单组件
|
|
646
|
+
|
|
647
|
+
| 组件 | 用途 | 导入路径 |
|
|
648
|
+
| --- | --- | --- |
|
|
649
|
+
| `Form` | 表单容器组件 | `@_tc/template-core/fe/rc` |
|
|
650
|
+
| `SchemaForm` | 配置驱动的表单组件,根据 schema 自动生成表单 | `@_tc/template-core/fe/rc` |
|
|
651
|
+
| `FormItem` | 表单项组件 | `@_tc/template-core/fe/rc` |
|
|
652
|
+
|
|
653
|
+
### 数据展示组件
|
|
654
|
+
|
|
655
|
+
| 组件 | 用途 | 导入路径 |
|
|
656
|
+
| --- | --- | --- |
|
|
657
|
+
| `DataTable` | 数据表格组件,支持分页、排序、筛选 | `@_tc/template-core/fe/rc` |
|
|
658
|
+
| `Table` | 表格组件(含表头、列配置等子组件) | `@_tc/template-core/fe/rc` |
|
|
659
|
+
| `TableSearch` | 表格搜索组件,配合 DataTable 使用 | `@_tc/template-core/fe/rc` |
|
|
660
|
+
| `Pagination` | 分页组件 | `@_tc/template-core/fe/rc` |
|
|
661
|
+
| `Breadcrumb` | 面包屑导航组件 | `@_tc/template-core/fe/rc` |
|
|
662
|
+
| `Calendar` | 日历组件 | `@_tc/template-core/fe/rc` |
|
|
663
|
+
| `TimePicker` | 时间选择器组件 | `@_tc/template-core/fe/rc` |
|
|
664
|
+
| `Skeleton` | 骨架屏加载占位组件 | `@_tc/template-core/fe/rc` |
|
|
665
|
+
|
|
666
|
+
### 反馈组件
|
|
667
|
+
|
|
668
|
+
| 组件 | 用途 | 导入路径 |
|
|
669
|
+
| --- | --- | --- |
|
|
670
|
+
| `Modal` | 模态框组件 | `@_tc/template-core/fe/rc` |
|
|
671
|
+
| `Drawer` | 抽屉组件 | `@_tc/template-core/fe/rc` |
|
|
672
|
+
| `message` | 消息提示方法 | `@_tc/template-core/fe/rc` |
|
|
673
|
+
| `Notification` | 通知组件 | `@_tc/template-core/fe/rc` |
|
|
674
|
+
| `ConfirmDialog` | 确认对话框组件 | `@_tc/template-core/fe/rc` |
|
|
675
|
+
| `Popup` | 弹出层组件 | `@_tc/template-core/fe/rc` |
|
|
676
|
+
| `Tooltip` | 文字提示组件 | `@_tc/template-core/fe/rc` |
|
|
677
|
+
| `Overlay` | 页面遮罩层组件 | `@_tc/template-core/fe/rc` |
|
|
678
|
+
| `Loading` | 加载状态组件 | `@_tc/template-core/fe/rc` |
|
|
679
|
+
|
|
680
|
+
### 布局组件
|
|
681
|
+
|
|
682
|
+
| 组件 | 用途 | 导入路径 |
|
|
683
|
+
| --- | --- | --- |
|
|
684
|
+
| `Layout` | 页面布局组件 | `@_tc/template-core/fe/rc` |
|
|
685
|
+
| `Card` | 卡片容器组件 | `@_tc/template-core/fe/rc` |
|
|
686
|
+
| `Tabs` | 标签页组件 | `@_tc/template-core/fe/rc` |
|
|
687
|
+
| `Menu` | 菜单组件(含 MenuItem 等子组件) | `@_tc/template-core/fe/rc` |
|
|
688
|
+
| `Label` | 标签组件 | `@_tc/template-core/fe/rc` |
|
|
689
|
+
|
|
690
|
+
### 按钮组件
|
|
691
|
+
|
|
692
|
+
| 组件 | 用途 | 导入路径 |
|
|
693
|
+
| --- | --- | --- |
|
|
694
|
+
| `Button` | 通用按钮组件 | `@_tc/template-core/fe/rc` |
|
|
695
|
+
| `AsynchronousButton` | 异步按钮组件,支持加载状态 | `@_tc/template-core/fe/rc` |
|
|
696
|
+
| `SubmitButton` | 表单提交按钮组件 | `@_tc/template-core/fe/rc` |
|
|
697
|
+
| `ActionBtn` | 操作按钮组件 | `@_tc/template-core/fe/rc` |
|
|
698
|
+
|
|
699
|
+
### 使用示例
|
|
700
|
+
|
|
701
|
+
```tsx
|
|
702
|
+
import { Button, Input, Select, Modal, DataTable } from '@_tc/template-core/fe/rc'
|
|
703
|
+
|
|
704
|
+
function MyComponent() {
|
|
705
|
+
return (
|
|
706
|
+
<div>
|
|
707
|
+
<Button variant="primary" onClick={() => console.log('clicked')}>
|
|
708
|
+
点击我
|
|
709
|
+
</Button>
|
|
710
|
+
|
|
711
|
+
<Input placeholder="请输入内容" />
|
|
712
|
+
<Input type="password" placeholder="请输入密码" />
|
|
713
|
+
|
|
714
|
+
<Select
|
|
715
|
+
options={[
|
|
716
|
+
{ label: '选项1', value: '1' },
|
|
717
|
+
{ label: '选项2', value: '2' },
|
|
718
|
+
]}
|
|
719
|
+
/>
|
|
720
|
+
</div>
|
|
721
|
+
)
|
|
722
|
+
}
|
|
723
|
+
```
|
|
724
|
+
|
|
725
|
+
**注意**:
|
|
726
|
+
- 所有组件都支持 TypeScript 类型提示
|
|
727
|
+
- 组件样式基于 Tailwind CSS V4
|
|
728
|
+
- 详细的组件 API 和示例可以访问 `/ui-components` 页面查看
|
|
729
|
+
|
|
730
|
+
## 后端约定
|
|
731
|
+
|
|
732
|
+
项目目录会按下面规则加载:
|
|
733
|
+
|
|
734
|
+
```text
|
|
735
|
+
app/controller/**/*.(js|ts) -> app.controller
|
|
736
|
+
app/service/**/*.(js|ts) -> app.service
|
|
737
|
+
app/middlewares/**/*.(js|ts) -> app.middlewares
|
|
738
|
+
app/middleware.(js|ts) -> 全局中间件编排,按框架 -> 项目顺序执行
|
|
739
|
+
app/router/**/*.(js|ts) -> Koa router
|
|
740
|
+
app/router-schema/**/*.(js|ts) -> app.routerSchema
|
|
741
|
+
app/extend/*.(js|ts) -> app.extends
|
|
742
|
+
config/config.default.(js|ts) -> app.config
|
|
743
|
+
config/config.{env}.(js|ts) -> app.config
|
|
744
|
+
model/**/*.(js|ts) -> 项目模型配置
|
|
745
|
+
```
|
|
746
|
+
|
|
747
|
+
内置扩展:
|
|
748
|
+
|
|
749
|
+
- `app.extends.$fetch`:Node 侧基于 `fetch` 的 axios 风格请求实例,支持 `get/post/put/patch/delete` 和 `create(config)`。
|
|
750
|
+
- `app.extends.crypto`:Node 侧加密辅助方法,支持 base64url 编解码、HMAC 签名、签名 payload 和常量时间比较。
|
|
751
|
+
- `app.extends.db`:默认 SQLite 框架数据库,提供 `getDBData/setDBData` 等通用数据方法。
|
|
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
|
+
|
|
771
|
+
### 数据库扩展
|
|
772
|
+
|
|
773
|
+
默认 `app.extends.db` 使用 SQLite 保存数据,数据库文件位于项目根目录 `.template-core/template-core.sqlite`。可以在配置中调整路径:
|
|
774
|
+
|
|
775
|
+
```ts
|
|
776
|
+
// config/config.default.ts
|
|
777
|
+
export default {
|
|
778
|
+
db: {
|
|
779
|
+
path: 'data/app.sqlite',
|
|
780
|
+
},
|
|
781
|
+
}
|
|
782
|
+
```
|
|
783
|
+
|
|
784
|
+
Controller 中使用:
|
|
785
|
+
|
|
786
|
+
```ts
|
|
787
|
+
import { baseFn, type ControllerFN, type Ctx } from '@_tc/template-core'
|
|
788
|
+
|
|
789
|
+
const getSettingController = ((app) => {
|
|
790
|
+
const BaseController = baseFn.baseControllerFn(app)
|
|
791
|
+
|
|
792
|
+
return class SettingController extends BaseController {
|
|
793
|
+
detail = async (ctx: Ctx) => {
|
|
794
|
+
const data = app.extends.db.getDBData('site-setting', {
|
|
795
|
+
namespace: 'setting',
|
|
796
|
+
})
|
|
797
|
+
|
|
798
|
+
this.success(ctx, data ?? {})
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
save = async (ctx: Ctx) => {
|
|
802
|
+
app.extends.db.setDBData('site-setting', ctx.request.body, {
|
|
803
|
+
namespace: 'setting',
|
|
804
|
+
})
|
|
805
|
+
|
|
806
|
+
this.success(ctx, true)
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
}) satisfies ControllerFN
|
|
810
|
+
|
|
811
|
+
export default getSettingController
|
|
812
|
+
```
|
|
813
|
+
|
|
814
|
+
常用方法:
|
|
815
|
+
|
|
816
|
+
- `getDBData(key, options)`:读取 JSON 数据。
|
|
817
|
+
- `setDBData(key, value, options)`:写入 JSON 数据。
|
|
818
|
+
- `hasDBData(key, options)`:判断数据是否存在。
|
|
819
|
+
- `deleteDBData(key, options)`:删除单条数据。
|
|
820
|
+
- `listDBData(options)`:分页列出当前 namespace 下的数据。
|
|
821
|
+
- `countDBData(options)` / `clearDBData(options)`:统计和清空当前 namespace。
|
|
822
|
+
- `queryDB(sql, params)` / `runDB(sql, params)`:直接执行 SQLite SQL。
|
|
823
|
+
- `transactionDB(handler)`:事务执行。
|
|
824
|
+
- `closeDB()`:关闭连接。
|
|
825
|
+
|
|
826
|
+
SQL 注入边界:
|
|
827
|
+
|
|
828
|
+
- `getDBData`、`setDBData`、`deleteDBData`、`listDBData` 这类通用方法内部使用参数绑定,不需要手写 SQL。
|
|
829
|
+
- `queryDB`、`runDB`、`getDBFirst` 是原始 SQL 入口,用户输入必须放到 `params`,不要拼接到 SQL 字符串里。
|
|
830
|
+
- `execDB` 没有参数绑定能力,只建议用于固定 SQL,例如建表或迁移。
|
|
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
|
+
|
|
862
|
+
```ts
|
|
863
|
+
// 推荐:参数绑定
|
|
864
|
+
const users = app.extends.db.queryDB(
|
|
865
|
+
'SELECT * FROM user WHERE name = ?',
|
|
866
|
+
[ctx.query.name as string]
|
|
867
|
+
)
|
|
868
|
+
|
|
869
|
+
// 不推荐:拼接用户输入,有 SQL 注入风险
|
|
870
|
+
const unsafeUsers = app.extends.db.queryDB(
|
|
871
|
+
`SELECT * FROM user WHERE name = '${ctx.query.name}'`
|
|
872
|
+
)
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
业务项目可以用自己的 `app/extend/db.ts` 覆盖默认实现。建议保留同一组方法名,这样 controller/service 调用方不用调整。
|
|
876
|
+
|
|
877
|
+
```ts
|
|
878
|
+
// app/extend/db.ts
|
|
879
|
+
import type { DB, DBFactory } from '@_tc/template-core'
|
|
880
|
+
|
|
881
|
+
interface DataOptions {
|
|
882
|
+
namespace?: string
|
|
883
|
+
}
|
|
884
|
+
|
|
885
|
+
const store = new Map<string, unknown>()
|
|
886
|
+
|
|
887
|
+
const getDB = ((_app) => {
|
|
888
|
+
const toKey = (key: string, namespace = 'framework') => `${namespace}:${key}`
|
|
889
|
+
|
|
890
|
+
const db = {
|
|
891
|
+
dbPath: 'memory',
|
|
892
|
+
getDBConnection: () => {
|
|
893
|
+
throw new Error('memory db 没有底层 SQLite connection')
|
|
894
|
+
},
|
|
895
|
+
execDB: () => undefined,
|
|
896
|
+
runDB: () => ({ changes: 0, lastInsertRowid: 0 }),
|
|
897
|
+
queryDB: <T extends object = Record<string, unknown>>() => [] as T[],
|
|
898
|
+
getDBFirst: <T extends object = Record<string, unknown>>() => undefined as T | undefined,
|
|
899
|
+
transactionDB: <T>(handler: (db: DB) => T) => handler(db),
|
|
900
|
+
getDBData: <T = unknown>(key: string, options?: DataOptions) => {
|
|
901
|
+
return store.get(toKey(key, options?.namespace)) as T | undefined
|
|
902
|
+
},
|
|
903
|
+
getDBDataRecord: <T = unknown>(key: string, options?: DataOptions) => {
|
|
904
|
+
const value = store.get(toKey(key, options?.namespace)) as T | undefined
|
|
905
|
+
if (value === undefined) return undefined
|
|
906
|
+
|
|
907
|
+
return {
|
|
908
|
+
key,
|
|
909
|
+
value,
|
|
910
|
+
namespace: options?.namespace ?? 'framework',
|
|
911
|
+
createdAt: '',
|
|
912
|
+
updatedAt: '',
|
|
913
|
+
}
|
|
914
|
+
},
|
|
915
|
+
setDBData: <T = unknown>(key: string, value: T, options?: DataOptions) => {
|
|
916
|
+
store.set(toKey(key, options?.namespace), value)
|
|
917
|
+
return { changes: 1, lastInsertRowid: 0 }
|
|
918
|
+
},
|
|
919
|
+
hasDBData: (key: string, options?: DataOptions) => {
|
|
920
|
+
return store.has(toKey(key, options?.namespace))
|
|
921
|
+
},
|
|
922
|
+
deleteDBData: (key: string, options?: DataOptions) => {
|
|
923
|
+
return store.delete(toKey(key, options?.namespace))
|
|
924
|
+
},
|
|
925
|
+
listDBData: <T = unknown>(options?: DataOptions) => {
|
|
926
|
+
const namespace = options?.namespace ?? 'framework'
|
|
927
|
+
|
|
928
|
+
return Array.from(store.entries())
|
|
929
|
+
.filter(([key]) => key.startsWith(`${namespace}:`))
|
|
930
|
+
.map(([key, value]) => ({
|
|
931
|
+
key: key.slice(namespace.length + 1),
|
|
932
|
+
value: value as T,
|
|
933
|
+
namespace,
|
|
934
|
+
createdAt: '',
|
|
935
|
+
updatedAt: '',
|
|
936
|
+
}))
|
|
937
|
+
},
|
|
938
|
+
countDBData: () => store.size,
|
|
939
|
+
clearDBData: () => {
|
|
940
|
+
const size = store.size
|
|
941
|
+
store.clear()
|
|
942
|
+
return size
|
|
943
|
+
},
|
|
944
|
+
closeDB: () => undefined,
|
|
945
|
+
} satisfies DB
|
|
946
|
+
|
|
947
|
+
return db
|
|
948
|
+
}) satisfies DBFactory
|
|
949
|
+
|
|
950
|
+
export default getDB
|
|
951
|
+
```
|
|
952
|
+
|
|
953
|
+
Controller 示例:
|
|
954
|
+
|
|
955
|
+
```ts
|
|
956
|
+
import { baseFn, type ControllerFN, type Ctx } from '@_tc/template-core'
|
|
957
|
+
|
|
958
|
+
const getProductController = ((app) => {
|
|
959
|
+
const BaseController = baseFn.baseControllerFn(app)
|
|
960
|
+
|
|
961
|
+
return class ProductController extends BaseController {
|
|
962
|
+
list = async (ctx: Ctx) => {
|
|
963
|
+
this.success(ctx, {
|
|
964
|
+
data: [],
|
|
965
|
+
page: 1,
|
|
966
|
+
pageSize: 10,
|
|
967
|
+
total: 0,
|
|
968
|
+
})
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
}) satisfies ControllerFN
|
|
972
|
+
|
|
973
|
+
export default getProductController
|
|
974
|
+
```
|
|
975
|
+
|
|
976
|
+
Router 示例:
|
|
977
|
+
|
|
978
|
+
```ts
|
|
979
|
+
import type { KoaApp, Router } from '@_tc/template-core'
|
|
980
|
+
|
|
981
|
+
export default (app: KoaApp, router: Router) => {
|
|
982
|
+
router.get('/api/product/list', app.controller.product.list)
|
|
983
|
+
}
|
|
984
|
+
```
|
|
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
|
+
|
|
1002
|
+
## model 数据如何配置
|
|
1003
|
+
|
|
1004
|
+
`model` 是后台菜单、项目和 Schema 页面的数据源。框架会读取:
|
|
1005
|
+
|
|
1006
|
+
```text
|
|
1007
|
+
model/{modelKey}/mode.ts
|
|
1008
|
+
model/{modelKey}/project/{projectKey}.ts
|
|
1009
|
+
```
|
|
1010
|
+
|
|
1011
|
+
`mode.ts` 定义模型模板:
|
|
1012
|
+
|
|
1013
|
+
```ts
|
|
1014
|
+
import type { ModelDataType } from '@_tc/template-core/model'
|
|
1015
|
+
|
|
1016
|
+
const model: ModelDataType = {
|
|
1017
|
+
mode: 'MB',
|
|
1018
|
+
name: '商品后台',
|
|
1019
|
+
desc: '商品管理',
|
|
1020
|
+
icon: '',
|
|
1021
|
+
homePage: '/_sidebar_/product?projk=demo',
|
|
1022
|
+
menuLayout: 'left',
|
|
1023
|
+
menu: [
|
|
1024
|
+
{
|
|
1025
|
+
key: 'product',
|
|
1026
|
+
name: '商品列表',
|
|
1027
|
+
menuType: 'module',
|
|
1028
|
+
moduleType: 'schema',
|
|
1029
|
+
schemaConfig: {
|
|
1030
|
+
api: '/api/product',
|
|
1031
|
+
schema: {
|
|
1032
|
+
type: 'object',
|
|
1033
|
+
properties: {
|
|
1034
|
+
product_id: {
|
|
1035
|
+
type: 'string',
|
|
1036
|
+
label: '商品 ID',
|
|
1037
|
+
tableOption: { width: 160 },
|
|
1038
|
+
detailPanelOption: {},
|
|
1039
|
+
editFormOption: {
|
|
1040
|
+
comType: 'input',
|
|
1041
|
+
disabled: true,
|
|
1042
|
+
},
|
|
1043
|
+
},
|
|
1044
|
+
product_name: {
|
|
1045
|
+
type: 'string',
|
|
1046
|
+
label: '商品名称',
|
|
1047
|
+
tableOption: {},
|
|
1048
|
+
searchOption: { comType: 'input' },
|
|
1049
|
+
createFormOption: { comType: 'input' },
|
|
1050
|
+
editFormOption: { comType: 'input' },
|
|
1051
|
+
detailPanelOption: {},
|
|
1052
|
+
},
|
|
1053
|
+
price: {
|
|
1054
|
+
type: 'number',
|
|
1055
|
+
label: '价格',
|
|
1056
|
+
tableOption: {},
|
|
1057
|
+
createFormOption: { comType: 'inputNumber' },
|
|
1058
|
+
editFormOption: { comType: 'inputNumber' },
|
|
1059
|
+
detailPanelOption: {},
|
|
1060
|
+
},
|
|
1061
|
+
},
|
|
1062
|
+
required: ['product_name'],
|
|
1063
|
+
},
|
|
1064
|
+
componentConfig: {
|
|
1065
|
+
createForm: {
|
|
1066
|
+
title: '新增商品',
|
|
1067
|
+
saveBtnText: '创建',
|
|
1068
|
+
},
|
|
1069
|
+
editForm: {
|
|
1070
|
+
title: '编辑商品',
|
|
1071
|
+
saveBtnText: '保存',
|
|
1072
|
+
fetchKey: 'product_id',
|
|
1073
|
+
},
|
|
1074
|
+
detailPanel: {
|
|
1075
|
+
title: '商品详情',
|
|
1076
|
+
fetchKey: 'product_id',
|
|
1077
|
+
},
|
|
1078
|
+
},
|
|
1079
|
+
tableConfig: {
|
|
1080
|
+
headerButtons: [
|
|
1081
|
+
{
|
|
1082
|
+
label: '新增',
|
|
1083
|
+
eventKey: 'callComponent',
|
|
1084
|
+
variant: 'primary',
|
|
1085
|
+
eventOption: { comName: 'createForm' },
|
|
1086
|
+
},
|
|
1087
|
+
],
|
|
1088
|
+
rowButtons: [
|
|
1089
|
+
{
|
|
1090
|
+
label: '编辑',
|
|
1091
|
+
eventKey: 'callComponent',
|
|
1092
|
+
eventOption: { comName: 'editForm' },
|
|
1093
|
+
},
|
|
1094
|
+
{
|
|
1095
|
+
label: '详情',
|
|
1096
|
+
eventKey: 'callComponent',
|
|
1097
|
+
eventOption: { comName: 'detailPanel' },
|
|
1098
|
+
},
|
|
1099
|
+
{
|
|
1100
|
+
label: '删除',
|
|
1101
|
+
eventKey: 'remove',
|
|
1102
|
+
eventOption: {
|
|
1103
|
+
params: {
|
|
1104
|
+
product_id: '$schema::product_id',
|
|
1105
|
+
},
|
|
1106
|
+
},
|
|
1107
|
+
},
|
|
1108
|
+
],
|
|
1109
|
+
},
|
|
1110
|
+
},
|
|
1111
|
+
},
|
|
1112
|
+
],
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
export default model
|
|
1116
|
+
```
|
|
1117
|
+
|
|
1118
|
+
`name`、`desc`、`icon`、`homePage` 都是可选项。Dashboard 页头标题优先使用 `desc`,没有时回退到 `name`;`icon` 可以是图片地址、图片路径、data image 或普通文本。未配置 `homePage` 时会自动跳到第一个可用菜单;配置时必须命中菜单生成的真实路由,左侧布局通常是 `/_sidebar_/{menuKey}`,顶部布局通常是 `/{menuKey}`。
|
|
1119
|
+
|
|
1120
|
+
`project/demo.ts` 定义项目覆盖:
|
|
1121
|
+
|
|
1122
|
+
```ts
|
|
1123
|
+
export default {
|
|
1124
|
+
name: 'Demo 企业',
|
|
1125
|
+
desc: 'Demo 企业商品后台',
|
|
1126
|
+
homePage: '/_sidebar_/product?projk=demo',
|
|
1127
|
+
}
|
|
1128
|
+
```
|
|
1129
|
+
|
|
1130
|
+
合并规则:
|
|
1131
|
+
|
|
1132
|
+
- `project` 会继承同目录上层 `mode`。
|
|
1133
|
+
- 对象递归合并,`project` 覆盖 `mode`。
|
|
1134
|
+
- 数组按 `key` 合并:同 key 覆盖,不同 key 新增。
|
|
1135
|
+
- `model/index.ts` 或 `model/index.js` 会被 loader 跳过。
|
|
1136
|
+
|
|
1137
|
+
### model 数组合并示例
|
|
1138
|
+
|
|
1139
|
+
假设 `mode.ts` 定义了两个菜单项:
|
|
1140
|
+
|
|
1141
|
+
```ts
|
|
1142
|
+
// model/product/mode.ts
|
|
1143
|
+
export default {
|
|
1144
|
+
name: '商品后台',
|
|
1145
|
+
menu: [
|
|
1146
|
+
{
|
|
1147
|
+
key: 'product',
|
|
1148
|
+
name: '商品列表',
|
|
1149
|
+
menuType: 'module',
|
|
1150
|
+
moduleType: 'schema',
|
|
1151
|
+
schemaConfig: {
|
|
1152
|
+
api: '/api/product',
|
|
1153
|
+
// ... 省略 schema 配置
|
|
1154
|
+
},
|
|
1155
|
+
},
|
|
1156
|
+
{
|
|
1157
|
+
key: 'category',
|
|
1158
|
+
name: '分类管理',
|
|
1159
|
+
menuType: 'module',
|
|
1160
|
+
moduleType: 'schema',
|
|
1161
|
+
schemaConfig: {
|
|
1162
|
+
api: '/api/category',
|
|
1163
|
+
// ... 省略 schema 配置
|
|
1164
|
+
},
|
|
1165
|
+
},
|
|
1166
|
+
],
|
|
1167
|
+
}
|
|
1168
|
+
```
|
|
1169
|
+
|
|
1170
|
+
`project/demo.ts` 可以:
|
|
1171
|
+
|
|
1172
|
+
```ts
|
|
1173
|
+
// model/product/project/demo.ts
|
|
1174
|
+
export default {
|
|
1175
|
+
name: 'Demo 企业商品后台',
|
|
1176
|
+
menu: [
|
|
1177
|
+
// 1. 覆盖:修改 product 菜单的名称和配置
|
|
1178
|
+
{
|
|
1179
|
+
key: 'product',
|
|
1180
|
+
name: 'Demo 商品', // 覆盖 name
|
|
1181
|
+
schemaConfig: {
|
|
1182
|
+
api: '/api/demo/product', // 覆盖 api
|
|
1183
|
+
},
|
|
1184
|
+
},
|
|
1185
|
+
// 2. 新增:添加 brand 菜单
|
|
1186
|
+
{
|
|
1187
|
+
key: 'brand',
|
|
1188
|
+
name: '品牌管理',
|
|
1189
|
+
menuType: 'module',
|
|
1190
|
+
moduleType: 'schema',
|
|
1191
|
+
schemaConfig: {
|
|
1192
|
+
api: '/api/brand',
|
|
1193
|
+
},
|
|
1194
|
+
},
|
|
1195
|
+
// 3. 继承:category 菜单未在 project 中定义,会完整继承 mode 的配置
|
|
1196
|
+
],
|
|
1197
|
+
}
|
|
1198
|
+
```
|
|
1199
|
+
|
|
1200
|
+
合并后的结果:
|
|
1201
|
+
|
|
1202
|
+
```ts
|
|
1203
|
+
{
|
|
1204
|
+
name: 'Demo 企业商品后台', // project 覆盖
|
|
1205
|
+
menu: [
|
|
1206
|
+
{
|
|
1207
|
+
key: 'product',
|
|
1208
|
+
name: 'Demo 商品', // project 覆盖
|
|
1209
|
+
menuType: 'module', // mode 继承
|
|
1210
|
+
moduleType: 'schema', // mode 继承
|
|
1211
|
+
schemaConfig: {
|
|
1212
|
+
api: '/api/demo/product', // project 覆盖
|
|
1213
|
+
// schema 配置会递归合并
|
|
1214
|
+
},
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
key: 'category', // mode 完整继承
|
|
1218
|
+
name: '分类管理',
|
|
1219
|
+
menuType: 'module',
|
|
1220
|
+
moduleType: 'schema',
|
|
1221
|
+
schemaConfig: {
|
|
1222
|
+
api: '/api/category',
|
|
1223
|
+
},
|
|
1224
|
+
},
|
|
1225
|
+
{
|
|
1226
|
+
key: 'brand', // project 新增
|
|
1227
|
+
name: '品牌管理',
|
|
1228
|
+
menuType: 'module',
|
|
1229
|
+
moduleType: 'schema',
|
|
1230
|
+
schemaConfig: {
|
|
1231
|
+
api: '/api/brand',
|
|
1232
|
+
},
|
|
1233
|
+
},
|
|
1234
|
+
],
|
|
1235
|
+
}
|
|
1236
|
+
```
|
|
1237
|
+
|
|
1238
|
+
**关键点**:
|
|
1239
|
+
- 数组合并依赖 `key` 字段,确保每个菜单项都有唯一的 `key`
|
|
1240
|
+
- 同 `key` 的项会递归合并,不是简单替换
|
|
1241
|
+
- `project` 中未定义的项会完整继承 `mode` 的配置
|
|
1242
|
+
|
|
1243
|
+
## model 数据如何引用
|
|
1244
|
+
|
|
1245
|
+
后端可以直接调用 loader:
|
|
1246
|
+
|
|
1247
|
+
```ts
|
|
1248
|
+
import { modelLoader, type KoaApp } from '@_tc/template-core'
|
|
1249
|
+
|
|
1250
|
+
export default (app: KoaApp) => {
|
|
1251
|
+
const modelList = modelLoader(app)
|
|
1252
|
+
return modelList
|
|
1253
|
+
}
|
|
1254
|
+
```
|
|
1255
|
+
|
|
1256
|
+
前端默认不直接读文件,而是通过内置接口获取:
|
|
1257
|
+
|
|
1258
|
+
```text
|
|
1259
|
+
GET /api/project/model_list
|
|
1260
|
+
GET /api/project/list?projk=demo
|
|
1261
|
+
GET /api/project/demo
|
|
1262
|
+
```
|
|
1263
|
+
|
|
1264
|
+
Dashboard 会根据 `projk` 请求 `/api/project/:key`,再按返回的 `menu` 渲染页面。
|
|
1265
|
+
|
|
1266
|
+
Schema 页面的接口约定:
|
|
1267
|
+
|
|
1268
|
+
```text
|
|
1269
|
+
GET {api}/list -> 表格列表
|
|
1270
|
+
GET {api} -> 编辑/详情拉取,参数由 fetchKey 决定
|
|
1271
|
+
POST {api} -> 新增
|
|
1272
|
+
PUT {api} -> 编辑
|
|
1273
|
+
DELETE {api} -> 删除
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
`$schema::字段名` 表示从当前表格行读取字段值,常用于删除按钮参数。
|
|
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
|
+
|
|
1301
|
+
## 如何扩展组件
|
|
1302
|
+
|
|
1303
|
+
### 扩展 Dashboard 顶部用户区域
|
|
1304
|
+
|
|
1305
|
+
业务项目可以创建 `frontend/extended/dash/components.tsx`,通过组件映射填充内置 Dashboard 页头右侧区域。
|
|
1306
|
+
|
|
1307
|
+
```tsx
|
|
1308
|
+
// frontend/extended/dash/components.tsx
|
|
1309
|
+
import type { DashComponentsMap } from '@_tc/template-core/fe'
|
|
1310
|
+
|
|
1311
|
+
const components = {
|
|
1312
|
+
'HeaderView.userArea': ({ projectInfo }) => {
|
|
1313
|
+
return <div>{projectInfo?.name}</div>
|
|
1314
|
+
},
|
|
1315
|
+
} satisfies DashComponentsMap
|
|
1316
|
+
|
|
1317
|
+
export default components
|
|
1318
|
+
```
|
|
1319
|
+
|
|
1320
|
+
当前支持的 Dashboard 组件扩展槽位:
|
|
1321
|
+
|
|
1322
|
+
- `HeaderView.userArea`:Dashboard 顶部右侧区域。
|
|
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
|
+
|
|
1346
|
+
### 扩展 SchemaForm 字段组件
|
|
1347
|
+
|
|
1348
|
+
1. 声明字段类型。
|
|
1349
|
+
2. 注册运行时组件。
|
|
1350
|
+
3. 在 `model` 的 `createFormOption`、`editFormOption`、`searchOption` 中使用。
|
|
1351
|
+
|
|
1352
|
+
类型声明:
|
|
1353
|
+
|
|
1354
|
+
```ts
|
|
1355
|
+
// typing/template-core.d.ts
|
|
1356
|
+
import '@_tc/template-core/fe/rc'
|
|
1357
|
+
import type { SelectProps } from '@_tc/template-core/fe/rc'
|
|
1358
|
+
|
|
1359
|
+
declare module '@_tc/template-core/fe/rc' {
|
|
1360
|
+
export namespace SchemaFormNamespace {
|
|
1361
|
+
interface FieldTypes {
|
|
1362
|
+
businessSelect: true
|
|
1363
|
+
}
|
|
1364
|
+
|
|
1365
|
+
interface PropsMap {
|
|
1366
|
+
businessSelect: SelectProps & {
|
|
1367
|
+
requestUrl?: string
|
|
1368
|
+
valueField?: string
|
|
1369
|
+
labelField?: string
|
|
1370
|
+
}
|
|
1371
|
+
}
|
|
1372
|
+
}
|
|
1373
|
+
}
|
|
1374
|
+
```
|
|
1375
|
+
|
|
1376
|
+
运行时注册:
|
|
1377
|
+
|
|
1378
|
+
```ts
|
|
1379
|
+
// frontend/extended/SchemaForm/data.ts
|
|
1380
|
+
import React from 'react'
|
|
1381
|
+
import type { SchemaFormComponentsMap } from '@_tc/template-core/fe/rc'
|
|
1382
|
+
|
|
1383
|
+
const componentsMap = {
|
|
1384
|
+
businessSelect: React.lazy(async () => ({
|
|
1385
|
+
default: (await import('../../components/BusinessSelect')).BusinessSelect,
|
|
1386
|
+
})),
|
|
1387
|
+
} satisfies SchemaFormComponentsMap
|
|
1388
|
+
|
|
1389
|
+
export default componentsMap
|
|
1390
|
+
```
|
|
1391
|
+
|
|
1392
|
+
model 中使用:
|
|
1393
|
+
|
|
1394
|
+
```ts
|
|
1395
|
+
status: {
|
|
1396
|
+
type: 'string',
|
|
1397
|
+
label: '状态',
|
|
1398
|
+
searchOption: {
|
|
1399
|
+
comType: 'businessSelect',
|
|
1400
|
+
requestUrl: '/api/status/options',
|
|
1401
|
+
valueField: 'value',
|
|
1402
|
+
labelField: 'label',
|
|
1403
|
+
},
|
|
1404
|
+
}
|
|
1405
|
+
```
|
|
1406
|
+
|
|
1407
|
+
### 扩展 SchemaPage CallCom
|
|
1408
|
+
|
|
1409
|
+
CallCom 是 SchemaPage 中的弹窗、抽屉、面板类组件。内置组件有:
|
|
1410
|
+
|
|
1411
|
+
- `createForm`
|
|
1412
|
+
- `editForm`
|
|
1413
|
+
- `detailPanel`
|
|
1414
|
+
|
|
1415
|
+
声明配置类型:
|
|
1416
|
+
|
|
1417
|
+
```ts
|
|
1418
|
+
// typing/template-core.d.ts
|
|
1419
|
+
import '@_tc/template-core/model'
|
|
1420
|
+
|
|
1421
|
+
declare module '@_tc/template-core/model' {
|
|
1422
|
+
export namespace CallComNamespace {
|
|
1423
|
+
interface ConfigMap {
|
|
1424
|
+
auditPanel: {
|
|
1425
|
+
title: string
|
|
1426
|
+
fetchKey: string
|
|
1427
|
+
approveApi?: string
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
|
|
1431
|
+
interface OptionMap {
|
|
1432
|
+
auditPanel: {
|
|
1433
|
+
visible?: boolean
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
}
|
|
1437
|
+
}
|
|
1438
|
+
```
|
|
1439
|
+
|
|
1440
|
+
注册运行时组件:
|
|
1441
|
+
|
|
1442
|
+
```ts
|
|
1443
|
+
// frontend/extended/SchemaPage/CallCom/data.ts
|
|
1444
|
+
import { lazy } from 'react'
|
|
1445
|
+
import type { CallComComponentsMap } from '@_tc/template-core/fe'
|
|
1446
|
+
|
|
1447
|
+
const componentsMap = {
|
|
1448
|
+
auditPanel: lazy(() => import('../../components/AuditPanel')),
|
|
1449
|
+
} satisfies CallComComponentsMap
|
|
1450
|
+
|
|
1451
|
+
export default componentsMap
|
|
1452
|
+
```
|
|
1453
|
+
|
|
1454
|
+
组件示例:
|
|
1455
|
+
|
|
1456
|
+
```tsx
|
|
1457
|
+
// frontend/src/components/AuditPanel.tsx
|
|
1458
|
+
import { eventsInfo, merge, schemaEventBus } from '@_tc/template-core/fe'
|
|
1459
|
+
|
|
1460
|
+
export default function AuditPanel(props: {
|
|
1461
|
+
data: Record<string, unknown>
|
|
1462
|
+
comName: 'auditPanel'
|
|
1463
|
+
}) {
|
|
1464
|
+
const closeAndRefresh = () => {
|
|
1465
|
+
schemaEventBus.getState().emitCom({
|
|
1466
|
+
type: merge(eventsInfo.closeCom, eventsInfo.initTable),
|
|
1467
|
+
})
|
|
1468
|
+
}
|
|
1469
|
+
|
|
1470
|
+
return (
|
|
1471
|
+
<div>
|
|
1472
|
+
<div>审核对象:{String(props.data.id ?? '')}</div>
|
|
1473
|
+
<button onClick={closeAndRefresh}>完成</button>
|
|
1474
|
+
</div>
|
|
1475
|
+
)
|
|
1476
|
+
}
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
model 中使用:
|
|
1480
|
+
|
|
1481
|
+
```ts
|
|
1482
|
+
componentConfig: {
|
|
1483
|
+
auditPanel: {
|
|
1484
|
+
title: '审核',
|
|
1485
|
+
fetchKey: 'id',
|
|
1486
|
+
approveApi: '/api/audit/approve',
|
|
1487
|
+
},
|
|
1488
|
+
},
|
|
1489
|
+
tableConfig: {
|
|
1490
|
+
rowButtons: [
|
|
1491
|
+
{
|
|
1492
|
+
label: '审核',
|
|
1493
|
+
eventKey: 'callComponent',
|
|
1494
|
+
eventOption: {
|
|
1495
|
+
comName: 'auditPanel',
|
|
1496
|
+
},
|
|
1497
|
+
},
|
|
1498
|
+
],
|
|
1499
|
+
},
|
|
1500
|
+
```
|
|
1501
|
+
|
|
1502
|
+
字段级配置使用 `${组件名}Option`:
|
|
1503
|
+
|
|
1504
|
+
```ts
|
|
1505
|
+
remark: {
|
|
1506
|
+
type: 'string',
|
|
1507
|
+
label: '备注',
|
|
1508
|
+
auditPanelOption: {
|
|
1509
|
+
visible: true,
|
|
1510
|
+
},
|
|
1511
|
+
}
|
|
1512
|
+
```
|
|
1513
|
+
|
|
1514
|
+
## 如何配置类型扩展
|
|
1515
|
+
|
|
1516
|
+
### tsconfig
|
|
1517
|
+
|
|
1518
|
+
如果项目分了后端、前端、model 多个 TS 上下文,确保它们都 include 同一份声明文件:
|
|
1519
|
+
|
|
1520
|
+
```json
|
|
1521
|
+
{
|
|
1522
|
+
"include": ["app/**/*", "model/**/*", "frontend/**/*", "typing/**/*.d.ts"]
|
|
1523
|
+
}
|
|
1524
|
+
```
|
|
1525
|
+
|
|
1526
|
+
### SchemaForm 类型扩展
|
|
1527
|
+
|
|
1528
|
+
扩展目标:
|
|
1529
|
+
|
|
1530
|
+
```ts
|
|
1531
|
+
declare module '@_tc/template-core/fe/rc' {
|
|
1532
|
+
export namespace SchemaFormNamespace {
|
|
1533
|
+
interface FieldTypes {}
|
|
1534
|
+
interface PropsMap {}
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
```
|
|
1538
|
+
|
|
1539
|
+
- `FieldTypes` 用来增加字段类型名。
|
|
1540
|
+
- `PropsMap` 用来绑定该字段的 props 类型。
|
|
1541
|
+
- 类型声明只负责 TS 校验,运行时还必须在 `frontend/extended/SchemaForm/data.ts` 注册组件。
|
|
1542
|
+
|
|
1543
|
+
### Model mode 类型扩展
|
|
1544
|
+
|
|
1545
|
+
`mode` 和对应的数据结构一起扩展。内置 `MB` 对应管理后台菜单结构 `MBMenuType`。
|
|
1546
|
+
|
|
1547
|
+
```ts
|
|
1548
|
+
// typing/template-core.d.ts
|
|
1549
|
+
import '@_tc/template-core/model'
|
|
1550
|
+
|
|
1551
|
+
declare module '@_tc/template-core/model' {
|
|
1552
|
+
interface ModelModeMap {
|
|
1553
|
+
portal: {
|
|
1554
|
+
portalConfig: {
|
|
1555
|
+
title: string
|
|
1556
|
+
theme?: 'light' | 'dark'
|
|
1557
|
+
}
|
|
1558
|
+
}
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
```
|
|
1562
|
+
|
|
1563
|
+
使用新 `mode`:
|
|
1564
|
+
|
|
1565
|
+
```ts
|
|
1566
|
+
import type { ModelDataType } from '@_tc/template-core/model'
|
|
1567
|
+
|
|
1568
|
+
const model: ModelDataType<'portal'> = {
|
|
1569
|
+
mode: 'portal',
|
|
1570
|
+
name: '门户',
|
|
1571
|
+
desc: '门户配置',
|
|
1572
|
+
homePage: '/',
|
|
1573
|
+
portalConfig: {
|
|
1574
|
+
title: 'Portal',
|
|
1575
|
+
theme: 'light',
|
|
1576
|
+
},
|
|
1577
|
+
}
|
|
1578
|
+
|
|
1579
|
+
export default model
|
|
1580
|
+
```
|
|
1581
|
+
|
|
1582
|
+
继续使用内置管理后台时:
|
|
1583
|
+
|
|
1584
|
+
```ts
|
|
1585
|
+
import type { ModelDataType } from '@_tc/template-core/model'
|
|
1586
|
+
|
|
1587
|
+
const model: ModelDataType<'MB'> = {
|
|
1588
|
+
mode: 'MB',
|
|
1589
|
+
name: '商品后台',
|
|
1590
|
+
desc: '商品管理',
|
|
1591
|
+
homePage: '/_sidebar_/product?projk=demo',
|
|
1592
|
+
menu: [],
|
|
1593
|
+
}
|
|
1594
|
+
```
|
|
1595
|
+
|
|
1596
|
+
### CallCom 类型扩展
|
|
1597
|
+
|
|
1598
|
+
扩展目标:
|
|
1599
|
+
|
|
1600
|
+
```ts
|
|
1601
|
+
declare module '@_tc/template-core/model' {
|
|
1602
|
+
export namespace CallComNamespace {
|
|
1603
|
+
interface ConfigMap {}
|
|
1604
|
+
interface OptionMap {}
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
```
|
|
1608
|
+
|
|
1609
|
+
- `ConfigMap` 对应 `schemaConfig.componentConfig.xxx`。
|
|
1610
|
+
- `OptionMap` 对应字段上的 `xxxOption`。
|
|
1611
|
+
- 运行时组件注册在 `frontend/extended/SchemaPage/CallCom/data.ts`。
|
|
1612
|
+
|
|
1613
|
+
### KoaApp 类型扩展
|
|
1614
|
+
|
|
1615
|
+
使用方推荐增强根包 `@_tc/template-core`:
|
|
1616
|
+
|
|
1617
|
+
```ts
|
|
1618
|
+
// typing/template-core.d.ts
|
|
1619
|
+
import '@_tc/template-core'
|
|
1620
|
+
|
|
1621
|
+
declare module '@_tc/template-core' {
|
|
1622
|
+
namespace FrameworkAugment {
|
|
1623
|
+
interface IServiceAugmented {
|
|
1624
|
+
product: {
|
|
1625
|
+
list(): Promise<unknown[]>
|
|
1626
|
+
}
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1629
|
+
interface IControllerAugmented {
|
|
1630
|
+
product: {
|
|
1631
|
+
list(ctx: import('@_tc/template-core').Ctx): Promise<void>
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
interface IExtendsAugmented {
|
|
1636
|
+
redis: {
|
|
1637
|
+
get(key: string): Promise<string | null>
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
interface IMiddlewaresAugmented {
|
|
1642
|
+
auth: import('koa').Middleware
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
interface AppConfigAugmented {
|
|
1646
|
+
authSecret: string
|
|
1647
|
+
}
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
```
|
|
1651
|
+
|
|
1652
|
+
使用:
|
|
1653
|
+
|
|
1654
|
+
```ts
|
|
1655
|
+
import type { KoaApp } from '@_tc/template-core'
|
|
1656
|
+
|
|
1657
|
+
export default (app: KoaApp) => {
|
|
1658
|
+
app.config.authSecret
|
|
1659
|
+
app.service.product.list()
|
|
1660
|
+
app.extends.$fetch.get('https://example.com/api')
|
|
1661
|
+
app.extends.redis.get('token')
|
|
1662
|
+
}
|
|
1663
|
+
```
|
|
1664
|
+
|
|
1665
|
+
如果在 TemplateCore 仓库源码内部扩展,声明目标通常是内部别名 `@tc/core`;npm 使用方不要依赖 `@tc/*` 内部路径。
|
|
1666
|
+
|
|
1667
|
+
## 扩展自定义前端页面
|
|
1668
|
+
|
|
1669
|
+
新增应用入口:
|
|
1670
|
+
|
|
1671
|
+
```text
|
|
1672
|
+
frontend/admin/admin.entry.tsx
|
|
1673
|
+
```
|
|
1674
|
+
|
|
1675
|
+
入口文件名必须包含 `.entry.`,构建器才会扫描。
|
|
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
|
+
|
|
1726
|
+
扩展 Dashboard 路由:
|
|
1727
|
+
|
|
1728
|
+
```tsx
|
|
1729
|
+
// frontend/extended/dash/customRoutes.tsx
|
|
1730
|
+
import type { DashRoutesExtender } from '@_tc/template-core/fe'
|
|
1731
|
+
|
|
1732
|
+
const extendDashRoutes: DashRoutesExtender = ({ topRoutes, sidebarRoutes }) => {
|
|
1733
|
+
topRoutes.push({
|
|
1734
|
+
path: 'custom-page',
|
|
1735
|
+
component: <div>Custom Page</div>,
|
|
1736
|
+
})
|
|
1737
|
+
|
|
1738
|
+
sidebarRoutes.push({
|
|
1739
|
+
path: 'custom-sidebar-page',
|
|
1740
|
+
component: <div>Custom Sidebar Page</div>,
|
|
1741
|
+
})
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
export default extendDashRoutes
|
|
1745
|
+
```
|
|
1746
|
+
|
|
1747
|
+
**路径规则说明**:
|
|
1748
|
+
|
|
1749
|
+
- **topRoutes**:追加到 Dashboard 顶层路由,路径相对于 `/dash`
|
|
1750
|
+
- 示例:`path: 'custom-page'` → 访问路径为 `/dash/custom-page`
|
|
1751
|
+
- 不要写成 `/custom-page`,使用相对路径即可
|
|
1752
|
+
|
|
1753
|
+
- **sidebarRoutes**:追加到侧边栏容器的子路由,路径相对于 `/dash/_sidebar_`
|
|
1754
|
+
- 示例:`path: 'custom-sidebar-page'` → 访问路径为 `/dash/_sidebar_/custom-sidebar-page`
|
|
1755
|
+
- 适用于 `menuLayout: 'left'` 的项目
|
|
1756
|
+
|
|
1757
|
+
model 中用 `custom` 菜单指向自定义路径:
|
|
1758
|
+
|
|
1759
|
+
```ts
|
|
1760
|
+
{
|
|
1761
|
+
key: 'custom',
|
|
1762
|
+
name: '自定义页面',
|
|
1763
|
+
menuType: 'module',
|
|
1764
|
+
moduleType: 'custom',
|
|
1765
|
+
customConfig: {
|
|
1766
|
+
path: '/custom-page', // 注意:这里使用完整路径,以 / 开头
|
|
1767
|
+
},
|
|
1768
|
+
}
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
## 前端构建 buildFE
|
|
1772
|
+
|
|
1773
|
+
开发构建:
|
|
1774
|
+
|
|
1775
|
+
```ts
|
|
1776
|
+
import { buildFE } from '@_tc/template-core/bundler'
|
|
1777
|
+
|
|
1778
|
+
buildFE('dev')
|
|
1779
|
+
```
|
|
1780
|
+
|
|
1781
|
+
生产构建:
|
|
1782
|
+
|
|
1783
|
+
```ts
|
|
1784
|
+
buildFE('prod')
|
|
1785
|
+
```
|
|
1786
|
+
|
|
1787
|
+
默认输出到当前导入格式对应的框架静态目录,例如 `esm/app/public/dist` 或 `cjs/app/public/dist`。如果要输出到项目:
|
|
1788
|
+
|
|
1789
|
+
```ts
|
|
1790
|
+
buildFE('prod', {
|
|
1791
|
+
output: 'run',
|
|
1792
|
+
})
|
|
1793
|
+
```
|
|
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
|
+
|
|
1948
|
+
## 注意事项
|
|
1949
|
+
|
|
1950
|
+
- 不要在项目代码里引用 `dist/fe/*`、`dist/model/*` 这类构建产物路径。
|
|
1951
|
+
- npm 使用方只使用公开入口:`@_tc/template-core/*`。
|
|
1952
|
+
- SchemaForm 和 CallCom 的类型扩展、运行时注册都要做,少一个就只会“类型通过但页面不显示”或“页面能配但类型报错”。
|
|
1953
|
+
- `model` 数组合并依赖稳定 `key`。
|
|
1954
|
+
- Dashboard 默认需要 URL 带 `?projk=项目key`。
|
|
1955
|
+
- Dashboard 登录守卫放在 `frontend/extended/dash/routeGuard.ts`;登录页通常不在 Dash 路由下,返回登录页 URL 即可。
|
|
1956
|
+
- 服务端兜底守卫放在业务 `app/router-guard.ts|js`,不是 `app/business` 子目录。
|
|
1957
|
+
- 前端入口必须命名为 `.entry.tsx`、`.entry.ts`、`.entry.jsx` 或 `.entry.js`。
|
|
1958
|
+
- 入口同目录的 `.html` 只能作为插槽文件使用,不能写完整 HTML 文档;页面外壳始终由 `app/view/entry.tpl` 生成。
|