@_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
|
@@ -1,201 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from "../../lib/utils";
|
|
3
|
-
import { format as formatDate, isValid, parse } from "date-fns";
|
|
4
|
-
import { Calendar as CalendarIcon, X } from "lucide-react";
|
|
5
|
-
import { forwardRef, useEffect, useMemo, useRef, useState } from "react";
|
|
6
|
-
import { Button } from "../Button";
|
|
7
|
-
import { Input } from "../Input";
|
|
8
|
-
import { Popup } from "../Popup";
|
|
9
|
-
import { useDropdownPositioning } from "../hooks/useDropdownPositioning";
|
|
10
|
-
import { Calendar } from "./Calendar";
|
|
11
|
-
import { ModeType } from "./data";
|
|
12
|
-
import { getDatePickerDropdownPosition } from "./dropdownPositioning";
|
|
13
|
-
import { useDateLocale } from "./LocaleContext";
|
|
14
|
-
const formatValue = (val, format) => {
|
|
15
|
-
if (!val)
|
|
16
|
-
return "";
|
|
17
|
-
if (val instanceof Date)
|
|
18
|
-
return formatDate(val, format);
|
|
19
|
-
if ("from" in val) {
|
|
20
|
-
if (val.from && val.to) {
|
|
21
|
-
return `${formatDate(val.from, format)} - ${formatDate(val.to, format)}`;
|
|
22
|
-
}
|
|
23
|
-
if (val.from) {
|
|
24
|
-
return formatDate(val.from, format);
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return "";
|
|
28
|
-
};
|
|
29
|
-
const formatDateValue = (val, format) => {
|
|
30
|
-
if (!val)
|
|
31
|
-
return "";
|
|
32
|
-
/**
|
|
33
|
-
* 将 DateBaseValue 转为 yyyy-MM-dd | [yyyy-MM-dd, yyyy-MM-dd]
|
|
34
|
-
*/
|
|
35
|
-
if (val instanceof Date)
|
|
36
|
-
return formatDate(val, format);
|
|
37
|
-
if ("from" in val) {
|
|
38
|
-
if (val.from && val.to) {
|
|
39
|
-
return [formatDate(val.from, format), formatDate(val.to, format)];
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return "";
|
|
43
|
-
};
|
|
44
|
-
const DatePicker = forwardRef((props, ref) => {
|
|
45
|
-
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;
|
|
46
|
-
const isControlled = Object.prototype.hasOwnProperty.call(props, "value");
|
|
47
|
-
const contextLocale = useDateLocale();
|
|
48
|
-
const locale = { ...contextLocale, ...customLocale };
|
|
49
|
-
// 如果没有传入 placeholder,根据模式自动选择
|
|
50
|
-
const finalPlaceholder = placeholder ||
|
|
51
|
-
(showTime
|
|
52
|
-
? mode === ModeType.Range
|
|
53
|
-
? locale.placeholderDateTimeRange
|
|
54
|
-
: locale.placeholderDateTime
|
|
55
|
-
: mode === ModeType.Range
|
|
56
|
-
? locale.placeholderRange
|
|
57
|
-
: locale.placeholder);
|
|
58
|
-
// Auto-adjust format based on showTime
|
|
59
|
-
const format = customFormat || (showTime ? "yyyy-MM-dd HH:mm" : "yyyy-MM-dd");
|
|
60
|
-
const { value, defaultValue } = useMemo(() => {
|
|
61
|
-
/**
|
|
62
|
-
* 将 DateChangeStrValue 转为 Dates
|
|
63
|
-
*/
|
|
64
|
-
const convertValue = (val) => {
|
|
65
|
-
if (!val)
|
|
66
|
-
return undefined;
|
|
67
|
-
// Already a Date object
|
|
68
|
-
if (val instanceof Date)
|
|
69
|
-
return val;
|
|
70
|
-
// Already a DateRange object
|
|
71
|
-
if (typeof val === "object" && "from" in val)
|
|
72
|
-
return val;
|
|
73
|
-
// String value - single date
|
|
74
|
-
if (typeof val === "string") {
|
|
75
|
-
try {
|
|
76
|
-
const parsed = parse(val, format, new Date());
|
|
77
|
-
return isValid(parsed) ? parsed : undefined;
|
|
78
|
-
}
|
|
79
|
-
catch {
|
|
80
|
-
return undefined;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// date range
|
|
84
|
-
if (Array.isArray(val)) {
|
|
85
|
-
// string
|
|
86
|
-
if (typeof val[0] === "string" && typeof val[1] === "string") {
|
|
87
|
-
try {
|
|
88
|
-
const from = parse(val[0], format, new Date());
|
|
89
|
-
const to = parse(val[1], format, new Date());
|
|
90
|
-
return isValid(from) && isValid(to) ? { from, to } : undefined;
|
|
91
|
-
}
|
|
92
|
-
catch {
|
|
93
|
-
return undefined;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
else {
|
|
97
|
-
return { from: val[0], to: val[1] };
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
return undefined;
|
|
101
|
-
};
|
|
102
|
-
return {
|
|
103
|
-
value: convertValue(pValue),
|
|
104
|
-
defaultValue: convertValue(pDefaultValue),
|
|
105
|
-
};
|
|
106
|
-
}, [pDefaultValue, pValue, format]);
|
|
107
|
-
const initialValue = isControlled ? value : (value || defaultValue);
|
|
108
|
-
const [selectedDate, setSelectedDate] = useState(initialValue);
|
|
109
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
110
|
-
const [inputValue, setInputValue] = useState(formatValue(initialValue, format));
|
|
111
|
-
const [isHover, setIsHover] = useState(false);
|
|
112
|
-
const containerRef = useRef(null);
|
|
113
|
-
const dropdownContentRef = useRef(null);
|
|
114
|
-
const inputRef = useRef(null);
|
|
115
|
-
const rangeDraftRef = useRef(false);
|
|
116
|
-
const positioning = useDropdownPositioning({
|
|
117
|
-
open: isOpen,
|
|
118
|
-
anchorRef: containerRef,
|
|
119
|
-
contentRef: dropdownContentRef,
|
|
120
|
-
placement: "bottom-start",
|
|
121
|
-
offset: 8,
|
|
122
|
-
matchAnchorWidth: false,
|
|
123
|
-
strategy: getDatePickerDropdownPosition,
|
|
124
|
-
});
|
|
125
|
-
// 同步外部 value 变化
|
|
126
|
-
useEffect(() => {
|
|
127
|
-
if (!isControlled)
|
|
128
|
-
return;
|
|
129
|
-
if (mode === ModeType.Range && rangeDraftRef.current && value === undefined) {
|
|
130
|
-
return;
|
|
131
|
-
}
|
|
132
|
-
setSelectedDate(value);
|
|
133
|
-
setInputValue(formatValue(value, format));
|
|
134
|
-
if (mode !== ModeType.Range || !value || !('from' in value) || value.to) {
|
|
135
|
-
rangeDraftRef.current = false;
|
|
136
|
-
}
|
|
137
|
-
}, [isControlled, mode, value, format]);
|
|
138
|
-
const handleSelect = (date) => {
|
|
139
|
-
const newDate = date;
|
|
140
|
-
if (mode === ModeType.Range) {
|
|
141
|
-
// 如果是范围选择,只有当 from 和 to 都存在时才关闭
|
|
142
|
-
if (date && "from" in date && "to" in date && date.from && date.to) {
|
|
143
|
-
setIsOpen(false);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
else {
|
|
147
|
-
// Single mode: always close popup when onChange is triggered
|
|
148
|
-
// (In showTime mode, this only happens when user clicks confirm button)
|
|
149
|
-
setIsOpen(false);
|
|
150
|
-
}
|
|
151
|
-
// range 选择需要保留内部草稿态,避免受控 value 把第一步点击抹掉
|
|
152
|
-
if (mode === ModeType.Range || !isControlled) {
|
|
153
|
-
setSelectedDate(newDate);
|
|
154
|
-
setInputValue(formatValue(newDate, format));
|
|
155
|
-
}
|
|
156
|
-
rangeDraftRef.current =
|
|
157
|
-
mode === ModeType.Range && !(newDate &&
|
|
158
|
-
typeof newDate === 'object' &&
|
|
159
|
-
'from' in newDate &&
|
|
160
|
-
newDate.from &&
|
|
161
|
-
newDate.to);
|
|
162
|
-
onChange?.(formatDateValue(newDate, format), newDate);
|
|
163
|
-
};
|
|
164
|
-
const handleClear = (e) => {
|
|
165
|
-
e.stopPropagation();
|
|
166
|
-
rangeDraftRef.current = false;
|
|
167
|
-
setSelectedDate(undefined);
|
|
168
|
-
setInputValue("");
|
|
169
|
-
onChange?.(undefined, undefined);
|
|
170
|
-
inputRef.current?.focus();
|
|
171
|
-
};
|
|
172
|
-
const handleInputChange = (e) => {
|
|
173
|
-
const newValue = e.target.value;
|
|
174
|
-
setInputValue(newValue);
|
|
175
|
-
if (mode === ModeType.Single) {
|
|
176
|
-
try {
|
|
177
|
-
const parsedDate = parse(newValue, format, new Date());
|
|
178
|
-
if (isValid(parsedDate)) {
|
|
179
|
-
if (!isControlled)
|
|
180
|
-
setSelectedDate(parsedDate);
|
|
181
|
-
onChange?.(formatDateValue(parsedDate, format), parsedDate);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
// ignore invalid date
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
};
|
|
189
|
-
const showClearIcon = allowClear && selectedDate && !disabled && isHover;
|
|
190
|
-
return (_jsx("div", { ref: ref, className: cn("tc-ui-date-picker relative w-full", mode === ModeType.Range ? "min-w-[255px]" : "", className), children: _jsxs("div", { ref: containerRef, className: "relative", children: [_jsxs("div", { className: cn("flex items-center w-full rounded-lg px-4 py-3 text-sm", "border transition-colors duration-200", "bg-background cursor-pointer", disabled &&
|
|
191
|
-
"cursor-not-allowed bg-muted border-border text-muted-foreground", !disabled && !selectedDate && !isOpen && "border-border", !disabled && (selectedDate || isOpen) && "border-theme"), onClick: () => !disabled && setIsOpen(!isOpen), onMouseEnter: () => setIsHover(true), onMouseLeave: () => setIsHover(false), children: [_jsx(Input, { ref: inputRef, type: "text", value: inputValue, onChange: (_, e) => handleInputChange(e), placeholder: finalPlaceholder, disabled: disabled, readOnly: mode === ModeType.Range, className: "flex-1", inputClassName: cn("flex-1 rounded-none border-0 bg-transparent px-0 py-0 outline-none", "text-sm text-foreground placeholder:text-muted-foreground", disabled && "cursor-not-allowed", mode === ModeType.Range &&
|
|
192
|
-
!disabled &&
|
|
193
|
-
"cursor-pointer caret-transparent") }), showClearIcon ? (_jsx(Button, { variant: "text", type: "button", onClick: handleClear, title: locale.clear, "aria-label": locale.clear, className: cn("ml-2 flex items-center justify-center", "w-5 h-5 rounded-full", "bg-muted hover:bg-muted/80", "text-foreground transition-colors", "cursor-pointer"), children: _jsx(X, { size: 12 }) })) : (_jsx(CalendarIcon, { size: 16, className: "ml-2 text-muted-foreground" }))] }), _jsx(Popup, { open: isOpen && !disabled, anchorRef: containerRef, contentRef: dropdownContentRef, positioning: positioning, keepMounted: true, onOpenChange: (nextOpen) => {
|
|
194
|
-
setIsOpen(nextOpen);
|
|
195
|
-
if (!nextOpen) {
|
|
196
|
-
rangeDraftRef.current = false;
|
|
197
|
-
}
|
|
198
|
-
}, className: cn("overflow-hidden"), container: getPopupContainer?.(), children: _jsx("div", { ref: dropdownContentRef, children: _jsx(Calendar, { mode: mode, value: selectedDate || null, onChange: handleSelect, disabledDate: disabledDate, showTime: showTime, locale: locale, quickRanges: quickRanges }) }) })] }) }));
|
|
199
|
-
});
|
|
200
|
-
DatePicker.displayName = "DatePicker";
|
|
201
|
-
export { DatePicker };
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { startOfDay } from 'date-fns';
|
|
3
|
-
import { useState } from 'react';
|
|
4
|
-
import { DatePicker } from './Date';
|
|
5
|
-
export default function DateTestPage() {
|
|
6
|
-
const [date1, setDate1] = useState();
|
|
7
|
-
const [dateTime1, setDateTime1] = useState();
|
|
8
|
-
const [range, setRange] = useState();
|
|
9
|
-
const [rangeWithTime, setRangeWithTime] = useState();
|
|
10
|
-
const [emptyRange, setEmptyRange] = useState();
|
|
11
|
-
return (_jsxs("div", { className: "p-8 max-w-6xl mx-auto space-y-8", children: [_jsxs("div", { children: [_jsx("h1", { className: "text-3xl font-bold mb-2", children: "Date \u7EC4\u4EF6\u4F7F\u7528\u793A\u4F8B" }), _jsx("p", { className: "text-muted-foreground", children: "\u5C55\u793A DatePicker \u7EC4\u4EF6\u7684\u5404\u79CD\u4F7F\u7528\u573A\u666F" })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "1. \u57FA\u672C\u7528\u6CD5" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u5355\u65E5\u671F\u9009\u62E9" }), _jsx(DatePicker, { placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F" })] }), _jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u7981\u7528\u6E05\u9664\u6309\u94AE" }), _jsx(DatePicker, { placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F", allowClear: false })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "2. \u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668 (showTime)" }), _jsx("p", { className: "text-sm text-muted-foreground", children: "\u65F6\u95F4\u9009\u62E9\u5668\u663E\u793A\u5728\u65E5\u5386\u53F3\u4FA7\uFF0C\u63D0\u4F9B\u66F4\u597D\u7684\u7528\u6237\u4F53\u9A8C" }), _jsxs("div", { className: "grid grid-cols-2 gap-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium mb-2", children: "\u57FA\u672C\u7528\u6CD5 - \u5355\u65E5\u671F\u65F6\u95F4" }), _jsx(DatePicker, { showTime: true, placeholder: "\u8BF7\u9009\u62E9\u65E5\u671F\u65F6\u95F4" }), _jsx("p", { className: "text-xs text-muted-foreground mt-2", children: "\u70B9\u51FB\u8F93\u5165\u6846\u6253\u5F00\u9009\u62E9\u5668\uFF0C\u65F6\u95F4\u9009\u62E9\u5668\u5728\u53F3\u4FA7\u663E\u793A" })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium mb-2", children: "\u53D7\u63A7\u6A21\u5F0F" }), _jsx(DatePicker, { showTime: true, value: dateTime1, onChange: (val, date) => {
|
|
12
|
-
setDateTime1(val);
|
|
13
|
-
console.log('选中日期时间:', val);
|
|
14
|
-
console.log('Date 对象:', date);
|
|
15
|
-
}, placeholder: "\u53D7\u63A7\u65E5\u671F\u65F6\u95F4\u9009\u62E9\u5668" }), _jsxs("p", { className: "text-sm text-muted-foreground mt-2", children: ["\u9009\u4E2D\u7684\u503C: ", _jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: String(dateTime1 || '未选择') })] })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "3. \u8303\u56F4\u9009\u62E9 (Range Picker)" }), _jsxs("div", { className: "grid grid-cols-2 gap-8", children: [_jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium mb-2", children: "\u57FA\u672C\u8303\u56F4\u9009\u62E9" }), _jsx(DatePicker, { mode: "range", value: emptyRange, onChange: (val) => {
|
|
16
|
-
setEmptyRange(val);
|
|
17
|
-
console.log('范围选择:', val);
|
|
18
|
-
}, placeholder: "\u9009\u62E9\u65E5\u671F\u8303\u56F4" }), _jsxs("p", { className: "text-sm text-muted-foreground mt-2", children: ["\u503C: ", _jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: JSON.stringify(emptyRange || '未选择') })] })] }), _jsxs("div", { children: [_jsx("h3", { className: "text-sm font-medium mb-2", children: "\u8303\u56F4\u9009\u62E9 + \u65F6\u95F4\u9009\u62E9" }), _jsx(DatePicker, { mode: "range", value: rangeWithTime, showTime: true, onChange: (val) => {
|
|
19
|
-
setRangeWithTime(val);
|
|
20
|
-
console.log('范围时间选择:', val);
|
|
21
|
-
}, placeholder: "\u9009\u62E9\u65E5\u671F\u65F6\u95F4\u8303\u56F4" }), _jsxs("p", { className: "text-sm text-muted-foreground mt-2", children: ["\u503C:", ' ', _jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: JSON.stringify(rangeWithTime || '未选择') })] }), _jsx("p", { className: "text-xs text-muted-foreground mt-1", children: "\u9009\u62E9\u5F00\u59CB\u65E5\u671F\u540E\uFF0C\u53F3\u4FA7\u4F1A\u663E\u793A\u5F00\u59CB\u65F6\u95F4\u9009\u62E9\u5668\uFF1B\u9009\u62E9\u7ED3\u675F\u65E5\u671F\u540E\uFF0C\u4F1A\u663E\u793A\u7ED3\u675F\u65F6\u95F4\u9009\u62E9\u5668" })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "4. \u53D7\u63A7\u6A21\u5F0F" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u5355\u65E5\u671F\u53D7\u63A7" }), _jsx(DatePicker, { value: date1, onChange: (date, dateString) => {
|
|
22
|
-
setDate1(date);
|
|
23
|
-
console.log('选中日期:', date);
|
|
24
|
-
console.log('日期字符串:', dateString);
|
|
25
|
-
}, placeholder: "\u53D7\u63A7\u65E5\u671F\u9009\u62E9\u5668" }), _jsxs("p", { className: "text-sm text-muted-foreground mt-2", children: ["\u9009\u4E2D\u7684\u65E5\u671F: ", _jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: String(date1 || '未选择') })] })] }), _jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u8303\u56F4\u53D7\u63A7" }), _jsx(DatePicker, { mode: "range", value: range, onChange: (val) => {
|
|
26
|
-
setRange(val);
|
|
27
|
-
console.log('范围变化:', val);
|
|
28
|
-
}, placeholder: "\u53D7\u63A7\u8303\u56F4\u9009\u62E9\u5668" }), _jsxs("p", { className: "text-sm text-muted-foreground mt-2", children: ["\u503C: ", _jsx("code", { className: "text-xs bg-muted px-1 py-0.5 rounded", children: JSON.stringify(range || '未选择') })] })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "5. \u7981\u7528\u65E5\u671F" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u53EA\u80FD\u9009\u62E9\u4ECA\u5929\u53CA\u4EE5\u540E" }), _jsx(DatePicker, { disabledDate: (current) => current < startOfDay(new Date()), placeholder: "\u9009\u62E9\u672A\u6765\u65E5\u671F" })] }), _jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u8303\u56F4\u9009\u62E9\uFF08\u7981\u7528\u8FC7\u53BB\uFF09" }), _jsx(DatePicker, { mode: "range", disabledDate: (current) => current < startOfDay(new Date()), placeholder: "\u9009\u62E9\u672A\u6765\u8303\u56F4" })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "6. \u7981\u7528\u72B6\u6001" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u7981\u7528\u72B6\u6001" }), _jsx(DatePicker, { disabled: true, placeholder: "\u7981\u7528\u72B6\u6001" })] }), _jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u7981\u7528\u72B6\u6001 + \u6709\u503C" }), _jsx(DatePicker, { disabled: true, value: "2024-01-15", placeholder: "\u7981\u7528\u72B6\u6001" })] })] })] }), _jsxs("section", { className: "space-y-4", children: [_jsx("h2", { className: "text-xl font-semibold", children: "7. \u81EA\u5B9A\u4E49\u683C\u5F0F" }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u81EA\u5B9A\u4E49\u65E5\u671F\u683C\u5F0F" }), _jsx(DatePicker, { format: "yyyy/MM/dd", placeholder: "\u9009\u62E9\u65E5\u671F (yyyy/MM/dd)" })] }), _jsxs("div", { children: [_jsx("p", { className: "text-sm text-muted-foreground mb-2", children: "\u81EA\u5B9A\u4E49\u65E5\u671F\u65F6\u95F4\u683C\u5F0F" }), _jsx(DatePicker, { showTime: true, format: "yyyy-MM-dd HH:mm:ss", placeholder: "\u9009\u62E9\u65E5\u671F\u65F6\u95F4 (yyyy-MM-dd HH:mm:ss)" })] })] })] }), _jsxs("section", { className: "space-y-4 border-t pt-6", children: [_jsx("h2", { className: "text-xl font-semibold", children: "API \u8BF4\u660E" }), _jsxs("div", { className: "bg-muted/50 p-4 rounded-lg space-y-2 text-sm", children: [_jsxs("div", { children: [_jsx("code", { className: "font-semibold", children: "showTime" }), _jsx("span", { className: "text-muted-foreground ml-2", children: ": boolean - \u662F\u5426\u663E\u793A\u65F6\u95F4\u9009\u62E9\u5668\uFF0C\u65F6\u95F4\u9009\u62E9\u5668\u4F1A\u663E\u793A\u5728\u65E5\u5386\u53F3\u4FA7" })] }), _jsxs("div", { children: [_jsx("code", { className: "font-semibold", children: "mode" }), _jsx("span", { className: "text-muted-foreground ml-2", children: ": 'single' | 'range' - \u9009\u62E9\u6A21\u5F0F\uFF0Csingle \u4E3A\u5355\u65E5\u671F\uFF0Crange \u4E3A\u65E5\u671F\u8303\u56F4" })] }), _jsxs("div", { children: [_jsx("code", { className: "font-semibold", children: "value" }), _jsx("span", { className: "text-muted-foreground ml-2", children: ": string | [string, string] - \u53D7\u63A7\u6A21\u5F0F\u7684\u503C" })] }), _jsxs("div", { children: [_jsx("code", { className: "font-semibold", children: "onChange" }), _jsxs("span", { className: "text-muted-foreground ml-2", children: [": (value?: DateChangeStrValue, date?: Date | DateRange) =", '>', " void - \u503C\u53D8\u5316\u56DE\u8C03"] })] }), _jsxs("div", { children: [_jsx("code", { className: "font-semibold", children: "format" }), _jsx("span", { className: "text-muted-foreground ml-2", children: ": string - \u65E5\u671F\u683C\u5F0F\uFF0C\u9ED8\u8BA4 'yyyy-MM-dd'\uFF0CshowTime \u65F6\u4E3A 'yyyy-MM-dd HH:mm'" })] }), _jsxs("div", { children: [_jsx("code", { className: "font-semibold", children: "disabledDate" }), _jsxs("span", { className: "text-muted-foreground ml-2", children: [": (current: Date) =", '>', " boolean - \u7981\u7528\u65E5\u671F\u7684\u5224\u65AD\u51FD\u6570"] })] })] })] })] }));
|
|
29
|
-
}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { useDateLocaleStore } from './dateLocaleStore';
|
|
2
|
-
/**
|
|
3
|
-
* Hook for accessing the current Date component locale.
|
|
4
|
-
* Backed by Zustand, so no React Context is required.
|
|
5
|
-
*/
|
|
6
|
-
export const useDateLocale = () => {
|
|
7
|
-
return useDateLocaleStore((state) => state.locale);
|
|
8
|
-
};
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useEffect } from 'react';
|
|
3
|
-
import { useDateLocaleStore } from './dateLocaleStore';
|
|
4
|
-
import { defaultLocale } from './locales';
|
|
5
|
-
/**
|
|
6
|
-
* Date 组件文案配置 Provider
|
|
7
|
-
* 用于全局设置 Date 组件的文案
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```tsx
|
|
11
|
-
* <DateLocaleProvider locale={customLocale}>
|
|
12
|
-
* <App />
|
|
13
|
-
* </DateLocaleProvider>
|
|
14
|
-
* ```
|
|
15
|
-
*/
|
|
16
|
-
export function DateLocaleProvider({ locale = defaultLocale, children }) {
|
|
17
|
-
const replaceLocale = useDateLocaleStore((state) => state.replaceLocale);
|
|
18
|
-
const resetLocale = useDateLocaleStore((state) => state.resetLocale);
|
|
19
|
-
useEffect(() => {
|
|
20
|
-
replaceLocale(locale);
|
|
21
|
-
return () => resetLocale();
|
|
22
|
-
}, [locale, replaceLocale, resetLocale]);
|
|
23
|
-
return _jsx(_Fragment, { children: children });
|
|
24
|
-
}
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../../lib/utils';
|
|
3
|
-
import { ChevronDown, ChevronUp } from 'lucide-react';
|
|
4
|
-
import { Button } from '../Button';
|
|
5
|
-
import { Input } from '../Input';
|
|
6
|
-
export function TimePicker({ value, onChange, className }) {
|
|
7
|
-
// Derive time from value prop directly
|
|
8
|
-
const hours = value?.getHours() ?? 0;
|
|
9
|
-
const minutes = value?.getMinutes() ?? 0;
|
|
10
|
-
const handleTimeChange = (newHours, newMinutes) => {
|
|
11
|
-
const newDate = value ? new Date(value) : new Date();
|
|
12
|
-
newDate.setHours(newHours);
|
|
13
|
-
newDate.setMinutes(newMinutes);
|
|
14
|
-
newDate.setSeconds(0);
|
|
15
|
-
newDate.setMilliseconds(0);
|
|
16
|
-
onChange?.(newDate);
|
|
17
|
-
};
|
|
18
|
-
const incrementHours = () => {
|
|
19
|
-
const newHours = (hours + 1) % 24;
|
|
20
|
-
handleTimeChange(newHours, minutes);
|
|
21
|
-
};
|
|
22
|
-
const decrementHours = () => {
|
|
23
|
-
const newHours = (hours - 1 + 24) % 24;
|
|
24
|
-
handleTimeChange(newHours, minutes);
|
|
25
|
-
};
|
|
26
|
-
const incrementMinutes = () => {
|
|
27
|
-
const newMinutes = (minutes + 1) % 60;
|
|
28
|
-
handleTimeChange(hours, newMinutes);
|
|
29
|
-
};
|
|
30
|
-
const decrementMinutes = () => {
|
|
31
|
-
const newMinutes = (minutes - 1 + 60) % 60;
|
|
32
|
-
handleTimeChange(hours, newMinutes);
|
|
33
|
-
};
|
|
34
|
-
const handleHoursInput = (e) => {
|
|
35
|
-
const val = e.target.value.replace(/\D/g, '');
|
|
36
|
-
if (val === '') {
|
|
37
|
-
handleTimeChange(0, minutes);
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
const num = parseInt(val, 10);
|
|
41
|
-
if (num >= 0 && num <= 23) {
|
|
42
|
-
handleTimeChange(num, minutes);
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
const handleMinutesInput = (e) => {
|
|
46
|
-
const val = e.target.value.replace(/\D/g, '');
|
|
47
|
-
if (val === '') {
|
|
48
|
-
handleTimeChange(hours, 0);
|
|
49
|
-
return;
|
|
50
|
-
}
|
|
51
|
-
const num = parseInt(val, 10);
|
|
52
|
-
if (num >= 0 && num <= 59) {
|
|
53
|
-
handleTimeChange(hours, num);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
const handleHoursKeyDown = (e) => {
|
|
57
|
-
if (e.key === 'ArrowUp') {
|
|
58
|
-
e.preventDefault();
|
|
59
|
-
incrementHours();
|
|
60
|
-
}
|
|
61
|
-
else if (e.key === 'ArrowDown') {
|
|
62
|
-
e.preventDefault();
|
|
63
|
-
decrementHours();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const handleMinutesKeyDown = (e) => {
|
|
67
|
-
if (e.key === 'ArrowUp') {
|
|
68
|
-
e.preventDefault();
|
|
69
|
-
incrementMinutes();
|
|
70
|
-
}
|
|
71
|
-
else if (e.key === 'ArrowDown') {
|
|
72
|
-
e.preventDefault();
|
|
73
|
-
decrementMinutes();
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
const formatNumber = (num) => String(num).padStart(2, '0');
|
|
77
|
-
return (_jsxs("div", { className: cn('tc-ui-time-picker flex items-center justify-center gap-3 py-3', className), children: [_jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx(Button, { variant: "text", type: "button", onClick: incrementHours, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronUp, { size: 14 }) }), _jsx(Input, { type: "text", value: formatNumber(hours), onChange: (_, e) => handleHoursInput(e), onKeyDown: handleHoursKeyDown, className: "w-12", inputClassName: cn('w-12 h-9 px-0 py-0 text-center text-sm font-medium', 'border border-border rounded', 'bg-background text-foreground', 'focus:outline-none focus:border-theme', 'transition-colors'), maxLength: 2 }), _jsx(Button, { variant: "text", type: "button", onClick: decrementHours, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronDown, { size: 14 }) })] }), _jsx("div", { className: "text-lg font-medium text-foreground mb-1", children: ":" }), _jsxs("div", { className: "flex flex-col items-center gap-1", children: [_jsx(Button, { variant: "text", type: "button", onClick: incrementMinutes, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronUp, { size: 14 }) }), _jsx(Input, { type: "text", value: formatNumber(minutes), onChange: (_, e) => handleMinutesInput(e), onKeyDown: handleMinutesKeyDown, className: "w-12", inputClassName: cn('w-12 h-9 px-0 py-0 text-center text-sm font-medium', 'border border-border rounded', 'bg-background text-foreground', 'focus:outline-none focus:border-theme', 'transition-colors'), maxLength: 2 }), _jsx(Button, { variant: "text", type: "button", onClick: decrementMinutes, className: "p-1 hover:bg-muted rounded transition-colors text-muted-foreground hover:text-foreground", children: _jsx(ChevronDown, { size: 14 }) })] })] }));
|
|
78
|
-
}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { create } from 'zustand';
|
|
2
|
-
import { defaultLocale } from './locales';
|
|
3
|
-
export const useDateLocaleStore = create((set) => ({
|
|
4
|
-
locale: defaultLocale,
|
|
5
|
-
setLocale: (patch) => set((state) => ({
|
|
6
|
-
locale: { ...state.locale, ...patch },
|
|
7
|
-
})),
|
|
8
|
-
replaceLocale: (nextLocale) => set(() => ({
|
|
9
|
-
locale: nextLocale,
|
|
10
|
-
})),
|
|
11
|
-
resetLocale: () => set(() => ({
|
|
12
|
-
locale: defaultLocale,
|
|
13
|
-
})),
|
|
14
|
-
}));
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
export const getDatePickerDropdownPosition = ({ anchorRect, contentRect, viewportHeight, offset, }) => {
|
|
2
|
-
const contentHeight = contentRect?.height ?? 360;
|
|
3
|
-
const spaceBelow = viewportHeight - anchorRect.bottom;
|
|
4
|
-
const spaceAbove = anchorRect.top;
|
|
5
|
-
const shouldFlipUp = spaceBelow < contentHeight && spaceAbove > spaceBelow;
|
|
6
|
-
return {
|
|
7
|
-
top: shouldFlipUp
|
|
8
|
-
? anchorRect.top - contentHeight - offset
|
|
9
|
-
: anchorRect.bottom + offset,
|
|
10
|
-
left: anchorRect.left,
|
|
11
|
-
};
|
|
12
|
-
};
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { defaultEnglishResources, defaultLanguageResources } from '../../../../common/i18n';
|
|
2
|
-
const dateDefaultLocale = defaultLanguageResources.components.date;
|
|
3
|
-
const dateDefaultEnglishLocale = defaultEnglishResources.components.date;
|
|
4
|
-
/**
|
|
5
|
-
* 默认中文文案
|
|
6
|
-
*/
|
|
7
|
-
export const zhCNLocale = {
|
|
8
|
-
...dateDefaultLocale,
|
|
9
|
-
weekDays: [...dateDefaultLocale.weekDays],
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* 默认英文文案
|
|
13
|
-
*/
|
|
14
|
-
export const enUSLocale = {
|
|
15
|
-
...dateDefaultEnglishLocale,
|
|
16
|
-
weekDays: [...dateDefaultEnglishLocale.weekDays],
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* 默认使用中文文案
|
|
20
|
-
*/
|
|
21
|
-
export const defaultLocale = zhCNLocale;
|
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useI18n } from '../../i18n';
|
|
3
|
-
import { cn } from '../../lib/utils';
|
|
4
|
-
import { X } from 'lucide-react';
|
|
5
|
-
import { useEffect, useRef, useState } from 'react';
|
|
6
|
-
import { Button } from '../Button';
|
|
7
|
-
import { Overlay } from '../Overlay';
|
|
8
|
-
const DRAWER_ANIMATION_DURATION = 320;
|
|
9
|
-
const DRAWER_ANIMATION_EASING = 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
10
|
-
const getDrawerPositionClassName = (placement) => {
|
|
11
|
-
const positionClassNames = {
|
|
12
|
-
top: 'left-0 right-0 top-0',
|
|
13
|
-
right: 'bottom-0 right-0 top-0',
|
|
14
|
-
bottom: 'bottom-0 left-0 right-0',
|
|
15
|
-
left: 'bottom-0 left-0 top-0',
|
|
16
|
-
};
|
|
17
|
-
return positionClassNames[placement];
|
|
18
|
-
};
|
|
19
|
-
const getDrawerTransform = (placement, open) => {
|
|
20
|
-
if (open)
|
|
21
|
-
return 'translate3d(0, 0, 0)';
|
|
22
|
-
const transforms = {
|
|
23
|
-
top: 'translate3d(0, -100%, 0)',
|
|
24
|
-
right: 'translate3d(100%, 0, 0)',
|
|
25
|
-
bottom: 'translate3d(0, 100%, 0)',
|
|
26
|
-
left: 'translate3d(-100%, 0, 0)',
|
|
27
|
-
};
|
|
28
|
-
return transforms[placement];
|
|
29
|
-
};
|
|
30
|
-
const getDrawerSizeStyle = (placement, width, height) => {
|
|
31
|
-
const isHorizontal = placement === 'left' || placement === 'right';
|
|
32
|
-
const size = isHorizontal ? width : height;
|
|
33
|
-
const resolvedSize = typeof size === 'number' ? `${size}px` : size;
|
|
34
|
-
return isHorizontal ? { width: resolvedSize } : { height: resolvedSize };
|
|
35
|
-
};
|
|
36
|
-
export function Drawer({ open = false, onClose, title, children, footer, className, contentClassName, mask = true, maskClosable = true, lockScroll = true, closable = true, placement = 'right', width = 420, height = 360, renderNode, keyboard = true, zIndex = 1000, }) {
|
|
37
|
-
const t = useI18n();
|
|
38
|
-
const [mounted, setMounted] = useState(open);
|
|
39
|
-
const [visible, setVisible] = useState(false);
|
|
40
|
-
const animationFrameRef = useRef(undefined);
|
|
41
|
-
const secondAnimationFrameRef = useRef(undefined);
|
|
42
|
-
const closeTimerRef = useRef(undefined);
|
|
43
|
-
useEffect(() => {
|
|
44
|
-
if (animationFrameRef.current) {
|
|
45
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
46
|
-
animationFrameRef.current = undefined;
|
|
47
|
-
}
|
|
48
|
-
if (secondAnimationFrameRef.current) {
|
|
49
|
-
cancelAnimationFrame(secondAnimationFrameRef.current);
|
|
50
|
-
secondAnimationFrameRef.current = undefined;
|
|
51
|
-
}
|
|
52
|
-
if (closeTimerRef.current) {
|
|
53
|
-
clearTimeout(closeTimerRef.current);
|
|
54
|
-
closeTimerRef.current = undefined;
|
|
55
|
-
}
|
|
56
|
-
if (open) {
|
|
57
|
-
setMounted(true);
|
|
58
|
-
animationFrameRef.current = requestAnimationFrame(() => {
|
|
59
|
-
secondAnimationFrameRef.current = requestAnimationFrame(() => {
|
|
60
|
-
setVisible(true);
|
|
61
|
-
secondAnimationFrameRef.current = undefined;
|
|
62
|
-
});
|
|
63
|
-
animationFrameRef.current = undefined;
|
|
64
|
-
});
|
|
65
|
-
return () => {
|
|
66
|
-
if (animationFrameRef.current) {
|
|
67
|
-
cancelAnimationFrame(animationFrameRef.current);
|
|
68
|
-
animationFrameRef.current = undefined;
|
|
69
|
-
}
|
|
70
|
-
if (secondAnimationFrameRef.current) {
|
|
71
|
-
cancelAnimationFrame(secondAnimationFrameRef.current);
|
|
72
|
-
secondAnimationFrameRef.current = undefined;
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
setVisible(false);
|
|
77
|
-
closeTimerRef.current = setTimeout(() => {
|
|
78
|
-
setMounted(false);
|
|
79
|
-
closeTimerRef.current = undefined;
|
|
80
|
-
}, DRAWER_ANIMATION_DURATION);
|
|
81
|
-
return () => {
|
|
82
|
-
if (closeTimerRef.current) {
|
|
83
|
-
clearTimeout(closeTimerRef.current);
|
|
84
|
-
closeTimerRef.current = undefined;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
}, [open]);
|
|
88
|
-
const handleContentClick = (e) => {
|
|
89
|
-
e.stopPropagation();
|
|
90
|
-
};
|
|
91
|
-
const drawerStyle = {
|
|
92
|
-
...getDrawerSizeStyle(placement, width, height),
|
|
93
|
-
transform: getDrawerTransform(placement, visible),
|
|
94
|
-
transition: `transform ${DRAWER_ANIMATION_DURATION}ms ${DRAWER_ANIMATION_EASING}`,
|
|
95
|
-
willChange: 'transform',
|
|
96
|
-
};
|
|
97
|
-
return (_jsx(Overlay, { open: mounted, visible: visible, onClose: onClose, mask: mask, maskClosable: maskClosable, lockScroll: lockScroll, keyboard: keyboard, closable: closable, renderNode: renderNode, zIndex: zIndex, className: "tc-ui-drawer", style: {
|
|
98
|
-
transition: `opacity ${DRAWER_ANIMATION_DURATION}ms ${DRAWER_ANIMATION_EASING}`,
|
|
99
|
-
}, children: _jsxs("div", { className: cn('fixed bg-background shadow-lg', 'flex flex-col', getDrawerPositionClassName(placement), placement === 'top' || placement === 'bottom' ? 'max-h-[90vh]' : 'max-w-[90vw]', className), style: drawerStyle, onClick: handleContentClick, children: [(title || closable) && (_jsxs("div", { className: "flex items-center justify-between px-6 py-4 border-border", children: [title && _jsx("div", { className: "text-lg font-semibold text-foreground", children: title }), closable && (_jsx(Button, { variant: "text", type: "button", onClick: onClose, "aria-label": t('components.modal.close'), className: cn('ml-auto p-1 rounded-md', 'text-muted-foreground hover:text-foreground', 'hover:bg-muted', 'transition-colors', 'focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2'), children: _jsx(X, { size: 20 }) }))] })), _jsx("div", { className: cn('flex-1 overflow-auto px-6 py-4', contentClassName), children: children }), footer && _jsx("div", { className: "px-6 py-4 border-border", children: footer })] }) }));
|
|
100
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { Drawer } from './Drawer';
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../../lib/utils';
|
|
3
|
-
import { Fragment, useCallback, useRef, useState } from 'react';
|
|
4
|
-
import { Button } from '../Button';
|
|
5
|
-
import { Popup } from '../Popup';
|
|
6
|
-
const isDropdownRenderItem = (item) => 'render' in item;
|
|
7
|
-
export function Dropdown({ items, children, className, placement = 'bottom-end', getPopupContainer }) {
|
|
8
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
9
|
-
const triggerRef = useRef(null);
|
|
10
|
-
const handleToggle = useCallback(() => {
|
|
11
|
-
setIsOpen((prev) => !prev);
|
|
12
|
-
}, []);
|
|
13
|
-
const handleItemClick = useCallback((item) => {
|
|
14
|
-
if (!isDropdownRenderItem(item)) {
|
|
15
|
-
item.onClick?.();
|
|
16
|
-
}
|
|
17
|
-
setIsOpen(false);
|
|
18
|
-
}, []);
|
|
19
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: triggerRef, className: cn('tc-ui-dropdown relative inline-block', className), children: _jsx("div", { onClick: handleToggle, children: children }) }), _jsx(Popup, { open: isOpen, anchorRef: triggerRef, placement: placement, onOpenChange: setIsOpen, container: getPopupContainer?.(), className: cn('min-w-10', 'py-1'), children: items.map((item, index) => {
|
|
20
|
-
const onClick = () => handleItemClick(item);
|
|
21
|
-
const close = () => setIsOpen(false);
|
|
22
|
-
const key = isDropdownRenderItem(item) ? index : item.key;
|
|
23
|
-
if (isDropdownRenderItem(item)) {
|
|
24
|
-
return _jsx(Fragment, { children: item.render(item, { onClick, close }) }, key);
|
|
25
|
-
}
|
|
26
|
-
return (_jsx(Button, { type: "button", variant: "text", state: item.danger ? 'danger' : undefined, onClick: onClick, className: cn('flex w-full items-center gap-2 px-4 py-2.5 text-left text-sm transition-colors', item.danger ? 'text-red-600 hover:bg-red-50' : 'text-gray-700 hover:bg-gray-50'), children: _jsxs(_Fragment, { children: [item.icon && _jsx("span", { className: "flex-shrink-0", children: item.icon }), _jsx("span", { children: item.label })] }) }, key));
|
|
27
|
-
}) })] }));
|
|
28
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './Dropdown';
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../../lib/utils';
|
|
3
|
-
import RcForm from 'rc-field-form';
|
|
4
|
-
const Form = ({ className, children, ...props }) => {
|
|
5
|
-
return (_jsx(RcForm, { ...props, component: "form", className: cn('tc-ui-form', className), children: children }));
|
|
6
|
-
};
|
|
7
|
-
Form.displayName = 'Form';
|
|
8
|
-
export { Form };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../../lib/utils';
|
|
3
|
-
import { Field } from 'rc-field-form';
|
|
4
|
-
import React, { forwardRef } from 'react';
|
|
5
|
-
import Label from '../Label';
|
|
6
|
-
const FormItemFN = forwardRef(({ className, label, labelClassName, required, children, errorClassName, showError = true, name, rules, layout, ...props }, ref) => {
|
|
7
|
-
return (_jsx(Field, { name: name, rules: rules, ...props, children: (control, meta /** form */) => {
|
|
8
|
-
const { value, onChange, ...restControl } = control;
|
|
9
|
-
const { errors, warnings } = meta;
|
|
10
|
-
const hasError = errors.length > 0;
|
|
11
|
-
const hasWarning = warnings.length > 0;
|
|
12
|
-
// 如果 children 是函数,调用它并传入 value、onChange 和 meta
|
|
13
|
-
const childNode = typeof children === 'function' ? children(value, onChange, meta) : children;
|
|
14
|
-
// 克隆子元素并注入 value 和 onChange
|
|
15
|
-
const childWithProps = childNode && typeof childNode === 'object' && 'props' in childNode
|
|
16
|
-
? React.cloneElement(childNode, {
|
|
17
|
-
value: value,
|
|
18
|
-
onChange: (val) => {
|
|
19
|
-
// 兼容 Input 组件的 onChange(value, event) 格式
|
|
20
|
-
// Input 组件的 onChange 签名是: (value: string, event: ChangeEvent) => void
|
|
21
|
-
if (typeof val === 'string') {
|
|
22
|
-
// 如果第一个参数是字符串,说明是 Input 组件的格式
|
|
23
|
-
onChange(val);
|
|
24
|
-
}
|
|
25
|
-
else if (val?.target?.value !== undefined) {
|
|
26
|
-
// 原生 input 的 onChange 事件格式
|
|
27
|
-
onChange(val.target.value);
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// 其他情况直接使用值
|
|
31
|
-
onChange(val);
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
...restControl,
|
|
35
|
-
})
|
|
36
|
-
: childNode;
|
|
37
|
-
const content = _jsx("div", { className: hasError || hasWarning ? 'relative' : '', children: childWithProps });
|
|
38
|
-
return (_jsxs("div", { ref: ref, className: cn('tc-ui-form-item', className), children: [label ? (_jsx(Label, { htmlFor: name, label: label, layout: layout, required: required, labelClassName: cn(labelClassName, hasError && 'text-destructive'), children: content })) : (content), showError && hasError && (_jsx("div", { className: cn('text-sm text-destructive', errorClassName), children: errors[0] })), hasWarning && _jsx("div", { className: "text-sm text-yellow-600", children: warnings[0] })] }));
|
|
39
|
-
} }));
|
|
40
|
-
});
|
|
41
|
-
FormItemFN.displayName = 'FormItem';
|
|
42
|
-
const FormItem = FormItemFN;
|
|
43
|
-
export { FormItem };
|