@_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,124 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { createContext, useCallback, useContext, useRef, useState, } from "react";
|
|
4
|
+
import { ChevronDown, ChevronRight, ChevronUp } from "lucide-react";
|
|
5
|
+
import { Popup } from "../Popup";
|
|
6
|
+
import { CollapsedContext, useMenuStore } from "./MenuContext";
|
|
7
|
+
import { getFirstChar } from "./utils";
|
|
8
|
+
const SUBMENU_POPUP_OFFSET = 12;
|
|
9
|
+
const SubMenuLevelContext = createContext(0);
|
|
10
|
+
const getTopNestedSubMenuPosition = ({ anchorRect, contentRect, viewportWidth, offset, matchAnchorWidth, }) => {
|
|
11
|
+
const width = contentRect?.width ?? 0;
|
|
12
|
+
const rightLeft = anchorRect.right + offset;
|
|
13
|
+
const canPlaceRight = rightLeft + width <= viewportWidth;
|
|
14
|
+
return {
|
|
15
|
+
top: anchorRect.top,
|
|
16
|
+
left: canPlaceRight
|
|
17
|
+
? rightLeft
|
|
18
|
+
: Math.max(0, anchorRect.left - width - offset),
|
|
19
|
+
width: matchAnchorWidth ? anchorRect.width : undefined,
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
function hasDescendantSelected(children, targetKey) {
|
|
23
|
+
if (!targetKey)
|
|
24
|
+
return false;
|
|
25
|
+
return walkReactChildren(children, targetKey);
|
|
26
|
+
}
|
|
27
|
+
function walkReactChildren(node, targetKey) {
|
|
28
|
+
if (!node)
|
|
29
|
+
return false;
|
|
30
|
+
if (Array.isArray(node))
|
|
31
|
+
return node.some((n) => walkReactChildren(n, targetKey));
|
|
32
|
+
if (typeof node === "object" && node && "props" in node) {
|
|
33
|
+
const props = node.props;
|
|
34
|
+
if (props.eventKey === targetKey)
|
|
35
|
+
return true;
|
|
36
|
+
if (walkReactChildren(props.children, targetKey))
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
function SubMenuItem({ triggerRef, onClick, icon, label, disabled, collapsed, descendantSelected, ArrowIcon, showArrow, setPopupContentRef, mode, }) {
|
|
42
|
+
const collapsedLabelTooltip = useMenuStore((s) => s.collapsedLabelTooltip);
|
|
43
|
+
return (_jsxs("div", { ref: triggerRef, onClick: onClick, className: cn("subMenuItem group relative flex items-center rounded-lg text-sm transition-all", "select-none", mode === "top" &&
|
|
44
|
+
"h-10 w-auto min-w-fit justify-start gap-3 px-3 py-2 text-left", mode === "left" &&
|
|
45
|
+
collapsed &&
|
|
46
|
+
"h-10 w-full justify-center gap-0 px-0 py-2", mode === "left" &&
|
|
47
|
+
!collapsed &&
|
|
48
|
+
"min-h-10 w-full gap-3 px-3 py-2.5 text-left", descendantSelected && "bg-theme/10 text-theme shadow-sm", !descendantSelected &&
|
|
49
|
+
"text-foreground hover:bg-gray-200 dark:hover:bg-gray-700", disabled && "cursor-not-allowed opacity-50"), children: [icon && (_jsx("span", { className: cn("flex h-7 w-7 flex-shrink-0 items-center justify-center rounded-md transition-colors", descendantSelected
|
|
50
|
+
? "bg-theme/10 text-theme"
|
|
51
|
+
: "text-muted-foreground group-hover:text-foreground"), children: icon })), !collapsed && _jsx("span", { className: "min-w-0 flex-1 truncate", children: label }), collapsed && !icon && collapsedLabelTooltip && (_jsx("span", { className: "absolute left-0 right-0 top-0 flex h-full items-center justify-center text-[10px]", children: getFirstChar(label) })), !collapsed && showArrow && (_jsx(ArrowIcon, { className: "h-4 w-4 flex-shrink-0 text-muted-foreground transition-transform group-hover:text-foreground" })), _jsx("div", { ref: setPopupContentRef })] }));
|
|
52
|
+
}
|
|
53
|
+
export function SubMenu({ eventKey, label, icon, disabled, popup: forcePopup, parentKey, children, }) {
|
|
54
|
+
const mode = useMenuStore((s) => s.mode);
|
|
55
|
+
const expandTrigger = useMenuStore((s) => s.expandTrigger);
|
|
56
|
+
const storeCollapsed = useMenuStore((s) => s.collapsed);
|
|
57
|
+
const collapsed = useContext(CollapsedContext);
|
|
58
|
+
const openKeys = useMenuStore((s) => s.openKeys);
|
|
59
|
+
const toggleOpenKey = useMenuStore((s) => s.toggleOpenKey);
|
|
60
|
+
const selectedKey = useMenuStore((s) => s.selectedKey);
|
|
61
|
+
const level = useContext(SubMenuLevelContext);
|
|
62
|
+
const isOpen = openKeys.includes(eventKey);
|
|
63
|
+
const triggerRef = useRef(null);
|
|
64
|
+
const popupContentRef = useRef(null);
|
|
65
|
+
const [popupContainer, setPopupContainer] = useState(undefined);
|
|
66
|
+
const [popupOpen, setPopupOpen] = useState(false);
|
|
67
|
+
const isInsidePopup = storeCollapsed && !collapsed;
|
|
68
|
+
const usePopup = mode === "top" ||
|
|
69
|
+
(mode === "left" && collapsed) ||
|
|
70
|
+
isInsidePopup ||
|
|
71
|
+
forcePopup === true;
|
|
72
|
+
const descendantSelected = hasDescendantSelected(children, selectedKey);
|
|
73
|
+
const setPopupContentRef = useCallback((el) => {
|
|
74
|
+
popupContentRef.current = el;
|
|
75
|
+
if (el)
|
|
76
|
+
setPopupContainer(el);
|
|
77
|
+
}, []);
|
|
78
|
+
const handleMouseEnter = useCallback(() => {
|
|
79
|
+
if (disabled)
|
|
80
|
+
return;
|
|
81
|
+
if (usePopup) {
|
|
82
|
+
setPopupOpen(true);
|
|
83
|
+
}
|
|
84
|
+
else if (expandTrigger === "hover" && !isOpen) {
|
|
85
|
+
toggleOpenKey(eventKey, parentKey);
|
|
86
|
+
}
|
|
87
|
+
}, [
|
|
88
|
+
disabled,
|
|
89
|
+
usePopup,
|
|
90
|
+
expandTrigger,
|
|
91
|
+
isOpen,
|
|
92
|
+
eventKey,
|
|
93
|
+
parentKey,
|
|
94
|
+
toggleOpenKey,
|
|
95
|
+
]);
|
|
96
|
+
const handleMouseLeave = useCallback(() => {
|
|
97
|
+
if (usePopup) {
|
|
98
|
+
setPopupOpen(false);
|
|
99
|
+
}
|
|
100
|
+
}, [usePopup]);
|
|
101
|
+
const handleTriggerClick = useCallback(() => {
|
|
102
|
+
if (disabled)
|
|
103
|
+
return;
|
|
104
|
+
if (usePopup) {
|
|
105
|
+
setPopupOpen((prev) => !prev);
|
|
106
|
+
}
|
|
107
|
+
else {
|
|
108
|
+
toggleOpenKey(eventKey, parentKey);
|
|
109
|
+
}
|
|
110
|
+
}, [disabled, usePopup, eventKey, parentKey, toggleOpenKey]);
|
|
111
|
+
const showArrow = !(mode === "left" && collapsed);
|
|
112
|
+
const ArrowIcon = usePopup
|
|
113
|
+
? mode === "top" && level === 0
|
|
114
|
+
? ChevronDown
|
|
115
|
+
: ChevronRight
|
|
116
|
+
: isOpen
|
|
117
|
+
? ChevronUp
|
|
118
|
+
: ChevronDown;
|
|
119
|
+
const popupPlacement = mode === "top" && level === 0 ? "bottom-start" : "right-start";
|
|
120
|
+
const popupStrategy = mode === "top" && level > 0 ? getTopNestedSubMenuPosition : undefined;
|
|
121
|
+
const hoverBridgePlacement = mode === "top" && level > 0 ? "horizontal" : "auto";
|
|
122
|
+
const subMenuContent = (_jsx("div", { className: cn(" rounded-xl bg-muted p-2 shadow-[0_18px_44px_rgba(15,23,42,0.14),0_4px_12px_rgba(15,23,42,0.08)]"), children: _jsx(SubMenuLevelContext.Provider, { value: level + 1, children: _jsx("div", { className: "flex flex-col gap-1", children: children }) }) }));
|
|
123
|
+
return (_jsxs("div", { className: "submenu", onMouseEnter: handleMouseEnter, onMouseLeave: handleMouseLeave, children: [_jsx(SubMenuItem, { triggerRef: triggerRef, onClick: handleTriggerClick, icon: icon, label: label, disabled: disabled, collapsed: collapsed, descendantSelected: descendantSelected, ArrowIcon: ArrowIcon, showArrow: showArrow, setPopupContentRef: setPopupContentRef, mode: mode }), usePopup ? (_jsx(Popup, { open: popupOpen, anchorRef: triggerRef, placement: popupPlacement, offset: SUBMENU_POPUP_OFFSET, hoverBridge: SUBMENU_POPUP_OFFSET, onOpenChange: setPopupOpen, container: popupContainer, strategy: popupStrategy, hoverBridgePlacement: hoverBridgePlacement, className: "border-0 bg-transparent p-0 shadow-none", children: _jsx(CollapsedContext.Provider, { value: false, children: subMenuContent }) })) : (isOpen && (_jsx("div", { className: "ml-4 pl-2 pt-1", children: _jsx(SubMenuLevelContext.Provider, { value: level + 1, children: _jsx("div", { className: "flex flex-col gap-1", children: children }) }) })))] }));
|
|
124
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { Menu } from './Menu';
|
|
2
|
+
export { MenuItem } from './MenuItem';
|
|
3
|
+
export { SubMenu } from './SubMenu';
|
|
4
|
+
export { CollapseToggle } from './Menu';
|
|
5
|
+
export type { MenuProps, MenuItemData, MenuItemProps, SubMenuProps } from './menuTypes';
|
|
6
|
+
export type { CollapseToggleHandle, CollapseToggleProps } from './Menu';
|
|
7
|
+
export { useMenuStore } from './MenuContext';
|
|
8
|
+
export type { MenuStore } from './MenuContext';
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { CSSProperties, MouseEventHandler, ReactNode, Ref } from 'react';
|
|
2
|
+
export interface MenuItemData {
|
|
3
|
+
key: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
danger?: boolean;
|
|
8
|
+
popup?: boolean;
|
|
9
|
+
children?: MenuItemData[];
|
|
10
|
+
onClick?: () => void;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
width?: CSSProperties['width'];
|
|
14
|
+
minWidth?: CSSProperties['minWidth'];
|
|
15
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
16
|
+
}
|
|
17
|
+
export interface MenuProps {
|
|
18
|
+
mode?: 'top' | 'left';
|
|
19
|
+
expandTrigger?: 'hover' | 'click';
|
|
20
|
+
expandMode?: 'accordion' | 'multiple';
|
|
21
|
+
selectedKey?: string;
|
|
22
|
+
defaultSelectedKey?: string;
|
|
23
|
+
onSelect?: (key: string) => void;
|
|
24
|
+
items?: MenuItemData[];
|
|
25
|
+
children?: ReactNode;
|
|
26
|
+
className?: string;
|
|
27
|
+
collapsed?: boolean;
|
|
28
|
+
defaultCollapsed?: boolean;
|
|
29
|
+
onCollapse?: (collapsed: boolean) => void;
|
|
30
|
+
collapsedWidth?: number;
|
|
31
|
+
collapsedLabelTooltip?: boolean;
|
|
32
|
+
}
|
|
33
|
+
export interface SubMenuProps {
|
|
34
|
+
eventKey: string;
|
|
35
|
+
label: ReactNode;
|
|
36
|
+
icon?: ReactNode;
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
popup?: boolean;
|
|
39
|
+
parentKey?: string;
|
|
40
|
+
children?: ReactNode;
|
|
41
|
+
}
|
|
42
|
+
export interface MenuItemProps {
|
|
43
|
+
eventKey?: string;
|
|
44
|
+
icon?: ReactNode;
|
|
45
|
+
disabled?: boolean;
|
|
46
|
+
danger?: boolean;
|
|
47
|
+
onClick?: () => void;
|
|
48
|
+
children?: ReactNode;
|
|
49
|
+
className?: string;
|
|
50
|
+
style?: CSSProperties;
|
|
51
|
+
width?: CSSProperties['width'];
|
|
52
|
+
minWidth?: CSSProperties['minWidth'];
|
|
53
|
+
maxWidth?: CSSProperties['maxWidth'];
|
|
54
|
+
onMouseLeave?: MouseEventHandler<HTMLButtonElement>;
|
|
55
|
+
onMouseEnter?: MouseEventHandler<HTMLButtonElement>;
|
|
56
|
+
ref?: Ref<HTMLButtonElement>;
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=menuTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -4,15 +4,8 @@ export type MessageProps = {
|
|
|
4
4
|
type?: MessageType;
|
|
5
5
|
content?: ReactNode;
|
|
6
6
|
children?: ReactNode;
|
|
7
|
-
/**
|
|
8
|
-
* 存在时间
|
|
9
|
-
* @default 3000ms
|
|
10
|
-
*/
|
|
11
7
|
duration?: number;
|
|
12
8
|
onClose?: () => void;
|
|
13
|
-
/**
|
|
14
|
-
* 可手动关闭
|
|
15
|
-
*/
|
|
16
9
|
closable?: boolean;
|
|
17
10
|
className?: string;
|
|
18
11
|
};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useI18n } from '../../i18n';
|
|
2
3
|
import { cn } from '../../lib/utils';
|
|
3
4
|
import { AlertCircle, CheckCircle2, Info, X, XCircle } from 'lucide-react';
|
|
4
5
|
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { Button } from '../Button';
|
|
5
7
|
import { DEFAULT_DURATION } from './data';
|
|
6
8
|
const typeConfig = {
|
|
7
9
|
success: {
|
|
@@ -22,6 +24,7 @@ const typeConfig = {
|
|
|
22
24
|
},
|
|
23
25
|
};
|
|
24
26
|
export function Message({ type = 'info', content, children, duration = DEFAULT_DURATION, onClose, closable = true, className, }) {
|
|
27
|
+
const t = useI18n();
|
|
25
28
|
const displayContent = children ?? content;
|
|
26
29
|
const [visible, setVisible] = useState(true);
|
|
27
30
|
const timerRef = useRef(null);
|
|
@@ -30,12 +33,10 @@ export function Message({ type = 'info', content, children, duration = DEFAULT_D
|
|
|
30
33
|
const iconColor = typeConfig[type].color;
|
|
31
34
|
const handleClose = () => {
|
|
32
35
|
setVisible(false);
|
|
33
|
-
// 等待动画完成后再调用 onClose
|
|
34
36
|
setTimeout(() => {
|
|
35
37
|
onClose?.();
|
|
36
38
|
}, 200);
|
|
37
39
|
};
|
|
38
|
-
// 自动关闭
|
|
39
40
|
useEffect(() => {
|
|
40
41
|
if (duration > 0) {
|
|
41
42
|
timerRef.current = setTimeout(() => {
|
|
@@ -47,9 +48,8 @@ export function Message({ type = 'info', content, children, duration = DEFAULT_D
|
|
|
47
48
|
clearTimeout(timerRef.current);
|
|
48
49
|
}
|
|
49
50
|
};
|
|
50
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
51
51
|
}, [duration]);
|
|
52
52
|
if (!visible)
|
|
53
53
|
return null;
|
|
54
|
-
return (_jsxs("div", { ref: messageRef, className: cn('flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg', 'bg-background border border-border', 'min-w-[320px] max-w-[480px]', 'transition-all duration-200', 'pointer-events-auto', visible ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-2', className), children: [_jsx(Icon, { size: 20, className: cn('flex-shrink-0 mt-0.5', iconColor) }), _jsx("div", { className: "flex-1 text-sm text-foreground", children: displayContent }), closable && (_jsx("
|
|
54
|
+
return (_jsxs("div", { ref: messageRef, className: cn('tc-ui-message flex items-start gap-3 px-4 py-3 rounded-lg shadow-lg', 'bg-background border border-border', 'min-w-[320px] max-w-[480px]', 'transition-all duration-200', 'pointer-events-auto', visible ? 'opacity-100 translate-y-0' : 'opacity-0 -translate-y-2', className), children: [_jsx(Icon, { size: 20, className: cn('flex-shrink-0 mt-0.5', iconColor) }), _jsx("div", { className: "flex-1 text-sm text-foreground", children: displayContent }), closable && (_jsx(Button, { variant: "text", type: "button", onClick: handleClose, "aria-label": t('components.message.close'), className: cn('flex-shrink-0 p-0.5 rounded-md', 'text-muted-foreground hover:text-foreground', 'hover:bg-muted', 'transition-colors', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'), children: _jsx(X, { size: 16 }) }))] }));
|
|
55
55
|
}
|
|
@@ -12,20 +12,17 @@ class MessageManagerClass {
|
|
|
12
12
|
init() {
|
|
13
13
|
if (typeof document === 'undefined' || this.container)
|
|
14
14
|
return;
|
|
15
|
-
// 可见消息容器
|
|
16
15
|
this.container = document.createElement('div');
|
|
17
16
|
this.container.id = 'message-container';
|
|
18
17
|
this.container.className = 'fixed top-4 left-1/2 z-[10000] flex flex-col items-center gap-2 pointer-events-none';
|
|
19
18
|
this.container.style.transform = 'translateX(-50%)';
|
|
20
19
|
document.body.appendChild(this.container);
|
|
21
|
-
// 屏幕外消息容器 保留回调触发
|
|
22
20
|
this.offScreenContainer = document.createElement('div');
|
|
23
21
|
this.offScreenContainer.id = 'message-offscreen-container';
|
|
24
22
|
this.offScreenContainer.className =
|
|
25
23
|
'fixed -left-[9999px] top-0 z-[10000] flex flex-col items-center gap-2 pointer-events-none';
|
|
26
24
|
this.offScreenContainer.setAttribute('aria-hidden', 'true');
|
|
27
25
|
document.body.appendChild(this.offScreenContainer);
|
|
28
|
-
// 创建 React 根节点
|
|
29
26
|
this.root = createRoot(this.container);
|
|
30
27
|
this.offScreenRoot = createRoot(this.offScreenContainer);
|
|
31
28
|
this.render();
|
|
@@ -35,17 +32,13 @@ class MessageManagerClass {
|
|
|
35
32
|
return;
|
|
36
33
|
const messages = Array.from(this.messages.values());
|
|
37
34
|
const totalCount = messages.length;
|
|
38
|
-
// 可见消息:最后 maxCount 条
|
|
39
35
|
const displayMessages = totalCount > this.maxCount ? messages.slice(-this.maxCount) : messages;
|
|
40
|
-
// 屏幕外消息:除了最后 maxCount 条之外的所有消息
|
|
41
36
|
const offScreenMessages = totalCount > this.maxCount ? messages.slice(0, -this.maxCount) : [];
|
|
42
37
|
const now = Date.now();
|
|
43
|
-
// 渲染可见消息
|
|
44
38
|
this.root.render(_jsx(_Fragment, { children: displayMessages.map((message) => (_jsx(Message, { ...message, duration: message.expirationTime - now, content: message.content, onClose: () => {
|
|
45
39
|
message.onClose?.();
|
|
46
40
|
this.close(message.id);
|
|
47
41
|
} }, message.id))) }));
|
|
48
|
-
// 渲染屏幕外消息
|
|
49
42
|
this.offScreenRoot.render(_jsx(_Fragment, { children: offScreenMessages.map((message) => (_jsx(Message, { ...message, duration: message.expirationTime - now, content: message.content, onClose: () => {
|
|
50
43
|
message.onClose?.();
|
|
51
44
|
this.close(message.id);
|
|
@@ -77,7 +70,6 @@ class MessageManagerClass {
|
|
|
77
70
|
this.maxCount = count;
|
|
78
71
|
}
|
|
79
72
|
}
|
|
80
|
-
// 单例模式
|
|
81
73
|
export const messageManager = new MessageManagerClass();
|
|
82
74
|
export const message = {
|
|
83
75
|
success: (content, config) => messageManager.show({ content, ...config }, 'success'),
|
|
@@ -7,19 +7,15 @@ export type ModalProps = {
|
|
|
7
7
|
footer?: ReactNode;
|
|
8
8
|
className?: string;
|
|
9
9
|
contentClassName?: string;
|
|
10
|
+
mask?: boolean;
|
|
10
11
|
maskClosable?: boolean;
|
|
12
|
+
lockScroll?: boolean;
|
|
11
13
|
closable?: boolean;
|
|
12
14
|
width?: number | string;
|
|
13
15
|
centered?: boolean;
|
|
14
16
|
zIndex?: number;
|
|
15
|
-
/**
|
|
16
|
-
* @default document.body
|
|
17
|
-
*/
|
|
18
17
|
renderNode?: HTMLElement | (() => HTMLElement);
|
|
19
|
-
/**
|
|
20
|
-
* 是否支持键盘关闭 默认开启
|
|
21
|
-
*/
|
|
22
18
|
keyboard?: boolean;
|
|
23
19
|
};
|
|
24
|
-
export declare function Modal({ open, onClose, title, children, footer, className, contentClassName, maskClosable, closable, width, centered, renderNode, keyboard, zIndex, }: ModalProps): import("react").
|
|
20
|
+
export declare function Modal({ open, onClose, title, children, footer, className, contentClassName, mask, maskClosable, lockScroll, closable, width, centered, renderNode, keyboard, zIndex, }: ModalProps): import("react/jsx-runtime").JSX.Element;
|
|
25
21
|
//# sourceMappingURL=Modal.d.ts.map
|
|
@@ -1,51 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useI18n } from '../../i18n';
|
|
2
3
|
import { cn } from '../../lib/utils';
|
|
3
4
|
import { X } from 'lucide-react';
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
export function Modal({ open = false, onClose, title, children, footer, className, contentClassName, maskClosable = true, closable = true, width = 520, centered = true, renderNode
|
|
7
|
-
const
|
|
8
|
-
const contentRef = useRef(null);
|
|
9
|
-
// 处理 ESC 键关闭
|
|
10
|
-
useEffect(() => {
|
|
11
|
-
if (!open || !keyboard)
|
|
12
|
-
return;
|
|
13
|
-
const handleEscape = (e) => {
|
|
14
|
-
if (e.key === 'Escape' && closable) {
|
|
15
|
-
onClose?.();
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
document.addEventListener('keydown', handleEscape);
|
|
19
|
-
return () => {
|
|
20
|
-
document.removeEventListener('keydown', handleEscape);
|
|
21
|
-
};
|
|
22
|
-
}, [open, closable, onClose, keyboard]);
|
|
23
|
-
// 阻止 body 滚动
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
if (open) {
|
|
26
|
-
const originalOverflow = document.body.style.overflow;
|
|
27
|
-
document.body.style.overflow = 'hidden';
|
|
28
|
-
return () => {
|
|
29
|
-
document.body.style.overflow = originalOverflow;
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
return () => { };
|
|
34
|
-
}
|
|
35
|
-
}, [open]);
|
|
36
|
-
// 点击遮罩层关闭
|
|
37
|
-
const handleMaskClick = (e) => {
|
|
38
|
-
if (maskClosable && e.target === e.currentTarget) {
|
|
39
|
-
onClose?.();
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
// 点击内容区域阻止冒泡
|
|
5
|
+
import { Button } from '../Button';
|
|
6
|
+
import { Overlay } from '../Overlay';
|
|
7
|
+
export function Modal({ open = false, onClose, title, children, footer, className, contentClassName, mask = true, maskClosable = true, lockScroll = true, closable = true, width = 520, centered = true, renderNode, keyboard = true, zIndex = 1000, }) {
|
|
8
|
+
const t = useI18n();
|
|
43
9
|
const handleContentClick = (e) => {
|
|
44
10
|
e.stopPropagation();
|
|
45
11
|
};
|
|
46
|
-
|
|
47
|
-
return null;
|
|
48
|
-
const modalContent = (_jsx("div", { ref: modalRef, className: cn('fixed inset-0 z-[1000] flex items-center justify-center', 'bg-black/50 backdrop-blur-sm', 'transition-opacity duration-200', open ? 'opacity-100' : 'opacity-0'), style: { zIndex }, onClick: handleMaskClick, children: _jsxs("div", { ref: contentRef, className: cn('relative bg-background rounded-lg shadow-lg', 'flex flex-col max-h-[90vh]', 'transition-all duration-200', open ? 'scale-100 opacity-100' : 'scale-95 opacity-0', centered ? 'my-auto' : 'mt-[10vh]', className), style: { width: typeof width === 'number' ? `${width}px` : width }, onClick: handleContentClick, children: [(title || closable) && (_jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-border", children: [title && _jsx("div", { className: "text-lg font-semibold text-foreground", children: title }), closable && (_jsx("button", { type: "button", onClick: onClose, "aria-label": "\u5173\u95ED", className: cn('ml-auto p-1 rounded-md', 'text-muted-foreground hover:text-foreground', 'hover:bg-muted', 'transition-colors', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'), children: _jsx(X, { size: 20 }) }))] })), _jsx("div", { className: cn('flex-1 overflow-auto px-6 py-4', contentClassName), children: children }), footer && _jsx("div", { className: "px-6 py-4 border-border", children: footer })] }) }));
|
|
49
|
-
const parent = typeof renderNode === 'function' ? renderNode() : renderNode;
|
|
50
|
-
return createPortal(modalContent, parent);
|
|
12
|
+
return (_jsx(Overlay, { open: open, onClose: onClose, mask: mask, maskClosable: maskClosable, lockScroll: lockScroll, keyboard: keyboard, closable: closable, renderNode: renderNode, zIndex: zIndex, className: cn('tc-ui-modal flex items-center justify-center'), children: _jsxs("div", { className: cn('relative bg-background rounded-lg shadow-lg', 'flex flex-col max-h-[90vh]', 'transition-all duration-200', open ? 'scale-100 opacity-100' : 'scale-95 opacity-0', centered ? 'my-auto' : 'mt-[10vh]', className), style: { width: typeof width === 'number' ? `${width}px` : width }, onClick: handleContentClick, children: [(title || closable) && (_jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-border", children: [title && _jsx("div", { className: "text-lg font-semibold text-foreground", children: title }), closable && (_jsx(Button, { variant: "text", type: "button", onClick: onClose, "aria-label": t('components.modal.close'), className: cn('ml-auto p-1 rounded-md', 'text-muted-foreground hover:text-foreground', 'hover:bg-muted', 'transition-colors', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'), children: _jsx(X, { size: 20 }) }))] })), _jsx("div", { className: cn('flex-1 overflow-auto px-6 py-4', contentClassName), children: children }), footer && _jsx("div", { className: "px-6 py-4 border-border", children: footer })] }) }));
|
|
51
13
|
}
|
|
@@ -22,34 +22,22 @@ declare class ModalManagerClass {
|
|
|
22
22
|
}
|
|
23
23
|
type OpenModalConfig = Omit<ModalConfig, 'id'>;
|
|
24
24
|
export declare const openConfirmModal: (pConfig: Pick<OpenModalConfig, "content"> & {
|
|
25
|
-
/** 标题 */
|
|
26
25
|
title?: ReactNode;
|
|
27
|
-
/** 内容 */
|
|
28
26
|
content: ReactNode;
|
|
29
|
-
/** 确认按钮文本 */
|
|
30
27
|
okText?: string;
|
|
31
|
-
/** 取消按钮文本 */
|
|
32
28
|
cancelText?: string;
|
|
33
|
-
/** 确认回调 */
|
|
34
29
|
onOk?: SumbitButtonProps["onClick"];
|
|
35
|
-
/** 取消回调 */
|
|
36
30
|
onCancel?: () => void;
|
|
37
31
|
}) => string;
|
|
38
32
|
export declare const modalManager: ModalManagerClass;
|
|
39
33
|
export declare const modal: {
|
|
40
34
|
open: (config: OpenModalConfig) => string;
|
|
41
35
|
confirm: (pConfig: Pick<OpenModalConfig, "content"> & {
|
|
42
|
-
/** 标题 */
|
|
43
36
|
title?: ReactNode;
|
|
44
|
-
/** 内容 */
|
|
45
37
|
content: ReactNode;
|
|
46
|
-
/** 确认按钮文本 */
|
|
47
38
|
okText?: string;
|
|
48
|
-
/** 取消按钮文本 */
|
|
49
39
|
cancelText?: string;
|
|
50
|
-
/** 确认回调 */
|
|
51
40
|
onOk?: SumbitButtonProps["onClick"];
|
|
52
|
-
/** 取消回调 */
|
|
53
41
|
onCancel?: () => void;
|
|
54
42
|
}) => string;
|
|
55
43
|
close: (id: string) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { t } from '../../i18n';
|
|
2
3
|
import { createRoot } from 'react-dom/client';
|
|
3
4
|
import { AsynchronousButton, Button } from '../Button';
|
|
4
5
|
import { Modal } from './Modal';
|
|
@@ -13,7 +14,6 @@ class ModalManagerClass {
|
|
|
13
14
|
this.container = document.createElement('div');
|
|
14
15
|
this.container.id = 'modal-container';
|
|
15
16
|
document.body.appendChild(this.container);
|
|
16
|
-
// 创建 React 根节点
|
|
17
17
|
this.root = createRoot(this.container);
|
|
18
18
|
this.render();
|
|
19
19
|
}
|
|
@@ -28,7 +28,7 @@ class ModalManagerClass {
|
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
30
|
open(config) {
|
|
31
|
-
this.init();
|
|
31
|
+
this.init();
|
|
32
32
|
const id = `modal-${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
|
|
33
33
|
const modalConfig = {
|
|
34
34
|
...config,
|
|
@@ -61,13 +61,13 @@ class ModalManagerClass {
|
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
export const openConfirmModal = (pConfig) => {
|
|
64
|
-
const { onOk, onCancel, okText = '
|
|
64
|
+
const { onOk, onCancel, okText = t('components.modal.okText'), cancelText = t('components.modal.cancelText'), ...props } = pConfig;
|
|
65
65
|
const config = {
|
|
66
|
-
title: '
|
|
66
|
+
title: t('components.modal.confirmTitle'),
|
|
67
67
|
footer: (_jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { onClick: () => {
|
|
68
68
|
onCancel?.();
|
|
69
69
|
modalManager.close(currentModalId);
|
|
70
|
-
}, className: "min-w-[100px] bg-
|
|
70
|
+
}, className: "min-w-[100px] bg-background border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/5", children: cancelText }), _jsx(AsynchronousButton, { variant: "primary", onClick: async (e) => {
|
|
71
71
|
const result = await onOk?.(e);
|
|
72
72
|
if (typeof result === 'boolean' && !result)
|
|
73
73
|
return;
|
|
@@ -78,9 +78,7 @@ export const openConfirmModal = (pConfig) => {
|
|
|
78
78
|
const currentModalId = modalManager.open(config);
|
|
79
79
|
return currentModalId;
|
|
80
80
|
};
|
|
81
|
-
// 单例模式
|
|
82
81
|
export const modalManager = new ModalManagerClass();
|
|
83
|
-
// 函数式 API
|
|
84
82
|
export const modal = {
|
|
85
83
|
open: (config) => modalManager.open(config),
|
|
86
84
|
confirm: openConfirmModal,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { CSSProperties, MouseEvent, ReactNode } from 'react';
|
|
2
|
+
export declare const canUseDocument: () => boolean;
|
|
3
|
+
export type OverlayProps = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
visible?: boolean;
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
className?: string;
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
zIndex?: number;
|
|
10
|
+
mask?: boolean;
|
|
11
|
+
maskClosable?: boolean;
|
|
12
|
+
lockScroll?: boolean;
|
|
13
|
+
keyboard?: boolean;
|
|
14
|
+
closable?: boolean;
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
onClick?: (e: MouseEvent<HTMLDivElement>) => void;
|
|
17
|
+
renderNode?: HTMLElement | (() => HTMLElement);
|
|
18
|
+
};
|
|
19
|
+
export declare function Overlay({ open, visible, children, className, style, zIndex, mask, maskClosable, lockScroll, keyboard, closable, onClose, onClick, renderNode, }: OverlayProps): import("react").ReactPortal | null;
|
|
20
|
+
//# sourceMappingURL=Overlay.d.ts.map
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { useEffect } from 'react';
|
|
4
|
+
import { createPortal } from 'react-dom';
|
|
5
|
+
let bodyScrollLockCount = 0;
|
|
6
|
+
let originalBodyOverflow = '';
|
|
7
|
+
export const canUseDocument = () => typeof document !== 'undefined';
|
|
8
|
+
const lockBodyScroll = () => {
|
|
9
|
+
if (!canUseDocument())
|
|
10
|
+
return () => { };
|
|
11
|
+
if (bodyScrollLockCount === 0) {
|
|
12
|
+
originalBodyOverflow = document.body.style.overflow;
|
|
13
|
+
document.body.style.overflow = 'hidden';
|
|
14
|
+
}
|
|
15
|
+
bodyScrollLockCount += 1;
|
|
16
|
+
return () => {
|
|
17
|
+
bodyScrollLockCount = Math.max(0, bodyScrollLockCount - 1);
|
|
18
|
+
if (bodyScrollLockCount === 0) {
|
|
19
|
+
document.body.style.overflow = originalBodyOverflow;
|
|
20
|
+
originalBodyOverflow = '';
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export function Overlay({ open = false, visible = open, children, className, style, zIndex = 1000, mask = true, maskClosable = true, lockScroll = true, keyboard = true, closable = true, onClose, onClick, renderNode, }) {
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (!open || !keyboard || !canUseDocument())
|
|
27
|
+
return;
|
|
28
|
+
const handleEscape = (e) => {
|
|
29
|
+
if (e.key === 'Escape' && closable) {
|
|
30
|
+
onClose?.();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
document.addEventListener('keydown', handleEscape);
|
|
34
|
+
return () => {
|
|
35
|
+
document.removeEventListener('keydown', handleEscape);
|
|
36
|
+
};
|
|
37
|
+
}, [open, closable, onClose, keyboard]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (!open || !lockScroll)
|
|
40
|
+
return;
|
|
41
|
+
return lockBodyScroll();
|
|
42
|
+
}, [lockScroll, open]);
|
|
43
|
+
const handleMaskClick = (e) => {
|
|
44
|
+
onClick?.(e);
|
|
45
|
+
if (maskClosable && e.target === e.currentTarget) {
|
|
46
|
+
onClose?.();
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
if (!open || !canUseDocument())
|
|
50
|
+
return null;
|
|
51
|
+
const parent = typeof renderNode === 'function' ? renderNode() : (renderNode ?? document.body);
|
|
52
|
+
return createPortal(_jsx("div", { className: cn('tc-ui-overlay fixed inset-0 z-[1000]', mask && 'bg-black/50 backdrop-blur-sm', 'transition-opacity duration-200', visible ? 'opacity-100' : 'opacity-0', className), style: { zIndex, ...style }, onClick: handleMaskClick, children: children }), parent);
|
|
53
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Overlay, canUseDocument } from './Overlay';
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
export interface PaginationProps {
|
|
2
|
-
/** 当前页码 */
|
|
3
2
|
current: number;
|
|
4
|
-
/** 每页显示数量 */
|
|
5
3
|
pageSize: number;
|
|
6
|
-
/** 总数据量 */
|
|
7
4
|
total: number;
|
|
8
|
-
/** 页码改变回调 */
|
|
9
5
|
onChange: (page: number) => void;
|
|
10
|
-
/** 每页显示数量改变回调 */
|
|
11
6
|
onPageSizeChange?: (pageSize: number) => void;
|
|
12
|
-
/** 每页显示数量选项 */
|
|
13
7
|
pageSizeOptions?: number[];
|
|
14
|
-
/** 自定义类名 */
|
|
15
8
|
className?: string;
|
|
16
9
|
}
|
|
17
10
|
export declare function Pagination({ current, pageSize, total, onChange, onPageSizeChange, pageSizeOptions, className, }: PaginationProps): import("react/jsx-runtime").JSX.Element | null;
|