@_tc/template-core 0.0.1-bate.36 → 0.0.1-bate.38
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/cjs/app/controller/base.js +3 -3
- package/cjs/app/controller/project.js +1 -1
- package/cjs/app/controller/view.js +16 -7
- package/cjs/app/middleware/api-params-verify.js +10 -1
- package/cjs/app/middleware/error-handle.js +9 -3
- package/cjs/app/middleware/project-handler.js +1 -1
- package/cjs/app/router/view.js +3 -1
- package/cjs/app/router-schema/project.js +1 -1
- package/cjs/app/service/project.js +5 -0
- package/cjs/bundler/defaultAlias.js +5 -0
- package/cjs/bundler/dev.js +4 -3
- package/cjs/bundler/index.js +2 -1
- package/cjs/bundler/prod.js +4 -3
- package/cjs/bundler/utils.js +52 -23
- package/cjs/packages/common/LRUCache.js +4 -0
- package/cjs/packages/common/array/index.js +43 -0
- package/cjs/packages/common/cache/LRUCache.js +45 -0
- package/cjs/packages/common/cache/index.js +4 -0
- package/cjs/packages/common/guards/index.js +34 -0
- package/cjs/packages/common/i18n/default.js +95 -0
- package/cjs/packages/common/i18n/en-US.js +95 -0
- package/cjs/packages/common/i18n/index.js +178 -0
- package/cjs/packages/common/i18n/locales.js +17 -0
- package/cjs/packages/common/i18n/types.js +1 -0
- package/cjs/packages/common/index.js +65 -0
- package/cjs/packages/common/log/index.js +160 -0
- package/cjs/packages/common/number/index.js +14 -0
- package/cjs/packages/common/object/filterEmpty.js +32 -0
- package/cjs/packages/common/object/filtereEmpty.js +5 -0
- package/cjs/packages/common/object/index.js +26 -0
- package/cjs/packages/common/string/index.js +17 -0
- package/cjs/packages/common/types/index.js +1 -0
- package/cjs/packages/core/index.js +18 -13
- package/cjs/packages/core/loader/config.js +4 -2
- package/cjs/packages/core/loader/controller.js +2 -3
- package/cjs/packages/core/loader/extend.js +1 -2
- package/cjs/packages/core/loader/middleware.js +2 -3
- package/cjs/packages/core/loader/model.js +10 -6
- package/cjs/packages/core/loader/router-schema.js +4 -2
- package/cjs/packages/core/loader/router.js +24 -11
- package/cjs/packages/core/loader/service.js +2 -2
- package/cjs/packages/utils/runFileFn.js +46 -1
- package/esm/app/controller/base.js +3 -3
- package/esm/app/controller/project.js +3 -3
- package/esm/app/controller/view.js +16 -7
- package/esm/app/middleware/api-params-verify.js +10 -1
- package/esm/app/middleware/error-handle.js +9 -3
- package/esm/app/middleware/project-handler.js +1 -1
- package/esm/app/router/view.js +3 -1
- package/esm/app/router-schema/project.js +1 -1
- package/esm/app/service/project.js +5 -0
- package/esm/bundler/defaultAlias.js +4 -0
- package/esm/bundler/dev.js +4 -3
- package/esm/bundler/index.js +2 -1
- package/esm/bundler/prod.js +4 -3
- package/esm/bundler/utils.js +52 -23
- package/esm/index.js +2 -2
- package/esm/packages/common/LRUCache.js +2 -0
- package/esm/packages/common/array/index.js +37 -0
- package/esm/packages/common/cache/LRUCache.js +43 -0
- package/esm/packages/common/cache/index.js +2 -0
- package/esm/packages/common/guards/index.js +26 -0
- package/esm/packages/common/i18n/default.js +93 -0
- package/esm/packages/common/i18n/en-US.js +93 -0
- package/esm/packages/common/i18n/index.js +162 -0
- package/esm/packages/common/i18n/locales.js +11 -0
- package/esm/packages/common/i18n/types.js +0 -0
- package/esm/packages/common/index.js +13 -0
- package/esm/packages/common/log/index.js +146 -0
- package/esm/packages/common/number/index.js +11 -0
- package/esm/packages/common/object/filterEmpty.js +29 -0
- package/esm/packages/common/object/filtereEmpty.js +2 -0
- package/esm/packages/common/object/index.js +20 -0
- package/esm/packages/common/string/index.js +13 -0
- package/esm/packages/common/types/index.js +0 -0
- package/esm/packages/core/index.js +18 -14
- package/esm/packages/core/loader/config.js +4 -3
- package/esm/packages/core/loader/controller.js +2 -4
- package/esm/packages/core/loader/extend.js +1 -3
- package/esm/packages/core/loader/middleware.js +2 -4
- package/esm/packages/core/loader/model.js +10 -7
- package/esm/packages/core/loader/router-schema.js +4 -3
- package/esm/packages/core/loader/router.js +24 -12
- package/esm/packages/core/loader/service.js +2 -3
- package/esm/packages/utils/runFileFn.js +47 -1
- package/fe/frontend/dash/Dashboard.d.ts +7 -0
- package/fe/frontend/dash/Dashboard.js +73 -0
- package/fe/frontend/dash/dash.entry.d.ts +2 -0
- package/fe/frontend/dash/dash.entry.js +80 -0
- package/fe/frontend/index.d.ts +3 -0
- package/fe/frontend/index.js +1 -0
- package/fe/frontend/main.css +2 -184
- package/fe/frontend/main.d.ts +10 -3
- package/fe/frontend/main.js +15 -4
- package/fe/frontend/testPage/testPage.entry.js +1 -2
- package/fe/frontend/typing/window.d.ts +7 -0
- package/fe/frontend/typing/window.js +1 -0
- package/fe/frontend/widgets/api/baseInfo.d.ts +31 -0
- package/fe/frontend/widgets/api/baseInfo.js +15 -0
- package/fe/frontend/widgets/common/CRUD/CRUD.d.ts +70 -0
- package/fe/frontend/widgets/common/CRUD/CRUD.js +208 -0
- package/fe/frontend/widgets/common/CRUD/index.d.ts +2 -0
- package/fe/frontend/widgets/common/CRUD/index.js +1 -0
- package/fe/frontend/widgets/common/auth/index.d.ts +7 -0
- package/fe/frontend/widgets/common/auth/index.js +20 -0
- package/fe/frontend/widgets/common/generateMenuData.d.ts +4 -0
- package/fe/frontend/widgets/common/generateMenuData.js +14 -0
- package/fe/frontend/widgets/common/importComponent.d.ts +5 -0
- package/fe/frontend/widgets/common/importComponent.js +8 -0
- package/fe/frontend/widgets/common/language.d.ts +2 -0
- package/fe/frontend/widgets/common/language.js +9 -0
- package/fe/frontend/widgets/common/logFn/index.d.ts +4 -0
- package/fe/frontend/widgets/common/logFn/index.js +8 -0
- package/fe/frontend/widgets/common/menu.d.ts +34 -0
- package/fe/frontend/widgets/common/menu.js +101 -0
- package/fe/frontend/widgets/common/request.d.ts +36 -0
- package/fe/frontend/widgets/common/request.js +133 -0
- package/fe/frontend/widgets/components/BasePage/HeaderView.d.ts +9 -0
- package/fe/frontend/widgets/components/BasePage/HeaderView.js +16 -0
- package/fe/frontend/widgets/components/Router/index.d.ts +9 -0
- package/fe/frontend/widgets/components/Router/index.js +11 -0
- package/fe/frontend/widgets/components/Router/type.d.ts +2 -0
- package/fe/frontend/widgets/components/Router/type.js +1 -0
- package/fe/frontend/widgets/defaultPages/Iframe/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Iframe/index.js +14 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.d.ts +7 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.js +94 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.d.ts +13 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.js +124 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.js +6 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.js +63 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.d.ts +11 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +188 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.d.ts +8 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.js +6 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/index.js +1 -0
- package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.d.ts +10 -0
- package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.js +14 -0
- package/fe/frontend/widgets/defaultPages/Schema/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/index.js +74 -0
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.d.ts +50 -0
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +4 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.d.ts +42 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +70 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +47 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +26 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.js +8 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.js +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.js +115 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +7 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +36 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +38 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +16 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +17 -0
- package/fe/frontend/widgets/defaultPages/SlotPage/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SlotPage/index.js +26 -0
- package/fe/frontend/widgets/defaultPages/Todo.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Todo.js +5 -0
- package/fe/frontend/widgets/hooks/useCurrentMenuData.d.ts +19 -0
- package/fe/frontend/widgets/hooks/useCurrentMenuData.js +28 -0
- package/fe/frontend/widgets/hooks/useRouterParams.d.ts +5 -0
- package/fe/frontend/widgets/hooks/useRouterParams.js +11 -0
- package/fe/frontend/widgets/store/mode.d.ts +19 -0
- package/fe/frontend/widgets/store/mode.js +37 -0
- package/fe/model/types/data/button.d.ts +32 -0
- package/fe/model/types/data/button.js +16 -0
- package/fe/model/types/data/component.d.ts +61 -0
- package/fe/model/types/data/component.js +11 -0
- package/fe/model/types/data/fetchInfo.d.ts +20 -0
- package/fe/model/types/data/fetchInfo.js +1 -0
- package/fe/model/types/data/schema.d.ts +98 -0
- package/fe/model/types/data/schema.js +1 -0
- package/fe/model/types/data/search.d.ts +7 -0
- package/fe/model/types/data/search.js +1 -0
- package/fe/model/types/menuType.d.ts +73 -0
- package/fe/model/types/menuType.js +1 -0
- package/fe/model/types/model.d.ts +33 -0
- package/fe/model/types/model.js +1 -0
- package/fe/packages/common/array/index.d.ts +7 -0
- package/fe/packages/common/array/index.js +40 -0
- package/fe/packages/common/cache/LRUCache.d.ts +13 -0
- package/fe/packages/common/cache/LRUCache.js +47 -0
- package/fe/packages/common/cache/index.d.ts +2 -0
- package/fe/packages/common/cache/index.js +1 -0
- package/fe/packages/common/guards/index.d.ts +9 -0
- package/fe/packages/common/guards/index.js +24 -0
- package/fe/packages/common/i18n/default.d.ts +92 -0
- package/fe/packages/common/i18n/default.js +90 -0
- package/fe/packages/common/i18n/en-US.d.ts +92 -0
- package/fe/packages/common/i18n/en-US.js +90 -0
- package/fe/packages/common/i18n/index.d.ts +43 -0
- package/fe/packages/common/i18n/index.js +173 -0
- package/fe/packages/common/i18n/locales.d.ts +8 -0
- package/fe/packages/common/i18n/locales.js +10 -0
- package/fe/packages/common/i18n/types.d.ts +71 -0
- package/fe/packages/common/i18n/types.js +1 -0
- package/fe/packages/common/index.d.ts +10 -0
- package/fe/packages/common/index.js +9 -0
- package/fe/packages/common/log/index.d.ts +33 -0
- package/fe/packages/common/log/index.js +176 -0
- package/fe/packages/common/number/index.d.ts +3 -0
- package/fe/packages/common/number/index.js +10 -0
- package/fe/packages/common/object/filterEmpty.d.ts +3 -0
- package/fe/packages/common/object/filterEmpty.js +33 -0
- package/fe/packages/common/object/index.d.ts +5 -0
- package/fe/packages/common/object/index.js +25 -0
- package/fe/packages/common/string/index.d.ts +4 -0
- package/fe/packages/common/string/index.js +17 -0
- package/fe/packages/common/types/index.d.ts +4 -0
- package/fe/packages/common/types/index.js +1 -0
- package/fe/packages/ui/react/components/Button/Button.d.ts +29 -10
- package/fe/packages/ui/react/components/Button/Button.js +53 -23
- package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +2 -2
- package/fe/packages/ui/react/components/Button/SumbitButton.js +3 -10
- package/fe/packages/ui/react/components/Button/index.d.ts +1 -1
- package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +1 -1
- package/fe/packages/ui/react/components/Checkbox/Checkbox.js +5 -3
- package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
- package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
- package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +3 -1
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +85 -4
- package/fe/packages/ui/react/components/DataTable/{data-table.d.ts → index.d.ts} +10 -4
- package/fe/packages/ui/react/components/DataTable/{data-table.js → index.js} +58 -44
- package/fe/packages/ui/react/components/Date/Calendar.js +4 -3
- package/fe/packages/ui/react/components/Date/Date.d.ts +5 -3
- package/fe/packages/ui/react/components/Date/Date.js +71 -48
- package/fe/packages/ui/react/components/Date/TimePicker.js +3 -1
- package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
- package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
- package/fe/packages/ui/react/components/Date/locales.d.ts +1 -0
- package/fe/packages/ui/react/components/Date/locales.js +7 -38
- package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +29 -0
- package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
- package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Drawer/index.js +1 -0
- package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +25 -0
- package/fe/packages/ui/react/components/Dropdown/Dropdown.js +28 -0
- package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
- package/fe/packages/ui/react/components/Form/Form.js +1 -1
- package/fe/packages/ui/react/components/Form/FormItem.js +1 -1
- package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +45 -0
- package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/data.js +9 -1
- package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/index.d.ts +15 -14
- package/fe/packages/ui/react/components/Form/SchemaForm/index.js +79 -0
- package/fe/packages/ui/react/components/Form/index.d.ts +1 -1
- package/fe/packages/ui/react/components/Form/index.js +1 -1
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +15 -12
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +5 -2
- package/fe/packages/ui/react/components/Input/Input.d.ts +5 -1
- package/fe/packages/ui/react/components/Input/Input.js +5 -4
- package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +28 -0
- package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
- package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
- package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
- package/fe/packages/ui/react/components/Label/Label.js +2 -2
- package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
- package/fe/packages/ui/react/components/Menu/Menu.js +102 -0
- package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
- package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
- package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
- package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +10 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.js +169 -0
- package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
- package/fe/packages/ui/react/components/Menu/index.js +5 -0
- package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +59 -0
- package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
- package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
- package/fe/packages/ui/react/components/Menu/utils.js +7 -0
- package/fe/packages/ui/react/components/Message/Message.js +4 -1
- package/fe/packages/ui/react/components/Modal/Modal.d.ts +3 -1
- package/fe/packages/ui/react/components/Modal/Modal.js +6 -43
- package/fe/packages/ui/react/components/Modal/ModalManager.js +4 -3
- package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +23 -0
- package/fe/packages/ui/react/components/Overlay/Overlay.js +53 -0
- package/fe/packages/ui/react/components/Overlay/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Overlay/index.js +1 -0
- package/fe/packages/ui/react/components/{Pagination.js → Pagination/Pagination.js} +4 -4
- package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Pagination/index.js +1 -0
- package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
- package/fe/packages/ui/react/components/Popup/Popup.js +81 -0
- package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Popup/index.js +1 -0
- package/fe/packages/ui/react/components/Search/Search.d.ts +2 -2
- package/fe/packages/ui/react/components/Search/Search.js +3 -3
- package/fe/packages/ui/react/components/Select/Select.d.ts +5 -0
- package/fe/packages/ui/react/components/Select/Select.js +52 -109
- package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
- package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +2 -2
- package/fe/packages/ui/react/components/Switch/Switch.js +3 -1
- package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +5 -4
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +23 -21
- package/fe/packages/ui/react/components/TableSearch/lang.js +5 -14
- package/fe/packages/ui/react/components/{Textarea.d.ts → Textarea/Textarea.d.ts} +11 -3
- package/fe/packages/ui/react/components/Textarea/Textarea.js +37 -0
- package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Textarea/index.js +1 -0
- package/fe/packages/ui/react/components/{Tooltip.d.ts → Tooltip/Tooltip.d.ts} +2 -2
- package/fe/packages/ui/react/components/Tooltip/Tooltip.js +79 -0
- package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
- package/fe/packages/ui/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +9 -11
- package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
- package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
- package/fe/packages/ui/react/components/Upload/ImageUpload.js +18 -6
- package/fe/packages/ui/react/components/Upload/Upload.js +2 -1
- package/fe/packages/ui/react/components/{breadcrumb.js → breadcrumb/breadcrumb.js} +15 -12
- package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
- package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +49 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +137 -0
- package/fe/packages/ui/react/components/index.d.ts +7 -1
- package/fe/packages/ui/react/components/index.js +7 -1
- package/fe/packages/ui/react/components/table/index.d.ts +2 -0
- package/fe/packages/ui/react/components/table/index.js +1 -0
- package/fe/packages/ui/react/components/table/table.js +20 -0
- package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
- package/fe/packages/ui/react/components/testPage/MenuTestPage.js +104 -0
- package/fe/packages/ui/react/components/testPage/index.js +277 -81
- package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +30 -0
- package/fe/packages/ui/react/hooks/useExecuteOnce.js +57 -0
- package/fe/packages/ui/react/hooks/useInit.d.ts +1 -1
- package/fe/packages/ui/react/hooks/useInit.js +1 -1
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +1 -6
- package/fe/packages/ui/react/hooks/useRefState.d.ts +30 -0
- package/fe/packages/ui/react/hooks/useRefState.js +29 -0
- package/fe/packages/ui/react/hooks/useWatch.d.ts +23 -0
- package/fe/packages/ui/react/hooks/useWatch.js +87 -0
- package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
- package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
- package/fe/packages/ui/react/i18n/I18nProvider.d.ts +31 -0
- package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
- package/fe/packages/ui/react/i18n/index.d.ts +4 -0
- package/fe/packages/ui/react/i18n/index.js +3 -0
- package/fe/packages/ui/react/i18n/useI18n.d.ts +13 -0
- package/fe/packages/ui/react/i18n/useI18n.js +18 -0
- package/fe/packages/ui/react/index.css +238 -0
- package/fe/packages/ui/react/index.d.ts +2 -0
- package/fe/packages/ui/react/index.js +2 -0
- package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
- package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
- package/fe/packages/ui/react/lib/export.d.ts +2 -2
- package/fe/packages/ui/react/stores/language.d.ts +3 -12
- package/fe/packages/ui/react/stores/language.js +2 -51
- package/fe/typings/type.d.ts +5 -0
- package/fe/typings/type.js +1 -0
- package/model/index.d.ts +2 -0
- package/model/types/data/button.d.ts +32 -0
- package/model/types/data/component.d.ts +61 -0
- package/model/types/data/fetchInfo.d.ts +20 -0
- package/model/types/data/schema.d.ts +98 -0
- package/model/types/data/search.d.ts +7 -0
- package/model/types/index.d.ts +2 -0
- package/model/types/menuType.d.ts +73 -0
- package/model/types/model.d.ts +33 -0
- package/model/types/test.d.ts +2 -0
- package/package.json +20 -6
- package/types/app/controller/base.d.ts +3 -3
- package/types/app/router/view.d.ts +2 -3
- package/types/app/service/project.d.ts +29 -4
- package/types/app/type.d.ts +1 -0
- package/types/app/typings.d.ts +12 -21
- package/types/bundler/defaultAlias.d.ts +3 -0
- package/types/bundler/utils.d.ts +1 -1
- package/types/config/config.default.d.ts +14 -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/i18n/default.d.ts +86 -0
- package/types/packages/common/i18n/en-US.d.ts +86 -0
- package/types/packages/common/i18n/index.d.ts +18 -0
- package/types/packages/common/i18n/locales.d.ts +7 -0
- package/types/packages/common/i18n/types.d.ts +46 -0
- package/types/packages/common/index.d.ts +9 -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/index.d.ts +1 -1
- package/types/packages/core/loader/router.d.ts +1 -1
- package/types/packages/core/types.d.ts +12 -3
- package/types/packages/utils/runFileFn.d.ts +5 -3
- package/fe/packages/ui/react/components/ConfirmDialog.js +0 -9
- package/fe/packages/ui/react/components/Dropdown.d.ts +0 -16
- package/fe/packages/ui/react/components/Dropdown.js +0 -54
- package/fe/packages/ui/react/components/Form/SchemeForm/data.d.ts +0 -51
- package/fe/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
- package/fe/packages/ui/react/components/Textarea.js +0 -35
- package/fe/packages/ui/react/components/Tooltip.js +0 -118
- package/fe/packages/ui/react/components/table.js +0 -20
- package/fe/packages/ui/react/locales/index.d.ts +0 -8
- package/fe/packages/ui/react/locales/index.js +0 -6
- /package/fe/packages/ui/react/components/{ConfirmDialog.d.ts → ConfirmDialog/ConfirmDialog.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{Pagination.d.ts → Pagination/Pagination.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{TreeSelect.d.ts → TreeSelect/TreeSelect.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{breadcrumb.d.ts → breadcrumb/breadcrumb.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{table.d.ts → table/table.d.ts} +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
require("../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_packages_core_paths = require("../paths.js");
|
|
3
|
-
const require_packages_utils_path = require("../../utils/path.js");
|
|
4
3
|
const require_packages_utils_loadFile = require("../../utils/loadFile.js");
|
|
5
4
|
const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
|
|
6
5
|
require("../../utils/index.js");
|
|
@@ -19,7 +18,7 @@ var extend_default = (app) => {
|
|
|
19
18
|
console.log("\x1B[31m%s\x1B[0m", `[extend loader error] name:${fileName} is already in app`);
|
|
20
19
|
return;
|
|
21
20
|
}
|
|
22
|
-
const exs = require_packages_utils_runFileFn.runFileFn(
|
|
21
|
+
const exs = require_packages_utils_runFileFn.runFileFn(filePath)(app);
|
|
23
22
|
if (exs instanceof Promise) (async () => {
|
|
24
23
|
app.extends[fileName] = await exs;
|
|
25
24
|
})();
|
|
@@ -14,12 +14,11 @@ require("../../utils/index.js");
|
|
|
14
14
|
*/
|
|
15
15
|
var middleware_default = (app) => {
|
|
16
16
|
/**
|
|
17
|
-
* xx/app/middleware/a/a.js -> app.middleware.a.a
|
|
18
|
-
* require('app/middleware/a/a.js')(app)
|
|
17
|
+
* xx/app/middleware/a/a.(js|ts) -> app.middleware.a.a
|
|
19
18
|
*/
|
|
20
19
|
app.middlewares = require_packages_core_paths.getAppPaths(app).reduce((preData, currentPath) => {
|
|
21
20
|
const middlewares = require_packages_utils_loadFile.loadFileFn(currentPath, "middleware", { loadFileCallback: (path) => {
|
|
22
|
-
return require_packages_utils_runFileFn.runFileFn(
|
|
21
|
+
return require_packages_utils_runFileFn.runFileFn(path)(app);
|
|
23
22
|
} });
|
|
24
23
|
return {
|
|
25
24
|
...preData,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
const require_runtime = require("../../../_virtual/_rolldown/runtime.js");
|
|
2
2
|
const require_packages_utils_loadFile = require("../../utils/loadFile.js");
|
|
3
|
+
const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
|
|
3
4
|
let path = require("path");
|
|
4
5
|
let lodash = require("lodash");
|
|
5
6
|
lodash = require_runtime.__toESM(lodash, 1);
|
|
6
7
|
//#region packages/core/loader/model.ts
|
|
7
8
|
/**
|
|
8
|
-
*
|
|
9
|
+
* 获取使用方的 跟路径下的 model文件夹
|
|
9
10
|
* @param app
|
|
10
11
|
*/
|
|
11
12
|
var modelLoader = (app) => {
|
|
@@ -17,10 +18,10 @@ var modelLoader = (app) => {
|
|
|
17
18
|
/**
|
|
18
19
|
* 1.遍历当前文件夹
|
|
19
20
|
* 2.根据路径区分 model | project
|
|
20
|
-
* 3.根据不同的
|
|
21
|
+
* 3.根据不同的 类型 获取key
|
|
21
22
|
*/
|
|
22
23
|
loadFileCallback: (file) => {
|
|
23
|
-
if (file
|
|
24
|
+
if (!isModelIndexFile(file)) {
|
|
24
25
|
const filePathChunk = file.split(path.sep);
|
|
25
26
|
if (filePathChunk[filePathChunk.length - 2] === "project") {
|
|
26
27
|
const modelKey = filePathChunk[filePathChunk.length - 3];
|
|
@@ -76,7 +77,7 @@ var setProject = (config, modelKey, key, file) => {
|
|
|
76
77
|
const projectItem = {
|
|
77
78
|
key,
|
|
78
79
|
modelKey,
|
|
79
|
-
...
|
|
80
|
+
...require_packages_utils_runFileFn.runFileFn(file)
|
|
80
81
|
};
|
|
81
82
|
currentModel.project[key] = projectItem;
|
|
82
83
|
};
|
|
@@ -92,16 +93,19 @@ var setModel = (config, key, filePath) => {
|
|
|
92
93
|
if (!modelItem) {
|
|
93
94
|
const newModel = {
|
|
94
95
|
model: { key },
|
|
95
|
-
project: {
|
|
96
|
+
project: {}
|
|
96
97
|
};
|
|
97
98
|
config.push(newModel);
|
|
98
99
|
modelItem = newModel;
|
|
99
100
|
}
|
|
100
101
|
if (filePath) modelItem.model = {
|
|
101
|
-
...
|
|
102
|
+
...require_packages_utils_runFileFn.runFileFn(filePath),
|
|
102
103
|
key
|
|
103
104
|
};
|
|
104
105
|
return modelItem;
|
|
105
106
|
};
|
|
107
|
+
function isModelIndexFile(file) {
|
|
108
|
+
return file.indexOf(`model${path.sep}index.js`) !== -1 || file.indexOf(`model${path.sep}index.ts`) !== -1;
|
|
109
|
+
}
|
|
106
110
|
//#endregion
|
|
107
111
|
module.exports = modelLoader;
|
|
@@ -2,6 +2,8 @@ require("../../../_virtual/_rolldown/runtime.js");
|
|
|
2
2
|
const require_packages_core_paths = require("../paths.js");
|
|
3
3
|
const require_packages_utils_path = require("../../utils/path.js");
|
|
4
4
|
const require_packages_utils_loadFile = require("../../utils/loadFile.js");
|
|
5
|
+
const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
|
|
6
|
+
require("../../utils/index.js");
|
|
5
7
|
//#region packages/core/loader/router-schema.ts
|
|
6
8
|
/**
|
|
7
9
|
*
|
|
@@ -9,7 +11,7 @@ const require_packages_utils_loadFile = require("../../utils/loadFile.js");
|
|
|
9
11
|
*
|
|
10
12
|
* @param app
|
|
11
13
|
*
|
|
12
|
-
* xx/app/router-schema/**.js
|
|
14
|
+
* xx/app/router-schema/**.(js|ts)
|
|
13
15
|
*
|
|
14
16
|
* 输出:
|
|
15
17
|
* app.routerSchema = {
|
|
@@ -24,7 +26,7 @@ var router_schema_default = (app) => {
|
|
|
24
26
|
require_packages_utils_loadFile.loadFileFn(currentPath, "router-schema", { preProcessingFileCallback(file) {
|
|
25
27
|
routerSchema = {
|
|
26
28
|
...routerSchema,
|
|
27
|
-
...
|
|
29
|
+
...require_packages_utils_runFileFn.runFileFn(require_packages_utils_path.resolve(file))
|
|
28
30
|
};
|
|
29
31
|
} });
|
|
30
32
|
});
|
|
@@ -4,6 +4,7 @@ const require_packages_utils_path = require("../../utils/path.js");
|
|
|
4
4
|
const require_packages_utils_loadFile = require("../../utils/loadFile.js");
|
|
5
5
|
const require_packages_utils_runFileFn = require("../../utils/runFileFn.js");
|
|
6
6
|
require("../../utils/index.js");
|
|
7
|
+
let fs = require("fs");
|
|
7
8
|
let koa_router = require("koa-router");
|
|
8
9
|
koa_router = require_runtime.__toESM(koa_router, 1);
|
|
9
10
|
//#region packages/core/loader/router.ts
|
|
@@ -13,25 +14,33 @@ koa_router = require_runtime.__toESM(koa_router, 1);
|
|
|
13
14
|
* 解析 xx/app/router/下的所有文件 加载到 koa-router上
|
|
14
15
|
*/
|
|
15
16
|
var router_default = (app) => {
|
|
16
|
-
const router = new koa_router.default();
|
|
17
17
|
let routerGuard;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const businessPath = require_packages_core_paths.getAppPath(app, "business");
|
|
19
|
+
if (businessPath) for (const fileName of ["router-guard.ts", "router-guard.js"]) {
|
|
20
|
+
const filePath = require_packages_utils_path.resolve(businessPath, fileName);
|
|
21
|
+
if ((0, fs.existsSync)(filePath)) {
|
|
22
|
+
routerGuard = require_packages_utils_runFileFn.runFileFn(filePath)(app);
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
23
25
|
}
|
|
26
|
+
if (!routerGuard) console.info("-- [router-guard] -- not router-guard.(ts|js) file");
|
|
27
|
+
const routers = [];
|
|
24
28
|
require_packages_core_paths.getAppPaths(app).forEach((currentPath) => {
|
|
25
29
|
require_packages_utils_loadFile.loadFileFn(currentPath, "router", { preProcessingFileCallback: (filePath) => {
|
|
30
|
+
const router = new koa_router.default();
|
|
31
|
+
router.level = 0;
|
|
32
|
+
routers.push(router);
|
|
26
33
|
/**
|
|
27
34
|
* module.export = (app,router) => {
|
|
28
35
|
* router.get('/xxx/xxxx', app.controller)
|
|
29
36
|
* }
|
|
30
37
|
*/
|
|
31
|
-
require_packages_utils_runFileFn.runFileFn(
|
|
38
|
+
require_packages_utils_runFileFn.runFileFn(require_packages_utils_path.resolve(filePath))(app, router);
|
|
32
39
|
} });
|
|
33
40
|
});
|
|
34
|
-
|
|
41
|
+
const BaseRouters = new koa_router.default();
|
|
42
|
+
BaseRouters.level = 99;
|
|
43
|
+
BaseRouters.get("(.*)", async (ctx, _next) => {
|
|
35
44
|
console.info("\x1B[31m%s\x1B[0m", `-- notFound path: ${ctx.path} --`);
|
|
36
45
|
ctx.status = 302;
|
|
37
46
|
const executionResults = routerGuard?.(ctx);
|
|
@@ -41,9 +50,13 @@ var router_default = (app) => {
|
|
|
41
50
|
ctx.body = "notFound";
|
|
42
51
|
}
|
|
43
52
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
53
|
+
routers.push(BaseRouters);
|
|
54
|
+
routers.sort((r, nr) => (r.level ?? 0) < (nr.level ?? 0) ? -1 : 1);
|
|
55
|
+
routers.forEach((r) => {
|
|
56
|
+
app.use(r.routes());
|
|
57
|
+
app.use(r.allowedMethods());
|
|
58
|
+
});
|
|
59
|
+
app.currentUseRouter = routers;
|
|
47
60
|
};
|
|
48
61
|
//#endregion
|
|
49
62
|
module.exports = router_default;
|
|
@@ -12,7 +12,7 @@ app/service
|
|
|
12
12
|
|
|
13
13
|
|-- cuStom-moduLe
|
|
14
14
|
|
|
15
|
-
|-- custom-midd Leware.js
|
|
15
|
+
|-- custom-midd Leware.(js|ts)
|
|
16
16
|
|
|
17
17
|
=> app.service.customModule. customMiddleware
|
|
18
18
|
*
|
|
@@ -22,7 +22,7 @@ var service_default = (app) => {
|
|
|
22
22
|
app.service = require_packages_core_paths.getAppPaths(app).reduce((preData, currentPath) => ({
|
|
23
23
|
...preData,
|
|
24
24
|
...require_packages_utils_loadFile.loadFileFn(currentPath, "service", { loadFileCallback: (file) => {
|
|
25
|
-
return new (require_packages_utils_runFileFn.runFileFn(
|
|
25
|
+
return new (require_packages_utils_runFileFn.runFileFn(file)(app))();
|
|
26
26
|
} })
|
|
27
27
|
}), {});
|
|
28
28
|
};
|
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
require("../../_virtual/_rolldown/runtime.js");
|
|
3
|
+
let path = require("path");
|
|
4
|
+
let fs = require("fs");
|
|
3
5
|
//#region packages/utils/runFileFn.ts
|
|
4
|
-
var
|
|
6
|
+
var registeredTypeScriptLoader = false;
|
|
7
|
+
function runFileFn(fileOrModule) {
|
|
8
|
+
return getDefaultExport(typeof fileOrModule === "string" ? requireFile(fileOrModule) : fileOrModule);
|
|
9
|
+
}
|
|
10
|
+
function getDefaultExport(fileModule) {
|
|
11
|
+
if (fileModule && typeof fileModule === "object" && "default" in fileModule && fileModule.default !== void 0) return fileModule.default;
|
|
12
|
+
return fileModule;
|
|
13
|
+
}
|
|
14
|
+
function requireFile(file) {
|
|
15
|
+
try {
|
|
16
|
+
return require(file);
|
|
17
|
+
} catch (error) {
|
|
18
|
+
if ((0, path.extname)(file) !== ".ts" || !shouldRetryWithTypeScript(error)) throw error;
|
|
19
|
+
registerTypeScriptLoader();
|
|
20
|
+
delete require.cache[require.resolve(file)];
|
|
21
|
+
return require(file);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function shouldRetryWithTypeScript(error) {
|
|
25
|
+
const err = error;
|
|
26
|
+
const message = err?.message ?? "";
|
|
27
|
+
return err?.code === "ERR_UNKNOWN_FILE_EXTENSION" || err?.code === "ERR_UNSUPPORTED_TYPESCRIPT_SYNTAX" || err?.name === "SyntaxError" || message.indexOf("Cannot use import statement outside a module") !== -1 || message.indexOf("Unexpected token 'export'") !== -1;
|
|
28
|
+
}
|
|
29
|
+
function registerTypeScriptLoader() {
|
|
30
|
+
if (registeredTypeScriptLoader) return;
|
|
31
|
+
const typescript = loadTypeScriptCompiler();
|
|
32
|
+
require.extensions[".ts"] = (module, filename) => {
|
|
33
|
+
const { outputText } = typescript.transpileModule((0, fs.readFileSync)(filename, "utf8"), { compilerOptions: {
|
|
34
|
+
module: typescript.ModuleKind.CommonJS,
|
|
35
|
+
target: typescript.ScriptTarget.ES2020,
|
|
36
|
+
esModuleInterop: true,
|
|
37
|
+
allowSyntheticDefaultImports: true
|
|
38
|
+
} });
|
|
39
|
+
module._compile(outputText, filename);
|
|
40
|
+
};
|
|
41
|
+
registeredTypeScriptLoader = true;
|
|
42
|
+
}
|
|
43
|
+
function loadTypeScriptCompiler() {
|
|
44
|
+
try {
|
|
45
|
+
return require("typescript");
|
|
46
|
+
} catch (error) {
|
|
47
|
+
throw new Error(`Unable to load TypeScript file. Please install "typescript" or run with a TypeScript runtime. ${String(error)}`);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
5
50
|
//#endregion
|
|
6
51
|
exports.runFileFn = runFileFn;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
//#region app/controller/base.ts
|
|
2
|
-
var
|
|
2
|
+
var getBaseController = (app) => class BaseController {
|
|
3
3
|
app;
|
|
4
4
|
config;
|
|
5
5
|
constructor() {
|
|
@@ -20,9 +20,9 @@ var base_default = (app) => class BaseController {
|
|
|
20
20
|
ctx.body = {
|
|
21
21
|
data,
|
|
22
22
|
code,
|
|
23
|
-
message
|
|
23
|
+
message: message ?? "ok"
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
27
|
//#endregion
|
|
28
|
-
export {
|
|
28
|
+
export { getBaseController as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import
|
|
1
|
+
import getBaseController from "./base.js";
|
|
2
2
|
//#region app/controller/project.ts
|
|
3
3
|
var getProjectController = (app) => {
|
|
4
|
-
const BaseController =
|
|
4
|
+
const BaseController = getBaseController(app);
|
|
5
5
|
return class ProjectController extends BaseController {
|
|
6
6
|
getModelList = async (ctx) => {
|
|
7
7
|
const dtoModelList = (await this.service.project.getModelList()).reduce((preList, item) => {
|
|
@@ -31,7 +31,7 @@ var getProjectController = (app) => {
|
|
|
31
31
|
this.success(ctx, dtoModelList);
|
|
32
32
|
};
|
|
33
33
|
getProjectList = async (ctx) => {
|
|
34
|
-
const {
|
|
34
|
+
const { projk: projectKey } = ctx.query;
|
|
35
35
|
const dtoProject = (await this.service.project.getList(projectKey))?.map((project) => {
|
|
36
36
|
const { modelKey, key, name, desc, homePage } = project;
|
|
37
37
|
return {
|
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
//#region app/controller/view.ts
|
|
2
2
|
var getViewController = (app) => class ViewController {
|
|
3
3
|
async renderPage(ctx) {
|
|
4
|
-
app.extends.
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
app.extends.logger.log(" - render page: " + ctx.params.page);
|
|
5
|
+
try {
|
|
6
|
+
app.extends.renderView(`dist/${ctx.params.page}.entry.tpl`, ctx, {
|
|
7
|
+
projKey: ctx.query.projk,
|
|
8
|
+
name: app.options?.name,
|
|
9
|
+
env: app.envs.get(),
|
|
10
|
+
basePath: `${app.options.pageBasePage}${ctx.params.page}`,
|
|
11
|
+
options: JSON.stringify(app.options)
|
|
12
|
+
});
|
|
13
|
+
} catch (error) {
|
|
14
|
+
app.extends.generateErrorMessage("template not found", {
|
|
15
|
+
status: 404,
|
|
16
|
+
showError: true,
|
|
17
|
+
code: 0
|
|
18
|
+
});
|
|
19
|
+
}
|
|
11
20
|
}
|
|
12
21
|
};
|
|
13
22
|
//#endregion
|
|
@@ -12,7 +12,16 @@ var validateFN = (key, data, schema) => {
|
|
|
12
12
|
var api_params_verify_default = (app) => async (ctx, next) => {
|
|
13
13
|
const { path, method } = ctx;
|
|
14
14
|
if (path.indexOf("/api") < 0) return next();
|
|
15
|
-
const
|
|
15
|
+
const currentUseRouter = app.currentUseRouter;
|
|
16
|
+
let route;
|
|
17
|
+
for (const r of currentUseRouter) {
|
|
18
|
+
const data = r.match(path, "get");
|
|
19
|
+
if (data) {
|
|
20
|
+
route = data;
|
|
21
|
+
break;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
const routePath = route?.path[0]?.path;
|
|
16
25
|
if (routePath) {
|
|
17
26
|
const params = app.extends.parsingParamsOnUrl(routePath, path);
|
|
18
27
|
const { body, query, headers } = ctx.request;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
//#region app/middleware/error-handle.ts
|
|
2
|
+
var redirectInfo = {};
|
|
2
3
|
var error_handle_default = (app) => async (ctx, next) => {
|
|
3
4
|
try {
|
|
4
5
|
await next();
|
|
@@ -8,9 +9,14 @@ var error_handle_default = (app) => async (ctx, next) => {
|
|
|
8
9
|
app.extends.logger?.error("-- [excption] --", error);
|
|
9
10
|
app.extends.logger?.error("-- [excption] info --", status, message, detail);
|
|
10
11
|
if (message?.includes("template not found")) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
const url = ctx.req.url;
|
|
13
|
+
if (redirectInfo[url] !== void 0) redirectInfo[url] += 1;
|
|
14
|
+
else redirectInfo[url] = 0;
|
|
15
|
+
if (redirectInfo[url] < app.config.notFoundRedirectCount) {
|
|
16
|
+
ctx.status = 302;
|
|
17
|
+
ctx.redirect(app.options?.homePage ?? "/");
|
|
18
|
+
return;
|
|
19
|
+
} else redirectInfo[url] = 0;
|
|
14
20
|
}
|
|
15
21
|
if (returnError) {
|
|
16
22
|
ctx.status = status;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region app/middleware/project-handler.ts
|
|
2
2
|
var project_handler_default = () => async (ctx, next) => {
|
|
3
|
-
const key = ctx.headers.
|
|
3
|
+
const key = ctx.headers.projk;
|
|
4
4
|
const { path } = ctx;
|
|
5
5
|
if (path.indexOf("/api/proj/") !== -1) {
|
|
6
6
|
if (!key || ["undefined", "null"].includes(key)) {
|
package/esm/app/router/view.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
//#region app/router/view.ts
|
|
2
2
|
var view_default = (app, router) => {
|
|
3
|
-
|
|
3
|
+
const { pageBasePage } = app.options;
|
|
4
|
+
router.level = 2;
|
|
5
|
+
router.get([`${pageBasePage}:page`, `${pageBasePage}:page/:r(.*)`], app.controller.view.renderPage.bind(app.controller.view));
|
|
4
6
|
};
|
|
5
7
|
//#endregion
|
|
6
8
|
export { view_default as default };
|
package/esm/bundler/dev.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { logGreen, logRed } from "../packages/common/log/index.js";
|
|
1
2
|
import { VBuildFE, entries, watchFiles } from "./utils.js";
|
|
2
3
|
//#region bundler/dev.ts
|
|
3
4
|
var init = async () => {
|
|
4
5
|
const input = entries();
|
|
5
|
-
|
|
6
|
+
logGreen(input);
|
|
6
7
|
if (!Object.keys(input).length) {
|
|
7
|
-
|
|
8
|
+
logRed("no entry found");
|
|
8
9
|
process.exit(1);
|
|
9
10
|
}
|
|
10
|
-
await VBuildFE(input);
|
|
11
|
+
await VBuildFE(input, "dev");
|
|
11
12
|
};
|
|
12
13
|
async function dev() {
|
|
13
14
|
await init();
|
package/esm/bundler/index.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { logRed } from "../packages/common/log/index.js";
|
|
1
2
|
import { dev } from "./dev.js";
|
|
2
3
|
import { prod } from "./prod.js";
|
|
3
4
|
//#region bundler/index.ts
|
|
@@ -9,7 +10,7 @@ var buildFE = (mode) => {
|
|
|
9
10
|
case "prod":
|
|
10
11
|
prod();
|
|
11
12
|
break;
|
|
12
|
-
default:
|
|
13
|
+
default: logRed("Usage: npx tsx scripts/index.ts [dev|prod]");
|
|
13
14
|
}
|
|
14
15
|
};
|
|
15
16
|
//#endregion
|
package/esm/bundler/prod.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { logGreen, logRed } from "../packages/common/log/index.js";
|
|
1
2
|
import { VBuildFE, entries } from "./utils.js";
|
|
2
3
|
//#region bundler/prod.ts
|
|
3
4
|
async function prod() {
|
|
4
5
|
const input = entries();
|
|
5
6
|
if (!Object.keys(input).length) {
|
|
6
|
-
|
|
7
|
+
logRed("no entry found");
|
|
7
8
|
process.exit(1);
|
|
8
9
|
}
|
|
9
10
|
try {
|
|
10
11
|
await VBuildFE(input);
|
|
11
|
-
|
|
12
|
+
logGreen("build done");
|
|
12
13
|
} catch (err) {
|
|
13
|
-
|
|
14
|
+
logRed(String(err));
|
|
14
15
|
process.exit(1);
|
|
15
16
|
}
|
|
16
17
|
}
|
package/esm/bundler/utils.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { resolve as resolve$1 } from "../packages/utils/path.js";
|
|
2
2
|
import "../packages/utils/index.js";
|
|
3
|
+
import { colorize, logJoinColorized, logRed, logWhite, logYellow } from "../packages/common/log/index.js";
|
|
3
4
|
import path from "path";
|
|
4
5
|
import * as glob from "glob";
|
|
5
|
-
import { build } from "vite";
|
|
6
6
|
import { copyFileSync, existsSync, readFileSync, readdirSync, rmdirSync, unlinkSync, writeFileSync } from "fs";
|
|
7
7
|
import tailwindcss from "@tailwindcss/vite";
|
|
8
|
+
import { build } from "vite";
|
|
8
9
|
//#region bundler/utils.ts
|
|
9
10
|
var base = process.cwd();
|
|
10
11
|
var framePath = path.resolve(__dirname, "../../");
|
|
@@ -18,8 +19,8 @@ var runFEPath = path.resolve(runPath, "./frontend");
|
|
|
18
19
|
* 生成入口
|
|
19
20
|
*/
|
|
20
21
|
function entries() {
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
logWhite("frameFEPath: " + frameFEPath);
|
|
23
|
+
logWhite("runFEPath: " + runFEPath);
|
|
23
24
|
/**
|
|
24
25
|
* 所有包含 entry 的文件
|
|
25
26
|
*/
|
|
@@ -72,12 +73,11 @@ var watchFiles = async (callback) => {
|
|
|
72
73
|
watcher.on("change", async (filePath) => {
|
|
73
74
|
if (building) return;
|
|
74
75
|
building = true;
|
|
75
|
-
|
|
76
|
+
logYellow(`changed: ${filePath}`);
|
|
76
77
|
await callback?.();
|
|
77
|
-
console.log("rebuild done");
|
|
78
78
|
building = false;
|
|
79
79
|
});
|
|
80
|
-
|
|
80
|
+
logYellow(`watching ${runFEPath}/...`);
|
|
81
81
|
};
|
|
82
82
|
/**
|
|
83
83
|
*
|
|
@@ -122,26 +122,55 @@ function flattenHtmlPlugin(suffix = ".html") {
|
|
|
122
122
|
* ------------------
|
|
123
123
|
*/
|
|
124
124
|
const endFiles = glob.sync("**/*" + suffix, { cwd: feDir });
|
|
125
|
-
for (const f of endFiles)
|
|
125
|
+
for (const f of endFiles) logYellow("final file path -----> " + f);
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
129
|
+
/**
|
|
130
|
+
* 处理别名目录兜底
|
|
131
|
+
* 如果 alias 指向的路径不存在,则使用 ./defaultAlias 兜底文件
|
|
132
|
+
*/
|
|
133
|
+
function resolveAliasWithFallback(aliasList) {
|
|
134
|
+
const aliasExtensions = [
|
|
135
|
+
"",
|
|
136
|
+
".ts",
|
|
137
|
+
".tsx",
|
|
138
|
+
".js",
|
|
139
|
+
".jsx"
|
|
140
|
+
];
|
|
141
|
+
return aliasList.reduce((o, [aliasName, aliasPath]) => {
|
|
142
|
+
const businessFilePath = aliasExtensions.map((ext) => path.resolve(runFEPath, aliasPath + ext)).find((filePath) => existsSync(filePath));
|
|
143
|
+
let filePath = path.resolve(__dirname, "./defaultAlias");
|
|
144
|
+
if (businessFilePath) filePath = businessFilePath;
|
|
145
|
+
o[aliasName] = filePath;
|
|
146
|
+
return o;
|
|
147
|
+
}, {});
|
|
148
|
+
}
|
|
149
|
+
var VBuildFE = async (input, OperatingEnv) => {
|
|
150
|
+
try {
|
|
151
|
+
await build({
|
|
152
|
+
configFile: false,
|
|
153
|
+
base: "/dist",
|
|
154
|
+
plugins: [
|
|
155
|
+
(await import("@vitejs/plugin-react")).default(),
|
|
156
|
+
flattenHtmlPlugin(".tpl"),
|
|
157
|
+
tailwindcss()
|
|
158
|
+
],
|
|
159
|
+
build: {
|
|
160
|
+
outDir: outDir(),
|
|
161
|
+
emptyOutDir: true,
|
|
162
|
+
sourcemap: OperatingEnv === "dev" ? "inline" : "hidden",
|
|
163
|
+
rollupOptions: { input }
|
|
164
|
+
},
|
|
165
|
+
resolve: { alias: {
|
|
166
|
+
"@tc/ui-react": path.resolve(__dirname, "../../fe/packages/ui/react/"),
|
|
167
|
+
...resolveAliasWithFallback([["$business/SchemaForm/data", "./extended/SchemaForm/data"]])
|
|
168
|
+
} }
|
|
169
|
+
});
|
|
170
|
+
logJoinColorized(colorize("builded", "green"), colorize(" -> ", "white"), colorize("time: ", "cyan"), colorize(/* @__PURE__ */ new Date(), "pink"));
|
|
171
|
+
} catch (error) {
|
|
172
|
+
logRed(error);
|
|
173
|
+
}
|
|
145
174
|
};
|
|
146
175
|
//#endregion
|
|
147
176
|
export { VBuildFE, entries, outDir, watchFiles };
|
package/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import getBaseController from "./app/controller/base.js";
|
|
2
2
|
import bese_default from "./app/service/bese.js";
|
|
3
3
|
import { resolve } from "./packages/utils/path.js";
|
|
4
4
|
import "./packages/utils/index.js";
|
|
@@ -12,7 +12,7 @@ var serverStart = (options) => {
|
|
|
12
12
|
});
|
|
13
13
|
};
|
|
14
14
|
var baseFn = {
|
|
15
|
-
baseControllerFn:
|
|
15
|
+
baseControllerFn: getBaseController,
|
|
16
16
|
baseServiceFn: bese_default
|
|
17
17
|
};
|
|
18
18
|
//#endregion
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { isNonNullable } from "../guards/index.js";
|
|
2
|
+
//#region packages/common/array/index.ts
|
|
3
|
+
function toArray(value) {
|
|
4
|
+
if (value === null || value === void 0) return [];
|
|
5
|
+
return Array.isArray(value) ? [...value] : [value];
|
|
6
|
+
}
|
|
7
|
+
var compact = (items) => {
|
|
8
|
+
return items.filter(isNonNullable);
|
|
9
|
+
};
|
|
10
|
+
var uniqueBy = (items, getKey) => {
|
|
11
|
+
const keys = /* @__PURE__ */ new Set();
|
|
12
|
+
const result = [];
|
|
13
|
+
for (const item of items) {
|
|
14
|
+
const key = getKey(item);
|
|
15
|
+
if (keys.has(key)) continue;
|
|
16
|
+
keys.add(key);
|
|
17
|
+
result.push(item);
|
|
18
|
+
}
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
var groupBy = (items, getKey) => {
|
|
22
|
+
const result = {};
|
|
23
|
+
for (const item of items) {
|
|
24
|
+
const key = getKey(item);
|
|
25
|
+
result[key] = result[key] ?? [];
|
|
26
|
+
result[key].push(item);
|
|
27
|
+
}
|
|
28
|
+
return result;
|
|
29
|
+
};
|
|
30
|
+
var chunk = (items, size) => {
|
|
31
|
+
if (!Number.isInteger(size) || size <= 0) throw new RangeError("chunk size must be a positive integer");
|
|
32
|
+
const result = [];
|
|
33
|
+
for (let index = 0; index < items.length; index += size) result.push(items.slice(index, index + size));
|
|
34
|
+
return result;
|
|
35
|
+
};
|
|
36
|
+
//#endregion
|
|
37
|
+
export { chunk, compact, groupBy, toArray, uniqueBy };
|