@_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
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from
|
|
3
|
-
import { format as formatDate, isValid, parse } from
|
|
4
|
-
import { Calendar as CalendarIcon, X } from
|
|
5
|
-
import { forwardRef, useEffect, useMemo, useRef, useState } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { cn } from "../../lib/utils";
|
|
3
|
+
import { format as formatDate, isValid, parse } from "date-fns";
|
|
4
|
+
import { Calendar as CalendarIcon, X } from "lucide-react";
|
|
5
|
+
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
+
import { Button } from "../Button";
|
|
7
|
+
import { Input } from "../Input";
|
|
8
|
+
import { Popup } from "../Popup";
|
|
9
|
+
import { useDropdownPositioning } from "../hooks/useDropdownPositioning";
|
|
10
|
+
import { Calendar } from "./Calendar";
|
|
11
|
+
import { ModeType } from "./data";
|
|
12
|
+
import { getDatePickerDropdownPosition } from "./dropdownPositioning";
|
|
13
|
+
import { useDateLocale } from "./LocaleContext";
|
|
9
14
|
const formatValue = (val, format) => {
|
|
10
15
|
if (!val)
|
|
11
|
-
return
|
|
16
|
+
return "";
|
|
12
17
|
if (val instanceof Date)
|
|
13
18
|
return formatDate(val, format);
|
|
14
|
-
if (
|
|
19
|
+
if ("from" in val) {
|
|
15
20
|
if (val.from && val.to) {
|
|
16
21
|
return `${formatDate(val.from, format)} - ${formatDate(val.to, format)}`;
|
|
17
22
|
}
|
|
@@ -19,27 +24,25 @@ const formatValue = (val, format) => {
|
|
|
19
24
|
return formatDate(val.from, format);
|
|
20
25
|
}
|
|
21
26
|
}
|
|
22
|
-
return
|
|
27
|
+
return "";
|
|
23
28
|
};
|
|
24
29
|
const formatDateValue = (val, format) => {
|
|
25
30
|
if (!val)
|
|
26
|
-
return
|
|
27
|
-
/**
|
|
28
|
-
* 将 DateBaseValue 转为 yyyy-MM-dd | [yyyy-MM-dd, yyyy-MM-dd]
|
|
29
|
-
*/
|
|
31
|
+
return "";
|
|
30
32
|
if (val instanceof Date)
|
|
31
33
|
return formatDate(val, format);
|
|
32
|
-
if (
|
|
34
|
+
if ("from" in val) {
|
|
33
35
|
if (val.from && val.to) {
|
|
34
36
|
return [formatDate(val.from, format), formatDate(val.to, format)];
|
|
35
37
|
}
|
|
36
38
|
}
|
|
37
|
-
return
|
|
39
|
+
return "";
|
|
38
40
|
};
|
|
39
|
-
const DatePicker = forwardRef((
|
|
41
|
+
const DatePicker = forwardRef((props, ref) => {
|
|
42
|
+
const { mode = ModeType.Single, className, format: customFormat, placeholder, allowClear = true, disabled = false, showTime = false, value: pValue, defaultValue: pDefaultValue, onChange, disabledDate, locale: customLocale, quickRanges, getPopupContainer, } = props;
|
|
43
|
+
const isControlled = Object.prototype.hasOwnProperty.call(props, "value");
|
|
40
44
|
const contextLocale = useDateLocale();
|
|
41
45
|
const locale = { ...contextLocale, ...customLocale };
|
|
42
|
-
// 如果没有传入 placeholder,根据模式自动选择
|
|
43
46
|
const finalPlaceholder = placeholder ||
|
|
44
47
|
(showTime
|
|
45
48
|
? mode === ModeType.Range
|
|
@@ -48,23 +51,16 @@ const DatePicker = forwardRef(({ mode = ModeType.Single, className, format: cust
|
|
|
48
51
|
: mode === ModeType.Range
|
|
49
52
|
? locale.placeholderRange
|
|
50
53
|
: locale.placeholder);
|
|
51
|
-
|
|
52
|
-
const format = customFormat || (showTime ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd');
|
|
54
|
+
const format = customFormat || (showTime ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd");
|
|
53
55
|
const { value, defaultValue } = useMemo(() => {
|
|
54
|
-
/**
|
|
55
|
-
* 将 DateChangeStrValue 转为 Dates
|
|
56
|
-
*/
|
|
57
56
|
const convertValue = (val) => {
|
|
58
57
|
if (!val)
|
|
59
58
|
return undefined;
|
|
60
|
-
// Already a Date object
|
|
61
59
|
if (val instanceof Date)
|
|
62
60
|
return val;
|
|
63
|
-
|
|
64
|
-
if (typeof val === 'object' && 'from' in val)
|
|
61
|
+
if (typeof val === "object" && "from" in val)
|
|
65
62
|
return val;
|
|
66
|
-
|
|
67
|
-
if (typeof val === 'string') {
|
|
63
|
+
if (typeof val === "string") {
|
|
68
64
|
try {
|
|
69
65
|
const parsed = parse(val, format, new Date());
|
|
70
66
|
return isValid(parsed) ? parsed : undefined;
|
|
@@ -73,10 +69,8 @@ const DatePicker = forwardRef(({ mode = ModeType.Single, className, format: cust
|
|
|
73
69
|
return undefined;
|
|
74
70
|
}
|
|
75
71
|
}
|
|
76
|
-
// date range
|
|
77
72
|
if (Array.isArray(val)) {
|
|
78
|
-
|
|
79
|
-
if (typeof val[0] === 'string' && typeof val[1] === 'string') {
|
|
73
|
+
if (typeof val[0] === "string" && typeof val[1] === "string") {
|
|
80
74
|
try {
|
|
81
75
|
const from = parse(val[0], format, new Date());
|
|
82
76
|
const to = parse(val[1], format, new Date());
|
|
@@ -97,60 +91,63 @@ const DatePicker = forwardRef(({ mode = ModeType.Single, className, format: cust
|
|
|
97
91
|
defaultValue: convertValue(pDefaultValue),
|
|
98
92
|
};
|
|
99
93
|
}, [pDefaultValue, pValue, format]);
|
|
100
|
-
const
|
|
94
|
+
const initialValue = isControlled ? value : (value || defaultValue);
|
|
95
|
+
const [selectedDate, setSelectedDate] = useState(initialValue);
|
|
101
96
|
const [isOpen, setIsOpen] = useState(false);
|
|
102
|
-
const [inputValue, setInputValue] = useState(formatValue(
|
|
97
|
+
const [inputValue, setInputValue] = useState(formatValue(initialValue, format));
|
|
103
98
|
const [isHover, setIsHover] = useState(false);
|
|
104
99
|
const containerRef = useRef(null);
|
|
100
|
+
const dropdownContentRef = useRef(null);
|
|
105
101
|
const inputRef = useRef(null);
|
|
106
|
-
|
|
102
|
+
const rangeDraftRef = useRef(false);
|
|
103
|
+
const positioning = useDropdownPositioning({
|
|
104
|
+
open: isOpen,
|
|
105
|
+
anchorRef: containerRef,
|
|
106
|
+
contentRef: dropdownContentRef,
|
|
107
|
+
placement: "bottom-start",
|
|
108
|
+
offset: 8,
|
|
109
|
+
matchAnchorWidth: false,
|
|
110
|
+
strategy: getDatePickerDropdownPosition,
|
|
111
|
+
});
|
|
107
112
|
useEffect(() => {
|
|
108
|
-
if (
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
113
|
+
if (!isControlled)
|
|
114
|
+
return;
|
|
115
|
+
if (mode === ModeType.Range && rangeDraftRef.current && value === undefined) {
|
|
116
|
+
return;
|
|
112
117
|
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
if (containerRef.current && !containerRef.current.contains(event.target)) {
|
|
118
|
-
setIsOpen(false);
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
if (isOpen) {
|
|
122
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
123
|
-
return () => document.removeEventListener('mousedown', handleClickOutside);
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
return () => { };
|
|
118
|
+
setSelectedDate(value);
|
|
119
|
+
setInputValue(formatValue(value, format));
|
|
120
|
+
if (mode !== ModeType.Range || !value || !('from' in value) || value.to) {
|
|
121
|
+
rangeDraftRef.current = false;
|
|
127
122
|
}
|
|
128
|
-
}, [
|
|
123
|
+
}, [isControlled, mode, value, format]);
|
|
129
124
|
const handleSelect = (date) => {
|
|
130
125
|
const newDate = date;
|
|
131
126
|
if (mode === ModeType.Range) {
|
|
132
|
-
|
|
133
|
-
if (date && 'from' in date && 'to' in date && date.from && date.to) {
|
|
127
|
+
if (date && "from" in date && "to" in date && date.from && date.to) {
|
|
134
128
|
setIsOpen(false);
|
|
135
129
|
}
|
|
136
130
|
}
|
|
137
131
|
else {
|
|
138
|
-
// Single mode: always close popup when onChange is triggered
|
|
139
|
-
// (In showTime mode, this only happens when user clicks confirm button)
|
|
140
132
|
setIsOpen(false);
|
|
141
133
|
}
|
|
142
|
-
|
|
143
|
-
setInputValue(formatValue(newDate, format));
|
|
144
|
-
// 只在非受控模式下更新内部状态
|
|
145
|
-
if (value === undefined) {
|
|
134
|
+
if (mode === ModeType.Range || !isControlled) {
|
|
146
135
|
setSelectedDate(newDate);
|
|
136
|
+
setInputValue(formatValue(newDate, format));
|
|
147
137
|
}
|
|
138
|
+
rangeDraftRef.current =
|
|
139
|
+
mode === ModeType.Range && !(newDate &&
|
|
140
|
+
typeof newDate === 'object' &&
|
|
141
|
+
'from' in newDate &&
|
|
142
|
+
newDate.from &&
|
|
143
|
+
newDate.to);
|
|
148
144
|
onChange?.(formatDateValue(newDate, format), newDate);
|
|
149
145
|
};
|
|
150
146
|
const handleClear = (e) => {
|
|
151
147
|
e.stopPropagation();
|
|
148
|
+
rangeDraftRef.current = false;
|
|
152
149
|
setSelectedDate(undefined);
|
|
153
|
-
setInputValue(
|
|
150
|
+
setInputValue("");
|
|
154
151
|
onChange?.(undefined, undefined);
|
|
155
152
|
inputRef.current?.focus();
|
|
156
153
|
};
|
|
@@ -161,18 +158,25 @@ const DatePicker = forwardRef(({ mode = ModeType.Single, className, format: cust
|
|
|
161
158
|
try {
|
|
162
159
|
const parsedDate = parse(newValue, format, new Date());
|
|
163
160
|
if (isValid(parsedDate)) {
|
|
164
|
-
if (
|
|
161
|
+
if (!isControlled)
|
|
165
162
|
setSelectedDate(parsedDate);
|
|
166
163
|
onChange?.(formatDateValue(parsedDate, format), parsedDate);
|
|
167
164
|
}
|
|
168
165
|
}
|
|
169
166
|
catch {
|
|
170
|
-
// ignore invalid date
|
|
171
167
|
}
|
|
172
168
|
}
|
|
173
169
|
};
|
|
174
170
|
const showClearIcon = allowClear && selectedDate && !disabled && isHover;
|
|
175
|
-
return (_jsx("div", { ref: ref, className: cn(
|
|
171
|
+
return (_jsx("div", { ref: ref, className: cn("tc-ui-date-picker relative w-full", mode === ModeType.Range ? "min-w-[255px]" : "", className), children: _jsxs("div", { ref: containerRef, className: "relative", children: [_jsxs("div", { className: cn("flex items-center w-full rounded-lg px-4 py-3 text-sm", "border transition-colors duration-200", "bg-background cursor-pointer", disabled &&
|
|
172
|
+
"cursor-not-allowed bg-muted border-border text-muted-foreground", !disabled && !selectedDate && !isOpen && "border-border", !disabled && (selectedDate || isOpen) && "border-theme"), onClick: () => !disabled && setIsOpen(!isOpen), onMouseEnter: () => setIsHover(true), onMouseLeave: () => setIsHover(false), children: [_jsx(Input, { ref: inputRef, type: "text", value: inputValue, onChange: (_, e) => handleInputChange(e), placeholder: finalPlaceholder, disabled: disabled, readOnly: mode === ModeType.Range, className: "flex-1", inputClassName: cn("flex-1 rounded-none border-0 bg-transparent px-0 py-0 outline-none", "text-sm text-foreground placeholder:text-muted-foreground", disabled && "cursor-not-allowed", mode === ModeType.Range &&
|
|
173
|
+
!disabled &&
|
|
174
|
+
"cursor-pointer caret-transparent") }), showClearIcon ? (_jsx(Button, { variant: "text", type: "button", onClick: handleClear, title: locale.clear, "aria-label": locale.clear, className: cn("ml-2 flex items-center justify-center", "w-5 h-5 rounded-full", "bg-muted hover:bg-muted/80", "text-foreground transition-colors", "cursor-pointer"), children: _jsx(X, { size: 12 }) })) : (_jsx(CalendarIcon, { size: 16, className: "ml-2 text-muted-foreground" }))] }), _jsx(Popup, { open: isOpen && !disabled, anchorRef: containerRef, contentRef: dropdownContentRef, positioning: positioning, keepMounted: true, onOpenChange: (nextOpen) => {
|
|
175
|
+
setIsOpen(nextOpen);
|
|
176
|
+
if (!nextOpen) {
|
|
177
|
+
rangeDraftRef.current = false;
|
|
178
|
+
}
|
|
179
|
+
}, className: cn("overflow-hidden"), container: getPopupContainer?.(), children: _jsx("div", { ref: dropdownContentRef, children: _jsx(Calendar, { mode: mode, value: selectedDate || null, onChange: handleSelect, disabledDate: disabledDate, showTime: showTime, locale: locale, quickRanges: quickRanges }) }) })] }) }));
|
|
176
180
|
});
|
|
177
|
-
DatePicker.displayName =
|
|
181
|
+
DatePicker.displayName = "DatePicker";
|
|
178
182
|
export { DatePicker };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import { useDateLocaleStore } from './dateLocaleStore';
|
|
2
|
-
/**
|
|
3
|
-
* Hook for accessing the current Date component locale.
|
|
4
|
-
* Backed by Zustand, so no React Context is required.
|
|
5
|
-
*/
|
|
6
2
|
export const useDateLocale = () => {
|
|
7
3
|
return useDateLocaleStore((state) => state.locale);
|
|
8
4
|
};
|
|
@@ -4,16 +4,5 @@ export interface DateLocaleProviderProps {
|
|
|
4
4
|
locale?: DateLocaleConfig;
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
}
|
|
7
|
-
/**
|
|
8
|
-
* Date 组件文案配置 Provider
|
|
9
|
-
* 用于全局设置 Date 组件的文案
|
|
10
|
-
*
|
|
11
|
-
* @example
|
|
12
|
-
* ```tsx
|
|
13
|
-
* <DateLocaleProvider locale={customLocale}>
|
|
14
|
-
* <App />
|
|
15
|
-
* </DateLocaleProvider>
|
|
16
|
-
* ```
|
|
17
|
-
*/
|
|
18
7
|
export declare function DateLocaleProvider({ locale, children }: DateLocaleProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
19
8
|
//# sourceMappingURL=LocaleProvider.d.ts.map
|
|
@@ -2,17 +2,6 @@ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useEffect } from 'react';
|
|
3
3
|
import { useDateLocaleStore } from './dateLocaleStore';
|
|
4
4
|
import { defaultLocale } from './locales';
|
|
5
|
-
/**
|
|
6
|
-
* Date 组件文案配置 Provider
|
|
7
|
-
* 用于全局设置 Date 组件的文案
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <DateLocaleProvider locale={customLocale}>
|
|
12
|
-
* <App />
|
|
13
|
-
* </DateLocaleProvider>
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
5
|
export function DateLocaleProvider({ locale = defaultLocale, children }) {
|
|
17
6
|
const replaceLocale = useDateLocaleStore((state) => state.replaceLocale);
|
|
18
7
|
const resetLocale = useDateLocaleStore((state) => state.resetLocale);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../lib/utils';
|
|
3
3
|
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Input } from '../Input';
|
|
4
6
|
export function TimePicker({ value, onChange, className }) {
|
|
5
|
-
// Derive time from value prop directly
|
|
6
7
|
const hours = value?.getHours() ?? 0;
|
|
7
8
|
const minutes = value?.getMinutes() ?? 0;
|
|
8
9
|
const handleTimeChange = (newHours, newMinutes) => {
|
|
@@ -72,5 +73,5 @@ export function TimePicker({ value, onChange, className }) {
|
|
|
72
73
|
}
|
|
73
74
|
};
|
|
74
75
|
const formatNumber = (num) => String(num).padStart(2, '0');
|
|
75
|
-
return (_jsxs("div", { className: cn('flex items-center justify-center gap-3 py-3', className), children: [_jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx("
|
|
76
|
+
return (_jsxs("div", { className: cn('tc-ui-time-picker flex items-center justify-center gap-3 py-3', className), children: [_jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx(Button, { variant: "text", type: "button", onClick: incrementHours, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronUp, { size: 14 }) }), _jsx(Input, { type: "text", value: formatNumber(hours), onChange: (_, e) => handleHoursInput(e), onKeyDown: handleHoursKeyDown, className: "w-12", inputClassName: cn('w-12 h-9 px-0 py-0 text-center text-sm font-medium', 'border border-border rounded', 'bg-background text-foreground', 'focus:outline-none focus:border-theme', 'transition-colors'), maxLength: 2 }), _jsx(Button, { variant: "text", type: "button", onClick: decrementHours, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronDown, { size: 14 }) })] }), _jsx("div", { className: "text-lg font-medium text-foreground mb-1", children: ":" }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx(Button, { variant: "text", type: "button", onClick: incrementMinutes, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronUp, { size: 14 }) }), _jsx(Input, { type: "text", value: formatNumber(minutes), onChange: (_, e) => handleMinutesInput(e), onKeyDown: handleMinutesKeyDown, className: "w-12", inputClassName: cn('w-12 h-9 px-0 py-0 text-center text-sm font-medium', 'border border-border rounded', 'bg-background text-foreground', 'focus:outline-none focus:border-theme', 'transition-colors'), maxLength: 2 }), _jsx(Button, { variant: "text", type: "button", onClick: decrementMinutes, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronDown, { size: 14 }) })] })] }));
|
|
76
77
|
}
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { type DateLocaleConfig } from './locales';
|
|
2
2
|
type DateLocaleState = {
|
|
3
3
|
locale: DateLocaleConfig;
|
|
4
|
-
/**
|
|
5
|
-
* Merge partial updates into the current locale.
|
|
6
|
-
*/
|
|
7
4
|
setLocale: (patch: Partial<DateLocaleConfig>) => void;
|
|
8
|
-
/**
|
|
9
|
-
* Replace the locale entirely.
|
|
10
|
-
*/
|
|
11
5
|
replaceLocale: (nextLocale: DateLocaleConfig) => void;
|
|
12
6
|
resetLocale: () => void;
|
|
13
7
|
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const getDatePickerDropdownPosition = ({ anchorRect, contentRect, viewportHeight, offset, }) => {
|
|
2
|
+
const contentHeight = contentRect?.height ?? 360;
|
|
3
|
+
const spaceBelow = viewportHeight - anchorRect.bottom;
|
|
4
|
+
const spaceAbove = anchorRect.top;
|
|
5
|
+
const shouldFlipUp = spaceBelow < contentHeight && spaceAbove > spaceBelow;
|
|
6
|
+
return {
|
|
7
|
+
top: shouldFlipUp
|
|
8
|
+
? anchorRect.top - contentHeight - offset
|
|
9
|
+
: anchorRect.bottom + offset,
|
|
10
|
+
left: anchorRect.left,
|
|
11
|
+
};
|
|
12
|
+
};
|
|
@@ -1,7 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Date 组件文案配置
|
|
3
|
-
* 支持外部修改文案内容
|
|
4
|
-
*/
|
|
5
1
|
export interface DateLocaleConfig {
|
|
6
2
|
placeholder: string;
|
|
7
3
|
placeholderDateTime: string;
|
|
@@ -12,13 +8,8 @@ export interface DateLocaleConfig {
|
|
|
12
8
|
startTime: string;
|
|
13
9
|
endTime: string;
|
|
14
10
|
confirm: string;
|
|
15
|
-
|
|
16
|
-
* 范围模式 - 快捷选择面板标题
|
|
17
|
-
*/
|
|
11
|
+
monthFormat: string;
|
|
18
12
|
quickRanges: string;
|
|
19
|
-
/**
|
|
20
|
-
* 范围模式 - 各快捷范围文案
|
|
21
|
-
*/
|
|
22
13
|
quickRangeToday: string;
|
|
23
14
|
quickRangeYesterday: string;
|
|
24
15
|
quickRangeLast7Days: string;
|
|
@@ -27,16 +18,7 @@ export interface DateLocaleConfig {
|
|
|
27
18
|
quickRangeLastYear: string;
|
|
28
19
|
clear: string;
|
|
29
20
|
}
|
|
30
|
-
/**
|
|
31
|
-
* 默认中文文案
|
|
32
|
-
*/
|
|
33
21
|
export declare const zhCNLocale: DateLocaleConfig;
|
|
34
|
-
/**
|
|
35
|
-
* 默认英文文案
|
|
36
|
-
*/
|
|
37
22
|
export declare const enUSLocale: DateLocaleConfig;
|
|
38
|
-
/**
|
|
39
|
-
* 默认使用中文文案
|
|
40
|
-
*/
|
|
41
23
|
export declare const defaultLocale: DateLocaleConfig;
|
|
42
24
|
//# sourceMappingURL=locales.d.ts.map
|
|
@@ -1,52 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* 默认中文文案
|
|
7
|
-
*/
|
|
1
|
+
import { defaultEnglishResources, defaultLanguageResources } from '../../../../common/i18n';
|
|
2
|
+
const dateDefaultLocale = defaultLanguageResources.components.date;
|
|
3
|
+
const dateDefaultEnglishLocale = defaultEnglishResources.components.date;
|
|
8
4
|
export const zhCNLocale = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
placeholderRange: '选择日期范围',
|
|
12
|
-
placeholderDateTimeRange: '选择日期时间范围',
|
|
13
|
-
weekDays: ['日', '一', '二', '三', '四', '五', '六'],
|
|
14
|
-
selectTime: '选择时间',
|
|
15
|
-
startTime: '开始时间',
|
|
16
|
-
endTime: '结束时间',
|
|
17
|
-
confirm: '确认',
|
|
18
|
-
quickRanges: '快速选择',
|
|
19
|
-
quickRangeToday: '今天',
|
|
20
|
-
quickRangeYesterday: '昨天',
|
|
21
|
-
quickRangeLast7Days: '近7天',
|
|
22
|
-
quickRangeLast30Days: '近30天',
|
|
23
|
-
quickRangeThisMonth: '本月',
|
|
24
|
-
quickRangeLastYear: '最近一年',
|
|
25
|
-
clear: '清除',
|
|
5
|
+
...dateDefaultLocale,
|
|
6
|
+
weekDays: [...dateDefaultLocale.weekDays],
|
|
26
7
|
};
|
|
27
|
-
/**
|
|
28
|
-
* 默认英文文案
|
|
29
|
-
*/
|
|
30
8
|
export const enUSLocale = {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
placeholderRange: 'Select date range',
|
|
34
|
-
placeholderDateTimeRange: 'Select date and time range',
|
|
35
|
-
weekDays: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
|
|
36
|
-
selectTime: 'Select time',
|
|
37
|
-
startTime: 'Start time',
|
|
38
|
-
endTime: 'End time',
|
|
39
|
-
confirm: 'Confirm',
|
|
40
|
-
quickRanges: 'Quick ranges',
|
|
41
|
-
quickRangeToday: 'Today',
|
|
42
|
-
quickRangeYesterday: 'Yesterday',
|
|
43
|
-
quickRangeLast7Days: 'Last 7 days',
|
|
44
|
-
quickRangeLast30Days: 'Last 30 days',
|
|
45
|
-
quickRangeThisMonth: 'This month',
|
|
46
|
-
quickRangeLastYear: 'Last year',
|
|
47
|
-
clear: 'Clear',
|
|
9
|
+
...dateDefaultEnglishLocale,
|
|
10
|
+
weekDays: [...dateDefaultEnglishLocale.weekDays],
|
|
48
11
|
};
|
|
49
|
-
/**
|
|
50
|
-
* 默认使用中文文案
|
|
51
|
-
*/
|
|
52
12
|
export const defaultLocale = zhCNLocale;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type DrawerPlacement = 'top' | 'right' | 'bottom' | 'left';
|
|
3
|
+
export type DrawerProps = {
|
|
4
|
+
open?: boolean;
|
|
5
|
+
onClose?: () => void;
|
|
6
|
+
title?: ReactNode;
|
|
7
|
+
children?: ReactNode;
|
|
8
|
+
footer?: ReactNode;
|
|
9
|
+
className?: string;
|
|
10
|
+
contentClassName?: string;
|
|
11
|
+
mask?: boolean;
|
|
12
|
+
maskClosable?: boolean;
|
|
13
|
+
lockScroll?: boolean;
|
|
14
|
+
closable?: boolean;
|
|
15
|
+
placement?: DrawerPlacement;
|
|
16
|
+
width?: number | string;
|
|
17
|
+
height?: number | string;
|
|
18
|
+
zIndex?: number;
|
|
19
|
+
renderNode?: HTMLElement | (() => HTMLElement);
|
|
20
|
+
keyboard?: boolean;
|
|
21
|
+
};
|
|
22
|
+
export declare function Drawer({ open, onClose, title, children, footer, className, contentClassName, mask, maskClosable, lockScroll, closable, placement, width, height, renderNode, keyboard, zIndex, }: DrawerProps): import("react/jsx-runtime").JSX.Element;
|
|
23
|
+
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useI18n } from '../../i18n';
|
|
3
|
+
import { cn } from '../../lib/utils';
|
|
4
|
+
import { X } from 'lucide-react';
|
|
5
|
+
import { useEffect, useRef, useState } from 'react';
|
|
6
|
+
import { Button } from '../Button';
|
|
7
|
+
import { Overlay } from '../Overlay';
|
|
8
|
+
const DRAWER_ANIMATION_DURATION = 320;
|
|
9
|
+
const DRAWER_ANIMATION_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
10
|
+
const getDrawerPositionClassName = (placement) => {
|
|
11
|
+
const positionClassNames = {
|
|
12
|
+
top: 'left-0 right-0 top-0',
|
|
13
|
+
right: 'bottom-0 right-0 top-0',
|
|
14
|
+
bottom: 'bottom-0 left-0 right-0',
|
|
15
|
+
left: 'bottom-0 left-0 top-0',
|
|
16
|
+
};
|
|
17
|
+
return positionClassNames[placement];
|
|
18
|
+
};
|
|
19
|
+
const getDrawerTransform = (placement, open) => {
|
|
20
|
+
if (open)
|
|
21
|
+
return 'translate3d(0, 0, 0)';
|
|
22
|
+
const transforms = {
|
|
23
|
+
top: 'translate3d(0, -100%, 0)',
|
|
24
|
+
right: 'translate3d(100%, 0, 0)',
|
|
25
|
+
bottom: 'translate3d(0, 100%, 0)',
|
|
26
|
+
left: 'translate3d(-100%, 0, 0)',
|
|
27
|
+
};
|
|
28
|
+
return transforms[placement];
|
|
29
|
+
};
|
|
30
|
+
const getDrawerSizeStyle = (placement, width, height) => {
|
|
31
|
+
const isHorizontal = placement === 'left' || placement === 'right';
|
|
32
|
+
const size = isHorizontal ? width : height;
|
|
33
|
+
const resolvedSize = typeof size === 'number' ? `${size}px` : size;
|
|
34
|
+
return isHorizontal ? { width: resolvedSize } : { height: resolvedSize };
|
|
35
|
+
};
|
|
36
|
+
export function Drawer({ open = false, onClose, title, children, footer, className, contentClassName, mask = true, maskClosable = true, lockScroll = true, closable = true, placement = 'right', width = 420, height = 360, renderNode, keyboard = true, zIndex = 1000, }) {
|
|
37
|
+
const t = useI18n();
|
|
38
|
+
const [mounted, setMounted] = useState(open);
|
|
39
|
+
const [visible, setVisible] = useState(false);
|
|
40
|
+
const animationFrameRef = useRef(undefined);
|
|
41
|
+
const secondAnimationFrameRef = useRef(undefined);
|
|
42
|
+
const closeTimerRef = useRef(undefined);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (animationFrameRef.current) {
|
|
45
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
46
|
+
animationFrameRef.current = undefined;
|
|
47
|
+
}
|
|
48
|
+
if (secondAnimationFrameRef.current) {
|
|
49
|
+
cancelAnimationFrame(secondAnimationFrameRef.current);
|
|
50
|
+
secondAnimationFrameRef.current = undefined;
|
|
51
|
+
}
|
|
52
|
+
if (closeTimerRef.current) {
|
|
53
|
+
clearTimeout(closeTimerRef.current);
|
|
54
|
+
closeTimerRef.current = undefined;
|
|
55
|
+
}
|
|
56
|
+
if (open) {
|
|
57
|
+
setMounted(true);
|
|
58
|
+
animationFrameRef.current = requestAnimationFrame(() => {
|
|
59
|
+
secondAnimationFrameRef.current = requestAnimationFrame(() => {
|
|
60
|
+
setVisible(true);
|
|
61
|
+
secondAnimationFrameRef.current = undefined;
|
|
62
|
+
});
|
|
63
|
+
animationFrameRef.current = undefined;
|
|
64
|
+
});
|
|
65
|
+
return () => {
|
|
66
|
+
if (animationFrameRef.current) {
|
|
67
|
+
cancelAnimationFrame(animationFrameRef.current);
|
|
68
|
+
animationFrameRef.current = undefined;
|
|
69
|
+
}
|
|
70
|
+
if (secondAnimationFrameRef.current) {
|
|
71
|
+
cancelAnimationFrame(secondAnimationFrameRef.current);
|
|
72
|
+
secondAnimationFrameRef.current = undefined;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
setVisible(false);
|
|
77
|
+
closeTimerRef.current = setTimeout(() => {
|
|
78
|
+
setMounted(false);
|
|
79
|
+
closeTimerRef.current = undefined;
|
|
80
|
+
}, DRAWER_ANIMATION_DURATION);
|
|
81
|
+
return () => {
|
|
82
|
+
if (closeTimerRef.current) {
|
|
83
|
+
clearTimeout(closeTimerRef.current);
|
|
84
|
+
closeTimerRef.current = undefined;
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
}, [open]);
|
|
88
|
+
const handleContentClick = (e) => {
|
|
89
|
+
e.stopPropagation();
|
|
90
|
+
};
|
|
91
|
+
const drawerStyle = {
|
|
92
|
+
...getDrawerSizeStyle(placement, width, height),
|
|
93
|
+
transform: getDrawerTransform(placement, visible),
|
|
94
|
+
transition: `transform ${DRAWER_ANIMATION_DURATION}ms ${DRAWER_ANIMATION_EASING}`,
|
|
95
|
+
willChange: 'transform',
|
|
96
|
+
};
|
|
97
|
+
return (_jsx(Overlay, { open: mounted, visible: visible, onClose: onClose, mask: mask, maskClosable: maskClosable, lockScroll: lockScroll, keyboard: keyboard, closable: closable, renderNode: renderNode, zIndex: zIndex, className: "tc-ui-drawer", style: {
|
|
98
|
+
transition: `opacity ${DRAWER_ANIMATION_DURATION}ms ${DRAWER_ANIMATION_EASING}`,
|
|
99
|
+
}, children: _jsxs("div", { className: cn('fixed bg-background shadow-lg', 'flex flex-col', getDrawerPositionClassName(placement), placement === 'top' || placement === 'bottom' ? 'max-h-[90vh]' : 'max-w-[90vw]', className), style: drawerStyle, 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 })] }) }));
|
|
100
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Drawer } from './Drawer';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface DropdownBaseItem {
|
|
3
|
+
key: string;
|
|
4
|
+
label: ReactNode;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
danger?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
export interface DropdownRenderItem {
|
|
10
|
+
render: (item: DropdownRenderItem, context: {
|
|
11
|
+
onClick: () => void;
|
|
12
|
+
close: () => void;
|
|
13
|
+
}) => ReactNode;
|
|
14
|
+
}
|
|
15
|
+
export type DropdownItem = Omit<DropdownBaseItem, 'render'> | DropdownRenderItem;
|
|
16
|
+
export interface DropdownProps {
|
|
17
|
+
items: DropdownItem[];
|
|
18
|
+
children: ReactNode;
|
|
19
|
+
className?: string;
|
|
20
|
+
placement?: 'bottom-end' | 'bottom-start';
|
|
21
|
+
getPopupContainer?: () => HTMLElement;
|
|
22
|
+
}
|
|
23
|
+
export declare function Dropdown({ items, children, className, placement, getPopupContainer }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { Fragment, useCallback, useRef, useState } from 'react';
|
|
4
|
+
import { Button } from '../Button';
|
|
5
|
+
import { Popup } from '../Popup';
|
|
6
|
+
const isDropdownRenderItem = (item) => 'render' in item;
|
|
7
|
+
export function Dropdown({ items, children, className, placement = 'bottom-end', getPopupContainer }) {
|
|
8
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
9
|
+
const triggerRef = useRef(null);
|
|
10
|
+
const handleToggle = useCallback(() => {
|
|
11
|
+
setIsOpen((prev) => !prev);
|
|
12
|
+
}, []);
|
|
13
|
+
const handleItemClick = useCallback((item) => {
|
|
14
|
+
if (!isDropdownRenderItem(item)) {
|
|
15
|
+
item.onClick?.();
|
|
16
|
+
}
|
|
17
|
+
setIsOpen(false);
|
|
18
|
+
}, []);
|
|
19
|
+
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: triggerRef, className: cn('tc-ui-dropdown relative inline-block', className), children: _jsx("div", { onClick: handleToggle, children: children }) }), _jsx(Popup, { open: isOpen, anchorRef: triggerRef, placement: placement, onOpenChange: setIsOpen, container: getPopupContainer?.(), className: cn('min-w-10', 'py-1'), children: items.map((item, index) => {
|
|
20
|
+
const onClick = () => handleItemClick(item);
|
|
21
|
+
const close = () => setIsOpen(false);
|
|
22
|
+
const key = isDropdownRenderItem(item) ? index : item.key;
|
|
23
|
+
if (isDropdownRenderItem(item)) {
|
|
24
|
+
return _jsx(Fragment, { children: item.render(item, { onClick, close }) }, key);
|
|
25
|
+
}
|
|
26
|
+
return (_jsx(Button, { type: "button", variant: "text", state: item.danger ? 'danger' : undefined, onClick: onClick, className: cn('flex w-full items-center gap-2 px-4 py-2.5 text-left text-sm transition-colors', item.danger ? 'text-red-600 hover:bg-red-50' : 'text-gray-700 hover:bg-gray-50'), children: _jsxs(_Fragment, { children: [item.icon && _jsx("span", { className: "flex-shrink-0", children: item.icon }), _jsx("span", { children: item.label })] }) }, key));
|
|
27
|
+
}) })] }));
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Dropdown';
|