@_tc/template-core 0.0.1-bate.36 → 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 +2 -184
- 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 +12 -1
- 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,42 +1,69 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../lib/utils';
|
|
3
3
|
import { forwardRef } from 'react';
|
|
4
|
-
const Button = forwardRef((
|
|
4
|
+
const Button = forwardRef((props, ref) => {
|
|
5
|
+
const { className, size = 'md', state, disabled: disabledProp, loading: loadingProp, leftIcon, rightIcon, noUnderline, children, } = props;
|
|
6
|
+
const variant = props.variant ?? 'default';
|
|
7
|
+
const danger = state === 'danger';
|
|
8
|
+
const ghost = state === 'ghost';
|
|
9
|
+
const loading = loadingProp;
|
|
10
|
+
const disabled = disabledProp;
|
|
5
11
|
const isDisabled = disabled || loading;
|
|
6
|
-
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const baseStyles = 'inline-flex items-center justify-center rounded-lg font-medium transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 cursor-pointer';
|
|
13
|
+
const getVariantStyles = () => {
|
|
14
|
+
if (variant === 'text' || variant === 'link') {
|
|
15
|
+
return danger
|
|
16
|
+
? 'bg-transparent border-0 text-destructive focus-visible:ring-destructive'
|
|
17
|
+
: 'bg-transparent border-0 text-foreground focus-visible:ring-border';
|
|
18
|
+
}
|
|
19
|
+
const ghostStyles = ghost && 'bg-transparent hover:bg-transparent';
|
|
20
|
+
if (danger) {
|
|
21
|
+
if (variant === 'primary') {
|
|
22
|
+
return cn(ghost
|
|
23
|
+
? 'border border-destructive text-destructive focus-visible:ring-destructive'
|
|
24
|
+
: 'bg-destructive text-destructive-foreground border border-destructive hover:bg-destructive/90 focus-visible:ring-destructive', ghostStyles);
|
|
25
|
+
}
|
|
26
|
+
return cn(ghost ? 'text-destructive' : 'bg-background text-destructive hover:bg-destructive/10', variant === 'dashed' ? 'border border-dashed' : 'border', 'border-destructive focus-visible:ring-destructive', ghostStyles);
|
|
27
|
+
}
|
|
28
|
+
const variantStyles = {
|
|
29
|
+
default: 'bg-background border border-border text-foreground hover:bg-muted/50 focus-visible:ring-border',
|
|
30
|
+
primary: 'bg-theme text-theme-foreground border border-theme hover:bg-theme/90 focus-visible:ring-theme',
|
|
31
|
+
dashed: 'bg-background border border-dashed border-border text-foreground hover:bg-muted/50 focus-visible:ring-border',
|
|
32
|
+
text: 'bg-transparent border-0 text-foreground focus-visible:ring-border',
|
|
33
|
+
};
|
|
34
|
+
return cn(variantStyles[variant], ghostStyles);
|
|
15
35
|
};
|
|
16
|
-
|
|
17
|
-
const disabledStyles = {
|
|
18
|
-
default: 'disabled:bg-white/60 disabled:border-border/60 disabled:text-foreground/60 disabled:hover:bg-white/60',
|
|
19
|
-
primary: 'disabled:bg-theme/60 disabled:border-theme/0 disabled:text-theme-foreground/60 disabled:hover:bg-theme/60',
|
|
20
|
-
text: 'disabled:text-foreground/40 disabled:hover:bg-transparent',
|
|
21
|
-
link: 'disabled:text-foreground/40',
|
|
22
|
-
};
|
|
23
|
-
// 尺寸样式
|
|
36
|
+
const disabledStyles = 'disabled:bg-background/60 disabled:border-border/60 disabled:text-foreground/40 disabled:hover:bg-background/60 aria-disabled:text-foreground/40 aria-disabled:hover:bg-transparent';
|
|
24
37
|
const sizeStyles = {
|
|
25
38
|
sm: 'h-8 px-3 text-sm',
|
|
26
39
|
md: 'h-10 px-4 text-sm',
|
|
27
40
|
lg: 'h-12 px-6 text-base',
|
|
28
41
|
};
|
|
29
|
-
|
|
42
|
+
const spinnerSize = {
|
|
43
|
+
sm: 'h-3 w-3',
|
|
44
|
+
md: 'h-4 w-4',
|
|
45
|
+
lg: 'h-5 w-5',
|
|
46
|
+
};
|
|
47
|
+
const loadingIcon = loading ? (_jsx("span", { className: cn('flex items-center', children && 'mr-2'), children: _jsxs("svg", { className: cn('animate-spin', spinnerSize[size]), xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) }, "loading")) : null;
|
|
30
48
|
const contents = [
|
|
31
|
-
|
|
49
|
+
loadingIcon,
|
|
50
|
+
!loading && leftIcon && (_jsx("span", { className: cn('flex items-center', 'mr-2'), children: leftIcon }, "left")),
|
|
32
51
|
children,
|
|
33
52
|
rightIcon ? (_jsx("span", { className: cn('flex items-center', 'ml-2'), children: rightIcon }, "right")) : undefined,
|
|
34
53
|
].filter(Boolean);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
54
|
+
const buttonClassName = cn('tc-ui-button', baseStyles, getVariantStyles(), disabledStyles, ['text', 'link'].includes(variant) ? 'h-auto px-0 py-0 text-sm font-normal' : sizeStyles[size], ['text', 'link'].includes(variant) ? '' : 'before:content-normal', variant === 'link' && !noUnderline && 'hover:underline', variant === 'link' && !noUnderline && 'aria-disabled:hover:no-underline', disabled && !loading && 'cursor-not-allowed', loading && 'cursor-wait', className);
|
|
55
|
+
if (props.variant === 'link') {
|
|
56
|
+
const { className: _className, variant: _variant, size: _size, state: _state, disabled: _disabled, loading: _loading, leftIcon: _leftIcon, rightIcon: _rightIcon, noUnderline: _noUnderline, children: _children, onClick, tabIndex, ...anchorProps } = props;
|
|
57
|
+
return (_jsx("a", { ref: ref, className: buttonClassName, "aria-disabled": isDisabled || undefined, tabIndex: isDisabled ? -1 : tabIndex, onClick: (event) => {
|
|
58
|
+
if (isDisabled) {
|
|
59
|
+
event.preventDefault();
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
onClick?.(event);
|
|
63
|
+
}, ...anchorProps, children: contents }));
|
|
64
|
+
}
|
|
65
|
+
const { className: _className, variant: _variant, size: _size, state: _state, disabled: _disabled, loading: _loading, leftIcon: _leftIcon, rightIcon: _rightIcon, noUnderline: _noUnderline, children: _children, ...buttonProps } = props;
|
|
66
|
+
return (_jsx("button", { ref: ref, className: buttonClassName, disabled: isDisabled, ...buttonProps, children: contents }));
|
|
40
67
|
});
|
|
41
68
|
Button.displayName = 'Button';
|
|
42
69
|
export { Button };
|
|
@@ -1,12 +1,8 @@
|
|
|
1
1
|
import type { MOmit } from '../../types';
|
|
2
|
-
import { type
|
|
3
|
-
export type SumbitButtonProps = MOmit<
|
|
2
|
+
import { type ButtonElementProps } from './Button';
|
|
3
|
+
export type SumbitButtonProps = MOmit<ButtonElementProps, 'onClick'> & {
|
|
4
4
|
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void | boolean> | void;
|
|
5
5
|
};
|
|
6
|
-
/**
|
|
7
|
-
*
|
|
8
|
-
* 会自动添加loading 其余同button一致
|
|
9
|
-
*/
|
|
10
6
|
declare const SumbitButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
7
|
declare const AsynchronousButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
8
|
export { AsynchronousButton, SumbitButton };
|
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../lib/utils';
|
|
3
3
|
import { useState } from 'react';
|
|
4
4
|
import { Button } from './Button';
|
|
5
|
-
/**
|
|
6
|
-
*
|
|
7
|
-
* 会自动添加loading 其余同button一致
|
|
8
|
-
*/
|
|
9
5
|
const SumbitButton = (props) => {
|
|
10
|
-
const { onClick,
|
|
6
|
+
const { onClick, className, loading: loadingProp, ...bprops } = props;
|
|
11
7
|
const [loading, uLoading] = useState(false);
|
|
12
|
-
|
|
13
|
-
const spinnerSize = {
|
|
14
|
-
sm: 'h-3 w-3',
|
|
15
|
-
md: 'h-4 w-4',
|
|
16
|
-
lg: 'h-5 w-5',
|
|
17
|
-
};
|
|
18
|
-
const loadingIcon = loading ? (_jsx("span", { className: cn('flex items-center', 'mr-2'), children: _jsxs("svg", { className: cn('animate-spin', spinnerSize[size]), xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [_jsx("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }), _jsx("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })] }) })) : null;
|
|
19
|
-
return (_jsx(Button, { loading: loading, leftIcon: loading ? loadingIcon : leftIcon, onClick: async (e) => {
|
|
8
|
+
return (_jsx(Button, { className: cn('tc-ui-submit-button', className), loading: loading || loadingProp, onClick: async (e) => {
|
|
20
9
|
if (loading)
|
|
21
10
|
return;
|
|
22
11
|
uLoading(true);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export { Button } from './Button';
|
|
2
|
-
export type { ButtonProps, ButtonSize, ButtonVariant } from './Button';
|
|
2
|
+
export type { ButtonElementProps, ButtonLinkProps, ButtonProps, ButtonSize, ButtonState, ButtonVariant } from './Button';
|
|
3
3
|
export * from './SumbitButton';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -6,7 +6,7 @@ export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChang
|
|
|
6
6
|
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
|
7
7
|
value?: boolean;
|
|
8
8
|
};
|
|
9
|
-
declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "
|
|
9
|
+
declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "value" | "onChange"> & {
|
|
10
10
|
checked?: boolean;
|
|
11
11
|
defaultChecked?: boolean;
|
|
12
12
|
indeterminate?: boolean;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { cn } from '../../lib/utils';
|
|
3
|
+
import { Check, Minus } from 'lucide-react';
|
|
3
4
|
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
-
const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, defaultChecked, indeterminate, onChange, ...props }, ref) => {
|
|
5
|
+
const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, defaultChecked, indeterminate, onChange, disabled, ...props }, ref) => {
|
|
5
6
|
const internalRef = useRef(null);
|
|
6
7
|
const controlledChecked = value ?? _controlledChecked;
|
|
7
8
|
const setRefs = (element) => {
|
|
@@ -24,6 +25,7 @@ const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, de
|
|
|
24
25
|
const isControlled = controlledChecked !== undefined;
|
|
25
26
|
const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);
|
|
26
27
|
const checked = isControlled ? controlledChecked : internalChecked;
|
|
28
|
+
const showChecked = checked && !indeterminate;
|
|
27
29
|
const handleChange = (e) => {
|
|
28
30
|
const newChecked = e.target.checked;
|
|
29
31
|
if (!isControlled) {
|
|
@@ -31,7 +33,7 @@ const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, de
|
|
|
31
33
|
}
|
|
32
34
|
onChange?.(newChecked, e);
|
|
33
35
|
};
|
|
34
|
-
return (_jsx("input", { type: "checkbox", ref: setRefs, checked: checked, onChange: handleChange, className: cn('w-
|
|
36
|
+
return (_jsxs("span", { className: cn('tc-ui-checkbox relative inline-flex h-4 w-4 shrink-0', className), children: [_jsx("input", { type: "checkbox", ref: setRefs, checked: checked, disabled: disabled, onChange: handleChange, className: cn('peer absolute inset-0 z-10 m-0 h-full w-full appearance-none rounded opacity-0', disabled ? 'cursor-not-allowed' : 'cursor-pointer'), ...props }), _jsxs("span", { "aria-hidden": "true", className: cn('pointer-events-none flex h-full w-full items-center justify-center rounded border transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background', (showChecked || indeterminate) && 'border-theme bg-theme text-theme-foreground', !showChecked && !indeterminate && 'border-border bg-background text-theme', disabled && 'opacity-60'), children: [showChecked && _jsx(Check, { className: "h-3 w-3", strokeWidth: 3 }), indeterminate && _jsx(Minus, { className: "h-3 w-3", strokeWidth: 3 })] })] }));
|
|
35
37
|
});
|
|
36
38
|
Checkbox.displayName = 'Checkbox';
|
|
37
39
|
export { Checkbox };
|
package/fe/packages/ui/react/components/{ConfirmDialog.d.ts → ConfirmDialog/ConfirmDialog.d.ts}
RENAMED
|
@@ -1,19 +1,11 @@
|
|
|
1
1
|
export interface ConfirmDialogProps {
|
|
2
|
-
/** 是否显示 */
|
|
3
2
|
open: boolean;
|
|
4
|
-
/** 标题 */
|
|
5
3
|
title?: string;
|
|
6
|
-
/** 内容 */
|
|
7
4
|
content: string;
|
|
8
|
-
/** 确认按钮文本 */
|
|
9
5
|
okText?: string;
|
|
10
|
-
/** 取消按钮文本 */
|
|
11
6
|
cancelText?: string;
|
|
12
|
-
/** 确认按钮加载状态 */
|
|
13
7
|
loading?: boolean;
|
|
14
|
-
/** 确认回调 */
|
|
15
8
|
onOk: () => void | Promise<void>;
|
|
16
|
-
/** 取消回调 */
|
|
17
9
|
onCancel: () => void;
|
|
18
10
|
}
|
|
19
11
|
export declare function ConfirmDialog({ open, title, content, okText, cancelText, loading, onOk, onCancel, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useI18n } from '../../i18n';
|
|
3
|
+
import { Button } from '../Button';
|
|
4
|
+
import { Modal } from '../Modal';
|
|
5
|
+
export function ConfirmDialog({ open, title, content, okText, cancelText, loading = false, onOk, onCancel, }) {
|
|
6
|
+
const t = useI18n();
|
|
7
|
+
const handleOk = async () => {
|
|
8
|
+
await onOk();
|
|
9
|
+
};
|
|
10
|
+
return (_jsx(Modal, { open: open, onClose: onCancel, title: title ?? t('components.confirmDialog.title'), width: 450, className: "tc-ui-confirm-dialog", footer: _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { onClick: onCancel, 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 ?? t('components.confirmDialog.cancelText') }), _jsx(Button, { variant: "primary", loading: loading, onClick: handleOk, className: "min-w-[100px] bg-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/90 border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary-foreground))]", children: okText ?? t('components.confirmDialog.okText') })] }), children: _jsx("div", { className: "py-4 text-base text-foreground", children: content }) }));
|
|
11
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ConfirmDialog';
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type DropdownItem } from '../Dropdown';
|
|
2
|
+
export type ActionOverflow = 'auto' | 'dropdown' | 'inline';
|
|
2
3
|
export interface ActionBtnProps {
|
|
3
4
|
actions: DropdownItem[];
|
|
5
|
+
overflow?: ActionOverflow;
|
|
4
6
|
}
|
|
5
|
-
export declare const ActionBtn: ({ actions }: ActionBtnProps) =>
|
|
7
|
+
export declare const ActionBtn: ({ actions, overflow }: ActionBtnProps) => import("react/jsx-runtime").JSX.Element | "-";
|
|
6
8
|
//# sourceMappingURL=ActionBtn.d.ts.map
|
|
@@ -1,13 +1,94 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
2
3
|
import { MoreHorizontal } from 'lucide-react';
|
|
4
|
+
import { useCallback, useLayoutEffect, useRef, useState } from 'react';
|
|
5
|
+
import { Button } from '../Button';
|
|
3
6
|
import { Dropdown } from '../Dropdown';
|
|
4
|
-
|
|
7
|
+
const isInlineAction = (action) => !('render' in action);
|
|
8
|
+
const renderActionLabel = (action) => (_jsxs(_Fragment, { children: [action.icon && _jsx("span", { className: "flex-shrink-0", children: action.icon }), _jsx("span", { className: "truncate", children: action.label })] }));
|
|
9
|
+
const canShowInlineActions = (actions) => actions.every(isInlineAction);
|
|
10
|
+
const InlineActions = ({ actions }) => (_jsx("div", { className: "tc-ui-action-btn-list inline-flex max-w-full items-center justify-center gap-1 whitespace-nowrap", children: actions.map((action) => isInlineAction(action) ? (_jsx(Button, { type: "button", onClick: action.onClick, className: cn('tc-ui-action-btn inline-flex h-8 max-w-full items-center justify-center gap-1 rounded px-2 text-sm transition-colors', action.danger ? 'text-red-600 hover:bg-red-50' : 'text-table-action-text hover:bg-background/60'), children: renderActionLabel(action) }, action.key)) : null) }));
|
|
11
|
+
const DropdownActions = ({ actions }) => (_jsx(Dropdown, { items: actions, children: _jsx(Button, { type: "button", state: "ghost", variant: "text", "aria-label": "More actions", className: "inline-flex h-8 w-8 items-center justify-center rounded transition-colors hover:bg-background/60", children: _jsx(MoreHorizontal, { className: "h-5 w-5 text-gray-600" }) }) }));
|
|
12
|
+
const AutoActionBtn = ({ actions }) => {
|
|
13
|
+
const containerRef = useRef(null);
|
|
14
|
+
const measureRef = useRef(null);
|
|
15
|
+
const [canShowInline, setCanShowInline] = useState(false);
|
|
16
|
+
const updateOverflow = useCallback(() => {
|
|
17
|
+
const container = containerRef.current;
|
|
18
|
+
const measure = measureRef.current;
|
|
19
|
+
if (!container || !measure) {
|
|
20
|
+
setCanShowInline(false);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const containerWidth = container.clientWidth;
|
|
24
|
+
const actionsWidth = measure.scrollWidth;
|
|
25
|
+
setCanShowInline(containerWidth > 0 && actionsWidth <= containerWidth);
|
|
26
|
+
}, []);
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
if (!canShowInlineActions(actions))
|
|
29
|
+
return;
|
|
30
|
+
if (actions.length <= 1)
|
|
31
|
+
return;
|
|
32
|
+
updateOverflow();
|
|
33
|
+
let rafId = 0;
|
|
34
|
+
const scheduleUpdate = () => {
|
|
35
|
+
cancelAnimationFrame(rafId);
|
|
36
|
+
rafId = requestAnimationFrame(updateOverflow);
|
|
37
|
+
};
|
|
38
|
+
if (typeof ResizeObserver === 'undefined') {
|
|
39
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
40
|
+
return () => {
|
|
41
|
+
cancelAnimationFrame(rafId);
|
|
42
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
const observer = new ResizeObserver(scheduleUpdate);
|
|
46
|
+
if (containerRef.current) {
|
|
47
|
+
observer.observe(containerRef.current);
|
|
48
|
+
}
|
|
49
|
+
if (measureRef.current) {
|
|
50
|
+
observer.observe(measureRef.current);
|
|
51
|
+
}
|
|
52
|
+
window.addEventListener('resize', scheduleUpdate);
|
|
53
|
+
return () => {
|
|
54
|
+
cancelAnimationFrame(rafId);
|
|
55
|
+
observer.disconnect();
|
|
56
|
+
window.removeEventListener('resize', scheduleUpdate);
|
|
57
|
+
};
|
|
58
|
+
}, [actions, updateOverflow]);
|
|
5
59
|
if (actions.length === 0) {
|
|
6
60
|
return '-';
|
|
7
61
|
}
|
|
62
|
+
if (actions.length === 1) {
|
|
63
|
+
if (!canShowInlineActions(actions)) {
|
|
64
|
+
return _jsx(DropdownActions, { actions: actions });
|
|
65
|
+
}
|
|
66
|
+
return _jsx(InlineActions, { actions: actions });
|
|
67
|
+
}
|
|
68
|
+
if (!canShowInlineActions(actions)) {
|
|
69
|
+
return _jsx(DropdownActions, { actions: actions });
|
|
70
|
+
}
|
|
71
|
+
return (_jsxs("div", { ref: containerRef, className: "relative w-full min-w-0", children: [_jsx("div", { ref: measureRef, "aria-hidden": "true", className: "pointer-events-none invisible absolute left-0 top-0 w-max max-w-none", children: _jsx(InlineActions, { actions: actions }) }), canShowInline ? _jsx(InlineActions, { actions: actions }) : _jsx(DropdownActions, { actions: actions })] }));
|
|
72
|
+
};
|
|
73
|
+
export const ActionBtn = ({ actions, overflow }) => {
|
|
74
|
+
if (overflow === 'dropdown') {
|
|
75
|
+
return actions.length === 0 ? '-' : _jsx(DropdownActions, { actions: actions });
|
|
76
|
+
}
|
|
77
|
+
if (overflow === 'auto') {
|
|
78
|
+
return _jsx(AutoActionBtn, { actions: actions });
|
|
79
|
+
}
|
|
80
|
+
if (actions.length === 0) {
|
|
81
|
+
return '-';
|
|
82
|
+
}
|
|
83
|
+
if (overflow === 'inline') {
|
|
84
|
+
return canShowInlineActions(actions) ? _jsx(InlineActions, { actions: actions }) : _jsx(DropdownActions, { actions: actions });
|
|
85
|
+
}
|
|
8
86
|
if (actions.length === 1) {
|
|
9
87
|
const action = actions[0];
|
|
10
|
-
|
|
88
|
+
if (!isInlineAction(action)) {
|
|
89
|
+
return _jsx(DropdownActions, { actions: actions });
|
|
90
|
+
}
|
|
91
|
+
return (_jsx(Button, { type: "button", onClick: action.onClick, className: "tc-ui-action-btn inline-flex items-center justify-center w-8 h-8 rounded transition-colors", children: action.label }));
|
|
11
92
|
}
|
|
12
|
-
return
|
|
93
|
+
return _jsx(DropdownActions, { actions: actions });
|
|
13
94
|
};
|
|
@@ -1,44 +1,31 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
+
import type { DropdownItem } from '../Dropdown';
|
|
2
3
|
import { type PaginationProps } from '../Pagination';
|
|
3
4
|
import type { ColumnDef } from '../types/baseType';
|
|
4
|
-
|
|
5
|
+
import { type ActionOverflow } from './ActionBtn';
|
|
6
|
+
type DataTableActionColumnOptions<T> = {
|
|
7
|
+
actions?: DropdownItem[] | ((value: unknown, record: T, index: number) => DropdownItem[]);
|
|
8
|
+
actionOverflow?: ActionOverflow;
|
|
9
|
+
};
|
|
10
|
+
type TableColumnDef<T = Record<string, unknown>> = ColumnDef<T> & DataTableActionColumnOptions<T>;
|
|
5
11
|
type RowSelection<T> = {
|
|
6
|
-
/**
|
|
7
|
-
* 受控用法:完全由外部维护选中 keys
|
|
8
|
-
*/
|
|
9
12
|
selectedRowKeys?: Array<string | number>;
|
|
10
|
-
/**
|
|
11
|
-
* 非受控用法:仅作为初始值,后续由内部维护
|
|
12
|
-
*/
|
|
13
13
|
defaultSelectedRowKeys?: Array<string | number>;
|
|
14
|
-
/**
|
|
15
|
-
* 选中项变化回调(受控/非受控都会触发)
|
|
16
|
-
*/
|
|
17
14
|
onChange?: (selectedRowKeys: Array<string | number>, selectedRows: T[], isAll: boolean) => void;
|
|
18
|
-
/**
|
|
19
|
-
* 全选 受控
|
|
20
|
-
*/
|
|
21
15
|
isAll?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* theader checkbox
|
|
24
|
-
*/
|
|
25
16
|
beforeCheckboxNode?: ReactNode;
|
|
26
17
|
};
|
|
27
18
|
interface DataTableProps<T = Record<string, unknown>> {
|
|
28
|
-
columns:
|
|
19
|
+
columns: TableColumnDef<T>[];
|
|
29
20
|
data: T[];
|
|
30
21
|
rowKey?: keyof T | ((record: T, index: number) => string | number);
|
|
31
22
|
rowSelection?: RowSelection<T>;
|
|
32
23
|
pagination?: PaginationProps;
|
|
33
24
|
loading?: boolean;
|
|
34
|
-
/**
|
|
35
|
-
* 统一配置 column width 默认100px
|
|
36
|
-
* 会被columns[number].width覆盖
|
|
37
|
-
*/
|
|
38
25
|
defaultColumnWidth?: number;
|
|
39
26
|
}
|
|
40
27
|
export declare function DataTable<T = Record<string, unknown>>({ columns, data: pData, loading, rowKey, rowSelection, defaultColumnWidth, pagination: pPagination, }: DataTableProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
41
28
|
export { ActionBtn } from './ActionBtn';
|
|
42
29
|
export type { ActionBtnProps } from './ActionBtn';
|
|
43
|
-
export type { DataTableProps, RowSelection };
|
|
44
|
-
//# sourceMappingURL=
|
|
30
|
+
export type { DataTableProps, RowSelection, TableColumnDef };
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,34 +1,45 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import noResult from '@tc/ui-react/assets/table/no-result.svg';
|
|
3
|
+
import { useI18n } from '../../i18n';
|
|
3
4
|
import { useMemo, useState } from 'react';
|
|
5
|
+
import { Checkbox } from '../Checkbox';
|
|
4
6
|
import { Pagination } from '../Pagination';
|
|
5
7
|
import { Skeleton } from '../Skeleton';
|
|
6
8
|
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../table';
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
import { ActionBtn } from './ActionBtn';
|
|
10
|
+
const defaultRowKey = 'id';
|
|
11
|
+
const getRowKey = (record, index, rowKey = defaultRowKey) => {
|
|
12
|
+
if (typeof rowKey === 'function') {
|
|
13
|
+
return rowKey(record, index);
|
|
14
|
+
}
|
|
15
|
+
const key = record[rowKey];
|
|
16
|
+
return typeof key === 'string' || typeof key === 'number' ? key : index;
|
|
17
|
+
};
|
|
18
|
+
const renderCellContent = (column, value, record, rowIndex, hasAction) => {
|
|
19
|
+
if (hasAction && column.actions) {
|
|
20
|
+
const actions = typeof column.actions === 'function' ? column.actions(value, record, rowIndex) : column.actions;
|
|
21
|
+
return (_jsx("div", { className: "flex w-full min-w-0 justify-center", children: _jsx(ActionBtn, { actions: actions, overflow: column.actionOverflow ?? 'auto' }) }));
|
|
22
|
+
}
|
|
23
|
+
return column.render ? column.render(value, record, rowIndex) : value;
|
|
24
|
+
};
|
|
25
|
+
export function DataTable({ columns, data: pData, loading, rowKey = defaultRowKey, rowSelection, defaultColumnWidth = 100, pagination: pPagination, }) {
|
|
26
|
+
const t = useI18n();
|
|
15
27
|
const getCellValue = (record, column) => record[(column.dataIndex || column.key)];
|
|
16
28
|
const isControlled = rowSelection && Array.isArray(rowSelection.selectedRowKeys);
|
|
17
29
|
const [innerSelectedRowKeys, setInnerSelectedRowKeys] = useState(rowSelection?.defaultSelectedRowKeys ?? []);
|
|
18
30
|
const selectedRowKeys = (isControlled ? rowSelection?.selectedRowKeys : innerSelectedRowKeys) ?? [];
|
|
19
31
|
const selectedKeySet = new Set(selectedRowKeys);
|
|
20
32
|
const [currentPage, setCurrentPage] = useState(1);
|
|
21
|
-
const { showPagination, pagination, data } = useMemo(() => {
|
|
33
|
+
const { showPagination, pagination, data, pageStartIndex } = useMemo(() => {
|
|
22
34
|
let pagination;
|
|
23
35
|
let data = pData;
|
|
24
36
|
let showPagination;
|
|
25
|
-
|
|
37
|
+
let pageStartIndex = 0;
|
|
26
38
|
if (pPagination) {
|
|
27
39
|
pagination = pPagination;
|
|
28
40
|
showPagination = pagination.total > 0;
|
|
29
41
|
}
|
|
30
42
|
else {
|
|
31
|
-
// 使用内部
|
|
32
43
|
pagination = {
|
|
33
44
|
onChange(v) {
|
|
34
45
|
setCurrentPage(v);
|
|
@@ -38,16 +49,17 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
|
|
|
38
49
|
total: pData.length,
|
|
39
50
|
};
|
|
40
51
|
showPagination = pData.length > pagination.pageSize;
|
|
41
|
-
|
|
52
|
+
pageStartIndex = (pagination.current - 1) * pagination.pageSize;
|
|
53
|
+
data = pData.slice(pageStartIndex, pagination.current * pagination.pageSize);
|
|
42
54
|
}
|
|
43
55
|
return {
|
|
44
56
|
showPagination,
|
|
45
57
|
pagination,
|
|
46
58
|
data,
|
|
59
|
+
pageStartIndex,
|
|
47
60
|
};
|
|
48
61
|
}, [currentPage, pData, pPagination]);
|
|
49
|
-
|
|
50
|
-
const pageRowKeys = pData.map((record, index) => getRowKey(record, index));
|
|
62
|
+
const pageRowKeys = data.map((record, index) => getRowKey(record, pageStartIndex + index, rowKey));
|
|
51
63
|
const handleRowSelectChange = (key) => {
|
|
52
64
|
if (!rowSelection)
|
|
53
65
|
return;
|
|
@@ -55,7 +67,7 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
|
|
|
55
67
|
? selectedRowKeys.filter((k) => k !== key)
|
|
56
68
|
: [...selectedRowKeys, key];
|
|
57
69
|
const nextSelectedKeySet = new Set(nextSelectedKeys);
|
|
58
|
-
const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index)));
|
|
70
|
+
const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index, rowKey)));
|
|
59
71
|
if (!isControlled) {
|
|
60
72
|
setInnerSelectedRowKeys(nextSelectedKeys);
|
|
61
73
|
}
|
|
@@ -70,10 +82,8 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
|
|
|
70
82
|
const pageKeySet = new Set(pageRowKeys);
|
|
71
83
|
nextSelectedKeys = Array.from(new Set([
|
|
72
84
|
...selectedRowKeys,
|
|
73
|
-
//
|
|
74
85
|
...pageRowKeys.filter((key) => !selectedKeySet.has(key)),
|
|
75
86
|
]))
|
|
76
|
-
//
|
|
77
87
|
.filter((key) => pageKeySet.has(key) || selectedKeySet.has(key));
|
|
78
88
|
}
|
|
79
89
|
else {
|
|
@@ -81,27 +91,23 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
|
|
|
81
91
|
nextSelectedKeys = selectedRowKeys.filter((key) => !pageKeySet.has(key));
|
|
82
92
|
}
|
|
83
93
|
const nextSelectedKeySet = new Set(nextSelectedKeys);
|
|
84
|
-
const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index)));
|
|
94
|
+
const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index, rowKey)));
|
|
85
95
|
if (!isControlled) {
|
|
86
96
|
setInnerSelectedRowKeys(nextSelectedKeys);
|
|
87
97
|
}
|
|
88
98
|
rowSelection.onChange?.(nextSelectedKeys, selectedRows, checked);
|
|
89
99
|
};
|
|
90
100
|
const allChecked = rowSelection
|
|
91
|
-
? rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key)))
|
|
101
|
+
? (rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key))))
|
|
92
102
|
: false;
|
|
93
103
|
const partiallyChecked = rowSelection ? pageRowKeys.some((key) => selectedKeySet.has(key)) && !allChecked : false;
|
|
94
|
-
return (_jsxs("div", { className: "bg-
|
|
104
|
+
return (_jsxs("div", { className: "tc-ui-data-table bg-background rounded-[20px] overflow-hidden relative", children: [_jsxs(Table, { containerClassName: "rounded-b-none overflow-x-auto", children: [_jsx(TableHeader, { children: _jsxs(TableRow, { children: [rowSelection && (_jsxs(TableHead, { className: "bg-table-header", style: {
|
|
95
105
|
width: '48px',
|
|
96
106
|
minWidth: '48px',
|
|
97
107
|
position: 'sticky',
|
|
98
108
|
left: 0,
|
|
99
109
|
zIndex: 10,
|
|
100
|
-
}, children: [rowSelection.beforeCheckboxNode, _jsx(
|
|
101
|
-
if (el) {
|
|
102
|
-
el.indeterminate = partiallyChecked;
|
|
103
|
-
}
|
|
104
|
-
}, onChange: handleSelectAllChange })] })), columns.map((column) => {
|
|
110
|
+
}, children: [rowSelection.beforeCheckboxNode, _jsx(Checkbox, { checked: allChecked, "aria-label": "Select all rows", indeterminate: partiallyChecked, onChange: (_, event) => handleSelectAllChange(event) })] })), columns.map((column) => {
|
|
105
111
|
const hasAction = column.isAction ?? column.key === 'action';
|
|
106
112
|
return (_jsx(TableHead, { isAction: hasAction, style: {
|
|
107
113
|
...(hasAction
|
|
@@ -115,27 +121,31 @@ export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSel
|
|
|
115
121
|
? { width: column.width, minWidth: column.width }
|
|
116
122
|
: { minWidth: defaultColumnWidth }),
|
|
117
123
|
}, children: column.title }, column.key));
|
|
118
|
-
})] }) }), _jsx(TableBody, { children: data.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (rowSelection ? 1 : 0), className: "text-muted-foreground", children: _jsxs("div", { className: "flex flex-col items-center w-full gap-2.5", children: [_jsx("img", { src: noResult, alt:
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
124
|
+
})] }) }), _jsx(TableBody, { children: data.length === 0 ? (_jsx(TableRow, { children: _jsx(TableCell, { colSpan: columns.length + (rowSelection ? 1 : 0), className: "text-muted-foreground", children: _jsxs("div", { className: "flex flex-col items-center w-full gap-2.5", children: [_jsx("img", { src: noResult, alt: t('components.dataTable.noData'), className: " w-24 h-24" }), t('components.dataTable.noData')] }) }) })) : (data.map((record, rowIndex) => {
|
|
125
|
+
const absoluteRowIndex = pageStartIndex + rowIndex;
|
|
126
|
+
const recordKey = getRowKey(record, absoluteRowIndex, rowKey);
|
|
127
|
+
return (_jsxs(TableRow, { children: [rowSelection && (_jsx(TableCell, { className: "bg-background", style: {
|
|
128
|
+
width: '48px',
|
|
129
|
+
minWidth: '48px',
|
|
130
|
+
position: 'sticky',
|
|
131
|
+
left: 0,
|
|
132
|
+
zIndex: 1,
|
|
133
|
+
}, children: _jsx(Checkbox, { checked: selectedKeySet.has(recordKey), "aria-label": "Select row", onChange: () => handleRowSelectChange(recordKey) }) })), columns.map((column) => {
|
|
134
|
+
const value = getCellValue(record, column);
|
|
135
|
+
const hasAction = column.isAction ?? column.key === 'action';
|
|
136
|
+
return (_jsx(TableCell, { isAction: hasAction, style: {
|
|
137
|
+
...(hasAction
|
|
138
|
+
? {
|
|
139
|
+
position: 'sticky',
|
|
140
|
+
right: 0,
|
|
141
|
+
zIndex: 1,
|
|
142
|
+
}
|
|
143
|
+
: undefined),
|
|
144
|
+
...(column.width
|
|
145
|
+
? { width: column.width, minWidth: column.width }
|
|
146
|
+
: { minWidth: defaultColumnWidth }),
|
|
147
|
+
}, children: renderCellContent(column, value, record, rowIndex, hasAction) }, column.key));
|
|
148
|
+
})] }, recordKey));
|
|
149
|
+
})) })] }), loading && (_jsx("div", { className: "absolute inset-0 rounded-[20px] bg-background/70 text-sm text-gray-600 z-[100]", children: _jsx(Skeleton, { mode: "tableloading", rows: 8 }) })), showPagination && (_jsx("div", { className: "px-6 pb-6 mt-6", children: _jsx(Pagination, { ...pagination }) }))] }));
|
|
140
150
|
}
|
|
141
151
|
export { ActionBtn } from './ActionBtn';
|
|
@@ -5,13 +5,7 @@ export type DateRange = {
|
|
|
5
5
|
to?: Date | undefined;
|
|
6
6
|
};
|
|
7
7
|
export type QuickRangePreset = {
|
|
8
|
-
/**
|
|
9
|
-
* 展示文案
|
|
10
|
-
*/
|
|
11
8
|
label: string;
|
|
12
|
-
/**
|
|
13
|
-
* 返回一个范围对象
|
|
14
|
-
*/
|
|
15
9
|
getRange: () => DateRange;
|
|
16
10
|
};
|
|
17
11
|
export interface CalendarProps {
|
|
@@ -21,14 +15,7 @@ export interface CalendarProps {
|
|
|
21
15
|
disabledDate?: (date: Date) => boolean;
|
|
22
16
|
showTime?: boolean;
|
|
23
17
|
className?: string;
|
|
24
|
-
/**
|
|
25
|
-
* 自定义文案配置,会覆盖默认文案
|
|
26
|
-
*/
|
|
27
18
|
locale?: Partial<DateLocaleConfig>;
|
|
28
|
-
/**
|
|
29
|
-
* 范围模式下的快捷选择配置
|
|
30
|
-
* 不传则使用默认预设
|
|
31
|
-
*/
|
|
32
19
|
quickRanges?: QuickRangePreset[];
|
|
33
20
|
}
|
|
34
21
|
export declare function Calendar({ mode, value, onChange, disabledDate, showTime, className, locale: customLocale, quickRanges, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|