@_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
package/fe/frontend/main.css
CHANGED
|
@@ -1,187 +1,5 @@
|
|
|
1
|
-
@import "
|
|
1
|
+
@import "../packages/ui/react/index.css";
|
|
2
2
|
|
|
3
3
|
/* 内容扫描 */
|
|
4
4
|
/* enhancedComponents */
|
|
5
|
-
@source "./**/*.{js,ts,jsx,tsx}";
|
|
6
|
-
/* baseComponents */
|
|
7
|
-
@source "../packages/ui/react/**/*.{js,ts,jsx,tsx}";
|
|
8
|
-
|
|
9
|
-
/* 暗色模式变体 */
|
|
10
|
-
@custom-variant dark (&:where(.dark, .dark *));
|
|
11
|
-
|
|
12
|
-
/* 主题配置 */
|
|
13
|
-
@theme {
|
|
14
|
-
/* 圆角 */
|
|
15
|
-
--radius-lg: var(--radius);
|
|
16
|
-
--radius-md: calc(var(--radius) - 2px);
|
|
17
|
-
--radius-sm: calc(var(--radius) - 4px);
|
|
18
|
-
|
|
19
|
-
/* 颜色 */
|
|
20
|
-
--color-background: hsl(var(--background));
|
|
21
|
-
--color-foreground: hsl(var(--foreground));
|
|
22
|
-
|
|
23
|
-
--color-card: hsl(var(--card));
|
|
24
|
-
--color-card-foreground: hsl(var(--card-foreground));
|
|
25
|
-
|
|
26
|
-
--color-popover: hsl(var(--popover));
|
|
27
|
-
--color-popover-foreground: hsl(var(--popover-foreground));
|
|
28
|
-
|
|
29
|
-
--color-primary: hsl(var(--primary));
|
|
30
|
-
--color-primary-foreground: hsl(var(--primary-foreground));
|
|
31
|
-
|
|
32
|
-
--color-secondary: hsl(var(--secondary));
|
|
33
|
-
--color-secondary-foreground: hsl(var(--secondary-foreground));
|
|
34
|
-
|
|
35
|
-
--color-muted: hsl(var(--muted));
|
|
36
|
-
--color-muted-foreground: hsl(var(--muted-foreground));
|
|
37
|
-
|
|
38
|
-
--color-accent: hsl(var(--accent));
|
|
39
|
-
--color-accent-foreground: hsl(var(--accent-foreground));
|
|
40
|
-
|
|
41
|
-
--color-destructive: hsl(var(--destructive));
|
|
42
|
-
--color-destructive-foreground: hsl(var(--destructive-foreground));
|
|
43
|
-
|
|
44
|
-
--color-border: hsl(var(--border));
|
|
45
|
-
--color-input: hsl(var(--input));
|
|
46
|
-
--color-ring: hsl(var(--ring));
|
|
47
|
-
|
|
48
|
-
--color-chart-1: hsl(var(--chart-1));
|
|
49
|
-
--color-chart-2: hsl(var(--chart-2));
|
|
50
|
-
--color-chart-3: hsl(var(--chart-3));
|
|
51
|
-
--color-chart-4: hsl(var(--chart-4));
|
|
52
|
-
--color-chart-5: hsl(var(--chart-5));
|
|
53
|
-
|
|
54
|
-
/* 主题色 - 与 @layer base 中的 CSS 变量对应 */
|
|
55
|
-
--color-theme: hsl(var(--theme-primary));
|
|
56
|
-
--color-theme-foreground: hsl(var(--theme-primary-foreground));
|
|
57
|
-
--color-theme-bg: hsl(var(--theme-bg));
|
|
58
|
-
--color-theme-text: hsl(var(--theme-text));
|
|
59
|
-
|
|
60
|
-
/* 表格颜色 */
|
|
61
|
-
--color-table-header: hsl(var(--table-header-bg));
|
|
62
|
-
--color-table-header-text: hsl(var(--table-header-text));
|
|
63
|
-
--color-table-head-text: hsl(var(--table-head-text));
|
|
64
|
-
--color-table-cell-text: hsl(var(--table-cell-text));
|
|
65
|
-
--color-table-action: hsl(var(--table-action-bg));
|
|
66
|
-
--color-table-action-text: hsl(var(--table-action-text));
|
|
67
|
-
|
|
68
|
-
/* 面包屑颜色 */
|
|
69
|
-
--color-breadcrumb-text: hsl(var(--breadcrumb-text));
|
|
70
|
-
--color-breadcrumb-border: hsl(var(--breadcrumb-border));
|
|
71
|
-
--color-breadcrumb-active-text: hsl(var(--breadcrumb-active-text));
|
|
72
|
-
--color-breadcrumb-active-bg: hsl(var(--breadcrumb-active-bg));
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
/* CSS 变量定义 */
|
|
76
|
-
:root {
|
|
77
|
-
--background: 0 0% 100%;
|
|
78
|
-
--foreground: 240 10% 3.9%;
|
|
79
|
-
--card: 0 0% 100%;
|
|
80
|
-
--card-foreground: 240 10% 3.9%;
|
|
81
|
-
--popover: 0 0% 100%;
|
|
82
|
-
--popover-foreground: 240 10% 3.9%;
|
|
83
|
-
--primary: 240 5.9% 10%;
|
|
84
|
-
--primary-foreground: 0 0% 98%;
|
|
85
|
-
--secondary: 240 4.8% 95.9%;
|
|
86
|
-
--secondary-foreground: 240 5.9% 10%;
|
|
87
|
-
--muted: 240 4.8% 95.9%;
|
|
88
|
-
--muted-foreground: 240 3.8% 46.1%;
|
|
89
|
-
--accent: 240 4.8% 95.9%;
|
|
90
|
-
--accent-foreground: 240 5.9% 10%;
|
|
91
|
-
--destructive: 0 84.2% 60.2%;
|
|
92
|
-
--destructive-foreground: 0 0% 98%;
|
|
93
|
-
--border: 240 5.9% 90%;
|
|
94
|
-
--input: 240 5.9% 90%;
|
|
95
|
-
--ring: 240 5.9% 10%;
|
|
96
|
-
--radius: 0.5rem;
|
|
97
|
-
--chart-1: 12 76% 61%;
|
|
98
|
-
--chart-2: 173 58% 39%;
|
|
99
|
-
--chart-3: 197 37% 24%;
|
|
100
|
-
--chart-4: 43 74% 66%;
|
|
101
|
-
--chart-5: 27 87% 67%;
|
|
102
|
-
|
|
103
|
-
/* 主题色 - 黑色主题(默认) */
|
|
104
|
-
--theme-primary: 0 0% 0%;
|
|
105
|
-
--theme-primary-foreground: 0 0% 100%;
|
|
106
|
-
--theme-bg: 0 0% 0%;
|
|
107
|
-
--theme-text: 0 0% 100%;
|
|
108
|
-
|
|
109
|
-
/* 表格颜色 - 黑色主题 */
|
|
110
|
-
--table-header-bg: 220 14% 96%;
|
|
111
|
-
--table-header-text: 220 9% 46%;
|
|
112
|
-
--table-head-text: 217 19% 27%;
|
|
113
|
-
--table-cell-text: 180 4% 16%;
|
|
114
|
-
--table-action-bg: 220 13% 91%;
|
|
115
|
-
--table-action-text: 0 0% 0%;
|
|
116
|
-
|
|
117
|
-
/* 面包屑颜色 - 黑色主题 */
|
|
118
|
-
--breadcrumb-text: 220 10% 46%;
|
|
119
|
-
--breadcrumb-border: 0 0% 88%;
|
|
120
|
-
--breadcrumb-active-text: 0 0% 100%;
|
|
121
|
-
--breadcrumb-active-bg: 0 0% 0%;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/* 绿色主题 */
|
|
125
|
-
[data-theme='green'] {
|
|
126
|
-
--theme-primary: 142 76% 36%;
|
|
127
|
-
--theme-primary-foreground: 0 0% 100%;
|
|
128
|
-
--theme-bg: 120 25% 93%;
|
|
129
|
-
--theme-text: 141 48% 13%;
|
|
130
|
-
|
|
131
|
-
--table-header-bg: 0 0% 88%;
|
|
132
|
-
--table-header-text: 120 4% 16%;
|
|
133
|
-
--table-head-text: 120 4% 16%;
|
|
134
|
-
--table-cell-text: 120 4% 16%;
|
|
135
|
-
--table-action-bg: 120 25% 93% / 0.8;
|
|
136
|
-
--table-action-text: 141 48% 13%;
|
|
137
|
-
|
|
138
|
-
--breadcrumb-text: 0 0% 27%;
|
|
139
|
-
--breadcrumb-border: 0 0% 88%;
|
|
140
|
-
--breadcrumb-active-text: 141 48% 13%;
|
|
141
|
-
--breadcrumb-active-bg: 140 96% 72%;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
/* 暗色模式 */
|
|
145
|
-
.dark {
|
|
146
|
-
--background: 240 10% 3.9%;
|
|
147
|
-
--foreground: 0 0% 98%;
|
|
148
|
-
--card: 240 10% 3.9%;
|
|
149
|
-
--card-foreground: 0 0% 98%;
|
|
150
|
-
--popover: 240 10% 3.9%;
|
|
151
|
-
--popover-foreground: 0 0% 98%;
|
|
152
|
-
--primary: 0 0% 98%;
|
|
153
|
-
--primary-foreground: 240 5.9% 10%;
|
|
154
|
-
--secondary: 240 3.7% 15.9%;
|
|
155
|
-
--secondary-foreground: 0 0% 98%;
|
|
156
|
-
--muted: 240 3.7% 15.9%;
|
|
157
|
-
--muted-foreground: 240 5% 64.9%;
|
|
158
|
-
--accent: 240 3.7% 15.9%;
|
|
159
|
-
--accent-foreground: 0 0% 98%;
|
|
160
|
-
--destructive: 0 62.8% 30.6%;
|
|
161
|
-
--destructive-foreground: 0 0% 98%;
|
|
162
|
-
--border: 240 3.7% 15.9%;
|
|
163
|
-
--input: 240 3.7% 15.9%;
|
|
164
|
-
--ring: 240 4.9% 83.9%;
|
|
165
|
-
--chart-1: 220 70% 50%;
|
|
166
|
-
--chart-2: 160 60% 45%;
|
|
167
|
-
--chart-3: 30 80% 55%;
|
|
168
|
-
--chart-4: 280 65% 60%;
|
|
169
|
-
--chart-5: 340 75% 55%;
|
|
170
|
-
|
|
171
|
-
--table-header-bg: 240 4% 16%;
|
|
172
|
-
--table-header-text: 240 5% 65%;
|
|
173
|
-
--table-head-text: 240 5% 84%;
|
|
174
|
-
--table-cell-text: 0 0% 90%;
|
|
175
|
-
--table-action-bg: 240 4% 20%;
|
|
176
|
-
--table-action-text: 0 0% 95%;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
/* 全局样式 */
|
|
180
|
-
* {
|
|
181
|
-
border-color: hsl(var(--border));
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
body {
|
|
185
|
-
background-color: hsl(var(--background));
|
|
186
|
-
color: hsl(var(--foreground));
|
|
187
|
-
}
|
|
5
|
+
@source "./**/*.{js,ts,jsx,tsx}";
|
package/fe/frontend/main.d.ts
CHANGED
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { PropsWithChildren } from "react";
|
|
2
|
+
import type { JSX } from "react/jsx-runtime";
|
|
3
|
+
import "./main.css";
|
|
4
|
+
import "./typing/window";
|
|
5
|
+
import { RouterType } from "./widgets/components/Router/type";
|
|
6
|
+
import { RouteInfo } from "./widgets/components/Router";
|
|
7
|
+
export declare const initApp: (RootComponent: (props: PropsWithChildren) => JSX.Element, options?: {
|
|
8
|
+
routes: RouteInfo[];
|
|
9
|
+
routerType?: RouterType;
|
|
10
|
+
}) => void;
|
|
4
11
|
//# sourceMappingURL=main.d.ts.map
|
package/fe/frontend/main.js
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
2
|
import { createRoot } from "react-dom/client";
|
|
2
|
-
import
|
|
3
|
-
|
|
3
|
+
import "./main.css";
|
|
4
|
+
import "./typing/window";
|
|
5
|
+
import { generateRouter } from "./widgets/components/Router";
|
|
6
|
+
export const initApp = (RootComponent, options) => {
|
|
4
7
|
const root = createRoot(document.getElementById("root"));
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
const { routerType = "browser", routes: pRoutes = [] } = options ?? {};
|
|
9
|
+
const routes = [...pRoutes];
|
|
10
|
+
const usedRouter = !!routes.length;
|
|
11
|
+
let routerDom;
|
|
12
|
+
if (usedRouter) {
|
|
13
|
+
routerDom = generateRouter(routes, routerType);
|
|
14
|
+
}
|
|
15
|
+
// 创建路由
|
|
16
|
+
// 挂载 根节点
|
|
17
|
+
root.render(_jsx(RootComponent, { children: routerDom }));
|
|
7
18
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { ModeMenuType } from '../../../model/types/model';
|
|
2
|
+
type ProjectMenuType = ModeMenuType;
|
|
3
|
+
export type ModelInfo = {
|
|
4
|
+
model: {
|
|
5
|
+
key: string;
|
|
6
|
+
name: string;
|
|
7
|
+
desc: string;
|
|
8
|
+
};
|
|
9
|
+
project: {
|
|
10
|
+
[k: string]: {
|
|
11
|
+
key: string;
|
|
12
|
+
name: string;
|
|
13
|
+
desc: string;
|
|
14
|
+
homePage: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export declare const getModelList: () => Promise<ModelInfo[]>;
|
|
19
|
+
export type ProjectInfo = {
|
|
20
|
+
mode: string;
|
|
21
|
+
homePage: string;
|
|
22
|
+
icon: string;
|
|
23
|
+
name: string;
|
|
24
|
+
desc: string;
|
|
25
|
+
} & ProjectMenuType & {
|
|
26
|
+
key: string;
|
|
27
|
+
modelKey: string;
|
|
28
|
+
};
|
|
29
|
+
export declare const getProjeckData: (key: string) => Promise<ProjectInfo | null>;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=baseInfo.d.ts.map
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { get } from '../../widgets/common/request';
|
|
2
|
+
export const getModelList = async () => {
|
|
3
|
+
const res = await get('/project/model_list');
|
|
4
|
+
if (res.data.code === 0) {
|
|
5
|
+
return res.data.data;
|
|
6
|
+
}
|
|
7
|
+
return [];
|
|
8
|
+
};
|
|
9
|
+
export const getProjeckData = async (key) => {
|
|
10
|
+
const res = await get(`/project/${key}`);
|
|
11
|
+
if (res.data.code === 0) {
|
|
12
|
+
return res.data.data;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export interface RequestConfig<D = unknown> {
|
|
2
|
+
url?: string;
|
|
3
|
+
method?: 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS';
|
|
4
|
+
baseURL?: string;
|
|
5
|
+
headers?: Record<string, string>;
|
|
6
|
+
params?: Record<string, string | number | boolean | undefined | null>;
|
|
7
|
+
data?: D;
|
|
8
|
+
timeout?: number;
|
|
9
|
+
signal?: AbortSignal;
|
|
10
|
+
credentials?: RequestCredentials;
|
|
11
|
+
cache?: RequestCache;
|
|
12
|
+
redirect?: RequestRedirect;
|
|
13
|
+
referrer?: string;
|
|
14
|
+
referrerPolicy?: ReferrerPolicy;
|
|
15
|
+
transformRequest?: ((data: D, headers: Headers) => D | string | ArrayBuffer | Blob) | ((data: D, headers: Headers) => D | string | ArrayBuffer | Blob)[];
|
|
16
|
+
transformResponse?: ((data: unknown) => unknown) | ((data: unknown) => unknown)[];
|
|
17
|
+
validateStatus?: (status: number) => boolean;
|
|
18
|
+
onUploadProgress?: (progress: ProgressEvent) => void;
|
|
19
|
+
onDownloadProgress?: (progress: ProgressEvent) => void;
|
|
20
|
+
}
|
|
21
|
+
export interface ResponseConfig<T = unknown, D = unknown> {
|
|
22
|
+
data: T;
|
|
23
|
+
status: number;
|
|
24
|
+
statusText: string;
|
|
25
|
+
headers: Record<string, string>;
|
|
26
|
+
config: RequestConfig<D>;
|
|
27
|
+
request?: Request;
|
|
28
|
+
}
|
|
29
|
+
export interface AxiosError<T = unknown, D = unknown> extends Error {
|
|
30
|
+
config: RequestConfig<D>;
|
|
31
|
+
code?: string;
|
|
32
|
+
request?: Request;
|
|
33
|
+
response?: ResponseConfig<T, D>;
|
|
34
|
+
isAxiosError: boolean;
|
|
35
|
+
}
|
|
36
|
+
interface InterceptorHandler<V> {
|
|
37
|
+
fulfilled?: (value: V) => V | Promise<V>;
|
|
38
|
+
rejected?: (error: unknown) => unknown;
|
|
39
|
+
id: number;
|
|
40
|
+
}
|
|
41
|
+
declare class InterceptorManager<V> {
|
|
42
|
+
private handlers;
|
|
43
|
+
private nextId;
|
|
44
|
+
use(onFulfilled?: (value: V) => V | Promise<V>, onRejected?: (error: unknown) => unknown): number;
|
|
45
|
+
eject(id: number): void;
|
|
46
|
+
clear(): void;
|
|
47
|
+
getHandlers(): InterceptorHandler<V>[];
|
|
48
|
+
}
|
|
49
|
+
export declare class FetchAxios {
|
|
50
|
+
defaults: RequestConfig;
|
|
51
|
+
interceptors: {
|
|
52
|
+
request: InterceptorManager<RequestConfig<unknown>>;
|
|
53
|
+
response: InterceptorManager<ResponseConfig<unknown, unknown>>;
|
|
54
|
+
};
|
|
55
|
+
constructor(config?: RequestConfig);
|
|
56
|
+
private request;
|
|
57
|
+
private _doRequest;
|
|
58
|
+
private createError;
|
|
59
|
+
get<T = unknown, D = unknown>(url: string, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
60
|
+
post<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
61
|
+
put<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
62
|
+
patch<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
63
|
+
delete<T = unknown, D = unknown>(url: string, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
64
|
+
head<T = unknown, D = unknown>(url: string, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
65
|
+
options<T = unknown, D = unknown>(url: string, config?: RequestConfig<D>): Promise<ResponseConfig<T, D>>;
|
|
66
|
+
}
|
|
67
|
+
export declare const axios: FetchAxios;
|
|
68
|
+
export declare const createInstance: (defaultConfig: RequestConfig) => FetchAxios;
|
|
69
|
+
export default FetchAxios;
|
|
70
|
+
//# sourceMappingURL=CRUD.d.ts.map
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
class InterceptorManager {
|
|
2
|
+
handlers = [];
|
|
3
|
+
nextId = 0;
|
|
4
|
+
use(onFulfilled, onRejected) {
|
|
5
|
+
const id = this.nextId++;
|
|
6
|
+
this.handlers.push({ id, fulfilled: onFulfilled, rejected: onRejected });
|
|
7
|
+
return id;
|
|
8
|
+
}
|
|
9
|
+
eject(id) {
|
|
10
|
+
const idx = this.handlers.findIndex((h) => h.id === id);
|
|
11
|
+
if (idx !== -1)
|
|
12
|
+
this.handlers.splice(idx, 1);
|
|
13
|
+
}
|
|
14
|
+
clear() {
|
|
15
|
+
this.handlers = [];
|
|
16
|
+
}
|
|
17
|
+
getHandlers() {
|
|
18
|
+
return this.handlers;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
function buildURL(url, baseURL, params) {
|
|
22
|
+
let fullUrl = baseURL ? `${baseURL.replace(/\/+$/, '')}/${url.replace(/^\/+/, '')}` : url;
|
|
23
|
+
if (params) {
|
|
24
|
+
const searchParams = new URLSearchParams();
|
|
25
|
+
for (const [key, value] of Object.entries(params)) {
|
|
26
|
+
if (value !== undefined && value !== null) {
|
|
27
|
+
searchParams.append(key, String(value));
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
const query = searchParams.toString();
|
|
31
|
+
if (query) {
|
|
32
|
+
fullUrl += (fullUrl.includes('?') ? '&' : '?') + query;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return fullUrl;
|
|
36
|
+
}
|
|
37
|
+
function parseHeaders(rawHeaders) {
|
|
38
|
+
const headers = {};
|
|
39
|
+
rawHeaders.forEach((value, key) => {
|
|
40
|
+
headers[key] = value;
|
|
41
|
+
});
|
|
42
|
+
return headers;
|
|
43
|
+
}
|
|
44
|
+
function mergeConfig(primary, secondary) {
|
|
45
|
+
return {
|
|
46
|
+
...secondary,
|
|
47
|
+
...primary,
|
|
48
|
+
headers: {
|
|
49
|
+
...secondary?.headers,
|
|
50
|
+
...primary.headers,
|
|
51
|
+
},
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
function isObject(value) {
|
|
55
|
+
return Object.prototype.toString.call(value) === '[object Object]';
|
|
56
|
+
}
|
|
57
|
+
function applyTransformers(value, transformers) {
|
|
58
|
+
if (!transformers?.length)
|
|
59
|
+
return value;
|
|
60
|
+
return transformers.reduce((acc, fn) => fn(acc), value);
|
|
61
|
+
}
|
|
62
|
+
export class FetchAxios {
|
|
63
|
+
defaults;
|
|
64
|
+
interceptors = {
|
|
65
|
+
request: new InterceptorManager(),
|
|
66
|
+
response: new InterceptorManager(),
|
|
67
|
+
};
|
|
68
|
+
constructor(config = {}) {
|
|
69
|
+
this.defaults = config;
|
|
70
|
+
}
|
|
71
|
+
async request(config) {
|
|
72
|
+
const merged = mergeConfig(this.defaults, config);
|
|
73
|
+
const chain = [];
|
|
74
|
+
this.interceptors.request.getHandlers().forEach((h) => {
|
|
75
|
+
chain.unshift({
|
|
76
|
+
fulfilled: h.fulfilled,
|
|
77
|
+
rejected: h.rejected,
|
|
78
|
+
});
|
|
79
|
+
});
|
|
80
|
+
chain.push({
|
|
81
|
+
fulfilled: (cfg) => Promise.resolve(cfg),
|
|
82
|
+
rejected: undefined,
|
|
83
|
+
});
|
|
84
|
+
this.interceptors.response.getHandlers().forEach((h) => {
|
|
85
|
+
chain.push({
|
|
86
|
+
fulfilled: h.fulfilled,
|
|
87
|
+
rejected: h.rejected,
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
let currentConfig = merged;
|
|
91
|
+
// 执行拦截器
|
|
92
|
+
for (let i = 0; i < chain.length; i++) {
|
|
93
|
+
const item = chain[i];
|
|
94
|
+
const { fulfilled, rejected } = item;
|
|
95
|
+
try {
|
|
96
|
+
currentConfig = await fulfilled(currentConfig);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
if (rejected) {
|
|
100
|
+
void (await rejected(err));
|
|
101
|
+
}
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return this._doRequest(currentConfig);
|
|
106
|
+
}
|
|
107
|
+
async _doRequest(config) {
|
|
108
|
+
const { method = 'GET', baseURL, headers: rawHeaders = {}, params, data, timeout, credentials, cache, redirect, referrer, referrerPolicy, transformRequest, transformResponse, validateStatus, } = config;
|
|
109
|
+
const url = buildURL(config.url ?? '', baseURL, params);
|
|
110
|
+
const requestHeaders = new Headers(rawHeaders);
|
|
111
|
+
let requestData = data;
|
|
112
|
+
if (transformRequest && (method === 'POST' || method === 'PUT' || method === 'PATCH')) {
|
|
113
|
+
const fns = Array.isArray(transformRequest) ? transformRequest : [transformRequest];
|
|
114
|
+
requestData = applyTransformers(data, fns);
|
|
115
|
+
if (isObject(requestData) || Array.isArray(requestData)) {
|
|
116
|
+
if (!requestHeaders.has('Content-Type')) {
|
|
117
|
+
requestHeaders.set('Content-Type', 'application/json');
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
const init = {
|
|
122
|
+
method,
|
|
123
|
+
headers: requestHeaders,
|
|
124
|
+
credentials: credentials ?? 'same-origin',
|
|
125
|
+
cache: cache,
|
|
126
|
+
redirect: redirect,
|
|
127
|
+
referrer: referrer,
|
|
128
|
+
referrerPolicy: referrerPolicy,
|
|
129
|
+
};
|
|
130
|
+
if (requestData !== undefined && method !== 'GET' && method !== 'HEAD') {
|
|
131
|
+
init.body = typeof requestData === 'string' ? requestData : JSON.stringify(requestData);
|
|
132
|
+
}
|
|
133
|
+
const controller = new AbortController();
|
|
134
|
+
init.signal = config.signal ?? controller.signal;
|
|
135
|
+
let timeoutId;
|
|
136
|
+
if (timeout) {
|
|
137
|
+
timeoutId = setTimeout(() => controller.abort(), timeout);
|
|
138
|
+
}
|
|
139
|
+
let response;
|
|
140
|
+
try {
|
|
141
|
+
response = await fetch(url, init);
|
|
142
|
+
}
|
|
143
|
+
catch (err) {
|
|
144
|
+
if (timeoutId)
|
|
145
|
+
clearTimeout(timeoutId);
|
|
146
|
+
const error = this.createError(err instanceof Error ? err : new Error(String(err)), 'ECONNABORTED', config);
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
if (timeoutId)
|
|
150
|
+
clearTimeout(timeoutId);
|
|
151
|
+
const responseHeaders = parseHeaders(response.headers);
|
|
152
|
+
const responseConfig = {
|
|
153
|
+
data: null,
|
|
154
|
+
status: response.status,
|
|
155
|
+
statusText: response.statusText,
|
|
156
|
+
headers: responseHeaders,
|
|
157
|
+
config,
|
|
158
|
+
};
|
|
159
|
+
if (!validateStatus || validateStatus(response.status)) {
|
|
160
|
+
const rawData = await response.text();
|
|
161
|
+
const parsed = rawData ? JSON.parse(rawData) : null;
|
|
162
|
+
const transformedData = transformResponse
|
|
163
|
+
? applyTransformers(parsed, Array.isArray(transformResponse) ? transformResponse : [transformResponse])
|
|
164
|
+
: parsed;
|
|
165
|
+
responseConfig.data = transformedData;
|
|
166
|
+
return responseConfig;
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const rawData = response.body ? await response.text() : null;
|
|
170
|
+
responseConfig.data = rawData ? JSON.parse(rawData) : null;
|
|
171
|
+
const error = this.createError(new Error(`Request failed with status ${response.status}`), undefined, config, responseConfig);
|
|
172
|
+
throw error;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
createError(message, code, config, response) {
|
|
176
|
+
const error = message;
|
|
177
|
+
error.config = config;
|
|
178
|
+
error.code = code;
|
|
179
|
+
error.response = response;
|
|
180
|
+
error.isAxiosError = true;
|
|
181
|
+
return error;
|
|
182
|
+
}
|
|
183
|
+
get(url, config) {
|
|
184
|
+
return this.request({ ...config, url, method: 'GET' });
|
|
185
|
+
}
|
|
186
|
+
post(url, data, config) {
|
|
187
|
+
return this.request({ ...config, url, method: 'POST', data });
|
|
188
|
+
}
|
|
189
|
+
put(url, data, config) {
|
|
190
|
+
return this.request({ ...config, url, method: 'PUT', data });
|
|
191
|
+
}
|
|
192
|
+
patch(url, data, config) {
|
|
193
|
+
return this.request({ ...config, url, method: 'PATCH', data });
|
|
194
|
+
}
|
|
195
|
+
delete(url, config) {
|
|
196
|
+
return this.request({ ...config, url, method: 'DELETE' });
|
|
197
|
+
}
|
|
198
|
+
head(url, config) {
|
|
199
|
+
return this.request({ ...config, url, method: 'HEAD' });
|
|
200
|
+
}
|
|
201
|
+
options(url, config) {
|
|
202
|
+
return this.request({ ...config, url, method: 'OPTIONS' });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
const instance = new FetchAxios();
|
|
206
|
+
export const axios = instance;
|
|
207
|
+
export const createInstance = (defaultConfig) => new FetchAxios(defaultConfig);
|
|
208
|
+
export default FetchAxios;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './CRUD';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const AUTH_HEADER_KEY = "Authorization";
|
|
2
|
+
export declare function getAuthToken(): Promise<string | null>;
|
|
3
|
+
export declare function clearAuthToken(): Promise<void>;
|
|
4
|
+
export declare const API_AUTH_HEADER_KEY = "projk";
|
|
5
|
+
export declare const getApiAuth: () => string;
|
|
6
|
+
export declare const setApiAuth: (v: string) => void;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const AUTH_LOCAL_KEY = 'auth_token';
|
|
2
|
+
const API_AUTH_LOCAL_KEY = 'p_J_k';
|
|
3
|
+
export const AUTH_HEADER_KEY = 'Authorization';
|
|
4
|
+
export async function getAuthToken() {
|
|
5
|
+
if (typeof localStorage === 'undefined')
|
|
6
|
+
return null;
|
|
7
|
+
return localStorage.getItem(AUTH_LOCAL_KEY);
|
|
8
|
+
}
|
|
9
|
+
export async function clearAuthToken() {
|
|
10
|
+
if (typeof localStorage === 'undefined')
|
|
11
|
+
return;
|
|
12
|
+
localStorage.removeItem(AUTH_LOCAL_KEY);
|
|
13
|
+
}
|
|
14
|
+
export const API_AUTH_HEADER_KEY = 'projk';
|
|
15
|
+
export const getApiAuth = () => {
|
|
16
|
+
return localStorage.getItem(API_AUTH_LOCAL_KEY) ?? '';
|
|
17
|
+
};
|
|
18
|
+
export const setApiAuth = (v) => {
|
|
19
|
+
return localStorage.setItem(API_AUTH_LOCAL_KEY, v);
|
|
20
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const generateMenuItemData = (data) => {
|
|
2
|
+
return data.map((m) => {
|
|
3
|
+
const children = (m.menuType === "group" && m.subMenu.length
|
|
4
|
+
? generateMenuItemData(m.subMenu)
|
|
5
|
+
: undefined);
|
|
6
|
+
return {
|
|
7
|
+
key: m.key,
|
|
8
|
+
label: m.name,
|
|
9
|
+
icon: m.icon,
|
|
10
|
+
children: children,
|
|
11
|
+
minWidth: 100,
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { lazy, Suspense } from 'react';
|
|
3
|
+
export const renderImportComponent = (c, fallback) => {
|
|
4
|
+
const Component = lazy(() => c);
|
|
5
|
+
// TODO 加上页面级 loading
|
|
6
|
+
const showFallback = typeof fallback !== 'undefined' ? fallback : 'loading';
|
|
7
|
+
return (_jsx(Suspense, { fallback: showFallback, children: _jsx(Component, {}) }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
const logJoin = (...logs) => logs.join(`
|
|
2
|
+
---------
|
|
3
|
+
`);
|
|
4
|
+
export const logPageNotFound = () => {
|
|
5
|
+
console.error(logJoin('url有问题 或者 自定义页面未在路由器注册', 'The URL is incorrect, or the custom page is not registered with the router.'));
|
|
6
|
+
};
|
|
7
|
+
export const logIllegalComponentCallback = (comName) => console.error(logJoin(`非法的组件回调 - ${comName}`, `Illegal component callback - ${comName}`));
|
|
8
|
+
export const logSubscriptionError = () => console.error(logJoin('不曾订阅过,请检查代码,关注函数与取消函数必须为同一个', "You haven't subscribed. Please check your code; the follow function and unsubscribe function must be the same."));
|