@_tc/template-core 0.0.1-bate.8 → 0.0.1-bate.9
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/{app → cjs/app}/controller/base.d.ts +1 -2
- package/{app → cjs/app}/controller/base.js +0 -2
- package/{app → cjs/app}/controller/project.d.ts +1 -2
- package/cjs/app/controller/project.js +50 -0
- package/{app → cjs/app}/controller/view.d.ts +1 -2
- package/cjs/app/data/signKey.d.ts +1 -0
- package/cjs/app/extend/db.d.ts +2 -0
- package/cjs/app/extend/db.js +12 -0
- package/cjs/app/extend/generateErrorMessage.d.ts +7 -0
- package/{app → cjs/app}/extend/generateErrorMessage.js +3 -0
- package/cjs/app/extend/logger.d.ts +11 -0
- package/cjs/app/extend/parsingParamsOnUrl.d.ts +2 -0
- package/{app → cjs/app}/extend/render-view.d.ts +1 -2
- package/{app → cjs/app}/middleware/api-params-verify.d.ts +1 -2
- package/{app → cjs/app}/middleware/api-sign-verify.d.ts +1 -2
- package/{app → cjs/app}/middleware/error-handle.d.ts +1 -2
- package/{app → cjs/app}/middleware/project-handler.d.ts +1 -2
- package/cjs/app/middleware.d.ts +5 -0
- package/{app → cjs/app}/middleware.js +23 -1
- package/cjs/app/router/project.d.ts +4 -0
- package/cjs/app/router/view.d.ts +4 -0
- package/cjs/app/router-schema/project.d.ts +3 -0
- package/cjs/app/service/bese.d.ts +10 -0
- package/cjs/app/service/project.d.ts +27 -0
- package/cjs/app/service/project.js +42 -0
- package/cjs/app/type.d.ts +2 -0
- package/cjs/app/typings.d.ts +49 -0
- package/cjs/app/view/entry.tpl +30 -0
- package/cjs/bundler/dev.d.ts +1 -0
- package/{packages/ui/react/components/Form/SchemeForm/data.js → cjs/bundler/dev.js} +30 -9
- package/cjs/bundler/index.d.ts +1 -0
- package/cjs/bundler/index.js +18 -0
- package/cjs/bundler/prod.d.ts +1 -0
- package/cjs/bundler/prod.js +19 -0
- package/cjs/bundler/utils.d.ts +7 -0
- package/cjs/bundler/utils.js +127 -0
- package/cjs/index.d.ts +28 -0
- package/cjs/packages/core/env.d.ts +15 -0
- package/cjs/packages/core/index.d.ts +6 -0
- package/{packages → cjs/packages}/core/index.js +24 -0
- package/cjs/packages/core/loader/config.d.ts +9 -0
- package/{packages → cjs/packages}/core/loader/config.js +14 -0
- package/cjs/packages/core/loader/controller.d.ts +17 -0
- package/{packages → cjs/packages}/core/loader/controller.js +23 -0
- package/cjs/packages/core/loader/extend.d.ts +8 -0
- package/{packages → cjs/packages}/core/loader/extend.js +8 -0
- package/cjs/packages/core/loader/middleware.d.ts +11 -0
- package/cjs/packages/core/loader/middleware.js +38 -0
- package/cjs/packages/core/loader/model.d.ts +36 -0
- package/{packages → cjs/packages}/core/loader/model.js +43 -0
- package/cjs/packages/core/loader/router-schema.d.ts +18 -0
- package/{packages → cjs/packages}/core/loader/router-schema.js +16 -0
- package/{packages → cjs/packages}/core/loader/router.d.ts +5 -1
- package/{packages → cjs/packages}/core/loader/router.js +20 -3
- package/cjs/packages/core/loader/service.d.ts +17 -0
- package/{packages → cjs/packages}/core/loader/service.js +14 -0
- package/cjs/packages/core/paths.d.ts +11 -0
- package/{packages → cjs/packages}/core/types.d.ts +1 -1
- package/{packages → cjs/packages}/utils/getAllFilesInFolder.d.ts +5 -1
- package/cjs/packages/utils/getAllFnReturnValue.d.ts +0 -0
- package/cjs/packages/utils/getAllFnReturnValue.js +6 -0
- package/cjs/packages/utils/index.d.ts +4 -0
- package/{packages → cjs/packages}/utils/loadFile.d.ts +6 -1
- package/{packages → cjs/packages}/utils/loadFile.js +9 -0
- package/cjs/packages/utils/path.d.ts +24 -0
- package/{packages → cjs/packages}/utils/path.js +14 -0
- package/cjs/packages/utils/runFileFn.d.ts +5 -0
- package/cjs/typings/type.d.ts +4 -0
- package/esm/app/controller/base.d.ts +14 -0
- package/esm/app/controller/base.js +21 -0
- package/esm/app/controller/project.d.ts +12 -0
- package/{app → esm/app}/controller/project.js +3 -8
- package/esm/app/controller/view.d.ts +9 -0
- package/esm/app/controller/view.js +12 -0
- package/esm/app/data/signKey.js +1 -0
- package/esm/app/extend/db.js +9 -0
- package/esm/app/extend/generateErrorMessage.js +12 -0
- package/esm/app/extend/logger.js +37 -0
- package/esm/app/extend/parsingParamsOnUrl.js +20 -0
- package/esm/app/extend/render-view.d.ts +5 -0
- package/esm/app/extend/render-view.js +16 -0
- package/esm/app/middleware/api-params-verify.d.ts +6 -0
- package/esm/app/middleware/api-params-verify.js +58 -0
- package/esm/app/middleware/api-sign-verify.d.ts +6 -0
- package/esm/app/middleware/api-sign-verify.js +23 -0
- package/esm/app/middleware/error-handle.d.ts +6 -0
- package/esm/app/middleware/error-handle.js +31 -0
- package/esm/app/middleware/project-handler.d.ts +5 -0
- package/esm/app/middleware/project-handler.js +19 -0
- package/esm/app/middleware.js +55 -0
- package/esm/app/router/project.js +6 -0
- package/esm/app/router/view.js +3 -0
- package/esm/app/router-schema/project.js +31 -0
- package/esm/app/service/bese.js +12 -0
- package/{app → esm/app}/service/project.js +6 -10
- package/esm/app/type.js +1 -0
- package/esm/app/typings.js +1 -0
- package/esm/app/view/entry.tpl +30 -0
- package/esm/bundler/dev.d.ts +2 -0
- package/esm/bundler/dev.js +29 -0
- package/esm/bundler/index.d.ts +2 -0
- package/esm/bundler/index.js +14 -0
- package/esm/bundler/prod.d.ts +2 -0
- package/esm/bundler/prod.js +16 -0
- package/esm/bundler/utils.d.ts +8 -0
- package/esm/bundler/utils.js +85 -0
- package/esm/index.js +13 -0
- package/esm/packages/core/env.js +23 -0
- package/esm/packages/core/index.js +109 -0
- package/esm/packages/core/loader/config.d.ts +10 -0
- package/esm/packages/core/loader/config.js +43 -0
- package/esm/packages/core/loader/controller.d.ts +18 -0
- package/esm/packages/core/loader/controller.js +38 -0
- package/esm/packages/core/loader/extend.d.ts +9 -0
- package/esm/packages/core/loader/extend.js +39 -0
- package/esm/packages/core/loader/middleware.d.ts +12 -0
- package/esm/packages/core/loader/middleware.js +36 -0
- package/esm/packages/core/loader/model.d.ts +37 -0
- package/esm/packages/core/loader/model.js +127 -0
- package/esm/packages/core/loader/router-schema.d.ts +19 -0
- package/esm/packages/core/loader/router-schema.js +33 -0
- package/esm/packages/core/loader/router.d.ts +9 -0
- package/esm/packages/core/loader/router.js +57 -0
- package/esm/packages/core/loader/service.d.ts +18 -0
- package/esm/packages/core/loader/service.js +28 -0
- package/esm/packages/core/paths.js +6 -0
- package/esm/packages/core/types.d.ts +75 -0
- package/esm/packages/core/types.js +1 -0
- package/esm/packages/utils/getAllFilesInFolder.d.ts +10 -0
- package/esm/packages/utils/getAllFilesInFolder.js +8 -0
- package/esm/packages/utils/getAllFnReturnValue.js +6 -0
- package/esm/packages/utils/index.js +4 -0
- package/esm/packages/utils/loadFile.d.ts +21 -0
- package/esm/packages/utils/loadFile.js +63 -0
- package/esm/packages/utils/path.d.ts +25 -0
- package/esm/packages/utils/path.js +27 -0
- package/esm/packages/utils/runFileFn.js +1 -0
- package/esm/typings/type.d.ts +5 -0
- package/esm/typings/type.js +1 -0
- package/fe/frontend/main.js +6 -0
- package/fe/packages/ui/react/assets/table/no-result.svg +5 -0
- package/{packages → fe/packages}/ui/react/components/Button/Button.d.ts +24 -0
- package/fe/packages/ui/react/components/Button/Button.js +42 -0
- package/{packages → fe/packages}/ui/react/components/Button/SumbitButton.d.ts +4 -0
- package/fe/packages/ui/react/components/Button/SumbitButton.js +32 -0
- package/fe/packages/ui/react/components/Button/index.js +2 -0
- package/{packages → fe/packages}/ui/react/components/Checkbox/Checkbox.js +9 -12
- package/fe/packages/ui/react/components/Checkbox/index.js +1 -0
- package/{packages → fe/packages}/ui/react/components/ConfirmDialog.d.ts +8 -0
- package/fe/packages/ui/react/components/ConfirmDialog.js +9 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +13 -0
- package/{packages → fe/packages}/ui/react/components/DataTable/data-table.d.ts +19 -0
- package/{packages → fe/packages}/ui/react/components/DataTable/data-table.js +23 -26
- package/{packages → fe/packages}/ui/react/components/Date/Calendar.d.ts +13 -0
- package/fe/packages/ui/react/components/Date/Calendar.js +215 -0
- package/{packages → fe/packages}/ui/react/components/Date/Date.d.ts +10 -0
- package/fe/packages/ui/react/components/Date/Date.js +178 -0
- package/fe/packages/ui/react/components/Date/DateTestPage.js +29 -0
- package/fe/packages/ui/react/components/Date/LocaleContext.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/LocaleContext.js +8 -0
- package/{packages → fe/packages}/ui/react/components/Date/LocaleProvider.d.ts +11 -0
- package/fe/packages/ui/react/components/Date/LocaleProvider.js +24 -0
- package/fe/packages/ui/react/components/Date/TimePicker.js +76 -0
- package/fe/packages/ui/react/components/Date/data.js +4 -0
- package/{packages → fe/packages}/ui/react/components/Date/dateLocaleStore.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/dateLocaleStore.js +14 -0
- package/fe/packages/ui/react/components/Date/index.js +5 -0
- package/{packages → fe/packages}/ui/react/components/Date/locales.d.ts +19 -0
- package/{packages → fe/packages}/ui/react/components/Date/locales.js +16 -6
- package/fe/packages/ui/react/components/Dropdown.js +54 -0
- package/{packages → fe/packages}/ui/react/components/Form/Form.d.ts +6 -0
- package/fe/packages/ui/react/components/Form/Form.js +8 -0
- package/{packages → fe/packages}/ui/react/components/Form/FormItem.d.ts +21 -0
- package/fe/packages/ui/react/components/Form/FormItem.js +43 -0
- package/fe/packages/ui/react/components/Form/SchemeForm/data.js +8 -0
- package/{packages → fe/packages}/ui/react/components/Form/SchemeForm/index.d.ts +93 -0
- package/fe/packages/ui/react/components/Form/SchemeForm/index.js +69 -0
- package/fe/packages/ui/react/components/Form/index.js +4 -0
- package/fe/packages/ui/react/components/Form/useForm.js +1 -0
- package/{packages → fe/packages}/ui/react/components/ImagePreview/ImagePreview.js +46 -41
- package/{packages → fe/packages}/ui/react/components/ImagePreview/PreviewImage.d.ts +3 -0
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +25 -0
- package/fe/packages/ui/react/components/ImagePreview/index.js +2 -0
- package/{packages → fe/packages}/ui/react/components/Input/Input.d.ts +20 -0
- package/fe/packages/ui/react/components/Input/Input.js +60 -0
- package/fe/packages/ui/react/components/Input/index.js +1 -0
- package/{packages → fe/packages}/ui/react/components/Label/Label.d.ts +29 -0
- package/fe/packages/ui/react/components/Label/Label.js +35 -0
- package/fe/packages/ui/react/components/Label/index.js +2 -0
- package/{packages → fe/packages}/ui/react/components/Message/Message.d.ts +7 -0
- package/fe/packages/ui/react/components/Message/Message.js +55 -0
- package/{packages → fe/packages}/ui/react/components/Message/MessageManager.js +26 -21
- package/fe/packages/ui/react/components/Message/data.js +1 -0
- package/fe/packages/ui/react/components/Message/index.js +1 -0
- package/{packages → fe/packages}/ui/react/components/Modal/Modal.d.ts +6 -0
- package/fe/packages/ui/react/components/Modal/Modal.js +51 -0
- package/{packages → fe/packages}/ui/react/components/Modal/ModalManager.d.ts +12 -0
- package/{packages → fe/packages}/ui/react/components/Modal/ModalManager.js +22 -23
- package/fe/packages/ui/react/components/Modal/index.js +2 -0
- package/{packages → fe/packages}/ui/react/components/Pagination.d.ts +7 -0
- package/{packages → fe/packages}/ui/react/components/Pagination.js +19 -15
- package/{packages → fe/packages}/ui/react/components/Search/Search.d.ts +3 -0
- package/fe/packages/ui/react/components/Search/Search.js +12 -0
- package/fe/packages/ui/react/components/Search/index.js +1 -0
- package/{packages → fe/packages}/ui/react/components/Select/Select.d.ts +2 -0
- package/fe/packages/ui/react/components/Select/Select.js +180 -0
- package/fe/packages/ui/react/components/Select/index.js +1 -0
- package/{packages → fe/packages}/ui/react/components/Skeleton/Skeleton.d.ts +15 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +31 -0
- package/fe/packages/ui/react/components/Skeleton/index.js +1 -0
- package/fe/packages/ui/react/components/Switch/Switch.js +20 -0
- package/fe/packages/ui/react/components/Switch/index.js +1 -0
- package/{packages → fe/packages}/ui/react/components/TableSearch/TableSearch.d.ts +37 -0
- package/{packages → fe/packages}/ui/react/components/TableSearch/TableSearch.js +22 -23
- package/fe/packages/ui/react/components/TableSearch/index.js +1 -0
- package/fe/packages/ui/react/components/TableSearch/lang.js +23 -0
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +11 -0
- package/{packages → fe/packages}/ui/react/components/Textarea.d.ts +40 -0
- package/fe/packages/ui/react/components/Textarea.js +35 -0
- package/{packages → fe/packages}/ui/react/components/Tooltip.d.ts +16 -0
- package/{packages → fe/packages}/ui/react/components/Tooltip.js +26 -16
- package/{packages → fe/packages}/ui/react/components/TreeSelect.d.ts +6 -0
- package/{packages → fe/packages}/ui/react/components/TreeSelect.js +27 -24
- package/{packages → fe/packages}/ui/react/components/Upload/ImageUpload.js +11 -14
- package/{packages → fe/packages}/ui/react/components/Upload/Upload.d.ts +27 -0
- package/fe/packages/ui/react/components/Upload/Upload.js +5 -0
- package/fe/packages/ui/react/components/Upload/index.js +2 -0
- package/fe/packages/ui/react/components/breadcrumb.js +78 -0
- package/{packages → fe/packages}/ui/react/components/hooks/useInputController.d.ts +3 -0
- package/{packages → fe/packages}/ui/react/components/hooks/useInputController.js +15 -12
- package/fe/packages/ui/react/components/index.js +23 -0
- package/fe/packages/ui/react/components/table.js +20 -0
- package/fe/packages/ui/react/components/testPage/index.js +118 -0
- package/fe/packages/ui/react/hooks/useBreadcrumb.js +2 -0
- package/fe/packages/ui/react/hooks/useInit.js +9 -0
- package/fe/packages/ui/react/hooks/useLanguage.js +4 -0
- package/{packages → fe/packages}/ui/react/hooks/usePagination.js +7 -13
- package/fe/packages/ui/react/index.js +4 -0
- package/fe/packages/ui/react/lib/export.d.ts +66 -0
- package/{packages → fe/packages}/ui/react/lib/export.js +52 -49
- package/fe/packages/ui/react/lib/utils.d.ts +34 -0
- package/{packages → fe/packages}/ui/react/lib/utils.js +33 -15
- package/fe/packages/ui/react/locales/index.js +6 -0
- package/{packages → fe/packages}/ui/react/stores/breadcrumb.js +6 -7
- package/{packages → fe/packages}/ui/react/stores/language.js +14 -17
- package/fe/packages/ui/react/types/index.js +1 -0
- package/package.json +31 -12
- package/app/controller/base.d.ts.map +0 -1
- package/app/controller/project.d.ts.map +0 -1
- package/app/controller/view.d.ts.map +0 -1
- package/app/data/signKey.d.ts.map +0 -1
- package/app/extend/db.d.ts.map +0 -1
- package/app/extend/db.js +0 -7
- package/app/extend/generateErrorMessage.d.ts.map +0 -1
- package/app/extend/logger.d.ts.map +0 -1
- package/app/extend/parsingParamsOnUrl.d.ts.map +0 -1
- package/app/extend/render-view.d.ts.map +0 -1
- package/app/middleware/api-params-verify.d.ts.map +0 -1
- package/app/middleware/api-sign-verify.d.ts.map +0 -1
- package/app/middleware/error-handle.d.ts.map +0 -1
- package/app/middleware/project-handler.d.ts.map +0 -1
- package/app/middleware.d.ts.map +0 -1
- package/app/pages/main.d.ts.map +0 -1
- package/app/pages/main.js +0 -9
- package/app/router/project.d.ts.map +0 -1
- package/app/router/view.d.ts.map +0 -1
- package/app/router-schema/project.d.ts.map +0 -1
- package/app/service/bese.d.ts.map +0 -1
- package/app/service/project.d.ts.map +0 -1
- package/app/type.d.ts.map +0 -1
- package/app/typings.d.ts.map +0 -1
- package/app/vite/config/base.d.ts +0 -6
- package/app/vite/config/base.js +0 -96
- package/app/vite/config/data.d.ts +0 -3
- package/app/vite/config/data.js +0 -11
- package/app/vite/config/dev.d.ts +0 -11
- package/app/vite/config/dev.js +0 -15
- package/app/vite/config/prod.d.ts +0 -17
- package/app/vite/config/prod.js +0 -34
- package/app/vite/dev.d.ts +0 -2
- package/app/vite/dev.js +0 -29
- package/app/vite/index.d.ts +0 -1
- package/app/vite/index.js +0 -13
- package/app/vite/package.json +0 -10
- package/app/vite/prod.d.ts +0 -1
- package/app/vite/prod.js +0 -82
- package/index.d.ts.map +0 -1
- package/model/index.d.ts +0 -2
- package/model/index.d.ts.map +0 -1
- package/model/index.js +0 -6
- package/model/test.d.ts +0 -6
- package/model/test.d.ts.map +0 -1
- package/model/test.js +0 -5
- package/model/test2.d.ts +0 -6
- package/model/test2.d.ts.map +0 -1
- package/model/test2.js +0 -5
- package/packages/core/env.d.ts.map +0 -1
- package/packages/core/index.d.ts.map +0 -1
- package/packages/core/loader/config.d.ts +0 -4
- package/packages/core/loader/config.d.ts.map +0 -1
- package/packages/core/loader/controller.d.ts +0 -4
- package/packages/core/loader/controller.d.ts.map +0 -1
- package/packages/core/loader/extend.d.ts +0 -4
- package/packages/core/loader/extend.d.ts.map +0 -1
- package/packages/core/loader/middleware.d.ts +0 -4
- package/packages/core/loader/middleware.d.ts.map +0 -1
- package/packages/core/loader/middleware.js +0 -15
- package/packages/core/loader/model.d.ts +0 -15
- package/packages/core/loader/model.d.ts.map +0 -1
- package/packages/core/loader/router-schema.d.ts +0 -4
- package/packages/core/loader/router-schema.d.ts.map +0 -1
- package/packages/core/loader/router.d.ts.map +0 -1
- package/packages/core/loader/service.d.ts +0 -4
- package/packages/core/loader/service.d.ts.map +0 -1
- package/packages/core/paths.d.ts.map +0 -1
- package/packages/core/types.d.ts.map +0 -1
- package/packages/ui/react/components/Button/Button.d.ts.map +0 -1
- package/packages/ui/react/components/Button/Button.js +0 -35
- package/packages/ui/react/components/Button/SumbitButton.d.ts.map +0 -1
- package/packages/ui/react/components/Button/SumbitButton.js +0 -31
- package/packages/ui/react/components/Button/index.d.ts.map +0 -1
- package/packages/ui/react/components/Button/index.js +0 -20
- package/packages/ui/react/components/Checkbox/Checkbox.d.ts.map +0 -1
- package/packages/ui/react/components/Checkbox/index.d.ts.map +0 -1
- package/packages/ui/react/components/Checkbox/index.js +0 -17
- package/packages/ui/react/components/ConfirmDialog.d.ts.map +0 -1
- package/packages/ui/react/components/ConfirmDialog.js +0 -12
- package/packages/ui/react/components/DataTable/ActionBtn.d.ts.map +0 -1
- package/packages/ui/react/components/DataTable/ActionBtn.js +0 -17
- package/packages/ui/react/components/DataTable/data-table.d.ts.map +0 -1
- package/packages/ui/react/components/Date/Calendar.d.ts.map +0 -1
- package/packages/ui/react/components/Date/Calendar.js +0 -209
- package/packages/ui/react/components/Date/Date.d.ts.map +0 -1
- package/packages/ui/react/components/Date/Date.js +0 -160
- package/packages/ui/react/components/Date/DateTestPage.d.ts.map +0 -1
- package/packages/ui/react/components/Date/DateTestPage.js +0 -32
- package/packages/ui/react/components/Date/LocaleContext.d.ts +0 -2
- package/packages/ui/react/components/Date/LocaleContext.d.ts.map +0 -1
- package/packages/ui/react/components/Date/LocaleContext.js +0 -8
- package/packages/ui/react/components/Date/LocaleProvider.d.ts.map +0 -1
- package/packages/ui/react/components/Date/LocaleProvider.js +0 -16
- package/packages/ui/react/components/Date/TimePicker.d.ts.map +0 -1
- package/packages/ui/react/components/Date/TimePicker.js +0 -78
- package/packages/ui/react/components/Date/data.d.ts.map +0 -1
- package/packages/ui/react/components/Date/data.js +0 -7
- package/packages/ui/react/components/Date/dateLocaleStore.d.ts.map +0 -1
- package/packages/ui/react/components/Date/dateLocaleStore.js +0 -17
- package/packages/ui/react/components/Date/index.d.ts.map +0 -1
- package/packages/ui/react/components/Date/index.js +0 -23
- package/packages/ui/react/components/Date/locales.d.ts.map +0 -1
- package/packages/ui/react/components/Dropdown.d.ts.map +0 -1
- package/packages/ui/react/components/Dropdown.js +0 -55
- package/packages/ui/react/components/Form/Form.d.ts.map +0 -1
- package/packages/ui/react/components/Form/Form.js +0 -14
- package/packages/ui/react/components/Form/FormItem.d.ts.map +0 -1
- package/packages/ui/react/components/Form/FormItem.js +0 -75
- package/packages/ui/react/components/Form/SchemeForm/data.d.ts.map +0 -1
- package/packages/ui/react/components/Form/SchemeForm/index.d.ts.map +0 -1
- package/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
- package/packages/ui/react/components/Form/index.d.ts.map +0 -1
- package/packages/ui/react/components/Form/index.js +0 -20
- package/packages/ui/react/components/Form/useForm.d.ts.map +0 -1
- package/packages/ui/react/components/Form/useForm.js +0 -5
- package/packages/ui/react/components/ImagePreview/ImagePreview.d.ts.map +0 -1
- package/packages/ui/react/components/ImagePreview/PreviewImage.d.ts.map +0 -1
- package/packages/ui/react/components/ImagePreview/PreviewImage.js +0 -28
- package/packages/ui/react/components/ImagePreview/index.d.ts.map +0 -1
- package/packages/ui/react/components/ImagePreview/index.js +0 -18
- package/packages/ui/react/components/Input/Input.d.ts.map +0 -1
- package/packages/ui/react/components/Input/Input.js +0 -60
- package/packages/ui/react/components/Input/index.d.ts.map +0 -1
- package/packages/ui/react/components/Input/index.js +0 -17
- package/packages/ui/react/components/Label/Label.d.ts.map +0 -1
- package/packages/ui/react/components/Label/Label.js +0 -36
- package/packages/ui/react/components/Label/index.d.ts.map +0 -1
- package/packages/ui/react/components/Label/index.js +0 -20
- package/packages/ui/react/components/Message/Message.d.ts.map +0 -1
- package/packages/ui/react/components/Message/Message.js +0 -55
- package/packages/ui/react/components/Message/MessageManager.d.ts.map +0 -1
- package/packages/ui/react/components/Message/data.d.ts.map +0 -1
- package/packages/ui/react/components/Message/data.js +0 -4
- package/packages/ui/react/components/Message/index.d.ts.map +0 -1
- package/packages/ui/react/components/Message/index.js +0 -5
- package/packages/ui/react/components/Modal/Modal.d.ts.map +0 -1
- package/packages/ui/react/components/Modal/Modal.js +0 -50
- package/packages/ui/react/components/Modal/ModalManager.d.ts.map +0 -1
- package/packages/ui/react/components/Modal/index.d.ts.map +0 -1
- package/packages/ui/react/components/Modal/index.js +0 -7
- package/packages/ui/react/components/Pagination.d.ts.map +0 -1
- package/packages/ui/react/components/Search/Search.d.ts.map +0 -1
- package/packages/ui/react/components/Search/Search.js +0 -14
- package/packages/ui/react/components/Search/index.d.ts.map +0 -1
- package/packages/ui/react/components/Search/index.js +0 -8
- package/packages/ui/react/components/Select/Select.d.ts.map +0 -1
- package/packages/ui/react/components/Select/Select.js +0 -166
- package/packages/ui/react/components/Select/index.d.ts.map +0 -1
- package/packages/ui/react/components/Select/index.js +0 -17
- package/packages/ui/react/components/Skeleton/Skeleton.d.ts.map +0 -1
- package/packages/ui/react/components/Skeleton/Skeleton.js +0 -35
- package/packages/ui/react/components/Skeleton/index.d.ts.map +0 -1
- package/packages/ui/react/components/Skeleton/index.js +0 -5
- package/packages/ui/react/components/Switch/Switch.d.ts.map +0 -1
- package/packages/ui/react/components/Switch/Switch.js +0 -56
- package/packages/ui/react/components/Switch/index.d.ts.map +0 -1
- package/packages/ui/react/components/Switch/index.js +0 -17
- package/packages/ui/react/components/TableSearch/TableSearch.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/index.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/index.js +0 -8
- package/packages/ui/react/components/TableSearch/lang.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/lang.js +0 -27
- package/packages/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts.map +0 -1
- package/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +0 -14
- package/packages/ui/react/components/Textarea.d.ts.map +0 -1
- package/packages/ui/react/components/Textarea.js +0 -37
- package/packages/ui/react/components/Tooltip.d.ts.map +0 -1
- package/packages/ui/react/components/TreeSelect.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/ImageUpload.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/Upload.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/Upload.js +0 -8
- package/packages/ui/react/components/Upload/index.d.ts.map +0 -1
- package/packages/ui/react/components/Upload/index.js +0 -18
- package/packages/ui/react/components/breadcrumb.d.ts.map +0 -1
- package/packages/ui/react/components/breadcrumb.js +0 -79
- package/packages/ui/react/components/hooks/useInputController.d.ts.map +0 -1
- package/packages/ui/react/components/index.d.ts.map +0 -1
- package/packages/ui/react/components/index.js +0 -39
- package/packages/ui/react/components/table.d.ts.map +0 -1
- package/packages/ui/react/components/table.js +0 -63
- package/packages/ui/react/components/testPage/index.d.ts.map +0 -1
- package/packages/ui/react/components/testPage/index.js +0 -123
- package/packages/ui/react/hooks/useBreadcrumb.d.ts.map +0 -1
- package/packages/ui/react/hooks/useBreadcrumb.js +0 -5
- package/packages/ui/react/hooks/useInit.d.ts.map +0 -1
- package/packages/ui/react/hooks/useInit.js +0 -11
- package/packages/ui/react/hooks/useLanguage.d.ts.map +0 -1
- package/packages/ui/react/hooks/useLanguage.js +0 -7
- package/packages/ui/react/hooks/usePagination.d.ts.map +0 -1
- package/packages/ui/react/index.d.ts.map +0 -1
- package/packages/ui/react/index.js +0 -18
- package/packages/ui/react/lib/export.d.ts +0 -22
- package/packages/ui/react/lib/export.d.ts.map +0 -1
- package/packages/ui/react/lib/utils.d.ts +0 -10
- package/packages/ui/react/lib/utils.d.ts.map +0 -1
- package/packages/ui/react/locales/index.d.ts.map +0 -1
- package/packages/ui/react/locales/index.js +0 -9
- package/packages/ui/react/stores/breadcrumb.d.ts.map +0 -1
- package/packages/ui/react/stores/language.d.ts.map +0 -1
- package/packages/ui/react/types/index.d.ts.map +0 -1
- package/packages/ui/react/types/index.js +0 -2
- package/packages/utils/getAllFilesInFolder.d.ts.map +0 -1
- package/packages/utils/getAllFnReturnValue.d.ts.map +0 -1
- package/packages/utils/getAllFnReturnValue.js +0 -1
- package/packages/utils/index.d.ts.map +0 -1
- package/packages/utils/loadFile.d.ts.map +0 -1
- package/packages/utils/path.d.ts +0 -7
- package/packages/utils/path.d.ts.map +0 -1
- package/packages/utils/runFileFn.d.ts.map +0 -1
- package/typings/type.d.ts +0 -2
- package/typings/type.d.ts.map +0 -1
- /package/{app → cjs/app}/controller/view.js +0 -0
- /package/{app → cjs/app}/data/signKey.js +0 -0
- /package/{app → cjs/app}/extend/logger.js +0 -0
- /package/{app → cjs/app}/extend/parsingParamsOnUrl.js +0 -0
- /package/{app → cjs/app}/extend/render-view.js +0 -0
- /package/{app → cjs/app}/middleware/api-params-verify.js +0 -0
- /package/{app → cjs/app}/middleware/api-sign-verify.js +0 -0
- /package/{app → cjs/app}/middleware/error-handle.js +0 -0
- /package/{app → cjs/app}/middleware/project-handler.js +0 -0
- /package/{app → cjs/app}/router/project.js +0 -0
- /package/{app → cjs/app}/router/view.js +0 -0
- /package/{app → cjs/app}/router-schema/project.js +0 -0
- /package/{app → cjs/app}/service/bese.js +0 -0
- /package/{app → cjs/app}/type.js +0 -0
- /package/{app → cjs/app}/typings.js +0 -0
- /package/{index.js → cjs/index.js} +0 -0
- /package/{packages → cjs/packages}/core/env.js +0 -0
- /package/{packages → cjs/packages}/core/paths.js +0 -0
- /package/{packages → cjs/packages}/core/types.js +0 -0
- /package/{packages → cjs/packages}/utils/getAllFilesInFolder.js +0 -0
- /package/{packages → cjs/packages}/utils/index.js +0 -0
- /package/{packages → cjs/packages}/utils/runFileFn.js +0 -0
- /package/{typings → cjs/typings}/type.js +0 -0
- /package/{app → esm/app}/data/signKey.d.ts +0 -0
- /package/{app → esm/app}/extend/db.d.ts +0 -0
- /package/{app → esm/app}/extend/generateErrorMessage.d.ts +0 -0
- /package/{app → esm/app}/extend/logger.d.ts +0 -0
- /package/{app → esm/app}/extend/parsingParamsOnUrl.d.ts +0 -0
- /package/{app → esm/app}/middleware.d.ts +0 -0
- /package/{app → esm/app}/router/project.d.ts +0 -0
- /package/{app → esm/app}/router/view.d.ts +0 -0
- /package/{app → esm/app}/router-schema/project.d.ts +0 -0
- /package/{app → esm/app}/service/bese.d.ts +0 -0
- /package/{app → esm/app}/service/project.d.ts +0 -0
- /package/{app → esm/app}/type.d.ts +0 -0
- /package/{app → esm/app}/typings.d.ts +0 -0
- /package/{index.d.ts → esm/index.d.ts} +0 -0
- /package/{packages → esm/packages}/core/env.d.ts +0 -0
- /package/{packages → esm/packages}/core/index.d.ts +0 -0
- /package/{packages → esm/packages}/core/paths.d.ts +0 -0
- /package/{packages → esm/packages}/utils/getAllFnReturnValue.d.ts +0 -0
- /package/{packages → esm/packages}/utils/index.d.ts +0 -0
- /package/{packages → esm/packages}/utils/runFileFn.d.ts +0 -0
- /package/{app/pages → fe/frontend}/main.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Button/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Checkbox/Checkbox.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Checkbox/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/DataTable/ActionBtn.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Date/DateTestPage.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Date/TimePicker.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Date/data.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Date/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Dropdown.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Form/SchemeForm/data.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Form/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Form/useForm.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/ImagePreview/ImagePreview.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/ImagePreview/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Input/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Label/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Message/MessageManager.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Message/data.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Message/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Modal/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Search/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Select/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Skeleton/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Switch/Switch.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Switch/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/TableSearch/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/TableSearch/lang.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Upload/ImageUpload.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/Upload/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/breadcrumb.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/table.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/components/testPage/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/hooks/useBreadcrumb.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/hooks/useInit.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/hooks/useLanguage.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/hooks/usePagination.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/locales/index.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/stores/breadcrumb.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/stores/language.d.ts +0 -0
- /package/{packages → fe/packages}/ui/react/types/index.d.ts +0 -0
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { forwardRef } from 'react';
|
|
4
|
+
const Button = forwardRef(({ className, variant = 'default', size = 'md', disabled, loading, leftIcon, rightIcon, noUnderline, children, ...props }, ref) => {
|
|
5
|
+
const isDisabled = disabled || loading;
|
|
6
|
+
// 基础样式
|
|
7
|
+
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';
|
|
8
|
+
// 变体样式
|
|
9
|
+
const variantStyles = {
|
|
10
|
+
default: 'bg-white border border-border text-foreground hover:bg-muted/50 focus-visible:ring-border',
|
|
11
|
+
primary: 'bg-theme text-theme-foreground border border-theme hover:bg-theme/90 focus-visible:ring-theme',
|
|
12
|
+
text: 'bg-transparent border-0 text-foreground hover:bg-muted/30 focus-visible:ring-border',
|
|
13
|
+
// 链接样式按钮:无背景、无边框、与正文相同颜色,仅在悬停时下划线(可通过 noUnderline 控制)
|
|
14
|
+
link: 'bg-transparent border-0 text-foreground focus-visible:ring-border',
|
|
15
|
+
};
|
|
16
|
+
// 禁用状态样式(根据不同 variant)
|
|
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
|
+
// 尺寸样式
|
|
24
|
+
const sizeStyles = {
|
|
25
|
+
sm: 'h-8 px-3 text-sm',
|
|
26
|
+
md: 'h-10 px-4 text-sm',
|
|
27
|
+
lg: 'h-12 px-6 text-base',
|
|
28
|
+
};
|
|
29
|
+
// 展示内容
|
|
30
|
+
const contents = [
|
|
31
|
+
leftIcon && (_jsx("span", { className: cn('flex items-center', 'mr-2'), children: leftIcon }, "left")),
|
|
32
|
+
children,
|
|
33
|
+
rightIcon ? (_jsx("span", { className: cn('flex items-center', 'ml-2'), children: rightIcon }, "right")) : undefined,
|
|
34
|
+
].filter(Boolean);
|
|
35
|
+
return (_jsx("button", { ref: ref, className: cn(baseStyles, variantStyles[variant], disabledStyles[variant],
|
|
36
|
+
// link 模式不固定高度/内边距,更接近普通文字
|
|
37
|
+
variant === 'link' ? 'h-auto px-0 py-0 text-sm font-normal' : sizeStyles[size], variant === 'link' ? '' : 'before:content-normal',
|
|
38
|
+
// link 模式下,根据 noUnderline 控制下划线
|
|
39
|
+
variant === 'link' && !noUnderline && 'hover:underline', variant === 'link' && !noUnderline && 'disabled:hover:no-underline', isDisabled && 'cursor-not-allowed', className), disabled: isDisabled, ...props, children: contents }));
|
|
40
|
+
});
|
|
41
|
+
Button.displayName = 'Button';
|
|
42
|
+
export { Button };
|
|
@@ -3,6 +3,10 @@ import { type ButtonProps } from './Button';
|
|
|
3
3
|
export type SumbitButtonProps = MOmit<ButtonProps, 'onClick'> & {
|
|
4
4
|
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void | boolean> | void;
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* 会自动添加loading 其余同button一致
|
|
9
|
+
*/
|
|
6
10
|
declare const SumbitButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
11
|
declare const AsynchronousButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
12
|
export { AsynchronousButton, SumbitButton };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { Button } from './Button';
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* 会自动添加loading 其余同button一致
|
|
8
|
+
*/
|
|
9
|
+
const SumbitButton = (props) => {
|
|
10
|
+
const { onClick, leftIcon, size = 'md', ...bprops } = props;
|
|
11
|
+
const [loading, uLoading] = useState(false);
|
|
12
|
+
// Loading spinner icon - 根据按钮尺寸调整大小
|
|
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) => {
|
|
20
|
+
if (loading)
|
|
21
|
+
return;
|
|
22
|
+
uLoading(true);
|
|
23
|
+
try {
|
|
24
|
+
return await onClick?.(e);
|
|
25
|
+
}
|
|
26
|
+
finally {
|
|
27
|
+
uLoading(false);
|
|
28
|
+
}
|
|
29
|
+
}, ...bprops }));
|
|
30
|
+
};
|
|
31
|
+
const AsynchronousButton = SumbitButton;
|
|
32
|
+
export { AsynchronousButton, SumbitButton };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const react_1 = require("react");
|
|
7
|
-
const Checkbox = (0, react_1.forwardRef)(({ className, checked: _controlledChecked, value, defaultChecked, indeterminate, onChange, ...props }, ref) => {
|
|
8
|
-
const internalRef = (0, react_1.useRef)(null);
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { forwardRef, useLayoutEffect, useRef, useState } from 'react';
|
|
4
|
+
const Checkbox = forwardRef(({ className, checked: _controlledChecked, value, defaultChecked, indeterminate, onChange, ...props }, ref) => {
|
|
5
|
+
const internalRef = useRef(null);
|
|
9
6
|
const controlledChecked = value ?? _controlledChecked;
|
|
10
7
|
const setRefs = (element) => {
|
|
11
8
|
internalRef.current = element;
|
|
@@ -19,13 +16,13 @@ const Checkbox = (0, react_1.forwardRef)(({ className, checked: _controlledCheck
|
|
|
19
16
|
element.indeterminate = indeterminate ?? false;
|
|
20
17
|
}
|
|
21
18
|
};
|
|
22
|
-
|
|
19
|
+
useLayoutEffect(() => {
|
|
23
20
|
if (internalRef.current) {
|
|
24
21
|
internalRef.current.indeterminate = indeterminate ?? false;
|
|
25
22
|
}
|
|
26
23
|
}, [indeterminate]);
|
|
27
24
|
const isControlled = controlledChecked !== undefined;
|
|
28
|
-
const [internalChecked, setInternalChecked] =
|
|
25
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);
|
|
29
26
|
const checked = isControlled ? controlledChecked : internalChecked;
|
|
30
27
|
const handleChange = (e) => {
|
|
31
28
|
const newChecked = e.target.checked;
|
|
@@ -34,7 +31,7 @@ const Checkbox = (0, react_1.forwardRef)(({ className, checked: _controlledCheck
|
|
|
34
31
|
}
|
|
35
32
|
onChange?.(newChecked, e);
|
|
36
33
|
};
|
|
37
|
-
return ((
|
|
34
|
+
return (_jsx("input", { type: "checkbox", ref: setRefs, checked: checked, onChange: handleChange, className: cn('w-4 h-4 rounded border-gray-300 accent-theme', className), ...props }));
|
|
38
35
|
});
|
|
39
|
-
exports.Checkbox = Checkbox;
|
|
40
36
|
Checkbox.displayName = 'Checkbox';
|
|
37
|
+
export { Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Checkbox';
|
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
export interface ConfirmDialogProps {
|
|
2
|
+
/** 是否显示 */
|
|
2
3
|
open: boolean;
|
|
4
|
+
/** 标题 */
|
|
3
5
|
title?: string;
|
|
6
|
+
/** 内容 */
|
|
4
7
|
content: string;
|
|
8
|
+
/** 确认按钮文本 */
|
|
5
9
|
okText?: string;
|
|
10
|
+
/** 取消按钮文本 */
|
|
6
11
|
cancelText?: string;
|
|
12
|
+
/** 确认按钮加载状态 */
|
|
7
13
|
loading?: boolean;
|
|
14
|
+
/** 确认回调 */
|
|
8
15
|
onOk: () => void | Promise<void>;
|
|
16
|
+
/** 取消回调 */
|
|
9
17
|
onCancel: () => void;
|
|
10
18
|
}
|
|
11
19
|
export declare function ConfirmDialog({ open, title, content, okText, cancelText, loading, onOk, onCancel, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from './Button';
|
|
3
|
+
import { Modal } from './Modal';
|
|
4
|
+
export function ConfirmDialog({ open, title = '提示', content, okText = '确认', cancelText = '取消', loading = false, onOk, onCancel, }) {
|
|
5
|
+
const handleOk = async () => {
|
|
6
|
+
await onOk();
|
|
7
|
+
};
|
|
8
|
+
return (_jsx(Modal, { open: open, onClose: onCancel, title: title, width: 450, footer: _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { onClick: onCancel, className: "min-w-[100px] bg-white border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/5", children: 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 })] }), children: _jsx("div", { className: "py-4 text-base text-foreground", children: content }) }));
|
|
9
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MoreHorizontal } from 'lucide-react';
|
|
3
|
+
import { Dropdown } from '../Dropdown';
|
|
4
|
+
export const ActionBtn = ({ actions }) => {
|
|
5
|
+
if (actions.length === 0) {
|
|
6
|
+
return '-';
|
|
7
|
+
}
|
|
8
|
+
if (actions.length === 1) {
|
|
9
|
+
const action = actions[0];
|
|
10
|
+
return (_jsx("button", { onClick: action.onClick, className: "inline-flex items-center justify-center w-8 h-8 rounded transition-colors", children: action.label }));
|
|
11
|
+
}
|
|
12
|
+
return (_jsx(Dropdown, { items: actions, children: _jsx("button", { className: "inline-flex items-center justify-center w-8 h-8 rounded transition-colors", children: _jsx(MoreHorizontal, { className: "h-5 w-5 text-gray-600" }) }) }));
|
|
13
|
+
};
|
|
@@ -3,10 +3,25 @@ import { type PaginationProps } from '../Pagination';
|
|
|
3
3
|
import type { ColumnDef } from '../types/baseType';
|
|
4
4
|
export type { ColumnDef } from '../types/baseType';
|
|
5
5
|
type RowSelection<T> = {
|
|
6
|
+
/**
|
|
7
|
+
* 受控用法:完全由外部维护选中 keys
|
|
8
|
+
*/
|
|
6
9
|
selectedRowKeys?: Array<string | number>;
|
|
10
|
+
/**
|
|
11
|
+
* 非受控用法:仅作为初始值,后续由内部维护
|
|
12
|
+
*/
|
|
7
13
|
defaultSelectedRowKeys?: Array<string | number>;
|
|
14
|
+
/**
|
|
15
|
+
* 选中项变化回调(受控/非受控都会触发)
|
|
16
|
+
*/
|
|
8
17
|
onChange?: (selectedRowKeys: Array<string | number>, selectedRows: T[], isAll: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* 全选 受控
|
|
20
|
+
*/
|
|
9
21
|
isAll?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* theader checkbox
|
|
24
|
+
*/
|
|
10
25
|
beforeCheckboxNode?: ReactNode;
|
|
11
26
|
};
|
|
12
27
|
interface DataTableProps<T = Record<string, unknown>> {
|
|
@@ -16,6 +31,10 @@ interface DataTableProps<T = Record<string, unknown>> {
|
|
|
16
31
|
rowSelection?: RowSelection<T>;
|
|
17
32
|
pagination?: PaginationProps;
|
|
18
33
|
loading?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 统一配置 column width 默认100px
|
|
36
|
+
* 会被columns[number].width覆盖
|
|
37
|
+
*/
|
|
19
38
|
defaultColumnWidth?: number;
|
|
20
39
|
}
|
|
21
40
|
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;
|
|
@@ -1,17 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const no_result_svg_1 = __importDefault(require("@tc/ui-react/assets/table/no-result.svg"));
|
|
10
|
-
const react_1 = require("react");
|
|
11
|
-
const Pagination_1 = require("../Pagination");
|
|
12
|
-
const Skeleton_1 = require("../Skeleton");
|
|
13
|
-
const table_1 = require("../table");
|
|
14
|
-
function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection, defaultColumnWidth = 100, pagination: pPagination, }) {
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import noResult from '@tc/ui-react/assets/table/no-result.svg';
|
|
3
|
+
import { useMemo, useState } from 'react';
|
|
4
|
+
import { Pagination } from '../Pagination';
|
|
5
|
+
import { Skeleton } from '../Skeleton';
|
|
6
|
+
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../table';
|
|
7
|
+
export function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection, defaultColumnWidth = 100, pagination: pPagination, }) {
|
|
15
8
|
const getRowKey = (record, index) => {
|
|
16
9
|
if (typeof rowKey === 'function') {
|
|
17
10
|
return rowKey(record, index);
|
|
@@ -21,19 +14,21 @@ function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection,
|
|
|
21
14
|
};
|
|
22
15
|
const getCellValue = (record, column) => record[(column.dataIndex || column.key)];
|
|
23
16
|
const isControlled = rowSelection && Array.isArray(rowSelection.selectedRowKeys);
|
|
24
|
-
const [innerSelectedRowKeys, setInnerSelectedRowKeys] =
|
|
17
|
+
const [innerSelectedRowKeys, setInnerSelectedRowKeys] = useState(rowSelection?.defaultSelectedRowKeys ?? []);
|
|
25
18
|
const selectedRowKeys = (isControlled ? rowSelection?.selectedRowKeys : innerSelectedRowKeys) ?? [];
|
|
26
19
|
const selectedKeySet = new Set(selectedRowKeys);
|
|
27
|
-
const [currentPage, setCurrentPage] =
|
|
28
|
-
const { showPagination, pagination, data } =
|
|
20
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
21
|
+
const { showPagination, pagination, data } = useMemo(() => {
|
|
29
22
|
let pagination;
|
|
30
23
|
let data = pData;
|
|
31
24
|
let showPagination;
|
|
25
|
+
// 使用外部
|
|
32
26
|
if (pPagination) {
|
|
33
27
|
pagination = pPagination;
|
|
34
28
|
showPagination = pagination.total > 0;
|
|
35
29
|
}
|
|
36
30
|
else {
|
|
31
|
+
// 使用内部
|
|
37
32
|
pagination = {
|
|
38
33
|
onChange(v) {
|
|
39
34
|
setCurrentPage(v);
|
|
@@ -51,6 +46,7 @@ function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection,
|
|
|
51
46
|
data,
|
|
52
47
|
};
|
|
53
48
|
}, [currentPage, pData, pPagination]);
|
|
49
|
+
// TODO getRowKey 依赖剥离
|
|
54
50
|
const pageRowKeys = pData.map((record, index) => getRowKey(record, index));
|
|
55
51
|
const handleRowSelectChange = (key) => {
|
|
56
52
|
if (!rowSelection)
|
|
@@ -74,8 +70,10 @@ function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection,
|
|
|
74
70
|
const pageKeySet = new Set(pageRowKeys);
|
|
75
71
|
nextSelectedKeys = Array.from(new Set([
|
|
76
72
|
...selectedRowKeys,
|
|
73
|
+
//
|
|
77
74
|
...pageRowKeys.filter((key) => !selectedKeySet.has(key)),
|
|
78
75
|
]))
|
|
76
|
+
//
|
|
79
77
|
.filter((key) => pageKeySet.has(key) || selectedKeySet.has(key));
|
|
80
78
|
}
|
|
81
79
|
else {
|
|
@@ -93,19 +91,19 @@ function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection,
|
|
|
93
91
|
? rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key)))
|
|
94
92
|
: false;
|
|
95
93
|
const partiallyChecked = rowSelection ? pageRowKeys.some((key) => selectedKeySet.has(key)) && !allChecked : false;
|
|
96
|
-
return ((
|
|
94
|
+
return (_jsxs("div", { className: "bg-white 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: {
|
|
97
95
|
width: '48px',
|
|
98
96
|
minWidth: '48px',
|
|
99
97
|
position: 'sticky',
|
|
100
98
|
left: 0,
|
|
101
99
|
zIndex: 10,
|
|
102
|
-
}, children: [rowSelection.beforeCheckboxNode, (
|
|
100
|
+
}, children: [rowSelection.beforeCheckboxNode, _jsx("input", { type: "checkbox", className: "w-4 h-4 rounded border-gray-300 accent-theme", checked: allChecked, "aria-label": "Select all rows", ref: (el) => {
|
|
103
101
|
if (el) {
|
|
104
102
|
el.indeterminate = partiallyChecked;
|
|
105
103
|
}
|
|
106
104
|
}, onChange: handleSelectAllChange })] })), columns.map((column) => {
|
|
107
105
|
const hasAction = column.isAction ?? column.key === 'action';
|
|
108
|
-
return ((
|
|
106
|
+
return (_jsx(TableHead, { isAction: hasAction, style: {
|
|
109
107
|
...(hasAction
|
|
110
108
|
? {
|
|
111
109
|
position: 'sticky',
|
|
@@ -117,16 +115,16 @@ function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection,
|
|
|
117
115
|
? { width: column.width, minWidth: column.width }
|
|
118
116
|
: { minWidth: defaultColumnWidth }),
|
|
119
117
|
}, children: column.title }, column.key));
|
|
120
|
-
})] }) }), (
|
|
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: "\u6682\u65E0\u6570\u636E", className: " w-24 h-24" }), "No Data"] }) }) })) : (data.map((record, rowIndex) => (_jsxs(TableRow, { children: [rowSelection && (_jsx(TableCell, { className: "bg-white", style: {
|
|
121
119
|
width: '48px',
|
|
122
120
|
minWidth: '48px',
|
|
123
121
|
position: 'sticky',
|
|
124
122
|
left: 0,
|
|
125
123
|
zIndex: 1,
|
|
126
|
-
}, children: (
|
|
124
|
+
}, children: _jsx("input", { type: "checkbox", className: "w-4 h-4 rounded border-gray-300 accent-theme", checked: selectedKeySet.has(getRowKey(record, rowIndex)), "aria-label": "Select row", onChange: () => handleRowSelectChange(getRowKey(record, rowIndex)) }) })), columns.map((column) => {
|
|
127
125
|
const value = getCellValue(record, column);
|
|
128
126
|
const hasAction = column.isAction ?? column.key === 'action';
|
|
129
|
-
return ((
|
|
127
|
+
return (_jsx(TableCell, { isAction: hasAction, style: {
|
|
130
128
|
...(hasAction
|
|
131
129
|
? {
|
|
132
130
|
position: 'sticky',
|
|
@@ -138,7 +136,6 @@ function DataTable({ columns, data: pData, loading, rowKey = 'id', rowSelection,
|
|
|
138
136
|
? { width: column.width, minWidth: column.width }
|
|
139
137
|
: { minWidth: defaultColumnWidth }),
|
|
140
138
|
}, children: column.render ? column.render(value, record, rowIndex) : value }, column.key));
|
|
141
|
-
})] }, getRowKey(record, rowIndex))))) })] }), loading && ((
|
|
139
|
+
})] }, getRowKey(record, rowIndex))))) })] }), loading && (_jsx("div", { className: "absolute inset-0 rounded-[20px] bg-white/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 }) }))] }));
|
|
142
140
|
}
|
|
143
|
-
|
|
144
|
-
Object.defineProperty(exports, "ActionBtn", { enumerable: true, get: function () { return ActionBtn_1.ActionBtn; } });
|
|
141
|
+
export { ActionBtn } from './ActionBtn';
|
|
@@ -5,7 +5,13 @@ export type DateRange = {
|
|
|
5
5
|
to?: Date | undefined;
|
|
6
6
|
};
|
|
7
7
|
export type QuickRangePreset = {
|
|
8
|
+
/**
|
|
9
|
+
* 展示文案
|
|
10
|
+
*/
|
|
8
11
|
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* 返回一个范围对象
|
|
14
|
+
*/
|
|
9
15
|
getRange: () => DateRange;
|
|
10
16
|
};
|
|
11
17
|
export interface CalendarProps {
|
|
@@ -15,7 +21,14 @@ export interface CalendarProps {
|
|
|
15
21
|
disabledDate?: (date: Date) => boolean;
|
|
16
22
|
showTime?: boolean;
|
|
17
23
|
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 自定义文案配置,会覆盖默认文案
|
|
26
|
+
*/
|
|
18
27
|
locale?: Partial<DateLocaleConfig>;
|
|
28
|
+
/**
|
|
29
|
+
* 范围模式下的快捷选择配置
|
|
30
|
+
* 不传则使用默认预设
|
|
31
|
+
*/
|
|
19
32
|
quickRanges?: QuickRangePreset[];
|
|
20
33
|
}
|
|
21
34
|
export declare function Calendar({ mode, value, onChange, disabledDate, showTime, className, locale: customLocale, quickRanges, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from '../../lib/utils';
|
|
3
|
+
import { addMonths, addYears, eachDayOfInterval, endOfDay, endOfMonth, endOfWeek, format, isAfter, isBefore, isSameDay, isSameMonth, startOfDay, startOfMonth, startOfWeek, subDays, subMonths, subYears, } from 'date-fns';
|
|
4
|
+
import { zhCN } from 'date-fns/locale';
|
|
5
|
+
import { ChevronLeft, ChevronRight, ChevronsLeft, ChevronsRight } from 'lucide-react';
|
|
6
|
+
import { useMemo, useState } from 'react';
|
|
7
|
+
import { ModeType } from './data';
|
|
8
|
+
import { useDateLocale } from './LocaleContext';
|
|
9
|
+
import { TimePicker } from './TimePicker';
|
|
10
|
+
export function Calendar({ mode = ModeType.Single, value, onChange, disabledDate, showTime, className, locale: customLocale, quickRanges, }) {
|
|
11
|
+
const contextLocale = useDateLocale();
|
|
12
|
+
const locale = useMemo(() => ({ ...contextLocale, ...customLocale }), [contextLocale, customLocale]);
|
|
13
|
+
// Pending value for showTime mode (confirmed on button click)
|
|
14
|
+
const [pendingValue, setPendingValue] = useState(value ?? null);
|
|
15
|
+
// 当前显示的月份
|
|
16
|
+
const [currentMonth, setCurrentMonth] = useState(() => {
|
|
17
|
+
if (value instanceof Date)
|
|
18
|
+
return value;
|
|
19
|
+
if (value && 'from' in value && value.from)
|
|
20
|
+
return value.from;
|
|
21
|
+
return new Date();
|
|
22
|
+
});
|
|
23
|
+
// 悬停日期(用于范围选择预览)
|
|
24
|
+
const [hoverDate, setHoverDate] = useState(null);
|
|
25
|
+
// 生成日历网格数据
|
|
26
|
+
const days = useMemo(() => {
|
|
27
|
+
const monthStart = startOfMonth(currentMonth);
|
|
28
|
+
const monthEnd = endOfMonth(monthStart);
|
|
29
|
+
const startDate = startOfWeek(monthStart, { locale: zhCN, weekStartsOn: 0 });
|
|
30
|
+
const endDate = endOfWeek(monthEnd, { locale: zhCN, weekStartsOn: 0 });
|
|
31
|
+
const daysInGrid = eachDayOfInterval({
|
|
32
|
+
start: startDate,
|
|
33
|
+
end: endDate,
|
|
34
|
+
});
|
|
35
|
+
if (daysInGrid.length < 42) {
|
|
36
|
+
const remaining = 42 - daysInGrid.length;
|
|
37
|
+
const lastDay = daysInGrid[daysInGrid.length - 1];
|
|
38
|
+
const extraDays = eachDayOfInterval({
|
|
39
|
+
start: new Date(lastDay.getTime() + 86400000),
|
|
40
|
+
end: new Date(lastDay.getTime() + remaining * 86400000),
|
|
41
|
+
});
|
|
42
|
+
daysInGrid.push(...extraDays);
|
|
43
|
+
}
|
|
44
|
+
return daysInGrid;
|
|
45
|
+
}, [currentMonth]);
|
|
46
|
+
const weekDays = locale.weekDays;
|
|
47
|
+
const isRangeMode = mode === ModeType.Range;
|
|
48
|
+
const builtInQuickRanges = useMemo(() => [
|
|
49
|
+
{
|
|
50
|
+
label: locale.quickRangeToday,
|
|
51
|
+
getRange: () => {
|
|
52
|
+
const today = new Date();
|
|
53
|
+
return { from: startOfDay(today), to: endOfDay(today) };
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: locale.quickRangeYesterday,
|
|
58
|
+
getRange: () => {
|
|
59
|
+
const yesterday = subDays(new Date(), 1);
|
|
60
|
+
return { from: startOfDay(yesterday), to: endOfDay(yesterday) };
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
label: locale.quickRangeLast7Days,
|
|
65
|
+
getRange: () => {
|
|
66
|
+
const end = new Date();
|
|
67
|
+
const start = subDays(end, 6);
|
|
68
|
+
return { from: startOfDay(start), to: endOfDay(end) };
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
label: locale.quickRangeLast30Days,
|
|
73
|
+
getRange: () => {
|
|
74
|
+
const end = new Date();
|
|
75
|
+
const start = subDays(end, 29);
|
|
76
|
+
return { from: startOfDay(start), to: endOfDay(end) };
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
label: locale.quickRangeThisMonth,
|
|
81
|
+
getRange: () => {
|
|
82
|
+
const today = new Date();
|
|
83
|
+
return { from: startOfMonth(today), to: endOfMonth(today) };
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
label: locale.quickRangeLastYear,
|
|
88
|
+
getRange: () => {
|
|
89
|
+
const end = new Date();
|
|
90
|
+
const start = subYears(end, 1);
|
|
91
|
+
return { from: startOfDay(start), to: endOfDay(end) };
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
], [locale]);
|
|
95
|
+
const quickRangePresets = quickRanges && quickRanges.length > 0 ? quickRanges : builtInQuickRanges;
|
|
96
|
+
const handleQuickRangeClick = (getRange) => {
|
|
97
|
+
const range = getRange();
|
|
98
|
+
setCurrentMonth(range.from ?? new Date());
|
|
99
|
+
if (showTime) {
|
|
100
|
+
setPendingValue(range);
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
onChange?.(range);
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
const prevMonth = () => setCurrentMonth(subMonths(currentMonth, 1));
|
|
107
|
+
const nextMonth = () => setCurrentMonth(addMonths(currentMonth, 1));
|
|
108
|
+
const prevYear = () => setCurrentMonth(subYears(currentMonth, 1));
|
|
109
|
+
const nextYear = () => setCurrentMonth(addYears(currentMonth, 1));
|
|
110
|
+
const handleDateClick = (date) => {
|
|
111
|
+
if (disabledDate?.(date))
|
|
112
|
+
return;
|
|
113
|
+
// Preserve time when showTime is enabled
|
|
114
|
+
let dateWithTime = date;
|
|
115
|
+
if (showTime && pendingValue instanceof Date) {
|
|
116
|
+
dateWithTime = new Date(date);
|
|
117
|
+
dateWithTime.setHours(pendingValue.getHours());
|
|
118
|
+
dateWithTime.setMinutes(pendingValue.getMinutes());
|
|
119
|
+
dateWithTime.setSeconds(0);
|
|
120
|
+
dateWithTime.setMilliseconds(0);
|
|
121
|
+
}
|
|
122
|
+
if (showTime) {
|
|
123
|
+
// In showTime mode, store in pending value
|
|
124
|
+
if (mode === ModeType.Single) {
|
|
125
|
+
setPendingValue(dateWithTime);
|
|
126
|
+
}
|
|
127
|
+
else {
|
|
128
|
+
const range = pendingValue || { from: undefined, to: undefined };
|
|
129
|
+
if (!range.from || (range.from && range.to)) {
|
|
130
|
+
setPendingValue({ from: dateWithTime, to: undefined });
|
|
131
|
+
}
|
|
132
|
+
else {
|
|
133
|
+
if (isBefore(dateWithTime, range.from)) {
|
|
134
|
+
setPendingValue({ from: dateWithTime, to: range.from });
|
|
135
|
+
}
|
|
136
|
+
else {
|
|
137
|
+
setPendingValue({ from: range.from, to: dateWithTime });
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
// Without showTime, directly call onChange
|
|
144
|
+
if (mode === ModeType.Single) {
|
|
145
|
+
onChange?.(dateWithTime);
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
const range = value || { from: undefined, to: undefined };
|
|
149
|
+
if (!range.from || (range.from && range.to)) {
|
|
150
|
+
onChange?.({ from: dateWithTime, to: undefined });
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
if (isBefore(dateWithTime, range.from)) {
|
|
154
|
+
onChange?.({ from: dateWithTime, to: range.from });
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
onChange?.({ from: range.from, to: dateWithTime });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const isSelected = (date) => {
|
|
164
|
+
const compareValue = showTime ? pendingValue : value;
|
|
165
|
+
if (mode === ModeType.Single) {
|
|
166
|
+
return compareValue instanceof Date && isSameDay(date, compareValue);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
const range = compareValue;
|
|
170
|
+
return (range?.from && isSameDay(date, range.from)) || (range?.to && isSameDay(date, range.to));
|
|
171
|
+
}
|
|
172
|
+
};
|
|
173
|
+
const isInRange = (date) => {
|
|
174
|
+
if (mode !== ModeType.Range)
|
|
175
|
+
return false;
|
|
176
|
+
const compareValue = showTime ? pendingValue : value;
|
|
177
|
+
const range = compareValue;
|
|
178
|
+
if (!range?.from)
|
|
179
|
+
return false;
|
|
180
|
+
const end = range.to || hoverDate;
|
|
181
|
+
if (!end)
|
|
182
|
+
return false;
|
|
183
|
+
return (isAfter(date, range.from) && isBefore(date, end)) || (isAfter(date, end) && isBefore(date, range.from));
|
|
184
|
+
};
|
|
185
|
+
const handleConfirm = () => {
|
|
186
|
+
if (pendingValue) {
|
|
187
|
+
onChange?.(pendingValue);
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
const handleTimeChangeInternal = (date) => {
|
|
191
|
+
setPendingValue(date);
|
|
192
|
+
};
|
|
193
|
+
return (_jsxs("div", { className: cn('p-3', showTime || isRangeMode ? 'flex flex-col' : 'w-[280px]', className), children: [_jsxs("div", { className: cn('flex', (showTime || isRangeMode) && 'gap-4'), children: [isRangeMode && (_jsxs("div", { className: "w-[140px] pr-3 border-r border-border", children: [_jsx("div", { className: "text-xs font-medium text-muted-foreground mb-2", children: locale.quickRanges }), _jsx("div", { className: "space-y-1", children: quickRangePresets.map((preset) => (_jsx("button", { type: "button", onClick: () => handleQuickRangeClick(preset.getRange), className: cn('w-full text-left text-xs px-2 py-1 rounded', 'text-foreground hover:bg-muted transition-colors'), children: preset.label }, preset.label))) })] })), _jsxs("div", { className: "w-[280px]", children: [_jsxs("div", { className: "flex items-center justify-between mb-4", children: [_jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { onClick: prevYear, className: "p-1 hover:bg-muted rounded text-muted-foreground hover:text-foreground transition-colors", type: "button", children: _jsx(ChevronsLeft, { size: 16 }) }), _jsx("button", { onClick: prevMonth, className: "p-1 hover:bg-muted rounded text-muted-foreground hover:text-foreground transition-colors", type: "button", children: _jsx(ChevronLeft, { size: 16 }) })] }), _jsx("div", { className: "font-medium text-sm", children: format(currentMonth, 'yyyy年 M月', { locale: zhCN }) }), _jsxs("div", { className: "flex items-center gap-1", children: [_jsx("button", { onClick: nextMonth, className: "p-1 hover:bg-muted rounded text-muted-foreground hover:text-foreground transition-colors", type: "button", children: _jsx(ChevronRight, { size: 16 }) }), _jsx("button", { onClick: nextYear, className: "p-1 hover:bg-muted rounded text-muted-foreground hover:text-foreground transition-colors", type: "button", children: _jsx(ChevronsRight, { size: 16 }) })] })] }), _jsx("div", { className: "grid grid-cols-7 mb-2", children: weekDays.map((day) => (_jsx("div", { className: "text-center text-xs text-muted-foreground font-medium py-1", children: day }, day))) }), _jsx("div", { className: "grid grid-cols-7 gap-y-1", onMouseLeave: () => setHoverDate(null), children: days.map((date, i) => {
|
|
194
|
+
const selected = isSelected(date);
|
|
195
|
+
const inRange = isInRange(date);
|
|
196
|
+
const isToday = isSameDay(date, new Date());
|
|
197
|
+
const isCurrentMonth = isSameMonth(date, currentMonth);
|
|
198
|
+
const isDisabled = disabledDate?.(date);
|
|
199
|
+
return (_jsx("div", { className: "flex justify-center p-0", children: _jsx("button", { type: "button", onClick: () => handleDateClick(date), onMouseEnter: () => setHoverDate(date), disabled: isDisabled, className: cn('w-8 h-8 flex items-center justify-center rounded text-sm transition-colors relative z-10', !isCurrentMonth && 'text-muted-foreground/40', isCurrentMonth && !selected && !inRange && !isDisabled && 'text-foreground hover:bg-muted', selected && 'bg-theme text-theme-foreground hover:bg-theme/90', inRange && !selected && 'bg-theme/10 text-theme', !selected && !inRange && isToday && 'border border-theme text-theme', isDisabled && 'text-muted-foreground cursor-not-allowed hover:bg-transparent opacity-50'), children: format(date, 'd') }) }, i));
|
|
200
|
+
}) })] }), showTime && (_jsx("div", { className: "flex flex-col border-l border-border pl-4", children: mode === ModeType.Single ? (_jsxs("div", { className: "flex flex-col justify-center h-full", children: [_jsx("div", { className: "text-xs font-medium text-muted-foreground mb-3 text-center", children: locale.selectTime }), _jsx(TimePicker, { value: pendingValue instanceof Date ? pendingValue : undefined, onChange: handleTimeChangeInternal, className: "border-0" })] })) : (
|
|
201
|
+
// Range mode: show two time pickers
|
|
202
|
+
_jsxs("div", { className: "space-y-4 flex flex-col justify-center h-full", children: [_jsxs("div", { children: [_jsx("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center", children: locale.startTime }), _jsx(TimePicker, { value: pendingValue && 'from' in pendingValue && pendingValue.from ? pendingValue.from : undefined, onChange: (newDate) => {
|
|
203
|
+
const range = pendingValue;
|
|
204
|
+
setPendingValue({
|
|
205
|
+
from: newDate,
|
|
206
|
+
to: range?.to,
|
|
207
|
+
});
|
|
208
|
+
}, className: "border-0" })] }), pendingValue && 'from' in pendingValue && pendingValue.to && (_jsxs("div", { className: "pt-4 border-t border-border", children: [_jsx("div", { className: "text-xs font-medium text-muted-foreground mb-2 text-center", children: locale.endTime }), _jsx(TimePicker, { value: pendingValue.to, onChange: (newDate) => {
|
|
209
|
+
const range = pendingValue;
|
|
210
|
+
setPendingValue({
|
|
211
|
+
from: range?.from,
|
|
212
|
+
to: newDate,
|
|
213
|
+
});
|
|
214
|
+
}, className: "border-0" })] }))] })) }))] }), showTime && (_jsx("div", { className: "pt-3 mt-3 border-t border-border", children: _jsx("button", { type: "button", onClick: handleConfirm, className: cn('w-full py-2 px-4 rounded', 'bg-theme text-theme-foreground', 'hover:bg-theme/90 transition-colors', 'text-sm font-medium'), children: locale.confirm }) }))] }));
|
|
215
|
+
}
|
|
@@ -9,6 +9,9 @@ export type DatePickerProps = {
|
|
|
9
9
|
mode?: ModeType;
|
|
10
10
|
value?: DateValue;
|
|
11
11
|
defaultValue?: DateValue;
|
|
12
|
+
/**
|
|
13
|
+
* @default 'yyyy-MM-dd'
|
|
14
|
+
*/
|
|
12
15
|
format?: string;
|
|
13
16
|
placeholder?: string;
|
|
14
17
|
disabled?: boolean;
|
|
@@ -17,7 +20,14 @@ export type DatePickerProps = {
|
|
|
17
20
|
onChange?: (value?: DateChangeStrValue, date?: Dates) => void;
|
|
18
21
|
disabledDate?: (current: Date) => boolean;
|
|
19
22
|
className?: string;
|
|
23
|
+
/**
|
|
24
|
+
* 自定义文案配置,会覆盖默认文案
|
|
25
|
+
*/
|
|
20
26
|
locale?: Partial<DateLocaleConfig>;
|
|
27
|
+
/**
|
|
28
|
+
* 范围模式下的快捷选择配置
|
|
29
|
+
* 不传则使用默认预设
|
|
30
|
+
*/
|
|
21
31
|
quickRanges?: QuickRangePreset[];
|
|
22
32
|
};
|
|
23
33
|
declare const DatePicker: import("react").ForwardRefExoticComponent<DatePickerProps & import("react").RefAttributes<HTMLDivElement>>;
|