@_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
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ProjectInfo } from "../../widgets/api/baseInfo";
|
|
2
|
+
type MenuItem = {
|
|
3
|
+
key: string;
|
|
4
|
+
name: string;
|
|
5
|
+
path: Partial<{
|
|
6
|
+
pathname: string;
|
|
7
|
+
search: string;
|
|
8
|
+
hash: string;
|
|
9
|
+
}>;
|
|
10
|
+
};
|
|
11
|
+
export declare const enum QK {
|
|
12
|
+
/**
|
|
13
|
+
* project key
|
|
14
|
+
*/
|
|
15
|
+
pk = "projk",
|
|
16
|
+
/**
|
|
17
|
+
* key topMenu key
|
|
18
|
+
*/
|
|
19
|
+
k = "key",
|
|
20
|
+
/**
|
|
21
|
+
* sidebar key leftMenu key
|
|
22
|
+
*/
|
|
23
|
+
sk = "sidek",
|
|
24
|
+
/**
|
|
25
|
+
* 自定义 页面的key
|
|
26
|
+
*/
|
|
27
|
+
ck = "custk"
|
|
28
|
+
}
|
|
29
|
+
export declare const leftSidebarBasePath = "_sidebar_";
|
|
30
|
+
export declare const deserializationUrlSearch: <T = Record<string, string>>(url?: string) => T;
|
|
31
|
+
export declare const serializationUrl: (url: string, data: Record<string, string>) => string;
|
|
32
|
+
export declare const findMenuItem: <T = Record<string, any>>(menuData: ProjectInfo["menu"], key?: string) => MenuItem & T;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=menu.d.ts.map
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { modeStore } from "../../widgets/store/mode";
|
|
2
|
+
export var QK;
|
|
3
|
+
(function (QK) {
|
|
4
|
+
/**
|
|
5
|
+
* project key
|
|
6
|
+
*/
|
|
7
|
+
QK["pk"] = "projk";
|
|
8
|
+
/**
|
|
9
|
+
* key topMenu key
|
|
10
|
+
*/
|
|
11
|
+
QK["k"] = "key";
|
|
12
|
+
/**
|
|
13
|
+
* sidebar key leftMenu key
|
|
14
|
+
*/
|
|
15
|
+
QK["sk"] = "sidek";
|
|
16
|
+
/**
|
|
17
|
+
* 自定义 页面的key
|
|
18
|
+
*/
|
|
19
|
+
QK["ck"] = "custk";
|
|
20
|
+
})(QK || (QK = {}));
|
|
21
|
+
export const leftSidebarBasePath = "_sidebar_";
|
|
22
|
+
export const deserializationUrlSearch = (url = window.location.search) => {
|
|
23
|
+
const urls = new URLSearchParams(url);
|
|
24
|
+
const data = {};
|
|
25
|
+
for (const [k, v] of urls.entries()) {
|
|
26
|
+
data[k] = v;
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
};
|
|
30
|
+
export const serializationUrl = (url, data) => `${url}?${new URLSearchParams(data).toString()}`;
|
|
31
|
+
const generateMenuItem = (item) => {
|
|
32
|
+
let data = undefined;
|
|
33
|
+
if (item.menuType === "module") {
|
|
34
|
+
const pk = modeStore.getState().projestInfo?.key;
|
|
35
|
+
const query = {
|
|
36
|
+
[QK.pk]: pk,
|
|
37
|
+
};
|
|
38
|
+
switch (item.moduleType) {
|
|
39
|
+
case "custom":
|
|
40
|
+
query[QK.ck] = item.key;
|
|
41
|
+
data = {
|
|
42
|
+
...item,
|
|
43
|
+
path: {
|
|
44
|
+
pathname: item.customConfig.path,
|
|
45
|
+
search: new URLSearchParams(query).toString(),
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
break;
|
|
49
|
+
case "iframe":
|
|
50
|
+
case "schema":
|
|
51
|
+
case "sidebar":
|
|
52
|
+
let path = `/${item.key}`;
|
|
53
|
+
let search = new URLSearchParams(query).toString();
|
|
54
|
+
if (item.moduleType === "sidebar") {
|
|
55
|
+
// query[QK.sk] = item.sidebarConfig.menu[0].key;
|
|
56
|
+
const sfMenu = findMenuItem(item.sidebarConfig.menu, item.sidebarConfig.menu[0].key);
|
|
57
|
+
path += `${sfMenu.path.pathname}`;
|
|
58
|
+
search = sfMenu.path.search ?? "";
|
|
59
|
+
// path += `/pending`;
|
|
60
|
+
}
|
|
61
|
+
data = {
|
|
62
|
+
...item,
|
|
63
|
+
path: {
|
|
64
|
+
pathname: path,
|
|
65
|
+
search,
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
break;
|
|
69
|
+
default:
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return data;
|
|
74
|
+
};
|
|
75
|
+
export const findMenuItem = (menuData, key) => {
|
|
76
|
+
let data = undefined;
|
|
77
|
+
const useFirstAvailableMenu = typeof key === "undefined";
|
|
78
|
+
/**
|
|
79
|
+
* url query 分为
|
|
80
|
+
*
|
|
81
|
+
* projk 为项目key
|
|
82
|
+
* key 当前选择的top菜单key
|
|
83
|
+
* sidek 为侧边栏选中的key
|
|
84
|
+
*/
|
|
85
|
+
for (const item of menuData) {
|
|
86
|
+
if (item.menuType === "module") {
|
|
87
|
+
if (useFirstAvailableMenu || item.key === key) {
|
|
88
|
+
data = generateMenuItem(item);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
if (item.menuType === "group") {
|
|
93
|
+
const result = findMenuItem(item.subMenu, key);
|
|
94
|
+
if (result) {
|
|
95
|
+
data = { ...result };
|
|
96
|
+
break;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return data;
|
|
101
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AxiosError, FetchAxios, RequestConfig, ResponseConfig } from './CRUD';
|
|
2
|
+
declare const api: FetchAxios;
|
|
3
|
+
export interface PageParams {
|
|
4
|
+
page?: number;
|
|
5
|
+
pageSize?: number;
|
|
6
|
+
[key: string]: string | number | boolean | undefined | null;
|
|
7
|
+
}
|
|
8
|
+
export type PageResponse<T> = {
|
|
9
|
+
data: T[];
|
|
10
|
+
total: number;
|
|
11
|
+
page: number;
|
|
12
|
+
pageSize: number;
|
|
13
|
+
};
|
|
14
|
+
export interface BaseResponse<T> {
|
|
15
|
+
data: T;
|
|
16
|
+
code: number;
|
|
17
|
+
message: string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* GET/DELETE 不发送 body;统一把 data 转到 params。
|
|
21
|
+
* */
|
|
22
|
+
export declare function get<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<BaseResponse<T>, D>>;
|
|
23
|
+
export declare function post<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<BaseResponse<T>, D>>;
|
|
24
|
+
export declare function put<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<BaseResponse<T>, D>>;
|
|
25
|
+
export declare function patch<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<BaseResponse<T>, D>>;
|
|
26
|
+
export declare function del<T = unknown, D = unknown>(url: string, data?: D, config?: RequestConfig<D>): Promise<ResponseConfig<BaseResponse<T>, D>>;
|
|
27
|
+
export { api, FetchAxios };
|
|
28
|
+
export type { AxiosError, RequestConfig, ResponseConfig };
|
|
29
|
+
export declare const request: {
|
|
30
|
+
get: typeof get;
|
|
31
|
+
put: typeof put;
|
|
32
|
+
post: typeof post;
|
|
33
|
+
del: typeof del;
|
|
34
|
+
patch: typeof patch;
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=request.d.ts.map
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import md5 from 'md5';
|
|
2
|
+
import { API_AUTH_HEADER_KEY, AUTH_HEADER_KEY, clearAuthToken, getApiAuth, getAuthToken } from './auth';
|
|
3
|
+
import { FetchAxios } from './CRUD';
|
|
4
|
+
const BASE_URL = '/api';
|
|
5
|
+
const api = new FetchAxios({
|
|
6
|
+
baseURL: BASE_URL,
|
|
7
|
+
timeout: 15000,
|
|
8
|
+
credentials: 'include',
|
|
9
|
+
validateStatus: (status) => status >= 200 && status < 300,
|
|
10
|
+
});
|
|
11
|
+
const removeBaseurlFromURL = (config) => {
|
|
12
|
+
const { baseURL, url } = config;
|
|
13
|
+
if (!baseURL || !url)
|
|
14
|
+
return;
|
|
15
|
+
const origin = typeof window === 'undefined' ? 'http://localhost' : window.location.origin;
|
|
16
|
+
const baseURLObject = new URL(baseURL, origin);
|
|
17
|
+
const basePath = baseURLObject.pathname.replace(/\/+$/, '');
|
|
18
|
+
const requestURL = new URL(url, baseURLObject.origin);
|
|
19
|
+
if (requestURL.origin !== baseURLObject.origin || !basePath)
|
|
20
|
+
return;
|
|
21
|
+
const normalizedPathname = requestURL.pathname.replace(/\/+$/, '');
|
|
22
|
+
if (normalizedPathname !== basePath && !requestURL.pathname.startsWith(`${basePath}/`))
|
|
23
|
+
return;
|
|
24
|
+
const pathname = requestURL.pathname.slice(basePath.length) || '/';
|
|
25
|
+
config.url = `${pathname}${requestURL.search}${requestURL.hash}`;
|
|
26
|
+
};
|
|
27
|
+
// ---- Request Interceptors ----
|
|
28
|
+
api.interceptors.request.use(async (config) => {
|
|
29
|
+
removeBaseurlFromURL(config);
|
|
30
|
+
const token = await getAuthToken();
|
|
31
|
+
const aauto = getApiAuth();
|
|
32
|
+
const time = new Date().getTime();
|
|
33
|
+
config.headers = {
|
|
34
|
+
...config.headers,
|
|
35
|
+
s_t: time + '',
|
|
36
|
+
s_sign: md5(`sakjdfnkjwjfnfkjkjldljksndf_${time}`),
|
|
37
|
+
[API_AUTH_HEADER_KEY]: aauto,
|
|
38
|
+
};
|
|
39
|
+
if (token) {
|
|
40
|
+
config.headers = {
|
|
41
|
+
...config.headers,
|
|
42
|
+
[AUTH_HEADER_KEY]: `Bearer ${token}`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
return config;
|
|
46
|
+
});
|
|
47
|
+
api.interceptors.request.use((config) => {
|
|
48
|
+
console.debug(`[API] ${config.method?.toUpperCase()} ${config.url}`);
|
|
49
|
+
return config;
|
|
50
|
+
});
|
|
51
|
+
// ---- Response Interceptors ----
|
|
52
|
+
api.interceptors.response.use((res) => res, async (err) => {
|
|
53
|
+
const axiosErr = err;
|
|
54
|
+
if (axiosErr.response?.status === 401) {
|
|
55
|
+
await clearAuthToken();
|
|
56
|
+
if (typeof window !== 'undefined') {
|
|
57
|
+
window.location.href = '/login';
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
const message = extractErrorMessage(err);
|
|
61
|
+
console.error(`[API Error] ${message}`, {
|
|
62
|
+
url: err.config.url,
|
|
63
|
+
status: err.response?.status,
|
|
64
|
+
});
|
|
65
|
+
return Promise.reject(err);
|
|
66
|
+
});
|
|
67
|
+
// ---- Helpers ----
|
|
68
|
+
function extractErrorMessage(err) {
|
|
69
|
+
if (!(err instanceof Error))
|
|
70
|
+
return 'Unknown error';
|
|
71
|
+
const axiosErr = err;
|
|
72
|
+
if (axiosErr.response?.data && typeof axiosErr.response.data === 'object' && axiosErr.response.data !== null) {
|
|
73
|
+
const data = axiosErr.response.data;
|
|
74
|
+
if (typeof data.message === 'string')
|
|
75
|
+
return data.message;
|
|
76
|
+
if (typeof data.msg === 'string')
|
|
77
|
+
return data.msg;
|
|
78
|
+
if (Array.isArray(data.errors) && data.errors.length > 0) {
|
|
79
|
+
return String(data.errors[0]);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (axiosErr.message)
|
|
83
|
+
return axiosErr.message;
|
|
84
|
+
if (axiosErr.code === 'ECONNABORTED')
|
|
85
|
+
return 'Request timed out';
|
|
86
|
+
return 'Network error';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* GET/DELETE 不发送 body;统一把 data 转到 params。
|
|
90
|
+
* */
|
|
91
|
+
export function get(url, data, config) {
|
|
92
|
+
const hasDataParams = data !== undefined && data !== null && typeof data === 'object';
|
|
93
|
+
const getConfig = hasDataParams
|
|
94
|
+
? {
|
|
95
|
+
...config,
|
|
96
|
+
params: {
|
|
97
|
+
...config?.params,
|
|
98
|
+
...data,
|
|
99
|
+
},
|
|
100
|
+
}
|
|
101
|
+
: config;
|
|
102
|
+
return api.get(url, getConfig);
|
|
103
|
+
}
|
|
104
|
+
export function post(url, data, config) {
|
|
105
|
+
return api.post(url, data, config);
|
|
106
|
+
}
|
|
107
|
+
export function put(url, data, config) {
|
|
108
|
+
return api.put(url, data, config);
|
|
109
|
+
}
|
|
110
|
+
export function patch(url, data, config) {
|
|
111
|
+
return api.patch(url, data, config);
|
|
112
|
+
}
|
|
113
|
+
export function del(url, data, config) {
|
|
114
|
+
const hasDataParams = data !== undefined && data !== null && typeof data === 'object';
|
|
115
|
+
const delConfig = hasDataParams
|
|
116
|
+
? {
|
|
117
|
+
...config,
|
|
118
|
+
params: {
|
|
119
|
+
...config?.params,
|
|
120
|
+
...data,
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
: config;
|
|
124
|
+
return api.delete(url, delConfig);
|
|
125
|
+
}
|
|
126
|
+
export { api, FetchAxios };
|
|
127
|
+
export const request = {
|
|
128
|
+
get,
|
|
129
|
+
put,
|
|
130
|
+
post,
|
|
131
|
+
del,
|
|
132
|
+
patch,
|
|
133
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PropsWithChildren, ReactNode } from "react";
|
|
2
|
+
export interface HeaderViewProps extends PropsWithChildren {
|
|
3
|
+
menu?: ReactNode;
|
|
4
|
+
title?: ReactNode;
|
|
5
|
+
userArea?: ReactNode;
|
|
6
|
+
}
|
|
7
|
+
declare const HeaderView: (props?: HeaderViewProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export default HeaderView;
|
|
9
|
+
//# sourceMappingURL=HeaderView.d.ts.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../../../packages/ui/react/index";
|
|
3
|
+
const defaultTitle = _jsx("span", { children: "Template Core" });
|
|
4
|
+
const defaultProps = {};
|
|
5
|
+
const headerThemeStyle = {
|
|
6
|
+
"--header-fg": "hsl(var(--theme-text))",
|
|
7
|
+
"--header-bg": "hsl(var(--theme-bg))",
|
|
8
|
+
"--header-shadow": "hsl(var(--theme-primary) / 0.18)",
|
|
9
|
+
};
|
|
10
|
+
const HeaderView = (props) => {
|
|
11
|
+
const { title, menu, userArea, children } = props ?? defaultProps;
|
|
12
|
+
return (_jsxs("div", { className: "header-view", style: headerThemeStyle, children: [_jsxs("header", { className: cn("header flex h-16 items-center border-b",
|
|
13
|
+
// "border-[hsl(var(--theme-bg)/0.14)] bg-(--header-bg) text-(--header-fg)",
|
|
14
|
+
"shadow-[0_10px_30px_var(--header-shadow)]"), children: [_jsx("div", { className: "brand flex w-60 items-center border-r border-[hsl(var(--theme-bg)/0.14)] px-6 text-base font-semibold tracking-[0.02em] text-(--header-fg)", children: title ?? defaultTitle }), _jsx("div", { className: "top-menu flex flex-1 items-center px-6 text-(--header-fg)", children: menu }), _jsx("div", { className: "user-area flex items-center justify-end border-l border-[hsl(var(--theme-bg)/0.14)] px-6 text-(--header-fg)", children: userArea })] }), children] }));
|
|
15
|
+
};
|
|
16
|
+
export default HeaderView;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { RouterType } from './type';
|
|
3
|
+
export type RouteInfo = {
|
|
4
|
+
path: string;
|
|
5
|
+
component: ReactNode;
|
|
6
|
+
children?: RouteInfo[];
|
|
7
|
+
};
|
|
8
|
+
export declare const generateRouter: (routes: RouteInfo[], type: RouterType) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { BrowserRouter, HashRouter, Route, Routes } from 'react-router-dom';
|
|
3
|
+
export const generateRouter = (routes, type) => {
|
|
4
|
+
const RouterComponent = type === 'browser' ? BrowserRouter : HashRouter;
|
|
5
|
+
const renderDom = (routes) => {
|
|
6
|
+
return routes.map((route) => {
|
|
7
|
+
return (_jsx(Route, { path: route.path, element: route.component, children: route.children && renderDom(route.children) }, route.path));
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
return (_jsx(RouterComponent, { basename: window._basePath, children: _jsx(Routes, { children: renderDom(routes) }) }));
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import useCurrentMenuData from "../../../widgets/hooks/useCurrentMenuData";
|
|
3
|
+
import { useMemo } from "react";
|
|
4
|
+
const Iframe = () => {
|
|
5
|
+
const { menu } = useCurrentMenuData(true);
|
|
6
|
+
const ifUrl = useMemo(() => {
|
|
7
|
+
if (menu.moduleType === "iframe") {
|
|
8
|
+
return menu.iframeConfig.path;
|
|
9
|
+
}
|
|
10
|
+
return "";
|
|
11
|
+
}, []);
|
|
12
|
+
return (_jsx("div", { className: "iframe w-full h-full", children: _jsx("iframe", { className: " w-full h-full", src: ifUrl }) }));
|
|
13
|
+
};
|
|
14
|
+
export default Iframe;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { CallComNames, SchemaDefaultValue } from '../../schemaType';
|
|
2
|
+
declare const DetailPanel: import("react").MemoExoticComponent<(props: {
|
|
3
|
+
data: SchemaDefaultValue;
|
|
4
|
+
comName: CallComNames;
|
|
5
|
+
}) => import("react/jsx-runtime").JSX.Element>;
|
|
6
|
+
export default DetailPanel;
|
|
7
|
+
//# sourceMappingURL=DetailPanel.d.ts.map
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getText } from '../../../../../widgets/common/language';
|
|
3
|
+
import { Drawer } from '../../../../../../packages/ui/react/components';
|
|
4
|
+
import { memo, useMemo, useState } from 'react';
|
|
5
|
+
import { request } from '../../../../../widgets/common/request';
|
|
6
|
+
import useExecuteOnce from '../../../../../../packages/ui/react/hooks/useExecuteOnce';
|
|
7
|
+
import { eventsInfo } from '../../data/eventInfo';
|
|
8
|
+
import useComConfig from '../../hooks/useComConfig';
|
|
9
|
+
import { schemaEventBus } from '../../stores/schemaEventBus';
|
|
10
|
+
import { handlingRequestErrors } from '../../utils/fetchErrorShow';
|
|
11
|
+
import { merge } from '../../utils/permissions';
|
|
12
|
+
const EMPTY_TEXT = '-';
|
|
13
|
+
const isEmptyValue = (value) => value === undefined || value === null || value === '';
|
|
14
|
+
const stringifyValue = (value) => {
|
|
15
|
+
if (isEmptyValue(value))
|
|
16
|
+
return EMPTY_TEXT;
|
|
17
|
+
if (typeof value === 'object')
|
|
18
|
+
return JSON.stringify(value);
|
|
19
|
+
return String(value);
|
|
20
|
+
};
|
|
21
|
+
const getOptionLabel = (options, value) => {
|
|
22
|
+
if (!Array.isArray(options))
|
|
23
|
+
return undefined;
|
|
24
|
+
const matchedOption = options.find((option) => {
|
|
25
|
+
if (!option || typeof option !== 'object')
|
|
26
|
+
return false;
|
|
27
|
+
return option.value === value;
|
|
28
|
+
});
|
|
29
|
+
if (!matchedOption || typeof matchedOption !== 'object')
|
|
30
|
+
return undefined;
|
|
31
|
+
const label = matchedOption.label;
|
|
32
|
+
return label ?? stringifyValue(value);
|
|
33
|
+
};
|
|
34
|
+
const formatValue = (value, fieldInfo) => {
|
|
35
|
+
if (isEmptyValue(value))
|
|
36
|
+
return EMPTY_TEXT;
|
|
37
|
+
const option = fieldInfo.option;
|
|
38
|
+
const optionLabel = getOptionLabel(option?.options ?? option?.enumList, value);
|
|
39
|
+
if (optionLabel !== undefined)
|
|
40
|
+
return optionLabel;
|
|
41
|
+
if (Array.isArray(value)) {
|
|
42
|
+
if (value.length === 0)
|
|
43
|
+
return EMPTY_TEXT;
|
|
44
|
+
return value
|
|
45
|
+
.map((item) => {
|
|
46
|
+
return stringifyValue(item);
|
|
47
|
+
})
|
|
48
|
+
.join(', ');
|
|
49
|
+
}
|
|
50
|
+
if (typeof value === 'boolean')
|
|
51
|
+
return value ? getText('是') : getText('否');
|
|
52
|
+
return stringifyValue(value);
|
|
53
|
+
};
|
|
54
|
+
const generateFields = (schema, data) => {
|
|
55
|
+
if (!schema?.properties)
|
|
56
|
+
return [];
|
|
57
|
+
return Object.keys(schema.properties)
|
|
58
|
+
.reduce((fields, key) => {
|
|
59
|
+
const fieldInfo = schema.properties[key];
|
|
60
|
+
if (!fieldInfo.option || fieldInfo.option.visible === false)
|
|
61
|
+
return fields;
|
|
62
|
+
fields.push({
|
|
63
|
+
key,
|
|
64
|
+
label: getText(fieldInfo.label),
|
|
65
|
+
value: formatValue(data?.[key], fieldInfo),
|
|
66
|
+
level: fieldInfo.level ?? 10,
|
|
67
|
+
});
|
|
68
|
+
return fields;
|
|
69
|
+
}, [])
|
|
70
|
+
.sort((a, b) => a.level - b.level);
|
|
71
|
+
};
|
|
72
|
+
const DetailPanel = memo((props) => {
|
|
73
|
+
const [open, setOpen] = useState(true);
|
|
74
|
+
const [data, setData] = useState(props.data);
|
|
75
|
+
const { config, schema, api } = useComConfig({ comName: props.comName });
|
|
76
|
+
const fields = useMemo(() => generateFields(schema, data), [data, schema]);
|
|
77
|
+
useExecuteOnce(async () => {
|
|
78
|
+
const fetchKey = config?.fetchKey;
|
|
79
|
+
if (fetchKey) {
|
|
80
|
+
const params = {
|
|
81
|
+
[fetchKey]: props.data[fetchKey],
|
|
82
|
+
};
|
|
83
|
+
const { url: furl = api, method = 'get' } = config.fetchConfig ?? {};
|
|
84
|
+
const res = await handlingRequestErrors(request[method](furl, params));
|
|
85
|
+
if (res.data.code === 0)
|
|
86
|
+
setData(res.data.data);
|
|
87
|
+
}
|
|
88
|
+
}, { executionPhase: 'mount' });
|
|
89
|
+
return (_jsx("div", { className: "detail-panel", children: _jsx(Drawer, { title: getText(config?.title ?? ''), open: open, onClose: () => {
|
|
90
|
+
setOpen(false);
|
|
91
|
+
schemaEventBus.getState().emitCom({ type: merge(eventsInfo.closeCom) });
|
|
92
|
+
}, children: fields.length > 0 ? (_jsx("div", { className: "grid grid-cols-1 gap-x-6 gap-y-4 sm:grid-cols-2", children: fields.map((field) => (_jsxs("div", { className: "min-w-0 border-b border-border pb-3", children: [_jsx("div", { className: "mb-1 text-xs text-muted-foreground", children: field.label }), _jsx("div", { className: "break-words text-sm leading-6 text-foreground", children: field.value })] }, field.key))) })) : (_jsx("div", { className: "py-8 text-center text-sm text-muted-foreground", children: getText('暂无数据') })) }) }));
|
|
93
|
+
});
|
|
94
|
+
export default DetailPanel;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { CallComNames, ComponentConfig, SchemaDefaultValue } from '../../schemaType';
|
|
2
|
+
type PopFormComName = keyof ComponentConfig;
|
|
3
|
+
export interface PopFormValue {
|
|
4
|
+
comName: PopFormComName;
|
|
5
|
+
data?: SchemaDefaultValue;
|
|
6
|
+
}
|
|
7
|
+
export interface PopFormProps {
|
|
8
|
+
data: SchemaDefaultValue;
|
|
9
|
+
comName: CallComNames;
|
|
10
|
+
}
|
|
11
|
+
declare const PopForm: import("react").MemoExoticComponent<(props: PopFormProps) => import("react/jsx-runtime").JSX.Element>;
|
|
12
|
+
export default PopForm;
|
|
13
|
+
//# sourceMappingURL=PopFrom.d.ts.map
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { getText } from '../../../../../widgets/common/language';
|
|
3
|
+
import { Modal, SchemaForm } from '../../../../../../packages/ui/react/components';
|
|
4
|
+
import { post, put, request } from '../../../../../widgets/common/request';
|
|
5
|
+
import useExecuteOnce from '../../../../../../packages/ui/react/hooks/useExecuteOnce';
|
|
6
|
+
import { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { eventsInfo } from '../../data/eventInfo';
|
|
8
|
+
import useComConfig from '../../hooks/useComConfig';
|
|
9
|
+
import { schemaEventBus } from '../../stores/schemaEventBus';
|
|
10
|
+
import { handlingRequestErrors } from '../../utils/fetchErrorShow';
|
|
11
|
+
import { merge } from '../../utils/permissions';
|
|
12
|
+
import { createAjvValidator } from '../../utils/validator';
|
|
13
|
+
const generateSchemas = (schema) => {
|
|
14
|
+
if (!schema?.properties)
|
|
15
|
+
return [];
|
|
16
|
+
return Object.keys(schema.properties).reduce((schemas, key) => {
|
|
17
|
+
const fieldInfo = schema.properties[key];
|
|
18
|
+
const option = fieldInfo.option;
|
|
19
|
+
if (!option || option.visible === false)
|
|
20
|
+
return schemas;
|
|
21
|
+
const { comType = 'input', default: _defaultValue, visible: _visible, ...fieldProps } = option;
|
|
22
|
+
schemas.push({
|
|
23
|
+
key,
|
|
24
|
+
label: getText(fieldInfo.label),
|
|
25
|
+
type: comType,
|
|
26
|
+
required: schema.required?.includes(key),
|
|
27
|
+
rules: [
|
|
28
|
+
...(schema.required?.includes(key)
|
|
29
|
+
? [{ required: true, message: `请输入${getText(fieldInfo.label)}` }]
|
|
30
|
+
: []),
|
|
31
|
+
{
|
|
32
|
+
validator: createAjvValidator(fieldInfo),
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
fieldProps: {
|
|
36
|
+
...fieldProps,
|
|
37
|
+
...(comType === 'select'
|
|
38
|
+
? {
|
|
39
|
+
getPopupContainer: 'parent',
|
|
40
|
+
}
|
|
41
|
+
: []),
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
return schemas;
|
|
45
|
+
}, []);
|
|
46
|
+
};
|
|
47
|
+
const generateDefaultValue = (schema, data) => {
|
|
48
|
+
const defaultValue = { ...(data ?? {}) };
|
|
49
|
+
if (!schema?.properties)
|
|
50
|
+
return defaultValue;
|
|
51
|
+
Object.keys(schema.properties).forEach((key) => {
|
|
52
|
+
const defaultFieldValue = schema.properties[key].option?.default;
|
|
53
|
+
if (typeof defaultFieldValue !== 'undefined' && typeof defaultValue[key] === 'undefined') {
|
|
54
|
+
defaultValue[key] = defaultFieldValue;
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return defaultValue;
|
|
58
|
+
};
|
|
59
|
+
const PopForm = memo((props) => {
|
|
60
|
+
const [open, setOpen] = useState(true);
|
|
61
|
+
const [submitting, setSubmitting] = useState(false);
|
|
62
|
+
const { schema, config, api } = useComConfig({ comName: props.comName });
|
|
63
|
+
const formRef = useRef(null);
|
|
64
|
+
const [loading, setLoading] = useState(false);
|
|
65
|
+
/**
|
|
66
|
+
* 1. 生成 schemas
|
|
67
|
+
* 2. 根据config 获取相关展示内容、请求数据
|
|
68
|
+
* 3. 支持 create、edit
|
|
69
|
+
*
|
|
70
|
+
*
|
|
71
|
+
* 交互结束时 通知上层 清除show component
|
|
72
|
+
*
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
const schemas = useMemo(() => {
|
|
76
|
+
return generateSchemas(schema);
|
|
77
|
+
}, [schema]);
|
|
78
|
+
const closed = submitting
|
|
79
|
+
? undefined
|
|
80
|
+
: () => {
|
|
81
|
+
schemaEventBus.getState().emitCom({ type: merge(eventsInfo.closeCom) });
|
|
82
|
+
setOpen(false);
|
|
83
|
+
};
|
|
84
|
+
const defaultValue = useMemo(() => generateDefaultValue(schema, props.data), [schema, props.data]);
|
|
85
|
+
useExecuteOnce(async () => {
|
|
86
|
+
/**
|
|
87
|
+
* 编辑弹窗需要 获取一下数据
|
|
88
|
+
*/
|
|
89
|
+
if (props.comName === 'editForm' && 'fetchKey' in config) {
|
|
90
|
+
const { fetchKey } = config;
|
|
91
|
+
const params = {
|
|
92
|
+
[fetchKey]: props.data[fetchKey],
|
|
93
|
+
};
|
|
94
|
+
const { url = api, method = 'get' } = config?.fetchConfig ?? {};
|
|
95
|
+
setLoading(true);
|
|
96
|
+
const res = await handlingRequestErrors(request[method](url, params));
|
|
97
|
+
res.data.code === 0 && formRef.current?.setFieldsValue(res.data.data);
|
|
98
|
+
setLoading(false);
|
|
99
|
+
}
|
|
100
|
+
}, { executionPhase: 'mount' });
|
|
101
|
+
const handleSubmit = useCallback(async (v) => {
|
|
102
|
+
setSubmitting(true);
|
|
103
|
+
// 逻辑处理
|
|
104
|
+
let fetchFn = put;
|
|
105
|
+
if (props.comName === 'createForm') {
|
|
106
|
+
fetchFn = post;
|
|
107
|
+
}
|
|
108
|
+
try {
|
|
109
|
+
const res = await handlingRequestErrors(fetchFn(api, v));
|
|
110
|
+
if (res.data.code === 0) {
|
|
111
|
+
// 通知
|
|
112
|
+
schemaEventBus.getState().emitCom({
|
|
113
|
+
type: merge(eventsInfo.closeCom, eventsInfo.initTable, props.comName === 'createForm' ? eventsInfo.resetSearch : eventsInfo.none),
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
finally {
|
|
118
|
+
setSubmitting(false);
|
|
119
|
+
}
|
|
120
|
+
}, [api, props.comName]);
|
|
121
|
+
return (_jsx(Modal, { open: open, onClose: closed, title: getText(config?.title ?? ''), width: 640, maskClosable: !submitting, children: _jsx(SchemaForm, { schemas: schemas, initialValues: defaultValue, getForm: (f) => (formRef.current = f), onFinish: handleSubmit, onCancel: closed, buttonClassName: "justify-end", submitText: config?.saveBtnText, submitButtonProps: { loading: submitting }, cancelButtonProps: { disabled: submitting } }, `${String(props?.comName ?? '')}-${JSON.stringify(defaultValue)}`) }));
|
|
122
|
+
});
|
|
123
|
+
PopForm.displayName = 'PopForm';
|
|
124
|
+
export default PopForm;
|