@_tc/template-core 0.0.1-bate.36 → 0.0.1-bate.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/app/controller/base.js +3 -3
- package/cjs/app/controller/project.js +1 -1
- package/cjs/app/controller/view.js +16 -7
- package/cjs/app/middleware/api-params-verify.js +10 -1
- package/cjs/app/middleware/error-handle.js +9 -3
- package/cjs/app/middleware/project-handler.js +1 -1
- package/cjs/app/router/view.js +3 -1
- package/cjs/app/router-schema/project.js +1 -1
- package/cjs/app/service/project.js +5 -0
- package/cjs/bundler/defaultAlias.js +5 -0
- package/cjs/bundler/dev.js +4 -3
- package/cjs/bundler/index.js +2 -1
- package/cjs/bundler/prod.js +4 -3
- package/cjs/bundler/utils.js +52 -23
- package/cjs/packages/common/LRUCache.js +4 -0
- package/cjs/packages/common/array/index.js +43 -0
- package/cjs/packages/common/cache/LRUCache.js +45 -0
- package/cjs/packages/common/cache/index.js +4 -0
- package/cjs/packages/common/guards/index.js +34 -0
- package/cjs/packages/common/i18n/default.js +95 -0
- package/cjs/packages/common/i18n/en-US.js +95 -0
- package/cjs/packages/common/i18n/index.js +178 -0
- package/cjs/packages/common/i18n/locales.js +17 -0
- package/cjs/packages/common/i18n/types.js +1 -0
- package/cjs/packages/common/index.js +65 -0
- package/cjs/packages/common/log/index.js +160 -0
- package/cjs/packages/common/number/index.js +14 -0
- package/cjs/packages/common/object/filterEmpty.js +32 -0
- package/cjs/packages/common/object/filtereEmpty.js +5 -0
- package/cjs/packages/common/object/index.js +26 -0
- package/cjs/packages/common/string/index.js +17 -0
- package/cjs/packages/common/types/index.js +1 -0
- package/cjs/packages/core/index.js +18 -13
- package/cjs/packages/core/loader/config.js +4 -2
- package/cjs/packages/core/loader/controller.js +2 -3
- package/cjs/packages/core/loader/extend.js +1 -2
- package/cjs/packages/core/loader/middleware.js +2 -3
- package/cjs/packages/core/loader/model.js +10 -6
- package/cjs/packages/core/loader/router-schema.js +4 -2
- package/cjs/packages/core/loader/router.js +24 -11
- package/cjs/packages/core/loader/service.js +2 -2
- package/cjs/packages/utils/runFileFn.js +46 -1
- package/esm/app/controller/base.js +3 -3
- package/esm/app/controller/project.js +3 -3
- package/esm/app/controller/view.js +16 -7
- package/esm/app/middleware/api-params-verify.js +10 -1
- package/esm/app/middleware/error-handle.js +9 -3
- package/esm/app/middleware/project-handler.js +1 -1
- package/esm/app/router/view.js +3 -1
- package/esm/app/router-schema/project.js +1 -1
- package/esm/app/service/project.js +5 -0
- package/esm/bundler/defaultAlias.js +4 -0
- package/esm/bundler/dev.js +4 -3
- package/esm/bundler/index.js +2 -1
- package/esm/bundler/prod.js +4 -3
- package/esm/bundler/utils.js +52 -23
- package/esm/index.js +2 -2
- package/esm/packages/common/LRUCache.js +2 -0
- package/esm/packages/common/array/index.js +37 -0
- package/esm/packages/common/cache/LRUCache.js +43 -0
- package/esm/packages/common/cache/index.js +2 -0
- package/esm/packages/common/guards/index.js +26 -0
- package/esm/packages/common/i18n/default.js +93 -0
- package/esm/packages/common/i18n/en-US.js +93 -0
- package/esm/packages/common/i18n/index.js +162 -0
- package/esm/packages/common/i18n/locales.js +11 -0
- package/esm/packages/common/i18n/types.js +0 -0
- package/esm/packages/common/index.js +13 -0
- package/esm/packages/common/log/index.js +146 -0
- package/esm/packages/common/number/index.js +11 -0
- package/esm/packages/common/object/filterEmpty.js +29 -0
- package/esm/packages/common/object/filtereEmpty.js +2 -0
- package/esm/packages/common/object/index.js +20 -0
- package/esm/packages/common/string/index.js +13 -0
- package/esm/packages/common/types/index.js +0 -0
- package/esm/packages/core/index.js +18 -14
- package/esm/packages/core/loader/config.js +4 -3
- package/esm/packages/core/loader/controller.js +2 -4
- package/esm/packages/core/loader/extend.js +1 -3
- package/esm/packages/core/loader/middleware.js +2 -4
- package/esm/packages/core/loader/model.js +10 -7
- package/esm/packages/core/loader/router-schema.js +4 -3
- package/esm/packages/core/loader/router.js +24 -12
- package/esm/packages/core/loader/service.js +2 -3
- package/esm/packages/utils/runFileFn.js +47 -1
- package/fe/frontend/dash/Dashboard.d.ts +7 -0
- package/fe/frontend/dash/Dashboard.js +73 -0
- package/fe/frontend/dash/dash.entry.d.ts +2 -0
- package/fe/frontend/dash/dash.entry.js +80 -0
- package/fe/frontend/index.d.ts +3 -0
- package/fe/frontend/index.js +1 -0
- package/fe/frontend/main.css +2 -184
- package/fe/frontend/main.d.ts +10 -3
- package/fe/frontend/main.js +15 -4
- package/fe/frontend/testPage/testPage.entry.js +1 -2
- package/fe/frontend/typing/window.d.ts +7 -0
- package/fe/frontend/typing/window.js +1 -0
- package/fe/frontend/widgets/api/baseInfo.d.ts +31 -0
- package/fe/frontend/widgets/api/baseInfo.js +15 -0
- package/fe/frontend/widgets/common/CRUD/CRUD.d.ts +70 -0
- package/fe/frontend/widgets/common/CRUD/CRUD.js +208 -0
- package/fe/frontend/widgets/common/CRUD/index.d.ts +2 -0
- package/fe/frontend/widgets/common/CRUD/index.js +1 -0
- package/fe/frontend/widgets/common/auth/index.d.ts +7 -0
- package/fe/frontend/widgets/common/auth/index.js +20 -0
- package/fe/frontend/widgets/common/generateMenuData.d.ts +4 -0
- package/fe/frontend/widgets/common/generateMenuData.js +14 -0
- package/fe/frontend/widgets/common/importComponent.d.ts +5 -0
- package/fe/frontend/widgets/common/importComponent.js +8 -0
- package/fe/frontend/widgets/common/language.d.ts +2 -0
- package/fe/frontend/widgets/common/language.js +9 -0
- package/fe/frontend/widgets/common/logFn/index.d.ts +4 -0
- package/fe/frontend/widgets/common/logFn/index.js +8 -0
- package/fe/frontend/widgets/common/menu.d.ts +34 -0
- package/fe/frontend/widgets/common/menu.js +101 -0
- package/fe/frontend/widgets/common/request.d.ts +36 -0
- package/fe/frontend/widgets/common/request.js +133 -0
- package/fe/frontend/widgets/components/BasePage/HeaderView.d.ts +9 -0
- package/fe/frontend/widgets/components/BasePage/HeaderView.js +16 -0
- package/fe/frontend/widgets/components/Router/index.d.ts +9 -0
- package/fe/frontend/widgets/components/Router/index.js +11 -0
- package/fe/frontend/widgets/components/Router/type.d.ts +2 -0
- package/fe/frontend/widgets/components/Router/type.js +1 -0
- package/fe/frontend/widgets/defaultPages/Iframe/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Iframe/index.js +14 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.d.ts +7 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/DetailPanel.js +94 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.d.ts +13 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/PopFrom.js +124 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/CallCom/data.js +6 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaSearch/index.js +63 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.d.ts +11 -0
- package/fe/frontend/widgets/defaultPages/Schema/components/SchemaTable/index.js +188 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.d.ts +8 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/eventInfo.js +6 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/data/index.js +1 -0
- package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.d.ts +10 -0
- package/fe/frontend/widgets/defaultPages/Schema/hooks/useComConfig.js +14 -0
- package/fe/frontend/widgets/defaultPages/Schema/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/index.js +74 -0
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.d.ts +50 -0
- package/fe/frontend/widgets/defaultPages/Schema/schemaType.js +4 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.d.ts +42 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaEventBus.js +70 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.d.ts +47 -0
- package/fe/frontend/widgets/defaultPages/Schema/stores/schemaStore.js +26 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/fetchErrorShow.js +8 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/permissions.js +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/schemaConversion.js +115 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.d.ts +7 -0
- package/fe/frontend/widgets/defaultPages/Schema/utils/validator.js +36 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.d.ts +10 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/SidebarSlotContainer.js +38 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPage/index.js +16 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SidebarSlotPageTmp.js +17 -0
- package/fe/frontend/widgets/defaultPages/SlotPage/index.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/SlotPage/index.js +26 -0
- package/fe/frontend/widgets/defaultPages/Todo.d.ts +3 -0
- package/fe/frontend/widgets/defaultPages/Todo.js +5 -0
- package/fe/frontend/widgets/hooks/useCurrentMenuData.d.ts +19 -0
- package/fe/frontend/widgets/hooks/useCurrentMenuData.js +28 -0
- package/fe/frontend/widgets/hooks/useRouterParams.d.ts +5 -0
- package/fe/frontend/widgets/hooks/useRouterParams.js +11 -0
- package/fe/frontend/widgets/store/mode.d.ts +19 -0
- package/fe/frontend/widgets/store/mode.js +37 -0
- package/fe/model/types/data/button.d.ts +32 -0
- package/fe/model/types/data/button.js +16 -0
- package/fe/model/types/data/component.d.ts +61 -0
- package/fe/model/types/data/component.js +11 -0
- package/fe/model/types/data/fetchInfo.d.ts +20 -0
- package/fe/model/types/data/fetchInfo.js +1 -0
- package/fe/model/types/data/schema.d.ts +98 -0
- package/fe/model/types/data/schema.js +1 -0
- package/fe/model/types/data/search.d.ts +7 -0
- package/fe/model/types/data/search.js +1 -0
- package/fe/model/types/menuType.d.ts +73 -0
- package/fe/model/types/menuType.js +1 -0
- package/fe/model/types/model.d.ts +33 -0
- package/fe/model/types/model.js +1 -0
- package/fe/packages/common/array/index.d.ts +7 -0
- package/fe/packages/common/array/index.js +40 -0
- package/fe/packages/common/cache/LRUCache.d.ts +13 -0
- package/fe/packages/common/cache/LRUCache.js +47 -0
- package/fe/packages/common/cache/index.d.ts +2 -0
- package/fe/packages/common/cache/index.js +1 -0
- package/fe/packages/common/guards/index.d.ts +9 -0
- package/fe/packages/common/guards/index.js +24 -0
- package/fe/packages/common/i18n/default.d.ts +92 -0
- package/fe/packages/common/i18n/default.js +90 -0
- package/fe/packages/common/i18n/en-US.d.ts +92 -0
- package/fe/packages/common/i18n/en-US.js +90 -0
- package/fe/packages/common/i18n/index.d.ts +43 -0
- package/fe/packages/common/i18n/index.js +173 -0
- package/fe/packages/common/i18n/locales.d.ts +8 -0
- package/fe/packages/common/i18n/locales.js +10 -0
- package/fe/packages/common/i18n/types.d.ts +71 -0
- package/fe/packages/common/i18n/types.js +1 -0
- package/fe/packages/common/index.d.ts +10 -0
- package/fe/packages/common/index.js +9 -0
- package/fe/packages/common/log/index.d.ts +33 -0
- package/fe/packages/common/log/index.js +176 -0
- package/fe/packages/common/number/index.d.ts +3 -0
- package/fe/packages/common/number/index.js +10 -0
- package/fe/packages/common/object/filterEmpty.d.ts +3 -0
- package/fe/packages/common/object/filterEmpty.js +33 -0
- package/fe/packages/common/object/index.d.ts +5 -0
- package/fe/packages/common/object/index.js +25 -0
- package/fe/packages/common/string/index.d.ts +4 -0
- package/fe/packages/common/string/index.js +17 -0
- package/fe/packages/common/types/index.d.ts +4 -0
- package/fe/packages/common/types/index.js +1 -0
- package/fe/packages/ui/react/components/Button/Button.d.ts +29 -10
- package/fe/packages/ui/react/components/Button/Button.js +53 -23
- package/fe/packages/ui/react/components/Button/SumbitButton.d.ts +2 -2
- package/fe/packages/ui/react/components/Button/SumbitButton.js +3 -10
- package/fe/packages/ui/react/components/Button/index.d.ts +1 -1
- package/fe/packages/ui/react/components/Checkbox/Checkbox.d.ts +1 -1
- package/fe/packages/ui/react/components/Checkbox/Checkbox.js +5 -3
- package/fe/packages/ui/react/components/ConfirmDialog/ConfirmDialog.js +11 -0
- package/fe/packages/ui/react/components/ConfirmDialog/index.d.ts +2 -0
- package/fe/packages/ui/react/components/ConfirmDialog/index.js +1 -0
- package/fe/packages/ui/react/components/DataTable/ActionBtn.d.ts +3 -1
- package/fe/packages/ui/react/components/DataTable/ActionBtn.js +85 -4
- package/fe/packages/ui/react/components/DataTable/{data-table.d.ts → index.d.ts} +10 -4
- package/fe/packages/ui/react/components/DataTable/{data-table.js → index.js} +58 -44
- package/fe/packages/ui/react/components/Date/Calendar.js +4 -3
- package/fe/packages/ui/react/components/Date/Date.d.ts +5 -3
- package/fe/packages/ui/react/components/Date/Date.js +71 -48
- package/fe/packages/ui/react/components/Date/TimePicker.js +3 -1
- package/fe/packages/ui/react/components/Date/dropdownPositioning.d.ts +3 -0
- package/fe/packages/ui/react/components/Date/dropdownPositioning.js +12 -0
- package/fe/packages/ui/react/components/Date/locales.d.ts +1 -0
- package/fe/packages/ui/react/components/Date/locales.js +7 -38
- package/fe/packages/ui/react/components/Drawer/Drawer.d.ts +29 -0
- package/fe/packages/ui/react/components/Drawer/Drawer.js +100 -0
- package/fe/packages/ui/react/components/Drawer/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Drawer/index.js +1 -0
- package/fe/packages/ui/react/components/Dropdown/Dropdown.d.ts +25 -0
- package/fe/packages/ui/react/components/Dropdown/Dropdown.js +28 -0
- package/fe/packages/ui/react/components/Dropdown/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Dropdown/index.js +1 -0
- package/fe/packages/ui/react/components/Form/Form.js +1 -1
- package/fe/packages/ui/react/components/Form/FormItem.js +1 -1
- package/fe/packages/ui/react/components/Form/SchemaForm/data.d.ts +45 -0
- package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/data.js +9 -1
- package/fe/packages/ui/react/components/Form/{SchemeForm → SchemaForm}/index.d.ts +15 -14
- package/fe/packages/ui/react/components/Form/SchemaForm/index.js +79 -0
- package/fe/packages/ui/react/components/Form/index.d.ts +1 -1
- package/fe/packages/ui/react/components/Form/index.js +1 -1
- package/fe/packages/ui/react/components/ImagePreview/ImagePreview.js +15 -12
- package/fe/packages/ui/react/components/ImagePreview/PreviewImage.js +5 -2
- package/fe/packages/ui/react/components/Input/Input.d.ts +5 -1
- package/fe/packages/ui/react/components/Input/Input.js +5 -4
- package/fe/packages/ui/react/components/InputNumber/InputNumber.d.ts +28 -0
- package/fe/packages/ui/react/components/InputNumber/InputNumber.js +144 -0
- package/fe/packages/ui/react/components/InputNumber/index.d.ts +2 -0
- package/fe/packages/ui/react/components/InputNumber/index.js +1 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.d.ts +30 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.js +63 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.d.ts +2 -0
- package/fe/packages/ui/react/components/InputNumber/inputNumberUtils.test.js +27 -0
- package/fe/packages/ui/react/components/Label/Label.js +2 -2
- package/fe/packages/ui/react/components/Menu/Menu.d.ts +18 -0
- package/fe/packages/ui/react/components/Menu/Menu.js +102 -0
- package/fe/packages/ui/react/components/Menu/MenuContext.d.ts +39 -0
- package/fe/packages/ui/react/components/Menu/MenuContext.js +97 -0
- package/fe/packages/ui/react/components/Menu/MenuItem.d.ts +3 -0
- package/fe/packages/ui/react/components/Menu/MenuItem.js +33 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.d.ts +10 -0
- package/fe/packages/ui/react/components/Menu/SubMenu.js +169 -0
- package/fe/packages/ui/react/components/Menu/index.d.ts +9 -0
- package/fe/packages/ui/react/components/Menu/index.js +5 -0
- package/fe/packages/ui/react/components/Menu/menuTypes.d.ts +59 -0
- package/fe/packages/ui/react/components/Menu/menuTypes.js +1 -0
- package/fe/packages/ui/react/components/Menu/utils.d.ts +2 -0
- package/fe/packages/ui/react/components/Menu/utils.js +7 -0
- package/fe/packages/ui/react/components/Message/Message.js +4 -1
- package/fe/packages/ui/react/components/Modal/Modal.d.ts +3 -1
- package/fe/packages/ui/react/components/Modal/Modal.js +6 -43
- package/fe/packages/ui/react/components/Modal/ModalManager.js +4 -3
- package/fe/packages/ui/react/components/Overlay/Overlay.d.ts +23 -0
- package/fe/packages/ui/react/components/Overlay/Overlay.js +53 -0
- package/fe/packages/ui/react/components/Overlay/index.d.ts +3 -0
- package/fe/packages/ui/react/components/Overlay/index.js +1 -0
- package/fe/packages/ui/react/components/{Pagination.js → Pagination/Pagination.js} +4 -4
- package/fe/packages/ui/react/components/Pagination/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Pagination/index.js +1 -0
- package/fe/packages/ui/react/components/Popup/Popup.d.ts +26 -0
- package/fe/packages/ui/react/components/Popup/Popup.js +81 -0
- package/fe/packages/ui/react/components/Popup/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Popup/index.js +1 -0
- package/fe/packages/ui/react/components/Search/Search.d.ts +2 -2
- package/fe/packages/ui/react/components/Search/Search.js +3 -3
- package/fe/packages/ui/react/components/Select/Select.d.ts +5 -0
- package/fe/packages/ui/react/components/Select/Select.js +52 -109
- package/fe/packages/ui/react/components/Select/dropdownPositioning.d.ts +3 -0
- package/fe/packages/ui/react/components/Select/dropdownPositioning.js +13 -0
- package/fe/packages/ui/react/components/Skeleton/Skeleton.js +2 -2
- package/fe/packages/ui/react/components/Switch/Switch.js +3 -1
- package/fe/packages/ui/react/components/TableSearch/TableSearch.d.ts +5 -4
- package/fe/packages/ui/react/components/TableSearch/TableSearch.js +23 -21
- package/fe/packages/ui/react/components/TableSearch/lang.js +5 -14
- package/fe/packages/ui/react/components/{Textarea.d.ts → Textarea/Textarea.d.ts} +11 -3
- package/fe/packages/ui/react/components/Textarea/Textarea.js +37 -0
- package/fe/packages/ui/react/components/Textarea/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Textarea/index.js +1 -0
- package/fe/packages/ui/react/components/{Tooltip.d.ts → Tooltip/Tooltip.d.ts} +2 -2
- package/fe/packages/ui/react/components/Tooltip/Tooltip.js +79 -0
- package/fe/packages/ui/react/components/Tooltip/index.d.ts +2 -0
- package/fe/packages/ui/react/components/Tooltip/index.js +1 -0
- package/fe/packages/ui/react/components/{TreeSelect.js → TreeSelect/TreeSelect.js} +9 -11
- package/fe/packages/ui/react/components/TreeSelect/index.d.ts +2 -0
- package/fe/packages/ui/react/components/TreeSelect/index.js +1 -0
- package/fe/packages/ui/react/components/Upload/ImageUpload.js +18 -6
- package/fe/packages/ui/react/components/Upload/Upload.js +2 -1
- package/fe/packages/ui/react/components/{breadcrumb.js → breadcrumb/breadcrumb.js} +15 -12
- package/fe/packages/ui/react/components/breadcrumb/index.d.ts +2 -0
- package/fe/packages/ui/react/components/breadcrumb/index.js +1 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.d.ts +49 -0
- package/fe/packages/ui/react/components/hooks/useDropdownPositioning.js +137 -0
- package/fe/packages/ui/react/components/index.d.ts +7 -1
- package/fe/packages/ui/react/components/index.js +7 -1
- package/fe/packages/ui/react/components/table/index.d.ts +2 -0
- package/fe/packages/ui/react/components/table/index.js +1 -0
- package/fe/packages/ui/react/components/table/table.js +20 -0
- package/fe/packages/ui/react/components/testPage/MenuTestPage.d.ts +2 -0
- package/fe/packages/ui/react/components/testPage/MenuTestPage.js +104 -0
- package/fe/packages/ui/react/components/testPage/index.js +277 -81
- package/fe/packages/ui/react/hooks/useExecuteOnce.d.ts +30 -0
- package/fe/packages/ui/react/hooks/useExecuteOnce.js +57 -0
- package/fe/packages/ui/react/hooks/useInit.d.ts +1 -1
- package/fe/packages/ui/react/hooks/useInit.js +1 -1
- package/fe/packages/ui/react/hooks/useLanguage.d.ts +1 -6
- package/fe/packages/ui/react/hooks/useRefState.d.ts +30 -0
- package/fe/packages/ui/react/hooks/useRefState.js +29 -0
- package/fe/packages/ui/react/hooks/useWatch.d.ts +23 -0
- package/fe/packages/ui/react/hooks/useWatch.js +87 -0
- package/fe/packages/ui/react/hooks/useWatch.test.d.ts +2 -0
- package/fe/packages/ui/react/hooks/useWatch.test.js +22 -0
- package/fe/packages/ui/react/i18n/I18nProvider.d.ts +31 -0
- package/fe/packages/ui/react/i18n/I18nProvider.js +25 -0
- package/fe/packages/ui/react/i18n/index.d.ts +4 -0
- package/fe/packages/ui/react/i18n/index.js +3 -0
- package/fe/packages/ui/react/i18n/useI18n.d.ts +13 -0
- package/fe/packages/ui/react/i18n/useI18n.js +18 -0
- package/fe/packages/ui/react/index.css +238 -0
- package/fe/packages/ui/react/index.d.ts +2 -0
- package/fe/packages/ui/react/index.js +2 -0
- package/fe/packages/ui/react/lib/createStoreHook.d.ts +9 -0
- package/fe/packages/ui/react/lib/createStoreHook.js +6 -0
- package/fe/packages/ui/react/lib/export.d.ts +2 -2
- package/fe/packages/ui/react/stores/language.d.ts +3 -12
- package/fe/packages/ui/react/stores/language.js +2 -51
- package/fe/typings/type.d.ts +5 -0
- package/fe/typings/type.js +1 -0
- package/model/index.d.ts +2 -0
- package/model/types/data/button.d.ts +32 -0
- package/model/types/data/component.d.ts +61 -0
- package/model/types/data/fetchInfo.d.ts +20 -0
- package/model/types/data/schema.d.ts +98 -0
- package/model/types/data/search.d.ts +7 -0
- package/model/types/index.d.ts +2 -0
- package/model/types/menuType.d.ts +73 -0
- package/model/types/model.d.ts +33 -0
- package/model/types/test.d.ts +2 -0
- package/package.json +20 -6
- package/types/app/controller/base.d.ts +3 -3
- package/types/app/router/view.d.ts +2 -3
- package/types/app/service/project.d.ts +29 -4
- package/types/app/type.d.ts +1 -0
- package/types/app/typings.d.ts +12 -21
- package/types/bundler/defaultAlias.d.ts +3 -0
- package/types/bundler/utils.d.ts +1 -1
- package/types/config/config.default.d.ts +14 -0
- package/types/packages/common/LRUCache.d.ts +1 -0
- package/types/packages/common/array/index.d.ts +6 -0
- package/types/packages/common/cache/LRUCache.d.ts +12 -0
- package/types/packages/common/cache/index.d.ts +1 -0
- package/types/packages/common/guards/index.d.ts +8 -0
- package/types/packages/common/i18n/default.d.ts +86 -0
- package/types/packages/common/i18n/en-US.d.ts +86 -0
- package/types/packages/common/i18n/index.d.ts +18 -0
- package/types/packages/common/i18n/locales.d.ts +7 -0
- package/types/packages/common/i18n/types.d.ts +46 -0
- package/types/packages/common/index.d.ts +9 -0
- package/types/packages/common/log/index.d.ts +32 -0
- package/types/packages/common/number/index.d.ts +2 -0
- package/types/packages/common/object/filterEmpty.d.ts +2 -0
- package/types/packages/common/object/filtereEmpty.d.ts +1 -0
- package/types/packages/common/object/index.d.ts +4 -0
- package/types/packages/common/string/index.d.ts +3 -0
- package/types/packages/common/types/index.d.ts +3 -0
- package/types/packages/core/index.d.ts +1 -1
- package/types/packages/core/loader/router.d.ts +1 -1
- package/types/packages/core/types.d.ts +12 -3
- package/types/packages/utils/runFileFn.d.ts +5 -3
- package/fe/packages/ui/react/components/ConfirmDialog.js +0 -9
- package/fe/packages/ui/react/components/Dropdown.d.ts +0 -16
- package/fe/packages/ui/react/components/Dropdown.js +0 -54
- package/fe/packages/ui/react/components/Form/SchemeForm/data.d.ts +0 -51
- package/fe/packages/ui/react/components/Form/SchemeForm/index.js +0 -69
- package/fe/packages/ui/react/components/Textarea.js +0 -35
- package/fe/packages/ui/react/components/Tooltip.js +0 -118
- package/fe/packages/ui/react/components/table.js +0 -20
- package/fe/packages/ui/react/locales/index.d.ts +0 -8
- package/fe/packages/ui/react/locales/index.js +0 -6
- /package/fe/packages/ui/react/components/{ConfirmDialog.d.ts → ConfirmDialog/ConfirmDialog.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{Pagination.d.ts → Pagination/Pagination.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{TreeSelect.d.ts → TreeSelect/TreeSelect.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{breadcrumb.d.ts → breadcrumb/breadcrumb.d.ts} +0 -0
- /package/fe/packages/ui/react/components/{table.d.ts → table/table.d.ts} +0 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
export declare const defaultEnglishResources: {
|
|
2
|
+
readonly common: {
|
|
3
|
+
readonly tip: "Prompt";
|
|
4
|
+
readonly confirm: "Confirm";
|
|
5
|
+
readonly cancel: "Cancel";
|
|
6
|
+
readonly close: "Close";
|
|
7
|
+
readonly submit: "Submit";
|
|
8
|
+
readonly reset: "Reset";
|
|
9
|
+
};
|
|
10
|
+
readonly components: {
|
|
11
|
+
readonly breadcrumb: {
|
|
12
|
+
readonly close: "Close";
|
|
13
|
+
};
|
|
14
|
+
readonly confirmDialog: {
|
|
15
|
+
readonly title: "Prompt";
|
|
16
|
+
readonly okText: "Confirm";
|
|
17
|
+
readonly cancelText: "Cancel";
|
|
18
|
+
};
|
|
19
|
+
readonly dataTable: {
|
|
20
|
+
readonly noData: "No Data";
|
|
21
|
+
};
|
|
22
|
+
readonly date: {
|
|
23
|
+
readonly placeholder: "Select date";
|
|
24
|
+
readonly placeholderDateTime: "Select date and time";
|
|
25
|
+
readonly placeholderRange: "Select date range";
|
|
26
|
+
readonly placeholderDateTimeRange: "Select date and time range";
|
|
27
|
+
readonly weekDays: readonly ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"];
|
|
28
|
+
readonly selectTime: "Select time";
|
|
29
|
+
readonly startTime: "Start time";
|
|
30
|
+
readonly endTime: "End time";
|
|
31
|
+
readonly confirm: "Confirm";
|
|
32
|
+
readonly monthFormat: "MMM yyyy";
|
|
33
|
+
readonly quickRanges: "Quick ranges";
|
|
34
|
+
readonly quickRangeToday: "Today";
|
|
35
|
+
readonly quickRangeYesterday: "Yesterday";
|
|
36
|
+
readonly quickRangeLast7Days: "Last 7 days";
|
|
37
|
+
readonly quickRangeLast30Days: "Last 30 days";
|
|
38
|
+
readonly quickRangeThisMonth: "This month";
|
|
39
|
+
readonly quickRangeLastYear: "Last year";
|
|
40
|
+
readonly clear: "Clear";
|
|
41
|
+
};
|
|
42
|
+
readonly form: {
|
|
43
|
+
readonly submit: "Submit";
|
|
44
|
+
readonly cancel: "Cancel";
|
|
45
|
+
};
|
|
46
|
+
readonly imagePreview: {
|
|
47
|
+
readonly closePreview: "Close preview";
|
|
48
|
+
readonly previousImage: "Previous image";
|
|
49
|
+
readonly nextImage: "Next image";
|
|
50
|
+
readonly zoomOut: "Zoom out";
|
|
51
|
+
readonly zoomIn: "Zoom in";
|
|
52
|
+
readonly reset: "Reset";
|
|
53
|
+
readonly rotateLeft: "Rotate left";
|
|
54
|
+
readonly rotateRight: "Rotate right";
|
|
55
|
+
readonly flipHorizontal: "Flip horizontal";
|
|
56
|
+
readonly flipVertical: "Flip vertical";
|
|
57
|
+
readonly previewImage: "Preview image {index}";
|
|
58
|
+
};
|
|
59
|
+
readonly modal: {
|
|
60
|
+
readonly close: "Close";
|
|
61
|
+
readonly confirmTitle: "Prompt";
|
|
62
|
+
readonly okText: "Confirm";
|
|
63
|
+
readonly cancelText: "Cancel";
|
|
64
|
+
};
|
|
65
|
+
readonly message: {
|
|
66
|
+
readonly close: "Close";
|
|
67
|
+
};
|
|
68
|
+
readonly select: {
|
|
69
|
+
readonly empty: "No options";
|
|
70
|
+
};
|
|
71
|
+
readonly tableSearch: {
|
|
72
|
+
readonly reset: "Reset";
|
|
73
|
+
readonly search: "Search";
|
|
74
|
+
readonly export: "Export Excel";
|
|
75
|
+
readonly expand: "Expand";
|
|
76
|
+
readonly collapse: "Collapse";
|
|
77
|
+
readonly exportCurrentPage: "Current Page";
|
|
78
|
+
readonly exportCurrentQuery: "Current Filters";
|
|
79
|
+
};
|
|
80
|
+
readonly upload: {
|
|
81
|
+
readonly deleteImage: "Delete image";
|
|
82
|
+
readonly upload: "Upload";
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
export type DefaultEnglishResources = typeof defaultEnglishResources;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { I18nDictionary, I18nInterpolationValues, I18nMessage, I18nResources, I18nStore, I18nStoreListener, I18nTranslateOptions, I18nTranslateState } from "./types";
|
|
2
|
+
export * from "./types";
|
|
3
|
+
export * from "./locales";
|
|
4
|
+
export declare const isPlainI18nDictionary: (value: I18nMessage) => value is I18nDictionary;
|
|
5
|
+
export declare const mergeI18nDictionary: (base?: I18nDictionary, patch?: I18nDictionary) => I18nDictionary;
|
|
6
|
+
export declare const mergeI18nResources: (base?: I18nResources, patch?: I18nResources) => I18nResources;
|
|
7
|
+
export declare const getI18nPathValue: (dictionary: I18nDictionary | undefined, key: string) => I18nMessage | undefined;
|
|
8
|
+
export declare const interpolateI18nMessage: (value: string, data?: I18nInterpolationValues) => string;
|
|
9
|
+
export declare const translate: <T = string>(state: I18nTranslateState, key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => T | string;
|
|
10
|
+
export declare const i18nStore: {
|
|
11
|
+
getState: () => I18nStore;
|
|
12
|
+
getInitialState: () => I18nStore;
|
|
13
|
+
setState: (partial: Partial<I18nStore> | ((state: I18nStore) => Partial<I18nStore>)) => void;
|
|
14
|
+
subscribe: (listener: I18nStoreListener) => () => void;
|
|
15
|
+
};
|
|
16
|
+
export declare const i18n: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
17
|
+
export declare const t: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
18
|
+
export declare const getLanguage: <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => string | T;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { I18nResources } from "./types";
|
|
2
|
+
export declare const defaultLanguage: "zh-CN";
|
|
3
|
+
export declare const languageLocalKey = "tc_language";
|
|
4
|
+
export declare const translations: I18nResources;
|
|
5
|
+
export type Language = keyof typeof translations | (string & {});
|
|
6
|
+
export * from "./default";
|
|
7
|
+
export * from "./en-US";
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
export type I18nLanguage = string;
|
|
2
|
+
export type I18nPrimitive = string | number | boolean | null | undefined;
|
|
3
|
+
export type I18nMessage = I18nPrimitive | I18nMessage[] | readonly I18nMessage[] | I18nDictionary;
|
|
4
|
+
export interface I18nDictionary {
|
|
5
|
+
[key: string]: I18nMessage;
|
|
6
|
+
}
|
|
7
|
+
export type I18nResources<Language extends I18nLanguage = I18nLanguage> = Partial<Record<Language, I18nDictionary>>;
|
|
8
|
+
export type I18nInterpolationValues = Record<string, I18nPrimitive>;
|
|
9
|
+
export interface I18nTranslateState {
|
|
10
|
+
language: I18nLanguage;
|
|
11
|
+
fallbackLanguage: I18nLanguage;
|
|
12
|
+
resources: I18nResources;
|
|
13
|
+
}
|
|
14
|
+
export interface I18nState extends I18nTranslateState {
|
|
15
|
+
storageKey: string;
|
|
16
|
+
persist: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface I18nTranslateOptions {
|
|
19
|
+
language?: I18nLanguage;
|
|
20
|
+
fallbackLanguage?: I18nLanguage;
|
|
21
|
+
fallback?: I18nMessage;
|
|
22
|
+
}
|
|
23
|
+
export interface I18nSetResourcesOptions {
|
|
24
|
+
merge?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface I18nAddResourcesOptions {
|
|
27
|
+
merge?: boolean;
|
|
28
|
+
}
|
|
29
|
+
export type I18nTranslator = <T = string>(key: string, fillingData?: I18nInterpolationValues, options?: I18nTranslateOptions) => T | string;
|
|
30
|
+
export interface I18nActions {
|
|
31
|
+
setLanguage: (language: I18nLanguage) => void;
|
|
32
|
+
setFallbackLanguage: (language: I18nLanguage) => void;
|
|
33
|
+
setResources: (resources: I18nResources, options?: I18nSetResourcesOptions) => void;
|
|
34
|
+
addResources: (language: I18nLanguage, messages: I18nDictionary, options?: I18nAddResourcesOptions) => void;
|
|
35
|
+
configureI18n: (config: Partial<Pick<I18nState, 'storageKey' | 'persist'>>) => void;
|
|
36
|
+
resetI18n: () => void;
|
|
37
|
+
t: I18nTranslator;
|
|
38
|
+
}
|
|
39
|
+
export type I18nStore = I18nState & I18nActions;
|
|
40
|
+
export type I18nStoreListener = (state: I18nStore, previousState: I18nStore) => void;
|
|
41
|
+
export interface I18nStoreApi {
|
|
42
|
+
getState: () => I18nStore;
|
|
43
|
+
getInitialState: () => I18nStore;
|
|
44
|
+
setState: (partial: Partial<I18nStore> | ((state: I18nStore) => Partial<I18nStore>)) => void;
|
|
45
|
+
subscribe: (listener: I18nStoreListener) => () => void;
|
|
46
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export declare const ANSI_RESET = "\u001B[0m";
|
|
2
|
+
export declare const ansiColors: {
|
|
3
|
+
readonly black: "\u001B[30m";
|
|
4
|
+
readonly red: "\u001B[31m";
|
|
5
|
+
readonly green: "\u001B[32m";
|
|
6
|
+
readonly yellow: "\u001B[33m";
|
|
7
|
+
readonly blue: "\u001B[34m";
|
|
8
|
+
readonly magenta: "\u001B[35m";
|
|
9
|
+
readonly pink: "\u001B[95m";
|
|
10
|
+
readonly cyan: "\u001B[36m";
|
|
11
|
+
readonly white: "\u001B[37m";
|
|
12
|
+
readonly gray: "\u001B[90m";
|
|
13
|
+
};
|
|
14
|
+
export type LogColor = keyof typeof ansiColors;
|
|
15
|
+
export type ColorLogOptions = {
|
|
16
|
+
color?: LogColor;
|
|
17
|
+
prefix?: string;
|
|
18
|
+
suffix?: string;
|
|
19
|
+
};
|
|
20
|
+
export type ColorLogAffixes = Omit<ColorLogOptions, 'color'>;
|
|
21
|
+
export declare const colorize: (message: unknown, color?: LogColor) => string;
|
|
22
|
+
export declare const joinColorized: (...messages: readonly unknown[]) => string;
|
|
23
|
+
export declare const logJoinColorized: (...messages: readonly unknown[]) => void;
|
|
24
|
+
export declare function colorLog(color: LogColor, ...data: unknown[]): void;
|
|
25
|
+
export declare function colorLog(...data: unknown[]): void;
|
|
26
|
+
export declare const logColor: (color: LogColor, ...data: unknown[]) => void;
|
|
27
|
+
export declare const logColorized: (...messages: readonly unknown[]) => void;
|
|
28
|
+
export declare const logGreen: (...data: unknown[]) => void;
|
|
29
|
+
export declare const logYellow: (...data: unknown[]) => void;
|
|
30
|
+
export declare const logPink: (...data: unknown[]) => void;
|
|
31
|
+
export declare const logWhite: (...data: unknown[]) => void;
|
|
32
|
+
export declare const logRed: (...data: unknown[]) => void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { filterEmpty, filtereEmpty } from "./filterEmpty";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * from "./filterEmpty";
|
|
2
|
+
export declare const pick: <T extends object, K extends keyof T>(target: T, keys: readonly K[]) => Pick<T, K>;
|
|
3
|
+
export declare const omit: <T extends object, K extends keyof T>(target: T, keys: readonly K[]) => Omit<T, K>;
|
|
4
|
+
export declare const mapValues: <T extends object, TResult>(target: T, mapper: <K extends keyof T>(value: T[K], key: K) => TResult) => { [K in keyof T]: TResult; };
|
|
@@ -2,5 +2,5 @@ import "./types";
|
|
|
2
2
|
import "../../app/typings";
|
|
3
3
|
import type { KoaApp, StartOptions } from "./types";
|
|
4
4
|
export declare const loaderModel: (app: KoaApp) => import("./loader/model").ModelConfig;
|
|
5
|
-
export type { AppConfig, AppOptions, StartOptions, KoaMiddleware, ProcessingFileCallbackFN, IService, IController, IExtends, IMiddlewares, KoaApp, KoaAppExtensions, FrameworkAugment, } from "./types";
|
|
5
|
+
export type { AppConfig, AppOptions, StartOptions, KoaMiddleware, ProcessingFileCallbackFN, IService, IController, IExtends, IMiddlewares, KoaApp, KoaRouter, KoaAppExtensions, FrameworkAugment, } from "./types";
|
|
6
6
|
export declare const start: (options?: StartOptions) => KoaApp;
|
|
@@ -28,11 +28,15 @@ export declare namespace FrameworkAugment {
|
|
|
28
28
|
}
|
|
29
29
|
export type ICTX = Parameters<Router.IMiddleware<any, {}>>[0];
|
|
30
30
|
export interface KoaAppExtensions {
|
|
31
|
-
baseDir: string;
|
|
32
31
|
frameBaseDir: string;
|
|
32
|
+
framePath: string;
|
|
33
|
+
baseDir: string;
|
|
33
34
|
businessPath: string;
|
|
34
35
|
paths: AppPathInfo[];
|
|
35
|
-
|
|
36
|
+
hooks: {
|
|
37
|
+
inited?: () => void;
|
|
38
|
+
initing?: () => void;
|
|
39
|
+
};
|
|
36
40
|
envs: EnvReturn;
|
|
37
41
|
config: FrameworkAugment.AppConfigAugmented;
|
|
38
42
|
extends: FrameworkAugment.IExtendsAugmented;
|
|
@@ -41,7 +45,7 @@ export interface KoaAppExtensions {
|
|
|
41
45
|
middlewares: FrameworkAugment.IMiddlewaresAugmented;
|
|
42
46
|
model: unknown[];
|
|
43
47
|
routerSchema: Record<string, unknown>;
|
|
44
|
-
currentUseRouter:
|
|
48
|
+
currentUseRouter: KoaRouter[];
|
|
45
49
|
options: AppOptions;
|
|
46
50
|
logger?: {
|
|
47
51
|
info: (...args: unknown[]) => void;
|
|
@@ -62,12 +66,17 @@ export interface StartOptions {
|
|
|
62
66
|
name?: string;
|
|
63
67
|
homePage?: string;
|
|
64
68
|
frameBaseDir?: string;
|
|
69
|
+
baseDir?: string;
|
|
70
|
+
pageBasePage?: string;
|
|
65
71
|
}
|
|
66
72
|
export interface AppOptions extends StartOptions {
|
|
67
73
|
overwriteOriginalLogs?: boolean;
|
|
68
74
|
[key: string]: unknown;
|
|
69
75
|
}
|
|
70
76
|
export type KoaApp = Koa & KoaAppExtensions;
|
|
77
|
+
export type KoaRouter = Router & {
|
|
78
|
+
level?: number;
|
|
79
|
+
};
|
|
71
80
|
export type KoaMiddleware = Koa.Middleware;
|
|
72
81
|
export type { EnvType, EnvKeys } from "./env";
|
|
73
82
|
export type ProcessingFileCallbackFN = <T extends Record<string, unknown>>(fileName: string, filePath: string, isDir: boolean, tempData: T) => T | undefined;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
type AnyFun = (...p: any[]) => any;
|
|
2
|
-
|
|
3
|
-
default
|
|
4
|
-
}
|
|
2
|
+
type DefaultExport<T> = {
|
|
3
|
+
default?: T;
|
|
4
|
+
};
|
|
5
|
+
export declare function runFileFn<T = AnyFun>(file: string): T;
|
|
6
|
+
export declare function runFileFn<T = AnyFun>(fileModule: DefaultExport<T> | T): T;
|
|
5
7
|
export {};
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Button } from './Button';
|
|
3
|
-
import { Modal } from './Modal';
|
|
4
|
-
export function ConfirmDialog({ open, title = '提示', content, okText = '确认', cancelText = '取消', loading = false, onOk, onCancel, }) {
|
|
5
|
-
const handleOk = async () => {
|
|
6
|
-
await onOk();
|
|
7
|
-
};
|
|
8
|
-
return (_jsx(Modal, { open: open, onClose: onCancel, title: title, width: 450, footer: _jsxs("div", { className: "flex justify-end gap-3", children: [_jsx(Button, { onClick: onCancel, className: "min-w-[100px] bg-white border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/5", children: cancelText }), _jsx(Button, { variant: "primary", loading: loading, onClick: handleOk, className: "min-w-[100px] bg-[hsl(var(--theme-primary))] hover:bg-[hsl(var(--theme-primary))]/90 border-[hsl(var(--theme-primary))] text-[hsl(var(--theme-primary-foreground))]", children: okText })] }), children: _jsx("div", { className: "py-4 text-base text-foreground", children: content }) }));
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
export interface DropdownItem {
|
|
3
|
-
key: string;
|
|
4
|
-
label: ReactNode;
|
|
5
|
-
icon?: ReactNode;
|
|
6
|
-
danger?: boolean;
|
|
7
|
-
onClick?: () => void;
|
|
8
|
-
}
|
|
9
|
-
export interface DropdownProps {
|
|
10
|
-
items: DropdownItem[];
|
|
11
|
-
children: ReactNode;
|
|
12
|
-
className?: string;
|
|
13
|
-
placement?: 'bottom-end' | 'bottom-start';
|
|
14
|
-
}
|
|
15
|
-
export declare function Dropdown({ items, children, className, placement }: DropdownProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
-
//# sourceMappingURL=Dropdown.d.ts.map
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../lib/utils';
|
|
3
|
-
import { useEffect, useRef, useState } from 'react';
|
|
4
|
-
import { createPortal } from 'react-dom';
|
|
5
|
-
export function Dropdown({ items, children, className, placement = 'bottom-end' }) {
|
|
6
|
-
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
-
const [position, setPosition] = useState({ top: 0, left: 0, width: 0 });
|
|
8
|
-
const triggerRef = useRef(null);
|
|
9
|
-
const dropdownRef = useRef(null);
|
|
10
|
-
// 计算下拉菜单位置
|
|
11
|
-
const updatePosition = () => {
|
|
12
|
-
if (triggerRef.current) {
|
|
13
|
-
const rect = triggerRef.current.getBoundingClientRect();
|
|
14
|
-
setPosition({
|
|
15
|
-
top: rect.bottom + window.scrollY,
|
|
16
|
-
left: placement === 'bottom-end' ? rect.right + window.scrollX : rect.left + window.scrollX,
|
|
17
|
-
width: rect.width,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
// 点击外部关闭
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
if (!isOpen)
|
|
24
|
-
return;
|
|
25
|
-
const handleClickOutside = (event) => {
|
|
26
|
-
if (triggerRef.current &&
|
|
27
|
-
!triggerRef.current.contains(event.target) &&
|
|
28
|
-
dropdownRef.current &&
|
|
29
|
-
!dropdownRef.current.contains(event.target)) {
|
|
30
|
-
setIsOpen(false);
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
document.addEventListener('mousedown', handleClickOutside);
|
|
34
|
-
return () => {
|
|
35
|
-
document.removeEventListener('mousedown', handleClickOutside);
|
|
36
|
-
};
|
|
37
|
-
}, [isOpen]);
|
|
38
|
-
const handleToggle = () => {
|
|
39
|
-
if (!isOpen) {
|
|
40
|
-
updatePosition();
|
|
41
|
-
}
|
|
42
|
-
setIsOpen(!isOpen);
|
|
43
|
-
};
|
|
44
|
-
const handleItemClick = (item) => {
|
|
45
|
-
item.onClick?.();
|
|
46
|
-
setIsOpen(false);
|
|
47
|
-
};
|
|
48
|
-
return (_jsxs(_Fragment, { children: [_jsx("div", { ref: triggerRef, className: cn('relative inline-block', className), children: _jsx("div", { onClick: handleToggle, children: children }) }), isOpen &&
|
|
49
|
-
createPortal(_jsx("div", { ref: dropdownRef, className: cn('fixed z-[9999] mt-2 min-w-[120px]', 'bg-white rounded-lg shadow-lg border border-gray-200', 'py-1', 'animate-in fade-in-0 zoom-in-95'), style: {
|
|
50
|
-
top: `${position.top}px`,
|
|
51
|
-
left: placement === 'bottom-end' ? 'auto' : `${position.left}px`,
|
|
52
|
-
right: placement === 'bottom-end' ? `${window.innerWidth - position.left}px` : 'auto',
|
|
53
|
-
}, children: items.map((item) => (_jsxs("button", { onClick: () => handleItemClick(item), className: cn('w-full px-4 py-2.5 text-sm text-left', 'flex items-center gap-2', 'transition-colors', item.danger ? 'text-red-600 hover:bg-red-50' : 'text-gray-700 hover:bg-gray-50'), children: [item.icon && _jsx("span", { className: "flex-shrink-0", children: item.icon }), _jsx("span", { children: item.label })] }, item.key))) }), document.body)] }));
|
|
54
|
-
}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type DatePickerProps } from '../../Date';
|
|
3
|
-
import { type InputProps } from '../../Input';
|
|
4
|
-
import { type SelectProps } from '../../Select';
|
|
5
|
-
import { type SwitchProps } from '../../Switch';
|
|
6
|
-
import { type TextareaProps } from '../../Textarea';
|
|
7
|
-
export declare const componentsMap: {
|
|
8
|
-
input: React.LazyExoticComponent<React.ForwardRefExoticComponent<Omit<React.InputHTMLAttributes<HTMLInputElement>, "defaultValue" | "onChange" | "value"> & {
|
|
9
|
-
value?: string;
|
|
10
|
-
onChange?: (v: string, e: React.ChangeEvent<HTMLInputElement>) => void;
|
|
11
|
-
defaultValue?: string;
|
|
12
|
-
allowClear?: boolean | {
|
|
13
|
-
clearIcon: React.ReactNode;
|
|
14
|
-
};
|
|
15
|
-
addonAfter?: React.ReactNode;
|
|
16
|
-
} & React.RefAttributes<HTMLInputElement>>>;
|
|
17
|
-
select: React.LazyExoticComponent<React.ForwardRefExoticComponent<SelectProps & React.RefAttributes<HTMLDivElement>>>;
|
|
18
|
-
textarea: React.LazyExoticComponent<React.ForwardRefExoticComponent<Omit<React.TextareaHTMLAttributes<HTMLTextAreaElement>, "defaultValue" | "onChange" | "value"> & {
|
|
19
|
-
value?: string;
|
|
20
|
-
onChange?: (v: string, e: React.ChangeEvent<HTMLTextAreaElement>) => void;
|
|
21
|
-
defaultValue?: string;
|
|
22
|
-
maxLength?: number;
|
|
23
|
-
showCount?: boolean;
|
|
24
|
-
placeholder?: string;
|
|
25
|
-
} & React.RefAttributes<HTMLTextAreaElement>>>;
|
|
26
|
-
switch: React.LazyExoticComponent<React.ForwardRefExoticComponent<SwitchProps & React.RefAttributes<HTMLButtonElement>>>;
|
|
27
|
-
date: React.LazyExoticComponent<React.ForwardRefExoticComponent<DatePickerProps & React.RefAttributes<HTMLDivElement>>>;
|
|
28
|
-
};
|
|
29
|
-
type TextareaField = {
|
|
30
|
-
type?: 'textarea';
|
|
31
|
-
fieldProps?: TextareaProps;
|
|
32
|
-
};
|
|
33
|
-
type InputField = {
|
|
34
|
-
type?: 'input';
|
|
35
|
-
fieldProps?: InputProps;
|
|
36
|
-
};
|
|
37
|
-
type SelectField = {
|
|
38
|
-
type?: 'select';
|
|
39
|
-
fieldProps?: SelectProps;
|
|
40
|
-
};
|
|
41
|
-
type SwitchField = {
|
|
42
|
-
type?: 'switch';
|
|
43
|
-
fieldProps?: SwitchProps;
|
|
44
|
-
};
|
|
45
|
-
type DateField = {
|
|
46
|
-
type?: 'date';
|
|
47
|
-
fieldProps?: DatePickerProps;
|
|
48
|
-
};
|
|
49
|
-
export type FieldProps = TextareaField | InputField | SelectField | SwitchField | DateField;
|
|
50
|
-
export {};
|
|
51
|
-
//# sourceMappingURL=data.d.ts.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../../../lib/utils';
|
|
3
|
-
import { Suspense, useEffect, useMemo } from 'react';
|
|
4
|
-
import { Form, FormItem, useForm } from '..';
|
|
5
|
-
import { Button } from '../../Button';
|
|
6
|
-
import { Skeleton } from '../../Skeleton';
|
|
7
|
-
import { componentsMap } from './data';
|
|
8
|
-
const renderField = (scheme) => {
|
|
9
|
-
return (value, onChange, meta) => {
|
|
10
|
-
// 如果提供了自定义渲染函数,优先使用
|
|
11
|
-
if (scheme.render) {
|
|
12
|
-
return scheme.render(value, onChange, meta);
|
|
13
|
-
}
|
|
14
|
-
const { type = 'input' } = scheme;
|
|
15
|
-
const Component = componentsMap[type];
|
|
16
|
-
const { fieldProps } = scheme;
|
|
17
|
-
return (_jsxs(Suspense, { fallback: _jsx(Skeleton, { mode: "componentsloading", rows: 2 }), children: [_jsx(Component, { value: value, onChange: onChange, ...fieldProps }), scheme.affterNode] }));
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
export const SchemeForm = ({ form, getForm, schemes, className, onFinish, onFinishFailed, initialValues, footerButtons = true, submitText = '提交', cancelText = '取消', onCancel, buttonClassName, submitButtonProps, layout = 'vertical', fieldLayout = 'vertical', cancelButtonProps,
|
|
21
|
-
// preserve = false,
|
|
22
|
-
...formProps }) => {
|
|
23
|
-
const [f] = useForm();
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
getForm?.(f);
|
|
26
|
-
}, []);
|
|
27
|
-
const usedForm = form ?? f;
|
|
28
|
-
const handleCancel = () => {
|
|
29
|
-
if (onCancel) {
|
|
30
|
-
onCancel();
|
|
31
|
-
}
|
|
32
|
-
else {
|
|
33
|
-
// 如果没有提供 onCancel,默认重置表单
|
|
34
|
-
usedForm?.resetFields();
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
const { formClassName, fieldClassName, isHorizontal } = useMemo(() => {
|
|
38
|
-
return {
|
|
39
|
-
formClassName: cn(layout === 'horizontal' ? 'flex gap-4 items-start flex-wrap' : ''),
|
|
40
|
-
fieldClassName: cn('min-w-[255px]', layout === 'horizontal' ? '' : 'mb-5'),
|
|
41
|
-
isHorizontal: layout === 'horizontal',
|
|
42
|
-
};
|
|
43
|
-
}, [layout]);
|
|
44
|
-
const renderSchemes = (schemes) => {
|
|
45
|
-
return schemes.map((scheme, index) => {
|
|
46
|
-
const { type = 'input' } = scheme;
|
|
47
|
-
if (type !== 'group') {
|
|
48
|
-
const { name, label, rules, required, className: itemClassName, labelClassName, errorClassName, showError, layout: schemeFieldLayout, } = scheme;
|
|
49
|
-
const fLayout = schemeFieldLayout ?? fieldLayout;
|
|
50
|
-
const fRequired = required ??
|
|
51
|
-
rules?.some((r) => {
|
|
52
|
-
const rData = typeof r === 'function' ? r(usedForm) : r;
|
|
53
|
-
return rData.required;
|
|
54
|
-
});
|
|
55
|
-
const fiKey = (Array.isArray(name) ? `field-${index}-${name.join('_')}` : name);
|
|
56
|
-
return (_jsx(FormItem, { name: name, label: label, rules: rules, layout: fLayout, required: fRequired, className: cn(fieldClassName, itemClassName), labelClassName: labelClassName, errorClassName: errorClassName, showError: showError, children: renderField(scheme) }, fiKey));
|
|
57
|
-
}
|
|
58
|
-
else if (type === 'group') {
|
|
59
|
-
const s = scheme;
|
|
60
|
-
const fiKey = (Array.isArray(name) ? `field-group-${index}-${name.join('_')}` : name);
|
|
61
|
-
return (_jsx("div", { className: "field-group-container", ...s.fieldProps, children: renderSchemes(s.childrens) }, fiKey));
|
|
62
|
-
}
|
|
63
|
-
return null;
|
|
64
|
-
});
|
|
65
|
-
};
|
|
66
|
-
return (_jsxs(Form, { form: usedForm, onFinish: onFinish, onFinishFailed: onFinishFailed, initialValues: initialValues, className: cn(formClassName, className), ...formProps, children: [renderSchemes(schemes), footerButtons && !isHorizontal ? (typeof footerButtons === 'boolean' ? (_jsxs("div", { className: cn('flex items-center gap-4', buttonClassName), children: [_jsx(Button, { type: "button", onClick: handleCancel, ...cancelButtonProps, children: cancelText }), _jsx(Button, { type: "submit", variant: "primary", ...submitButtonProps, children: submitText })] })) : (footerButtons)) : undefined] }));
|
|
67
|
-
};
|
|
68
|
-
SchemeForm.displayName = 'SchemeForm';
|
|
69
|
-
export default SchemeForm;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { cn } from '../lib/utils';
|
|
3
|
-
import { forwardRef, useCallback } from 'react';
|
|
4
|
-
import { useInputController } from './hooks/useInputController';
|
|
5
|
-
const Textarea = forwardRef(({ className, value: controlledValue, onChange, defaultValue, maxLength = 500, showCount = true, placeholder, disabled, ...props }, ref) => {
|
|
6
|
-
const { isFocused, setIsFocused, setInternalValue, setRefs, value, hasValue, isControlledRef, currentLength, } = useInputController({
|
|
7
|
-
controlledValue,
|
|
8
|
-
defaultValue,
|
|
9
|
-
ref,
|
|
10
|
-
});
|
|
11
|
-
const handleChange = useCallback((e) => {
|
|
12
|
-
const newValue = e.target.value;
|
|
13
|
-
// 如果设置了 maxLength,限制输入长度
|
|
14
|
-
if (maxLength && newValue.length > maxLength) {
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
if (!isControlledRef.current) {
|
|
18
|
-
setInternalValue(newValue);
|
|
19
|
-
}
|
|
20
|
-
onChange?.(newValue, e);
|
|
21
|
-
}, [maxLength, isControlledRef, onChange, setInternalValue]);
|
|
22
|
-
return (_jsxs("div", { className: "relative w-full", children: [_jsx("textarea", { ref: setRefs, value: value, onChange: handleChange, maxLength: maxLength, placeholder: placeholder, className: cn('flex w-full rounded-lg px-4 py-3 text-sm', 'border transition-colors duration-200', 'placeholder:text-muted-foreground', 'focus:outline-none', 'resize-none', showCount && 'pb-10', disabled ? 'cursor-not-allowed bg-muted border-border text-muted-foreground' : 'bg-background', !disabled && !hasValue && !isFocused && 'border-border', !disabled && (hasValue || isFocused) && 'border-foreground', className), onFocus: (e) => {
|
|
23
|
-
if (!disabled) {
|
|
24
|
-
setIsFocused(true);
|
|
25
|
-
props.onFocus?.(e);
|
|
26
|
-
}
|
|
27
|
-
}, onBlur: (e) => {
|
|
28
|
-
if (!disabled) {
|
|
29
|
-
setIsFocused(false);
|
|
30
|
-
props.onBlur?.(e);
|
|
31
|
-
}
|
|
32
|
-
}, disabled: disabled, ...props }), showCount && (_jsxs("div", { className: cn('absolute bottom-3 right-4 text-xs text-muted-foreground', 'pointer-events-none'), children: [currentLength, "/", maxLength] }))] }));
|
|
33
|
-
});
|
|
34
|
-
Textarea.displayName = 'Textarea';
|
|
35
|
-
export { Textarea };
|