@_tc/template-core 0.0.1-bate.46 → 0.0.1-bate.48
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/.skills/tc-component-usage-skills/SKILL.md +132 -0
- package/.skills/tc-component-usage-skills/reference/component-api.md +801 -0
- package/.skills/tc-component-usage-skills/reference/examples.md +435 -0
- package/.skills/tc-component-usage-skills/reference/patterns.md +392 -0
- package/.skills/tc-component-usage-skills/reference/template-core-frontend.md +104 -0
- package/.skills/tc-generator/SKILL.md +70 -0
- package/.skills/tc-generator/reference/example.md +357 -0
- package/.skills/tc-generator/reference/model-schema.md +328 -0
- package/.skills/tc-generator/reference/project-template/app/controller/product.js +73 -0
- package/.skills/tc-generator/reference/project-template/app/router/product.js +9 -0
- package/.skills/tc-generator/reference/project-template/config/config.default.js +7 -0
- package/.skills/tc-generator/reference/project-template/index.js +17 -0
- package/.skills/tc-generator/reference/project-template/model/product/mode.js +179 -0
- package/.skills/tc-generator/reference/project-template/model/product/project/default.js +5 -0
- package/.skills/tc-generator/reference/project-template/package.json +25 -0
- package/.skills/tc-generator/reference/runtime-extensions.md +190 -0
- package/README.md +1723 -0
- package/cjs/_virtual/_rolldown/runtime.js +1 -37
- package/cjs/app/controller/base.js +1 -29
- package/cjs/app/controller/project.js +1 -60
- package/cjs/app/controller/view.js +1 -24
- package/cjs/app/extend/$fetch.js +1 -0
- package/cjs/app/extend/db.js +20 -8
- package/cjs/app/extend/generateErrorMessage.js +1 -16
- package/cjs/app/extend/logger.js +1 -35
- package/cjs/app/extend/parsingParamsOnUrl.js +1 -22
- package/cjs/app/extend/render-view.js +1 -24
- package/cjs/app/middleware/api-params-verify.js +1 -72
- package/cjs/app/middleware/api-sign-verify.js +1 -23
- package/cjs/app/middleware/error-handle.js +1 -38
- package/cjs/app/middleware/project-handler.js +1 -21
- package/cjs/app/middleware.js +1 -32
- package/cjs/app/router/project.js +1 -10
- package/cjs/app/router/view.js +1 -9
- package/cjs/app/router-schema/project.js +1 -16
- package/cjs/app/service/base.js +1 -17
- package/cjs/app/service/project.js +1 -38
- package/cjs/app/type.js +0 -1
- package/cjs/app/typings.js +0 -1
- package/cjs/app/view/entry.tpl +27 -28
- package/cjs/bundler/buildBE.js +1 -0
- package/cjs/bundler/defaultAlias.js +1 -5
- package/cjs/bundler/dev.js +1 -20
- package/cjs/bundler/index.js +1 -19
- package/cjs/bundler/prod.js +1 -21
- package/cjs/bundler/state.js +1 -0
- package/cjs/bundler/utils.js +1 -262
- package/cjs/config/config.default.js +1 -0
- package/cjs/index.js +1 -23
- package/cjs/packages/common/LRUCache.js +1 -4
- package/cjs/packages/common/array/index.js +1 -43
- package/cjs/packages/common/cache/LRUCache.js +1 -45
- package/cjs/packages/common/cache/index.js +1 -4
- package/cjs/packages/common/guards/index.js +1 -34
- package/cjs/packages/common/http/index.js +1 -0
- package/cjs/packages/common/i18n/default.js +1 -95
- package/cjs/packages/common/i18n/en-US.js +1 -95
- package/cjs/packages/common/i18n/index.js +1 -178
- package/cjs/packages/common/i18n/locales.js +1 -17
- package/cjs/packages/common/i18n/types.js +0 -1
- package/cjs/packages/common/index.js +1 -65
- package/cjs/packages/common/log/index.js +2 -160
- package/cjs/packages/common/number/index.js +1 -14
- package/cjs/packages/common/object/filterEmpty.js +1 -32
- package/cjs/packages/common/object/filtereEmpty.js +1 -5
- package/cjs/packages/common/object/index.js +1 -26
- package/cjs/packages/common/string/index.js +1 -17
- package/cjs/packages/common/types/index.js +0 -1
- package/cjs/packages/core/env.js +1 -27
- package/cjs/packages/core/index.js +1 -110
- package/cjs/packages/core/loader/config.js +1 -43
- package/cjs/packages/core/loader/controller.js +1 -33
- package/cjs/packages/core/loader/extend.js +1 -31
- package/cjs/packages/core/loader/middleware.js +1 -30
- package/cjs/packages/core/loader/model.js +1 -111
- package/cjs/packages/core/loader/router-schema.js +1 -36
- package/cjs/packages/core/loader/router.js +1 -62
- package/cjs/packages/core/loader/service.js +1 -30
- package/cjs/packages/core/paths.js +1 -12
- package/cjs/packages/core/types.js +0 -1
- package/cjs/packages/utils/getAllFilesInFolder.js +1 -14
- package/cjs/packages/utils/getAllFnReturnValue.js +0 -1
- package/cjs/packages/utils/index.js +1 -11
- package/cjs/packages/utils/loadFile.js +1 -55
- package/cjs/packages/utils/path.js +1 -31
- package/cjs/packages/utils/runFileFn.js +1 -51
- package/cjs/scripts/vite-build/build.js +3 -0
- package/cjs/scripts/vite-build/collect.js +1 -0
- package/cjs/scripts/vite-build/constants.js +1 -0
- package/cjs/scripts/vite-build/dts.js +1 -0
- package/cjs/scripts/vite-build/index.js +1 -0
- package/cjs/scripts/vite-build/normalize.js +1 -0
- package/cjs/scripts/vite-build/plugins.js +1 -0
- package/cjs/scripts/vite-build/resolve.js +1 -0
- package/cjs/scripts/vite-build/types.js +0 -0
- package/cjs/scripts/vite-build/utils.js +1 -0
- package/esm/_virtual/_rolldown/runtime.js +4 -29
- package/esm/app/controller/base.js +14 -16
- package/esm/app/controller/project.js +39 -46
- package/esm/app/controller/view.js +23 -19
- package/esm/app/extend/$fetch.js +15 -0
- package/esm/app/extend/db.js +138 -4
- package/esm/app/extend/generateErrorMessage.js +4 -12
- package/esm/app/extend/logger.js +9 -17
- package/esm/app/extend/parsingParamsOnUrl.js +11 -18
- package/esm/app/extend/render-view.js +18 -16
- package/esm/app/middleware/api-params-verify.js +36 -50
- package/esm/app/middleware/api-sign-verify.js +10 -16
- package/esm/app/middleware/error-handle.js +17 -30
- package/esm/app/middleware/project-handler.js +11 -16
- package/esm/app/middleware.js +12 -19
- package/esm/app/router/project.js +4 -6
- package/esm/app/router/view.js +4 -5
- package/esm/app/router-schema/project.js +2 -2
- package/esm/app/service/base.js +6 -7
- package/esm/app/service/project.js +18 -32
- package/esm/app/view/entry.tpl +27 -28
- package/esm/bundler/buildBE.js +54 -0
- package/esm/bundler/defaultAlias.js +2 -2
- package/esm/bundler/dev.js +8 -14
- package/esm/bundler/index.js +11 -9
- package/esm/bundler/prod.js +9 -14
- package/esm/bundler/state.js +10 -0
- package/esm/bundler/utils.js +115 -164
- package/esm/config/config.default.js +9 -0
- package/esm/index.js +12 -15
- package/esm/packages/common/LRUCache.js +2 -2
- package/esm/packages/common/array/index.js +21 -31
- package/esm/packages/common/cache/LRUCache.js +21 -25
- package/esm/packages/common/cache/index.js +2 -2
- package/esm/packages/common/guards/index.js +5 -23
- package/esm/packages/common/http/index.js +256 -0
- package/esm/packages/common/i18n/default.js +2 -7
- package/esm/packages/common/i18n/en-US.js +2 -7
- package/esm/packages/common/i18n/index.js +73 -144
- package/esm/packages/common/i18n/locales.js +6 -8
- package/esm/packages/common/index.js +14 -13
- package/esm/packages/common/log/index.js +69 -122
- package/esm/packages/common/number/index.js +7 -8
- package/esm/packages/common/object/filterEmpty.js +16 -22
- package/esm/packages/common/object/filtereEmpty.js +2 -2
- package/esm/packages/common/object/index.js +14 -17
- package/esm/packages/common/string/index.js +2 -11
- package/esm/packages/core/env.js +22 -24
- package/esm/packages/core/index.js +36 -92
- package/esm/packages/core/loader/config.js +21 -35
- package/esm/packages/core/loader/controller.js +8 -27
- package/esm/packages/core/loader/extend.js +19 -21
- package/esm/packages/core/loader/middleware.js +9 -22
- package/esm/packages/core/loader/model.js +50 -91
- package/esm/packages/core/loader/router-schema.js +13 -29
- package/esm/packages/core/loader/router.js +27 -51
- package/esm/packages/core/loader/service.js +8 -24
- package/esm/packages/core/paths.js +5 -5
- package/esm/packages/utils/getAllFilesInFolder.js +6 -8
- package/esm/packages/utils/index.js +5 -5
- package/esm/packages/utils/loadFile.js +28 -43
- package/esm/packages/utils/path.js +10 -22
- package/esm/packages/utils/runFileFn.js +32 -37
- package/esm/scripts/vite-build/build.js +141 -0
- package/esm/scripts/vite-build/collect.js +79 -0
- package/esm/scripts/vite-build/constants.js +34 -0
- package/esm/scripts/vite-build/dts.js +132 -0
- package/esm/scripts/vite-build/index.js +3 -0
- package/esm/scripts/vite-build/normalize.js +78 -0
- package/esm/scripts/vite-build/plugins.js +106 -0
- package/esm/scripts/vite-build/resolve.js +46 -0
- package/esm/scripts/vite-build/types.js +0 -0
- package/esm/scripts/vite-build/utils.js +24 -0
- package/fe/bundler/defaultAlias.js +4 -0
- package/fe/frontend/apps/dash/Dashboard.d.ts +6 -0
- package/fe/frontend/apps/dash/Dashboard.js +164 -0
- package/fe/frontend/apps/dash/dash.entry.js +54 -0
- package/fe/frontend/apps/dash/types.d.ts +25 -0
- package/fe/frontend/apps/dash/types.js +0 -0
- package/fe/frontend/apps/ui-components/index.js +16 -0
- package/fe/frontend/apps/ui-components/ui-components.entry.d.ts +2 -0
- package/fe/frontend/apps/ui-components/ui-components.entry.js +8 -0
- package/fe/frontend/extended/SchemaForm/data.d.ts +1 -1
- package/fe/frontend/extended/SchemaForm/data.js +7 -7
- package/fe/frontend/{widgets → src}/api/baseInfo.d.ts +2 -2
- package/fe/frontend/src/api/baseInfo.js +14 -0
- package/fe/frontend/src/common/CRUD/CRUD.d.ts +3 -0
- package/fe/frontend/src/common/CRUD/CRUD.js +2 -0
- package/fe/frontend/src/common/CRUD/index.d.ts +2 -0
- package/fe/frontend/src/common/CRUD/index.js +2 -0
- package/fe/frontend/src/common/auth/index.js +21 -0
- package/fe/frontend/{widgets/defaultPages/Schema/utils → src/common}/fetchErrorShow.d.ts +1 -1
- package/fe/frontend/src/common/fetchErrorShow.js +11 -0
- package/fe/frontend/src/common/generateMenuData.d.ts +4 -0
- package/fe/frontend/src/common/generateMenuData.js +16 -0
- package/fe/frontend/{widgets → src}/common/importComponent.d.ts +1 -1
- package/fe/frontend/src/common/importComponent.js +23 -0
- package/fe/frontend/src/common/language.d.ts +3 -0
- package/fe/frontend/src/common/language.js +12 -0
- package/fe/frontend/{widgets → src}/common/logFn/index.d.ts +1 -0
- package/fe/frontend/src/common/logFn/index.js +14 -0
- package/fe/frontend/{widgets → src}/common/menu.d.ts +1 -1
- package/fe/frontend/src/common/menu.js +97 -0
- package/fe/frontend/src/common/request.d.ts +37 -0
- package/fe/frontend/src/common/request.js +183 -0
- package/fe/frontend/{components → src/components}/AsyncSelect/AsyncSelect.d.ts +3 -3
- package/fe/frontend/src/components/AsyncSelect/AsyncSelect.js +35 -0
- package/fe/frontend/src/components/AsyncSelect/index.d.ts +4 -0
- package/fe/frontend/src/components/AsyncSelect/index.js +5 -0
- package/fe/frontend/{widgets → src}/components/BasePage/HeaderView.d.ts +1 -0
- package/fe/frontend/src/components/BasePage/HeaderView.js +55 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.d.ts +14 -0
- package/fe/frontend/src/components/LanguageSwitch/LanguageSwitch.js +44 -0
- package/fe/frontend/src/components/LanguageSwitch/index.d.ts +4 -0
- package/fe/frontend/src/components/LanguageSwitch/index.js +5 -0
- package/fe/frontend/{widgets → src}/components/Router/index.d.ts +2 -2
- package/fe/frontend/src/components/Router/index.js +21 -0
- package/fe/frontend/src/components/Router/type.js +0 -0
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.d.ts +15 -0
- package/fe/frontend/src/components/ThemeSwitch/ThemeSwitch.js +83 -0
- package/fe/frontend/src/components/ThemeSwitch/index.d.ts +4 -0
- package/fe/frontend/src/components/ThemeSwitch/index.js +5 -0
- package/fe/frontend/src/components/index.d.ts +11 -0
- package/fe/frontend/src/components/index.js +7 -0
- package/fe/frontend/src/defaultPages/Iframe/index.js +15 -0
- package/fe/frontend/src/defaultPages/NotFoundPage/index.d.ts +3 -0
- package/fe/frontend/src/defaultPages/NotFoundPage/index.js +28 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/components/CallCom/DetailPanel.d.ts +1 -1
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/DetailPanel.js +102 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/components/CallCom/PopFrom.d.ts +1 -1
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/PopFrom.js +119 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.d.ts +44 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/builtIn.js +10 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.d.ts +4 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/CallCom/data.js +9 -0
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaSearch/index.js +62 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/components/SchemaTable/index.d.ts +2 -2
- package/fe/frontend/src/defaultPages/SchemaPage/components/SchemaTable/index.js +200 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/eventInfo.js +9 -0
- package/fe/frontend/src/defaultPages/SchemaPage/data/index.js +4 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/hooks/useComConfig.d.ts +1 -1
- package/fe/frontend/src/defaultPages/SchemaPage/hooks/useComConfig.js +17 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.css +112 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/index.d.ts +1 -0
- package/fe/frontend/src/defaultPages/SchemaPage/index.js +90 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/schemaType.d.ts +7 -6
- package/fe/frontend/src/defaultPages/SchemaPage/schemaType.js +7 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/permissions.js +6 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.d.ts +3 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/schemaConversion.js +66 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.d.ts +11 -0
- package/fe/frontend/src/defaultPages/SchemaPage/utils/validator.js +122 -0
- package/fe/frontend/{widgets → src}/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +2 -2
- package/fe/frontend/src/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +55 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPage/index.js +21 -0
- package/fe/frontend/src/defaultPages/SidebarSlotPageTmp.js +21 -0
- package/fe/frontend/src/defaultPages/SlotPage/index.js +22 -0
- package/fe/frontend/src/exportStore.d.ts +17 -0
- package/fe/frontend/src/exportStore.js +5 -0
- package/fe/frontend/src/hooks/useCurrentMenuData.js +30 -0
- package/fe/frontend/src/hooks/useRouterParams.js +16 -0
- package/fe/frontend/src/index.d.ts +21 -0
- package/fe/frontend/src/index.js +19 -0
- package/fe/frontend/src/language/en-US.d.ts +89 -0
- package/fe/frontend/src/language/en-US.js +89 -0
- package/fe/frontend/src/language/index.d.ts +73 -0
- package/fe/frontend/src/language/index.js +79 -0
- package/fe/frontend/src/language/zh-CN.d.ts +89 -0
- package/fe/frontend/src/language/zh-CN.js +89 -0
- package/fe/frontend/src/main.css +96 -0
- package/fe/frontend/src/main.d.ts +27 -0
- package/fe/frontend/src/main.js +60 -0
- package/fe/frontend/src/stores/apiFreezer.d.ts +93 -0
- package/fe/frontend/src/stores/apiFreezer.js +53 -0
- package/fe/frontend/{widgets/store → src/stores}/mode.d.ts +3 -3
- package/fe/frontend/src/stores/mode.js +36 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src}/stores/schemaEventBus.d.ts +1 -1
- package/fe/frontend/src/stores/schemaEventBus.js +53 -0
- package/fe/frontend/{widgets/defaultPages/Schema → src}/stores/schemaStore.d.ts +5 -5
- package/fe/frontend/src/stores/schemaStore.js +28 -0
- package/fe/frontend/{typing → src/typing}/scalability.d.ts +3 -3
- package/fe/frontend/src/typing/scalability.js +0 -0
- package/fe/frontend/src/typing/window.d.ts +9 -0
- package/fe/frontend/src/typing/window.js +0 -0
- package/fe/model/types/data/button.d.ts +4 -4
- package/fe/model/types/data/component.d.ts +32 -47
- package/fe/model/types/data/schema.d.ts +6 -6
- package/fe/model/types/data/search.d.ts +1 -1
- package/fe/model/types/model.d.ts +19 -12
- package/fe/packages/common/cache/LRUCache.js +43 -47
- package/fe/packages/common/guards/index.js +8 -24
- package/fe/packages/common/http/index.d.ts +90 -0
- package/fe/packages/common/http/index.js +300 -0
- package/fe/packages/common/i18n/default.js +91 -88
- package/fe/packages/common/i18n/en-US.js +91 -88
- package/fe/packages/common/i18n/index.d.ts +3 -3
- package/fe/packages/common/i18n/index.js +142 -153
- package/fe/packages/common/i18n/locales.d.ts +3 -3
- package/fe/packages/common/i18n/locales.js +10 -9
- package/fe/packages/common/index.d.ts +1 -0
- package/fe/packages/common/object/filterEmpty.js +25 -30
- package/fe/packages/react/hooks/useBreadcrumb.d.ts +10 -0
- package/fe/packages/react/hooks/useBreadcrumb.js +5 -0
- package/fe/packages/react/hooks/useExecuteOnce.js +47 -0
- package/fe/packages/react/hooks/useInit.js +11 -0
- package/fe/packages/react/hooks/useLanguage.d.ts +2 -0
- package/fe/packages/react/hooks/useLanguage.js +8 -0
- package/fe/packages/react/hooks/usePagination.js +30 -0
- package/fe/packages/{ui/react → react}/hooks/useRefState.d.ts +1 -1
- package/fe/packages/react/hooks/useRefState.js +35 -0
- package/fe/packages/react/hooks/useWatch.js +60 -0
- package/fe/packages/react/hooks/useWatch.test.js +24 -0
- package/fe/packages/react/ui/assets/table/no-result.js +4 -0
- package/fe/packages/{ui/react → react/ui}/components/Button/Button.d.ts +1 -1
- package/fe/packages/react/ui/components/Button/Button.js +88 -0
- package/fe/packages/react/ui/components/Button/SubmitButton.d.ts +13 -0
- package/fe/packages/react/ui/components/Button/SubmitButton.js +30 -0
- package/fe/packages/react/ui/components/Button/index.d.ts +4 -0
- package/fe/packages/react/ui/components/Button/index.js +3 -0
- package/fe/packages/react/ui/components/Card/Card.d.ts +15 -0
- package/fe/packages/react/ui/components/Card/Card.js +31 -0
- package/fe/packages/react/ui/components/Card/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Card/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Checkbox/Checkbox.d.ts +1 -1
- package/fe/packages/react/ui/components/Checkbox/Checkbox.js +52 -0
- package/fe/packages/react/ui/components/Checkbox/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Checkbox/index.js +2 -0
- package/fe/packages/react/ui/components/ConfirmDialog/ConfirmDialog.js +41 -0
- package/fe/packages/react/ui/components/ConfirmDialog/index.d.ts +2 -0
- package/fe/packages/react/ui/components/ConfirmDialog/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/DataTable/ActionBtn.d.ts +1 -1
- package/fe/packages/react/ui/components/DataTable/ActionBtn.js +116 -0
- package/fe/packages/{ui/react → react/ui}/components/DataTable/index.d.ts +9 -7
- package/fe/packages/react/ui/components/DataTable/index.js +235 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/Calendar.d.ts +2 -2
- package/fe/packages/react/ui/components/Date/Calendar.js +351 -0
- package/fe/packages/react/ui/components/Date/Date.js +210 -0
- package/fe/packages/react/ui/components/Date/DateTestPage.js +340 -0
- package/fe/packages/react/ui/components/Date/LocaleContext.js +11 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/LocaleProvider.d.ts +2 -2
- package/fe/packages/react/ui/components/Date/LocaleProvider.js +31 -0
- package/fe/packages/react/ui/components/Date/TimePicker.js +136 -0
- package/fe/packages/react/ui/components/Date/data.js +7 -0
- package/fe/packages/{ui/react → react/ui}/components/Date/dateLocaleStore.d.ts +1 -1
- package/fe/packages/react/ui/components/Date/dateLocaleStore.js +14 -0
- package/fe/packages/react/ui/components/Date/dropdownPositioning.d.ts +3 -0
- package/fe/packages/react/ui/components/Date/dropdownPositioning.js +12 -0
- package/fe/packages/react/ui/components/Date/index.d.ts +6 -0
- package/fe/packages/react/ui/components/Date/index.js +6 -0
- package/fe/packages/react/ui/components/Date/locales.js +25 -0
- package/fe/packages/{ui/react → react/ui}/components/Drawer/Drawer.d.ts +1 -1
- package/fe/packages/react/ui/components/Drawer/Drawer.js +151 -0
- package/fe/packages/react/ui/components/Drawer/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Drawer/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Dropdown/Dropdown.d.ts +3 -2
- package/fe/packages/react/ui/components/Dropdown/Dropdown.js +105 -0
- package/fe/packages/react/ui/components/Dropdown/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Dropdown/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/Form.d.ts +2 -2
- package/fe/packages/react/ui/components/Form/Form.js +15 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/FormItem.d.ts +3 -3
- package/fe/packages/react/ui/components/Form/FormItem.js +60 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/SchemaForm/data.d.ts +8 -8
- package/fe/packages/react/ui/components/Form/SchemaForm/data.js +16 -0
- package/fe/packages/react/ui/components/Form/SchemaForm/defaultComponentsMap.d.ts +4 -0
- package/fe/packages/react/ui/components/Form/SchemaForm/defaultComponentsMap.js +4 -0
- package/fe/packages/{ui/react → react/ui}/components/Form/SchemaForm/index.d.ts +9 -9
- package/fe/packages/react/ui/components/Form/SchemaForm/index.js +119 -0
- package/fe/packages/react/ui/components/Form/index.d.ts +5 -0
- package/fe/packages/react/ui/components/Form/index.js +5 -0
- package/fe/packages/react/ui/components/Form/useForm.d.ts +3 -0
- package/fe/packages/react/ui/components/Form/useForm.js +2 -0
- package/fe/packages/react/ui/components/ImagePreview/ImagePreview.js +307 -0
- package/fe/packages/{ui/react → react/ui}/components/ImagePreview/PreviewImage.d.ts +2 -2
- package/fe/packages/react/ui/components/ImagePreview/PreviewImage.js +56 -0
- package/fe/packages/react/ui/components/ImagePreview/index.d.ts +3 -0
- package/fe/packages/react/ui/components/ImagePreview/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/Input/Input.d.ts +1 -1
- package/fe/packages/react/ui/components/Input/Input.js +88 -0
- package/fe/packages/react/ui/components/Input/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Input/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/InputNumber/InputNumber.d.ts +2 -2
- package/fe/packages/react/ui/components/InputNumber/InputNumber.js +207 -0
- package/fe/packages/react/ui/components/InputNumber/index.d.ts +2 -0
- package/fe/packages/react/ui/components/InputNumber/index.js +2 -0
- package/fe/packages/react/ui/components/InputNumber/inputNumberUtils.js +45 -0
- package/fe/packages/react/ui/components/InputNumber/inputNumberUtils.test.js +59 -0
- package/fe/packages/{ui/react → react/ui}/components/Label/Label.d.ts +1 -1
- package/fe/packages/react/ui/components/Label/Label.js +58 -0
- package/fe/packages/react/ui/components/Label/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Label/index.js +2 -0
- package/fe/packages/react/ui/components/Layout/Layout.d.ts +11 -0
- package/fe/packages/react/ui/components/Layout/Layout.js +33 -0
- package/fe/packages/react/ui/components/Layout/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Layout/index.js +2 -0
- package/fe/packages/react/ui/components/Loading/Loading.d.ts +25 -0
- package/fe/packages/react/ui/components/Loading/Loading.js +48 -0
- package/fe/packages/react/ui/components/Loading/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Loading/index.js +2 -0
- package/fe/packages/react/ui/components/Menu/Menu.js +147 -0
- package/fe/packages/react/ui/components/Menu/MenuContext.js +88 -0
- package/fe/packages/react/ui/components/Menu/MenuItem.js +78 -0
- package/fe/packages/react/ui/components/Menu/SubMenu.js +207 -0
- package/fe/packages/react/ui/components/Menu/index.d.ts +9 -0
- package/fe/packages/react/ui/components/Menu/index.js +5 -0
- package/fe/packages/{ui/react → react/ui}/components/Menu/menuTypes.d.ts +1 -1
- package/fe/packages/react/ui/components/Menu/menuTypes.js +0 -0
- package/fe/packages/react/ui/components/Menu/utils.js +8 -0
- package/fe/packages/{ui/react → react/ui}/components/Message/Message.d.ts +1 -1
- package/fe/packages/react/ui/components/Message/Message.js +76 -0
- package/fe/packages/{ui/react → react/ui}/components/Message/MessageManager.d.ts +2 -2
- package/fe/packages/react/ui/components/Message/MessageManager.js +104 -0
- package/fe/packages/react/ui/components/Message/data.js +4 -0
- package/fe/packages/react/ui/components/Message/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Message/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Modal/Modal.d.ts +1 -1
- package/fe/packages/react/ui/components/Modal/Modal.js +59 -0
- package/fe/packages/{ui/react → react/ui}/components/Modal/ModalManager.d.ts +5 -5
- package/fe/packages/react/ui/components/Modal/ModalManager.js +106 -0
- package/fe/packages/react/ui/components/Modal/index.d.ts +4 -0
- package/fe/packages/react/ui/components/Modal/index.js +3 -0
- package/fe/packages/react/ui/components/Notification/Notification.d.ts +14 -0
- package/fe/packages/react/ui/components/Notification/Notification.js +56 -0
- package/fe/packages/react/ui/components/Notification/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Notification/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Overlay/Overlay.d.ts +1 -1
- package/fe/packages/react/ui/components/Overlay/Overlay.js +61 -0
- package/fe/packages/react/ui/components/Overlay/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Overlay/index.js +2 -0
- package/fe/packages/react/ui/components/Pagination/Pagination.js +115 -0
- package/fe/packages/react/ui/components/Pagination/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Pagination/index.js +2 -0
- package/fe/packages/react/ui/components/Popup/Popup.js +86 -0
- package/fe/packages/react/ui/components/Popup/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Popup/index.js +2 -0
- package/fe/packages/react/ui/components/Radio/Radio.d.ts +9 -0
- package/fe/packages/react/ui/components/Radio/Radio.js +36 -0
- package/fe/packages/react/ui/components/Radio/RadioGroup.d.ts +19 -0
- package/fe/packages/react/ui/components/Radio/RadioGroup.js +33 -0
- package/fe/packages/react/ui/components/Radio/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Radio/index.js +3 -0
- package/fe/packages/{ui/react → react/ui}/components/Search/Search.d.ts +4 -4
- package/fe/packages/react/ui/components/Search/Search.js +24 -0
- package/fe/packages/react/ui/components/Search/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Search/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Select/Select.d.ts +1 -1
- package/fe/packages/react/ui/components/Select/Select.js +276 -0
- package/fe/packages/react/ui/components/Select/dropdownPositioning.d.ts +3 -0
- package/fe/packages/react/ui/components/Select/dropdownPositioning.js +16 -0
- package/fe/packages/react/ui/components/Select/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Select/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Skeleton/Skeleton.d.ts +1 -1
- package/fe/packages/react/ui/components/Skeleton/Skeleton.js +101 -0
- package/fe/packages/react/ui/components/Skeleton/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Skeleton/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/Switch/Switch.d.ts +1 -1
- package/fe/packages/react/ui/components/Switch/Switch.js +28 -0
- package/fe/packages/react/ui/components/Switch/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Switch/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/TableSearch/TableSearch.d.ts +6 -6
- package/fe/packages/react/ui/components/TableSearch/TableSearch.js +146 -0
- package/fe/packages/react/ui/components/TableSearch/index.d.ts +3 -0
- package/fe/packages/react/ui/components/TableSearch/index.js +2 -0
- package/fe/packages/react/ui/components/TableSearch/lang.js +14 -0
- package/fe/packages/{ui/react → react/ui}/components/TableSearch/tableSearchLocaleStore.d.ts +1 -1
- package/fe/packages/react/ui/components/TableSearch/tableSearchLocaleStore.js +10 -0
- package/fe/packages/react/ui/components/Tabs/Tabs.d.ts +16 -0
- package/fe/packages/react/ui/components/Tabs/Tabs.js +33 -0
- package/fe/packages/react/ui/components/Tabs/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Tabs/index.js +2 -0
- package/fe/packages/react/ui/components/Textarea/Textarea.js +58 -0
- package/fe/packages/react/ui/components/Textarea/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Textarea/index.js +2 -0
- package/fe/packages/react/ui/components/Tooltip/Tooltip.js +77 -0
- package/fe/packages/react/ui/components/Tooltip/index.d.ts +2 -0
- package/fe/packages/react/ui/components/Tooltip/index.js +2 -0
- package/fe/packages/react/ui/components/TreeSelect/TreeSelect.js +190 -0
- package/fe/packages/react/ui/components/TreeSelect/index.d.ts +2 -0
- package/fe/packages/react/ui/components/TreeSelect/index.js +2 -0
- package/fe/packages/react/ui/components/Upload/ImageUpload.js +101 -0
- package/fe/packages/{ui/react → react/ui}/components/Upload/Upload.d.ts +1 -1
- package/fe/packages/react/ui/components/Upload/Upload.js +29 -0
- package/fe/packages/react/ui/components/Upload/index.d.ts +3 -0
- package/fe/packages/react/ui/components/Upload/index.js +3 -0
- package/fe/packages/react/ui/components/breadcrumb/breadcrumb.js +155 -0
- package/fe/packages/react/ui/components/breadcrumb/index.d.ts +2 -0
- package/fe/packages/react/ui/components/breadcrumb/index.js +2 -0
- package/fe/packages/react/ui/components/hooks/useDropdownPositioning.js +121 -0
- package/fe/packages/react/ui/components/hooks/useInputController.js +39 -0
- package/fe/packages/react/ui/components/index.d.ts +36 -0
- package/fe/packages/react/ui/components/index.js +81 -0
- package/fe/packages/react/ui/components/table/index.d.ts +2 -0
- package/fe/packages/react/ui/components/table/index.js +2 -0
- package/fe/packages/{ui/react → react/ui}/components/table/table.d.ts +16 -3
- package/fe/packages/react/ui/components/table/table.js +166 -0
- package/fe/packages/react/ui/components/testPage/MenuTestPage.js +397 -0
- package/fe/packages/react/ui/components/testPage/index.js +1612 -0
- package/fe/packages/{ui/react → react/ui}/i18n/I18nProvider.d.ts +2 -2
- package/fe/packages/react/ui/i18n/I18nProvider.js +38 -0
- package/fe/packages/react/ui/i18n/index.d.ts +4 -0
- package/fe/packages/react/ui/i18n/index.js +7 -0
- package/fe/packages/react/ui/i18n/useI18n.d.ts +13 -0
- package/fe/packages/react/ui/i18n/useI18n.js +25 -0
- package/fe/packages/{ui/react → react/ui}/index.css +70 -9
- package/fe/packages/react/ui/index.d.ts +5 -0
- package/fe/packages/react/ui/index.js +58 -0
- package/fe/packages/{ui/react → react/ui}/lib/createStoreHook.d.ts +1 -1
- package/fe/packages/react/ui/lib/createStoreHook.js +9 -0
- package/fe/packages/{ui/react → react/ui}/lib/export.d.ts +1 -1
- package/fe/packages/react/ui/lib/export.js +112 -0
- package/fe/packages/react/ui/lib/utils.js +64 -0
- package/fe/packages/{ui/react → react/ui}/stores/breadcrumb.d.ts +1 -1
- package/fe/packages/react/ui/stores/breadcrumb.js +52 -0
- package/fe/packages/react/ui/stores/language.d.ts +4 -0
- package/fe/packages/react/ui/stores/language.js +4 -0
- package/fe/packages/react/ui/types/index.js +0 -0
- package/fe/typings/type.d.ts +1 -0
- package/model/index.d.ts +1 -1
- package/model/types/data/button.d.ts +4 -4
- package/model/types/data/component.d.ts +32 -47
- package/model/types/data/schema.d.ts +6 -6
- package/model/types/data/search.d.ts +1 -1
- package/model/types/index.d.ts +2 -1
- package/model/types/model.d.ts +19 -12
- package/package.json +37 -39
- package/types/app/controller/project.d.ts +14 -2
- package/types/app/controller/view.d.ts +1 -1
- package/types/app/extend/$fetch.d.ts +8 -0
- package/types/app/extend/db.d.ts +54 -1
- package/types/app/extend/render-view.d.ts +3 -0
- package/types/app/middleware/api-params-verify.d.ts +1 -1
- package/types/app/middleware/project-handler.d.ts +2 -2
- package/types/app/router/project.d.ts +1 -1
- package/types/app/service/base.d.ts +3 -4
- package/types/app/service/project.d.ts +7 -2
- package/types/app/type.d.ts +5 -3
- package/types/app/typings.d.ts +4 -2
- package/types/bundler/buildBE.d.ts +13 -0
- package/types/bundler/index.d.ts +4 -1
- package/types/bundler/state.d.ts +18 -0
- package/types/bundler/utils.d.ts +5 -0
- package/types/config/config.default.d.ts +33 -2
- package/types/index.d.ts +6 -5
- package/{fe/frontend/widgets/common/CRUD/CRUD.d.ts → types/packages/common/http/index.d.ts} +29 -10
- package/types/packages/common/i18n/default.d.ts +5 -0
- package/types/packages/common/i18n/en-US.d.ts +5 -0
- package/types/packages/common/i18n/index.d.ts +24 -0
- package/types/packages/common/i18n/types.d.ts +24 -0
- package/types/packages/common/index.d.ts +1 -0
- package/types/packages/core/index.d.ts +3 -3
- package/types/packages/core/loader/config.d.ts +6 -0
- package/types/packages/core/loader/controller.d.ts +14 -0
- package/types/packages/core/loader/extend.d.ts +6 -1
- package/types/packages/core/loader/middleware.d.ts +8 -0
- package/types/packages/core/loader/model.d.ts +22 -0
- package/types/packages/core/loader/router-schema.d.ts +15 -0
- package/types/packages/core/loader/router.d.ts +5 -0
- package/types/packages/core/loader/service.d.ts +14 -0
- package/types/packages/core/paths.d.ts +10 -7
- package/types/packages/core/types.d.ts +66 -3
- package/types/packages/utils/getAllFilesInFolder.d.ts +5 -0
- package/types/packages/utils/loadFile.d.ts +6 -0
- package/types/packages/utils/path.d.ts +18 -0
- package/types/scripts/vite-build/build.d.ts +24 -0
- package/types/scripts/vite-build/collect.d.ts +57 -0
- package/types/scripts/vite-build/constants.d.ts +6 -0
- package/types/scripts/vite-build/dts.d.ts +53 -0
- package/types/scripts/vite-build/index.d.ts +2 -0
- package/types/scripts/vite-build/normalize.d.ts +66 -0
- package/types/scripts/vite-build/plugins.d.ts +67 -0
- package/types/scripts/vite-build/resolve.d.ts +61 -0
- package/types/scripts/vite-build/types.d.ts +174 -0
- package/types/scripts/vite-build/utils.d.ts +35 -0
- package/types/typings/type.d.ts +1 -0
- package/cjs/app/README.md +0 -286
- package/cjs/app/data/signKey.js +0 -23
- package/esm/app/README.md +0 -286
- package/esm/app/data/signKey.js +0 -10
- package/fe/frontend/components/AsyncSelect/AsyncSelect.js +0 -32
- package/fe/frontend/components/AsyncSelect/index.d.ts +0 -4
- package/fe/frontend/components/AsyncSelect/index.js +0 -3
- package/fe/frontend/dash/Dashboard.d.ts +0 -7
- package/fe/frontend/dash/Dashboard.js +0 -73
- package/fe/frontend/dash/dash.entry.js +0 -93
- package/fe/frontend/dash/types.d.ts +0 -17
- package/fe/frontend/dash/types.js +0 -1
- package/fe/frontend/index.d.ts +0 -5
- package/fe/frontend/index.js +0 -2
- package/fe/frontend/main.css +0 -5
- package/fe/frontend/main.d.ts +0 -11
- package/fe/frontend/main.js +0 -19
- package/fe/frontend/testPage/index.js +0 -6
- package/fe/frontend/testPage/testPage.entry.d.ts +0 -2
- package/fe/frontend/testPage/testPage.entry.js +0 -3
- package/fe/frontend/typing/scalability.js +0 -1
- package/fe/frontend/typing/window.d.ts +0 -7
- package/fe/frontend/typing/window.js +0 -1
- package/fe/frontend/widgets/api/baseInfo.js +0 -15
- package/fe/frontend/widgets/common/CRUD/CRUD.js +0 -208
- package/fe/frontend/widgets/common/CRUD/index.d.ts +0 -2
- package/fe/frontend/widgets/common/CRUD/index.js +0 -1
- package/fe/frontend/widgets/common/auth/index.js +0 -20
- package/fe/frontend/widgets/common/generateMenuData.d.ts +0 -4
- package/fe/frontend/widgets/common/generateMenuData.js +0 -14
- package/fe/frontend/widgets/common/importComponent.js +0 -8
- package/fe/frontend/widgets/common/language.d.ts +0 -2
- package/fe/frontend/widgets/common/language.js +0 -9
- package/fe/frontend/widgets/common/logFn/index.js +0 -8
- package/fe/frontend/widgets/common/menu.js +0 -101
- package/fe/frontend/widgets/common/request.d.ts +0 -36
- package/fe/frontend/widgets/common/request.js +0 -133
- package/fe/frontend/widgets/components/BasePage/HeaderView.js +0 -16
- package/fe/frontend/widgets/components/Router/index.js +0 -11
- package/fe/frontend/widgets/components/Router/type.js +0 -1
- package/fe/frontend/widgets/defaultPages/Iframe/index.js +0 -14
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.js +0 -94
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.js +0 -124
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.d.ts +0 -3
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.js +0 -6
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.js +0 -63
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +0 -188
- package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.js +0 -6
- package/fe/frontend/widgets/defaultPages/Schema/data/index.js +0 -1
- package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.js +0 -14
- package/fe/frontend/widgets/defaultPages/Schema/index.js +0 -74
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +0 -4
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +0 -70
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +0 -26
- package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.js +0 -8
- package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.js +0 -3
- package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.d.ts +0 -3
- package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.js +0 -115
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +0 -7
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +0 -36
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +0 -38
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +0 -16
- package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +0 -17
- package/fe/frontend/widgets/defaultPages/SlotPage/index.js +0 -26
- package/fe/frontend/widgets/defaultPages/Todo.d.ts +0 -3
- package/fe/frontend/widgets/defaultPages/Todo.js +0 -5
- package/fe/frontend/widgets/hooks/useCurrentMenuData.js +0 -28
- package/fe/frontend/widgets/hooks/useRouterParams.js +0 -11
- package/fe/frontend/widgets/store/mode.js +0 -37
- package/fe/model/types/data/button.js +0 -16
- package/fe/model/types/data/component.js +0 -11
- package/fe/model/types/data/fetchInfo.js +0 -1
- package/fe/model/types/data/schema.js +0 -1
- package/fe/model/types/data/search.js +0 -1
- package/fe/model/types/menuType.js +0 -1
- package/fe/model/types/model.js +0 -1
- package/fe/packages/common/array/index.js +0 -40
- package/fe/packages/common/cache/index.js +0 -1
- package/fe/packages/common/i18n/types.js +0 -1
- package/fe/packages/common/index.js +0 -9
- package/fe/packages/common/log/index.js +0 -176
- package/fe/packages/common/number/index.js +0 -10
- package/fe/packages/common/object/index.js +0 -25
- package/fe/packages/common/string/index.js +0 -17
- package/fe/packages/common/types/index.js +0 -1
- package/fe/packages/ui/react/components/Button/Button.js +0 -72
- package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +0 -13
- package/fe/packages/ui/react/components/Button/SumbitButton.js +0 -25
- package/fe/packages/ui/react/components/Button/index.d.ts +0 -4
- package/fe/packages/ui/react/components/Button/index.js +0 -2
- package/fe/packages/ui/react/components/Checkbox/Checkbox.js +0 -39
- package/fe/packages/ui/react/components/Checkbox/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Checkbox/index.js +0 -1
- package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +0 -11
- package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +0 -2
- package/fe/packages/ui/react/components/ConfirmDialog/index.js +0 -1
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +0 -94
- package/fe/packages/ui/react/components/DataTable/index.js +0 -155
- package/fe/packages/ui/react/components/Date/Calendar.js +0 -216
- package/fe/packages/ui/react/components/Date/Date.js +0 -201
- package/fe/packages/ui/react/components/Date/DateTestPage.js +0 -29
- package/fe/packages/ui/react/components/Date/LocaleContext.js +0 -8
- package/fe/packages/ui/react/components/Date/LocaleProvider.js +0 -24
- package/fe/packages/ui/react/components/Date/TimePicker.js +0 -78
- package/fe/packages/ui/react/components/Date/data.js +0 -4
- package/fe/packages/ui/react/components/Date/dateLocaleStore.js +0 -14
- package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +0 -3
- package/fe/packages/ui/react/components/Date/dropdownPositioning.js +0 -12
- package/fe/packages/ui/react/components/Date/index.d.ts +0 -6
- package/fe/packages/ui/react/components/Date/index.js +0 -5
- package/fe/packages/ui/react/components/Date/locales.js +0 -21
- package/fe/packages/ui/react/components/Drawer/Drawer.js +0 -100
- package/fe/packages/ui/react/components/Drawer/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Drawer/index.js +0 -1
- package/fe/packages/ui/react/components/Dropdown/Dropdown.js +0 -28
- package/fe/packages/ui/react/components/Dropdown/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Dropdown/index.js +0 -1
- package/fe/packages/ui/react/components/Form/Form.js +0 -8
- package/fe/packages/ui/react/components/Form/FormItem.js +0 -43
- package/fe/packages/ui/react/components/Form/SchemaForm/data.js +0 -18
- package/fe/packages/ui/react/components/Form/SchemaForm/index.js +0 -79
- package/fe/packages/ui/react/components/Form/index.d.ts +0 -5
- package/fe/packages/ui/react/components/Form/index.js +0 -4
- package/fe/packages/ui/react/components/Form/useForm.d.ts +0 -3
- package/fe/packages/ui/react/components/Form/useForm.js +0 -1
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +0 -169
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +0 -28
- package/fe/packages/ui/react/components/ImagePreview/index.d.ts +0 -3
- package/fe/packages/ui/react/components/ImagePreview/index.js +0 -2
- package/fe/packages/ui/react/components/Input/Input.js +0 -61
- package/fe/packages/ui/react/components/Input/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Input/index.js +0 -1
- package/fe/packages/ui/react/components/InputNumber/InputNumber.js +0 -144
- package/fe/packages/ui/react/components/InputNumber/index.d.ts +0 -2
- package/fe/packages/ui/react/components/InputNumber/index.js +0 -1
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +0 -63
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +0 -27
- package/fe/packages/ui/react/components/Label/Label.js +0 -35
- package/fe/packages/ui/react/components/Label/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Label/index.js +0 -2
- package/fe/packages/ui/react/components/Menu/Menu.js +0 -102
- package/fe/packages/ui/react/components/Menu/MenuContext.js +0 -97
- package/fe/packages/ui/react/components/Menu/MenuItem.js +0 -33
- package/fe/packages/ui/react/components/Menu/SubMenu.js +0 -169
- package/fe/packages/ui/react/components/Menu/index.d.ts +0 -9
- package/fe/packages/ui/react/components/Menu/index.js +0 -5
- package/fe/packages/ui/react/components/Menu/menuTypes.js +0 -1
- package/fe/packages/ui/react/components/Menu/utils.js +0 -7
- package/fe/packages/ui/react/components/Message/Message.js +0 -58
- package/fe/packages/ui/react/components/Message/MessageManager.js +0 -90
- package/fe/packages/ui/react/components/Message/data.js +0 -1
- package/fe/packages/ui/react/components/Message/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Message/index.js +0 -1
- package/fe/packages/ui/react/components/Modal/Modal.js +0 -14
- package/fe/packages/ui/react/components/Modal/ModalManager.js +0 -90
- package/fe/packages/ui/react/components/Modal/index.d.ts +0 -4
- package/fe/packages/ui/react/components/Modal/index.js +0 -2
- package/fe/packages/ui/react/components/Overlay/Overlay.js +0 -53
- package/fe/packages/ui/react/components/Overlay/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Overlay/index.js +0 -1
- package/fe/packages/ui/react/components/Pagination/Pagination.js +0 -88
- package/fe/packages/ui/react/components/Pagination/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Pagination/index.js +0 -1
- package/fe/packages/ui/react/components/Popup/Popup.js +0 -81
- package/fe/packages/ui/react/components/Popup/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Popup/index.js +0 -1
- package/fe/packages/ui/react/components/Search/Search.js +0 -12
- package/fe/packages/ui/react/components/Search/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Search/index.js +0 -1
- package/fe/packages/ui/react/components/Select/Select.js +0 -123
- package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +0 -3
- package/fe/packages/ui/react/components/Select/dropdownPositioning.js +0 -13
- package/fe/packages/ui/react/components/Select/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Select/index.js +0 -1
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +0 -31
- package/fe/packages/ui/react/components/Skeleton/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Skeleton/index.js +0 -1
- package/fe/packages/ui/react/components/Switch/Switch.js +0 -22
- package/fe/packages/ui/react/components/Switch/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Switch/index.js +0 -1
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +0 -121
- package/fe/packages/ui/react/components/TableSearch/index.d.ts +0 -2
- package/fe/packages/ui/react/components/TableSearch/index.js +0 -1
- package/fe/packages/ui/react/components/TableSearch/lang.js +0 -14
- package/fe/packages/ui/react/components/TableSearch/tableSearchLocaleStore.js +0 -11
- package/fe/packages/ui/react/components/Textarea/Textarea.js +0 -37
- package/fe/packages/ui/react/components/Textarea/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Textarea/index.js +0 -1
- package/fe/packages/ui/react/components/Tooltip/Tooltip.js +0 -79
- package/fe/packages/ui/react/components/Tooltip/index.d.ts +0 -2
- package/fe/packages/ui/react/components/Tooltip/index.js +0 -1
- package/fe/packages/ui/react/components/TreeSelect/TreeSelect.js +0 -160
- package/fe/packages/ui/react/components/TreeSelect/index.d.ts +0 -2
- package/fe/packages/ui/react/components/TreeSelect/index.js +0 -1
- package/fe/packages/ui/react/components/Upload/ImageUpload.js +0 -75
- package/fe/packages/ui/react/components/Upload/Upload.js +0 -6
- package/fe/packages/ui/react/components/Upload/index.d.ts +0 -3
- package/fe/packages/ui/react/components/Upload/index.js +0 -2
- package/fe/packages/ui/react/components/breadcrumb/breadcrumb.js +0 -81
- package/fe/packages/ui/react/components/breadcrumb/index.d.ts +0 -2
- package/fe/packages/ui/react/components/breadcrumb/index.js +0 -1
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +0 -137
- package/fe/packages/ui/react/components/hooks/useInputController.js +0 -45
- package/fe/packages/ui/react/components/index.d.ts +0 -30
- package/fe/packages/ui/react/components/index.js +0 -29
- package/fe/packages/ui/react/components/table/index.d.ts +0 -2
- package/fe/packages/ui/react/components/table/index.js +0 -1
- package/fe/packages/ui/react/components/table/table.js +0 -20
- package/fe/packages/ui/react/components/testPage/MenuTestPage.js +0 -104
- package/fe/packages/ui/react/components/testPage/index.js +0 -314
- package/fe/packages/ui/react/hooks/useBreadcrumb.d.ts +0 -10
- package/fe/packages/ui/react/hooks/useBreadcrumb.js +0 -2
- package/fe/packages/ui/react/hooks/useExecuteOnce.js +0 -57
- package/fe/packages/ui/react/hooks/useInit.js +0 -9
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +0 -2
- package/fe/packages/ui/react/hooks/useLanguage.js +0 -4
- package/fe/packages/ui/react/hooks/usePagination.js +0 -27
- package/fe/packages/ui/react/hooks/useRefState.js +0 -29
- package/fe/packages/ui/react/hooks/useWatch.js +0 -87
- package/fe/packages/ui/react/hooks/useWatch.test.js +0 -22
- package/fe/packages/ui/react/i18n/I18nProvider.js +0 -25
- package/fe/packages/ui/react/i18n/index.d.ts +0 -4
- package/fe/packages/ui/react/i18n/index.js +0 -3
- package/fe/packages/ui/react/i18n/useI18n.d.ts +0 -13
- package/fe/packages/ui/react/i18n/useI18n.js +0 -18
- package/fe/packages/ui/react/index.d.ts +0 -5
- package/fe/packages/ui/react/index.js +0 -6
- package/fe/packages/ui/react/lib/createStoreHook.js +0 -6
- package/fe/packages/ui/react/lib/export.js +0 -138
- package/fe/packages/ui/react/lib/utils.js +0 -70
- package/fe/packages/ui/react/stores/breadcrumb.js +0 -66
- package/fe/packages/ui/react/stores/language.d.ts +0 -4
- package/fe/packages/ui/react/stores/language.js +0 -2
- package/fe/packages/ui/react/types/index.js +0 -1
- package/fe/typings/type.js +0 -1
- package/types/app/data/signKey.d.ts +0 -1
- /package/fe/frontend/{dash → apps/dash}/dash.entry.d.ts +0 -0
- /package/fe/frontend/{testPage → apps/ui-components}/index.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/common/auth/index.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/components/Router/type.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/defaultPages/Iframe/index.d.ts +0 -0
- /package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/components/SchemaSearch/index.d.ts +0 -0
- /package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/data/eventInfo.d.ts +0 -0
- /package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/data/index.d.ts +0 -0
- /package/fe/frontend/{widgets/defaultPages/Schema → src/defaultPages/SchemaPage}/utils/permissions.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/defaultPages/SidebarSlotPage/index.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/defaultPages/SidebarSlotPageTmp.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/defaultPages/SlotPage/index.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/hooks/useCurrentMenuData.d.ts +0 -0
- /package/fe/frontend/{widgets → src}/hooks/useRouterParams.d.ts +0 -0
- /package/fe/packages/{ui/react → react}/hooks/useExecuteOnce.d.ts +0 -0
- /package/fe/packages/{ui/react → react}/hooks/useInit.d.ts +0 -0
- /package/fe/packages/{ui/react → react}/hooks/usePagination.d.ts +0 -0
- /package/fe/packages/{ui/react → react}/hooks/useWatch.d.ts +0 -0
- /package/fe/packages/{ui/react → react}/hooks/useWatch.test.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/assets/table/no-result.svg +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/ConfirmDialog/ConfirmDialog.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Date/Date.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Date/DateTestPage.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Date/LocaleContext.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Date/TimePicker.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Date/data.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Date/locales.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/ImagePreview/ImagePreview.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/InputNumber/inputNumberUtils.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/InputNumber/inputNumberUtils.test.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Menu/Menu.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Menu/MenuContext.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Menu/MenuItem.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Menu/SubMenu.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Menu/utils.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Message/data.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Pagination/Pagination.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Popup/Popup.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/TableSearch/lang.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Textarea/Textarea.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Tooltip/Tooltip.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/TreeSelect/TreeSelect.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/Upload/ImageUpload.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/breadcrumb/breadcrumb.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/hooks/useDropdownPositioning.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/hooks/useInputController.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/testPage/MenuTestPage.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/components/testPage/index.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/lib/utils.d.ts +0 -0
- /package/fe/packages/{ui/react → react/ui}/types/index.d.ts +0 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { cn } from "../../lib/utils.js";
|
|
2
|
+
import { Button } from "../Button/Button.js";
|
|
3
|
+
import "../Button/index.js";
|
|
4
|
+
import { Input } from "../Input/Input.js";
|
|
5
|
+
import "../Input/index.js";
|
|
6
|
+
import { useDropdownPositioning } from "../hooks/useDropdownPositioning.js";
|
|
7
|
+
import { Popup } from "../Popup/Popup.js";
|
|
8
|
+
import "../Popup/index.js";
|
|
9
|
+
import { ModeType } from "./data.js";
|
|
10
|
+
import { useDateLocale } from "./LocaleContext.js";
|
|
11
|
+
import { Calendar as Calendar$1 } from "./Calendar.js";
|
|
12
|
+
import { getDatePickerDropdownPosition } from "./dropdownPositioning.js";
|
|
13
|
+
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
14
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
15
|
+
import { Calendar, X } from "lucide-react";
|
|
16
|
+
import { format, isValid, parse } from "date-fns";
|
|
17
|
+
//#region packages/react/ui/components/Date/Date.tsx
|
|
18
|
+
var formatValue = (val, format$1) => {
|
|
19
|
+
if (!val) return "";
|
|
20
|
+
if (val instanceof Date) return format(val, format$1);
|
|
21
|
+
if ("from" in val) {
|
|
22
|
+
if (val.from && val.to) return `${format(val.from, format$1)} - ${format(val.to, format$1)}`;
|
|
23
|
+
if (val.from) return format(val.from, format$1);
|
|
24
|
+
}
|
|
25
|
+
return "";
|
|
26
|
+
};
|
|
27
|
+
var formatDateValue = (val, format$2) => {
|
|
28
|
+
if (!val) return "";
|
|
29
|
+
/**
|
|
30
|
+
* 将 DateBaseValue 转为 yyyy-MM-dd | [yyyy-MM-dd, yyyy-MM-dd]
|
|
31
|
+
*/
|
|
32
|
+
if (val instanceof Date) return format(val, format$2);
|
|
33
|
+
if ("from" in val) {
|
|
34
|
+
if (val.from && val.to) return [format(val.from, format$2), format(val.to, format$2)];
|
|
35
|
+
}
|
|
36
|
+
return "";
|
|
37
|
+
};
|
|
38
|
+
var DatePicker = forwardRef((props, ref) => {
|
|
39
|
+
const { mode = ModeType.Single, className, format: customFormat, placeholder, allowClear = true, disabled = false, showTime = false, value: pValue, defaultValue: pDefaultValue, onChange, disabledDate, locale: customLocale, quickRanges, getPopupContainer } = props;
|
|
40
|
+
const isControlled = Object.prototype.hasOwnProperty.call(props, "value");
|
|
41
|
+
const locale = {
|
|
42
|
+
...useDateLocale(),
|
|
43
|
+
...customLocale
|
|
44
|
+
};
|
|
45
|
+
const finalPlaceholder = placeholder || (showTime ? mode === ModeType.Range ? locale.placeholderDateTimeRange : locale.placeholderDateTime : mode === ModeType.Range ? locale.placeholderRange : locale.placeholder);
|
|
46
|
+
const format = customFormat || (showTime ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd");
|
|
47
|
+
const { value, defaultValue } = useMemo(() => {
|
|
48
|
+
/**
|
|
49
|
+
* 将 DateChangeStrValue 转为 Dates
|
|
50
|
+
*/
|
|
51
|
+
const convertValue = (val) => {
|
|
52
|
+
if (!val) return void 0;
|
|
53
|
+
if (val instanceof Date) return val;
|
|
54
|
+
if (typeof val === "object" && "from" in val) return val;
|
|
55
|
+
if (typeof val === "string") try {
|
|
56
|
+
const parsed = parse(val, format, /* @__PURE__ */ new Date());
|
|
57
|
+
return isValid(parsed) ? parsed : void 0;
|
|
58
|
+
} catch {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (Array.isArray(val)) if (typeof val[0] === "string" && typeof val[1] === "string") try {
|
|
62
|
+
const from = parse(val[0], format, /* @__PURE__ */ new Date());
|
|
63
|
+
const to = parse(val[1], format, /* @__PURE__ */ new Date());
|
|
64
|
+
return isValid(from) && isValid(to) ? {
|
|
65
|
+
from,
|
|
66
|
+
to
|
|
67
|
+
} : void 0;
|
|
68
|
+
} catch {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
else return {
|
|
72
|
+
from: val[0],
|
|
73
|
+
to: val[1]
|
|
74
|
+
};
|
|
75
|
+
};
|
|
76
|
+
return {
|
|
77
|
+
value: convertValue(pValue),
|
|
78
|
+
defaultValue: convertValue(pDefaultValue)
|
|
79
|
+
};
|
|
80
|
+
}, [
|
|
81
|
+
pDefaultValue,
|
|
82
|
+
pValue,
|
|
83
|
+
format
|
|
84
|
+
]);
|
|
85
|
+
const initialValue = isControlled ? value : value || defaultValue;
|
|
86
|
+
const [selectedDate, setSelectedDate] = useState(initialValue);
|
|
87
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
88
|
+
const [inputValue, setInputValue] = useState(formatValue(initialValue, format));
|
|
89
|
+
const [isHover, setIsHover] = useState(false);
|
|
90
|
+
const containerRef = useRef(null);
|
|
91
|
+
const dropdownContentRef = useRef(null);
|
|
92
|
+
const inputRef = useRef(null);
|
|
93
|
+
const rangeDraftRef = useRef(false);
|
|
94
|
+
const positioning = useDropdownPositioning({
|
|
95
|
+
open: isOpen,
|
|
96
|
+
anchorRef: containerRef,
|
|
97
|
+
contentRef: dropdownContentRef,
|
|
98
|
+
placement: "bottom-start",
|
|
99
|
+
offset: 8,
|
|
100
|
+
matchAnchorWidth: false,
|
|
101
|
+
strategy: getDatePickerDropdownPosition
|
|
102
|
+
});
|
|
103
|
+
useEffect(() => {
|
|
104
|
+
if (!isControlled) return;
|
|
105
|
+
if (mode === ModeType.Range && rangeDraftRef.current && value === void 0) return;
|
|
106
|
+
setSelectedDate(value);
|
|
107
|
+
setInputValue(formatValue(value, format));
|
|
108
|
+
if (mode !== ModeType.Range || !value || !("from" in value) || value.to) rangeDraftRef.current = false;
|
|
109
|
+
}, [
|
|
110
|
+
isControlled,
|
|
111
|
+
mode,
|
|
112
|
+
value,
|
|
113
|
+
format
|
|
114
|
+
]);
|
|
115
|
+
const handleSelect = (date) => {
|
|
116
|
+
const newDate = date;
|
|
117
|
+
if (mode === ModeType.Range) {
|
|
118
|
+
if (date && "from" in date && "to" in date && date.from && date.to) setIsOpen(false);
|
|
119
|
+
} else setIsOpen(false);
|
|
120
|
+
if (mode === ModeType.Range || !isControlled) {
|
|
121
|
+
setSelectedDate(newDate);
|
|
122
|
+
setInputValue(formatValue(newDate, format));
|
|
123
|
+
}
|
|
124
|
+
rangeDraftRef.current = mode === ModeType.Range && !(newDate && typeof newDate === "object" && "from" in newDate && newDate.from && newDate.to);
|
|
125
|
+
onChange?.(formatDateValue(newDate, format), newDate);
|
|
126
|
+
};
|
|
127
|
+
const handleClear = (e) => {
|
|
128
|
+
e.stopPropagation();
|
|
129
|
+
rangeDraftRef.current = false;
|
|
130
|
+
setSelectedDate(void 0);
|
|
131
|
+
setInputValue("");
|
|
132
|
+
onChange?.(void 0, void 0);
|
|
133
|
+
inputRef.current?.focus();
|
|
134
|
+
};
|
|
135
|
+
const handleInputChange = (e) => {
|
|
136
|
+
const newValue = e.target.value;
|
|
137
|
+
setInputValue(newValue);
|
|
138
|
+
if (mode === ModeType.Single) try {
|
|
139
|
+
const parsedDate = parse(newValue, format, /* @__PURE__ */ new Date());
|
|
140
|
+
if (isValid(parsedDate)) {
|
|
141
|
+
if (!isControlled) setSelectedDate(parsedDate);
|
|
142
|
+
onChange?.(formatDateValue(parsedDate, format), parsedDate);
|
|
143
|
+
}
|
|
144
|
+
} catch {}
|
|
145
|
+
};
|
|
146
|
+
const showClearIcon = allowClear && selectedDate && !disabled && isHover;
|
|
147
|
+
return /* @__PURE__ */ jsx("div", {
|
|
148
|
+
ref,
|
|
149
|
+
className: cn("tc-ui-date-picker relative w-full", mode === ModeType.Range ? "min-w-[255px]" : "", className),
|
|
150
|
+
children: /* @__PURE__ */ jsxs("div", {
|
|
151
|
+
ref: containerRef,
|
|
152
|
+
className: "relative",
|
|
153
|
+
children: [/* @__PURE__ */ jsxs("div", {
|
|
154
|
+
className: cn("flex h-10 items-center w-full rounded-lg px-3 py-0 text-sm", "border transition-colors duration-200", "bg-background cursor-pointer", disabled && "cursor-not-allowed bg-muted border-border text-muted-foreground", !disabled && !isOpen && "border-border", !disabled && isOpen && "border-theme ring-2 ring-theme/25", !disabled && "focus-within:border-theme focus-within:ring-2 focus-within:ring-theme/25"),
|
|
155
|
+
onClick: () => !disabled && setIsOpen(!isOpen),
|
|
156
|
+
onMouseEnter: () => setIsHover(true),
|
|
157
|
+
onMouseLeave: () => setIsHover(false),
|
|
158
|
+
children: [/* @__PURE__ */ jsx(Input, {
|
|
159
|
+
ref: inputRef,
|
|
160
|
+
type: "text",
|
|
161
|
+
value: inputValue,
|
|
162
|
+
onChange: (_, e) => handleInputChange(e),
|
|
163
|
+
placeholder: finalPlaceholder,
|
|
164
|
+
disabled,
|
|
165
|
+
readOnly: mode === ModeType.Range,
|
|
166
|
+
className: "min-w-0 flex-1",
|
|
167
|
+
inputClassName: cn("h-8 min-w-0 flex-1 rounded-none border-0 bg-transparent px-0 py-0 outline-none", "ring-0 shadow-none focus:ring-0 focus-visible:ring-0", "text-sm text-foreground placeholder:text-muted-foreground", disabled && "cursor-not-allowed", mode === ModeType.Range && !disabled && "cursor-pointer caret-transparent")
|
|
168
|
+
}), showClearIcon ? /* @__PURE__ */ jsx(Button, {
|
|
169
|
+
variant: "text",
|
|
170
|
+
type: "button",
|
|
171
|
+
onClick: handleClear,
|
|
172
|
+
title: locale.clear,
|
|
173
|
+
"aria-label": locale.clear,
|
|
174
|
+
className: cn("ml-2 flex h-7 w-7 items-center justify-center rounded-md", "text-muted-foreground transition-colors hover:bg-foreground/8 hover:text-foreground", "cursor-pointer"),
|
|
175
|
+
children: /* @__PURE__ */ jsx(X, { size: 12 })
|
|
176
|
+
}) : /* @__PURE__ */ jsx(Calendar, {
|
|
177
|
+
size: 16,
|
|
178
|
+
className: "ml-2 shrink-0 text-muted-foreground"
|
|
179
|
+
})]
|
|
180
|
+
}), /* @__PURE__ */ jsx(Popup, {
|
|
181
|
+
open: isOpen && !disabled,
|
|
182
|
+
anchorRef: containerRef,
|
|
183
|
+
contentRef: dropdownContentRef,
|
|
184
|
+
positioning,
|
|
185
|
+
keepMounted: true,
|
|
186
|
+
onOpenChange: (nextOpen) => {
|
|
187
|
+
setIsOpen(nextOpen);
|
|
188
|
+
if (!nextOpen) rangeDraftRef.current = false;
|
|
189
|
+
},
|
|
190
|
+
className: cn("overflow-hidden"),
|
|
191
|
+
container: getPopupContainer?.(),
|
|
192
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
193
|
+
ref: dropdownContentRef,
|
|
194
|
+
children: /* @__PURE__ */ jsx(Calendar$1, {
|
|
195
|
+
mode,
|
|
196
|
+
value: selectedDate || null,
|
|
197
|
+
onChange: handleSelect,
|
|
198
|
+
disabledDate,
|
|
199
|
+
showTime,
|
|
200
|
+
locale,
|
|
201
|
+
quickRanges
|
|
202
|
+
})
|
|
203
|
+
})
|
|
204
|
+
})]
|
|
205
|
+
})
|
|
206
|
+
});
|
|
207
|
+
});
|
|
208
|
+
DatePicker.displayName = "DatePicker";
|
|
209
|
+
//#endregion
|
|
210
|
+
export { DatePicker };
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
import { DatePicker } from "./Date.js";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { startOfDay } from "date-fns";
|
|
5
|
+
//#region packages/react/ui/components/Date/DateTestPage.tsx
|
|
6
|
+
function DateTestPage() {
|
|
7
|
+
const [date1, setDate1] = useState();
|
|
8
|
+
const [dateTime1, setDateTime1] = useState();
|
|
9
|
+
const [range, setRange] = useState();
|
|
10
|
+
const [rangeWithTime, setRangeWithTime] = useState();
|
|
11
|
+
const [emptyRange, setEmptyRange] = useState();
|
|
12
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
className: "p-8 max-w-6xl mx-auto space-y-8",
|
|
14
|
+
children: [
|
|
15
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("h1", {
|
|
16
|
+
className: "text-3xl font-bold mb-2",
|
|
17
|
+
children: "Date 组件使用示例"
|
|
18
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
19
|
+
className: "text-muted-foreground",
|
|
20
|
+
children: "展示 DatePicker 组件的各种使用场景"
|
|
21
|
+
})] }),
|
|
22
|
+
/* @__PURE__ */ jsxs("section", {
|
|
23
|
+
className: "space-y-4",
|
|
24
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
25
|
+
className: "text-xl font-semibold",
|
|
26
|
+
children: "1. 基本用法"
|
|
27
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
28
|
+
className: "grid grid-cols-2 gap-4",
|
|
29
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
30
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
31
|
+
children: "单日期选择"
|
|
32
|
+
}), /* @__PURE__ */ jsx(DatePicker, { placeholder: "请选择日期" })] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
33
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
34
|
+
children: "禁用清除按钮"
|
|
35
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
36
|
+
placeholder: "请选择日期",
|
|
37
|
+
allowClear: false
|
|
38
|
+
})] })]
|
|
39
|
+
})]
|
|
40
|
+
}),
|
|
41
|
+
/* @__PURE__ */ jsxs("section", {
|
|
42
|
+
className: "space-y-4",
|
|
43
|
+
children: [
|
|
44
|
+
/* @__PURE__ */ jsx("h2", {
|
|
45
|
+
className: "text-xl font-semibold",
|
|
46
|
+
children: "2. 日期时间选择器 (showTime)"
|
|
47
|
+
}),
|
|
48
|
+
/* @__PURE__ */ jsx("p", {
|
|
49
|
+
className: "text-sm text-muted-foreground",
|
|
50
|
+
children: "时间选择器显示在日历右侧,提供更好的用户体验"
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ jsxs("div", {
|
|
53
|
+
className: "grid grid-cols-2 gap-8",
|
|
54
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
55
|
+
/* @__PURE__ */ jsx("h3", {
|
|
56
|
+
className: "text-sm font-medium mb-2",
|
|
57
|
+
children: "基本用法 - 单日期时间"
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsx(DatePicker, {
|
|
60
|
+
showTime: true,
|
|
61
|
+
placeholder: "请选择日期时间"
|
|
62
|
+
}),
|
|
63
|
+
/* @__PURE__ */ jsx("p", {
|
|
64
|
+
className: "text-xs text-muted-foreground mt-2",
|
|
65
|
+
children: "点击输入框打开选择器,时间选择器在右侧显示"
|
|
66
|
+
})
|
|
67
|
+
] }), /* @__PURE__ */ jsxs("div", { children: [
|
|
68
|
+
/* @__PURE__ */ jsx("h3", {
|
|
69
|
+
className: "text-sm font-medium mb-2",
|
|
70
|
+
children: "受控模式"
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ jsx(DatePicker, {
|
|
73
|
+
showTime: true,
|
|
74
|
+
value: dateTime1,
|
|
75
|
+
onChange: (val, date) => {
|
|
76
|
+
setDateTime1(val);
|
|
77
|
+
console.log("选中日期时间:", val);
|
|
78
|
+
console.log("Date 对象:", date);
|
|
79
|
+
},
|
|
80
|
+
placeholder: "受控日期时间选择器"
|
|
81
|
+
}),
|
|
82
|
+
/* @__PURE__ */ jsxs("p", {
|
|
83
|
+
className: "text-sm text-muted-foreground mt-2",
|
|
84
|
+
children: ["选中的值: ", /* @__PURE__ */ jsx("code", {
|
|
85
|
+
className: "text-xs bg-muted px-1 py-0.5 rounded",
|
|
86
|
+
children: String(dateTime1 || "未选择")
|
|
87
|
+
})]
|
|
88
|
+
})
|
|
89
|
+
] })]
|
|
90
|
+
})
|
|
91
|
+
]
|
|
92
|
+
}),
|
|
93
|
+
/* @__PURE__ */ jsxs("section", {
|
|
94
|
+
className: "space-y-4",
|
|
95
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
96
|
+
className: "text-xl font-semibold",
|
|
97
|
+
children: "3. 范围选择 (Range Picker)"
|
|
98
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
99
|
+
className: "grid grid-cols-2 gap-8",
|
|
100
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
101
|
+
/* @__PURE__ */ jsx("h3", {
|
|
102
|
+
className: "text-sm font-medium mb-2",
|
|
103
|
+
children: "基本范围选择"
|
|
104
|
+
}),
|
|
105
|
+
/* @__PURE__ */ jsx(DatePicker, {
|
|
106
|
+
mode: "range",
|
|
107
|
+
value: emptyRange,
|
|
108
|
+
onChange: (val) => {
|
|
109
|
+
setEmptyRange(val);
|
|
110
|
+
console.log("范围选择:", val);
|
|
111
|
+
},
|
|
112
|
+
placeholder: "选择日期范围"
|
|
113
|
+
}),
|
|
114
|
+
/* @__PURE__ */ jsxs("p", {
|
|
115
|
+
className: "text-sm text-muted-foreground mt-2",
|
|
116
|
+
children: ["值: ", /* @__PURE__ */ jsx("code", {
|
|
117
|
+
className: "text-xs bg-muted px-1 py-0.5 rounded",
|
|
118
|
+
children: JSON.stringify(emptyRange || "未选择")
|
|
119
|
+
})]
|
|
120
|
+
})
|
|
121
|
+
] }), /* @__PURE__ */ jsxs("div", { children: [
|
|
122
|
+
/* @__PURE__ */ jsx("h3", {
|
|
123
|
+
className: "text-sm font-medium mb-2",
|
|
124
|
+
children: "范围选择 + 时间选择"
|
|
125
|
+
}),
|
|
126
|
+
/* @__PURE__ */ jsx(DatePicker, {
|
|
127
|
+
mode: "range",
|
|
128
|
+
value: rangeWithTime,
|
|
129
|
+
showTime: true,
|
|
130
|
+
onChange: (val) => {
|
|
131
|
+
setRangeWithTime(val);
|
|
132
|
+
console.log("范围时间选择:", val);
|
|
133
|
+
},
|
|
134
|
+
placeholder: "选择日期时间范围"
|
|
135
|
+
}),
|
|
136
|
+
/* @__PURE__ */ jsxs("p", {
|
|
137
|
+
className: "text-sm text-muted-foreground mt-2",
|
|
138
|
+
children: [
|
|
139
|
+
"值:",
|
|
140
|
+
" ",
|
|
141
|
+
/* @__PURE__ */ jsx("code", {
|
|
142
|
+
className: "text-xs bg-muted px-1 py-0.5 rounded",
|
|
143
|
+
children: JSON.stringify(rangeWithTime || "未选择")
|
|
144
|
+
})
|
|
145
|
+
]
|
|
146
|
+
}),
|
|
147
|
+
/* @__PURE__ */ jsx("p", {
|
|
148
|
+
className: "text-xs text-muted-foreground mt-1",
|
|
149
|
+
children: "选择开始日期后,右侧会显示开始时间选择器;选择结束日期后,会显示结束时间选择器"
|
|
150
|
+
})
|
|
151
|
+
] })]
|
|
152
|
+
})]
|
|
153
|
+
}),
|
|
154
|
+
/* @__PURE__ */ jsxs("section", {
|
|
155
|
+
className: "space-y-4",
|
|
156
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
157
|
+
className: "text-xl font-semibold",
|
|
158
|
+
children: "4. 受控模式"
|
|
159
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
160
|
+
className: "grid grid-cols-2 gap-4",
|
|
161
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [
|
|
162
|
+
/* @__PURE__ */ jsx("p", {
|
|
163
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
164
|
+
children: "单日期受控"
|
|
165
|
+
}),
|
|
166
|
+
/* @__PURE__ */ jsx(DatePicker, {
|
|
167
|
+
value: date1,
|
|
168
|
+
onChange: (date, dateString) => {
|
|
169
|
+
setDate1(date);
|
|
170
|
+
console.log("选中日期:", date);
|
|
171
|
+
console.log("日期字符串:", dateString);
|
|
172
|
+
},
|
|
173
|
+
placeholder: "受控日期选择器"
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsxs("p", {
|
|
176
|
+
className: "text-sm text-muted-foreground mt-2",
|
|
177
|
+
children: ["选中的日期: ", /* @__PURE__ */ jsx("code", {
|
|
178
|
+
className: "text-xs bg-muted px-1 py-0.5 rounded",
|
|
179
|
+
children: String(date1 || "未选择")
|
|
180
|
+
})]
|
|
181
|
+
})
|
|
182
|
+
] }), /* @__PURE__ */ jsxs("div", { children: [
|
|
183
|
+
/* @__PURE__ */ jsx("p", {
|
|
184
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
185
|
+
children: "范围受控"
|
|
186
|
+
}),
|
|
187
|
+
/* @__PURE__ */ jsx(DatePicker, {
|
|
188
|
+
mode: "range",
|
|
189
|
+
value: range,
|
|
190
|
+
onChange: (val) => {
|
|
191
|
+
setRange(val);
|
|
192
|
+
console.log("范围变化:", val);
|
|
193
|
+
},
|
|
194
|
+
placeholder: "受控范围选择器"
|
|
195
|
+
}),
|
|
196
|
+
/* @__PURE__ */ jsxs("p", {
|
|
197
|
+
className: "text-sm text-muted-foreground mt-2",
|
|
198
|
+
children: ["值: ", /* @__PURE__ */ jsx("code", {
|
|
199
|
+
className: "text-xs bg-muted px-1 py-0.5 rounded",
|
|
200
|
+
children: JSON.stringify(range || "未选择")
|
|
201
|
+
})]
|
|
202
|
+
})
|
|
203
|
+
] })]
|
|
204
|
+
})]
|
|
205
|
+
}),
|
|
206
|
+
/* @__PURE__ */ jsxs("section", {
|
|
207
|
+
className: "space-y-4",
|
|
208
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
209
|
+
className: "text-xl font-semibold",
|
|
210
|
+
children: "5. 禁用日期"
|
|
211
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
212
|
+
className: "grid grid-cols-2 gap-4",
|
|
213
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
214
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
215
|
+
children: "只能选择今天及以后"
|
|
216
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
217
|
+
disabledDate: (current) => current < startOfDay(/* @__PURE__ */ new Date()),
|
|
218
|
+
placeholder: "选择未来日期"
|
|
219
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
220
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
221
|
+
children: "范围选择(禁用过去)"
|
|
222
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
223
|
+
mode: "range",
|
|
224
|
+
disabledDate: (current) => current < startOfDay(/* @__PURE__ */ new Date()),
|
|
225
|
+
placeholder: "选择未来范围"
|
|
226
|
+
})] })]
|
|
227
|
+
})]
|
|
228
|
+
}),
|
|
229
|
+
/* @__PURE__ */ jsxs("section", {
|
|
230
|
+
className: "space-y-4",
|
|
231
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
232
|
+
className: "text-xl font-semibold",
|
|
233
|
+
children: "6. 禁用状态"
|
|
234
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
235
|
+
className: "grid grid-cols-2 gap-4",
|
|
236
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
237
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
238
|
+
children: "禁用状态"
|
|
239
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
240
|
+
disabled: true,
|
|
241
|
+
placeholder: "禁用状态"
|
|
242
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
243
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
244
|
+
children: "禁用状态 + 有值"
|
|
245
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
246
|
+
disabled: true,
|
|
247
|
+
value: "2024-01-15",
|
|
248
|
+
placeholder: "禁用状态"
|
|
249
|
+
})] })]
|
|
250
|
+
})]
|
|
251
|
+
}),
|
|
252
|
+
/* @__PURE__ */ jsxs("section", {
|
|
253
|
+
className: "space-y-4",
|
|
254
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
255
|
+
className: "text-xl font-semibold",
|
|
256
|
+
children: "7. 自定义格式"
|
|
257
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
258
|
+
className: "grid grid-cols-2 gap-4",
|
|
259
|
+
children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
260
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
261
|
+
children: "自定义日期格式"
|
|
262
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
263
|
+
format: "yyyy/MM/dd",
|
|
264
|
+
placeholder: "选择日期 (yyyy/MM/dd)"
|
|
265
|
+
})] }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("p", {
|
|
266
|
+
className: "text-sm text-muted-foreground mb-2",
|
|
267
|
+
children: "自定义日期时间格式"
|
|
268
|
+
}), /* @__PURE__ */ jsx(DatePicker, {
|
|
269
|
+
showTime: true,
|
|
270
|
+
format: "yyyy-MM-dd HH:mm:ss",
|
|
271
|
+
placeholder: "选择日期时间 (yyyy-MM-dd HH:mm:ss)"
|
|
272
|
+
})] })]
|
|
273
|
+
})]
|
|
274
|
+
}),
|
|
275
|
+
/* @__PURE__ */ jsxs("section", {
|
|
276
|
+
className: "space-y-4 border-t pt-6",
|
|
277
|
+
children: [/* @__PURE__ */ jsx("h2", {
|
|
278
|
+
className: "text-xl font-semibold",
|
|
279
|
+
children: "API 说明"
|
|
280
|
+
}), /* @__PURE__ */ jsxs("div", {
|
|
281
|
+
className: "bg-muted/50 p-4 rounded-lg space-y-2 text-sm",
|
|
282
|
+
children: [
|
|
283
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("code", {
|
|
284
|
+
className: "font-semibold",
|
|
285
|
+
children: "showTime"
|
|
286
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
287
|
+
className: "text-muted-foreground ml-2",
|
|
288
|
+
children: ": boolean - 是否显示时间选择器,时间选择器会显示在日历右侧"
|
|
289
|
+
})] }),
|
|
290
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("code", {
|
|
291
|
+
className: "font-semibold",
|
|
292
|
+
children: "mode"
|
|
293
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
294
|
+
className: "text-muted-foreground ml-2",
|
|
295
|
+
children: ": 'single' | 'range' - 选择模式,single 为单日期,range 为日期范围"
|
|
296
|
+
})] }),
|
|
297
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("code", {
|
|
298
|
+
className: "font-semibold",
|
|
299
|
+
children: "value"
|
|
300
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
301
|
+
className: "text-muted-foreground ml-2",
|
|
302
|
+
children: ": string | [string, string] - 受控模式的值"
|
|
303
|
+
})] }),
|
|
304
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("code", {
|
|
305
|
+
className: "font-semibold",
|
|
306
|
+
children: "onChange"
|
|
307
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
308
|
+
className: "text-muted-foreground ml-2",
|
|
309
|
+
children: [
|
|
310
|
+
": (value?: DateChangeStrValue, date?: Date | DateRange) =",
|
|
311
|
+
">",
|
|
312
|
+
" void - 值变化回调"
|
|
313
|
+
]
|
|
314
|
+
})] }),
|
|
315
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("code", {
|
|
316
|
+
className: "font-semibold",
|
|
317
|
+
children: "format"
|
|
318
|
+
}), /* @__PURE__ */ jsx("span", {
|
|
319
|
+
className: "text-muted-foreground ml-2",
|
|
320
|
+
children: ": string - 日期格式,默认 'yyyy-MM-dd',showTime 时为 'yyyy-MM-dd HH:mm'"
|
|
321
|
+
})] }),
|
|
322
|
+
/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx("code", {
|
|
323
|
+
className: "font-semibold",
|
|
324
|
+
children: "disabledDate"
|
|
325
|
+
}), /* @__PURE__ */ jsxs("span", {
|
|
326
|
+
className: "text-muted-foreground ml-2",
|
|
327
|
+
children: [
|
|
328
|
+
": (current: Date) =",
|
|
329
|
+
">",
|
|
330
|
+
" boolean - 禁用日期的判断函数"
|
|
331
|
+
]
|
|
332
|
+
})] })
|
|
333
|
+
]
|
|
334
|
+
})]
|
|
335
|
+
})
|
|
336
|
+
]
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
//#endregion
|
|
340
|
+
export { DateTestPage as default };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { useDateLocaleStore } from "./dateLocaleStore.js";
|
|
2
|
+
//#region packages/react/ui/components/Date/LocaleContext.tsx
|
|
3
|
+
/**
|
|
4
|
+
* Hook for accessing the current Date component locale.
|
|
5
|
+
* Backed by Zustand, so no React Context is required.
|
|
6
|
+
*/
|
|
7
|
+
var useDateLocale = () => {
|
|
8
|
+
return useDateLocaleStore((state) => state.locale);
|
|
9
|
+
};
|
|
10
|
+
//#endregion
|
|
11
|
+
export { useDateLocale };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type ReactNode } from
|
|
2
|
-
import { type DateLocaleConfig } from
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type DateLocaleConfig } from "./locales";
|
|
3
3
|
export interface DateLocaleProviderProps {
|
|
4
4
|
locale?: DateLocaleConfig;
|
|
5
5
|
children: ReactNode;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { defaultLocale } from "./locales.js";
|
|
2
|
+
import { useDateLocaleStore } from "./dateLocaleStore.js";
|
|
3
|
+
import { useEffect } from "react";
|
|
4
|
+
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region packages/react/ui/components/Date/LocaleProvider.tsx
|
|
6
|
+
/**
|
|
7
|
+
* Date 组件文案配置 Provider
|
|
8
|
+
* 用于全局设置 Date 组件的文案
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```tsx
|
|
12
|
+
* <DateLocaleProvider locale={customLocale}>
|
|
13
|
+
* <App />
|
|
14
|
+
* </DateLocaleProvider>
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
function DateLocaleProvider({ locale = defaultLocale, children }) {
|
|
18
|
+
const replaceLocale = useDateLocaleStore((state) => state.replaceLocale);
|
|
19
|
+
const resetLocale = useDateLocaleStore((state) => state.resetLocale);
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
replaceLocale(locale);
|
|
22
|
+
return () => resetLocale();
|
|
23
|
+
}, [
|
|
24
|
+
locale,
|
|
25
|
+
replaceLocale,
|
|
26
|
+
resetLocale
|
|
27
|
+
]);
|
|
28
|
+
return /* @__PURE__ */ jsx(Fragment$1, { children });
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
export { DateLocaleProvider };
|