@_tc/template-core 0.0.1-bate.35 → 0.0.1-bate.37
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 +53 -24
- 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 +17 -12
- package/cjs/packages/core/loader/model.js +3 -3
- package/cjs/packages/core/loader/router.js +14 -5
- 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 +53 -24
- 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 +17 -12
- package/esm/packages/core/loader/model.js +3 -3
- package/esm/packages/core/loader/router.js +14 -5
- package/fe/frontend/dash/Dashboard.d.ts +7 -0
- package/fe/frontend/dash/Dashboard.js +63 -0
- package/fe/frontend/dash/dash.entry.d.ts +2 -0
- package/fe/frontend/dash/dash.entry.js +62 -0
- package/fe/frontend/index.d.ts +3 -0
- package/fe/frontend/index.js +1 -0
- package/fe/frontend/main.css +5 -1
- package/fe/frontend/main.d.ts +10 -3
- package/fe/frontend/main.js +13 -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 +207 -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 +7 -0
- package/fe/frontend/widgets/common/language.d.ts +2 -0
- package/fe/frontend/widgets/common/language.js +8 -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 +22 -0
- package/fe/frontend/widgets/common/menu.js +80 -0
- package/fe/frontend/widgets/common/request.d.ts +33 -0
- package/fe/frontend/widgets/common/request.js +127 -0
- package/fe/frontend/widgets/components/BasePage/HeaderView.d.ts +9 -0
- package/fe/frontend/widgets/components/BasePage/HeaderView.js +14 -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 +109 -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 +58 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.d.ts +11 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +176 -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 +67 -0
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.d.ts +41 -0
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +4 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.d.ts +23 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +66 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +33 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +24 -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 +72 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +4 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +31 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +31 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +15 -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 +24 -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 +11 -0
- package/fe/frontend/widgets/hooks/useCurrentMenuData.js +20 -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 +16 -0
- package/fe/frontend/widgets/store/mode.js +36 -0
- package/fe/model/types/data/button.d.ts +23 -0
- package/fe/model/types/data/button.js +1 -0
- package/fe/model/types/data/component.d.ts +37 -0
- package/fe/model/types/data/component.js +1 -0
- package/fe/model/types/data/fetchInfo.d.ts +8 -0
- package/fe/model/types/data/fetchInfo.js +1 -0
- package/fe/model/types/data/schema.d.ts +47 -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 +44 -0
- package/fe/model/types/menuType.js +1 -0
- package/fe/model/types/model.d.ts +20 -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 +87 -0
- package/fe/packages/common/i18n/default.js +85 -0
- package/fe/packages/common/i18n/en-US.d.ts +87 -0
- package/fe/packages/common/i18n/en-US.js +85 -0
- package/fe/packages/common/i18n/index.d.ts +19 -0
- package/fe/packages/common/i18n/index.js +142 -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 +47 -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 +16 -30
- package/fe/packages/ui/react/components/Button/Button.js +53 -26
- package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +2 -6
- package/fe/packages/ui/react/components/Button/SumbitButton.js +3 -14
- 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.d.ts → ConfirmDialog/ConfirmDialog.d.ts} +0 -8
- 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 -23
- package/fe/packages/ui/react/components/DataTable/{data-table.js → index.js} +57 -47
- package/fe/packages/ui/react/components/Date/Calendar.d.ts +0 -13
- package/fe/packages/ui/react/components/Date/Calendar.js +5 -13
- package/fe/packages/ui/react/components/Date/Date.d.ts +4 -13
- package/fe/packages/ui/react/components/Date/Date.js +70 -66
- package/fe/packages/ui/react/components/Date/LocaleContext.d.ts +0 -4
- package/fe/packages/ui/react/components/Date/LocaleContext.js +0 -4
- package/fe/packages/ui/react/components/Date/LocaleProvider.d.ts +0 -11
- package/fe/packages/ui/react/components/Date/LocaleProvider.js +0 -11
- package/fe/packages/ui/react/components/Date/TimePicker.js +3 -2
- package/fe/packages/ui/react/components/Date/dateLocaleStore.d.ts +0 -6
- 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 -19
- package/fe/packages/ui/react/components/Date/locales.js +7 -47
- package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +23 -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 +24 -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.d.ts +0 -6
- package/fe/packages/ui/react/components/Form/Form.js +1 -1
- package/fe/packages/ui/react/components/Form/FormItem.d.ts +0 -21
- package/fe/packages/ui/react/components/Form/FormItem.js +2 -9
- package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +45 -0
- package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/data.js +8 -1
- package/fe/packages/ui/react/components/Form/SchemaForm/index.d.ts +60 -0
- package/fe/packages/ui/react/components/Form/SchemaForm/index.js +75 -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 -20
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.d.ts +0 -3
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +5 -2
- package/fe/packages/ui/react/components/Input/Input.d.ts +3 -21
- package/fe/packages/ui/react/components/Input/Input.js +5 -7
- package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +26 -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.d.ts +0 -29
- package/fe/packages/ui/react/components/Label/Label.js +2 -4
- package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
- package/fe/packages/ui/react/components/Menu/Menu.js +98 -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 +3 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.js +124 -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 +58 -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.d.ts +0 -7
- package/fe/packages/ui/react/components/Message/Message.js +4 -4
- package/fe/packages/ui/react/components/Message/MessageManager.js +0 -8
- package/fe/packages/ui/react/components/Modal/Modal.d.ts +3 -7
- package/fe/packages/ui/react/components/Modal/Modal.js +6 -44
- package/fe/packages/ui/react/components/Modal/ModalManager.d.ts +0 -12
- package/fe/packages/ui/react/components/Modal/ModalManager.js +5 -7
- package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +20 -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.d.ts → Pagination/Pagination.d.ts} +0 -7
- package/fe/packages/ui/react/components/{Pagination.js → Pagination/Pagination.js} +5 -12
- 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 +69 -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 -5
- package/fe/packages/ui/react/components/Search/Search.js +3 -3
- package/fe/packages/ui/react/components/Select/Select.d.ts +2 -2
- package/fe/packages/ui/react/components/Select/Select.js +52 -113
- 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.d.ts +0 -15
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +3 -3
- package/fe/packages/ui/react/components/Switch/Switch.js +3 -1
- package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +5 -41
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +21 -22
- package/fe/packages/ui/react/components/TableSearch/lang.js +5 -14
- package/fe/packages/ui/react/components/Textarea/Textarea.d.ts +21 -0
- package/fe/packages/ui/react/components/Textarea/Textarea.js +36 -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/Tooltip.d.ts +9 -0
- package/fe/packages/ui/react/components/Tooltip/Tooltip.js +71 -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.d.ts → TreeSelect/TreeSelect.d.ts} +0 -6
- package/fe/packages/ui/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +9 -17
- 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.d.ts +0 -27
- package/fe/packages/ui/react/components/Upload/Upload.js +2 -1
- package/fe/packages/ui/react/components/{breadcrumb.js → breadcrumb/breadcrumb.js} +15 -21
- 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 +43 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +123 -0
- package/fe/packages/ui/react/components/hooks/useInputController.d.ts +0 -3
- package/fe/packages/ui/react/components/hooks/useInputController.js +0 -7
- 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 +101 -0
- package/fe/packages/ui/react/components/testPage/index.js +251 -81
- package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +12 -0
- package/fe/packages/ui/react/hooks/useExecuteOnce.js +36 -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 +18 -0
- package/fe/packages/ui/react/hooks/useRefState.js +28 -0
- package/fe/packages/ui/react/hooks/useWatch.d.ts +15 -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 +13 -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 +9 -0
- package/fe/packages/ui/react/i18n/useI18n.js +14 -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 -2
- 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 -46
- package/fe/packages/ui/react/lib/export.js +0 -40
- package/fe/packages/ui/react/lib/utils.d.ts +0 -24
- package/fe/packages/ui/react/lib/utils.js +0 -25
- package/fe/packages/ui/react/stores/breadcrumb.js +0 -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/package.json +14 -2
- 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/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.d.ts +0 -152
- package/fe/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
- package/fe/packages/ui/react/components/Textarea.d.ts +0 -59
- package/fe/packages/ui/react/components/Textarea.js +0 -35
- package/fe/packages/ui/react/components/Tooltip.d.ts +0 -25
- 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/{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,176 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getText } from '../../../../../widgets/common/language';
|
|
3
|
+
import { del, get } from '../../../../../widgets/common/request';
|
|
4
|
+
import { Button, DataTable, modal, } from '../../../../../../packages/ui/react/components';
|
|
5
|
+
import useExecuteOnce from '../../../../../../packages/ui/react/hooks/useExecuteOnce';
|
|
6
|
+
import useInit from '../../../../../../packages/ui/react/hooks/useInit';
|
|
7
|
+
import useRefState from '../../../../../../packages/ui/react/hooks/useRefState';
|
|
8
|
+
import useWatch from '../../../../../../packages/ui/react/hooks/useWatch';
|
|
9
|
+
import { produce } from 'immer';
|
|
10
|
+
import { memo, useCallback, useImperativeHandle, useMemo, useState } from 'react';
|
|
11
|
+
import { useShallow } from 'zustand/react/shallow';
|
|
12
|
+
import { eventsInfo } from '../../data/eventInfo';
|
|
13
|
+
import { schemaEventBus } from '../../stores/schemaEventBus';
|
|
14
|
+
import { useSchemaStore } from '../../stores/schemaStore';
|
|
15
|
+
import { handlingRequestErrors } from '../../utils/fetchErrorShow';
|
|
16
|
+
import { merge } from '../../utils/permissions';
|
|
17
|
+
const VALUE_KEY = 'schema::';
|
|
18
|
+
const generateColumns = (config) => {
|
|
19
|
+
const keys = Object.keys(config);
|
|
20
|
+
const columns = [];
|
|
21
|
+
keys.forEach((k) => {
|
|
22
|
+
const fieldInfo = config[k];
|
|
23
|
+
if (fieldInfo?.option) {
|
|
24
|
+
const { ...fieldProps } = fieldInfo.option;
|
|
25
|
+
columns.push({
|
|
26
|
+
title: getText(fieldInfo.label),
|
|
27
|
+
key: k,
|
|
28
|
+
...fieldProps,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
return columns;
|
|
33
|
+
};
|
|
34
|
+
const generateRowActions = (btnConfigs, rowData, api) => {
|
|
35
|
+
const handleRowAction = (btnConfig) => {
|
|
36
|
+
const { eventKey, eventOption } = btnConfig;
|
|
37
|
+
switch (eventKey) {
|
|
38
|
+
case 'callComponent':
|
|
39
|
+
const { emitTable } = schemaEventBus.getState();
|
|
40
|
+
emitTable({ ...rowData, comName: eventOption.comName });
|
|
41
|
+
break;
|
|
42
|
+
case 'remove':
|
|
43
|
+
if (api) {
|
|
44
|
+
const apiParams = Object.entries(eventOption.params).reduce((o, [k, v]) => {
|
|
45
|
+
if (('' + v).includes(VALUE_KEY)) {
|
|
46
|
+
const valueKey = ('' + v).split(VALUE_KEY)[1];
|
|
47
|
+
o[k] = rowData[valueKey];
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
o[k] = v;
|
|
51
|
+
}
|
|
52
|
+
return o;
|
|
53
|
+
}, {});
|
|
54
|
+
modal.confirm({
|
|
55
|
+
content: `确认删除?`,
|
|
56
|
+
async onOk() {
|
|
57
|
+
await handlingRequestErrors(del(api, apiParams));
|
|
58
|
+
schemaEventBus.getState().emitCom({ type: merge(eventsInfo.initTable) });
|
|
59
|
+
return true;
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
break;
|
|
64
|
+
default:
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
return btnConfigs.map((rb, index) => {
|
|
69
|
+
const label = getText(rb.label ?? '');
|
|
70
|
+
const bState = rb.eventKey === 'remove' ? 'danger' : undefined;
|
|
71
|
+
return {
|
|
72
|
+
render: (_item, { close }) => (_jsx("div", { className: " p-2.5", children: _jsx(Button, { state: bState, variant: "link", onClick: () => {
|
|
73
|
+
handleRowAction(rb);
|
|
74
|
+
close();
|
|
75
|
+
}, children: label }, `${rb.eventKey}-${rb.label ?? index}`) })),
|
|
76
|
+
};
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const SchemaTable = memo(({ ref }) => {
|
|
80
|
+
const params = useSchemaStore(useShallow((s) => ({ config: s.tableConfig, schema: s.tableSchema, api: s.api })));
|
|
81
|
+
const [data, uData] = useState([]);
|
|
82
|
+
const [columns, uColumns] = useState([]);
|
|
83
|
+
const [loading, uLoading, loadingRef] = useRefState(false);
|
|
84
|
+
const [pagination, setPagination, paginationRef] = useRefState({
|
|
85
|
+
current: 1,
|
|
86
|
+
pageSize: 10,
|
|
87
|
+
total: 0,
|
|
88
|
+
});
|
|
89
|
+
const [handleBtn, setHandleBtn] = useState([]);
|
|
90
|
+
const init = useCallback(async (query) => {
|
|
91
|
+
if (loadingRef.current.data)
|
|
92
|
+
return;
|
|
93
|
+
uLoading(true);
|
|
94
|
+
try {
|
|
95
|
+
const res = await handlingRequestErrors(get(params.api ? `${params.api}/list` : '', { ...query, ...paginationRef.current.data }));
|
|
96
|
+
if (res.data.code === 0) {
|
|
97
|
+
uData(res.data.data.data);
|
|
98
|
+
setPagination(produce((nextState) => {
|
|
99
|
+
nextState.total = res.data.data.total;
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
uLoading(false);
|
|
105
|
+
}
|
|
106
|
+
}, [loadingRef, paginationRef, params.api, setPagination, uLoading]);
|
|
107
|
+
useImperativeHandle(ref, () => {
|
|
108
|
+
return {
|
|
109
|
+
initData: init,
|
|
110
|
+
};
|
|
111
|
+
}, [init]);
|
|
112
|
+
useInit(() => {
|
|
113
|
+
const contextColumns = generateColumns(params.schema.properties);
|
|
114
|
+
const actionColumn = [];
|
|
115
|
+
if (params.config) {
|
|
116
|
+
const { rowButtons, headerButtons } = params.config;
|
|
117
|
+
if (rowButtons) {
|
|
118
|
+
actionColumn.push({
|
|
119
|
+
key: 'action',
|
|
120
|
+
title: getText('操作'),
|
|
121
|
+
actions: (_value, _record, index) => [
|
|
122
|
+
...generateRowActions(rowButtons, _record, params.api),
|
|
123
|
+
],
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
setHandleBtn(headerButtons?.map((c) => {
|
|
127
|
+
const { label, eventKey, eventOption, ...props } = c;
|
|
128
|
+
return {
|
|
129
|
+
children: getText(label ?? ''),
|
|
130
|
+
onClick: () => {
|
|
131
|
+
if ('comName' in eventOption) {
|
|
132
|
+
schemaEventBus.getState().emitTable(eventOption);
|
|
133
|
+
}
|
|
134
|
+
else {
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
...props,
|
|
138
|
+
};
|
|
139
|
+
}) ?? []);
|
|
140
|
+
}
|
|
141
|
+
uColumns(contextColumns.concat(actionColumn));
|
|
142
|
+
});
|
|
143
|
+
useExecuteOnce(() => {
|
|
144
|
+
init();
|
|
145
|
+
}, { executionPhase: 'mount' });
|
|
146
|
+
const daProps = useMemo(() => {
|
|
147
|
+
return {
|
|
148
|
+
columns,
|
|
149
|
+
data,
|
|
150
|
+
loading,
|
|
151
|
+
pagination: {
|
|
152
|
+
...pagination,
|
|
153
|
+
onPageSizeChange(pageSize) {
|
|
154
|
+
setPagination(produce((ns) => {
|
|
155
|
+
ns.pageSize = pageSize;
|
|
156
|
+
}));
|
|
157
|
+
},
|
|
158
|
+
onChange(page) {
|
|
159
|
+
setPagination(produce((ns) => {
|
|
160
|
+
ns.current = page;
|
|
161
|
+
}));
|
|
162
|
+
},
|
|
163
|
+
},
|
|
164
|
+
};
|
|
165
|
+
}, [columns, data, loading, pagination, setPagination]);
|
|
166
|
+
useWatch([pagination.current, pagination.pageSize], () => {
|
|
167
|
+
init();
|
|
168
|
+
}, {
|
|
169
|
+
compare: 'shallow',
|
|
170
|
+
});
|
|
171
|
+
return (_jsxs("div", { className: "schema-table", children: [_jsx("div", { className: "schema-table flex items-end", children: handleBtn.map((bc) => {
|
|
172
|
+
return _jsx(Button, { ...bc });
|
|
173
|
+
}) }), _jsx(DataTable, { ...daProps })] }));
|
|
174
|
+
});
|
|
175
|
+
SchemaTable.displayName = 'SchemaTable';
|
|
176
|
+
export default SchemaTable;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const suffixKey = "Option";
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { CallComNames, NamedComponentConfig, NamedSchemaType } from '../schemaType';
|
|
2
|
+
declare const useComConfig: <CN extends CallComNames>({ comName }: {
|
|
3
|
+
comName: CallComNames;
|
|
4
|
+
}) => {
|
|
5
|
+
config: NamedComponentConfig<CN>;
|
|
6
|
+
schema: NamedSchemaType<`${CN}Option`>;
|
|
7
|
+
api: string | undefined;
|
|
8
|
+
};
|
|
9
|
+
export default useComConfig;
|
|
10
|
+
//# sourceMappingURL=useComConfig.d.ts.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { useShallow } from 'zustand/react/shallow';
|
|
2
|
+
import { useSchemaStore } from '../stores/schemaStore';
|
|
3
|
+
const useComConfig = ({ comName }) => {
|
|
4
|
+
const params = useSchemaStore(useShallow((s) => ({ comConfig: s.components, api: s.api })));
|
|
5
|
+
const comConfig = params.comConfig?.[comName];
|
|
6
|
+
const config = comConfig?.config;
|
|
7
|
+
const schema = comConfig?.schema;
|
|
8
|
+
return {
|
|
9
|
+
config,
|
|
10
|
+
schema,
|
|
11
|
+
api: params.api,
|
|
12
|
+
};
|
|
13
|
+
};
|
|
14
|
+
export default useComConfig;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { logIllegalComponentCallback } from '../../../widgets/common/logFn';
|
|
3
|
+
import useCurrentMenuData from '../../../widgets/hooks/useCurrentMenuData';
|
|
4
|
+
import useExecuteOnce, { executionPhaseType } from '../../../../packages/ui/react/hooks/useExecuteOnce';
|
|
5
|
+
import useInit from '../../../../packages/ui/react/hooks/useInit';
|
|
6
|
+
import { memo, Suspense, useCallback, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { components } from './components/CallCom/data';
|
|
8
|
+
import SchemaSearch from './components/SchemaSearch';
|
|
9
|
+
import SchemaTable from './components/SchemaTable';
|
|
10
|
+
import { eventsInfo } from './data/eventInfo';
|
|
11
|
+
import { schemaEventBus } from './stores/schemaEventBus';
|
|
12
|
+
import { useSchemaStore } from './stores/schemaStore';
|
|
13
|
+
import { isAllowed } from './utils/permissions';
|
|
14
|
+
import { schemaConversion } from './utils/schemaConversion';
|
|
15
|
+
const Schema = memo(() => {
|
|
16
|
+
const { menu } = useCurrentMenuData();
|
|
17
|
+
const [showCompoentKey, setShowCompoentKey] = useState();
|
|
18
|
+
const [comProps, setComProps] = useState({});
|
|
19
|
+
const schemaStoreAvailable = useSchemaStore((s) => s.schemaStoreAvailable);
|
|
20
|
+
const TableRef = useRef(null);
|
|
21
|
+
const onSearch = useCallback((v) => {
|
|
22
|
+
TableRef.current?.initData(v);
|
|
23
|
+
}, []);
|
|
24
|
+
const callCom = useCallback((v) => {
|
|
25
|
+
const { comName, ...params } = v;
|
|
26
|
+
setComProps({ data: params, comName });
|
|
27
|
+
setShowCompoentKey(comName);
|
|
28
|
+
}, []);
|
|
29
|
+
const comDone = useCallback(({ type }) => {
|
|
30
|
+
if (isAllowed(type, eventsInfo.closeCom)) {
|
|
31
|
+
setShowCompoentKey(undefined);
|
|
32
|
+
setComProps(undefined);
|
|
33
|
+
}
|
|
34
|
+
if (isAllowed(type, eventsInfo.initTable)) {
|
|
35
|
+
TableRef.current?.initData();
|
|
36
|
+
}
|
|
37
|
+
if (isAllowed(type, eventsInfo.resetSearch)) {
|
|
38
|
+
}
|
|
39
|
+
}, []);
|
|
40
|
+
useInit(() => {
|
|
41
|
+
schemaConversion(menu.schemaConfig, menu.key);
|
|
42
|
+
});
|
|
43
|
+
useExecuteOnce(() => {
|
|
44
|
+
schemaEventBus.getState().subscribeSearch(onSearch);
|
|
45
|
+
schemaEventBus.getState().subscribeCom(comDone);
|
|
46
|
+
schemaEventBus.getState().subscribeTable(callCom);
|
|
47
|
+
}, { executionPhase: executionPhaseType.mount });
|
|
48
|
+
useExecuteOnce(() => {
|
|
49
|
+
schemaEventBus.getState().unSubscribeSearch(onSearch);
|
|
50
|
+
schemaEventBus.getState().unSubscribeTable(callCom);
|
|
51
|
+
schemaEventBus.getState().unSubscribeCom(comDone);
|
|
52
|
+
}, { executionPhase: executionPhaseType.unMount });
|
|
53
|
+
const dom = useMemo(() => {
|
|
54
|
+
if (schemaStoreAvailable) {
|
|
55
|
+
const CallCom = components[showCompoentKey];
|
|
56
|
+
if (!CallCom && showCompoentKey) {
|
|
57
|
+
logIllegalComponentCallback(showCompoentKey);
|
|
58
|
+
}
|
|
59
|
+
return (_jsxs("div", { className: "schema-container gap-3 flex-col flex h-full", children: [_jsx(SchemaSearch, {}), _jsx(SchemaTable, { ref: TableRef }), _jsx(Suspense, { children: CallCom && _jsx(CallCom, { ...comProps }) })] }));
|
|
60
|
+
}
|
|
61
|
+
else
|
|
62
|
+
return _jsx("div", { children: "loading" });
|
|
63
|
+
}, [comProps, schemaStoreAvailable, showCompoentKey]);
|
|
64
|
+
return dom;
|
|
65
|
+
});
|
|
66
|
+
Schema.displayName = 'SchemaPage';
|
|
67
|
+
export default Schema;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ComponentConfig } from '../../../../model/types/data/component';
|
|
2
|
+
import type { BaseOption, ConfigSchema, SchemaDataType, SearchConfig, TableConfig, UsedConfigSchema } from '../../../../model/types/data/schema';
|
|
3
|
+
import type { SuffixKey } from './data';
|
|
4
|
+
export type { ComponentConfig, SearchConfig, TableConfig };
|
|
5
|
+
export type FieldType = ConfigSchema['properties'][''];
|
|
6
|
+
export type SchemaType = Required<SchemaDataType>['schema'];
|
|
7
|
+
export type AllFieldKeys = keyof FieldType;
|
|
8
|
+
export type AllOptionsPreNames = {
|
|
9
|
+
[K in AllFieldKeys]: K extends `${infer Name}${SuffixKey}` ? Name : never;
|
|
10
|
+
}[AllFieldKeys];
|
|
11
|
+
export type NonOptionKey = {
|
|
12
|
+
[K in AllFieldKeys]: K extends `${string}${SuffixKey}` ? never : K;
|
|
13
|
+
}[AllFieldKeys];
|
|
14
|
+
export type StoreSchemaType = UsedConfigSchema<BaseOption<FieldType[`${AllOptionsPreNames}${SuffixKey}`]>>;
|
|
15
|
+
export type NamedSchemaType<N extends `${AllOptionsPreNames}${SuffixKey}`> = UsedConfigSchema<BaseOption<FieldType[N]>>;
|
|
16
|
+
export type NamedComOption<N extends CallComNames> = ComponentType<ComponentConfig>[N];
|
|
17
|
+
export type NamedComponentConfig<N extends CallComNames> = ComponentConfig[N];
|
|
18
|
+
type ComponentC<C extends ComponentConfig> = {
|
|
19
|
+
[K in keyof C]: {
|
|
20
|
+
schema: StoreSchemaType;
|
|
21
|
+
config: C[K];
|
|
22
|
+
};
|
|
23
|
+
}[keyof C];
|
|
24
|
+
export type ComponentType<C extends ComponentConfig> = {
|
|
25
|
+
[K in keyof C]: ComponentC<C>;
|
|
26
|
+
};
|
|
27
|
+
export type CallComNames = keyof ComponentConfig;
|
|
28
|
+
export type SchemaDefaultValue = Record<string, any>;
|
|
29
|
+
export type SchemaTableEmitData = SchemaDefaultValue & {
|
|
30
|
+
comName: CallComNames;
|
|
31
|
+
};
|
|
32
|
+
export declare const enum ComEventType {
|
|
33
|
+
close = 0
|
|
34
|
+
}
|
|
35
|
+
export type SchemaComEventInfo = {
|
|
36
|
+
type: number;
|
|
37
|
+
};
|
|
38
|
+
export type CallComponent<T> = {
|
|
39
|
+
[K in CallComNames]: T;
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=schemaType.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { SchemaComEventInfo, SchemaDefaultValue, SchemaTableEmitData } from '../schemaType';
|
|
2
|
+
type WatchFn<V = SchemaDefaultValue | undefined> = (value: V) => void;
|
|
3
|
+
declare const enum SubscribeEnum {
|
|
4
|
+
search = "search",
|
|
5
|
+
table = "table",
|
|
6
|
+
com = "com"
|
|
7
|
+
}
|
|
8
|
+
interface SchemaEventBusStore {
|
|
9
|
+
readonly Subscribers: Map<WatchFn, SubscribeEnum>;
|
|
10
|
+
subscribeSearch: (fn: WatchFn) => void;
|
|
11
|
+
unSubscribeSearch: (fn: WatchFn) => void;
|
|
12
|
+
emitSearch: (v: SchemaDefaultValue | undefined) => void;
|
|
13
|
+
subscribeTable: (fn: WatchFn<SchemaTableEmitData>) => void;
|
|
14
|
+
unSubscribeTable: (fn: WatchFn<SchemaTableEmitData>) => void;
|
|
15
|
+
emitTable: (v: SchemaTableEmitData) => void;
|
|
16
|
+
emitCall: (v: SchemaDefaultValue | undefined, type: SubscribeEnum) => void;
|
|
17
|
+
subscribeCom: (fn: WatchFn<SchemaComEventInfo>) => void;
|
|
18
|
+
unSubscribeCom: (fn: WatchFn<SchemaComEventInfo>) => void;
|
|
19
|
+
emitCom: (v: SchemaComEventInfo) => void;
|
|
20
|
+
}
|
|
21
|
+
export declare const schemaEventBus: import("zustand").StoreApi<SchemaEventBusStore>;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=schemaEventBus.d.ts.map
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { logSubscriptionError } from '../../../../widgets/common/logFn';
|
|
2
|
+
import { createStore } from 'zustand';
|
|
3
|
+
var SubscribeEnum;
|
|
4
|
+
(function (SubscribeEnum) {
|
|
5
|
+
SubscribeEnum["search"] = "search";
|
|
6
|
+
SubscribeEnum["table"] = "table";
|
|
7
|
+
SubscribeEnum["com"] = "com";
|
|
8
|
+
})(SubscribeEnum || (SubscribeEnum = {}));
|
|
9
|
+
export const schemaEventBus = createStore((set, get) => {
|
|
10
|
+
return {
|
|
11
|
+
Subscribers: new Map(),
|
|
12
|
+
subscribeCom(fn) {
|
|
13
|
+
get().Subscribers.set(fn, SubscribeEnum.com);
|
|
14
|
+
},
|
|
15
|
+
unSubscribeCom(fn) {
|
|
16
|
+
const { Subscribers } = get();
|
|
17
|
+
if (Subscribers.has(fn)) {
|
|
18
|
+
Subscribers.delete(fn);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
logSubscriptionError();
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
emitCom(v) {
|
|
25
|
+
get().emitCall(v, SubscribeEnum.com);
|
|
26
|
+
},
|
|
27
|
+
subscribeTable(fn) {
|
|
28
|
+
get().Subscribers.set(fn, SubscribeEnum.table);
|
|
29
|
+
},
|
|
30
|
+
unSubscribeTable(fn) {
|
|
31
|
+
const { Subscribers } = get();
|
|
32
|
+
if (Subscribers.has(fn)) {
|
|
33
|
+
Subscribers.delete(fn);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
logSubscriptionError();
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
emitTable(v) {
|
|
40
|
+
get().emitCall(v, SubscribeEnum.table);
|
|
41
|
+
},
|
|
42
|
+
emitCall(v, calType) {
|
|
43
|
+
const { Subscribers } = get();
|
|
44
|
+
for (const [fn, type] of Subscribers.entries()) {
|
|
45
|
+
if (calType === type) {
|
|
46
|
+
fn(v);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
},
|
|
50
|
+
subscribeSearch(fn) {
|
|
51
|
+
get().Subscribers.set(fn, SubscribeEnum.search);
|
|
52
|
+
},
|
|
53
|
+
unSubscribeSearch(fn) {
|
|
54
|
+
const { Subscribers } = get();
|
|
55
|
+
if (Subscribers.has(fn)) {
|
|
56
|
+
Subscribers.delete(fn);
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
logSubscriptionError();
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
emitSearch(v) {
|
|
63
|
+
get().emitCall(v, SubscribeEnum.search);
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { LRUCache } from '../../../../../packages/common/index.js';
|
|
2
|
+
import { TableSearchSchema } from '../../../../../packages/ui/react/components/TableSearch/TableSearch';
|
|
3
|
+
import type { MOmit } from '../../../../../typings/type';
|
|
4
|
+
import type { ComponentConfig, ComponentType, SearchConfig, StoreSchemaType, TableConfig } from '../schemaType';
|
|
5
|
+
interface FunctionalData {
|
|
6
|
+
api: string;
|
|
7
|
+
components: ComponentType<ComponentConfig>;
|
|
8
|
+
tableSchema: StoreSchemaType;
|
|
9
|
+
tableConfig: TableConfig;
|
|
10
|
+
searchSchema: StoreSchemaType;
|
|
11
|
+
searchConfig: SearchConfig;
|
|
12
|
+
}
|
|
13
|
+
interface ComSchemaCache {
|
|
14
|
+
searchSchema: TableSearchSchema<Record<string, any>>[];
|
|
15
|
+
}
|
|
16
|
+
interface SchemaStoreState extends Partial<FunctionalData> {
|
|
17
|
+
readonly schemaStoreAvailable: boolean;
|
|
18
|
+
readonly schemaCache: LRUCache<FunctionalData>;
|
|
19
|
+
readonly comSchemaCache: LRUCache<ComSchemaCache>;
|
|
20
|
+
}
|
|
21
|
+
interface SchemaStoreActions {
|
|
22
|
+
setSchemaState: (data: Partial<MOmit<SchemaStoreState, 'schemaStoreAvailable' | 'schemaCache'>>) => void;
|
|
23
|
+
updateSchemaCache: (data: FunctionalData & {
|
|
24
|
+
schemaKey: string;
|
|
25
|
+
}) => void;
|
|
26
|
+
updateComSchemaCache: (data: ComSchemaCache & {
|
|
27
|
+
schemaKey: string;
|
|
28
|
+
}) => void;
|
|
29
|
+
}
|
|
30
|
+
export declare const schemaStore: import("zustand").StoreApi<SchemaStoreState & SchemaStoreActions>;
|
|
31
|
+
export declare const useSchemaStore: import("../../../../../packages/ui/react/index").StoreHook<import("zustand").StoreApi<SchemaStoreState & SchemaStoreActions>>;
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=schemaStore.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LRUCache } from '../../../../../packages/common/index.js';
|
|
2
|
+
import { createStoreHook } from '../../../../../packages/ui/react/index';
|
|
3
|
+
import { createStore } from 'zustand';
|
|
4
|
+
export const schemaStore = createStore((set, get) => ({
|
|
5
|
+
api: '',
|
|
6
|
+
schemaStoreAvailable: false,
|
|
7
|
+
schemaCache: new LRUCache(5),
|
|
8
|
+
comSchemaCache: new LRUCache(5),
|
|
9
|
+
setSchemaState: (state) => {
|
|
10
|
+
set({ ...state });
|
|
11
|
+
set({ schemaStoreAvailable: !!get().api });
|
|
12
|
+
},
|
|
13
|
+
updateSchemaCache: (data) => {
|
|
14
|
+
const { schemaKey, ...params } = data;
|
|
15
|
+
const { schemaCache } = get();
|
|
16
|
+
schemaCache.set(schemaKey, params);
|
|
17
|
+
},
|
|
18
|
+
updateComSchemaCache: (data) => {
|
|
19
|
+
const { schemaKey, ...params } = data;
|
|
20
|
+
const { comSchemaCache } = get();
|
|
21
|
+
comSchemaCache.set(schemaKey, params);
|
|
22
|
+
},
|
|
23
|
+
}));
|
|
24
|
+
export const useSchemaStore = createStoreHook(schemaStore);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { BaseResponse, ResponseConfig } from '../../../../widgets/common/request';
|
|
2
|
+
export declare const handlingRequestErrors: <D>(data: Promise<ResponseConfig<BaseResponse<D>, any>>) => Promise<ResponseConfig<BaseResponse<D>, any>>;
|
|
3
|
+
//# sourceMappingURL=fetchErrorShow.d.ts.map
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { suffixKey } from '../data';
|
|
2
|
+
import { schemaStore } from '../stores/schemaStore';
|
|
3
|
+
const buildSchema = (schema, fieldType) => {
|
|
4
|
+
if (!schema.properties)
|
|
5
|
+
return;
|
|
6
|
+
const temSchema = {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {},
|
|
9
|
+
required: schema.required,
|
|
10
|
+
};
|
|
11
|
+
for (const key in schema.properties) {
|
|
12
|
+
const fieldInfo = schema.properties[key];
|
|
13
|
+
const fieldKeys = Object.keys(fieldInfo);
|
|
14
|
+
temSchema.properties[key] = fieldKeys.reduce((o, fieldKey) => {
|
|
15
|
+
if (fieldKey.indexOf(suffixKey) !== -1) {
|
|
16
|
+
if (fieldKey === `${fieldType}${suffixKey}`) {
|
|
17
|
+
o['option'] = fieldInfo[fieldKey];
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
;
|
|
22
|
+
o[fieldKey] = fieldInfo[fieldKey];
|
|
23
|
+
}
|
|
24
|
+
return o;
|
|
25
|
+
}, {});
|
|
26
|
+
}
|
|
27
|
+
return temSchema;
|
|
28
|
+
};
|
|
29
|
+
export const schemaConversion = (schema, schemaKey) => {
|
|
30
|
+
const { schemaCache, setSchemaState } = schemaStore.getState();
|
|
31
|
+
if (schemaCache.has(schemaKey)) {
|
|
32
|
+
setSchemaState({
|
|
33
|
+
...schemaCache.get(schemaKey),
|
|
34
|
+
});
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
const { api, schema: schemaMetadata = {}, componentConfig, tableConfig, searchConfig } = schema;
|
|
38
|
+
const tableSchema = buildSchema(JSON.parse(JSON.stringify(schemaMetadata)), 'table');
|
|
39
|
+
const searchSchema = buildSchema(JSON.parse(JSON.stringify(schemaMetadata)), 'search');
|
|
40
|
+
let components = {};
|
|
41
|
+
if (componentConfig) {
|
|
42
|
+
const componentKeys = Object.keys(componentConfig ?? {});
|
|
43
|
+
components = componentKeys.reduce((o, comKey) => {
|
|
44
|
+
const comSchema = buildSchema(JSON.parse(JSON.stringify(schemaMetadata)), comKey);
|
|
45
|
+
o[comKey] = {
|
|
46
|
+
schema: comSchema,
|
|
47
|
+
config: componentConfig[comKey],
|
|
48
|
+
};
|
|
49
|
+
return o;
|
|
50
|
+
}, {});
|
|
51
|
+
}
|
|
52
|
+
{
|
|
53
|
+
const { setSchemaState, updateSchemaCache } = schemaStore.getState();
|
|
54
|
+
setSchemaState({
|
|
55
|
+
api,
|
|
56
|
+
components,
|
|
57
|
+
tableSchema,
|
|
58
|
+
tableConfig,
|
|
59
|
+
searchSchema,
|
|
60
|
+
searchConfig,
|
|
61
|
+
});
|
|
62
|
+
updateSchemaCache({
|
|
63
|
+
api,
|
|
64
|
+
schemaKey,
|
|
65
|
+
components,
|
|
66
|
+
tableSchema: tableSchema,
|
|
67
|
+
tableConfig: tableConfig,
|
|
68
|
+
searchSchema: searchSchema,
|
|
69
|
+
searchConfig: searchConfig,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ajv } from 'ajv';
|
|
2
|
+
export const ajvInstance = new Ajv({ allErrors: true, verbose: true, strict: false });
|
|
3
|
+
export function createAjvValidator(schema) {
|
|
4
|
+
const validate = ajvInstance.compile(schema);
|
|
5
|
+
return (rule, value, callback) => {
|
|
6
|
+
const valid = validate(value);
|
|
7
|
+
if (valid) {
|
|
8
|
+
callback();
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
const messages = (validate.errors || []).map(formatError);
|
|
12
|
+
callback(messages);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function formatError(error) {
|
|
17
|
+
const path = error.instancePath.replace(/^\//, '') || 'value';
|
|
18
|
+
switch (error.keyword) {
|
|
19
|
+
case 'required':
|
|
20
|
+
return `缺少必填字段: ${error.params.missingProperty}`;
|
|
21
|
+
case 'type':
|
|
22
|
+
return `${path} 类型错误,期望 ${error.params.type}`;
|
|
23
|
+
case 'format':
|
|
24
|
+
return `${path} 格式不正确`;
|
|
25
|
+
case 'minimum':
|
|
26
|
+
case 'maximum':
|
|
27
|
+
return `${path} 超出允许范围`;
|
|
28
|
+
default:
|
|
29
|
+
return `${path} ${error.message}`;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseMenuType } from '../../../../model/types/menuType';
|
|
2
|
+
import { MenuItemData } from '../../../../packages/ui/react/components';
|
|
3
|
+
interface SidebarSlotContainerProps {
|
|
4
|
+
prefixPath: string;
|
|
5
|
+
rawMenuData: BaseMenuType[];
|
|
6
|
+
menuItems: MenuItemData[];
|
|
7
|
+
}
|
|
8
|
+
declare const SidebarSlotContainer: (props: SidebarSlotContainerProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export default SidebarSlotContainer;
|
|
10
|
+
//# sourceMappingURL=SidebarSlotContainer.d.ts.map
|