@_tc/template-core 0.0.1-bate.1 → 0.0.1-bate.11
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 -3
- 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/{app → cjs/app}/controller/view.js +0 -1
- package/cjs/app/data/signKey.d.ts +1 -0
- package/{app → cjs/app}/data/signKey.js +0 -1
- 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 -1
- package/cjs/app/extend/logger.d.ts +11 -0
- package/{app → cjs/app}/extend/logger.js +0 -1
- package/cjs/app/extend/parsingParamsOnUrl.d.ts +2 -0
- package/{app → cjs/app}/extend/parsingParamsOnUrl.js +0 -1
- package/{app → cjs/app}/extend/render-view.d.ts +1 -2
- package/{app → cjs/app}/extend/render-view.js +0 -1
- package/{app → cjs/app}/middleware/api-params-verify.d.ts +1 -2
- package/{app → cjs/app}/middleware/api-params-verify.js +0 -1
- package/{app → cjs/app}/middleware/api-sign-verify.d.ts +1 -2
- package/{app → cjs/app}/middleware/api-sign-verify.js +0 -1
- package/{app → cjs/app}/middleware/error-handle.d.ts +1 -2
- package/{app → cjs/app}/middleware/error-handle.js +0 -1
- package/{app → cjs/app}/middleware/project-handler.d.ts +1 -2
- package/{app → cjs/app}/middleware/project-handler.js +0 -1
- package/cjs/app/middleware.d.ts +5 -0
- package/{app → cjs/app}/middleware.js +23 -2
- package/cjs/app/router/project.d.ts +4 -0
- package/{app → cjs/app}/router/project.js +0 -1
- package/cjs/app/router/view.d.ts +4 -0
- package/{app → cjs/app}/router/view.js +0 -1
- package/cjs/app/router-schema/project.d.ts +3 -0
- package/{app → cjs/app}/router-schema/project.js +0 -1
- package/cjs/app/service/bese.d.ts +10 -0
- package/{app → cjs/app}/service/bese.js +0 -1
- 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/{app → cjs/app}/type.js +0 -1
- package/cjs/app/typings.d.ts +49 -0
- package/{app → cjs/app}/typings.js +0 -1
- package/cjs/app/view/entry.tpl +30 -0
- package/cjs/bundler/dev.d.ts +1 -0
- package/cjs/bundler/dev.js +68 -0
- 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/{index.js → cjs/index.js} +0 -1
- package/cjs/packages/core/env.d.ts +15 -0
- package/{packages → cjs/packages}/core/env.js +0 -1
- package/cjs/packages/core/index.d.ts +6 -0
- package/{packages → cjs/packages}/core/index.js +24 -1
- package/cjs/packages/core/loader/config.d.ts +9 -0
- package/{packages → cjs/packages}/core/loader/config.js +14 -1
- package/cjs/packages/core/loader/controller.d.ts +17 -0
- package/{packages → cjs/packages}/core/loader/controller.js +23 -1
- package/cjs/packages/core/loader/extend.d.ts +8 -0
- package/{packages → cjs/packages}/core/loader/extend.js +8 -1
- 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 -1
- package/cjs/packages/core/loader/router-schema.d.ts +18 -0
- package/{packages → cjs/packages}/core/loader/router-schema.js +16 -1
- package/{packages → cjs/packages}/core/loader/router.d.ts +5 -1
- package/{packages → cjs/packages}/core/loader/router.js +20 -4
- package/cjs/packages/core/loader/service.d.ts +17 -0
- package/{packages → cjs/packages}/core/loader/service.js +14 -1
- package/cjs/packages/core/paths.d.ts +11 -0
- package/{packages → cjs/packages}/core/paths.js +0 -1
- package/{packages → cjs/packages}/core/types.d.ts +1 -1
- package/{packages → cjs/packages}/core/types.js +0 -1
- package/{packages → cjs/packages}/utils/getAllFilesInFolder.d.ts +5 -1
- package/{packages → cjs/packages}/utils/getAllFilesInFolder.js +0 -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/index.js +0 -1
- package/{packages → cjs/packages}/utils/loadFile.d.ts +6 -1
- package/{packages → cjs/packages}/utils/loadFile.js +9 -1
- package/cjs/packages/utils/path.d.ts +24 -0
- package/{packages → cjs/packages}/utils/path.js +14 -1
- package/cjs/packages/utils/runFileFn.d.ts +5 -0
- package/{packages → cjs/packages}/utils/runFileFn.js +0 -1
- package/cjs/typings/type.d.ts +4 -0
- package/{typings → cjs/typings}/type.js +0 -1
- 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 -9
- 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 -11
- 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.d.ts +3 -0
- package/fe/frontend/main.js +6 -0
- package/fe/frontend/testPage/index.d.ts +3 -0
- package/fe/frontend/testPage/index.js +6 -0
- package/fe/frontend/testPage/testPage.entry.d.ts +2 -0
- package/fe/frontend/testPage/testPage.entry.js +4 -0
- package/fe/packages/ui/react/assets/table/no-result.svg +5 -0
- package/fe/packages/ui/react/components/Button/Button.d.ts +39 -0
- package/fe/packages/ui/react/components/Button/Button.js +42 -0
- package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +13 -0
- package/fe/packages/ui/react/components/Button/SumbitButton.js +32 -0
- package/fe/packages/ui/react/components/Button/index.d.ts +4 -0
- package/fe/packages/ui/react/components/Button/index.js +2 -0
- package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +17 -0
- package/fe/packages/ui/react/components/Checkbox/Checkbox.js +37 -0
- package/fe/packages/ui/react/components/Checkbox/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Checkbox/index.js +1 -0
- package/fe/packages/ui/react/components/ConfirmDialog.d.ts +20 -0
- package/fe/packages/ui/react/components/ConfirmDialog.js +9 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +6 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +13 -0
- package/fe/packages/ui/react/components/DataTable/data-table.d.ts +44 -0
- package/fe/packages/ui/react/components/DataTable/data-table.js +141 -0
- package/fe/packages/ui/react/components/Date/Calendar.d.ts +35 -0
- package/fe/packages/ui/react/components/Date/Calendar.js +215 -0
- package/fe/packages/ui/react/components/Date/Date.d.ts +36 -0
- package/fe/packages/ui/react/components/Date/Date.js +178 -0
- package/fe/packages/ui/react/components/Date/DateTestPage.d.ts +2 -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/fe/packages/ui/react/components/Date/LocaleProvider.d.ts +19 -0
- package/fe/packages/ui/react/components/Date/LocaleProvider.js +24 -0
- package/fe/packages/ui/react/components/Date/TimePicker.d.ts +7 -0
- package/fe/packages/ui/react/components/Date/TimePicker.js +76 -0
- package/fe/packages/ui/react/components/Date/data.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/data.js +4 -0
- package/fe/packages/ui/react/components/Date/dateLocaleStore.d.ts +16 -0
- package/fe/packages/ui/react/components/Date/dateLocaleStore.js +14 -0
- package/fe/packages/ui/react/components/Date/index.d.ts +6 -0
- package/fe/packages/ui/react/components/Date/index.js +5 -0
- package/fe/packages/ui/react/components/Date/locales.d.ts +42 -0
- package/fe/packages/ui/react/components/Date/locales.js +52 -0
- package/fe/packages/ui/react/components/Dropdown.d.ts +16 -0
- package/fe/packages/ui/react/components/Dropdown.js +54 -0
- package/fe/packages/ui/react/components/Form/Form.d.ts +18 -0
- package/fe/packages/ui/react/components/Form/Form.js +8 -0
- package/fe/packages/ui/react/components/Form/FormItem.d.ts +41 -0
- package/fe/packages/ui/react/components/Form/FormItem.js +43 -0
- package/fe/packages/ui/react/components/Form/SchemeForm/data.d.ts +51 -0
- package/fe/packages/ui/react/components/Form/SchemeForm/data.js +8 -0
- package/fe/packages/ui/react/components/Form/SchemeForm/index.d.ts +152 -0
- package/fe/packages/ui/react/components/Form/SchemeForm/index.js +69 -0
- package/fe/packages/ui/react/components/Form/index.d.ts +5 -0
- package/fe/packages/ui/react/components/Form/index.js +4 -0
- package/fe/packages/ui/react/components/Form/useForm.d.ts +3 -0
- package/fe/packages/ui/react/components/Form/useForm.js +1 -0
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.d.ts +8 -0
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +166 -0
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.d.ts +11 -0
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +25 -0
- package/fe/packages/ui/react/components/ImagePreview/index.d.ts +3 -0
- package/fe/packages/ui/react/components/ImagePreview/index.js +2 -0
- package/fe/packages/ui/react/components/Input/Input.d.ts +41 -0
- package/fe/packages/ui/react/components/Input/Input.js +60 -0
- package/fe/packages/ui/react/components/Input/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Input/index.js +1 -0
- package/fe/packages/ui/react/components/Label/Label.d.ts +51 -0
- package/fe/packages/ui/react/components/Label/Label.js +35 -0
- package/fe/packages/ui/react/components/Label/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Label/index.js +2 -0
- package/fe/packages/ui/react/components/Message/Message.d.ts +20 -0
- package/fe/packages/ui/react/components/Message/Message.js +55 -0
- package/fe/packages/ui/react/components/Message/MessageManager.d.ts +37 -0
- package/fe/packages/ui/react/components/Message/MessageManager.js +90 -0
- package/fe/packages/ui/react/components/Message/data.d.ts +2 -0
- package/fe/packages/ui/react/components/Message/data.js +1 -0
- package/fe/packages/ui/react/components/Message/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Message/index.js +1 -0
- package/fe/packages/ui/react/components/Modal/Modal.d.ts +25 -0
- package/fe/packages/ui/react/components/Modal/Modal.js +51 -0
- package/fe/packages/ui/react/components/Modal/ModalManager.d.ts +59 -0
- package/fe/packages/ui/react/components/Modal/ModalManager.js +89 -0
- package/fe/packages/ui/react/components/Modal/index.d.ts +4 -0
- package/fe/packages/ui/react/components/Modal/index.js +2 -0
- package/fe/packages/ui/react/components/Pagination.d.ts +18 -0
- package/fe/packages/ui/react/components/Pagination.js +88 -0
- package/fe/packages/ui/react/components/Search/Search.d.ts +17 -0
- package/fe/packages/ui/react/components/Search/Search.js +12 -0
- package/fe/packages/ui/react/components/Search/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Search/index.js +1 -0
- package/fe/packages/ui/react/components/Select/Select.d.ts +21 -0
- package/fe/packages/ui/react/components/Select/Select.js +180 -0
- package/fe/packages/ui/react/components/Select/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Select/index.js +1 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.d.ts +28 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +31 -0
- package/fe/packages/ui/react/components/Skeleton/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Skeleton/index.js +1 -0
- package/fe/packages/ui/react/components/Switch/Switch.d.ts +11 -0
- package/fe/packages/ui/react/components/Switch/Switch.js +20 -0
- package/fe/packages/ui/react/components/Switch/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Switch/index.js +1 -0
- package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +67 -0
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +119 -0
- package/fe/packages/ui/react/components/TableSearch/index.d.ts +2 -0
- package/fe/packages/ui/react/components/TableSearch/index.js +1 -0
- package/fe/packages/ui/react/components/TableSearch/lang.d.ts +15 -0
- package/fe/packages/ui/react/components/TableSearch/lang.js +23 -0
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.d.ts +9 -0
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +11 -0
- package/fe/packages/ui/react/components/Textarea.d.ts +59 -0
- package/fe/packages/ui/react/components/Textarea.js +35 -0
- package/fe/packages/ui/react/components/Tooltip.d.ts +25 -0
- package/fe/packages/ui/react/components/Tooltip.js +118 -0
- package/fe/packages/ui/react/components/TreeSelect.d.ts +25 -0
- package/fe/packages/ui/react/components/TreeSelect.js +162 -0
- package/fe/packages/ui/react/components/Upload/ImageUpload.d.ts +9 -0
- package/fe/packages/ui/react/components/Upload/ImageUpload.js +63 -0
- package/fe/packages/ui/react/components/Upload/Upload.d.ts +41 -0
- package/fe/packages/ui/react/components/Upload/Upload.js +5 -0
- package/fe/packages/ui/react/components/Upload/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Upload/index.js +2 -0
- package/fe/packages/ui/react/components/breadcrumb.d.ts +35 -0
- package/fe/packages/ui/react/components/breadcrumb.js +78 -0
- package/fe/packages/ui/react/components/hooks/useInputController.d.ts +24 -0
- package/fe/packages/ui/react/components/hooks/useInputController.js +45 -0
- package/fe/packages/ui/react/components/index.d.ts +24 -0
- package/fe/packages/ui/react/components/index.js +23 -0
- package/fe/packages/ui/react/components/table.d.ts +17 -0
- package/fe/packages/ui/react/components/table.js +20 -0
- package/fe/packages/ui/react/components/testPage/index.d.ts +3 -0
- package/fe/packages/ui/react/components/testPage/index.js +118 -0
- package/fe/packages/ui/react/hooks/useBreadcrumb.d.ts +10 -0
- package/fe/packages/ui/react/hooks/useBreadcrumb.js +2 -0
- package/fe/packages/ui/react/hooks/useInit.d.ts +3 -0
- package/fe/packages/ui/react/hooks/useInit.js +9 -0
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +7 -0
- package/fe/packages/ui/react/hooks/useLanguage.js +4 -0
- package/fe/packages/ui/react/hooks/usePagination.d.ts +16 -0
- package/fe/packages/ui/react/hooks/usePagination.js +27 -0
- package/fe/packages/ui/react/index.d.ts +3 -0
- package/fe/packages/ui/react/index.js +4 -0
- package/fe/packages/ui/react/lib/export.d.ts +66 -0
- package/fe/packages/ui/react/lib/export.js +138 -0
- package/fe/packages/ui/react/lib/utils.d.ts +34 -0
- package/fe/packages/ui/react/lib/utils.js +70 -0
- package/fe/packages/ui/react/locales/index.d.ts +8 -0
- package/fe/packages/ui/react/locales/index.js +6 -0
- package/fe/packages/ui/react/stores/breadcrumb.d.ts +15 -0
- package/fe/packages/ui/react/stores/breadcrumb.js +66 -0
- package/fe/packages/ui/react/stores/language.d.ts +13 -0
- package/fe/packages/ui/react/stores/language.js +51 -0
- package/{typings/type.d.ts → fe/packages/ui/react/types/index.d.ts} +1 -1
- package/fe/packages/ui/react/types/index.js +1 -0
- package/package.json +39 -3
- package/app/controller/base.d.ts.map +0 -1
- package/app/controller/base.js.map +0 -1
- package/app/controller/project.d.ts.map +0 -1
- package/app/controller/project.js.map +0 -1
- package/app/controller/view.d.ts.map +0 -1
- package/app/controller/view.js.map +0 -1
- package/app/data/signKey.d.ts.map +0 -1
- package/app/data/signKey.js.map +0 -1
- package/app/extend/db.d.ts.map +0 -1
- package/app/extend/db.js +0 -8
- package/app/extend/db.js.map +0 -1
- package/app/extend/generateErrorMessage.d.ts.map +0 -1
- package/app/extend/generateErrorMessage.js.map +0 -1
- package/app/extend/logger.d.ts.map +0 -1
- package/app/extend/logger.js.map +0 -1
- package/app/extend/parsingParamsOnUrl.d.ts.map +0 -1
- package/app/extend/parsingParamsOnUrl.js.map +0 -1
- package/app/extend/render-view.d.ts.map +0 -1
- package/app/extend/render-view.js.map +0 -1
- package/app/middleware/api-params-verify.d.ts.map +0 -1
- package/app/middleware/api-params-verify.js.map +0 -1
- package/app/middleware/api-sign-verify.d.ts.map +0 -1
- package/app/middleware/api-sign-verify.js.map +0 -1
- package/app/middleware/error-handle.d.ts.map +0 -1
- package/app/middleware/error-handle.js.map +0 -1
- package/app/middleware/project-handler.d.ts.map +0 -1
- package/app/middleware/project-handler.js.map +0 -1
- package/app/middleware.d.ts.map +0 -1
- package/app/middleware.js.map +0 -1
- package/app/router/project.d.ts.map +0 -1
- package/app/router/project.js.map +0 -1
- package/app/router/view.d.ts.map +0 -1
- package/app/router/view.js.map +0 -1
- package/app/router-schema/project.d.ts.map +0 -1
- package/app/router-schema/project.js.map +0 -1
- package/app/service/bese.d.ts.map +0 -1
- package/app/service/bese.js.map +0 -1
- package/app/service/project.d.ts.map +0 -1
- package/app/service/project.js.map +0 -1
- package/app/type.d.ts.map +0 -1
- package/app/type.js.map +0 -1
- package/app/typings.d.ts.map +0 -1
- package/app/typings.js.map +0 -1
- package/index.d.ts.map +0 -1
- package/index.js.map +0 -1
- package/model/index.d.ts +0 -2
- package/model/index.d.ts.map +0 -1
- package/model/index.js +0 -7
- package/model/index.js.map +0 -1
- package/model/test.d.ts +0 -6
- package/model/test.d.ts.map +0 -1
- package/model/test.js +0 -6
- package/model/test.js.map +0 -1
- package/model/test2.d.ts +0 -6
- package/model/test2.d.ts.map +0 -1
- package/model/test2.js +0 -6
- package/model/test2.js.map +0 -1
- package/packages/core/env.d.ts.map +0 -1
- package/packages/core/env.js.map +0 -1
- package/packages/core/index.d.ts.map +0 -1
- package/packages/core/index.js.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/config.js.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/controller.js.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/extend.js.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 -16
- package/packages/core/loader/middleware.js.map +0 -1
- package/packages/core/loader/model.d.ts +0 -15
- package/packages/core/loader/model.d.ts.map +0 -1
- package/packages/core/loader/model.js.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-schema.js.map +0 -1
- package/packages/core/loader/router.d.ts.map +0 -1
- package/packages/core/loader/router.js.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/loader/service.js.map +0 -1
- package/packages/core/paths.d.ts.map +0 -1
- package/packages/core/paths.js.map +0 -1
- package/packages/core/types.d.ts.map +0 -1
- package/packages/core/types.js.map +0 -1
- package/packages/utils/getAllFilesInFolder.d.ts.map +0 -1
- package/packages/utils/getAllFilesInFolder.js.map +0 -1
- package/packages/utils/getAllFnReturnValue.d.ts.map +0 -1
- package/packages/utils/getAllFnReturnValue.js +0 -2
- package/packages/utils/getAllFnReturnValue.js.map +0 -1
- package/packages/utils/index.d.ts.map +0 -1
- package/packages/utils/index.js.map +0 -1
- package/packages/utils/loadFile.d.ts.map +0 -1
- package/packages/utils/loadFile.js.map +0 -1
- package/packages/utils/path.d.ts +0 -7
- package/packages/utils/path.d.ts.map +0 -1
- package/packages/utils/path.js.map +0 -1
- package/packages/utils/runFileFn.d.ts.map +0 -1
- package/packages/utils/runFileFn.js.map +0 -1
- package/typings/type.d.ts.map +0 -1
- package/typings/type.js.map +0 -1
- /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
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as path from "path";
|
|
2
|
+
import { sep } from "path";
|
|
3
|
+
/**
|
|
4
|
+
* splicing('path') : /path
|
|
5
|
+
*/
|
|
6
|
+
export function splicing(str, opt) {
|
|
7
|
+
const { symbol, position } = opt ?? {
|
|
8
|
+
symbol: sep,
|
|
9
|
+
position: "before",
|
|
10
|
+
};
|
|
11
|
+
// before <- symbol + str
|
|
12
|
+
// after -> str + symbol
|
|
13
|
+
return [str, symbol][position === "before" ? "reduceRight" : "reduce"]((o, c) => o + c, "");
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* @param paths
|
|
18
|
+
* @description input [a,b,c] -> out a/b/c
|
|
19
|
+
*
|
|
20
|
+
* window: input [a,b,c] -> out a\b\c
|
|
21
|
+
*
|
|
22
|
+
* 拼接路径
|
|
23
|
+
*/
|
|
24
|
+
export function resolve(...paths) {
|
|
25
|
+
const [basePath, ...otherPath] = paths;
|
|
26
|
+
return path.resolve(basePath, otherPath.length ? "." + splicing(otherPath.join(sep)) : "");
|
|
27
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const runFileFn = (fn) => typeof fn === "function" ? fn : fn.default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Button } from "../../packages/ui/react/components";
|
|
3
|
+
import TestPage from "../../packages/ui/react/components/testPage";
|
|
4
|
+
export default () => {
|
|
5
|
+
return (_jsxs("div", { children: [_jsx("h1", { children: "test page" }), _jsx(Button, { children: "click me" }), _jsx(TestPage, {})] }));
|
|
6
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="120" height="120" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round">
|
|
2
|
+
<rect x="3" y="3" width="18" height="18" rx="2" ry="2"/>
|
|
3
|
+
<line x1="3" y1="9" x2="21" y2="9"/>
|
|
4
|
+
<line x1="9" y1="21" x2="9" y2="9"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ButtonHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type ButtonVariant = 'default' | 'primary' | 'text' | 'link';
|
|
3
|
+
export type ButtonSize = 'sm' | 'md' | 'lg';
|
|
4
|
+
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
|
5
|
+
/**
|
|
6
|
+
* 按钮变体
|
|
7
|
+
* @default 'default'
|
|
8
|
+
*/
|
|
9
|
+
variant?: ButtonVariant;
|
|
10
|
+
/**
|
|
11
|
+
* 按钮尺寸
|
|
12
|
+
* @default 'md'
|
|
13
|
+
*/
|
|
14
|
+
size?: ButtonSize;
|
|
15
|
+
/**
|
|
16
|
+
* 是否显示加载状态
|
|
17
|
+
*/
|
|
18
|
+
loading?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 左侧图标
|
|
21
|
+
*/
|
|
22
|
+
leftIcon?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* 右侧图标
|
|
25
|
+
*/
|
|
26
|
+
rightIcon?: ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* 是否去除下划线(仅对 variant="link" 有效)
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
noUnderline?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* 作为子元素,用于更灵活的布局
|
|
34
|
+
*/
|
|
35
|
+
children?: ReactNode;
|
|
36
|
+
}
|
|
37
|
+
declare const Button: import("react").ForwardRefExoticComponent<ButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
38
|
+
export { Button };
|
|
39
|
+
//# sourceMappingURL=Button.d.ts.map
|
|
@@ -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 };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MOmit } from '../../types';
|
|
2
|
+
import { type ButtonProps } from './Button';
|
|
3
|
+
export type SumbitButtonProps = MOmit<ButtonProps, 'onClick'> & {
|
|
4
|
+
onClick?: (e: React.MouseEvent<HTMLButtonElement, MouseEvent>) => Promise<void | boolean> | void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* 会自动添加loading 其余同button一致
|
|
9
|
+
*/
|
|
10
|
+
declare const SumbitButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
declare const AsynchronousButton: (props: SumbitButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { AsynchronousButton, SumbitButton };
|
|
13
|
+
//# sourceMappingURL=SumbitButton.d.ts.map
|
|
@@ -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 };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
2
|
+
export type CheckboxProps = Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange' | 'value'> & {
|
|
3
|
+
checked?: boolean;
|
|
4
|
+
defaultChecked?: boolean;
|
|
5
|
+
indeterminate?: boolean;
|
|
6
|
+
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
|
7
|
+
value?: boolean;
|
|
8
|
+
};
|
|
9
|
+
declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<InputHTMLAttributes<HTMLInputElement>, "onChange" | "value"> & {
|
|
10
|
+
checked?: boolean;
|
|
11
|
+
defaultChecked?: boolean;
|
|
12
|
+
indeterminate?: boolean;
|
|
13
|
+
onChange?: (checked: boolean, e: ChangeEvent<HTMLInputElement>) => void;
|
|
14
|
+
value?: boolean;
|
|
15
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
16
|
+
export { Checkbox };
|
|
17
|
+
//# sourceMappingURL=Checkbox.d.ts.map
|
|
@@ -0,0 +1,37 @@
|
|
|
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);
|
|
6
|
+
const controlledChecked = value ?? _controlledChecked;
|
|
7
|
+
const setRefs = (element) => {
|
|
8
|
+
internalRef.current = element;
|
|
9
|
+
if (typeof ref === 'function') {
|
|
10
|
+
ref(element);
|
|
11
|
+
}
|
|
12
|
+
else if (ref) {
|
|
13
|
+
ref.current = element;
|
|
14
|
+
}
|
|
15
|
+
if (element) {
|
|
16
|
+
element.indeterminate = indeterminate ?? false;
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
useLayoutEffect(() => {
|
|
20
|
+
if (internalRef.current) {
|
|
21
|
+
internalRef.current.indeterminate = indeterminate ?? false;
|
|
22
|
+
}
|
|
23
|
+
}, [indeterminate]);
|
|
24
|
+
const isControlled = controlledChecked !== undefined;
|
|
25
|
+
const [internalChecked, setInternalChecked] = useState(defaultChecked ?? false);
|
|
26
|
+
const checked = isControlled ? controlledChecked : internalChecked;
|
|
27
|
+
const handleChange = (e) => {
|
|
28
|
+
const newChecked = e.target.checked;
|
|
29
|
+
if (!isControlled) {
|
|
30
|
+
setInternalChecked(newChecked);
|
|
31
|
+
}
|
|
32
|
+
onChange?.(newChecked, e);
|
|
33
|
+
};
|
|
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 }));
|
|
35
|
+
});
|
|
36
|
+
Checkbox.displayName = 'Checkbox';
|
|
37
|
+
export { Checkbox };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Checkbox';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ConfirmDialogProps {
|
|
2
|
+
/** 是否显示 */
|
|
3
|
+
open: boolean;
|
|
4
|
+
/** 标题 */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** 内容 */
|
|
7
|
+
content: string;
|
|
8
|
+
/** 确认按钮文本 */
|
|
9
|
+
okText?: string;
|
|
10
|
+
/** 取消按钮文本 */
|
|
11
|
+
cancelText?: string;
|
|
12
|
+
/** 确认按钮加载状态 */
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
/** 确认回调 */
|
|
15
|
+
onOk: () => void | Promise<void>;
|
|
16
|
+
/** 取消回调 */
|
|
17
|
+
onCancel: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function ConfirmDialog({ open, title, content, okText, cancelText, loading, onOk, onCancel, }: ConfirmDialogProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=ConfirmDialog.d.ts.map
|
|
@@ -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,6 @@
|
|
|
1
|
+
import { type DropdownItem } from '../Dropdown';
|
|
2
|
+
export interface ActionBtnProps {
|
|
3
|
+
actions: DropdownItem[];
|
|
4
|
+
}
|
|
5
|
+
export declare const ActionBtn: ({ actions }: ActionBtnProps) => "-" | import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=ActionBtn.d.ts.map
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type PaginationProps } from '../Pagination';
|
|
3
|
+
import type { ColumnDef } from '../types/baseType';
|
|
4
|
+
export type { ColumnDef } from '../types/baseType';
|
|
5
|
+
type RowSelection<T> = {
|
|
6
|
+
/**
|
|
7
|
+
* 受控用法:完全由外部维护选中 keys
|
|
8
|
+
*/
|
|
9
|
+
selectedRowKeys?: Array<string | number>;
|
|
10
|
+
/**
|
|
11
|
+
* 非受控用法:仅作为初始值,后续由内部维护
|
|
12
|
+
*/
|
|
13
|
+
defaultSelectedRowKeys?: Array<string | number>;
|
|
14
|
+
/**
|
|
15
|
+
* 选中项变化回调(受控/非受控都会触发)
|
|
16
|
+
*/
|
|
17
|
+
onChange?: (selectedRowKeys: Array<string | number>, selectedRows: T[], isAll: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* 全选 受控
|
|
20
|
+
*/
|
|
21
|
+
isAll?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* theader checkbox
|
|
24
|
+
*/
|
|
25
|
+
beforeCheckboxNode?: ReactNode;
|
|
26
|
+
};
|
|
27
|
+
interface DataTableProps<T = Record<string, unknown>> {
|
|
28
|
+
columns: ColumnDef<T>[];
|
|
29
|
+
data: T[];
|
|
30
|
+
rowKey?: keyof T | ((record: T, index: number) => string | number);
|
|
31
|
+
rowSelection?: RowSelection<T>;
|
|
32
|
+
pagination?: PaginationProps;
|
|
33
|
+
loading?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* 统一配置 column width 默认100px
|
|
36
|
+
* 会被columns[number].width覆盖
|
|
37
|
+
*/
|
|
38
|
+
defaultColumnWidth?: number;
|
|
39
|
+
}
|
|
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;
|
|
41
|
+
export { ActionBtn } from './ActionBtn';
|
|
42
|
+
export type { ActionBtnProps } from './ActionBtn';
|
|
43
|
+
export type { DataTableProps, RowSelection };
|
|
44
|
+
//# sourceMappingURL=data-table.d.ts.map
|
|
@@ -0,0 +1,141 @@
|
|
|
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, }) {
|
|
8
|
+
const getRowKey = (record, index) => {
|
|
9
|
+
if (typeof rowKey === 'function') {
|
|
10
|
+
return rowKey(record, index);
|
|
11
|
+
}
|
|
12
|
+
const key = record[rowKey];
|
|
13
|
+
return typeof key === 'string' || typeof key === 'number' ? key : index;
|
|
14
|
+
};
|
|
15
|
+
const getCellValue = (record, column) => record[(column.dataIndex || column.key)];
|
|
16
|
+
const isControlled = rowSelection && Array.isArray(rowSelection.selectedRowKeys);
|
|
17
|
+
const [innerSelectedRowKeys, setInnerSelectedRowKeys] = useState(rowSelection?.defaultSelectedRowKeys ?? []);
|
|
18
|
+
const selectedRowKeys = (isControlled ? rowSelection?.selectedRowKeys : innerSelectedRowKeys) ?? [];
|
|
19
|
+
const selectedKeySet = new Set(selectedRowKeys);
|
|
20
|
+
const [currentPage, setCurrentPage] = useState(1);
|
|
21
|
+
const { showPagination, pagination, data } = useMemo(() => {
|
|
22
|
+
let pagination;
|
|
23
|
+
let data = pData;
|
|
24
|
+
let showPagination;
|
|
25
|
+
// 使用外部
|
|
26
|
+
if (pPagination) {
|
|
27
|
+
pagination = pPagination;
|
|
28
|
+
showPagination = pagination.total > 0;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
// 使用内部
|
|
32
|
+
pagination = {
|
|
33
|
+
onChange(v) {
|
|
34
|
+
setCurrentPage(v);
|
|
35
|
+
},
|
|
36
|
+
current: currentPage,
|
|
37
|
+
pageSize: 10,
|
|
38
|
+
total: pData.length,
|
|
39
|
+
};
|
|
40
|
+
showPagination = pData.length > pagination.pageSize;
|
|
41
|
+
data = pData.slice((pagination.current - 1) * pagination.pageSize, pagination.current * pagination.pageSize);
|
|
42
|
+
}
|
|
43
|
+
return {
|
|
44
|
+
showPagination,
|
|
45
|
+
pagination,
|
|
46
|
+
data,
|
|
47
|
+
};
|
|
48
|
+
}, [currentPage, pData, pPagination]);
|
|
49
|
+
// TODO getRowKey 依赖剥离
|
|
50
|
+
const pageRowKeys = pData.map((record, index) => getRowKey(record, index));
|
|
51
|
+
const handleRowSelectChange = (key) => {
|
|
52
|
+
if (!rowSelection)
|
|
53
|
+
return;
|
|
54
|
+
const nextSelectedKeys = selectedKeySet.has(key)
|
|
55
|
+
? selectedRowKeys.filter((k) => k !== key)
|
|
56
|
+
: [...selectedRowKeys, key];
|
|
57
|
+
const nextSelectedKeySet = new Set(nextSelectedKeys);
|
|
58
|
+
const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index)));
|
|
59
|
+
if (!isControlled) {
|
|
60
|
+
setInnerSelectedRowKeys(nextSelectedKeys);
|
|
61
|
+
}
|
|
62
|
+
rowSelection.onChange?.(nextSelectedKeys, selectedRows, false);
|
|
63
|
+
};
|
|
64
|
+
const handleSelectAllChange = (event) => {
|
|
65
|
+
if (!rowSelection)
|
|
66
|
+
return;
|
|
67
|
+
const checked = event.target.checked;
|
|
68
|
+
let nextSelectedKeys;
|
|
69
|
+
if (checked) {
|
|
70
|
+
const pageKeySet = new Set(pageRowKeys);
|
|
71
|
+
nextSelectedKeys = Array.from(new Set([
|
|
72
|
+
...selectedRowKeys,
|
|
73
|
+
//
|
|
74
|
+
...pageRowKeys.filter((key) => !selectedKeySet.has(key)),
|
|
75
|
+
]))
|
|
76
|
+
//
|
|
77
|
+
.filter((key) => pageKeySet.has(key) || selectedKeySet.has(key));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const pageKeySet = new Set(pageRowKeys);
|
|
81
|
+
nextSelectedKeys = selectedRowKeys.filter((key) => !pageKeySet.has(key));
|
|
82
|
+
}
|
|
83
|
+
const nextSelectedKeySet = new Set(nextSelectedKeys);
|
|
84
|
+
const selectedRows = pData.filter((record, index) => nextSelectedKeySet.has(getRowKey(record, index)));
|
|
85
|
+
if (!isControlled) {
|
|
86
|
+
setInnerSelectedRowKeys(nextSelectedKeys);
|
|
87
|
+
}
|
|
88
|
+
rowSelection.onChange?.(nextSelectedKeys, selectedRows, checked);
|
|
89
|
+
};
|
|
90
|
+
const allChecked = rowSelection
|
|
91
|
+
? rowSelection.isAll ?? (pageRowKeys.length > 0 && pageRowKeys.every((key) => selectedKeySet.has(key)))
|
|
92
|
+
: false;
|
|
93
|
+
const partiallyChecked = rowSelection ? pageRowKeys.some((key) => selectedKeySet.has(key)) && !allChecked : false;
|
|
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: {
|
|
95
|
+
width: '48px',
|
|
96
|
+
minWidth: '48px',
|
|
97
|
+
position: 'sticky',
|
|
98
|
+
left: 0,
|
|
99
|
+
zIndex: 10,
|
|
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) => {
|
|
101
|
+
if (el) {
|
|
102
|
+
el.indeterminate = partiallyChecked;
|
|
103
|
+
}
|
|
104
|
+
}, onChange: handleSelectAllChange })] })), columns.map((column) => {
|
|
105
|
+
const hasAction = column.isAction ?? column.key === 'action';
|
|
106
|
+
return (_jsx(TableHead, { isAction: hasAction, style: {
|
|
107
|
+
...(hasAction
|
|
108
|
+
? {
|
|
109
|
+
position: 'sticky',
|
|
110
|
+
right: 0,
|
|
111
|
+
zIndex: 10,
|
|
112
|
+
}
|
|
113
|
+
: undefined),
|
|
114
|
+
...(column.width
|
|
115
|
+
? { width: column.width, minWidth: column.width }
|
|
116
|
+
: { minWidth: defaultColumnWidth }),
|
|
117
|
+
}, 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: "\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: {
|
|
119
|
+
width: '48px',
|
|
120
|
+
minWidth: '48px',
|
|
121
|
+
position: 'sticky',
|
|
122
|
+
left: 0,
|
|
123
|
+
zIndex: 1,
|
|
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) => {
|
|
125
|
+
const value = getCellValue(record, column);
|
|
126
|
+
const hasAction = column.isAction ?? column.key === 'action';
|
|
127
|
+
return (_jsx(TableCell, { isAction: hasAction, style: {
|
|
128
|
+
...(hasAction
|
|
129
|
+
? {
|
|
130
|
+
position: 'sticky',
|
|
131
|
+
right: 0,
|
|
132
|
+
zIndex: 1,
|
|
133
|
+
}
|
|
134
|
+
: undefined),
|
|
135
|
+
...(column.width
|
|
136
|
+
? { width: column.width, minWidth: column.width }
|
|
137
|
+
: { minWidth: defaultColumnWidth }),
|
|
138
|
+
}, children: column.render ? column.render(value, record, rowIndex) : value }, column.key));
|
|
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 }) }))] }));
|
|
140
|
+
}
|
|
141
|
+
export { ActionBtn } from './ActionBtn';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ModeType } from './data';
|
|
2
|
+
import { type DateLocaleConfig } from './locales';
|
|
3
|
+
export type DateRange = {
|
|
4
|
+
from: Date | undefined;
|
|
5
|
+
to?: Date | undefined;
|
|
6
|
+
};
|
|
7
|
+
export type QuickRangePreset = {
|
|
8
|
+
/**
|
|
9
|
+
* 展示文案
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* 返回一个范围对象
|
|
14
|
+
*/
|
|
15
|
+
getRange: () => DateRange;
|
|
16
|
+
};
|
|
17
|
+
export interface CalendarProps {
|
|
18
|
+
mode?: ModeType;
|
|
19
|
+
value?: Date | DateRange | null;
|
|
20
|
+
onChange?: (date: Date | DateRange) => void;
|
|
21
|
+
disabledDate?: (date: Date) => boolean;
|
|
22
|
+
showTime?: boolean;
|
|
23
|
+
className?: string;
|
|
24
|
+
/**
|
|
25
|
+
* 自定义文案配置,会覆盖默认文案
|
|
26
|
+
*/
|
|
27
|
+
locale?: Partial<DateLocaleConfig>;
|
|
28
|
+
/**
|
|
29
|
+
* 范围模式下的快捷选择配置
|
|
30
|
+
* 不传则使用默认预设
|
|
31
|
+
*/
|
|
32
|
+
quickRanges?: QuickRangePreset[];
|
|
33
|
+
}
|
|
34
|
+
export declare function Calendar({ mode, value, onChange, disabledDate, showTime, className, locale: customLocale, quickRanges, }: CalendarProps): import("react/jsx-runtime").JSX.Element;
|
|
35
|
+
//# sourceMappingURL=Calendar.d.ts.map
|