From d5e2d26a0f08bd672a3a016bf50d31311dd219c8 Mon Sep 17 00:00:00 2001 From: saber <1558365539@qq.com> Date: Mon, 10 Oct 2022 10:53:48 +0800 Subject: [PATCH] Compact main branch (#2255) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * init * init * fix: 修改外联路由打包bug * fix: sime * wip(lock): remove * fix: LOCK * fix: lock * init * feat: remove lock * chore: remove semi * chore: chore * chore: chore * chore: chore * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init * init --- .vscode/settings.json | 1 - CHANGELOG.en_US.md | 1262 ------- CHANGELOG.zh_CN.md | 1317 -------- README.md | 174 +- README.zh-CN.md | 175 - build/vite/plugin/index.ts | 62 +- build/vite/plugin/styleImport.ts | 14 +- commitlint.config.js | 12 +- index.html | 14 +- mock/sys/menu.ts | 58 +- package.json | 7 +- pnpm-lock.yaml | 466 +-- prettier.config.js | 4 +- src/App.vue | 14 +- src/api/demo/account.ts | 10 +- src/api/demo/cascader.ts | 6 +- src/api/demo/error.ts | 4 +- src/api/demo/model/accountModel.ts | 10 +- src/api/demo/model/areaModel.ts | 14 +- src/api/demo/model/optionsModel.ts | 10 +- src/api/demo/model/systemModel.ts | 90 +- src/api/demo/model/tableModel.ts | 20 +- src/api/demo/select.ts | 6 +- src/api/demo/system.ts | 18 +- src/api/demo/table.ts | 6 +- src/api/demo/tree.ts | 4 +- src/api/model/baseModel.ts | 8 +- src/api/sys/menu.ts | 8 +- src/api/sys/model/menuModel.ts | 20 +- src/api/sys/model/uploadModel.ts | 6 +- src/api/sys/model/userModel.ts | 26 +- src/api/sys/upload.ts | 22 - src/api/sys/user.ts | 16 +- src/components/Application/index.ts | 24 +- .../Application/src/AppDarkModeToggle.vue | 32 +- .../Application/src/AppLocalePicker.vue | 42 +- src/components/Application/src/AppLogo.vue | 32 +- .../Application/src/AppProvider.vue | 50 +- .../Application/src/search/AppSearch.vue | 22 +- .../src/search/AppSearchFooter.vue | 10 +- .../src/search/AppSearchKeyItem.vue | 4 +- .../Application/src/search/AppSearchModal.vue | 54 +- .../Application/src/search/useMenuSearch.ts | 162 +- .../Application/src/useAppContext.ts | 14 +- src/components/Authority/index.ts | 4 - src/components/Authority/src/Authority.vue | 45 - src/components/Basic/index.ts | 14 +- src/components/Basic/src/BasicArrow.vue | 16 +- src/components/Basic/src/BasicHelp.vue | 40 +- src/components/Basic/src/BasicTitle.vue | 16 +- src/components/Button/index.ts | 16 +- src/components/Button/src/BasicButton.vue | 26 +- .../Button/src/PopConfirmButton.vue | 40 +- src/components/Button/src/props.ts | 2 +- src/components/CardList/index.ts | 4 - src/components/CardList/src/CardList.vue | 177 - src/components/CardList/src/data.ts | 25 - src/components/ClickOutSide/index.ts | 4 - .../ClickOutSide/src/ClickOutSide.vue | 19 - src/components/CodeEditor/index.ts | 8 - src/components/CodeEditor/src/CodeEditor.vue | 54 - .../CodeEditor/src/codemirror/CodeMirror.vue | 113 - .../CodeEditor/src/codemirror/codeMirror.ts | 21 - .../CodeEditor/src/codemirror/codemirror.css | 525 --- .../src/json-preview/JsonPreview.vue | 12 - src/components/CodeEditor/src/typing.ts | 5 - src/components/Container/index.ts | 16 +- .../Container/src/LazyContainer.vue | 72 +- .../Container/src/ScrollContainer.vue | 48 +- .../src/collapse/CollapseContainer.vue | 30 +- .../Container/src/collapse/CollapseHeader.vue | 8 +- src/components/Container/src/typing.ts | 20 +- src/components/ContextMenu/index.ts | 3 - .../ContextMenu/src/ContextMenu.vue | 209 -- .../ContextMenu/src/createContextMenu.ts | 75 - src/components/ContextMenu/src/typing.ts | 36 - src/components/CountDown/index.ts | 10 +- src/components/CountDown/src/CountButton.vue | 42 +- .../CountDown/src/CountdownInput.vue | 18 +- src/components/CountDown/src/useCountdown.ts | 44 +- src/components/CountTo/index.ts | 4 - src/components/CountTo/src/CountTo.vue | 110 - src/components/Cropper/index.ts | 7 - src/components/Cropper/src/CopperModal.vue | 283 -- src/components/Cropper/src/Cropper.vue | 188 -- src/components/Cropper/src/CropperAvatar.vue | 161 - src/components/Cropper/src/typing.ts | 8 - src/components/Description/index.ts | 10 +- .../Description/src/Description.vue | 116 +- src/components/Description/src/typing.ts | 36 +- .../Description/src/useDescription.ts | 26 +- src/components/Drawer/index.ts | 10 +- src/components/Drawer/src/BasicDrawer.vue | 120 +- .../Drawer/src/components/DrawerFooter.vue | 24 +- .../Drawer/src/components/DrawerHeader.vue | 18 +- src/components/Drawer/src/props.ts | 10 +- src/components/Drawer/src/typing.ts | 110 +- src/components/Drawer/src/useDrawer.ts | 134 +- src/components/Dropdown/index.ts | 8 +- src/components/Dropdown/src/Dropdown.vue | 50 +- src/components/Dropdown/src/typing.ts | 14 +- src/components/Excel/index.ts | 8 - src/components/Excel/src/Export2Excel.ts | 81 - src/components/Excel/src/ExportExcelModal.vue | 91 - src/components/Excel/src/ImportExcel.vue | 166 - src/components/Excel/src/typing.ts | 27 - src/components/FlowChart/index.ts | 4 - src/components/FlowChart/src/FlowChart.vue | 158 - .../FlowChart/src/FlowChartToolbar.vue | 162 - .../FlowChart/src/adpterForTurbo.ts | 75 - src/components/FlowChart/src/config.ts | 96 - src/components/FlowChart/src/enum.ts | 11 - src/components/FlowChart/src/types.ts | 14 - .../FlowChart/src/useFlowContext.ts | 17 - src/components/Form/index.ts | 17 - src/components/Form/src/BasicForm.vue | 353 -- src/components/Form/src/componentMap.ts | 83 - .../Form/src/components/ApiCascader.vue | 198 -- .../Form/src/components/ApiRadioGroup.vue | 130 - .../Form/src/components/ApiSelect.vue | 147 - .../Form/src/components/ApiTransfer.vue | 134 - .../Form/src/components/ApiTree.vue | 90 - .../Form/src/components/ApiTreeSelect.vue | 86 - .../Form/src/components/FormAction.vue | 135 - .../Form/src/components/FormItem.vue | 392 --- .../Form/src/components/RadioButtonGroup.vue | 57 - src/components/Form/src/helper.ts | 74 - src/components/Form/src/hooks/useAdvanced.ts | 170 - src/components/Form/src/hooks/useAutoFocus.ts | 40 - .../Form/src/hooks/useComponentRegister.ts | 11 - src/components/Form/src/hooks/useForm.ts | 122 - .../Form/src/hooks/useFormContext.ts | 17 - .../Form/src/hooks/useFormEvents.ts | 314 -- .../Form/src/hooks/useFormValues.ts | 131 - .../Form/src/hooks/useLabelWidth.ts | 42 - src/components/Form/src/props.ts | 103 - src/components/Form/src/types/form.ts | 223 -- src/components/Form/src/types/formItem.ts | 91 - src/components/Form/src/types/hooks.ts | 6 - src/components/Form/src/types/index.ts | 117 - src/components/Icon/data/icons.data.ts | 9 +- src/components/Icon/index.ts | 10 +- src/components/Icon/src/Icon.vue | 70 +- src/components/Icon/src/IconPicker.vue | 107 +- src/components/Icon/src/SvgIcon.vue | 24 +- src/components/Loading/index.ts | 8 +- src/components/Loading/src/Loading.vue | 14 +- src/components/Loading/src/createLoading.ts | 42 +- src/components/Loading/src/typing.ts | 14 +- src/components/Loading/src/useLoading.ts | 50 +- src/components/Markdown/index.ts | 7 - src/components/Markdown/src/Markdown.vue | 158 - .../Markdown/src/MarkdownViewer.vue | 62 - src/components/Markdown/src/getTheme.ts | 19 - src/components/Markdown/src/typing.ts | 4 - src/components/Menu/index.ts | 4 +- src/components/Menu/src/BasicMenu.vue | 120 +- .../Menu/src/components/BasicMenuItem.vue | 12 +- .../Menu/src/components/BasicSubMenuItem.vue | 24 +- .../Menu/src/components/MenuItemContent.vue | 22 +- src/components/Menu/src/props.ts | 20 +- src/components/Menu/src/types.ts | 10 +- src/components/Menu/src/useOpenKeys.ts | 62 +- src/components/Modal/index.ts | 14 +- src/components/Modal/src/BasicModal.vue | 128 +- src/components/Modal/src/components/Modal.tsx | 30 +- .../Modal/src/components/ModalClose.vue | 30 +- .../Modal/src/components/ModalFooter.vue | 12 +- .../Modal/src/components/ModalHeader.vue | 8 +- .../Modal/src/components/ModalWrapper.vue | 116 +- src/components/Modal/src/hooks/useModal.ts | 140 +- .../Modal/src/hooks/useModalContext.ts | 12 +- .../Modal/src/hooks/useModalDrag.ts | 110 +- .../Modal/src/hooks/useModalFullScreen.ts | 22 +- src/components/Modal/src/props.ts | 14 +- src/components/Modal/src/typing.ts | 124 +- src/components/Page/index.ts | 12 +- src/components/Page/src/PageFooter.vue | 14 +- src/components/Page/src/PageWrapper.vue | 76 +- src/components/Preview/index.ts | 2 - src/components/Preview/src/Functional.vue | 546 --- src/components/Preview/src/Preview.vue | 94 - src/components/Preview/src/functional.ts | 17 - src/components/Preview/src/typing.ts | 49 - src/components/Qrcode/index.ts | 5 - src/components/Qrcode/src/Qrcode.vue | 112 - src/components/Qrcode/src/drawCanvas.ts | 37 - src/components/Qrcode/src/drawLogo.ts | 88 - src/components/Qrcode/src/qrcodePlus.ts | 4 - src/components/Qrcode/src/toCanvas.ts | 10 - src/components/Qrcode/src/typing.ts | 38 - src/components/Scrollbar/index.ts | 6 +- src/components/Scrollbar/src/Scrollbar.vue | 76 +- src/components/Scrollbar/src/bar.ts | 84 +- src/components/Scrollbar/src/types.d.ts | 22 +- src/components/Scrollbar/src/util.ts | 26 +- src/components/SimpleMenu/index.ts | 4 +- src/components/SimpleMenu/src/SimpleMenu.vue | 100 +- .../SimpleMenu/src/SimpleMenuTag.vue | 54 +- .../SimpleMenu/src/SimpleSubMenu.vue | 44 +- .../SimpleMenu/src/components/Menu.vue | 100 +- .../src/components/MenuCollapseTransition.vue | 74 +- .../SimpleMenu/src/components/MenuItem.vue | 68 +- .../SimpleMenu/src/components/SubMenuItem.vue | 177 +- .../SimpleMenu/src/components/useMenu.ts | 64 +- .../src/components/useSimpleMenuContext.ts | 16 +- src/components/SimpleMenu/src/types.ts | 6 +- src/components/SimpleMenu/src/useOpenKeys.ts | 44 +- src/components/StrengthMeter/index.ts | 6 +- .../StrengthMeter/src/StrengthMeter.vue | 42 +- src/components/Table/index.ts | 11 - src/components/Table/src/BasicTable.vue | 453 --- src/components/Table/src/componentMap.ts | 36 - .../src/components/EditTableHeaderIcon.vue | 16 - .../Table/src/components/HeaderCell.vue | 48 - .../Table/src/components/TableAction.vue | 202 -- .../Table/src/components/TableFooter.vue | 94 - .../Table/src/components/TableHeader.vue | 81 - .../Table/src/components/TableImg.vue | 85 - .../Table/src/components/TableTitle.vue | 53 - .../src/components/editable/CellComponent.ts | 44 - .../src/components/editable/EditableCell.vue | 531 --- .../Table/src/components/editable/helper.ts | 28 - .../Table/src/components/editable/index.ts | 68 - .../src/components/settings/ColumnSetting.vue | 482 --- .../components/settings/FullScreenSetting.vue | 38 - .../src/components/settings/RedoSetting.vue | 33 - .../src/components/settings/SizeSetting.vue | 64 - .../Table/src/components/settings/index.vue | 76 - src/components/Table/src/const.ts | 38 - src/components/Table/src/hooks/useColumns.ts | 317 -- .../Table/src/hooks/useCustomRow.ts | 100 - .../Table/src/hooks/useDataSource.ts | 374 --- src/components/Table/src/hooks/useLoading.ts | 21 - .../Table/src/hooks/usePagination.tsx | 85 - .../Table/src/hooks/useRowSelection.ts | 122 - src/components/Table/src/hooks/useScrollTo.ts | 55 - src/components/Table/src/hooks/useTable.ts | 167 - .../Table/src/hooks/useTableContext.ts | 22 - .../Table/src/hooks/useTableExpand.ts | 65 - .../Table/src/hooks/useTableFooter.ts | 56 - .../Table/src/hooks/useTableForm.ts | 50 - .../Table/src/hooks/useTableHeader.ts | 54 - .../Table/src/hooks/useTableScroll.ts | 220 -- .../Table/src/hooks/useTableStyle.ts | 20 - src/components/Table/src/props.ts | 151 - src/components/Table/src/types/column.ts | 198 -- .../Table/src/types/componentType.ts | 11 - src/components/Table/src/types/pagination.ts | 115 - src/components/Table/src/types/table.ts | 478 --- src/components/Table/src/types/tableAction.ts | 39 - src/components/Time/index.ts | 4 - src/components/Time/src/Time.vue | 108 - src/components/Tinymce/index.ts | 4 - src/components/Tinymce/src/Editor.vue | 346 -- src/components/Tinymce/src/ImgUpload.vue | 96 - src/components/Tinymce/src/helper.ts | 81 - src/components/Tinymce/src/tinymce.ts | 13 - src/components/Transition/index.ts | 32 +- .../Transition/src/CollapseTransition.vue | 74 +- .../Transition/src/CreateTransition.tsx | 26 +- .../Transition/src/ExpandTransition.ts | 60 +- src/components/Tree/index.ts | 6 - src/components/Tree/src/BasicTree.vue | 455 --- src/components/Tree/src/TreeIcon.ts | 13 - .../Tree/src/components/TreeHeader.vue | 170 - src/components/Tree/src/hooks/useTree.ts | 207 -- src/components/Tree/src/types/tree.ts | 195 -- src/components/Tree/style/index.less | 52 - src/components/Tree/style/index.ts | 1 - src/components/Upload/index.ts | 4 - src/components/Upload/src/BasicUpload.vue | 123 - src/components/Upload/src/FileList.vue | 104 - src/components/Upload/src/ThumbUrl.vue | 29 - src/components/Upload/src/UploadModal.vue | 322 -- .../Upload/src/UploadPreviewModal.vue | 99 - src/components/Upload/src/data.tsx | 153 - src/components/Upload/src/helper.ts | 27 - src/components/Upload/src/props.ts | 83 - src/components/Upload/src/typing.ts | 55 - src/components/Upload/src/useUpload.ts | 60 - src/components/Verify/index.ts | 7 - src/components/Verify/src/DragVerify.vue | 371 --- src/components/Verify/src/ImgRotate.vue | 220 -- src/components/Verify/src/props.ts | 87 - src/components/Verify/src/typing.ts | 14 - src/components/VirtualScroll/index.ts | 4 - .../VirtualScroll/src/VirtualScroll.vue | 190 -- src/components/registerGlobComp.ts | 8 +- src/directives/clickOutside.ts | 66 +- src/directives/index.ts | 10 +- src/directives/loading.ts | 36 +- src/directives/permission.ts | 26 +- src/directives/repeatClick.ts | 34 +- src/directives/ripple/index.ts | 146 +- src/enums/appEnum.ts | 4 +- src/enums/breakpointEnum.ts | 16 +- src/enums/cacheEnum.ts | 21 +- src/enums/menuEnum.ts | 2 +- src/enums/sizeEnum.ts | 12 +- src/hooks/component/useFormItem.ts | 38 +- src/hooks/component/usePageContext.ts | 16 +- src/hooks/core/onMountedOrActivated.ts | 16 +- src/hooks/core/useAttrs.ts | 40 +- src/hooks/core/useContext.ts | 26 +- src/hooks/core/useLockFn.ts | 17 - src/hooks/core/useRefs.ts | 16 +- src/hooks/core/useTimeout.ts | 38 +- src/hooks/event/useBreakpoint.ts | 76 +- src/hooks/event/useEventListener.ts | 56 +- src/hooks/event/useIntersectionObserver.ts | 38 +- src/hooks/event/useScroll.ts | 70 +- src/hooks/event/useScrollTo.ts | 68 +- src/hooks/event/useWindowSizeFn.ts | 36 +- src/hooks/setting/index.ts | 16 +- src/hooks/setting/useHeaderSetting.ts | 71 +- src/hooks/setting/useMenuSetting.ts | 114 +- src/hooks/setting/useMultipleTabSetting.ts | 20 +- src/hooks/setting/useRootSetting.ts | 61 +- src/hooks/setting/useTransitionSetting.ts | 22 +- src/hooks/web/useAppInject.ts | 8 +- src/hooks/web/useContentHeight.ts | 140 +- src/hooks/web/useContextMenu.ts | 12 - src/hooks/web/useCopyToClipboard.ts | 67 +- src/hooks/web/useDesign.ts | 6 +- src/hooks/web/useECharts.ts | 104 +- src/hooks/web/useFullContent.ts | 26 +- src/hooks/web/useI18n.ts | 50 +- src/hooks/web/useLockPage.ts | 72 - src/hooks/web/useMessage.tsx | 88 +- src/hooks/web/usePage.ts | 48 +- src/hooks/web/usePagination.ts | 28 +- src/hooks/web/usePermission.ts | 80 +- src/hooks/web/useScript.ts | 50 +- src/hooks/web/useSortable.ts | 16 +- src/hooks/web/useTabs.ts | 76 +- src/hooks/web/useTitle.ts | 34 +- src/hooks/web/useWatermark.ts | 124 +- src/layouts/default/content/index.vue | 24 +- .../default/content/useContentContext.ts | 14 +- .../default/content/useContentViewHeight.ts | 32 +- src/layouts/default/feature/index.vue | 44 +- src/layouts/default/footer/index.vue | 46 +- src/layouts/default/header/MultipleHeader.vue | 80 +- .../default/header/components/Breadcrumb.vue | 128 +- .../default/header/components/ErrorAction.vue | 48 - .../default/header/components/FullScreen.vue | 22 +- .../default/header/components/index.ts | 14 +- .../header/components/lock/LockModal.vue | 126 - .../header/components/notify/NoticeList.vue | 48 +- .../default/header/components/notify/data.ts | 32 +- .../header/components/notify/index.vue | 36 +- .../components/user-dropdown/DropMenuItem.vue | 16 +- .../header/components/user-dropdown/index.vue | 76 +- src/layouts/default/header/index.vue | 88 +- src/layouts/default/index.vue | 49 +- src/layouts/default/menu/index.vue | 92 +- src/layouts/default/menu/useLayoutMenu.ts | 92 +- src/layouts/default/setting/SettingDrawer.tsx | 86 +- .../setting/components/InputNumberItem.vue | 18 +- .../default/setting/components/SelectItem.vue | 22 +- .../setting/components/SettingFooter.vue | 72 +- .../default/setting/components/SwitchItem.vue | 26 +- .../setting/components/ThemeColorPicker.vue | 18 +- .../default/setting/components/TypePicker.vue | 14 +- .../default/setting/components/index.ts | 14 +- src/layouts/default/setting/enum.ts | 25 +- src/layouts/default/setting/handler.ts | 133 +- src/layouts/default/setting/index.vue | 14 +- src/layouts/default/sider/DragBar.vue | 24 +- src/layouts/default/sider/LayoutSider.vue | 64 +- src/layouts/default/sider/MixSider.vue | 195 +- src/layouts/default/sider/index.vue | 26 +- src/layouts/default/sider/useLayoutSider.ts | 126 +- .../default/tabs/components/FoldButton.vue | 34 +- .../default/tabs/components/TabContent.vue | 40 +- .../default/tabs/components/TabRedo.vue | 26 +- src/layouts/default/tabs/index.vue | 94 +- src/layouts/default/tabs/types.ts | 12 +- src/layouts/default/tabs/useMultipleTabs.ts | 72 +- src/layouts/default/tabs/useTabDropdown.ts | 98 +- src/layouts/default/trigger/HeaderTrigger.vue | 18 +- src/layouts/default/trigger/SiderTrigger.vue | 12 +- src/layouts/default/trigger/index.vue | 10 +- src/layouts/iframe/index.vue | 29 - src/layouts/iframe/useFrameKeepAlive.ts | 59 - src/layouts/page/index.vue | 37 +- src/layouts/page/transition.ts | 28 +- src/locales/helper.ts | 36 +- src/locales/lang/en.ts | 8 +- src/locales/lang/en/common.ts | 2 +- src/locales/lang/en/component.ts | 2 +- src/locales/lang/en/layout.ts | 11 +- src/locales/lang/en/routes/basic.ts | 2 +- src/locales/lang/en/routes/dashboard.ts | 2 +- src/locales/lang/en/routes/demo.ts | 15 +- src/locales/lang/en/sys.ts | 10 +- .../lang/zh-CN/antdLocale/DatePicker.ts | 2 +- src/locales/lang/zh-CN/common.ts | 2 +- src/locales/lang/zh-CN/component.ts | 2 +- src/locales/lang/zh-CN/layout.ts | 11 +- src/locales/lang/zh-CN/routes/basic.ts | 2 +- src/locales/lang/zh-CN/routes/dashboard.ts | 2 +- src/locales/lang/zh-CN/routes/demo.ts | 14 +- src/locales/lang/zh-CN/sys.ts | 16 +- src/locales/lang/zh_CN.ts | 8 +- src/locales/setupI18n.ts | 38 +- src/locales/useLocale.ts | 62 +- src/logics/error-handle/index.ts | 184 - src/logics/initAppConfig.ts | 80 +- src/logics/mitt/routeChange.ts | 24 +- src/logics/theme/dark.ts | 20 +- src/logics/theme/index.ts | 10 +- src/logics/theme/updateBackground.ts | 58 +- src/logics/theme/updateColorWeak.ts | 4 +- src/logics/theme/updateGrayMode.ts | 4 +- src/logics/theme/util.ts | 12 +- src/main.ts | 55 +- src/router/constant.ts | 16 +- src/router/guard/index.ts | 138 +- src/router/guard/paramMenuGuard.ts | 48 +- src/router/guard/permissionGuard.ts | 88 +- src/router/guard/stateGuard.ts | 34 +- src/router/helper/menuHelper.ts | 76 +- src/router/helper/routeHelper.ts | 148 +- src/router/index.ts | 28 +- src/router/menus/index.ts | 132 +- src/router/routes/basic.ts | 38 +- src/router/routes/index.ts | 35 +- src/router/routes/mainOut.ts | 22 - src/router/routes/modules/about.ts | 10 +- src/router/routes/modules/dashboard.ts | 10 +- src/router/routes/modules/demo/charts.ts | 80 - src/router/routes/modules/demo/comp.ts | 564 ---- src/router/routes/modules/demo/feat.ts | 324 -- src/router/routes/modules/demo/flow.ts | 28 - src/router/routes/modules/demo/iframe.ts | 48 - src/router/routes/modules/demo/level.ts | 68 - src/router/routes/modules/demo/page.ts | 255 -- src/router/routes/modules/demo/permission.ts | 92 - src/router/routes/modules/demo/system.ts | 78 - src/router/routes/modules/{demo => }/setup.ts | 12 +- src/router/types.ts | 56 +- src/settings/componentSetting.ts | 12 +- src/settings/designSetting.ts | 12 +- src/settings/encryptionSetting.ts | 8 +- src/settings/localeSetting.ts | 10 +- src/settings/projectSetting.ts | 21 +- src/settings/siteSetting.ts | 6 +- src/store/index.ts | 10 +- src/store/modules/app.ts | 76 +- src/store/modules/errorLog.ts | 77 - src/store/modules/locale.ts | 32 +- src/store/modules/lock.ts | 59 - src/store/modules/multipleTab.ts | 282 +- src/store/modules/permission.ts | 201 +- src/store/modules/user.ts | 164 +- src/utils/auth/index.ts | 26 +- src/utils/bem.ts | 32 +- src/utils/cache/index.ts | 30 +- src/utils/cache/memory.ts | 76 +- src/utils/cache/persistent.ts | 119 +- src/utils/cache/storageCache.ts | 72 +- src/utils/cipher.ts | 40 +- src/utils/color.ts | 70 +- src/utils/dateUtil.ts | 12 +- src/utils/domUtils.ts | 134 +- src/utils/env.ts | 34 +- src/utils/event/index.ts | 34 +- src/utils/factory/createAsyncComponent.tsx | 24 +- src/utils/file/base64Conver.ts | 44 +- src/utils/file/download.ts | 72 +- src/utils/helper/treeHelper.ts | 156 +- src/utils/helper/tsxHelper.tsx | 28 +- src/utils/http/axios/Axios.ts | 156 +- src/utils/http/axios/axiosCancel.ts | 34 +- src/utils/http/axios/axiosRetry.ts | 16 +- src/utils/http/axios/axiosTransform.ts | 24 +- src/utils/http/axios/checkStatus.ts | 82 +- src/utils/http/axios/helper.ts | 28 +- src/utils/http/axios/index.ts | 171 +- src/utils/index.ts | 62 +- src/utils/is.ts | 54 +- src/utils/lib/echarts.ts | 12 +- src/utils/log.ts | 6 +- src/utils/mitt.ts | 56 +- src/utils/propTypes.ts | 18 +- src/utils/props.ts | 98 +- src/utils/types.ts | 40 +- src/utils/uuid.ts | 26 +- .../analysis/components/GrowCard.vue | 31 +- .../analysis/components/SalesProductPie.vue | 22 +- .../analysis/components/SiteAnalysis.vue | 14 +- .../analysis/components/VisitAnalysis.vue | 16 +- .../analysis/components/VisitAnalysisBar.vue | 16 +- .../analysis/components/VisitRadar.vue | 18 +- .../analysis/components/VisitSource.vue | 20 +- .../dashboard/analysis/components/props.ts | 8 +- src/views/dashboard/analysis/data.ts | 47 +- src/views/dashboard/analysis/index.vue | 18 +- .../workbench/components/DynamicInfo.vue | 10 +- .../workbench/components/ProjectCard.vue | 12 +- .../workbench/components/QuickNav.vue | 8 +- .../workbench/components/SaleRadar.vue | 18 +- .../workbench/components/WorkbenchHeader.vue | 12 +- .../dashboard/workbench/components/data.ts | 32 +- src/views/dashboard/workbench/index.vue | 22 +- src/views/demo/charts/Line.vue | 117 - src/views/demo/charts/Map.vue | 75 - src/views/demo/charts/Pie.vue | 146 - src/views/demo/charts/SaleRadar.vue | 101 - src/views/demo/charts/china.json | 856 ----- src/views/demo/charts/data.ts | 189 -- src/views/demo/charts/map/Baidu.vue | 46 - src/views/demo/charts/map/Gaode.vue | 47 - src/views/demo/charts/map/Google.vue | 53 - src/views/demo/comp/button/index.vue | 112 - src/views/demo/comp/card-list/index.vue | 32 - src/views/demo/comp/count-to/index.vue | 61 - src/views/demo/comp/cropper/index.vue | 100 - src/views/demo/comp/desc/index.vue | 85 - src/views/demo/comp/drawer/Drawer1.vue | 13 - src/views/demo/comp/drawer/Drawer2.vue | 17 - src/views/demo/comp/drawer/Drawer3.vue | 35 - src/views/demo/comp/drawer/Drawer4.vue | 53 - src/views/demo/comp/drawer/Drawer5.vue | 13 - src/views/demo/comp/drawer/index.vue | 69 - src/views/demo/comp/flow-chart/dataTurbo.json | 240 -- src/views/demo/comp/flow-chart/index.vue | 23 - src/views/demo/comp/lazy/TargetContent.vue | 19 - src/views/demo/comp/lazy/Transition.vue | 77 - src/views/demo/comp/lazy/index.vue | 52 - src/views/demo/comp/loading/index.vue | 113 - src/views/demo/comp/modal/Modal1.vue | 65 - src/views/demo/comp/modal/Modal2.vue | 28 - src/views/demo/comp/modal/Modal3.vue | 15 - src/views/demo/comp/modal/Modal4.vue | 85 - src/views/demo/comp/modal/index.vue | 113 - src/views/demo/comp/qrcode/index.vue | 128 - src/views/demo/comp/scroll/Action.vue | 59 - src/views/demo/comp/scroll/VirtualScroll.vue | 64 - src/views/demo/comp/scroll/index.vue | 31 - src/views/demo/comp/strength-meter/index.vue | 32 - src/views/demo/comp/time/index.vue | 44 - src/views/demo/comp/transition/index.vue | 96 - src/views/demo/comp/upload/index.vue | 61 - src/views/demo/comp/verify/Rotate.vue | 33 - src/views/demo/comp/verify/index.vue | 97 - src/views/demo/editor/json/index.vue | 98 - src/views/demo/editor/markdown/Editor.vue | 59 - src/views/demo/editor/markdown/index.vue | 97 - src/views/demo/editor/tinymce/Editor.vue | 59 - src/views/demo/editor/tinymce/index.vue | 21 - src/views/demo/excel/ArrayExport.vue | 37 - src/views/demo/excel/CustomExport.vue | 44 - src/views/demo/excel/ImportExcel.vue | 57 - src/views/demo/excel/JsonExport.vue | 58 - src/views/demo/excel/data.ts | 59 - .../demo/feat/breadcrumb/ChildrenList.vue | 13 - .../feat/breadcrumb/ChildrenListDetail.vue | 10 - src/views/demo/feat/breadcrumb/FlatList.vue | 13 - .../demo/feat/breadcrumb/FlatListDetail.vue | 8 - src/views/demo/feat/click-out-side/index.vue | 43 - src/views/demo/feat/context-menu/index.vue | 85 - src/views/demo/feat/copy/index.vue | 40 - src/views/demo/feat/download/imgBase64.ts | 1 - src/views/demo/feat/download/index.vue | 66 - src/views/demo/feat/full-screen/index.vue | 48 - src/views/demo/feat/icon/index.vue | 96 - src/views/demo/feat/img-preview/index.vue | 31 - src/views/demo/feat/menu-params/index.vue | 42 - src/views/demo/feat/msg/index.vue | 100 - src/views/demo/feat/print/index.vue | 49 - src/views/demo/feat/request-demo/index.vue | 23 - src/views/demo/feat/ripple/index.vue | 31 - src/views/demo/feat/session-timeout/index.vue | 54 - src/views/demo/feat/tab-params/index.vue | 27 - src/views/demo/feat/tabs/TabDetail.vue | 28 - src/views/demo/feat/tabs/index.vue | 69 - src/views/demo/feat/watermark/index.vue | 32 - src/views/demo/feat/ws/index.vue | 127 - src/views/demo/form/AdvancedForm.vue | 195 -- src/views/demo/form/AppendForm.vue | 118 - src/views/demo/form/CustomerForm.vue | 85 - src/views/demo/form/DynamicForm.vue | 246 -- src/views/demo/form/RefForm.vue | 188 -- src/views/demo/form/RuleForm.vue | 258 -- src/views/demo/form/TabsForm.vue | 136 - src/views/demo/form/UseForm.vue | 268 -- src/views/demo/form/index.vue | 667 ---- src/views/demo/level/Menu111.vue | 12 - src/views/demo/level/Menu12.vue | 12 - src/views/demo/level/Menu2.vue | 15 - src/views/demo/main-out/index.vue | 6 - .../demo/page/account/center/Application.vue | 92 - .../demo/page/account/center/Article.vue | 97 - .../demo/page/account/center/Project.vue | 71 - src/views/demo/page/account/center/data.tsx | 132 - src/views/demo/page/account/center/index.vue | 155 - .../demo/page/account/setting/AccountBind.vue | 59 - .../demo/page/account/setting/BaseSetting.vue | 96 - .../demo/page/account/setting/MsgNotify.vue | 53 - .../page/account/setting/SecureSetting.vue | 47 - src/views/demo/page/account/setting/data.ts | 149 - src/views/demo/page/account/setting/index.vue | 61 - src/views/demo/page/desc/basic/data.tsx | 196 -- src/views/demo/page/desc/basic/index.vue | 98 - src/views/demo/page/desc/high/data.tsx | 65 - src/views/demo/page/desc/high/index.vue | 131 - src/views/demo/page/form/basic/data.ts | 138 - src/views/demo/page/form/basic/index.vue | 69 - src/views/demo/page/form/high/PersonTable.vue | 146 - src/views/demo/page/form/high/data.ts | 149 - src/views/demo/page/form/high/index.vue | 73 - src/views/demo/page/form/step/Step1.vue | 103 - src/views/demo/page/form/step/Step2.vue | 78 - src/views/demo/page/form/step/Step3.vue | 49 - src/views/demo/page/form/step/data.tsx | 78 - src/views/demo/page/form/step/index.vue | 96 - src/views/demo/page/list/basic/data.tsx | 17 - src/views/demo/page/list/basic/index.vue | 161 - src/views/demo/page/list/card/data.tsx | 14 - src/views/demo/page/list/card/index.vue | 104 - src/views/demo/page/list/search/data.tsx | 37 - src/views/demo/page/list/search/index.vue | 135 - src/views/demo/page/result/fail/index.vue | 54 - src/views/demo/page/result/success/index.vue | 61 - .../demo/permission/CurrentPermissionMode.vue | 32 - src/views/demo/permission/back/Btn.vue | 107 - src/views/demo/permission/back/index.vue | 70 - src/views/demo/permission/front/AuthPageA.vue | 19 - src/views/demo/permission/front/AuthPageB.vue | 19 - src/views/demo/permission/front/Btn.vue | 93 - src/views/demo/permission/front/index.vue | 57 - .../demo/system/account/AccountDetail.vue | 62 - .../demo/system/account/AccountModal.vue | 74 - src/views/demo/system/account/DeptTree.vue | 43 - src/views/demo/system/account/account.data.ts | 127 - src/views/demo/system/account/index.vue | 137 - src/views/demo/system/dept/DeptModal.vue | 62 - src/views/demo/system/dept/dept.data.ts | 108 - src/views/demo/system/dept/index.vue | 103 - src/views/demo/system/menu/MenuDrawer.vue | 70 - src/views/demo/system/menu/index.vue | 110 - src/views/demo/system/menu/menu.data.ts | 202 -- src/views/demo/system/password/index.vue | 45 - src/views/demo/system/password/pwd.data.ts | 46 - src/views/demo/system/role/RoleDrawer.vue | 88 - src/views/demo/system/role/index.vue | 100 - src/views/demo/system/role/role.data.ts | 124 - src/views/demo/table/AuthColumn.vue | 154 - src/views/demo/table/Basic.vue | 80 - src/views/demo/table/CustomerCell.vue | 108 - src/views/demo/table/EditCellTable.vue | 224 -- src/views/demo/table/EditRowTable.vue | 264 -- src/views/demo/table/ExpandTable.vue | 77 - src/views/demo/table/FetchTable.vue | 43 - src/views/demo/table/FixedColumn.vue | 95 - src/views/demo/table/FixedHeight.vue | 47 - src/views/demo/table/FooterTable.vue | 50 - src/views/demo/table/FormTable.vue | 66 - src/views/demo/table/MergeHeader.vue | 27 - src/views/demo/table/MultipleHeader.vue | 26 - src/views/demo/table/RefTable.vue | 125 - .../demo/table/ResizeParentHeightTable.vue | 79 - src/views/demo/table/TreeTable.vue | 41 - src/views/demo/table/UseTable.vue | 147 - src/views/demo/table/tableData.tsx | 304 -- src/views/demo/tree/ActionTree.vue | 139 - src/views/demo/tree/EditTree.vue | 120 - src/views/demo/tree/data.ts | 118 - src/views/demo/tree/index.vue | 148 - src/views/{demo => }/setup/index.vue | 18 +- src/views/sys/about/index.vue | 40 +- src/views/sys/error-log/DetailModal.vue | 27 - src/views/sys/error-log/data.tsx | 67 - src/views/sys/error-log/index.vue | 97 - src/views/sys/exception/Exception.vue | 80 +- src/views/sys/exception/index.ts | 2 +- src/views/sys/iframe/FrameBlank.vue | 9 - src/views/sys/iframe/index.vue | 90 - src/views/sys/lock/LockPage.vue | 234 -- src/views/sys/lock/index.vue | 13 - src/views/sys/lock/useNow.ts | 60 - src/views/sys/login/ForgetPasswordForm.vue | 34 +- src/views/sys/login/Login.vue | 38 +- src/views/sys/login/LoginForm.vue | 84 +- src/views/sys/login/LoginFormTitle.vue | 17 +- src/views/sys/login/MobileForm.vue | 36 +- src/views/sys/login/QrCodeForm.vue | 31 - src/views/sys/login/RegisterForm.vue | 40 +- src/views/sys/login/SessionTimeoutLogin.vue | 40 +- src/views/sys/login/useLogin.ts | 76 +- src/views/sys/redirect/index.vue | 20 +- tests/server/README.md | 15 - tests/server/controller/FileController.ts | 18 - tests/server/controller/UserController.ts | 15 - tests/server/ecosystem.config.js | 18 - tests/server/index.ts | 63 - tests/server/nodemon.json | 8 - tests/server/package.json | 36 - tests/server/routes.ts | 23 - tests/server/service/FileService.ts | 54 - tests/server/service/UserService.ts | 25 - tests/server/tsconfig.json | 15 - tests/server/utils.ts | 9 - tests/server/yarn.lock | 2955 ----------------- types/axios.d.ts | 50 +- types/config.d.ts | 164 +- types/global.d.ts | 96 +- types/index.d.ts | 24 +- types/module.d.ts | 16 +- types/store.d.ts | 52 +- types/utils.d.ts | 6 +- types/vue-router.d.ts | 44 +- vite.config.ts | 40 +- 716 files changed, 7340 insertions(+), 48285 deletions(-) delete mode 100644 CHANGELOG.en_US.md delete mode 100644 README.zh-CN.md delete mode 100644 src/api/sys/upload.ts delete mode 100644 src/components/Authority/index.ts delete mode 100644 src/components/Authority/src/Authority.vue delete mode 100644 src/components/CardList/index.ts delete mode 100644 src/components/CardList/src/CardList.vue delete mode 100644 src/components/CardList/src/data.ts delete mode 100644 src/components/ClickOutSide/index.ts delete mode 100644 src/components/ClickOutSide/src/ClickOutSide.vue delete mode 100644 src/components/CodeEditor/index.ts delete mode 100644 src/components/CodeEditor/src/CodeEditor.vue delete mode 100644 src/components/CodeEditor/src/codemirror/CodeMirror.vue delete mode 100644 src/components/CodeEditor/src/codemirror/codeMirror.ts delete mode 100644 src/components/CodeEditor/src/codemirror/codemirror.css delete mode 100644 src/components/CodeEditor/src/json-preview/JsonPreview.vue delete mode 100644 src/components/CodeEditor/src/typing.ts delete mode 100644 src/components/ContextMenu/index.ts delete mode 100644 src/components/ContextMenu/src/ContextMenu.vue delete mode 100644 src/components/ContextMenu/src/createContextMenu.ts delete mode 100644 src/components/ContextMenu/src/typing.ts delete mode 100644 src/components/CountTo/index.ts delete mode 100644 src/components/CountTo/src/CountTo.vue delete mode 100644 src/components/Cropper/index.ts delete mode 100644 src/components/Cropper/src/CopperModal.vue delete mode 100644 src/components/Cropper/src/Cropper.vue delete mode 100644 src/components/Cropper/src/CropperAvatar.vue delete mode 100644 src/components/Cropper/src/typing.ts delete mode 100644 src/components/Excel/index.ts delete mode 100644 src/components/Excel/src/Export2Excel.ts delete mode 100644 src/components/Excel/src/ExportExcelModal.vue delete mode 100644 src/components/Excel/src/ImportExcel.vue delete mode 100644 src/components/Excel/src/typing.ts delete mode 100644 src/components/FlowChart/index.ts delete mode 100644 src/components/FlowChart/src/FlowChart.vue delete mode 100644 src/components/FlowChart/src/FlowChartToolbar.vue delete mode 100644 src/components/FlowChart/src/adpterForTurbo.ts delete mode 100644 src/components/FlowChart/src/config.ts delete mode 100644 src/components/FlowChart/src/enum.ts delete mode 100644 src/components/FlowChart/src/types.ts delete mode 100644 src/components/FlowChart/src/useFlowContext.ts delete mode 100644 src/components/Form/index.ts delete mode 100644 src/components/Form/src/BasicForm.vue delete mode 100644 src/components/Form/src/componentMap.ts delete mode 100644 src/components/Form/src/components/ApiCascader.vue delete mode 100644 src/components/Form/src/components/ApiRadioGroup.vue delete mode 100644 src/components/Form/src/components/ApiSelect.vue delete mode 100644 src/components/Form/src/components/ApiTransfer.vue delete mode 100644 src/components/Form/src/components/ApiTree.vue delete mode 100644 src/components/Form/src/components/ApiTreeSelect.vue delete mode 100644 src/components/Form/src/components/FormAction.vue delete mode 100644 src/components/Form/src/components/FormItem.vue delete mode 100644 src/components/Form/src/components/RadioButtonGroup.vue delete mode 100644 src/components/Form/src/helper.ts delete mode 100644 src/components/Form/src/hooks/useAdvanced.ts delete mode 100644 src/components/Form/src/hooks/useAutoFocus.ts delete mode 100644 src/components/Form/src/hooks/useComponentRegister.ts delete mode 100644 src/components/Form/src/hooks/useForm.ts delete mode 100644 src/components/Form/src/hooks/useFormContext.ts delete mode 100644 src/components/Form/src/hooks/useFormEvents.ts delete mode 100644 src/components/Form/src/hooks/useFormValues.ts delete mode 100644 src/components/Form/src/hooks/useLabelWidth.ts delete mode 100644 src/components/Form/src/props.ts delete mode 100644 src/components/Form/src/types/form.ts delete mode 100644 src/components/Form/src/types/formItem.ts delete mode 100644 src/components/Form/src/types/hooks.ts delete mode 100644 src/components/Form/src/types/index.ts delete mode 100644 src/components/Markdown/index.ts delete mode 100644 src/components/Markdown/src/Markdown.vue delete mode 100644 src/components/Markdown/src/MarkdownViewer.vue delete mode 100644 src/components/Markdown/src/getTheme.ts delete mode 100644 src/components/Markdown/src/typing.ts delete mode 100644 src/components/Preview/index.ts delete mode 100644 src/components/Preview/src/Functional.vue delete mode 100644 src/components/Preview/src/Preview.vue delete mode 100644 src/components/Preview/src/functional.ts delete mode 100644 src/components/Preview/src/typing.ts delete mode 100644 src/components/Qrcode/index.ts delete mode 100644 src/components/Qrcode/src/Qrcode.vue delete mode 100644 src/components/Qrcode/src/drawCanvas.ts delete mode 100644 src/components/Qrcode/src/drawLogo.ts delete mode 100644 src/components/Qrcode/src/qrcodePlus.ts delete mode 100644 src/components/Qrcode/src/toCanvas.ts delete mode 100644 src/components/Qrcode/src/typing.ts delete mode 100644 src/components/Table/index.ts delete mode 100644 src/components/Table/src/BasicTable.vue delete mode 100644 src/components/Table/src/componentMap.ts delete mode 100644 src/components/Table/src/components/EditTableHeaderIcon.vue delete mode 100644 src/components/Table/src/components/HeaderCell.vue delete mode 100644 src/components/Table/src/components/TableAction.vue delete mode 100644 src/components/Table/src/components/TableFooter.vue delete mode 100644 src/components/Table/src/components/TableHeader.vue delete mode 100644 src/components/Table/src/components/TableImg.vue delete mode 100644 src/components/Table/src/components/TableTitle.vue delete mode 100644 src/components/Table/src/components/editable/CellComponent.ts delete mode 100644 src/components/Table/src/components/editable/EditableCell.vue delete mode 100644 src/components/Table/src/components/editable/helper.ts delete mode 100644 src/components/Table/src/components/editable/index.ts delete mode 100644 src/components/Table/src/components/settings/ColumnSetting.vue delete mode 100644 src/components/Table/src/components/settings/FullScreenSetting.vue delete mode 100644 src/components/Table/src/components/settings/RedoSetting.vue delete mode 100644 src/components/Table/src/components/settings/SizeSetting.vue delete mode 100644 src/components/Table/src/components/settings/index.vue delete mode 100644 src/components/Table/src/const.ts delete mode 100644 src/components/Table/src/hooks/useColumns.ts delete mode 100644 src/components/Table/src/hooks/useCustomRow.ts delete mode 100644 src/components/Table/src/hooks/useDataSource.ts delete mode 100644 src/components/Table/src/hooks/useLoading.ts delete mode 100644 src/components/Table/src/hooks/usePagination.tsx delete mode 100644 src/components/Table/src/hooks/useRowSelection.ts delete mode 100644 src/components/Table/src/hooks/useScrollTo.ts delete mode 100644 src/components/Table/src/hooks/useTable.ts delete mode 100644 src/components/Table/src/hooks/useTableContext.ts delete mode 100644 src/components/Table/src/hooks/useTableExpand.ts delete mode 100644 src/components/Table/src/hooks/useTableFooter.ts delete mode 100644 src/components/Table/src/hooks/useTableForm.ts delete mode 100644 src/components/Table/src/hooks/useTableHeader.ts delete mode 100644 src/components/Table/src/hooks/useTableScroll.ts delete mode 100644 src/components/Table/src/hooks/useTableStyle.ts delete mode 100644 src/components/Table/src/props.ts delete mode 100644 src/components/Table/src/types/column.ts delete mode 100644 src/components/Table/src/types/componentType.ts delete mode 100644 src/components/Table/src/types/pagination.ts delete mode 100644 src/components/Table/src/types/table.ts delete mode 100644 src/components/Table/src/types/tableAction.ts delete mode 100644 src/components/Time/index.ts delete mode 100644 src/components/Time/src/Time.vue delete mode 100644 src/components/Tinymce/index.ts delete mode 100644 src/components/Tinymce/src/Editor.vue delete mode 100644 src/components/Tinymce/src/ImgUpload.vue delete mode 100644 src/components/Tinymce/src/helper.ts delete mode 100644 src/components/Tinymce/src/tinymce.ts delete mode 100644 src/components/Tree/index.ts delete mode 100644 src/components/Tree/src/BasicTree.vue delete mode 100644 src/components/Tree/src/TreeIcon.ts delete mode 100644 src/components/Tree/src/components/TreeHeader.vue delete mode 100644 src/components/Tree/src/hooks/useTree.ts delete mode 100644 src/components/Tree/src/types/tree.ts delete mode 100644 src/components/Tree/style/index.less delete mode 100644 src/components/Tree/style/index.ts delete mode 100644 src/components/Upload/index.ts delete mode 100644 src/components/Upload/src/BasicUpload.vue delete mode 100644 src/components/Upload/src/FileList.vue delete mode 100644 src/components/Upload/src/ThumbUrl.vue delete mode 100644 src/components/Upload/src/UploadModal.vue delete mode 100644 src/components/Upload/src/UploadPreviewModal.vue delete mode 100644 src/components/Upload/src/data.tsx delete mode 100644 src/components/Upload/src/helper.ts delete mode 100644 src/components/Upload/src/props.ts delete mode 100644 src/components/Upload/src/typing.ts delete mode 100644 src/components/Upload/src/useUpload.ts delete mode 100644 src/components/Verify/index.ts delete mode 100644 src/components/Verify/src/DragVerify.vue delete mode 100644 src/components/Verify/src/ImgRotate.vue delete mode 100644 src/components/Verify/src/props.ts delete mode 100644 src/components/Verify/src/typing.ts delete mode 100644 src/components/VirtualScroll/index.ts delete mode 100644 src/components/VirtualScroll/src/VirtualScroll.vue delete mode 100644 src/hooks/core/useLockFn.ts delete mode 100644 src/hooks/web/useContextMenu.ts delete mode 100644 src/hooks/web/useLockPage.ts delete mode 100644 src/layouts/default/header/components/ErrorAction.vue delete mode 100644 src/layouts/default/header/components/lock/LockModal.vue delete mode 100644 src/layouts/iframe/index.vue delete mode 100644 src/layouts/iframe/useFrameKeepAlive.ts delete mode 100644 src/logics/error-handle/index.ts delete mode 100644 src/router/routes/mainOut.ts delete mode 100644 src/router/routes/modules/demo/charts.ts delete mode 100644 src/router/routes/modules/demo/comp.ts delete mode 100644 src/router/routes/modules/demo/feat.ts delete mode 100644 src/router/routes/modules/demo/flow.ts delete mode 100644 src/router/routes/modules/demo/iframe.ts delete mode 100644 src/router/routes/modules/demo/level.ts delete mode 100644 src/router/routes/modules/demo/page.ts delete mode 100644 src/router/routes/modules/demo/permission.ts delete mode 100644 src/router/routes/modules/demo/system.ts rename src/router/routes/modules/{demo => }/setup.ts (66%) delete mode 100644 src/store/modules/errorLog.ts delete mode 100644 src/store/modules/lock.ts delete mode 100644 src/views/demo/charts/Line.vue delete mode 100644 src/views/demo/charts/Map.vue delete mode 100644 src/views/demo/charts/Pie.vue delete mode 100644 src/views/demo/charts/SaleRadar.vue delete mode 100644 src/views/demo/charts/china.json delete mode 100644 src/views/demo/charts/data.ts delete mode 100644 src/views/demo/charts/map/Baidu.vue delete mode 100644 src/views/demo/charts/map/Gaode.vue delete mode 100644 src/views/demo/charts/map/Google.vue delete mode 100644 src/views/demo/comp/button/index.vue delete mode 100644 src/views/demo/comp/card-list/index.vue delete mode 100644 src/views/demo/comp/count-to/index.vue delete mode 100644 src/views/demo/comp/cropper/index.vue delete mode 100644 src/views/demo/comp/desc/index.vue delete mode 100644 src/views/demo/comp/drawer/Drawer1.vue delete mode 100644 src/views/demo/comp/drawer/Drawer2.vue delete mode 100644 src/views/demo/comp/drawer/Drawer3.vue delete mode 100644 src/views/demo/comp/drawer/Drawer4.vue delete mode 100644 src/views/demo/comp/drawer/Drawer5.vue delete mode 100644 src/views/demo/comp/drawer/index.vue delete mode 100644 src/views/demo/comp/flow-chart/dataTurbo.json delete mode 100644 src/views/demo/comp/flow-chart/index.vue delete mode 100644 src/views/demo/comp/lazy/TargetContent.vue delete mode 100644 src/views/demo/comp/lazy/Transition.vue delete mode 100644 src/views/demo/comp/lazy/index.vue delete mode 100644 src/views/demo/comp/loading/index.vue delete mode 100644 src/views/demo/comp/modal/Modal1.vue delete mode 100644 src/views/demo/comp/modal/Modal2.vue delete mode 100644 src/views/demo/comp/modal/Modal3.vue delete mode 100644 src/views/demo/comp/modal/Modal4.vue delete mode 100644 src/views/demo/comp/modal/index.vue delete mode 100644 src/views/demo/comp/qrcode/index.vue delete mode 100644 src/views/demo/comp/scroll/Action.vue delete mode 100644 src/views/demo/comp/scroll/VirtualScroll.vue delete mode 100644 src/views/demo/comp/scroll/index.vue delete mode 100644 src/views/demo/comp/strength-meter/index.vue delete mode 100644 src/views/demo/comp/time/index.vue delete mode 100644 src/views/demo/comp/transition/index.vue delete mode 100644 src/views/demo/comp/upload/index.vue delete mode 100644 src/views/demo/comp/verify/Rotate.vue delete mode 100644 src/views/demo/comp/verify/index.vue delete mode 100644 src/views/demo/editor/json/index.vue delete mode 100644 src/views/demo/editor/markdown/Editor.vue delete mode 100644 src/views/demo/editor/markdown/index.vue delete mode 100644 src/views/demo/editor/tinymce/Editor.vue delete mode 100644 src/views/demo/editor/tinymce/index.vue delete mode 100644 src/views/demo/excel/ArrayExport.vue delete mode 100644 src/views/demo/excel/CustomExport.vue delete mode 100644 src/views/demo/excel/ImportExcel.vue delete mode 100644 src/views/demo/excel/JsonExport.vue delete mode 100644 src/views/demo/excel/data.ts delete mode 100644 src/views/demo/feat/breadcrumb/ChildrenList.vue delete mode 100644 src/views/demo/feat/breadcrumb/ChildrenListDetail.vue delete mode 100644 src/views/demo/feat/breadcrumb/FlatList.vue delete mode 100644 src/views/demo/feat/breadcrumb/FlatListDetail.vue delete mode 100644 src/views/demo/feat/click-out-side/index.vue delete mode 100644 src/views/demo/feat/context-menu/index.vue delete mode 100644 src/views/demo/feat/copy/index.vue delete mode 100644 src/views/demo/feat/download/imgBase64.ts delete mode 100644 src/views/demo/feat/download/index.vue delete mode 100644 src/views/demo/feat/full-screen/index.vue delete mode 100644 src/views/demo/feat/icon/index.vue delete mode 100644 src/views/demo/feat/img-preview/index.vue delete mode 100644 src/views/demo/feat/menu-params/index.vue delete mode 100644 src/views/demo/feat/msg/index.vue delete mode 100644 src/views/demo/feat/print/index.vue delete mode 100644 src/views/demo/feat/request-demo/index.vue delete mode 100644 src/views/demo/feat/ripple/index.vue delete mode 100644 src/views/demo/feat/session-timeout/index.vue delete mode 100644 src/views/demo/feat/tab-params/index.vue delete mode 100644 src/views/demo/feat/tabs/TabDetail.vue delete mode 100644 src/views/demo/feat/tabs/index.vue delete mode 100644 src/views/demo/feat/watermark/index.vue delete mode 100644 src/views/demo/feat/ws/index.vue delete mode 100644 src/views/demo/form/AdvancedForm.vue delete mode 100644 src/views/demo/form/AppendForm.vue delete mode 100644 src/views/demo/form/CustomerForm.vue delete mode 100644 src/views/demo/form/DynamicForm.vue delete mode 100644 src/views/demo/form/RefForm.vue delete mode 100644 src/views/demo/form/RuleForm.vue delete mode 100644 src/views/demo/form/TabsForm.vue delete mode 100644 src/views/demo/form/UseForm.vue delete mode 100644 src/views/demo/form/index.vue delete mode 100644 src/views/demo/level/Menu111.vue delete mode 100644 src/views/demo/level/Menu12.vue delete mode 100644 src/views/demo/level/Menu2.vue delete mode 100644 src/views/demo/main-out/index.vue delete mode 100644 src/views/demo/page/account/center/Application.vue delete mode 100644 src/views/demo/page/account/center/Article.vue delete mode 100644 src/views/demo/page/account/center/Project.vue delete mode 100644 src/views/demo/page/account/center/data.tsx delete mode 100644 src/views/demo/page/account/center/index.vue delete mode 100644 src/views/demo/page/account/setting/AccountBind.vue delete mode 100644 src/views/demo/page/account/setting/BaseSetting.vue delete mode 100644 src/views/demo/page/account/setting/MsgNotify.vue delete mode 100644 src/views/demo/page/account/setting/SecureSetting.vue delete mode 100644 src/views/demo/page/account/setting/data.ts delete mode 100644 src/views/demo/page/account/setting/index.vue delete mode 100644 src/views/demo/page/desc/basic/data.tsx delete mode 100644 src/views/demo/page/desc/basic/index.vue delete mode 100644 src/views/demo/page/desc/high/data.tsx delete mode 100644 src/views/demo/page/desc/high/index.vue delete mode 100644 src/views/demo/page/form/basic/data.ts delete mode 100644 src/views/demo/page/form/basic/index.vue delete mode 100644 src/views/demo/page/form/high/PersonTable.vue delete mode 100644 src/views/demo/page/form/high/data.ts delete mode 100644 src/views/demo/page/form/high/index.vue delete mode 100644 src/views/demo/page/form/step/Step1.vue delete mode 100644 src/views/demo/page/form/step/Step2.vue delete mode 100644 src/views/demo/page/form/step/Step3.vue delete mode 100644 src/views/demo/page/form/step/data.tsx delete mode 100644 src/views/demo/page/form/step/index.vue delete mode 100644 src/views/demo/page/list/basic/data.tsx delete mode 100644 src/views/demo/page/list/basic/index.vue delete mode 100644 src/views/demo/page/list/card/data.tsx delete mode 100644 src/views/demo/page/list/card/index.vue delete mode 100644 src/views/demo/page/list/search/data.tsx delete mode 100644 src/views/demo/page/list/search/index.vue delete mode 100644 src/views/demo/page/result/fail/index.vue delete mode 100644 src/views/demo/page/result/success/index.vue delete mode 100644 src/views/demo/permission/CurrentPermissionMode.vue delete mode 100644 src/views/demo/permission/back/Btn.vue delete mode 100644 src/views/demo/permission/back/index.vue delete mode 100644 src/views/demo/permission/front/AuthPageA.vue delete mode 100644 src/views/demo/permission/front/AuthPageB.vue delete mode 100644 src/views/demo/permission/front/Btn.vue delete mode 100644 src/views/demo/permission/front/index.vue delete mode 100644 src/views/demo/system/account/AccountDetail.vue delete mode 100644 src/views/demo/system/account/AccountModal.vue delete mode 100644 src/views/demo/system/account/DeptTree.vue delete mode 100644 src/views/demo/system/account/account.data.ts delete mode 100644 src/views/demo/system/account/index.vue delete mode 100644 src/views/demo/system/dept/DeptModal.vue delete mode 100644 src/views/demo/system/dept/dept.data.ts delete mode 100644 src/views/demo/system/dept/index.vue delete mode 100644 src/views/demo/system/menu/MenuDrawer.vue delete mode 100644 src/views/demo/system/menu/index.vue delete mode 100644 src/views/demo/system/menu/menu.data.ts delete mode 100644 src/views/demo/system/password/index.vue delete mode 100644 src/views/demo/system/password/pwd.data.ts delete mode 100644 src/views/demo/system/role/RoleDrawer.vue delete mode 100644 src/views/demo/system/role/index.vue delete mode 100644 src/views/demo/system/role/role.data.ts delete mode 100644 src/views/demo/table/AuthColumn.vue delete mode 100644 src/views/demo/table/Basic.vue delete mode 100644 src/views/demo/table/CustomerCell.vue delete mode 100644 src/views/demo/table/EditCellTable.vue delete mode 100644 src/views/demo/table/EditRowTable.vue delete mode 100644 src/views/demo/table/ExpandTable.vue delete mode 100644 src/views/demo/table/FetchTable.vue delete mode 100644 src/views/demo/table/FixedColumn.vue delete mode 100644 src/views/demo/table/FixedHeight.vue delete mode 100644 src/views/demo/table/FooterTable.vue delete mode 100644 src/views/demo/table/FormTable.vue delete mode 100644 src/views/demo/table/MergeHeader.vue delete mode 100644 src/views/demo/table/MultipleHeader.vue delete mode 100644 src/views/demo/table/RefTable.vue delete mode 100644 src/views/demo/table/ResizeParentHeightTable.vue delete mode 100644 src/views/demo/table/TreeTable.vue delete mode 100644 src/views/demo/table/UseTable.vue delete mode 100644 src/views/demo/table/tableData.tsx delete mode 100644 src/views/demo/tree/ActionTree.vue delete mode 100644 src/views/demo/tree/EditTree.vue delete mode 100644 src/views/demo/tree/data.ts delete mode 100644 src/views/demo/tree/index.vue rename src/views/{demo => }/setup/index.vue (75%) delete mode 100644 src/views/sys/error-log/DetailModal.vue delete mode 100644 src/views/sys/error-log/data.tsx delete mode 100644 src/views/sys/error-log/index.vue delete mode 100644 src/views/sys/iframe/FrameBlank.vue delete mode 100644 src/views/sys/iframe/index.vue delete mode 100644 src/views/sys/lock/LockPage.vue delete mode 100644 src/views/sys/lock/index.vue delete mode 100644 src/views/sys/lock/useNow.ts delete mode 100644 src/views/sys/login/QrCodeForm.vue delete mode 100644 tests/server/README.md delete mode 100644 tests/server/controller/FileController.ts delete mode 100644 tests/server/controller/UserController.ts delete mode 100644 tests/server/ecosystem.config.js delete mode 100644 tests/server/index.ts delete mode 100644 tests/server/nodemon.json delete mode 100644 tests/server/package.json delete mode 100644 tests/server/routes.ts delete mode 100644 tests/server/service/FileService.ts delete mode 100644 tests/server/service/UserService.ts delete mode 100644 tests/server/tsconfig.json delete mode 100644 tests/server/utils.ts delete mode 100644 tests/server/yarn.lock diff --git a/.vscode/settings.json b/.vscode/settings.json index a947eb97..c8702cf4 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -109,7 +109,6 @@ "esnext", "antv", "tinymce", - "qrcode", "sider", "pinia", "sider", diff --git a/CHANGELOG.en_US.md b/CHANGELOG.en_US.md deleted file mode 100644 index 345e8333..00000000 --- a/CHANGELOG.en_US.md +++ /dev/null @@ -1,1262 +0,0 @@ -## 2.8.0(2021-11.03) - -### Upgrade Instructions - -- Package manager changed from `yarn` to `pnpm` -- Delete `node_modules` and `yarn.lock`, install `pnpm` globally -- Execute `pnpm install` - -### ✨ Features - -- **Others** - - The `VITE_PROXY` configuration in the `.env` file supports single quotes - - Remove warnings during build - -### 🐛 Bug Fixes - -- **BasicTable** - - Fix the issue that editable cells cannot be submitted in some cases - - Fix the problem that the `inset` attribute does not work - - Fix the problem that the performance of `useTable` and `reload` method `await` of `BasicTable` instance are inconsistent - - Fix the issue that `clickToRowSelect` would ignore the disabled state of the row selection box - - Fix the problem that the page of `BasicTable` will be reset in some cases - - Modify the `deleteTableDataRecord` method -- **BasicModal** - - Fixed the problem that `Modal` could not be closed even when clicking on the mask and pressing the `Esc` key - - Fixed the issue that clicking the close button and the blank area next to the maximize button would also cause `Modal` to close -- **BasicTree** Fix the problem that the node slot does not work -- **CodeEditor** Fix the problem that may cause `Build` failure -- **BasicForm** Fix the problem that the content width of the custom FormItem component may be out of range -- **ApiTreeSelect** Fix the problem that the change of `params` failed to trigger the re-request of api data -- **Others** -Fixed an issue where multiple tabs would not jump to routing when closing tabs in some cases - - Fix the issue that some components may cause abnormal hot update - - Fix the problem that some sub-components of `antdv` will be reported in the build process when directly `import` part of the `antdv`, such as: TabPane, RadioGroup - -## 2.7.2(2021-09-14) - -### ✨ Features - -- **BasicForm** New `Divider` in the form component for dividing the area of longer forms -- **BasicTable** - - Cell editor adds submit callback, which will decide whether to submit data to the form based on the result returned by the callback function - - Add check method for row editing, allowing only check but not submit value, so asynchronously save data successfully before submit to table - - Fix the problem that the `rowClassName` property cannot be used at the same time as `striped`. -- New component **MarkdownViewer** for displaying rich text in Markdown format - -### 🐛 Bug Fixes - -- **CodeEditor** Fix JSON editor throwing exception when formatting invalid JSON text -- **Tinymce** fixes an issue where inline mode throws an exception in some scenarios -- **BasicTable** - - Repair the problem that the editing icon is not displayed when the content of editable cell is empty - - Repair the problem that the total row at the end of the table sometimes fails to align with the columns in the main part of the table. -- **MarkDown** Repair the problem that the value of initial value property does not work. -- **BasicUpload** Repair the problem that `accept` property does not support `MIME` and suffix name starting with dot. -- **ApiSelect** Fix the problem of type definition of `value` property. -- **Other** - - Repair the problem that some wrapper components give error when using slots. - - Repair the problem that `theme` parameter of `useECharts` does not work. - - Repair the problem that when `Token` is invalid, pressing F5 to refresh the page may cause abnormal page loading. - - Repair the problem that the improper call of `useRedo` may lead to `path` redirection abnormality. - - Repair the problem that `vite` custom mode name does not support underscore. - -## 2.7.1(2021-08-16) - -- Upgrade vue 3.2, if the operation fails, delete node_modules and reinstall it - -### ✨ Features - -- **BasicTree** Add search function related properties and methods -- **BasicForm** added `alwaysShowLines` to set the number of lines kept displayed when folding - -### 🐛 Bug Fixes - -- **Cropper** Fix the problem of failure to destroy in time -- **BasicTable** - - Fix the problem that `CellFormat` cannot use `Map` type data - - Fixed an issue where the editable cell failed to display the `0` value correctly - - Fixed the issue that selection-change event failed to trigger correctly when unchecked - - Fix the problem that the background color of the full screen state under the light theme is incorrect - - Fix the problem of obtaining complete data when `getSelectRows` does not support remote data cross-page selection - - Fix the issue that the `size` property provided for editing components in `editComponentProps` is invalid -- **Qrcode** Fixed the problem that the QR code component could not be drawn in time when it was created -- **BasicModal** Fix the problem that the `helpMessage` property does not work -- **BasicButton** Fix the problem that the button style performance is inconsistent with the official antd -- **Others** Fix the problem that `useRedo` (reload the current route) will lose route `params` data - -## 2.7.0(2021-08-03) - -## (Breaking changes) Breaking changes - -- Restore the project `tailwindcss` back to `windicss`, tried `tailwindcss`, there may be a lot of problems, first switch back to `windicss` to improve development efficiency and lower switching costs. - - There are currently incompatible areas of the project - - The wording of `xl:!m-4` needs to be changed to `!xl:m-4`, note that only `!` is incompatible. If you don’t use it, you don’t need to change it. - - The memory overflow problem may still exist (low frequency, just restart, restart vite faster) - -### ✨ Features - -- **Preview** Add new properties and events -- **Dark Theme** added support for tailwindcss night mode -- **Others** add setTip method for useLoading - -### 🐛 Bug Fixes - -- **ApiTreeSelect** Fixed the problem of failing to monitor `params` changes correctly -- **ImgRotateDragVerify** Fix the problem that the component `resume` method cannot be called -- **TableAction** Fix the problem that the stopButtonPropagation property does not work in some cases -- **PageWrapper** Fix the problem of invalid `class` attribute -- **BasicTree** Fix the problem that the `checkAll` method will affect the `disabled` state node -- **BasicTable** - - Fix the issue that editable cells do not support `ellipsis` configuration - - Fixed the problem that the pop-up layer of sub-components (popconfirm and edit components such as select and treeSelect) cannot be seen in full-screen mode - - Fixed an issue where when `expandRowByClick` is enabled, clicking non-expandable rows may cause style errors - - Fix the problem that the dynamic change of `pagination` property does not take effect - - Fix the problem that `getSelectRows` does not support the child data of the tree table -**Dark Theme** Fix the color matching problem under the dark theme - - Fix the background color of the selected node of the `Tree` component - - Fix the color configuration of the `Alert` component - - Fix the problem of the button color of `link` type in the disabled state - - Fix the style problem of checked checkboxes in `Tree` -**Others** Fix the problem that useScript failed to automatically remove the script node - -## 2.6.1(2021-07-19) - -### ✨ Features - -- **NoticeList** Add pagination, auto omit for overlength, title click event, title strikethrough, etc. -- **MixSider** Optimize the style of the bottom collapse button in the Mix menu layout to be consistent with the style of other menu layouts -- **ApiTreeSelect** Extend `TreeSelect` component of `antdv` to support remote data source, similar to `ApiSelect`. -- **BasicTable** New `ApiTreeSelect` editing component -- Different backend home pages can be specified for different users. - - Add `homePath` field (optional) to the user information returned by the `getUserInfo` interface to customize the home page path for the current user - -### 🐛 Bug Fixes - -- **BasicTable** - - Fix scrollbar style issue (removed scroll style patch) - - Fix the alignment problem of cells with expanded icons in tree tables - - Add `headerTop` slot. - - Fix the color display of the operation column button in disabled state. - - Repair the problem that the values of editable cells cannot be updated by modifying `dataSource` directly. - - Repair the problem of data replay when using `ApiSelect` to edit components. - - Repair the problem that editing components may report `onXXX` type error in some scenarios. -- **TableAction** - - Create Tooltip component only if `action.tooltip` exists. - - Fix the problem that the content of the round button inside the component is not centered -- **AppSearch** Fix the problem that the hidden menu may be searched. -- **BasicUpload** Repair the problem of error when handling non-`array` values. -- **Form** Repair the `suffix` slot style problem of `FormItem`. -- **Menu** - - Repair the hovering trigger logic of the left mixed menu - - Repair the problem that the top bar menu is wrong when displaying menu items that need to be hidden. - - Fix the left mixed menu in hover trigger mode will jump to route directly when there is no submenu and it is activated -- **Breadcrumb** Repair the problem that the menu with redirection cannot be jumped when clicked -- **Markdown** fixes an initialization exception and an issue where value was not set dynamically correctly -- **Modal** Make sure props are passed correctly -- **MultipleTab** fixes an issue that could accidentally create login route tabs -- **BasicTree** Fix the problem that the search function may cause `checkedKeys` to be lost -- **CodeEditor** Fix the problem that value does not support v-model usage. -- **CountdownInput** Fix the problem that `input` slot is not supported. -- **ApiSelect** Fix the problem that the `options-change` event parameter is not the standard `options` data used by `select -- **Other** - - Fix the problem that the configuration of default menu collapse does not work - - Repair the problem that `safari` browser reports an error and the website cannot be opened. - - Repair the problem that eslint keeps error due to endOfLine after pulling the code on window. - - Fix `Vue Router warn` caused by dynamic routing - -### 🎫 Chores - -- Add test environment test command - -## 2.6.0(2021-07-04) - -### ✨ Features - -- **Axios** New `withToken` configuration to control whether the request carries a token or not -- **BasicUpload** - - New `preview-delete` event triggered when deleting a file in preview `Modal`. - - `value` supports `v-model` usage -- **Route configuration** - - Add `ignoreRoute` to generate menu only in `ROUTE_MAPPING` or `BACK` permission mode - - Add `hidePathForChildren` configuration to ignore this level `path` when generating menus for child items -- **TableAction** Add `tooltip` configuration to add tooltip hint for button -- **CropperAvatar** - - Added `value` to set the current avatar - - Added `onChange` to accept avatar cropping and upload success event - - New `btnText`, `btnProps` for customizing the text and properties of the upload button - - Add tooltips to the action buttons in `Modal` for cropping -- **Modal** Add tooltip for action button in top right corner - -### 🐛 Bug Fixes - -- **Modal** - - Fix the problem that the mask cannot be closed by clicking on it. - - Fix `setModalProps` does not support setting `defaultFullscreen`. -- **Table** - - Fix the problem that `editComponentProps` doesn't support `onChange`. - - Fix the problem that `selection-change` event is not triggered when `clickToRowSelect` is enabled. - - Fix the problem that global configuration `fetchSetting` may be accidentally modified by local configuration. - - Fix the problem that the parameter of `handleSearchInfoFn` contains redundant blank keys. - - Repair the problem that when rowSelection.onChange is provided for table, the selected items of table cannot be changed manually. - - Fix the problem that the scrollbar continues to be displayed even when it is not needed to be displayed. -- **Icon** Repair the problem that SvgIcon is missing some styles. -- **Menu** - - Repair the problem that single-level menu refreshing will not be activated in route mapping mode. - - Repair the problem that the collapse customization at the bottom of the side menu is invalid. -- **Form** Repair the type definition of `submitButtonOptions` and `resetButtonOptions`. -- **PopConfirmButton** Remove the redundant `title` on `Button`. -- **Axios** Fix the problem that `params` and `data` data cannot be submitted at the same time when non-`GET` requests are made -- **Other** - - Repair the problem that the lock screen function can skip the lock state by refreshing the page or copying the URL to open a new browser tab - - Repair the problem that `Token` won't be synchronized when multiple windows open pages at the same time. - - Repair the problem that `hasPermission` does not work in `ROLE` permission mode. -- **Table** Repair the problem that the parameter of `handleSearchInfoFn` contains extra blank keys. -- **Tailwindcss** Remove console warning - -## 2.5.2(2021-06-27) - -### ⚡ Performance Improvements - -- **Icon** Remove the global registration of Icon components to prevent hot update issues under certain circumstances - -### ✨ Features - -- **Menu** Added `permissionMode=PermissionModeEnum.ROUTE_MAPPING` mode - - The project is changed to this mode by default, and the original menu file is deleted - - If you have written the menu before, you can change to `PermissionModeEnum.ROLE` mode - -## 2.5.1(2021-06-26) - -### ⚡ Performance Improvements - -- Upgrade `vue` and `ant-design-vue` versions to solve compatibility issues -- **Tree** Performance optimization - -### 🐛 Bug Fixes - -- **Table** Fix page jitter problem -- **Upload** Make sure to carry custom parameters -- **Dropdown** Fix the icon display problem of popConfirm -- **Table** Fix the problem that the editing event of the tree table is abnormal -- **Table** Fix the problem that when the table data is empty, the value returned by getDataSource is not the data source used by the table - -## 2.5.0(2021-06-20) - -## (Breaking changes) Breaking changes - -- Change the project `windicss` to `tailwindcss` to solve the memory overflow problem - - There are currently incompatible areas of the project - - The wording of `!xl:m-4` needs to be changed to `xl:!m-4`, note that only `!` is incompatible. If you don’t use it, you don’t need to change it. - - The new features of `windicss` itself need to be adjusted, for example, `Attribute` mode is not compatible - -### ✨ Refactor - -- Remove `useExpose` and use `expose` provided by the component itself instead - -### ⚡ Performance Improvements - -- **Locale** merge multi-language files to reduce the number of files -- **Utils** Mitt default export is changed from `Class` to `Function` -- **Axios** `isTransformRequestResult` is renamed to `isTransformResponse` - -### ✨ Features - -- **CropperImage** `Cropper` Avatar cropping adds circular cropping function -- **CropperAvatar** Added avatar upload component -- **Drawer** `useDrawer` added `closeDrawer` function -- **Preview** Added `createImgPreview` picture preview function -- **Setup** New guide page example -- **Tests** Add jest test suite, Vue component single test is not currently supported -- **Axios** Added `authenticationScheme` configuration to specify the authentication scheme -- **Setting** Added `sessionTimeoutProcessing` project configuration item, used to configure how to deal with session timeout - -### 🐛 Bug Fixes - -- **Modal** fix full screen height calculation error -- **Modal** Fix the problem that the shutdown event is triggered multiple times -- **PageWrapper** fix the height calculation problem -- **FlowChart** Repair drag and drop menu missing -- Fixed Iframe routing error in background mode -- **PageWrapper** Fix the height calculation problem when footer and global footer are opened at the same time -- **Menu** Fix the jitter problem of menu folding animation -- **Store** fixed type error after pinia version upgrade - -## 2.4.2(2021-06-10) - -### ✨ Refactor - -- `CountTo` component refactoring - -### ✨ Features - -- `radioButtonGroup` supports `boolean` value -- `useModalInner` added `redoModalHeight` to reset the height of `Modal` inside Modal -- `useECharts` added `getInstance` to obtain instances of `echart` -- `TableAction` added `stopButtonPropagation` to prevent the action button click event from bubbling -- `BasicTable` in the row edit mode, you can get or set the value of other editing components in the column -- The `ApiSelect` component will automatically re-fetch the data after the `params` is changed -- `TableImg` component improvement -- `BasicTable` added `columns-change` event to monitor the user to change the sorting, display, and fixed status of columns -- `Tinymce` supports dynamic modification readonly -- `BasicTable` added `updateTableDataRecord` method to update the specified row data -- `useModal` added `closeModal` method to close `Modal` - -### 🐛 Bug Fixes - -- Fix the problem that `redoModalHeight` cannot reduce the height -- Fix the problem that the schema data of `BasicForm` does not take effect -- Fix the problem that multiple tags may cause `KeepAlive` to fail -- Fix the problem that the default `axios` interceptor cannot handle custom code -- Fix the height issue of the lock screen pop-up window -- Fixed the problem that the half-selected state of the `Column Display` checkbox of `BaiscTable` was incorrectly displayed -- Fixed the problem that the preview list of the `BasicUpload` component could not be displayed in some cases -- Fix the problem that the `options` setting of ` RadioButtonGroup``disabled ` does not take effect -- Fix the problem that the button for uploading pictures in the read-only mode of the `Tinymce` component is still available -- Fix the stuttering problem of `BasicForm` under certain circumstances -- Fix the problem that "directory" routing does not work - -## 2.4.1(2021-06-01) - -### ✨ Features - -- Add `DatePicker` and `TimePicker` components to editable tables -- Added `defaultExpandLevel` configuration to `Tree` component - -### ⚡ Performance Improvements - --Menu search default focus - -### 🐛 Bug Fixes - -- Fix known issues of `CodeEditor` -- Fix the issue of `i18n` console warning -- Fix the problem that the editable table `align` configuration does not take effect -- Ensure that `axios` only processes `Object` parameters -- Fix the failure of the `defaultExpandAll` configuration of the `Tree` component -- Fix the problem of missing dividing line in `TableAction` -- Fix the known issues of the table -- Fix that the lang attribute of HTML will not be set when reloading due to the first loading or changing the language - -## 2.4.0 (2021-05-25) - -### ✨ Features - --New graphical editor example -New code editor (including Json editor) -Added `JsonPreview`Json data viewing component -The fields of the data column and actionColumn of the table can be controlled according to the authority and business. -Added an example of a permission control table (AuthColumn.vue) -Added user login expiration example - -### ⚡ Performance Improvements - --Consolidate some language files to reduce the number of files - -### 🐛 Bug Fixes - --Fix the flashing white screen when the dark theme refreshes -Fix the problem that other functions are invalid when the tab is closed -Fix known issues in the form -Fix the automatic lock screen failure - -## 2.3.0 (2021-04-10) - -## (Breaking changes) Breaking changes - -- Use `pinia` to replace `vuex`, `vuex-module-decorators`. - - -Impact, if you used vuex-module-decorators yourself before, you need to transform it to pinia. - - - the reason: -pinia is basically similar to vuex5api and is easy to understand. -Subsequent switching to vuex5 has a very low cost and can also be used as a third-party state management library - -- Remove `useKeyPress` and use `vueuse`-`onKeyStroke` instead -- Remove `useDebounceFn` and use `vueuse`-`useDebounceFn` instead -- Remove `useThrottle` and use `vueuse`-`useThrottleFn` instead - -### ✨ Features - -- Tabs support persistent storage - -### ✨ Refactor - -- Remove `useElResize` - -### 🐛 Bug Fixes - -- Login page style fix -- Fix the known problems of the menu -- Fix the problem of theme style switching - -## 2.2.0 (2021-04-06) - -### ✨ Features - -- Added `headerTitle` slot -- New printing example -- Added about interface - -### ✨ Refactor - -- Remove useFullScreen function -- tinymce changed from Cdn to npm (the package size is too large) -- Dashboard refactoring -- Remove ApexCharts and examples - -### 🐛 Bug Fixes - -- Make sure the breadcrumbs are displayed correctly -- Fixed the issue of tinymce upload button disappearing in full screen mode -- Make sure that the title changes normally after logging in again -- Ensure that the background mode login is normal -- Fix TableAction click event issue - -## 2.1.1 (2021-03-26) - -### ✨ Features - -- Added hideChildrenInMenu configuration for routing. Used to hide submenu -- Built-in expand/collapse all functions in the tree form - -### ✨ Refactor - -- Refactor the routing multi-layer mode to solve the problem of multiple implementations of nested keepalives - -### 🐛 Bug Fixes - -- Ensure that the CountDownInput component is reset to the empty value -- Fix the display problem on the small screen in split mode -- Fix table height calculation problem -- Fix the problem that components cannot be obtained by background routing -- Fix Modal component loadingTip configuration does not take effect -- Fix the background permission command does not take effect -- Make sure the progress bar is closed properly -- Fix the problem of invalid table check column configuration -- Ensure that the first level menu can be hidden -- Ensure that the hidden fields of the form are verified properly - -### 🎫 Chores - -- Remove ls-lint - -### 🎫 Chores - -- 移除 ls-lint - -## 2.1.0 (2021-03-15) - -### ✨ Features - -- Added svg mode to icon selector -- Added time component -- Added AutoNavi/Baidu/Google Map example - -### ✨ Refactor - -- Refactor the project to solve the hot update problem caused by circular dependencies -- Remove vueHelper/useClickoutside, use @vueuse/core instead - -### 🐛 Bug Fixes - -- Ensure that the value of `table action` is updated correctly -- Fix the animation of page switching cannot be closed -- Fix `PageWrapper`title not showing -- Fix the known issues of the table -- Fix the problem that the BasicTree component can't customize the title -- Fix the button style problem after theme switching - -## 2.0.3 (2021-03-07) - -### ✨ Features - -- `BasicTree` added `clickRowToExpand`, used to click tree node to expand -- Added SvgIcon plugin and examples -- Add the department tree on the left side of the account management interface· - -### ⚡ Performance Improvements - -- Pagination parameters are no longer carried when the table is closed -- The login page monitors the carriage return event to log in -- When the adaptive size of the table is set, the height is filled according to the screen. -- Tree scroll bar optimization -- Optimize the loading speed of local development - -### 🐛 Bug Fixes - -- Fix known issues with `Description` -- Fix known issues with `BasicForm` -- Fix the logic problem of show attribute of ActionItem under `BasicTree` -- Fix the style error of the tree component demo example -- Repair account management to add new but not cleared old data -- The form component should allow the setFieldsValue method to be null or undefined -- Ensure that the single-level breadcrumbs jump correctly -- Ensure that the Form component does not verify hidden form items - -## 2.0.2 (2021-03-04) - -### ✨ Refactor - -- Refactored multi-language modules to support lazy loading and remote loading - -### ✨ Features - -- axios supports form-data format request -- Added icon selector component (support local and online methods) -- Added WebSocket examples and service scripts -- Added the `renderIcon` property to the Tree component to control the display of level icons -- Tree->actionItem added show attribute, used to dynamically control button display -- New toolbar/title/search function for Tree -- Added department management/password modification/account management/role management/menu management sample interface - -### ⚡ Performance Improvements - -- Optimized login interface animation -- Fix the problem of excessively large github warehouse. -- Hide table full screen button by default -- `crypto-es` is changed to `crypto-js` to reduce the package size -- `types` directory moved to the root directory, compatible with other directory global types - -### 🐛 Bug Fixes - -- Fix the warning problem of verification code component -- Fix the table cannot get the selected row correctly -- Fixed modal height calculation error in full screen state -- Fix some table style issues -- Fix the invalidation of the tree form `indentSize` setting - -## 2.0.1 (2021-02-21) - -### ✨ Refactor - -- Refactored login page, new registration page/reset password page/mobile phone login/QR code login - -### ✨ Features - -- Added the `settingButtonPosition` configuration item for configuring the position of the `settings` button -- `modal` can switch the full screen by double-clicking the head -- Added `CountDownInput` component - -### ⚡ Performance Improvements - -- Optimize the editable center style and the width of the drop-down box is too short -- The `edit-change` event listener when the table is added and edited - -### 🐛 Bug Fixes - -- Fix image preview style error -- Fix icon style problem -- Fix the drop-down echo problem of editable table - -## 2.0.0 (2021-02-18) - -## Breaking changes - -- `echarts` is upgraded to 5.0 and introduced on demand (just use `useECharts`). - -### ✨ Refactor - -- Removed `global.less`, `mixin.less`, `design/helper`, replaced by `windicss`, and need to modify the corresponding styles if they are useful - -### ✨ Features - -- useModal adds the return value function `redoModalHeight`, which is used to refresh the modal height when the modal is dynamic content -- Upgrade husky to 5.0 -- Added `brotli`|`gzip` compression and related test commands -- Re-introduction of `windicss` (same as `tailwind`). Faster in speed - -### ⚡ Performance Improvements - -- Adjust the return value of the interface to obtain user information in array format -- Fix the error-log list as the system route - -### 🐛 Bug Fixes - -- Fix the issue of upload component maxNumber invalid -- Fix package sourcemap error report -- Fix code debugger location display error -- Fix the issue of mock plugin post request error -- Fix some themes color value error -- Fix the table in editable row status and press Enter to confirm - -### 🎫 Chores - -- Documentation update -- Upgrade ant-design-vue to `2.0.0` -- Upgrade vite to `2.0.0` - -## 2.0.0-rc.18 (2021-02-05) - -### ✨ Features - -- `ApiSelect` adds `numberToString` property, which is used to convert all the value of `number` into `string` -- Added theme color switch -- Packed image compression - -### ⚡ Performance Improvements - -When mock is not used, move `mock.js` out of the package file - -### 🐛 Bug Fixes - -- Fix modal height calculation error -- Fix the pop-up menu when the menu is clicked on the tab when the menu is collapsed -- Fix the problem that the initial value of form is 0 -- Fix table wrapping problem -- Fix the menu outside link does not jump -- Fix the display problem at the top of the menu -- Fix the issue of `modifyVars` configuration failure - -## 2.0.0-rc.17 (2020-01-18) - -### ✨ Refactor - -- Added `SimpleMenu` component to replace the left menu component (the top menu is not replaced, the function should be as simple as possible without stuck). Solve the menu stuck problem. -- The `ant-design-vue` component is no longer registered globally. In order to better coordinate with the introduction of css on demand. If you need to register globally, you need to add it yourself - -### ✨ Features - -- `css` import on demand - -### 🐛 Bug Fixes - -- Fix `TableAction` icon problem -- Fix the problem of missing menu folding buttons -- Fix menu related issues -- Fix moment multilingual issue - -## 2.0.0-rc.16 (2020-01-12) - -### ✨ Refactor - -- Independent component configuration to `/@/settings/componentsSetting` -- `colorSetting` and `designSetting` are now merged into `designSetting` -- `ant-design-vue` component registration moved to `components/registerComponent` -- Remove the `setup` folder -- Upgrade to `vite2` -- Image preview is changed to `Image` component implementation, temporarily removing functional usage - -### ✨ Features - -- Added `mixSideTrigger` configuration. Used to configure how to open the mixed mode menu on the left. Optional `hover`, default `click` -- Added `mixSideFixed` configuration. Used to fix the left mixed mode menu -- Added `height` and `min-height` properties to the modal component -- Added `PageWrapper` component. And applied to the sample page -- Added tab folding function -- Compatible with older browsers -- tinymce new image upload - -### 🐛 Bug Fixes - -- Fix known issues with table column configuration -- Restore the `isTreeTable` property of the table -- Fix table memory overflow problem -- Fix the function of `layout` shrinking and expanding in split mode -- Fix modal height calculation error -- Fix file upload error - -## 2.0.0-rc.15 (2020-12-31) - -### ✨ Table destructive update - -- Refactored editable cells and editable rows. See examples for details. The writing has changed. For editable tables. - -- Form editing supports form validation - -- Added the following configuration in the table column configuration - -```bash -{ - - # Whether to display columns by default. Those that are not displayed can be opened in the column configuration - defaultHidden?: boolean; - # Help text on the right side of the column header - helpMessage?: string | string[]; - # Custom formatting Cell content. Support time/enumeration automatic conversion - format?: CellFormat; - - # Editable - # Is it an editable cell - edit?: boolean; - # Is it an editable line - editRow?: boolean; - # Edit status. - editable?: boolean; - # Edit component - editComponent?: ComponentType; - # The parameters of the corresponding component - editComponentProps?: Recordable; - # Check - editRule?: boolean | ((text: string, record: Recordable) => Promise); - # Value enumeration conversion - editValueMap?: (value: any) => string; - # Trigger editing Zhenghang - record.onEditRow?: () => void; -} - -``` - -### ✨ Table reconstruction - -- Added `clickToRowSelect` attribute. Used to control whether the clicked row is checked or not -- Monitor row click event -- Add column drag and drop and column fix function for the table column configuration button. -- Added `defaultHidden` attribute to table column configuration. Used to hide by default. You can configure the tick display in the table column -- More powerful column configuration -- useTable: Support for dynamically changing parameters. You can pass in `Ref` type and `Computed` type for dynamic changes -- useTable: Added return function `getForm`. Can be used to manipulate forms in the form Fix known issues in the table - -### ✨ Features - -- Added `v-ripple` water ripple command -- Added the left menu mixed mode -- Add an example of markdown embedded in the form -- Add an example of a page outside the main frame -- `route.meta` added `currentActiveMenu`, `hideTab`, and `hideMenu` parameters to control the display and hide of the crumb-level menu on the detail page. -- Added breadcrumb navigation example -- form: Added `suffix` attribute to configure suffix content -- form: Added remote drop-down `ApiSelect` and examples -- form: Add `autoFocusFirstItem` configuration. Used to configure whether to focus on the first input box of the form -- useForm: Support for dynamically changing parameters. You can pass in `Ref` type and `Computed` type for dynamic changes - -### ⚡ Performance Improvements - -- Optimize the scroll bar components of `modal` and `drawer` -- table: remove the `isTreeTable` attribute -- Import `less` files globally. No need to manually re-introduce the component - -### 🎫 Chores - -- Upgrade `ant-design-vue` to `2.0.0-rc.7` -- Upgrade `vue` to `3.0.5` - -### 🐛 Bug Fixes - -- Fixed the issue of missing scroll bars in mixed mode -- Fix the invalid configuration of environment variables and the logo address problem in history mode -- Fix the calculation error of width and height caused by switching page of chart library -- Fixed the issue of multi-language configuration `Locale.show` causing the configuration not to take effect -- Fix routing type error -- Fix the problem of invalid permissions when the menu is split -- Iframe loads early when closing multi-tab pages -- Fix known issues with `modal` and `drawer` -- Fix the problem of mixing mode adaptation in the left menu - -## 2.0.0-rc.14 (2020-12-15) - -### ✨ Features - --Remove the left menu search, add the top menu search function -Layout mobile terminal adaptation. Business page is not adapted -axios join the joinTime configuration. Control whether the response includes a timestamp - -### ⚡ Performance Improvements - --Import components asynchronously -Optimize the overall structure -Replace the default scroll bar of the menu as a scroll component -Menu performance optimization - -### 🎫 Chores - --Return to the top to adjust the style to avoid covering other elements -Upgrade `ant-design-vue` to `2.0.0-rc.5` -Refresh button layout adjustment -`route.meta` removes the `externalLink` attribute - -### ✨ Refactor - --`openModal` and `openDrawer` third parameter `openOnSet` is set to true by default - -### 🐛 Bug Fixes - --Fixed an issue where multi-level routing cache caused components to render multiple times -Fixed the problem of disappearing after switching the map chart -Fix the issue of successful login and notify disappearing -Modify the names of `VirtualScroll` and `ImportExcel` components as `VScroll` and `ImpExcel` to temporarily solve the memory overflow of components containing keywords in the vue template -Fix axios case problem -Fix button style problem -Fix the problem of menu split mode -Fix the issue of invalid data transmission when using emits in `Modal` and `Drawer` components -Fix the known problems of the menu -Fix the issue of upload component api failure -Fix the problem of invalid menu permission filtering - -## 2.0.0-rc.13 (2020-12-10) - -## (Breaking changes) Breaking changes - --Route reconstruction, the previous format is no longer supported. Change to support the original default structure of vue-router, the specific format can be changed by referring to the example. Realize multi-level route caching, and no longer convert routes to level 2. -Refactor breadcrumbs and use antd's breadcrumbs component. The previous component has been deleted - -### ✨ Features - --Restore the default loading of antdv, refactor the `Loading` component, and add `useLoading` and `v-loading` instructions. And add examples -i18n supports vscode `i18n-ally` plugin -New examples of increased routing cache -Packaged code split (experimental) -Extract upload address to global variable, package can be dynamically configured - -### ✨ Refactor - --Tree component ref function call to delete `$` -Reconstruction and beautification of the lock screen interface, delete unnecessary background pictures - -### ⚡ Performance Improvements - --Page switching loading logic modification. Regardless of whether the loaded page is closed or not, loading will not be displayed when opened again (pages that have been opened are opened again faster, and loading is not required, and the logic of the top progress bar is the same), and it will be restored after refreshing. - -### 🎫 Chores - --First screen loading modification -Upgrade `vue` to `3.0.4` -Upgrade `ant-design-vue` to `2.0.0-rc.3` -Re-introduction of `vueuse` -Remove the `afterCloseLoading` attribute in route meta -Documentation update - -### 🐛 Bug Fixes - --Fix form i18n error -Fix the inconsistent size of menu icons -Fix the calculation of the top menu width -Fix table tabSetting problem -Repair file upload and delete invalidation -Fix the problem of editing and saving table rows - -## 2.0.0-rc.12 (2020-11-30) - -## (破坏性更新) Breaking changes - -- The ClickOutSide component import method is changed from `import ClickOutSide from'/@/components/ClickOutSide/index.vue'` to `import {ClickOutSide} from'/@/components/ClickOutSide'` -- Button component import method changed from `import Button from'/@/components/Button/index.vue'` to `import {Button} from'/@/components/Button'` -- StrengthMeter component import method is changed from `import StrengthMeter from'/@/components/StrengthMeter'` to `import {StrengthMeter} from'/@/components/StrengthMeter'` -- In addition to the examples, the global internationalization function is added, supporting Chinese and English - -### ✨ Refactor - -- Refactor the overall layout. Change the code implementation method. Code is more streamlined -- Configuration item reconstruction -- Remove messageSetting configuration -- BasicTitle component `showSpan`=> `span` - -### ✨ Features - -- The cache can be configured to encrypt or not, and Aes encryption is enabled in the production environment by default -- Add tab drag and drop sort -- Added LayoutFooter. The default display, can be closed in the configuration - -### ⚡ Performance Improvements - -- Optimized the problem that the full screen animation of `Modal` component is not smooth - -### 🐛 Bug Fixes - -- tree: Fix the problem that the text exceeds the operation button -- useRedo: Fix the problem of missing parameters when refreshing the page through useRedo -- form: Fix the problem that the form verification is first set in the verification and the console error message -- `modal`&`drawer` fix the problem of component passing array parameters -- form: fix `updateSchema` does not take effect when the value contains `[]` -- table: Fix the display problem of the table `TableAction` icon -- table: fix table column settings not displayed by `setColumns` setting - -### 🎫 Chores - -- Update antdv to `2.0.0-rc.2` -- Update vue to `3.0.3` -- Update vite to `1.0.0.rc13` -- Temporarily delete `@vueuse/core`. After it is stable, it will be integrated. It is currently not stable. - -## 2.0.0-rc.11 (2020-11-18) - -### ✨ Features - -- Added base64 file stream download -- Optimize upload components and examples -- New editable row example -- Add a personal page -- New form page -- Add details page -- Integrate upload components into form by default - -### 🎫 Chores - -- Update antdv to `2.0.0-rc.1` (temporarily restore to beta15, rc1 menu freezes too seriously.) -- Add some notes - -### ✨ Refactor - -- Removed `receiveDrawerDataRef` and `transferDrawerData` properties of `useModal` and `useDrawer` -- `openModal` and `openDrawer` corresponding to `useModal` and `useDrawer` extend the third parameter. Used to open the trigger callback again - -### 🐛 Bug Fixes - -- Repair form inputNumber verification error -- Fix the error of setting the default value of the form -- Fix the problem of occupying position when the menu collapse button is hidden -- Fix the form baseColProps does not take effect - -## 2.0.0-rc.10 (2020-11-13) - -### ✨ Refactor - -- Refactor hook, introduce `@vueuse`, delete existing `hook`, optimize existing hook -- ʻUseEvent` renamed ->ʻuseEventListener` -- Delete the four types `SelectOptGroup`, `SelectOption`, `Transfer`, and `Radio` from the form `ComponentType`. Modify the `RadioButtonGroup` component - -### ✨ Features - -- `componentsProps` support function type of form item -- Added tag display to the menu, supporting 4 types of colors and dot display -- New menu and top bar color selection color matching -- Add sample result page -- New file download example - -### ⚡ Wip - -- Upload components (not completed, testing...) - -### ⚡ Performance Improvements - -- Optimize settingDrawer code -- Optimize the switching speed of multiple tabs -- Add form customization and dynamic capabilities - -### 🐛 Bug Fixes - -- Fixed multiple rich text editors showing only one -- Fixed the problem of not redirecting to the original page after logging in again after expiration -- Fix window system dynamic introduction error -- Fix page type error -- Fixed an error when the form switch and checkBox were used separately - -## 2.0.0-rc.9 (2020-11-9) - -### ✨ Features - -- Menu trigger can select location -- Add an example of rich text embedded form -- Added `required` attribute to form component schema. Simplified configuration -- The second parameter of openModal and openDrawer can be passed internally instead of `transferModalData` -- Routes with parameters can be cached - -### ✨ Refactor - -- Refactored the logic of the menu generated by the background -- Route Module structural transformation - -### ⚡ Performance Improvements - -- Menu performance continues to be optimized and smoother -- Optimize lazy loading components and examples -- layout style fine-tuning - -### 🎫 Chores - -- Delete menu background image -- Update the version of ʻant-design-vue`to`beta15` -- Update `vite` version to `rc.9` -- Exception page adjustment -- `BasicTitle` Color blocks are not displayed by default - -### 🐛 Bug Fixes - -- Fix table type problem after upgrade -- Fix the problem that the last submenu continues to be displayed when the menu is divided and there is no data in the left menu -- Fix the issue of ʻuseMessage` type -- Fix the problem that the form item setting `disabled` does not take effect -- Fix that ʻuseECharts`can't adapt when`resize`, and an error is reported -- Fix that `resize` is not deleted after ʻuseWatermark` is cleared -- Fix form verification problem -- Fixed the problem that the multi-level header configuration does not take effect - -## 2.0.0-rc.8 (2020-11-2) - -### ✨ Features - -- Global loading add text -- Right-click menu supports multiple levels - -### 🎫 Chores - -- Login cache changed from sessionStorage to LocalStorage - -### ⚡ Performance Improvements - -- Update ʻant-design-vue`to`beta.12` -- Layout interface layout style adjustment -- Optimize lazy loading components -- Optimize table rendering performance -- Add animation to form folding search icon -- routeModule can ignore the layout configuration. Convenient to configure the first-level menu - -### 🐛 Bug Fixes - -- Fix table type error -- Fix bug in mock paging tool -- Fix the folding problem of the search form when the table is opened -- Fix the problem of fixed column style when the table size is samll -- Fixed the error report when closing multiple tabs -- Fix message type error - -## 2.0.0-rc.7 (2020-10-31) - -### ✨ Features - -- The form component now supports directly passing in the model to directly perform the set operation, please refer to **Component -> Popup Extension -> Open Popup and Pass Data** - -- The useModalInner of modal now supports the incoming callback function to receive the value passed in from the external `transferModalData` - - - Used to handle the setting values ​​of components such as forms when the pop-up window is opened. Refer to **Component -> Popup Extension -> Open Popup and Pass Data** - - The value of `receiveModalDataRef` is temporarily reserved. Use as little as possible. It may be deleted later. - -- The drawer’s useDrawerInner now supports the incoming callback function to receive the value passed in from the external `transferModalData`,, - - Used to handle the setting values ​​of components such as forms for opening the drawer Refer to **Component->Drawer Extension->Open the drawer and transfer data** - - The value of `receiveModalDataRef` is temporarily reserved. Use as little as possible. It may be deleted later. - -### ✨ Refactor - -- Form code optimization and reconstruction - -### ⚡ Performance Improvements - -- Modal slot can be overwritten -- Optimize table embedding height calculation problem - -### 🎫 Chores - -- Add some notes -- pwa icon supplement -- Type adjustment -- Upgrade ʻant-design-vue`to`beta.11`, and modify the known issues brought about, and some issues will be resolved after discovery - -### 🐛 Bug Fixes - -- Fix the timeout error of local proxy post interface to https address -- Fix modal full screen height calculation problem when footer is not displayed -- Fix the error that the verification information is not deleted when the form is reset -- Fix the style problem of the split mode of the top menu -- Fix the invalidation of table expansion icon animation - -## 2.0.0-rc.6 (2020-10-28) - -### ✨ Features - -- Added `pwa` function, which can be turned on in `.env.production` -- Button component extends `preIcon` and `postIcon` attributes to add icons before and after the text -- Restore the breadcrumb display icon function - -### 🎫 Chores - -- Upgrade vite version to `v1.0.0.rc8` -- vite.config.ts internal plugins extraction -- Build directory structure adjustment -- Dependency update -- Documentation update -- Modify the default route switching animation - -### ⚡ Performance Improvements - -- `setTitle` logic adjustment -- The sessionStorage and LocalStorage cache settings used by the system expire in `7` days by default - -### ✨ Refactor - -- Separate `vite-plugin-html` and modify the logic of inserting html - -### 🐛 Bug Fixes - -- Fix the warning problem of multiple registration components during hot update -- Fix the login tab page appears after login -- Fix the problem of routing switch parameter disappearance -- Fix the useMessage icon style problem - -## # 2.0.0-rc.5 (2020-10-26) - -### ✨ Features - -- Update component documentation -- Breadcrumbs support display icon -- Added tinymce rich text component -- Add submitOnReset to the form to control whether to re-initiate the request when reset -- Added `sortFn` to the table to support custom sorting -- Added animation components and examples -- Added lazy loading/delay loading components and examples - -### ✨ Refactor - -- The detailType of the Drawer component is changed to isDetail - -### 🎫 Chores - -- Remove the optional chain syntax in the code -- Form reset logic modification -- Turn off multi-tab page tabs animation -- Upgrade vite version to `v1.0.0.rc6` -- Delete Chinese path warning. rc6 has been fixed - -### 🐛 Bug Fixes - -- Fix the automatic height and display footer display problems of drawer components -- Reset to default value after repairing form query -- Fix the problem of displaying the collapsed menu when there are no child nodes -- Fix the problem of breadcrumb display style -- Fixed the problem of multiple open drag and drop failure when destroyOnClose=true in modal -- Fixed multiple action columns in the table - -# 2.0.0-rc.4 (2020-10-21) - -### ✨ Features - -- New configuration toolbar for tables -- New message notification module - -### 🎫 Chores - -- The table does not show borders by default -- Dependency update -- Update vue to `v3.0.2` -- Interface style fine-tuning - -### ⚡ Performance Improvements - -- Optimize the size of the first screen -- Optimize the TableAction component -- Reduce the folding width of the menu - -### 🐛 Bug Fixes - -- Fix the problem of the menu name when the first level menu is folded -- Fix the problem that the preview command is not packaged -- Fix the problem that the form actionColOptions parameter does not take effect -- Fix the problem that the loading does not take effect when refreshing the form - -# 2.0.0-rc.3 (2020-10-19) - -### ✨ Features - -- Added excel component and excel/xml/csv/html export example -- Added excel import example -- Added global error handling -- Added markdown components and examples -- The menu name can be displayed when adding a new folding menu - -### Docs - -- add project doc - -### 🎫 Chores - -- update deps - -### 🐛 Bug Fixes - -- Fix the adaptive problem of the top menu -- Fix window system packaging error - -# 2.0.0-rc.2 (2020-10-17) - -### ✨ Features - -- Package can be configured to output `gizp` -- Package can be configured to delete `console` -- Routes and menus do not need to be imported manually, they are imported automatically - -### 🎫 Chores - -- Upgrade vue to `3.0.1` -- Change `vite` version to daily build version - -### 🐛 Bug Fixes - -- Fix menu error -- Fix the problem of table adaptive height -- Fix the issue of error reporting when executing script in `window system` -- Fix the problem of folding components - -### ⚡ Performance Improvements - -- Remove menu to minimize background -- Prevent page refresh and re-render menu -- Some other details are optimized - -# 2.0.0-rc.1 (2020-10-14) - -### ✨ Features - -- Add a tab with parameters - -### ⚡ Performance Improvements - -- Optimized menu folding -- Page details optimization -- Compress html after packaging -- Functional reconstruction of preview components and right-click menu -- The preview component operation column is centered - -### 🎫 Chores - -- update deps -- Added `README.en-US.md` -- Added `CHANGELOG.en-US.md` - -### 🐛 Bug Fixes - -- Fix page refresh and jump to landing page - -# 2.0.0-beta.7 (2020-10-12) - -### ⚡ Performance Improvements - -- The existing tab switching no longer displays animation and progress bar - -### ✨ Features - -- Added `CountTo` component and sample demo -- Added `closeMessageOnSwitch` and `removeAllHttpPending` to the project configuration file -- The production environment has a separate configuration file for dynamic configuration project configuration -- Added ʻuseEcharts` and ʻuseApexChart` to facilitate the use of charts, and added related demos -- New workbench interface -- New analysis page interface - -### 🎫 Chores - -- Update dependencies - -### 🐛 Bug Fixes - -- Fix routing switch, tab inactive problem - -# 2.0.0-beta.6 (2020-10-11) - -### 💄 Styles - -- Menu style adjustment - -### 🐛 Bug Fixes - -- Fix the problem that editable forms cannot be entered -- Repair packaging errors, no proxy is required in the production environment - -### ⚡ Performance Improvements - -- Optimize the switching speed of multi-tab pages -- First screen loading animation - -# 2.0.0-beta.5 (2020-10-10) - -### ♻ Code Refactoring - -- Delete `tailwind css` - -### ⚡ Performance Improvements - -- Optimize page switching speed - -### 🎫 Chores - -- Add `.vscode` and `.github` configuration -- Change menu icon -- Added `.env` configuration file -- Update readme.md - -### 🐛 Bug Fixes - -- Fix the failure of `Tree` component check event - -# 2.0.0-beta.4 (2020-10-08) - -### 🎫 Chores - -- Remove redundant dependencies - -### 🐛 Bug Fixes - -- Fix page refresh blank -- Fix the invalid table style in the production environment - -# 2.0.0-beta.3 (2020-10-07) - -### ✨ Features - -- Added ʻopenNProgress` to the project configuration file to control whether to open the top control bar -- Add `Table` component and demo - -### 🎫 Chores - -- Add ` github workflows` - -# 2.0.0-beta.2 (2020-10-07) - -### ✨ Features - -- Added image preview component - -### 🔧 Continuous Integration - -- Add githubAction script - -# 2.0.0-beta.1(2020-09-30) - -### 🎫 Chores - -- Migrate some code from 1.0 -- Add README.md description file - -### 🐛 Bug Fixes - -- Fix the problem of form, animation and packaging failure diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index acf8957e..e69de29b 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -1,1317 +0,0 @@ -## 2.8.0(2021-11.03) - -### 升级说明 - -- 包管理器由`yarn`改为 `pnpm` -- 删除`node_modules`和`yarn.lock`,全局安装`pnpm` -- 执行`pnpm install` - -### ✨ Features - -- **其它** - - `.env`文件中的`VITE_PROXY`配置支持单引号 - - 移除 build 过程中的警告 - -### 🐛 Bug Fixes - -- **BasicTable** - - 修复可编辑单元格某些情况下无法提交的问题 - - 修复`inset`属性不起作用的问题 - - 修复`useTable`与`BasicTable`实例的`reload`方法`await`表现不一致的问题 - - 修复`clickToRowSelect`会无视行选择框 disabled 状态的问题 - - 修复`BasicTable`在某些情况下,分页会被重置的问题 - - 修改 `deleteTableDataRecord` 方法 -- **BasicModal** - - 修复点击遮罩、按下`Esc`键都不能关闭`Modal`的问题 - - 修复点击关闭按钮、最大化按钮旁边的空白区域也会导致`Modal`关闭的问题 -- **BasicTree** 修复节点插槽不起作用的问题 -- **CodeEditor** 修复可能会造成的`Build`失败的问题 -- **BasicForm** 修复自定义 FormItem 组件的内容宽度可能超出范围的问题 -- **ApiTreeSelect** 修复`params`变化未能触发重新请求 api 数据的问题 -- **其它** - - 修复多标签在某些情况下关闭页签不会跳转路由的问题 - - 修复部分组件可能会造成热更新异常的问题 - - 修复直接`import`部分`antdv`子组件时会在 build 过程中报错的问题,如:TabPane、RadioGroup - -## 2.7.2(2021-09-14) - -### ✨ Features - -- **BasicForm** 表单组件新增`Divider`,用于较长表单的区域分割 -- **BasicTable** - - 单元格编辑新增提交回调,将根据回调函数返回的结果来决定是否将数据提交到表格 - - 行编辑添加校验方法,允许只校验而不提交值,以便异步保存数据成功后才提交倒表格 - - 修复`rowClassName`属性无法和`striped`同时使用的问题 -- 新增组件 **MarkdownViewer** 用于显示 Markdown 格式的富文本 - -### 🐛 Bug Fixes - -- **CodeEditor** 修复 JSON 编辑器在格式化无效 JSON 文本时会抛出异常的问题 -- **Tinymce** 修复 inline 模式在一些场景下会出现异常的问题 -- **BasicTable** - - 修复可编辑单元格的内容为空时,不会显示编辑图标的问题 - - 修复表尾合计行与表格主体部分的列有时候未能对齐的问题 -- **MarkDown** 修复初始 value 属性的值不起作用的问题 -- **BasicUpload** 修复`accept`属性不支持`MIME`及点开头的后缀名的问题 -- **ApiSelect** 修复`value`属性的类型定义问题 -- **其它** - - 修复部分封装组件在使用插槽时报错的问题 - - 修复`useECharts`的`theme`参数不起作用的问题 - - 修复`Token`失效时,按 F5 刷新页面可能会出现页面加载异常的问题 - - 修复`useRedo`的不当调用可能会导致重定向`path`异常的问题 - - 修复`vite`自定义模式名称不支持下划线的问题 - -## 2.7.1(2021-08-16) - -- 升级 vue 3.2,如果运行失败,删除 node_modules 后重装即可 - -### ✨ Features - -- **BasicTree** 添加搜索功能相关属性和方法 -- **BasicForm** 新增`alwaysShowLines`用于设置折叠时保留显示的行数 - -### 🐛 Bug Fixes - -- **Cropper** 修复未能及时销毁的问题 -- **BasicTable** - - 修复`CellFormat`无法使用`Map`类型数据的问题 - - 修复可编辑单元格未能正确显示`0`值的问题 - - 修复 selection-change 事件在取消勾选时未能正确触发的问题 - - 修复浅色主题下的全屏状态背景颜色不正确的问题 - - 修复`getSelectRows`不支持远程数据跨页选择时获取完整数据的问题 - - 修复在`editComponentProps`中为编辑组件提供的`size`属性无效的问题 -- **Qrcode** 修复二维码组件在创建时未能及时绘制的问题 -- **BasicModal** 修复`helpMessage`属性不起作用的问题 -- **BasicButton** 修复按钮样式表现与 antd 官方不一致的问题 -- **其它** 修复`useRedo`(重新加载当前路由)会丢失路由`params`数据的问题 - -## 2.7.0(2021-08-03) - -## (破坏性更新) Breaking changes - -- 将项目`tailwindcss`还原回`windicss`,尝试了`tailwindcss`,问题可能还挺多,先切换回`windicss`提高开发效率,切换成本较低。 - - 目前项目不兼容地方有 - - `xl:!m-4` 之类的写法需要改为`!xl:m-4`,注意只有`!`这个不兼容,没用到则不用改 - - 内存溢出问题可能还在(频率低,重启下即可,重启 vite 较快) - -### ✨ Features - -- **Preview** 添加新的属性及事件 -- **Dark Theme** 新增对 tailwindcss 夜间模式的支持 -- **其它** 为 useLoading 添加 setTip 方法 - -### 🐛 Bug Fixes - -- **ApiTreeSelect** 修复未能正确监听`params`变化的问题 -- **ImgRotateDragVerify** 修复组件`resume`方法无法调用的问题 -- **TableAction** 修复 stopButtonPropagation 属性某些情况下不起作用的问题 -- **PageWrapper** 修复`class`属性无效的问题 -- **BasicTree** 修复`checkAll`方法会影响到`disabled`状态节点的问题 -- **BasicTable** - - 修复可编辑单元格不支持`ellipsis`配置的问题 - - 修复全屏模式下看不到子组件弹出层(popconfirm 以及 select、treeSelect 等编辑组件)的问题 - - 修复启用`expandRowByClick`时,点击不可展开的行可能会导致样式错误的问题 - - 修复`pagination`属性动态改变不生效的问题 - - 修复`getSelectRows`不支持树形表格子级数据的问题 -- **Dark Theme** 黑暗主题下的配色问题修正 - - 修复`Tree`组件被选中节点的背景颜色 - - 修复`Alert`组件的颜色配置 - - 修复禁用状态下的`link`类型的按钮颜色问题 - - 修复`Tree`已勾选的复选框的样式问题 -- **其它** 修复 useScript 未能自动移除 script 节点的问题 - -## 2.6.1(2021-07-19) - -### ✨ Features - -- **NoticeList** 添加分页、超长自动省略、标题点击事件、标题删除线等功能 -- **MixSider** 优化 Mix 菜单布局时 底部折叠按钮 的样式,与其它菜单布局时的风格保持一致 -- **ApiTreeSelect** 扩展`antdv`的`TreeSelect`组件,支持远程数据源,用法类似`ApiSelect` -- **BasicTable** - - 新增`ApiTreeSelect`编辑组件 - - 新增`headerTop`插槽 -- **其它** 可以为不同的用户指定不同的后台首页: - - 在`getUserInfo`接口返回的用户信息中增加`homePath`字段(可选)即可为当前用户定制首页路径 - -### 🐛 Bug Fixes - -- **BasicTable** - - 修复滚动条样式问题(移除了滚动样式补丁) - - 修复树形表格的带有展开图标的单元格的内容对齐问题 - - 修复操作列的按钮在 disabled 状态下的颜色显示 - - 修复可编辑单元格的值不能直接通过修改`dataSource`来更新显示的问题 - - 修复使用`ApiSelect`编辑组件时的数据回显问题 - - 修复在部分场景下编辑组件可能会报`onXXX`类型错误的问题 -- **TableAction** - - 仅在 `action.tooltip`存在的情况下 才创建 Tooltip 组件 - - 修复组件内的圆形按钮内容没有居中的问题 -- **AppSearch** 修复可能会搜索隐藏菜单的问题 -- **BasicUpload** 修复处理非`array`值时报错的问题 -- **Form** 修复`FormItem`的`suffix`插槽样式问题 -- **Menu** - - 修复左侧混合菜单的悬停触发逻辑 - - 修复顶栏菜单在显示包含需要隐藏的菜单项目时出错的问题 - - 修复悬停触发模式下左侧混合菜单会在没有子菜单且被激活时直接跳转路由 -- **Breadcrumb** 修复带有重定向的菜单点击无法跳转的问题 -- **Markdown** 修复初始化异常以及不能正确地动态设置 value 的问题 -- **Modal** 确保 props 正确被传递 -- **MultipleTab** 修复可能会意外创建登录路由标签的问题 -- **BasicTree** 修复搜索功能可能导致`checkedKeys`丢失的问题 -- **CodeEditor** 修复 value 不支持 v-model 用法的问题 -- **CountdownInput** 修复不支持`input`插槽的问题 -- **ApiSelect** 修复`options-change`事件参数不是`select`所使用的标准`options`数据的问题 -- **其它** - - 修复菜单默认折叠的配置不起作用的问题 - - 修复`safari`浏览器报错导致网站打不开 - - 修复在 window 上,拉取代码后 eslint 因 endOfLine 而报错问题 - - 修复因动态路由而产生的 `Vue Router warn` - -### 🎫 Chores - -- 添加 test 环境测试命令 - -## 2.6.0(2021-07-04) - -### ✨ Features - -- **Axios** 新增`withToken`配置,用于控制请求是否携带 token -- **BasicUpload** - - 新增在预览 `Modal` 中删除文件时触发`preview-delete` 事件 - - `value` 支持 `v-model` 用法 -- **Route 配置** - - 增加`ignoreRoute`用于在`ROUTE_MAPPING`或`BACK`权限模式下仅生成菜单 - - 增加`hidePathForChildren`配置,标识为子项目生成菜单时忽略本级`path` -- **TableAction** 新增`tooltip`配置,可以为按钮增加 tooltip 提示 -- **CropperAvatar** - - 新增`value`用于设置当前头像 - - 新增`onChange`用于接受头像剪裁并上传成功事件 - - 新增`btnText`、`btnProps` 用于自定义上传按钮文案和属性 - - 为剪裁`Modal`内的操作按钮添加工具提示 -- **Modal** 为右上角的操作按钮添加工具提示 - -### 🐛 Bug Fixes - -- **Modal** - - 修复点击遮罩不能关闭的问题 - - 修复 `setModalProps` 不支持设置 `defaultFullscreen` 的问题 -- **Table** - - 修复 `editComponentProps` 不支持 `onChange`的问题 - - 修复启用`clickToRowSelect`时,点击行不会触发`selection-change`事件的问题 - - 修复全局配置`fetchSetting`可能会被局部配置意外修改的问题 - - 修复`handleSearchInfoFn`的参数包含多余空白键的问题 - - 修复为 table 提供 rowSelection.onChange 时,无法手动变更 table 的选中项的问题 - - 修复滚动条在无需显示的时候仍然持续显示的问题 -- **Icon** 修复 SvgIcon 缺少部分样式的问题 -- **Menu** - - 修复路由映射模式下,单级菜单刷新不会激活 - - 修复侧边菜单底部的折叠自定义失效的问题 -- **Form** 修复`submitButtonOptions`和`resetButtonOptions`的类型定义 -- **PopConfirmButton** 移除`Button`上多余的`title` -- **Axios** 修复非`GET`请求时,无法同时提交`params`和`data`数据的问题 -- **其它** - - 修复锁屏功能可以通过刷新页面或复制 URL 打开新的浏览器标签来跳过锁定状态的问题 - - 修复多个窗口同时打开页面时,`Token` 不会同步的问题 - - 修复`ROLE`权限模式下`hasPermission`不工作的问题 -- **Table** 修复`handleSearchInfoFn`的参数包含多余空白键的问题 -- **Tailwindcss** 移除控制台警告 - -## 2.5.2(2021-06-27) - -### ⚡ Performance Improvements - -- **Icon** 移除 Icon 组件全局注册,防止特定情况下热更新问题 - -### ✨ Features - -- **Menu** 新增 `permissionMode=PermissionModeEnum.ROUTE_MAPPING`模式 - - 项目默认改为该模式,删除原有菜单文件 - - 如果之前已经写好了菜单,可以更改为`PermissionModeEnum.ROLE`模式即可 - -### 🐛 Bug Fixes - -- **Drawer** 修复`visible`状态异常 - -## 2.5.1(2021-06-26) - -### ⚡ Performance Improvements - -- 升级`vue`与`ant-design-vue`版本,解决兼容问题 -- **Tree** 性能优化 - -### 🐛 Bug Fixes - -- **Table** 修复分页抖动问题 -- **Upload** 确保携带自定义参数 -- **Dropdown** 修复 popConfirm 的图标显示问题 -- **Table** 修复树形表格的编辑事件不正常的问题 -- **Table** 修复当表格数据为空时,getDataSource 返回的值不是表格所使用的数据源的问题 - -## 2.5.0(2021-06-20) - -## (破坏性更新) Breaking changes - -- 将项目`windicss`改为`tailwindcss`,解决内存溢出问题 - - 目前项目不兼容地方有 - - `!xl:m-4` 之类的写法需要改为`xl:!m-4`,注意只有`!`这个不兼容,没用到则不用改 - - `windicss`自身新增的特性需要调整,比如`Attribute`模式不兼容 - -### ✨ Refactor - -- 移除`useExpose`,使用组件自身提供的`expose`代替 - -### ⚡ Performance Improvements - -- **Locale** 合并多语言文件,减少文件数量 -- **Utils** Mitt 默认导出由 `Class` 改为 `Function` -- **Axios** `isTransformRequestResult`更名为`isTransformResponse` - -### ✨ Features - -- **CropperImage** `Cropper` 头像裁剪新增圆形裁剪功能 -- **CropperAvatar** 新增头像上传组件 -- **Drawer** `useDrawer`新增`closeDrawer`函数 -- **Preview** 新增`createImgPreview`图片预览函数 -- **Setup** 新增引导页示例 -- **Tests** 添加 jest 测试套件,暂不支持 Vue 组件单测 -- **Axios** 新增`authenticationScheme`配置,用于指定认证方案 -- **Setting** 新增 `sessionTimeoutProcessing` 项目配置项,用于配置会话超时如何处理 - -### 🐛 Bug Fixes - -- **Modal** 修复全屏高度计算错误 -- **Modal** 修复关闭事件触发多次问题 -- **PageWrapper** 修复高度计算问题 -- **FlowChart** 修复拖放菜单丢失 -- 修复后台模式下,Iframe 路由错误 -- **PageWrapper** 修复 footer 与全局页脚同时开启时的高度计算问题 -- **Menu** 修复菜单折叠动画抖动问题 -- **Store**修复 pinia 版本升级之后类型错误 - -## 2.4.2(2021-06-10) - -### ✨ Refactor - -- `CountTo`组件重构 - -### ✨ Features - -- `radioButtonGroup` 支持`boolean`值 -- `useModalInner` 新增 `redoModalHeight`用于在 Modal 内部重设`Modal`高度 -- `useECharts` 新增`getInstance`用于获取`echart`实例 -- `TableAction` 新增 `stopButtonPropagation` 阻止操作按钮点击事件冒泡 -- `BasicTable` 在行编辑模式下,可以获取或设置其它处于列的编辑组件的值 -- `ApiSelect` 组件在`params`改变后会自动重新`fetch`数据 -- `TableImg` 组件改进 -- `BasicTable` 新增 `columns-change` 事件用于监听用户改变列排序、展示、固定状态 -- `Tinymce`支持动态修改 readonly -- `BasicTable`新增`updateTableDataRecord`方法用于更新指定行数据 -- `useModal`新增`closeModal`方法用于关闭`Modal` - -### 🐛 Bug Fixes - -- 修复`redoModalHeight`不能减小高度的问题 -- 修复 `BasicForm`设置 schemas 数据不生效的问题 -- 修复多标签可能导致`KeepAlive`失效的问题 -- 修复默认的`axios`拦截器不能处理自定义 code 的问题 -- 修复锁屏弹窗的高度问题 -- 修复`BaiscTable`的`列展示`复选框的半选状态显示不正确的问题 -- 修复`BasicUpload`组件的预览列表某些情况下不能显示的问题 -- 修复`RadioButtonGroup`的`options`设置`disabled`不生效的问题 -- 修复`Tinymce`组件在只读模式下上传图片的按钮仍然可用的问题 -- 修复`BasicForm`特定情况下的卡顿问题 -- 修复"目录"路由不起作用的问题 - -## 2.4.1(2021-06-01) - -### ✨ Features - -- 可编辑表格新增`DatePicker`和`TimePicker`组件 -- `Tree` 组件新增`defaultExpandLevel`配置 - -### ⚡ Performance Improvements - -- 菜单搜索默认聚焦 - -### 🐛 Bug Fixes - -- 修复`CodeEditor`已知问题 -- 修复`i18n`控制台警告问题 -- 修复可编辑表格`align`配置不生效问题 -- 确保`axios`只对`Object`参数进行处理 -- 修复`Tree`组件 `defaultExpandAll` 配置失效 -- 修复`TableAction` 分割线丢失问题 -- 修复表格已知问题 -- 修复首次加载或改变语言导致重载时,不会设置 HTML 的 lang 属性 - -## 2.4.0 (2021-05-25) - -### ✨ Features - -- 新增图形编辑器示例 -- 新增代码编辑器(包含 Json 编辑器) -- 新增 `JsonPreview`Json 数据查看组件 -- 表格的数据列(column)和操作列(actionColumn)的字段可以根据权限和业务来控制是否显示 -- 新增权限控制表格示例(AuthColumn.vue) -- 新增用户登录过期示例 - -### ⚡ Performance Improvements - -- 合并部分语言文件,减少文件数量 - -### 🐛 Bug Fixes - -- 修复黑暗主题刷新闪烁的白屏 -- 修复标签页关闭其他功能失效问题 -- 修复表单已知问题 -- 修复自动锁屏失效 - -## 2.3.0 (2021-04-10) - -## (破坏性更新) Breaking changes - -- 使用 `pinia` 替换 `vuex`,`vuex-module-decorators`。 - - - 影响,之前如果有自己使用 vuex-module-decorators,需要改造为 pinia。 - - 原因: - - pinia 于 vuex5api 基本类似,且简单易懂。 - - 后续切换 vuex5 成本非常低,也可以当作第三方状态管理库使用 - -- 移除 `useKeyPress` 使用`vueuse`-`onKeyStroke`代替 -- 移除 `useDebounceFn` 使用`vueuse`-`useDebounceFn`代替 -- 移除 `useThrottle` 使用`vueuse`-`useThrottleFn`代替 - -### ✨ Features - -- 标签页支持持久化保存 - -### ✨ Refactor - -- 移除 `useElResize` - -### 🐛 Bug Fixes - -- 登录页样式修复 -- 修复菜单已知问题 -- 修复主题样式切换问题 - -## 2.2.0 (2021-04-06) - -### ✨ Features - -- 新增`headerTitle` slot -- 新增打印示例 -- 新增关于界面 - -### ✨ Refactor - -- 移除 useFullScreen 函数 -- tinymce 由 Cdn 改为 npm(打包体积偏大) -- Dashboard 重构 -- 移除 ApexCharts 及示例 - -### 🐛 Bug Fixes - -- 确保面包屑正确的显示图标 -- 修复 tinymce 上传按钮全屏模式下消失问题 -- 确保 title 在重新登录后正常改变 -- 确保后台模式登录正常 -- 修复 TableAction 点击事件问题 - -## 2.1.1 (2021-03-26) - -### ✨ Features - -- 路由新增 hideChildrenInMenu 配置。用于隐藏子菜单 -- 树形表格内置展开/折叠全部函数 - -### ✨ Refactor - -- 重构路由多层模式,解决嵌套 keepalive 执行多次问题 - -### 🐛 Bug Fixes - -- 确保 CountDownInput 组件重置清空值 -- 修复分割模式下在小屏幕中显示问题 -- 修复表格高度计算问题 -- 修复后台路由获取不到组件问题 -- 修复 Modal 组件 loadingTip 配置不生效 -- 修复后台权限指令不生效 -- 确保 progress 进度条正确关闭 -- 修复表格勾选列配置失效问题 -- 确保一级菜单可以被隐藏 -- 确保表单隐藏字段校验正常 - -### 🎫 Chores - -- 移除 ls-lint - -## 2.1.0 (2021-03-15) - -### ✨ Features - -- 图标选择器新增 svg 模式 -- 新增时间组件 -- 新增高德/百度/谷歌地图示例 - -### ✨ Refactor - -- 重构项目以解决循环依赖项导致的热更新问题 -- 移除 vueHelper/useClickoutside,使用@vueuse/core 代替 - -### 🐛 Bug Fixes - -- 确保 `table action` 的值被正确更新 -- 修复页面切换的动画无法关闭 -- 修复`PageWrapper`title 不显示 -- 修复表格已知问题 -- 修复 BasicTree 组件不能自定义 title 问题 -- 修复主题切换后按钮样式问题 - -## 2.0.3 (2021-03-07) - -### ✨ Features - -- `BasicTree` 新增`clickRowToExpand`,用于单击树节点展开 -- 新增 SvgIcon 插件及示例 -- 账号管理界面增加左侧部门树· - -### ⚡ Performance Improvements - -- 表格关闭分页时不再携带分页参数 -- 登录页监听回车事件进行登录 -- 当表格设置自适应大小时,根据屏幕来铺满了高度. -- Tree 滚动条优化 -- 优化本地开发加载速度 - -### 🐛 Bug Fixes - -- 修复`Description`已知问题 -- 修复`BasicForm`已知问题 -- 修复`BasicTree`下 ActionItem 的 show 属性逻辑问题 -- 修复树组件 demo 示例样式错误 -- 修复账号管理新增未清空旧数据 -- form 组件应允许 setFieldsValue 方法值为 null 或者 undefined -- 确保单级面包屑正确跳转 -- 确保 Form 组件不校验隐藏的表单项 - -## 2.0.2 (2021-03-04) - -### ✨ Refactor - -- 重构多语言模块,支持懒加载及远程加载 - -### ✨ Features - -- axios 支持 form-data 格式请求 -- 新增图标选择器组件(支持本地和在线方式) -- 新增 WebSocket 示例和服务脚本 -- Tree 组件新增 `renderIcon` 属性用于控制层级图标显示 -- Tree->actionItem 新增 show 属性,用于动态控制按钮显示 -- Tree 新增工具栏/title/搜索功能 -- 新增部门管理/修改密码/账号管理/角色管理/菜单管理示例界面 - -### ⚡ Performance Improvements - -- 登录界面动画优化 -- 修复 github 仓库体积过大问题. -- 默认隐藏表格全屏按钮 -- `crypto-es`改为`crypto-js`,减小打包体积 -- `types`目录移动到根目录,兼容其他目录全局类型 - -### 🐛 Bug Fixes - -- 修复验证码组件警告问题 -- 修复表格不能正确的获取选中行 -- 修复全屏状态下 modal 高度计算错误 -- 修复部分表格样式问题 -- 修复树形表格 `indentSize`设置失效 - -## 2.0.1 (2021-02-21) - -### ✨ Refactor - -- 登录页重构,新增注册页面/重置密码页面/手机登录/二维码登录 - -### ✨ Features - -- 新增 `settingButtonPosition`配置项,用于配置`设置`按钮位置 -- `modal`可以通过双击头部切换全屏 -- 新增`CountDownInput`组件 - -### ⚡ Performance Improvements - -- 优化可编辑居中样式及下拉框宽度过短 -- 表格新增编辑时`edit-change`事件监听 - -### 🐛 Bug Fixes - -- 修复图片预览样式错误 -- 修复图标样式问题 -- 修复可编辑表格下拉回显问题 - -## 2.0.0 (2021-02-18) - -## (破坏性更新) Breaking changes - -- `echarts` 升级到 5.0,并且进行按需引入(只需使用 `useECharts` 即可). - -### ✨ Refactor - -- 移除`global.less`,`mixin.less`,`design/helper`,由`windicss`代替,有用到的需要修改对应的样式 - -### ✨ Features - -- useModal 新增返回值函数 `redoModalHeight`,用于在 modal 内为动态内容时刷新 modal 高度 -- 升级 husky 到 5.0 -- 新增 `brotli`|`gzip`压缩及相关测试命令 -- 重新引入 `windicss` (与`tailwind`一样).在速度上更快 - -### ⚡ Performance Improvements - -- 调整获取用户信息接口返回值为数组格式 -- 将 error-log 列表固定为系统路由 - -### 🐛 Bug Fixes - -- 修复 Upload 组件 maxNumber 失效问题 -- 修复打包 sourcemap 报错 -- 修复代码 debugger 位置显示错误 -- 修复 mock 插件 post 请求错误问题 -- 修复部分主题颜色值错误 -- 修复表格在可编辑行状态回车确认 - -### 🎫 Chores - -- 文档更新 -- 升级 ant-design-vue 到 `2.0.0` -- 升级 vite 到 `2.0.0` - -## 2.0.0-rc.18 (2021-02-05) - -### ✨ Features - -- `ApiSelect`新增 `numberToString`属性,用于将 value 为`number`的值全部转化为`string` -- 新增主题色切换 -- 打包图片压缩 - -### ⚡ Performance Improvements - -当不使用 mock 时,将 `mock.js` 移出打包文件 - -### 🐛 Bug Fixes - -- 修复 modal 高度计算错误 -- 修复菜单折叠状态下点击标签页弹出菜单 -- 修复 form 表单初始化值为 0 问题 -- 修复表格换行问题 -- 修复菜单外链不跳转 -- 修复菜单顶部显示问题 -- 修复`modifyVars`配置失效问题 - -## 2.0.0-rc.17 (2021-01-18) - -### ✨ Refactor - -- 新增 `SimpleMenu`组件替代左侧菜单组件(顶部菜单没有替换,功能尽量做到简单不卡)。解决菜单卡顿问题。 -- `ant-design-vue`组件不再全局注册。以便于更好配合 css 按需引入。如果需要全局注册,需要自己加 - -### ✨ Features - -- `css` 按需引入 - -### 🐛 Bug Fixes - -- 修复 `TableAction`图标问题 -- 修复菜单折叠按钮丢失问题 -- 修复菜单相关问题 -- 修复 moment 多语言问题 - -## 2.0.0-rc.16 (2021-01-12) - -### ✨ Refactor - -- 独立组件配置到 `/@/settings/componentsSetting` -- `colorSetting`和`designSetting`现在合并为`designSetting` -- `ant-design-vue`组件注册移动到`components/registerComponent` -- 移除 `setup` 文件夹 -- 升级到`vite2` -- 图片预览改为`Image`组件实现,暂时移除函数式使用方式 - -### ✨ Features - -- 新增`mixSideTrigger`配置。用于配置左侧混合模式菜单打开方式。可选`hover`,默认`click` -- 新增`mixSideFixed`配置。用于固定左侧混合模式菜单 -- modal 组件新增`height`和`min-height`属性 -- 新增`PageWrapper`组件。并应用于示例页面 -- 新增标签页折叠功能 -- 兼容旧版浏览器 -- tinymce 新增图片上传 - -### 🐛 Bug Fixes - -- 修复表格列配置已知问题 -- 恢复 table 的`isTreeTable`属性 -- 修复表格内存溢出问题 -- 修复`layout` 收缩展开功能在分割模式下失效 -- 修复 modal 高度计算错误 -- 修复文件上传错误 -- 修复表格已知问题 - -### 🎫 Chores - -- 文档更新 - -## 2.0.0-rc.15 (2020-12-31) - -### ✨ 表格破坏性更新 - -- 重构了可编辑单元格及可编辑行。具体看示例。写法已改变。针对可编辑表格。 - -- 表格编辑支持表单校验 - -- 在表格列配置增加了以下配置 - -```bash -{ - - # 默认是否显示列。不显示的可以在列配置打开 - defaultHidden?: boolean; - # 列头右侧帮助文本 - helpMessage?: string | string[]; - # 自定义格式化 单元格内容。 支持时间/枚举自动转化 - format?: CellFormat; - - # Editable - # 是否是可编辑单元格 - edit?: boolean; - # 是否是可编辑行 - editRow?: boolean; - # 编辑状态。 - editable?: boolean; - # 编辑组件 - editComponent?: ComponentType; - # 所对应组件的参数 - editComponentProps?: Recordable; - # 校验 - editRule?: boolean | ((text: string, record: Recordable) => Promise); - # 值枚举转化 - editValueMap?: (value: any) => string; - # 触发编辑正航 - record.onEditRow?: () => void; -} - -``` - -### ✨ 表格重构 - -- 新增`clickToRowSelect`属性。用于控制点击行是否选中勾选框 -- 监听行点击事件 -- 表格列配置按钮增加 列拖拽,列固定功能。 -- 表格列配置新增`defaultHidden` 属性。用于默认隐藏。可在表格列配置勾选显示 -- 更强大的列配置 -- useTable:支持动态改变参数。可以传入`Ref`类型与`Computed`类型进行动态更改 -- useTable:新增返回 `getForm`函数。可以用于操作表格内的表单 -- 修复表格已知的问题 - -### ✨ Features - -- 新增 `v-ripple`水波纹指令 -- 新增左侧菜单混合模式 -- 新增 markdown 嵌入表单内示例 -- 新增主框架外页面示例 -- `route.meta` 新增`currentActiveMenu`,`hideTab`,`hideMenu`参数 用于控制详情页面包屑级菜单显示隐藏。 -- 新增面包屑导航示例 -- form: 新增`suffix`属性,用于配置后缀内容 -- form: 新增远程下拉`ApiSelect`及示例 -- form: 新增`autoFocusFirstItem`配置。用于配置是否聚焦表单第一个输入框 -- useForm: 支持动态改变参数。可以传入`Ref`类型与`Computed`类型进行动态更改 - -### ⚡ Performance Improvements - -- 优化`modal`与`drawer`滚动条组件 -- table: 移除 `isTreeTable`属性 -- 全局引入`less`文件。无需手动在组件再次引入 - -### 🎫 Chores - -- 升级`ant-design-vue`到`2.0.0-rc.7` -- 升级`vue`到`3.0.5` - -### 🐛 Bug Fixes - -- 修复混合模式下滚动条丢失问题 -- 修复环境变量配置失效以及 history 模式下 logo 地址问题 -- 修复图表库切换页面导致宽高计算错误 -- 修复多语言配置 `Locale.show`导致配置不生效 -- 修复路由类型错误 -- 修复菜单分割时权限失效问题 -- 关闭多标签页时 iframe 提前加载 -- 修复`modal`与`drawer`已知问题 -- 修复左侧菜单混合模式适配问题 - -## 2.0.0-rc.14 (2020-12-15) - -### ✨ Features - -- 移除左侧菜单搜索,新增顶部菜单搜索功能 -- layout 移动端适配。业务页面未适配 -- axios 加入 joinTime 配置。控制响应是否加入时间戳 - -### ⚡ Performance Improvements - -- 异步引入组件 -- 优化整体结构 -- 替换菜单默认滚动条为滚动组件 -- 菜单性能优化 - -### 🎫 Chores - -- 返回顶部样式调整,避免遮住其他元素 -- 升级`ant-design-vue`到`2.0.0-rc.5` -- 刷新按钮布局调整 -- `route.meta` 移除 `externalLink` 属性 - -### ✨ Refactor - -- `openModal`与`openDrawer`第三个参数`openOnSet`默认设置为 true - -### 🐛 Bug Fixes - -- 修复多级路由缓存导致组件渲染多次的问题 -- 修复地图图表切换后消失问题 -- 修复登录成功 notify 消失问题 -- 修改 `VirtualScroll`和`ImportExcel`组件名为`VScroll`与`ImpExcel`,暂时解决含有关键字的组件在 vue 模版内使用内存溢出 -- 修复 axios 大小写问题 -- 修复按钮样式问题 -- 修复菜单分割模式问题 -- 修复 `Modal`与`Drawer`组件在使用 emits 数据传递失效问题 -- 修复菜单已知问题 -- 修复上传组件 api 失效问题 -- 修复菜单权限过滤失效问题 - -## 2.0.0-rc.13 (2020-12-10) - -## (破坏性更新) Breaking changes - -- 路由重构, 不再支持以前的格式。改为支持 vue-router 最初的默认结构,具体格式可以参考示例更改。实现多级路由缓存,不再将路由转化为 2 级。 -- 重构面包屑,使用 antd 的面包屑组件。之前的组件已删除 - -### ✨ Features - -- 还原 antdv 默认 loading,重构 `Loading` 组件,增加`useLoading`和`v-loading`指令。并增加示例 -- i18n 支持 vscode `i18n-ally`插件 -- 新增多级路由缓存示例 -- 打包代码拆分(试验) -- 提取上传地址到全局变量,打包可以动态配置 - -### ✨ Refactor - -- tree 组件 ref 函数调用删除 `$` -- 锁屏界面重构美化,删除不必要的背景图片 - -### ⚡ Performance Improvements - -- 页面切换 loading 逻辑修改。对于已经加载过的页面不管有没有关闭,再次打开不会在显示 loading(已经打开过的页面再次打开速度比较快,可以不需要 loading,同理顶部进度条逻辑也一样),刷新后恢复。 - -### 🎫 Chores - -- 首屏 loading 修改 -- 升级`vue`到`3.0.4` -- 升级`ant-design-vue`到`2.0.0-rc.3` -- 重新引入`vueuse` -- 移除 route meta 内的`afterCloseLoading`属性 -- 文档更新 - -### 🐛 Bug Fixes - -- 修复表格 i18n 错误 -- 修复菜单图标大小不一致 -- 修复顶部菜单宽度计算问题 -- 修复表格 tabSetting 问题 -- 修复文件上传删除失效 -- 修复表格行编辑保存错误问题 - -## 2.0.0-rc.12 (2020-11-30) - -## (破坏性更新) Breaking changes - -- ClickOutSide 组件引入方式由 `import ClickOutSide from '/@/components/ClickOutSide/index.vue'`变更为`import { ClickOutSide } from '/@/components/ClickOutSide'` -- Button 组件引入方式由 `import Button from '/@/components/Button/index.vue'`变更为`import { Button } from '/@/components/Button'` -- StrengthMeter 组件引入方式由 `import StrengthMeter from '/@/components/StrengthMeter'`变更为`import { StrengthMeter } from '/@/components/StrengthMeter'` -- 除示例外加入全局国际化功能,支持中文与英文 - -### ✨ Refactor - -- 重构整体 layout。更改代码实现方式。代码更精简 -- 配置项重构 -- 移除 messageSetting 配置 -- BasicTitle 组件 `showSpan`=> `span` - -### ✨ Features - -- 缓存可以配置是否加密,默认生产环境开启 Aes 加密 -- 新增标签页拖拽排序 -- 新增 LayoutFooter.默认显示,可以在配置内关闭 - -### ⚡ Performance Improvements - -- 优化`Modal`组件全屏动画不流畅问题 - -### 🐛 Bug Fixes - -- tree: 修复文本超出挡住操作按钮问题 -- useRedo: 修复通过 useRedo 刷新页面参数丢失问题 -- form: 修复表单校验先设置在校验及控制台错误信息问题 -- `modal`&`drawer` 修复组件传递数组参数问题 -- form: 修复`updateSchema`赋值含有`[]`时不生效 -- table: 修复表格 `TableAction` 图标显示问题 -- table: 修复表格列设置通过`setColumns`设置不显示 - -### 🎫 Chores - -- 更新 antdv 到`2.0.0-rc.2` -- 更新 vue 到`3.0.3` -- 更新 vite 到`1.0.0.rc13` -- 暂时删除 `@vueuse/core`.等稳定后在集成。目前不太稳定。 - -## 2.0.0-rc.11 (2020-11-18) - -### ✨ Features - -- 新增 base64 文件流下载 -- 优化上传组件及示例 -- 新增可编辑行示例 -- 新增个人页 -- 新增表单页 -- 新增详情页 -- 将上传组件默认集成到 form - -### 🎫 Chores - -- 更新 antdv 到`2.0.0-rc.1`(暂时还原到 beta15,rc1 菜单卡顿太严重.) -- 添加部分注释 - -### ✨ Refactor - -- 移除`useModal`与`useDrawer`的`receiveDrawerDataRef`和`transferDrawerData`属性 -- `useModal`与`useDrawer`对应的`openModal`与`openDrawer`扩展第三个参数。用于再次打开触发回调 - -### 🐛 Bug Fixes - -- 修复表单 inputNumber 校验错误 -- 修复表单默认值设置错误 -- 修复菜单折叠按钮隐藏时占位问题 -- 修复表单 baseColProps 不生效 - -## 2.0.0-rc.10 (2020-11-13) - -### ✨ Refactor - -- 重构 hook,引入 `@vueuse`,删除其中已有的`hook`,优化现有的 hook -- `useEvent` 更名->`useEventListener` -- 表单`ComponentType`删除 `SelectOptGroup`,`SelectOption`,`Transfer`,`Radio`,四个类型。修改`RadioButtonGroup`组件 - -### ✨ Features - -- 表单项的`componentsProps`支持函数类型 -- 菜单新增 tag 显示,支持 4 中类型颜色及 dot 圆点显示 -- 新增菜单及顶栏颜色选择配色 -- 增加示例结果页 -- 新增文件下载示例 - -### ⚡ Wip - -- 上传组件(未完成,测试中...) - -### ⚡ Performance Improvements - -- 优化 settingDrawer 代码 -- 优化多标签页切换速度 -- 增加表单自定义及动态能力 - -### 🐛 Bug Fixes - -- 修复多个富文本编辑器只显示一个 -- 修复登录过期后重新登录未跳转原来页面的 -- 修复 window 系统动态引入错误 -- 修复页面类型错误 -- 修复表单 switch 和 checkBox 单独使用报错 - -## 2.0.0-rc.9 (2020-11-9) - -### ✨ Features - -- 菜单 trigger 可以选择位置 -- 增加富文本嵌入表单的示例 -- 表单组件 schema 增加 `required`属性。简化配置 -- openModal 和 openDrawer 第二个参数可以代替`transferModalData`传参到内部 -- 带参路由可以被缓存 - -### ✨ Refactor - -- 重构由后台生成菜单的逻辑 -- Route Module 结构改造 - -### ⚡ Performance Improvements - -- 菜单性能继续优化,更流畅 -- 优化懒加载组件及示例 -- layout 样式微调 - -### 🎫 Chores - -- 删除菜单背景图 -- 更新`ant-design-vue`版本为`beta15` -- 更新`vite`版本为`rc.9` -- 异常页调整 -- `BasicTitle` 色块默认不显示 - -### 🐛 Bug Fixes - -- 修复升级之后 table 类型问题 -- 修复分割菜单且左侧菜单没有数据时候,继续展示上一次子菜单的问题 -- 修复`useMessage`类型问题 -- 修复表单项设置`disabled`不生效问题 -- 修复`useECharts`在`resize`时不能自适应,报错 -- 修复`useWatermark`在清空后`resize`未删除 -- 修复表单校验问题 -- 修复多级表头配置不生效问题 - -## 2.0.0-rc.8 (2020-11-2) - -### ✨ Features - -- 全局 loading 添加文本 -- 右键菜单支持多级 - -### 🎫 Chores - -- 登录缓存从 sessionStorage 改为 LocalStorage - -### ⚡ Performance Improvements - -- 更新`ant-design-vue`到`beta.12` -- Layout 界面布局样式调整 -- 优化懒加载组件 -- 优化表格渲染性能 -- 表单折叠搜索添图标添加动画 -- routeModule 可以忽略 layout 配置不写。方便配置一级菜单 - -### 🐛 Bug Fixes - -- 修复表格类型错误 -- 修复 mock 分页工具错误 -- 修复表格开启搜索表单折叠问题 -- 修复表格 size 为 samll 时候,fixed 列样式问题 -- 修复多标签页关闭报错问题 -- 修复 message 类型错误 - -## 2.0.0-rc.7 (2020-10-31) - -### ✨ Features - -- 表单组件现在支持直接传入 model 直接进行 set 操作,参考**组件->弹窗扩展->打开弹窗并传递数据** - -- modal 的 useModalInner 现在支持传入回调函数,用于接收外部`transferModalData`传进来的值, - - - 用于处理打开弹窗对表单等组件的设置值。参考**组件->弹窗扩展->打开弹窗并传递数据** - - `receiveModalDataRef`这个值暂时保留。尽量少用。后续可能会删除。 - -- drawer 的 useDrawerInner 现在支持传入回调函数,用于接收外部`transferModalData`传进来的值, - - 用于处理打开抽屉对表单等组件的设置值。参考**组件->抽屉扩展->打开抽屉并传递数据** - - `receiveModalDataRef`这个值暂时保留。尽量少用。后续可能会删除。 - -### ✨ Refactor - -- 表单代码优化重构 - -### ⚡ Performance Improvements - -- Modal slot 可以覆盖 -- 优化表格嵌入高度计算问题 - -### 🎫 Chores - -- 添加部分注释 -- pwa 图标补充 -- types 类型调整 -- 升级`ant-design-vue`到`beta.11`,并修改带来的已知问题,部分问题发现后在解决 - -### 🐛 Bug Fixes - -- 修复本地代理 post 接口到 https 地址超时错误 -- 修复 modal 在不显示 footer 的时候全屏高度计算问题 -- 修复表单重置未删除校验信息错误 -- 修复顶部菜单分割模式样式问题 -- 修复表格展开图标动画失效 - -## 2.0.0-rc.6 (2020-10-28) - -### ✨ Features - -- 新增`pwa`功能,可在`.env.production`开启 -- Button 组件扩展 `preIcon`和`postIcon`属性用于在文本前后添加图标 -- 恢复面包屑显示图标功能 - -### 🎫 Chores - -- 升级 vite 版本为`v1.0.0.rc8` -- vite.config.ts 内部 plugins 抽取 -- build 目录结构调整 -- 依赖更新 -- 文档更新 -- 修改默认路由切换动画 - -### ⚡ Performance Improvements - -- `setTitle`逻辑调整 -- 将系统用到的 sessionStorage 及 LocalStorage 缓存设置默认 `7` 天过期 - -### ✨ Refactor - -- 独立出`vite-plugin-html`,并修改相关插入 html 的逻辑 - -### 🐛 Bug Fixes - -- 修复热更新时多次注册组件警告问题 -- 修复登录后出现登录标签页 -- 修复路由切换参数消失问题 -- 修复 useMessage 图标样式问题 - -## 2.0.0-rc.5 (2020-10-26) - -### ✨ Features - -- 更新组件文档 -- 面包屑支持显示图标 -- 新增 tinymce 富文本组件 -- 表单新增 submitOnReset 控制是否在重置时重新发起请求 -- 表格新增`sortFn`支持自定义排序 -- 新增动画组件及示例 -- 新增懒加载/延时加载组件及示例 - -### ✨ Refactor - -- Drawer 组件的 detailType 修改为 isDetail - -### 🎫 Chores - -- 删除代码内的可选链语法 -- 表单重置逻辑修改 -- 关闭多标签页 tabs 动画 -- 升级 vite 版本为`v1.0.0.rc6` -- 删除中文路径警告。rc6 已修复 - -### 🐛 Bug Fixes - -- 修复抽屉组件自动高度及显示 footer 显示问题 -- 修复表单查询后重置回默认值 -- 修复菜单没有子节点时显示折叠的问题 -- 修复面包屑显示样式问题 -- 修复 modal 在 destroyOnClose=true 时多次打开拖拽失效 -- 修复表格出现多个 action 列 - -# 2.0.0-rc.4 (2020-10-21) - -### ✨ Features - -- 表格新增配置工具栏 -- 新增消息通知模块 - -### 🎫 Chores - -- 表格默认不显示边框 -- 依赖更新 -- 更新 vue 为`v3.0.2` -- 界面样式微调 - -### ⚡ Performance Improvements - -- 优化首屏体积大小 -- 优化 TableAction 组件 -- 减小菜单折叠宽度 - -### 🐛 Bug Fixes - -- 修复一级菜单折叠显示菜单名问题 -- 修复预览命令不打包问题 -- 修复表格 actionColOptions 参数不生效问题 -- 修复表格刷新表单 loading 不生效问题 -- 修复带参界面刷新参数丢失问题 - -# 2.0.0-rc.3 (2020-10-19) - -### ✨ Features - -- 新增 excel 组件及 excel/xml/csv/html 导出示例 -- 新增 excel 导入示例 -- 新增全局错误处理 -- 新增 markdown 组件及示例 -- 新增折叠菜单时可显示菜单名 - -### Docs - -- 添加项目文档 - -### 🎫 Chores - -- 升级依赖 -- 其他细节优化 - -### 🐛 Bug Fixes - -- 修复顶部菜单自适应问题 -- 修复 window 系统打包报错问题 - -# 2.0.0-rc.2 (2020-10-17) - -### ✨ Features - -- 打包可以配置输出`gizp` -- 打包可以配置删除`console` -- 路由及菜单不需要在手动引入,改为自动引入 - -### 🎫 Chores - -- 升级 vue 到`3.0.1` -- 将`vite`版本改为每日构建版本 - -### 🐛 Bug Fixes - -- 修复菜单报错 -- 修复表格自适应高度问题 -- 修复`window系统`执行 script 报错问题 -- 修复折叠组件问题 - -### ⚡ Performance Improvements - -- 删除菜单最小化背景 -- 阻止页面刷新重新渲染菜单 -- 其他一些细节优化 - -# 2.0.0-rc.1 (2020-10-14) - -### ✨ Features - -- 添加带参 tab - -### ⚡ Performance Improvements - -- 菜单折叠优化 -- 页面细节优化 -- 打包后压缩 html -- 预览组件及右键菜单函数化重构 -- 预览组件操作列居中 - -### 🎫 Chores - -- 更新依赖 -- 添加`README.en-US.md` -- 添加`CHANGELOG.en-US.md` - -### 🐛 Bug Fixes - -- 修复页面刷新跳转到登陆页 - -# 2.0.0-beta.7 (2020-10-12) - -### ⚡ Performance Improvements - -- 现有的选项卡切换不再显示动画和和进度条 - -### ✨ Features - -- 新增 `CountTo`组件及示例 demo -- 项目配置文件新增 `closeMessageOnSwitch`和`removeAllHttpPending` -- 生产环境独立出配置文件,用于动态配置项目配置 -- 新增 `useEcharts`和`useApexChart`来方便图表使用,同时新增相关 demo -- 新增工作台界面 -- 新增分析页界面 - -### 🎫 Chores - -- 更新依赖 - -### 🐛 Bug Fixes - -- 修复路由切换,tab 未激活问题 - -# 2.0.0-beta.56 (2020-10-11) - -### 💄 Styles - -- 菜单样式调整 - -### 🐛 Bug Fixes - -- 修复可编辑表格不能输入问题 -- 修复打包报错,生产环境不需要设计 proxy - -### ⚡ Performance Improvements - -- 优化多标签页切换速度 -- 首屏加载动画 - -# 2.0.0-beta.5 (2020-10-10) - -### ♻ Code Refactoring - -- 删除`tailwind css` - -### ⚡ Performance Improvements - -- 优化页面切换速度 - -### 🎫 Chores - -- 添加 `.vscode`和`.github`配置 -- 更改菜单图标 -- 新增`.env`配置文件 -- 更新 readme.md - -### 🐛 Bug Fixes - -- 修复`Tree`组件勾选事件失效问题 - -# 2.0.0-beta.4 (2020-10-08) - -### 🎫 Chores - -- 删除多余依赖 - -### 🐛 Bug Fixes - -- 修复页面刷新空白 -- 修复表格在生产环境样式失效 - -# 2.0.0-beta.3 (2020-10-07) - -### ✨ Features - -- 项目配置文件新增`openNProgress`用于控制是否开启顶部控制条 -- 添加`table`组件及 demo - -### 🎫 Chores - -- 添加` github workflows` - -# 2.0.0-beta.2 (2020-10-07) - -### ✨ Features - -- 新增图片预览组件 - -### 🔧 Continuous Integration - -- 增加 githubAction 脚本 - -# 2.0.0-beta.1(2020-09-30) - -### 🎫 Chores - -- 从 1.0 迁移部分代码 -- 添加 README.md 描述文件 - -### 🐛 Bug Fixes - -- 修复表单,动画及打包失败问题 diff --git a/README.md b/README.md index d686aa65..c55af2df 100644 --- a/README.md +++ b/README.md @@ -5,67 +5,47 @@

Vue vben admin

-**English** | [中文](./README.zh-CN.md) +## 简介 -## Introduction +精简 Vue Vben Admin。 -Vue Vben Admin is a free and open source middle and back-end template. Using the latest `vue3`, `vite2`, `TypeScript` and other mainstream technology development, the out-of-the-box middle and back-end front-end solutions can also be used for learning reference. +## 特性 -## Feature +- **最新技术栈**:使用 Vue3/vite2 等前端前沿技术开发 +- **TypeScript**: 应用程序级 JavaScript 的语言 +- **主题**:可配置的主题 +- **国际化**:内置完善的国际化方案 +- **Mock 数据** 内置 Mock 数据方案 +- **权限** 内置完善的动态路由权限生成方案 +- **组件** 二次封装了多个常用的组件 -- **State of The Art Development**:Use front-end front-end technology development such as Vue3/vite2 -- **TypeScript**: Application-level JavaScript language -- **Theming**: Configurable themes -- **International**:Built-in complete internationalization program -- **Mock Server** Built-in mock data scheme -- **Authority** Built-in complete dynamic routing permission generation scheme. -- **Component** Multiple commonly used components are encapsulated twice +## 预览 -## Preview +- [vue-vben-admin](https://vvbin.cn/next/) - 完整版中文站点 +- [vue-vben-admin-gh-pages](https://anncwb.github.io/vue-vben-admin/) - 完整版 github 站点 +- [vben-admin-thin-next](https://vvbin.cn/thin/next/) - 简化版中文站点 +- [vben-admin-thin-gh-pages](https://anncwb.github.io/vben-admin-thin-next/) - 简化版 github 站点 -- [vue-vben-admin](https://vvbin.cn/next/) - Full version Chinese site -- [vue-vben-admin-gh-pages](https://anncwb.github.io/vue-vben-admin/) - Full version of the github site -- [vben-admin-thin-next](https://vvbin.cn/thin/next/) - Simplified Chinese site -- [vben-admin-thin-gh-pages](https://anncwb.github.io/vben-admin-thin-next/) -Simplified github site +## 准备 -Test account: vben/123456 +- [node](http://nodejs.org/) 和 [git](https://git-scm.com/) -项目开发环境 +- [Vite](https://vitejs.dev/) - 熟悉 vite 特性 +- [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法 +- [TypeScript](https://www.typescriptlang.org/) - 熟悉`TypeScript`基本语法 +- [Es6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法 +- [Vue-Router-Next](https://next.router.vuejs.org/) - 熟悉 vue-router 基本使用 +- [Ant-Design-Vue](https://2x.antdv.com/docs/vue/introduce-cn/) - ui 基本使用 +- [Mock.js](https://github.com/nuysoft/Mock) - mockjs 基本语法 -

- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -

+## 安装使用 -### Use Gitpod - -Open the project in Gitpod (free online dev environment for GitHub) and start coding immediately. - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/anncwb/vue-vben-admin) - -## Documentation - -[Document](https://vvbin.cn/doc-next/) - -## Preparation - -- [node](http://nodejs.org/) and [git](https://git-scm.com/) - Project development environment -- [Vite](https://vitejs.dev/) - Familiar with vite features -- [Vue3](https://v3.vuejs.org/) - Familiar with Vue basic syntax -- [TypeScript](https://www.typescriptlang.org/) - Familiar with the basic syntax of `TypeScript` -- [Es6+](http://es6.ruanyifeng.com/) - Familiar with es6 basic syntax -- [Vue-Router-Next](https://next.router.vuejs.org/) - Familiar with the basic use of vue-router -- [Ant-Design-Vue](https://2x.antdv.com/docs/vue/introduce-cn/) - ui basic use -- [Mock.js](https://github.com/nuysoft/Mock) - mockjs basic syntax - -## Install and use - -- Get the project code +- 获取项目代码 ```bash git clone https://github.com/anncwb/vue-vben-admin.git ``` -- Installation dependencies +- 安装依赖 ```bash cd vue-vben-admin @@ -74,95 +54,47 @@ pnpm install ``` -- run +- 运行 ```bash pnpm serve ``` -- build +- 打包 ```bash pnpm build ``` -## Change Log +## Git 贡献提交规范 -[CHANGELOG](./CHANGELOG.zh_CN.md) +- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) -## Project + - `feat` 增加新功能 + - `fix` 修复问题/BUG + - `style` 代码风格相关无影响运行结果的 + - `perf` 优化/性能提升 + - `refactor` 重构 + - `revert` 撤销修改 + - `test` 测试相关 + - `docs` 文档/注释 + - `chore` 依赖更新/脚手架配置修改等 + - `workflow` 工作流改进 + - `ci` 持续集成 + - `types` 类型定义文件更改 + - `wip` 开发中 -- [vue-vben-admin](https://github.com/anncwb/vue-vben-admin) - full version -- [vue-vben-admin-thin-next](https://github.com/anncwb/vben-admin-thin-next) - Simplified version +## 相关仓库 -## How to contribute +如果这些插件对你有帮助,可以给一个 star 支持下 -You are very welcome to join![Raise an issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) Or submit a Pull Request。 - -**Pull Request:** - -1. Fork code! -2. Create your own branch: `git checkout -b feat/xxxx` -3. Submit your changes: `git commit -am 'feat(function): add xxxxx'` -4. Push your branch: `git push origin feat/xxxx` -5. submit`pull request` - -## Git Contribution submission specification - -- reference [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) specification ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - - - `feat` Add new features - - `fix` Fix the problem/BUG - - `style` The code style is related and does not affect the running result - - `perf` Optimization/performance improvement - - `refactor` Refactor - - `revert` Undo edit - - `test` Test related - - `docs` Documentation/notes - - `chore` Dependency update/scaffolding configuration modification etc. - - `workflow` Workflow improvements - - `ci` Continuous integration - - `types` Type definition file changes - - `wip` In development - -## Related warehouse - -If these plugins are helpful to you, you can give a star support - -- [vite-plugin-mock](https://github.com/anncwb/vite-plugin-mock) - Used for local and development environment data mock -- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - Used for html template conversion and compression -- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - Used for component library style introduction on demand -- [vite-plugin-theme](https://github.com/anncwb/vite-plugin-theme) - Used for online switching of theme colors and other color-related configurations -- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - Used to pack compressed image resources -- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - Used to pack input .gz|.brotil files -- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - Used to quickly generate svg sprite - -## Browser support - -The `Chrome 80+` browser is recommended for local development - -Support modern browsers, not IE - -| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | :-: | -| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | - -## Maintainer - -[@Vben](https://github.com/anncwb) - -## Donate - -If you think this project is helpful to you, you can help the author buy a cup of coffee to show your support! - -![donate](https://anncwb.github.io/anncwb/images/sponsor.png) - -Paypal Me - -## Discord - -- [github discussions](https://github.com/anncwb/vue-vben-admin/discussions) -- [Discord](https://discord.gg/8GuAdwDhj6) +- [vite-plugin-mock](https://github.com/anncwb/vite-plugin-mock) - 用于本地及开发环境数据 mock +- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - 用于 html 模版转换及压缩 +- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - 用于组件库样式按需引入 +- [vite-plugin-theme](https://github.com/anncwb/vite-plugin-theme) - 用于在线切换主题色等颜色相关配置 +- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - 用于打包压缩图片资源 +- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - 用于打包输出.gz|.brotil 文件 +- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - 用于快速生成 svg 雪碧图 ## License diff --git a/README.zh-CN.md b/README.zh-CN.md deleted file mode 100644 index 408af3cc..00000000 --- a/README.zh-CN.md +++ /dev/null @@ -1,175 +0,0 @@ -
VbenAdmin Logo

- -[![license](https://img.shields.io/github/license/anncwb/vue-vben-admin.svg)](LICENSE) - -

Vue vben admin

-
- -**中文** | [English](./README.md) - -## 简介 - -Vue Vben Admin 是一个免费开源的中后台模版。使用了最新的`vue3`,`vite2`,`TypeScript`等主流技术开发,开箱即用的中后台前端解决方案,也可用于学习参考。 - -## 特性 - -- **最新技术栈**:使用 Vue3/vite2 等前端前沿技术开发 -- **TypeScript**: 应用程序级 JavaScript 的语言 -- **主题**:可配置的主题 -- **国际化**:内置完善的国际化方案 -- **Mock 数据** 内置 Mock 数据方案 -- **权限** 内置完善的动态路由权限生成方案 -- **组件** 二次封装了多个常用的组件 - -## 预览 - -- [vue-vben-admin](https://vvbin.cn/next/) - 完整版中文站点 -- [vue-vben-admin-gh-pages](https://anncwb.github.io/vue-vben-admin/) - 完整版 github 站点 -- [vben-admin-thin-next](https://vvbin.cn/thin/next/) - 简化版中文站点 -- [vben-admin-thin-gh-pages](https://anncwb.github.io/vben-admin-thin-next/) - 简化版 github 站点 - -测试账号: vben/123456 - -

- VbenAdmin Logo - VbenAdmin Logo - VbenAdmin Logo -

- -### 使用 Gitpod - -在 Gitpod(适用于 GitHub 的免费在线开发环境)中打开项目,并立即开始编码. - -[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/anncwb/vue-vben-admin) - -## 文档 - -[文档地址](https://vvbin.cn/doc-next/) - -## 准备 - -- [node](http://nodejs.org/) 和 [git](https://git-scm.com/) -项目开发环境 -- [Vite](https://vitejs.dev/) - 熟悉 vite 特性 -- [Vue3](https://v3.vuejs.org/) - 熟悉 Vue 基础语法 -- [TypeScript](https://www.typescriptlang.org/) - 熟悉`TypeScript`基本语法 -- [Es6+](http://es6.ruanyifeng.com/) - 熟悉 es6 基本语法 -- [Vue-Router-Next](https://next.router.vuejs.org/) - 熟悉 vue-router 基本使用 -- [Ant-Design-Vue](https://2x.antdv.com/docs/vue/introduce-cn/) - ui 基本使用 -- [Mock.js](https://github.com/nuysoft/Mock) - mockjs 基本语法 - -## 安装使用 - -- 获取项目代码 - -```bash -git clone https://github.com/anncwb/vue-vben-admin.git -``` - -- 安装依赖 - -```bash -cd vue-vben-admin - -pnpm install - -``` - -- 运行 - -```bash -pnpm serve -``` - -- 打包 - -```bash -pnpm build -``` - -## 更新日志 - -[CHANGELOG](./CHANGELOG.zh_CN.md) - -## 项目地址 - -- [vue-vben-admin](https://github.com/anncwb/vue-vben-admin) - 完整版 -- [vue-vben-admin-thin-next](https://github.com/anncwb/vben-admin-thin-next) - 简化版 - -## 如何贡献 - -非常欢迎你的加入![提一个 Issue](https://github.com/anncwb/vue-vben-admin/issues/new/choose) 或者提交一个 Pull Request。 - -**Pull Request:** - -1. Fork 代码! -2. 创建自己的分支: `git checkout -b feat/xxxx` -3. 提交你的修改: `git commit -am 'feat(function): add xxxxx'` -4. 推送您的分支: `git push origin feat/xxxx` -5. 提交`pull request` - -## Git 贡献提交规范 - -- 参考 [vue](https://github.com/vuejs/vue/blob/dev/.github/COMMIT_CONVENTION.md) 规范 ([Angular](https://github.com/conventional-changelog/conventional-changelog/tree/master/packages/conventional-changelog-angular)) - - - `feat` 增加新功能 - - `fix` 修复问题/BUG - - `style` 代码风格相关无影响运行结果的 - - `perf` 优化/性能提升 - - `refactor` 重构 - - `revert` 撤销修改 - - `test` 测试相关 - - `docs` 文档/注释 - - `chore` 依赖更新/脚手架配置修改等 - - `workflow` 工作流改进 - - `ci` 持续集成 - - `types` 类型定义文件更改 - - `wip` 开发中 - -## 浏览器支持 - -本地开发推荐使用`Chrome 80+` 浏览器 - -支持现代浏览器, 不支持 IE - -| [ Edge](http://godban.github.io/browsers-support-badges/)
IE | [ Edge](http://godban.github.io/browsers-support-badges/)
Edge | [Firefox](http://godban.github.io/browsers-support-badges/)
Firefox | [Chrome](http://godban.github.io/browsers-support-badges/)
Chrome | [Safari](http://godban.github.io/browsers-support-badges/)
Safari | -| :-: | :-: | :-: | :-: | :-: | -| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | - -## 相关仓库 - -如果这些插件对你有帮助,可以给一个 star 支持下 - -- [vite-plugin-mock](https://github.com/anncwb/vite-plugin-mock) - 用于本地及开发环境数据 mock -- [vite-plugin-html](https://github.com/anncwb/vite-plugin-html) - 用于 html 模版转换及压缩 -- [vite-plugin-style-import](https://github.com/anncwb/vite-plugin-style-import) - 用于组件库样式按需引入 -- [vite-plugin-theme](https://github.com/anncwb/vite-plugin-theme) - 用于在线切换主题色等颜色相关配置 -- [vite-plugin-imagemin](https://github.com/anncwb/vite-plugin-imagemin) - 用于打包压缩图片资源 -- [vite-plugin-compression](https://github.com/anncwb/vite-plugin-compression) - 用于打包输出.gz|.brotil 文件 -- [vite-plugin-svg-icons](https://github.com/anncwb/vite-plugin-svg-icons) - 用于快速生成 svg 雪碧图 - -## 后台整合示例 - -- [lamp-cloud](https://github.com/zuihou/lamp-cloud) - 基于 SpringCloud Alibaba 的微服务中后台快速开发平台 -- [matecloud](https://github.com/matevip/matecloud) - MateCloud 微服务脚手架,基于 Spring Cloud 2020.0.3、SpringBoot 2.5.3 的全开源平台 - -## 维护者 - -[@Vben](https://github.com/anncwb) - -## 捐赠 - -如果你觉得这个项目对你有帮助,你可以帮作者买一杯咖啡表示支持! - -![donate](https://anncwb.github.io/anncwb/images/sponsor.png) - -Paypal Me - -## 交流 - -`Vue-vben-Admin` 是完全开源免费的项目,在帮助开发者更方便地进行中大型管理系统开发,同时也提供 QQ 交流群使用问题欢迎在群内提问。 - -- QQ 群 `569291866` - -## License - -[MIT © Vben-2020](./LICENSE) diff --git a/build/vite/plugin/index.ts b/build/vite/plugin/index.ts index 989b84e2..66956a3c 100644 --- a/build/vite/plugin/index.ts +++ b/build/vite/plugin/index.ts @@ -1,20 +1,20 @@ -import { PluginOption } from 'vite'; -import vue from '@vitejs/plugin-vue'; -import vueJsx from '@vitejs/plugin-vue-jsx'; -import legacy from '@vitejs/plugin-legacy'; -import purgeIcons from 'vite-plugin-purge-icons'; -import windiCSS from 'vite-plugin-windicss'; -import VitePluginCertificate from 'vite-plugin-mkcert'; +import { PluginOption } from 'vite' +import vue from '@vitejs/plugin-vue' +import vueJsx from '@vitejs/plugin-vue-jsx' +import legacy from '@vitejs/plugin-legacy' +import purgeIcons from 'vite-plugin-purge-icons' +import windiCSS from 'vite-plugin-windicss' +import VitePluginCertificate from 'vite-plugin-mkcert' //import vueSetupExtend from 'vite-plugin-vue-setup-extend'; -import { configHtmlPlugin } from './html'; -import { configPwaConfig } from './pwa'; -import { configMockPlugin } from './mock'; -import { configCompressPlugin } from './compress'; -import { configStyleImportPlugin } from './styleImport'; -import { configVisualizerConfig } from './visualizer'; -import { configThemePlugin } from './theme'; -import { configImageminPlugin } from './imagemin'; -import { configSvgIconsPlugin } from './svgSprite'; +import { configHtmlPlugin } from './html' +import { configPwaConfig } from './pwa' +import { configMockPlugin } from './mock' +import { configCompressPlugin } from './compress' +import { configStyleImportPlugin } from './styleImport' +import { configVisualizerConfig } from './visualizer' +import { configThemePlugin } from './theme' +import { configImageminPlugin } from './imagemin' +import { configSvgIconsPlugin } from './svgSprite' export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { const { @@ -23,7 +23,7 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { VITE_LEGACY, VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE, - } = viteEnv; + } = viteEnv const vitePlugins: (PluginOption | PluginOption[])[] = [ // have to @@ -35,48 +35,48 @@ export function createVitePlugins(viteEnv: ViteEnv, isBuild: boolean) { VitePluginCertificate({ source: 'coding', }), - ]; + ] // vite-plugin-windicss - vitePlugins.push(windiCSS()); + vitePlugins.push(windiCSS()) // @vitejs/plugin-legacy - VITE_LEGACY && isBuild && vitePlugins.push(legacy()); + VITE_LEGACY && isBuild && vitePlugins.push(legacy()) // vite-plugin-html - vitePlugins.push(configHtmlPlugin(viteEnv, isBuild)); + vitePlugins.push(configHtmlPlugin(viteEnv, isBuild)) // vite-plugin-svg-icons - vitePlugins.push(configSvgIconsPlugin(isBuild)); + vitePlugins.push(configSvgIconsPlugin(isBuild)) // vite-plugin-mock - VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild)); + VITE_USE_MOCK && vitePlugins.push(configMockPlugin(isBuild)) // vite-plugin-purge-icons - vitePlugins.push(purgeIcons()); + vitePlugins.push(purgeIcons()) // vite-plugin-style-import - vitePlugins.push(configStyleImportPlugin(isBuild)); + vitePlugins.push(configStyleImportPlugin(isBuild)) // rollup-plugin-visualizer - vitePlugins.push(configVisualizerConfig()); + vitePlugins.push(configVisualizerConfig()) // vite-plugin-theme - vitePlugins.push(configThemePlugin(isBuild)); + vitePlugins.push(configThemePlugin(isBuild)) // The following plugins only work in the production environment if (isBuild) { // vite-plugin-imagemin - VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()); + VITE_USE_IMAGEMIN && vitePlugins.push(configImageminPlugin()) // rollup-plugin-gzip vitePlugins.push( configCompressPlugin(VITE_BUILD_COMPRESS, VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE), - ); + ) // vite-plugin-pwa - vitePlugins.push(configPwaConfig(viteEnv)); + vitePlugins.push(configPwaConfig(viteEnv)) } - return vitePlugins; + return vitePlugins } diff --git a/build/vite/plugin/styleImport.ts b/build/vite/plugin/styleImport.ts index da1499d7..60d56843 100644 --- a/build/vite/plugin/styleImport.ts +++ b/build/vite/plugin/styleImport.ts @@ -2,11 +2,11 @@ * Introduces component library styles on demand. * https://github.com/anncwb/vite-plugin-style-import */ -import { createStyleImportPlugin } from 'vite-plugin-style-import'; +import { createStyleImportPlugin } from 'vite-plugin-style-import' export function configStyleImportPlugin(_isBuild: boolean) { if (!_isBuild) { - return []; + return [] } const styleImportPlugin = createStyleImportPlugin({ libs: [ @@ -45,7 +45,7 @@ export function configStyleImportPlugin(_isBuild: boolean) { 'skeleton-paragraph', 'skeleton-image', 'skeleton-button', - ]; + ] // 这里是需要额外引入样式的子组件列表 // 单独引入子组件时需引入组件样式,否则会在打包后导致子组件样式丢失 const replaceList = { @@ -66,16 +66,16 @@ export function configStyleImportPlugin(_isBuild: boolean) { 'month-picker': 'date-picker', 'range-picker': 'date-picker', 'image-preview-group': 'image', - }; + } return ignoreList.includes(name) ? '' : replaceList.hasOwnProperty(name) ? `ant-design-vue/es/${replaceList[name]}/style/index` - : `ant-design-vue/es/${name}/style/index`; + : `ant-design-vue/es/${name}/style/index` }, }, ], - }); - return styleImportPlugin; + }) + return styleImportPlugin } diff --git a/commitlint.config.js b/commitlint.config.js index 151ead3c..dbe4b091 100644 --- a/commitlint.config.js +++ b/commitlint.config.js @@ -1,11 +1,11 @@ -const fs = require('fs'); -const path = require('path'); -const { execSync } = require('child_process'); +const fs = require('fs') +const path = require('path') +const { execSync } = require('child_process') const scopes = fs .readdirSync(path.resolve(__dirname, 'src'), { withFileTypes: true }) .filter((dirent) => dirent.isDirectory()) - .map((dirent) => dirent.name.replace(/s$/, '')); + .map((dirent) => dirent.name.replace(/s$/, '')) // precomputed scope const scopeComplete = execSync('git status --porcelain || true') @@ -15,7 +15,7 @@ const scopeComplete = execSync('git status --porcelain || true') .find((r) => ~r.indexOf('M src')) ?.replace(/(\/)/g, '%%') ?.match(/src%%((\w|-)*)/)?.[1] - ?.replace(/s$/, ''); + ?.replace(/s$/, '') /** @type {import('cz-git').UserConfig} */ module.exports = { @@ -104,4 +104,4 @@ module.exports = { // emptyScopesAlias: 'empty: 不填写', // customScopesAlias: 'custom: 自定义', }, -}; +} diff --git a/index.html b/index.html index f615e97c..3f1aa761 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -13,14 +13,14 @@
diff --git a/src/components/ContextMenu/src/createContextMenu.ts b/src/components/ContextMenu/src/createContextMenu.ts deleted file mode 100644 index 8f7a1c82..00000000 --- a/src/components/ContextMenu/src/createContextMenu.ts +++ /dev/null @@ -1,75 +0,0 @@ -import contextMenuVue from './ContextMenu.vue'; -import { isClient } from '/@/utils/is'; -import { CreateContextOptions, ContextMenuProps } from './typing'; -import { createVNode, render } from 'vue'; - -const menuManager: { - domList: Element[]; - resolve: Fn; -} = { - domList: [], - resolve: () => {}, -}; - -export const createContextMenu = function (options: CreateContextOptions) { - const { event } = options || {}; - - event && event?.preventDefault(); - - if (!isClient) { - return; - } - return new Promise((resolve) => { - const body = document.body; - - const container = document.createElement('div'); - const propsData: Partial = {}; - if (options.styles) { - propsData.styles = options.styles; - } - - if (options.items) { - propsData.items = options.items; - } - - if (options.event) { - propsData.customEvent = event; - propsData.axis = { x: event.clientX, y: event.clientY }; - } - - const vm = createVNode(contextMenuVue, propsData); - render(vm, container); - - const handleClick = function () { - menuManager.resolve(''); - }; - - menuManager.domList.push(container); - - const remove = function () { - menuManager.domList.forEach((dom: Element) => { - try { - dom && body.removeChild(dom); - } catch (error) {} - }); - body.removeEventListener('click', handleClick); - body.removeEventListener('scroll', handleClick); - }; - - menuManager.resolve = function (arg) { - remove(); - resolve(arg); - }; - remove(); - body.appendChild(container); - body.addEventListener('click', handleClick); - body.addEventListener('scroll', handleClick); - }); -}; - -export const destroyContextMenu = function () { - if (menuManager) { - menuManager.resolve(''); - menuManager.domList = []; - } -}; diff --git a/src/components/ContextMenu/src/typing.ts b/src/components/ContextMenu/src/typing.ts deleted file mode 100644 index 63d3d37f..00000000 --- a/src/components/ContextMenu/src/typing.ts +++ /dev/null @@ -1,36 +0,0 @@ -export interface Axis { - x: number; - y: number; -} - -export interface ContextMenuItem { - label: string; - icon?: string; - hidden?: boolean; - disabled?: boolean; - handler?: Fn; - divider?: boolean; - children?: ContextMenuItem[]; -} -export interface CreateContextOptions { - event: MouseEvent; - icon?: string; - styles?: any; - items?: ContextMenuItem[]; -} - -export interface ContextMenuProps { - event?: MouseEvent; - styles?: any; - items: ContextMenuItem[]; - customEvent?: MouseEvent; - axis?: Axis; - width?: number; - showIcon?: boolean; -} - -export interface ItemContentProps { - showIcon: boolean | undefined; - item: ContextMenuItem; - handler: Fn; -} diff --git a/src/components/CountDown/index.ts b/src/components/CountDown/index.ts index 98094169..430e4bbc 100644 --- a/src/components/CountDown/index.ts +++ b/src/components/CountDown/index.ts @@ -1,6 +1,6 @@ -import { withInstall } from '/@/utils'; -import countButton from './src/CountButton.vue'; -import countdownInput from './src/CountdownInput.vue'; +import { withInstall } from '/@/utils' +import countButton from './src/CountButton.vue' +import countdownInput from './src/CountdownInput.vue' -export const CountdownInput = withInstall(countdownInput); -export const CountButton = withInstall(countButton); +export const CountdownInput = withInstall(countdownInput) +export const CountButton = withInstall(countButton) diff --git a/src/components/CountDown/src/CountButton.vue b/src/components/CountDown/src/CountButton.vue index 1ef520ed..5a785ab6 100644 --- a/src/components/CountDown/src/CountButton.vue +++ b/src/components/CountDown/src/CountButton.vue @@ -4,11 +4,11 @@ diff --git a/src/components/CountDown/src/CountdownInput.vue b/src/components/CountDown/src/CountdownInput.vue index 8da89cd6..9cb058ef 100644 --- a/src/components/CountDown/src/CountdownInput.vue +++ b/src/components/CountDown/src/CountdownInput.vue @@ -9,10 +9,10 @@ diff --git a/src/components/Cropper/src/Cropper.vue b/src/components/Cropper/src/Cropper.vue deleted file mode 100644 index 4523ad43..00000000 --- a/src/components/Cropper/src/Cropper.vue +++ /dev/null @@ -1,188 +0,0 @@ - - - diff --git a/src/components/Cropper/src/CropperAvatar.vue b/src/components/Cropper/src/CropperAvatar.vue deleted file mode 100644 index 15db0abd..00000000 --- a/src/components/Cropper/src/CropperAvatar.vue +++ /dev/null @@ -1,161 +0,0 @@ - - - - diff --git a/src/components/Cropper/src/typing.ts b/src/components/Cropper/src/typing.ts deleted file mode 100644 index e76cc6f8..00000000 --- a/src/components/Cropper/src/typing.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type Cropper from 'cropperjs'; - -export interface CropendResult { - imgBase64: string; - imgInfo: Cropper.Data; -} - -export type { Cropper }; diff --git a/src/components/Description/index.ts b/src/components/Description/index.ts index 58277d06..074babf5 100644 --- a/src/components/Description/index.ts +++ b/src/components/Description/index.ts @@ -1,6 +1,6 @@ -import { withInstall } from '/@/utils'; -import description from './src/Description.vue'; +import { withInstall } from '/@/utils' +import description from './src/Description.vue' -export * from './src/typing'; -export { useDescription } from './src/useDescription'; -export const Description = withInstall(description); +export * from './src/typing' +export { useDescription } from './src/useDescription' +export const Description = withInstall(description) diff --git a/src/components/Description/src/Description.vue b/src/components/Description/src/Description.vue index 1238acc2..dddf1332 100644 --- a/src/components/Description/src/Description.vue +++ b/src/components/Description/src/Description.vue @@ -1,16 +1,16 @@ diff --git a/src/components/Description/src/typing.ts b/src/components/Description/src/typing.ts index ee96084b..1fc0655e 100644 --- a/src/components/Description/src/typing.ts +++ b/src/components/Description/src/typing.ts @@ -1,50 +1,50 @@ -import type { VNode, CSSProperties } from 'vue'; -import type { CollapseContainerOptions } from '/@/components/Container/index'; -import type { DescriptionsProps } from 'ant-design-vue/es/descriptions/index'; +import type { VNode, CSSProperties } from 'vue' +import type { CollapseContainerOptions } from '/@/components/Container/index' +import type { DescriptionsProps } from 'ant-design-vue/es/descriptions/index' export interface DescItem { - labelMinWidth?: number; - contentMinWidth?: number; - labelStyle?: CSSProperties; - field: string; - label: string | VNode | JSX.Element; + labelMinWidth?: number + contentMinWidth?: number + labelStyle?: CSSProperties + field: string + label: string | VNode | JSX.Element // Merge column - span?: number; - show?: (...arg: any) => boolean; + span?: number + show?: (...arg: any) => boolean // render render?: ( val: any, data: Recordable, - ) => VNode | undefined | JSX.Element | Element | string | number; + ) => VNode | undefined | JSX.Element | Element | string | number } export interface DescriptionProps extends DescriptionsProps { // Whether to include the collapse component - useCollapse?: boolean; + useCollapse?: boolean /** * item configuration * @type DescItem */ - schema: DescItem[]; + schema: DescItem[] /** * 数据 * @type object */ - data: Recordable; + data: Recordable /** * Built-in CollapseContainer component configuration * @type CollapseContainerOptions */ - collapseOptions?: CollapseContainerOptions; + collapseOptions?: CollapseContainerOptions } export interface DescInstance { - setDescProps(descProps: Partial): void; + setDescProps(descProps: Partial): void } -export type Register = (descInstance: DescInstance) => void; +export type Register = (descInstance: DescInstance) => void /** * @description: */ -export type UseDescReturnType = [Register, DescInstance]; +export type UseDescReturnType = [Register, DescInstance] diff --git a/src/components/Description/src/useDescription.ts b/src/components/Description/src/useDescription.ts index d1037d06..07bb11a3 100644 --- a/src/components/Description/src/useDescription.ts +++ b/src/components/Description/src/useDescription.ts @@ -1,28 +1,28 @@ -import type { DescriptionProps, DescInstance, UseDescReturnType } from './typing'; -import { ref, getCurrentInstance, unref } from 'vue'; -import { isProdMode } from '/@/utils/env'; +import type { DescriptionProps, DescInstance, UseDescReturnType } from './typing' +import { ref, getCurrentInstance, unref } from 'vue' +import { isProdMode } from '/@/utils/env' export function useDescription(props?: Partial): UseDescReturnType { if (!getCurrentInstance()) { - throw new Error('useDescription() can only be used inside setup() or functional components!'); + throw new Error('useDescription() can only be used inside setup() or functional components!') } - const desc = ref>(null); - const loaded = ref(false); + const desc = ref>(null) + const loaded = ref(false) function register(instance: DescInstance) { if (unref(loaded) && isProdMode()) { - return; + return } - desc.value = instance; - props && instance.setDescProps(props); - loaded.value = true; + desc.value = instance + props && instance.setDescProps(props) + loaded.value = true } const methods: DescInstance = { setDescProps: (descProps: Partial): void => { - unref(desc)?.setDescProps(descProps); + unref(desc)?.setDescProps(descProps) }, - }; + } - return [register, methods]; + return [register, methods] } diff --git a/src/components/Drawer/index.ts b/src/components/Drawer/index.ts index 820ade56..73e4a49c 100644 --- a/src/components/Drawer/index.ts +++ b/src/components/Drawer/index.ts @@ -1,6 +1,6 @@ -import { withInstall } from '/@/utils'; -import basicDrawer from './src/BasicDrawer.vue'; +import { withInstall } from '/@/utils' +import basicDrawer from './src/BasicDrawer.vue' -export const BasicDrawer = withInstall(basicDrawer); -export * from './src/typing'; -export { useDrawer, useDrawerInner } from './src/useDrawer'; +export const BasicDrawer = withInstall(basicDrawer) +export * from './src/typing' +export { useDrawer, useDrawerInner } from './src/useDrawer' diff --git a/src/components/Drawer/src/BasicDrawer.vue b/src/components/Drawer/src/BasicDrawer.vue index 857b69bd..bcd3537e 100644 --- a/src/components/Drawer/src/BasicDrawer.vue +++ b/src/components/Drawer/src/BasicDrawer.vue @@ -31,8 +31,8 @@ diff --git a/src/components/FlowChart/src/adpterForTurbo.ts b/src/components/FlowChart/src/adpterForTurbo.ts deleted file mode 100644 index b68b276c..00000000 --- a/src/components/FlowChart/src/adpterForTurbo.ts +++ /dev/null @@ -1,75 +0,0 @@ -const TurboType = { - SEQUENCE_FLOW: 1, - START_EVENT: 2, - END_EVENT: 3, - USER_TASK: 4, - SERVICE_TASK: 5, - EXCLUSIVE_GATEWAY: 6, -}; - -function convertFlowElementToEdge(element) { - const { incoming, outgoing, properties, key } = element; - const { text, startPoint, endPoint, pointsList, logicFlowType } = properties; - const edge = { - id: key, - type: logicFlowType, - sourceNodeId: incoming[0], - targetNodeId: outgoing[0], - text, - startPoint, - endPoint, - pointsList, - properties: {}, - }; - const excludeProperties = ['startPoint', 'endPoint', 'pointsList', 'text', 'logicFlowType']; - Object.keys(element.properties).forEach((property) => { - if (excludeProperties.indexOf(property) === -1) { - edge.properties[property] = element.properties[property]; - } - }); - return edge; -} - -function convertFlowElementToNode(element) { - const { properties, key } = element; - const { x, y, text, logicFlowType } = properties; - const node = { - id: key, - type: logicFlowType, - x, - y, - text, - properties: {}, - }; - const excludeProperties = ['x', 'y', 'text', 'logicFlowType']; - Object.keys(element.properties).forEach((property) => { - if (excludeProperties.indexOf(property) === -1) { - node.properties[property] = element.properties[property]; - } - }); - return node; -} - -export function toLogicFlowData(data) { - const lfData: { - // TODO type - nodes: any[]; - edges: any[]; - } = { - nodes: [], - edges: [], - }; - const list = data.flowElementList; - list && - list.length > 0 && - list.forEach((element) => { - if (element.type === TurboType.SEQUENCE_FLOW) { - const edge = convertFlowElementToEdge(element); - lfData.edges.push(edge); - } else { - const node = convertFlowElementToNode(element); - lfData.nodes.push(node); - } - }); - return lfData; -} diff --git a/src/components/FlowChart/src/config.ts b/src/components/FlowChart/src/config.ts deleted file mode 100644 index 4f10d2ca..00000000 --- a/src/components/FlowChart/src/config.ts +++ /dev/null @@ -1,96 +0,0 @@ -export const nodeList = [ - { - text: '开始', - type: 'start', - class: 'node-start', - }, - { - text: '矩形', - type: 'rect', - class: 'node-rect', - }, - { - type: 'user', - text: '用户', - class: 'node-user', - }, - { - type: 'push', - text: '推送', - class: 'node-push', - }, - { - type: 'download', - text: '位置', - class: 'node-download', - }, - { - type: 'end', - text: '结束', - class: 'node-end', - }, -]; - -export const BpmnNode = [ - { - type: 'bpmn:startEvent', - text: '开始', - class: 'bpmn-start', - }, - { - type: 'bpmn:endEvent', - text: '结束', - class: 'bpmn-end', - }, - { - type: 'bpmn:exclusiveGateway', - text: '网关', - class: 'bpmn-exclusiveGateway', - }, - { - type: 'bpmn:userTask', - text: '用户', - class: 'bpmn-user', - }, -]; - -export function configDefaultDndPanel(lf) { - return [ - { - text: '选区', - icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAAH6ji2bAAAABGdBTUEAALGPC/xhBQAAAOVJREFUOBGtVMENwzAIjKP++2026ETdpv10iy7WFbqFyyW6GBywLCv5gI+Dw2Bluj1znuSjhb99Gkn6QILDY2imo60p8nsnc9bEo3+QJ+AKHfMdZHnl78wyTnyHZD53Zzx73MRSgYvnqgCUHj6gwdck7Zsp1VOrz0Uz8NbKunzAW+Gu4fYW28bUYutYlzSa7B84Fh7d1kjLwhcSdYAYrdkMQVpsBr5XgDGuXwQfQr0y9zwLda+DUYXLaGKdd2ZTtvbolaO87pdo24hP7ov16N0zArH1ur3iwJpXxm+v7oAJNR4JEP8DoAuSFEkYH7cAAAAASUVORK5CYII=', - callback: () => { - lf.updateEditConfig({ - stopMoveGraph: true, - }); - }, - }, - { - type: 'circle', - text: '开始', - icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAAH6ji2bAAAABGdBTUEAALGPC/xhBQAAAnBJREFUOBGdVL1rU1EcPfdGBddmaZLiEhdx1MHZQXApraCzQ7GKLgoRBxMfcRELuihWKcXFRcEWF8HBf0DdDCKYRZpnl7p0svLe9Zzbd29eQhTbC8nv+9zf130AT63jvooOGS8Vf9Nt5zxba7sXQwODfkWpkbjTQfCGUd9gIp3uuPP8bZ946g56dYQvnBg+b1HB8VIQmMFrazKcKSvFW2dQTxJnJdQ77urmXWOMBCmXM2Rke4S7UAW+/8ywwFoewmBps2tu7mbTdp8VMOkIRAkKfrVawalJTtIliclFbaOBqa0M2xImHeVIfd/nKAfVq/LGnPss5Kh00VEdSzfwnBXPUpmykNss4lUI9C1ga+8PNrBD5YeqRY2Zz8PhjooIbfJXjowvQJBqkmEkVnktWhwu2SM7SMx7Cj0N9IC0oQXRo8xwAGzQms+xrB/nNSUWVveI48ayrFGyC2+E2C+aWrZHXvOuz+CiV6iycWe1Rd1Q6+QUG07nb5SbPrL4426d+9E1axKjY3AoRrlEeSQo2Eu0T6BWAAr6COhTcWjRaYfKG5csnvytvUr/WY4rrPMB53Uo7jZRjXaG6/CFfNMaXEu75nG47X+oepU7PKJvvzGDY1YLSKHJrK7vFUwXKkaxwhCW3u+sDFMVrIju54RYYbFKpALZAo7sB6wcKyyrd+aBMryMT2gPyD6GsQoRFkGHr14TthZni9ck0z+Pnmee460mHXbRAypKNy3nuMdrWgVKj8YVV8E7PSzp1BZ9SJnJAsXdryw/h5ctboUVi4AFiCd+lQaYMw5z3LGTBKjLQOeUF35k89f58Vv/tGh+l+PE/wG0rgfIUbZK5AAAAABJRU5ErkJggg==', - }, - { - type: 'rect', - text: '用户任务', - icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAEFVwZaAAAABGdBTUEAALGPC/xhBQAAAqlJREFUOBF9VM9rE0EUfrMJNUKLihGbpLGtaCOIR8VjQMGDePCgCCIiCNqzCAp2MyYUCXhUtF5E0D+g1t48qAd7CCLqQUQKEWkStcEfVGlLdp/fm3aW2QQdyLzf33zz5m2IsAZ9XhDpyaaIZkTS4ASzK41TFao88GuJ3hsr2pAbipHxuSYyKRugagICGANkfFnNh3HeE2N0b3nN2cgnpcictw5veJIzxmDamSlxxQZicq/mflxhbaH8BLRbuRwNtZp0JAhoplVRUdzmCe/vO27wFuuA3S5qXruGdboy5/PRGFsbFGKo/haRtQHIrM83bVeTrOgNhZReWaYGnE4aUQgTJNvijJFF4jQ8BxJE5xfKatZWmZcTQ+BVgh7s8SgPlCkcec4mGTmieTP4xd7PcpIEg1TX6gdeLW8rTVMVLVvb7ctXoH0Cydl2QOPJBG21STE5OsnbweVYzAnD3A7PVILuY0yiiyDwSm2g441r6rMSgp6iK42yqroI2QoXeJVeA+YeZSa47gZdXaZWQKTrG93rukk/l2Al6Kzh5AZEl7dDQy+JjgFahQjRopSxPbrbvK7GRe9ePWBo1wcU7sYrFZtavXALwGw/7Dnc50urrHJuTPSoO2IMV3gUQGNg87IbSOIY9BpiT9HV7FCZ94nPXb3MSnwHn/FFFE1vG6DTby+r31KAkUktB3Qf6ikUPWxW1BkXSPQeMHHiW0+HAd2GelJsZz1OJegCxqzl+CLVHa/IibuHeJ1HAKzhuDR+ymNaRFM+4jU6UWKXorRmbyqkq/D76FffevwdCp+jN3UAN/C9JRVTDuOxC/oh+EdMnqIOrlYteKSfadVRGLJFJPSB/ti/6K8f0CNymg/iH2gO/f0DwE0yjAFO6l8JaR5j0VPwPwfaYHqOqrCI319WzwhwzNW/aQAAAABJRU5ErkJggg==', - cls: 'important-node', - }, - { - type: 'rect', - text: '系统任务', - icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABMAAAATCAYAAAEFVwZaAAAABGdBTUEAALGPC/xhBQAAAqlJREFUOBF9VM9rE0EUfrMJNUKLihGbpLGtaCOIR8VjQMGDePCgCCIiCNqzCAp2MyYUCXhUtF5E0D+g1t48qAd7CCLqQUQKEWkStcEfVGlLdp/fm3aW2QQdyLzf33zz5m2IsAZ9XhDpyaaIZkTS4ASzK41TFao88GuJ3hsr2pAbipHxuSYyKRugagICGANkfFnNh3HeE2N0b3nN2cgnpcictw5veJIzxmDamSlxxQZicq/mflxhbaH8BLRbuRwNtZp0JAhoplVRUdzmCe/vO27wFuuA3S5qXruGdboy5/PRGFsbFGKo/haRtQHIrM83bVeTrOgNhZReWaYGnE4aUQgTJNvijJFF4jQ8BxJE5xfKatZWmZcTQ+BVgh7s8SgPlCkcec4mGTmieTP4xd7PcpIEg1TX6gdeLW8rTVMVLVvb7ctXoH0Cydl2QOPJBG21STE5OsnbweVYzAnD3A7PVILuY0yiiyDwSm2g441r6rMSgp6iK42yqroI2QoXeJVeA+YeZSa47gZdXaZWQKTrG93rukk/l2Al6Kzh5AZEl7dDQy+JjgFahQjRopSxPbrbvK7GRe9ePWBo1wcU7sYrFZtavXALwGw/7Dnc50urrHJuTPSoO2IMV3gUQGNg87IbSOIY9BpiT9HV7FCZ94nPXb3MSnwHn/FFFE1vG6DTby+r31KAkUktB3Qf6ikUPWxW1BkXSPQeMHHiW0+HAd2GelJsZz1OJegCxqzl+CLVHa/IibuHeJ1HAKzhuDR+ymNaRFM+4jU6UWKXorRmbyqkq/D76FffevwdCp+jN3UAN/C9JRVTDuOxC/oh+EdMnqIOrlYteKSfadVRGLJFJPSB/ti/6K8f0CNymg/iH2gO/f0DwE0yjAFO6l8JaR5j0VPwPwfaYHqOqrCI319WzwhwzNW/aQAAAABJRU5ErkJggg==', - cls: 'import_icon', - }, - { - type: 'diamond', - text: '条件判断', - icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABUAAAAVCAYAAAHeEJUAAAAABGdBTUEAALGPC/xhBQAAAvVJREFUOBGNVEFrE0EU/mY3bQoiFlOkaUJrQUQoWMGePLX24EH0IIoHKQiCV0G8iE1covgLiqA/QTzVm1JPogc9tIJYFaQtlhQxqYjSpunu+L7JvmUTU3AgmTfvffPNN++9WSA1DO182f6xwILzD5btfAoQmwL5KJEwiQyVbSVZ0IgRyV6PTpIJ81E5ZvqfHQR0HUOBHW4L5Et2kQ6Zf7iAOhTFAA8s0pEP7AXO1uAA52SbqGk6h/6J45LaLhO64ByfcUzM39V7ZiAdS2yCePPEIQYvTUHqM/n7dgQNfBKWPjpF4ISk8q3J4nB11qw6X8l+FsF3EhlkEMfrjIer3wJTLwS2aCNcj4DbGxXTw00JmAuO+Ni6bBxVUCvS5d9aa04+so4pHW5jLTywuXAL7jJ+D06sl82Sgl2JuVBQn498zkc2bGKxULHjCnSMadBKYDYYHAtsby1EQ5lNGrQd4Y3v4Zo0XdGEmDno46yCM9Tk+RiJmUYHS/aXHPNTcjxcbTFna000PFJHIVZ5lFRqRpJWk9/+QtlOUYJj9HG5pVFEU7zqIYDVsw2s+AJaD8wTd2umgSCCyUxgGsS1Y6TBwXQQTFuZaHcd8gAGioE90hlsY+wMcs30RduYtxanjMGal8H5dMW67dmT1JFtYUEe8LiQLRsPZ6IIc7A4J5tqco3T0pnv/4u0kyzrYUq7gASuEyI8VXKvB9Odytv6jS/PNaZBln0nioJG/AVQRZvApOdhjj3Jt8QC8Im09SafwdBdvIpztpxWxpeKCC+EsFdS8DCyuCn2munFpL7ctHKp+Xc5cMybeIyMAN33SPL3ZR9QV1XVwLyzHm6Iv0/yeUuUb7PPlZC4D4HZkeu6dpF4v9j9MreGtMbxMMRLIcjJic9yHi7WQ3yVKzZVWUr5UrViJvn1FfUlwe/KYVfYyWRLSGNu16hR01U9IacajXPei0wx/5BqgInvJN+MMNtNme7ReU9SBbgntovn0kKHpFg7UogZvaZiOue/q1SBo9ktHzQAAAAASUVORK5CYII=', - }, - { - type: 'circle', - text: '结束', - icon: 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAAH6ji2bAAAABGdBTUEAALGPC/xhBQAAA1BJREFUOBFtVE1IVUEYPXOf+tq40Y3vPcmFIdSjIorWoRG0ERWUgnb5FwVhYQSl72oUoZAboxKNFtWiwKRN0M+jpfSzqJAQclHo001tKkjl3emc8V69igP3znzfnO/M9zcDcKT67azmjYWTwl9Vn7Vumeqzj1DVb6cleQY4oAVnIOPb+mKAGxQmKI5CWNJ2aLPatxWa3aB9K7/fB+/Z0jUF6TmMlFLQqrkECWQzOZxYGjTlOl8eeKaIY5yHnFn486xBustDjWT6dG7pmjHOJd+33t0iitTPkK6tEvjxq4h2MozQ6WFSX/LkDUGfFwfhEZj1Auz/U4pyAi5Sznd7uKzznXeVHlI/Aywmk6j7fsUsEuCGADrWARXXwjxWQsUbIupDHJI7kF5dRktg0eN81IbiZXiTESic50iwS+t1oJgL83jAiBupLDCQqwziaWSoAFSeIR3P5Xv5az00wyIn35QRYTwdSYbz8pH8fxUUAtxnFvYmEmgI0wYXUXcCCSpeEVpXlsRhBnCEATxWylL9+EKCAYhe1NGstUa6356kS9NVvt3DU2fd+Wtbm/+lSbylJqsqkSm9CRhvoJVlvKPvF1RKY/FcPn5j4UfIMLn8D4UYb54BNsilTDXKnF4CfTobA0FpoW/LSp306wkXM+XaOJhZaFkcNM82ASNAWMrhrUbRfmyeI1FvRBTpN06WKxa9BK0o2E4Pd3zfBBEwPsv9sQBnmLVbLEIZ/Xe9LYwJu/Er17W6HYVBc7vmuk0xUQ+pqxdom5Fnp55SiytXLPYoMXNM4u4SNSCFWnrVIzKG3EGyMXo6n/BQOe+bX3FClY4PwydVhthOZ9NnS+ntiLh0fxtlUJHAuGaFoVmttpVMeum0p3WEXbcll94l1wM/gZ0Ccczop77VvN2I7TlsZCsuXf1WHvWEhjO8DPtyOVg2/mvK9QqboEth+7pD6NUQC1HN/TwvydGBARi9MZSzLE4b8Ru3XhX2PBxf8E1er2A6516o0w4sIA+lwURhAON82Kwe2iDAC1Watq4XHaGQ7skLcFOtI5lDxuM2gZe6WFIotPAhbaeYlU4to5cuarF1QrcZ/lwrLaCJl66JBocYZnrNlvm2+MBCTmUymPrYZVbjdlr/BxlMjmNmNI3SAAAAAElFTkSuQmCC', - }, - ]; -} diff --git a/src/components/FlowChart/src/enum.ts b/src/components/FlowChart/src/enum.ts deleted file mode 100644 index 8ea134ca..00000000 --- a/src/components/FlowChart/src/enum.ts +++ /dev/null @@ -1,11 +0,0 @@ -export enum ToolbarTypeEnum { - ZOOM_IN = 'zoomIn', - ZOOM_OUT = 'zoomOut', - RESET_ZOOM = 'resetZoom', - - UNDO = 'undo', - REDO = 'redo', - - SNAPSHOT = 'snapshot', - VIEW_DATA = 'viewData', -} diff --git a/src/components/FlowChart/src/types.ts b/src/components/FlowChart/src/types.ts deleted file mode 100644 index 94992ba1..00000000 --- a/src/components/FlowChart/src/types.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { NodeConfig } from '@logicflow/core'; -import { ToolbarTypeEnum } from './enum'; - -export interface NodeItem extends NodeConfig { - icon: string; -} - -export interface ToolbarConfig { - type?: string | ToolbarTypeEnum; - tooltip?: string | boolean; - icon?: string; - disabled?: boolean; - separate?: boolean; -} diff --git a/src/components/FlowChart/src/useFlowContext.ts b/src/components/FlowChart/src/useFlowContext.ts deleted file mode 100644 index 7d15f3b3..00000000 --- a/src/components/FlowChart/src/useFlowContext.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type LogicFlow from '@logicflow/core'; - -import { provide, inject } from 'vue'; - -const key = Symbol('flow-chart'); - -type Instance = { - logicFlow: LogicFlow; -}; - -export function createFlowChartContext(instance: Instance) { - provide(key, instance); -} - -export function useFlowChartContext(): Instance { - return inject(key) as Instance; -} diff --git a/src/components/Form/index.ts b/src/components/Form/index.ts deleted file mode 100644 index d85b3c51..00000000 --- a/src/components/Form/index.ts +++ /dev/null @@ -1,17 +0,0 @@ -import BasicForm from './src/BasicForm.vue'; - -export * from './src/types/form'; -export * from './src/types/formItem'; - -export { useComponentRegister } from './src/hooks/useComponentRegister'; -export { useForm } from './src/hooks/useForm'; - -export { default as ApiSelect } from './src/components/ApiSelect.vue'; -export { default as RadioButtonGroup } from './src/components/RadioButtonGroup.vue'; -export { default as ApiTreeSelect } from './src/components/ApiTreeSelect.vue'; -export { default as ApiTree } from './src/components/ApiTree.vue'; -export { default as ApiRadioGroup } from './src/components/ApiRadioGroup.vue'; -export { default as ApiCascader } from './src/components/ApiCascader.vue'; -export { default as ApiTransfer } from './src/components/ApiTransfer.vue'; - -export { BasicForm }; diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue deleted file mode 100644 index d6416ee6..00000000 --- a/src/components/Form/src/BasicForm.vue +++ /dev/null @@ -1,353 +0,0 @@ - - - diff --git a/src/components/Form/src/componentMap.ts b/src/components/Form/src/componentMap.ts deleted file mode 100644 index 53e65c95..00000000 --- a/src/components/Form/src/componentMap.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { Component } from 'vue'; -import type { ComponentType } from './types/index'; - -/** - * Component list, register here to setting it in the form - */ -import { - Input, - Select, - Radio, - Checkbox, - AutoComplete, - Cascader, - DatePicker, - InputNumber, - Switch, - TimePicker, - TreeSelect, - Slider, - Rate, - Divider, -} from 'ant-design-vue'; - -import ApiRadioGroup from './components/ApiRadioGroup.vue'; -import RadioButtonGroup from './components/RadioButtonGroup.vue'; -import ApiSelect from './components/ApiSelect.vue'; -import ApiTree from './components/ApiTree.vue'; -import ApiTreeSelect from './components/ApiTreeSelect.vue'; -import ApiCascader from './components/ApiCascader.vue'; -import ApiTransfer from './components/ApiTransfer.vue'; -import { BasicUpload } from '/@/components/Upload'; -import { StrengthMeter } from '/@/components/StrengthMeter'; -import { IconPicker } from '/@/components/Icon'; -import { CountdownInput } from '/@/components/CountDown'; - -const componentMap = new Map(); - -componentMap.set('Input', Input); -componentMap.set('InputGroup', Input.Group); -componentMap.set('InputPassword', Input.Password); -componentMap.set('InputSearch', Input.Search); -componentMap.set('InputTextArea', Input.TextArea); -componentMap.set('InputNumber', InputNumber); -componentMap.set('AutoComplete', AutoComplete); - -componentMap.set('Select', Select); -componentMap.set('ApiSelect', ApiSelect); -componentMap.set('ApiTree', ApiTree); -componentMap.set('TreeSelect', TreeSelect); -componentMap.set('ApiTreeSelect', ApiTreeSelect); -componentMap.set('ApiRadioGroup', ApiRadioGroup); -componentMap.set('Switch', Switch); -componentMap.set('RadioButtonGroup', RadioButtonGroup); -componentMap.set('RadioGroup', Radio.Group); -componentMap.set('Checkbox', Checkbox); -componentMap.set('CheckboxGroup', Checkbox.Group); -componentMap.set('ApiCascader', ApiCascader); -componentMap.set('Cascader', Cascader); -componentMap.set('Slider', Slider); -componentMap.set('Rate', Rate); -componentMap.set('ApiTransfer', ApiTransfer); - -componentMap.set('DatePicker', DatePicker); -componentMap.set('MonthPicker', DatePicker.MonthPicker); -componentMap.set('RangePicker', DatePicker.RangePicker); -componentMap.set('WeekPicker', DatePicker.WeekPicker); -componentMap.set('TimePicker', TimePicker); -componentMap.set('StrengthMeter', StrengthMeter); -componentMap.set('IconPicker', IconPicker); -componentMap.set('InputCountDown', CountdownInput); - -componentMap.set('Upload', BasicUpload); -componentMap.set('Divider', Divider); - -export function add(compName: ComponentType, component: Component) { - componentMap.set(compName, component); -} - -export function del(compName: ComponentType) { - componentMap.delete(compName); -} - -export { componentMap }; diff --git a/src/components/Form/src/components/ApiCascader.vue b/src/components/Form/src/components/ApiCascader.vue deleted file mode 100644 index 0d8cf635..00000000 --- a/src/components/Form/src/components/ApiCascader.vue +++ /dev/null @@ -1,198 +0,0 @@ - - diff --git a/src/components/Form/src/components/ApiRadioGroup.vue b/src/components/Form/src/components/ApiRadioGroup.vue deleted file mode 100644 index 712cfba8..00000000 --- a/src/components/Form/src/components/ApiRadioGroup.vue +++ /dev/null @@ -1,130 +0,0 @@ - - - diff --git a/src/components/Form/src/components/ApiSelect.vue b/src/components/Form/src/components/ApiSelect.vue deleted file mode 100644 index 6155aab1..00000000 --- a/src/components/Form/src/components/ApiSelect.vue +++ /dev/null @@ -1,147 +0,0 @@ - - diff --git a/src/components/Form/src/components/ApiTransfer.vue b/src/components/Form/src/components/ApiTransfer.vue deleted file mode 100644 index 16dfee09..00000000 --- a/src/components/Form/src/components/ApiTransfer.vue +++ /dev/null @@ -1,134 +0,0 @@ - - - diff --git a/src/components/Form/src/components/ApiTree.vue b/src/components/Form/src/components/ApiTree.vue deleted file mode 100644 index 0ec6917d..00000000 --- a/src/components/Form/src/components/ApiTree.vue +++ /dev/null @@ -1,90 +0,0 @@ - - - diff --git a/src/components/Form/src/components/ApiTreeSelect.vue b/src/components/Form/src/components/ApiTreeSelect.vue deleted file mode 100644 index 3f073d34..00000000 --- a/src/components/Form/src/components/ApiTreeSelect.vue +++ /dev/null @@ -1,86 +0,0 @@ - - - diff --git a/src/components/Form/src/components/FormAction.vue b/src/components/Form/src/components/FormAction.vue deleted file mode 100644 index 8dec49fe..00000000 --- a/src/components/Form/src/components/FormAction.vue +++ /dev/null @@ -1,135 +0,0 @@ - - diff --git a/src/components/Form/src/components/FormItem.vue b/src/components/Form/src/components/FormItem.vue deleted file mode 100644 index 157e0db1..00000000 --- a/src/components/Form/src/components/FormItem.vue +++ /dev/null @@ -1,392 +0,0 @@ - diff --git a/src/components/Form/src/components/RadioButtonGroup.vue b/src/components/Form/src/components/RadioButtonGroup.vue deleted file mode 100644 index c2c7b220..00000000 --- a/src/components/Form/src/components/RadioButtonGroup.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - diff --git a/src/components/Form/src/helper.ts b/src/components/Form/src/helper.ts deleted file mode 100644 index d0727f38..00000000 --- a/src/components/Form/src/helper.ts +++ /dev/null @@ -1,74 +0,0 @@ -import type { ValidationRule } from 'ant-design-vue/lib/form/Form'; -import type { ComponentType } from './types/index'; -import { useI18n } from '/@/hooks/web/useI18n'; -import { dateUtil } from '/@/utils/dateUtil'; -import { isNumber, isObject } from '/@/utils/is'; - -const { t } = useI18n(); - -/** - * @description: 生成placeholder - */ -export function createPlaceholderMessage(component: ComponentType) { - if (component.includes('Input') || component.includes('Complete')) { - return t('common.inputText'); - } - if (component.includes('Picker')) { - return t('common.chooseText'); - } - if ( - component.includes('Select') || - component.includes('Cascader') || - component.includes('Checkbox') || - component.includes('Radio') || - component.includes('Switch') - ) { - // return `请选择${label}`; - return t('common.chooseText'); - } - return ''; -} - -const DATE_TYPE = ['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker']; - -function genType() { - return [...DATE_TYPE, 'RangePicker']; -} - -export function setComponentRuleType( - rule: ValidationRule, - component: ComponentType, - valueFormat: string, -) { - if (['DatePicker', 'MonthPicker', 'WeekPicker', 'TimePicker'].includes(component)) { - rule.type = valueFormat ? 'string' : 'object'; - } else if (['RangePicker', 'Upload', 'CheckboxGroup', 'TimePicker'].includes(component)) { - rule.type = 'array'; - } else if (['InputNumber'].includes(component)) { - rule.type = 'number'; - } -} - -export function processDateValue(attr: Recordable, component: string) { - const { valueFormat, value } = attr; - if (valueFormat) { - attr.value = isObject(value) ? dateUtil(value).format(valueFormat) : value; - } else if (DATE_TYPE.includes(component) && value) { - attr.value = dateUtil(attr.value); - } -} - -export function handleInputNumberValue(component?: ComponentType, val?: any) { - if (!component) return val; - if (['Input', 'InputPassword', 'InputSearch', 'InputTextArea'].includes(component)) { - return val && isNumber(val) ? `${val}` : val; - } - return val; -} - -/** - * 时间字段 - */ -export const dateItemType = genType(); - -export const defaultValueComponents = ['Input', 'InputPassword', 'InputSearch', 'InputTextArea']; diff --git a/src/components/Form/src/hooks/useAdvanced.ts b/src/components/Form/src/hooks/useAdvanced.ts deleted file mode 100644 index 0df0be0b..00000000 --- a/src/components/Form/src/hooks/useAdvanced.ts +++ /dev/null @@ -1,170 +0,0 @@ -import type { ColEx } from '../types'; -import type { AdvanceState } from '../types/hooks'; -import { ComputedRef, getCurrentInstance, Ref } from 'vue'; -import type { FormProps, FormSchema } from '../types/form'; -import { computed, unref, watch } from 'vue'; -import { isBoolean, isFunction, isNumber, isObject } from '/@/utils/is'; -import { useBreakpoint } from '/@/hooks/event/useBreakpoint'; -import { useDebounceFn } from '@vueuse/core'; - -const BASIC_COL_LEN = 24; - -interface UseAdvancedContext { - advanceState: AdvanceState; - emit: EmitType; - getProps: ComputedRef; - getSchema: ComputedRef; - formModel: Recordable; - defaultValueRef: Ref; -} - -export default function ({ - advanceState, - emit, - getProps, - getSchema, - formModel, - defaultValueRef, -}: UseAdvancedContext) { - const vm = getCurrentInstance(); - - const { realWidthRef, screenEnum, screenRef } = useBreakpoint(); - - const getEmptySpan = computed((): number => { - if (!advanceState.isAdvanced) { - return 0; - } - // For some special cases, you need to manually specify additional blank lines - const emptySpan = unref(getProps).emptySpan || 0; - - if (isNumber(emptySpan)) { - return emptySpan; - } - if (isObject(emptySpan)) { - const { span = 0 } = emptySpan; - const screen = unref(screenRef) as string; - - const screenSpan = (emptySpan as any)[screen.toLowerCase()]; - return screenSpan || span || 0; - } - return 0; - }); - - const debounceUpdateAdvanced = useDebounceFn(updateAdvanced, 30); - - watch( - [() => unref(getSchema), () => advanceState.isAdvanced, () => unref(realWidthRef)], - () => { - const { showAdvancedButton } = unref(getProps); - if (showAdvancedButton) { - debounceUpdateAdvanced(); - } - }, - { immediate: true }, - ); - - function getAdvanced(itemCol: Partial, itemColSum = 0, isLastAction = false) { - const width = unref(realWidthRef); - - const mdWidth = - parseInt(itemCol.md as string) || - parseInt(itemCol.xs as string) || - parseInt(itemCol.sm as string) || - (itemCol.span as number) || - BASIC_COL_LEN; - - const lgWidth = parseInt(itemCol.lg as string) || mdWidth; - const xlWidth = parseInt(itemCol.xl as string) || lgWidth; - const xxlWidth = parseInt(itemCol.xxl as string) || xlWidth; - if (width <= screenEnum.LG) { - itemColSum += mdWidth; - } else if (width < screenEnum.XL) { - itemColSum += lgWidth; - } else if (width < screenEnum.XXL) { - itemColSum += xlWidth; - } else { - itemColSum += xxlWidth; - } - - if (isLastAction) { - advanceState.hideAdvanceBtn = false; - if (itemColSum <= BASIC_COL_LEN * 2) { - // When less than or equal to 2 lines, the collapse and expand buttons are not displayed - advanceState.hideAdvanceBtn = true; - advanceState.isAdvanced = true; - } else if ( - itemColSum > BASIC_COL_LEN * 2 && - itemColSum <= BASIC_COL_LEN * (unref(getProps).autoAdvancedLine || 3) - ) { - advanceState.hideAdvanceBtn = false; - - // More than 3 lines collapsed by default - } else if (!advanceState.isLoad) { - advanceState.isLoad = true; - advanceState.isAdvanced = !advanceState.isAdvanced; - } - return { isAdvanced: advanceState.isAdvanced, itemColSum }; - } - if (itemColSum > BASIC_COL_LEN * (unref(getProps).alwaysShowLines || 1)) { - return { isAdvanced: advanceState.isAdvanced, itemColSum }; - } else { - // The first line is always displayed - return { isAdvanced: true, itemColSum }; - } - } - - function updateAdvanced() { - let itemColSum = 0; - let realItemColSum = 0; - const { baseColProps = {} } = unref(getProps); - - for (const schema of unref(getSchema)) { - const { show, colProps } = schema; - let isShow = true; - - if (isBoolean(show)) { - isShow = show; - } - - if (isFunction(show)) { - isShow = show({ - schema: schema, - model: formModel, - field: schema.field, - values: { - ...unref(defaultValueRef), - ...formModel, - }, - }); - } - - if (isShow && (colProps || baseColProps)) { - const { itemColSum: sum, isAdvanced } = getAdvanced( - { ...baseColProps, ...colProps }, - itemColSum, - ); - - itemColSum = sum || 0; - if (isAdvanced) { - realItemColSum = itemColSum; - } - schema.isAdvanced = isAdvanced; - } - } - - // 确保页面发送更新 - vm?.proxy?.$forceUpdate(); - - advanceState.actionSpan = (realItemColSum % BASIC_COL_LEN) + unref(getEmptySpan); - - getAdvanced(unref(getProps).actionColOptions || { span: BASIC_COL_LEN }, itemColSum, true); - - emit('advanced-change'); - } - - function handleToggleAdvanced() { - advanceState.isAdvanced = !advanceState.isAdvanced; - } - - return { handleToggleAdvanced }; -} diff --git a/src/components/Form/src/hooks/useAutoFocus.ts b/src/components/Form/src/hooks/useAutoFocus.ts deleted file mode 100644 index e24dd6bb..00000000 --- a/src/components/Form/src/hooks/useAutoFocus.ts +++ /dev/null @@ -1,40 +0,0 @@ -import type { ComputedRef, Ref } from 'vue'; -import type { FormSchema, FormActionType, FormProps } from '../types/form'; - -import { unref, nextTick, watchEffect } from 'vue'; - -interface UseAutoFocusContext { - getSchema: ComputedRef; - getProps: ComputedRef; - isInitedDefault: Ref; - formElRef: Ref; -} -export async function useAutoFocus({ - getSchema, - getProps, - formElRef, - isInitedDefault, -}: UseAutoFocusContext) { - watchEffect(async () => { - if (unref(isInitedDefault) || !unref(getProps).autoFocusFirstItem) { - return; - } - await nextTick(); - const schemas = unref(getSchema); - const formEl = unref(formElRef); - const el = (formEl as any)?.$el as HTMLElement; - if (!formEl || !el || !schemas || schemas.length === 0) { - return; - } - - const firstItem = schemas[0]; - // Only open when the first form item is input type - if (!firstItem.component.includes('Input')) { - return; - } - - const inputEl = el.querySelector('.ant-row:first-child input') as Nullable; - if (!inputEl) return; - inputEl?.focus(); - }); -} diff --git a/src/components/Form/src/hooks/useComponentRegister.ts b/src/components/Form/src/hooks/useComponentRegister.ts deleted file mode 100644 index 218aaa9b..00000000 --- a/src/components/Form/src/hooks/useComponentRegister.ts +++ /dev/null @@ -1,11 +0,0 @@ -import type { ComponentType } from '../types/index'; -import { tryOnUnmounted } from '@vueuse/core'; -import { add, del } from '../componentMap'; -import type { Component } from 'vue'; - -export function useComponentRegister(compName: ComponentType, comp: Component) { - add(compName, comp); - tryOnUnmounted(() => { - del(compName); - }); -} diff --git a/src/components/Form/src/hooks/useForm.ts b/src/components/Form/src/hooks/useForm.ts deleted file mode 100644 index d026d690..00000000 --- a/src/components/Form/src/hooks/useForm.ts +++ /dev/null @@ -1,122 +0,0 @@ -import type { FormProps, FormActionType, UseFormReturnType, FormSchema } from '../types/form'; -import type { NamePath } from 'ant-design-vue/lib/form/interface'; -import type { DynamicProps } from '/#/utils'; -import { ref, onUnmounted, unref, nextTick, watch } from 'vue'; -import { isProdMode } from '/@/utils/env'; -import { error } from '/@/utils/log'; -import { getDynamicProps } from '/@/utils'; - -export declare type ValidateFields = (nameList?: NamePath[]) => Promise; - -type Props = Partial>; - -export function useForm(props?: Props): UseFormReturnType { - const formRef = ref>(null); - const loadedRef = ref>(false); - - async function getForm() { - const form = unref(formRef); - if (!form) { - error( - 'The form instance has not been obtained, please make sure that the form has been rendered when performing the form operation!', - ); - } - await nextTick(); - return form as FormActionType; - } - - function register(instance: FormActionType) { - isProdMode() && - onUnmounted(() => { - formRef.value = null; - loadedRef.value = null; - }); - if (unref(loadedRef) && isProdMode() && instance === unref(formRef)) return; - - formRef.value = instance; - loadedRef.value = true; - - watch( - () => props, - () => { - props && instance.setProps(getDynamicProps(props)); - }, - { - immediate: true, - deep: true, - }, - ); - } - - const methods: FormActionType = { - scrollToField: async (name: NamePath, options?: ScrollOptions | undefined) => { - const form = await getForm(); - form.scrollToField(name, options); - }, - setProps: async (formProps: Partial) => { - const form = await getForm(); - form.setProps(formProps); - }, - - updateSchema: async (data: Partial | Partial[]) => { - const form = await getForm(); - form.updateSchema(data); - }, - - resetSchema: async (data: Partial | Partial[]) => { - const form = await getForm(); - form.resetSchema(data); - }, - - clearValidate: async (name?: string | string[]) => { - const form = await getForm(); - form.clearValidate(name); - }, - - resetFields: async () => { - getForm().then(async (form) => { - await form.resetFields(); - }); - }, - - removeSchemaByFiled: async (field: string | string[]) => { - unref(formRef)?.removeSchemaByFiled(field); - }, - - // TODO promisify - getFieldsValue: () => { - return unref(formRef)?.getFieldsValue() as T; - }, - - setFieldsValue: async (values: T) => { - const form = await getForm(); - form.setFieldsValue(values); - }, - - appendSchemaByField: async ( - schema: FormSchema, - prefixField: string | undefined, - first: boolean, - ) => { - const form = await getForm(); - form.appendSchemaByField(schema, prefixField, first); - }, - - submit: async (): Promise => { - const form = await getForm(); - return form.submit(); - }, - - validate: async (nameList?: NamePath[]): Promise => { - const form = await getForm(); - return form.validate(nameList); - }, - - validateFields: async (nameList?: NamePath[]): Promise => { - const form = await getForm(); - return form.validateFields(nameList); - }, - }; - - return [register, methods]; -} diff --git a/src/components/Form/src/hooks/useFormContext.ts b/src/components/Form/src/hooks/useFormContext.ts deleted file mode 100644 index 01dfadd7..00000000 --- a/src/components/Form/src/hooks/useFormContext.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { InjectionKey } from 'vue'; -import { createContext, useContext } from '/@/hooks/core/useContext'; - -export interface FormContextProps { - resetAction: () => Promise; - submitAction: () => Promise; -} - -const key: InjectionKey = Symbol(); - -export function createFormContext(context: FormContextProps) { - return createContext(context, key); -} - -export function useFormContext() { - return useContext(key); -} diff --git a/src/components/Form/src/hooks/useFormEvents.ts b/src/components/Form/src/hooks/useFormEvents.ts deleted file mode 100644 index 4fa96bc4..00000000 --- a/src/components/Form/src/hooks/useFormEvents.ts +++ /dev/null @@ -1,314 +0,0 @@ -import type { ComputedRef, Ref } from 'vue'; -import type { FormProps, FormSchema, FormActionType } from '../types/form'; -import type { NamePath } from 'ant-design-vue/lib/form/interface'; -import { unref, toRaw, nextTick } from 'vue'; -import { isArray, isFunction, isObject, isString, isDef, isNullOrUnDef } from '/@/utils/is'; -import { deepMerge } from '/@/utils'; -import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper'; -import { dateUtil } from '/@/utils/dateUtil'; -import { cloneDeep, uniqBy } from 'lodash-es'; -import { error } from '/@/utils/log'; - -interface UseFormActionContext { - emit: EmitType; - getProps: ComputedRef; - getSchema: ComputedRef; - formModel: Recordable; - defaultValueRef: Ref; - formElRef: Ref; - schemaRef: Ref; - handleFormValues: Fn; -} -export function useFormEvents({ - emit, - getProps, - formModel, - getSchema, - defaultValueRef, - formElRef, - schemaRef, - handleFormValues, -}: UseFormActionContext) { - async function resetFields(): Promise { - const { resetFunc, submitOnReset } = unref(getProps); - resetFunc && isFunction(resetFunc) && (await resetFunc()); - - const formEl = unref(formElRef); - if (!formEl) return; - - Object.keys(formModel).forEach((key) => { - const schema = unref(getSchema).find((item) => item.field === key); - const isInput = schema?.component && defaultValueComponents.includes(schema.component); - const defaultValue = cloneDeep(defaultValueRef.value[key]); - formModel[key] = isInput ? defaultValue || '' : defaultValue; - }); - nextTick(() => clearValidate()); - - emit('reset', toRaw(formModel)); - submitOnReset && handleSubmit(); - } - - /** - * @description: Set form value - */ - async function setFieldsValue(values: Recordable): Promise { - const fields = unref(getSchema) - .map((item) => item.field) - .filter(Boolean); - - // key 支持 a.b.c 的嵌套写法 - const delimiter = '.'; - const nestKeyArray = fields.filter((item) => item.indexOf(delimiter) >= 0); - - const validKeys: string[] = []; - Object.keys(values).forEach((key) => { - const schema = unref(getSchema).find((item) => item.field === key); - let value = values[key]; - - const hasKey = Reflect.has(values, key); - - value = handleInputNumberValue(schema?.component, value); - // 0| '' is allow - if (hasKey && fields.includes(key)) { - // time type - if (itemIsDateType(key)) { - if (Array.isArray(value)) { - const arr: any[] = []; - for (const ele of value) { - arr.push(ele ? dateUtil(ele) : null); - } - formModel[key] = arr; - } else { - const { componentProps } = schema || {}; - let _props = componentProps as any; - if (typeof componentProps === 'function') { - _props = _props({ formModel }); - } - formModel[key] = value ? (_props?.valueFormat ? value : dateUtil(value)) : null; - } - } else { - formModel[key] = value; - } - validKeys.push(key); - } else { - nestKeyArray.forEach((nestKey: string) => { - try { - const value = eval('values' + delimiter + nestKey); - if (isDef(value)) { - formModel[nestKey] = value; - validKeys.push(nestKey); - } - } catch (e) { - // key not exist - if (isDef(defaultValueRef.value[nestKey])) { - formModel[nestKey] = cloneDeep(defaultValueRef.value[nestKey]); - } - } - }); - } - }); - validateFields(validKeys).catch((_) => {}); - } - /** - * @description: Delete based on field name - */ - async function removeSchemaByFiled(fields: string | string[]): Promise { - const schemaList: FormSchema[] = cloneDeep(unref(getSchema)); - if (!fields) { - return; - } - - let fieldList: string[] = isString(fields) ? [fields] : fields; - if (isString(fields)) { - fieldList = [fields]; - } - for (const field of fieldList) { - _removeSchemaByFiled(field, schemaList); - } - schemaRef.value = schemaList; - } - - /** - * @description: Delete based on field name - */ - function _removeSchemaByFiled(field: string, schemaList: FormSchema[]): void { - if (isString(field)) { - const index = schemaList.findIndex((schema) => schema.field === field); - if (index !== -1) { - delete formModel[field]; - schemaList.splice(index, 1); - } - } - } - - /** - * @description: Insert after a certain field, if not insert the last - */ - async function appendSchemaByField(schema: FormSchema, prefixField?: string, first = false) { - const schemaList: FormSchema[] = cloneDeep(unref(getSchema)); - - const index = schemaList.findIndex((schema) => schema.field === prefixField); - - if (!prefixField || index === -1 || first) { - first ? schemaList.unshift(schema) : schemaList.push(schema); - schemaRef.value = schemaList; - _setDefaultValue(schema); - return; - } - if (index !== -1) { - schemaList.splice(index + 1, 0, schema); - } - _setDefaultValue(schema); - - schemaRef.value = schemaList; - } - - async function resetSchema(data: Partial | Partial[]) { - let updateData: Partial[] = []; - if (isObject(data)) { - updateData.push(data as FormSchema); - } - if (isArray(data)) { - updateData = [...data]; - } - - const hasField = updateData.every( - (item) => item.component === 'Divider' || (Reflect.has(item, 'field') && item.field), - ); - - if (!hasField) { - error( - 'All children of the form Schema array that need to be updated must contain the `field` field', - ); - return; - } - schemaRef.value = updateData as FormSchema[]; - } - - async function updateSchema(data: Partial | Partial[]) { - let updateData: Partial[] = []; - if (isObject(data)) { - updateData.push(data as FormSchema); - } - if (isArray(data)) { - updateData = [...data]; - } - - const hasField = updateData.every( - (item) => item.component === 'Divider' || (Reflect.has(item, 'field') && item.field), - ); - - if (!hasField) { - error( - 'All children of the form Schema array that need to be updated must contain the `field` field', - ); - return; - } - const schema: FormSchema[] = []; - updateData.forEach((item) => { - unref(getSchema).forEach((val) => { - if (val.field === item.field) { - const newSchema = deepMerge(val, item); - schema.push(newSchema as FormSchema); - } else { - schema.push(val); - } - }); - }); - _setDefaultValue(schema); - - schemaRef.value = uniqBy(schema, 'field'); - } - - function _setDefaultValue(data: FormSchema | FormSchema[]) { - let schemas: FormSchema[] = []; - if (isObject(data)) { - schemas.push(data as FormSchema); - } - if (isArray(data)) { - schemas = [...data]; - } - - const obj: Recordable = {}; - const currentFieldsValue = getFieldsValue(); - schemas.forEach((item) => { - if ( - item.component != 'Divider' && - Reflect.has(item, 'field') && - item.field && - !isNullOrUnDef(item.defaultValue) && - !(item.field in currentFieldsValue) - ) { - obj[item.field] = item.defaultValue; - } - }); - setFieldsValue(obj); - } - - function getFieldsValue(): Recordable { - const formEl = unref(formElRef); - if (!formEl) return {}; - return handleFormValues(toRaw(unref(formModel))); - } - - /** - * @description: Is it time - */ - function itemIsDateType(key: string) { - return unref(getSchema).some((item) => { - return item.field === key ? dateItemType.includes(item.component) : false; - }); - } - - async function validateFields(nameList?: NamePath[] | undefined) { - return unref(formElRef)?.validateFields(nameList); - } - - async function validate(nameList?: NamePath[] | undefined) { - return await unref(formElRef)?.validate(nameList); - } - - async function clearValidate(name?: string | string[]) { - await unref(formElRef)?.clearValidate(name); - } - - async function scrollToField(name: NamePath, options?: ScrollOptions | undefined) { - await unref(formElRef)?.scrollToField(name, options); - } - - /** - * @description: Form submission - */ - async function handleSubmit(e?: Event): Promise { - e && e.preventDefault(); - const { submitFunc } = unref(getProps); - if (submitFunc && isFunction(submitFunc)) { - await submitFunc(); - return; - } - const formEl = unref(formElRef); - if (!formEl) return; - try { - const values = await validate(); - const res = handleFormValues(values); - emit('submit', res); - } catch (error: any) { - throw new Error(error); - } - } - - return { - handleSubmit, - clearValidate, - validate, - validateFields, - getFieldsValue, - updateSchema, - resetSchema, - appendSchemaByField, - removeSchemaByFiled, - resetFields, - setFieldsValue, - scrollToField, - }; -} diff --git a/src/components/Form/src/hooks/useFormValues.ts b/src/components/Form/src/hooks/useFormValues.ts deleted file mode 100644 index 34dd9ddf..00000000 --- a/src/components/Form/src/hooks/useFormValues.ts +++ /dev/null @@ -1,131 +0,0 @@ -import { isArray, isFunction, isObject, isString, isNullOrUnDef } from '/@/utils/is'; -import { dateUtil } from '/@/utils/dateUtil'; -import { unref } from 'vue'; -import type { Ref, ComputedRef } from 'vue'; -import type { FormProps, FormSchema } from '../types/form'; -import { cloneDeep, set } from 'lodash-es'; - -interface UseFormValuesContext { - defaultValueRef: Ref; - getSchema: ComputedRef; - getProps: ComputedRef; - formModel: Recordable; -} - -/** - * @desription deconstruct array-link key. This method will mutate the target. - */ -function tryDeconstructArray(key: string, value: any, target: Recordable) { - const pattern = /^\[(.+)\]$/; - if (pattern.test(key)) { - const match = key.match(pattern); - if (match && match[1]) { - const keys = match[1].split(','); - value = Array.isArray(value) ? value : [value]; - keys.forEach((k, index) => { - set(target, k.trim(), value[index]); - }); - return true; - } - } -} - -/** - * @desription deconstruct object-link key. This method will mutate the target. - */ -function tryDeconstructObject(key: string, value: any, target: Recordable) { - const pattern = /^\{(.+)\}$/; - if (pattern.test(key)) { - const match = key.match(pattern); - if (match && match[1]) { - const keys = match[1].split(','); - value = isObject(value) ? value : {}; - keys.forEach((k) => { - set(target, k.trim(), value[k.trim()]); - }); - return true; - } - } -} - -export function useFormValues({ - defaultValueRef, - getSchema, - formModel, - getProps, -}: UseFormValuesContext) { - // Processing form values - function handleFormValues(values: Recordable) { - if (!isObject(values)) { - return {}; - } - const res: Recordable = {}; - for (const item of Object.entries(values)) { - let [, value] = item; - const [key] = item; - if (!key || (isArray(value) && value.length === 0) || isFunction(value)) { - continue; - } - const transformDateFunc = unref(getProps).transformDateFunc; - if (isObject(value)) { - value = transformDateFunc?.(value); - } - - if (isArray(value) && value[0]?.format && value[1]?.format) { - value = value.map((item) => transformDateFunc?.(item)); - } - // Remove spaces - if (isString(value)) { - value = value.trim(); - } - if (!tryDeconstructArray(key, value, res) && !tryDeconstructObject(key, value, res)) { - // 没有解构成功的,按原样赋值 - set(res, key, value); - } - } - return handleRangeTimeValue(res); - } - - /** - * @description: Processing time interval parameters - */ - function handleRangeTimeValue(values: Recordable) { - const fieldMapToTime = unref(getProps).fieldMapToTime; - - if (!fieldMapToTime || !Array.isArray(fieldMapToTime)) { - return values; - } - - for (const [field, [startTimeKey, endTimeKey], format = 'YYYY-MM-DD'] of fieldMapToTime) { - if (!field || !startTimeKey || !endTimeKey || !values[field]) { - continue; - } - - const [startTime, endTime]: string[] = values[field]; - - values[startTimeKey] = dateUtil(startTime).format(format); - values[endTimeKey] = dateUtil(endTime).format(format); - Reflect.deleteProperty(values, field); - } - - return values; - } - - function initDefault() { - const schemas = unref(getSchema); - const obj: Recordable = {}; - schemas.forEach((item) => { - const { defaultValue } = item; - if (!isNullOrUnDef(defaultValue)) { - obj[item.field] = defaultValue; - - if (formModel[item.field] === undefined) { - formModel[item.field] = defaultValue; - } - } - }); - defaultValueRef.value = cloneDeep(obj); - } - - return { handleFormValues, initDefault }; -} diff --git a/src/components/Form/src/hooks/useLabelWidth.ts b/src/components/Form/src/hooks/useLabelWidth.ts deleted file mode 100644 index 3befa1c2..00000000 --- a/src/components/Form/src/hooks/useLabelWidth.ts +++ /dev/null @@ -1,42 +0,0 @@ -import type { Ref } from 'vue'; -import { computed, unref } from 'vue'; -import type { FormProps, FormSchema } from '../types/form'; -import { isNumber } from '/@/utils/is'; - -export function useItemLabelWidth(schemaItemRef: Ref, propsRef: Ref) { - return computed(() => { - const schemaItem = unref(schemaItemRef); - const { labelCol = {}, wrapperCol = {} } = schemaItem.itemProps || {}; - const { labelWidth, disabledLabelWidth } = schemaItem; - - const { - labelWidth: globalLabelWidth, - labelCol: globalLabelCol, - wrapperCol: globWrapperCol, - layout, - } = unref(propsRef); - - // If labelWidth is set globally, all items setting - if ((!globalLabelWidth && !labelWidth && !globalLabelCol) || disabledLabelWidth) { - labelCol.style = { - textAlign: 'left', - }; - return { labelCol, wrapperCol }; - } - let width = labelWidth || globalLabelWidth; - const col = { ...globalLabelCol, ...labelCol }; - const wrapCol = { ...globWrapperCol, ...wrapperCol }; - - if (width) { - width = isNumber(width) ? `${width}px` : width; - } - - return { - labelCol: { style: { width }, ...col }, - wrapperCol: { - style: { width: layout === 'vertical' ? '100%' : `calc(100% - ${width})` }, - ...wrapCol, - }, - }; - }); -} diff --git a/src/components/Form/src/props.ts b/src/components/Form/src/props.ts deleted file mode 100644 index bfdaee7e..00000000 --- a/src/components/Form/src/props.ts +++ /dev/null @@ -1,103 +0,0 @@ -import type { FieldMapToTime, FormSchema } from './types/form'; -import type { CSSProperties, PropType } from 'vue'; -import type { ColEx } from './types'; -import type { TableActionType } from '/@/components/Table'; -import type { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; -import type { RowProps } from 'ant-design-vue/lib/grid/Row'; -import { propTypes } from '/@/utils/propTypes'; - -export const basicProps = { - model: { - type: Object as PropType, - default: {}, - }, - // 标签宽度 固定宽度 - labelWidth: { - type: [Number, String] as PropType, - default: 0, - }, - fieldMapToTime: { - type: Array as PropType, - default: () => [], - }, - compact: propTypes.bool, - // 表单配置规则 - schemas: { - type: [Array] as PropType, - default: () => [], - }, - mergeDynamicData: { - type: Object as PropType, - default: null, - }, - baseRowStyle: { - type: Object as PropType, - }, - baseColProps: { - type: Object as PropType>, - }, - autoSetPlaceHolder: propTypes.bool.def(true), - // 在INPUT组件上单击回车时,是否自动提交 - autoSubmitOnEnter: propTypes.bool.def(false), - submitOnReset: propTypes.bool, - submitOnChange: propTypes.bool, - size: propTypes.oneOf(['default', 'small', 'large']).def('default'), - // 禁用表单 - disabled: propTypes.bool, - emptySpan: { - type: [Number, Object] as PropType, - default: 0, - }, - // 是否显示收起展开按钮 - showAdvancedButton: propTypes.bool, - // 转化时间 - transformDateFunc: { - type: Function as PropType, - default: (date: any) => { - return date?.format?.('YYYY-MM-DD HH:mm:ss') ?? date; - }, - }, - rulesMessageJoinLabel: propTypes.bool.def(true), - // 超过3行自动折叠 - autoAdvancedLine: propTypes.number.def(3), - // 不受折叠影响的行数 - alwaysShowLines: propTypes.number.def(1), - - // 是否显示操作按钮 - showActionButtonGroup: propTypes.bool.def(true), - // 操作列Col配置 - actionColOptions: Object as PropType>, - // 显示重置按钮 - showResetButton: propTypes.bool.def(true), - // 是否聚焦第一个输入框,只在第一个表单项为input的时候作用 - autoFocusFirstItem: propTypes.bool, - // 重置按钮配置 - resetButtonOptions: Object as PropType>, - - // 显示确认按钮 - showSubmitButton: propTypes.bool.def(true), - // 确认按钮配置 - submitButtonOptions: Object as PropType>, - - // 自定义重置函数 - resetFunc: Function as PropType<() => Promise>, - submitFunc: Function as PropType<() => Promise>, - - // 以下为默认props - hideRequiredMark: propTypes.bool, - - labelCol: Object as PropType>, - - layout: propTypes.oneOf(['horizontal', 'vertical', 'inline']).def('horizontal'), - tableAction: { - type: Object as PropType, - }, - - wrapperCol: Object as PropType>, - - colon: propTypes.bool, - - labelAlign: propTypes.string, - - rowProps: Object as PropType, -}; diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts deleted file mode 100644 index 2c772286..00000000 --- a/src/components/Form/src/types/form.ts +++ /dev/null @@ -1,223 +0,0 @@ -import type { NamePath, RuleObject } from 'ant-design-vue/lib/form/interface'; -import type { VNode } from 'vue'; -import type { ButtonProps as AntdButtonProps } from '/@/components/Button'; -import type { FormItem } from './formItem'; -import type { ColEx, ComponentType } from './index'; -import type { TableActionType } from '/@/components/Table/src/types/table'; -import type { CSSProperties } from 'vue'; -import type { RowProps } from 'ant-design-vue/lib/grid/Row'; - -export type FieldMapToTime = [string, [string, string], string?][]; - -export type Rule = RuleObject & { - trigger?: 'blur' | 'change' | ['change', 'blur']; -}; - -export interface RenderCallbackParams { - schema: FormSchema; - values: Recordable; - model: Recordable; - field: string; -} - -export interface ButtonProps extends AntdButtonProps { - text?: string; -} - -export interface FormActionType { - submit: () => Promise; - setFieldsValue: (values: T) => Promise; - resetFields: () => Promise; - getFieldsValue: () => Recordable; - clearValidate: (name?: string | string[]) => Promise; - updateSchema: (data: Partial | Partial[]) => Promise; - resetSchema: (data: Partial | Partial[]) => Promise; - setProps: (formProps: Partial) => Promise; - removeSchemaByFiled: (field: string | string[]) => Promise; - appendSchemaByField: ( - schema: FormSchema, - prefixField: string | undefined, - first?: boolean | undefined, - ) => Promise; - validateFields: (nameList?: NamePath[]) => Promise; - validate: (nameList?: NamePath[]) => Promise; - scrollToField: (name: NamePath, options?: ScrollOptions) => Promise; -} - -export type RegisterFn = (formInstance: FormActionType) => void; - -export type UseFormReturnType = [RegisterFn, FormActionType]; - -export interface FormProps { - name?: string; - layout?: 'vertical' | 'inline' | 'horizontal'; - // Form value - model?: Recordable; - // The width of all items in the entire form - labelWidth?: number | string; - // alignment - labelAlign?: 'left' | 'right'; - // Row configuration for the entire form - rowProps?: RowProps; - // Submit form on reset - submitOnReset?: boolean; - // Submit form on form changing - submitOnChange?: boolean; - // Col configuration for the entire form - labelCol?: Partial; - // Col configuration for the entire form - wrapperCol?: Partial; - - // General row style - baseRowStyle?: CSSProperties; - - // General col configuration - baseColProps?: Partial; - - // Form configuration rules - schemas?: FormSchema[]; - // Function values used to merge into dynamic control form items - mergeDynamicData?: Recordable; - // Compact mode for search forms - compact?: boolean; - // Blank line span - emptySpan?: number | Partial; - // Internal component size of the form - size?: 'default' | 'small' | 'large'; - // Whether to disable - disabled?: boolean; - // Time interval fields are mapped into multiple - fieldMapToTime?: FieldMapToTime; - // Placeholder is set automatically - autoSetPlaceHolder?: boolean; - // Auto submit on press enter on input - autoSubmitOnEnter?: boolean; - // Check whether the information is added to the label - rulesMessageJoinLabel?: boolean; - // Whether to show collapse and expand buttons - showAdvancedButton?: boolean; - // Whether to focus on the first input box, only works when the first form item is input - autoFocusFirstItem?: boolean; - // Automatically collapse over the specified number of rows - autoAdvancedLine?: number; - // Always show lines - alwaysShowLines?: number; - // Whether to show the operation button - showActionButtonGroup?: boolean; - - // Reset button configuration - resetButtonOptions?: Partial; - - // Confirm button configuration - submitButtonOptions?: Partial; - - // Operation column configuration - actionColOptions?: Partial; - - // Show reset button - showResetButton?: boolean; - // Show confirmation button - showSubmitButton?: boolean; - - resetFunc?: () => Promise; - submitFunc?: () => Promise; - transformDateFunc?: (date: any) => string; - colon?: boolean; -} -export interface FormSchema { - // Field name - field: string; - // Event name triggered by internal value change, default change - changeEvent?: string; - // Variable name bound to v-model Default value - valueField?: string; - // Label name - label: string | VNode; - // Auxiliary text - subLabel?: string; - // Help text on the right side of the text - helpMessage?: - | string - | string[] - | ((renderCallbackParams: RenderCallbackParams) => string | string[]); - // BaseHelp component props - helpComponentProps?: Partial; - // Label width, if it is passed, the labelCol and WrapperCol configured by itemProps will be invalid - labelWidth?: string | number; - // Disable the adjustment of labelWidth with global settings of formModel, and manually set labelCol and wrapperCol by yourself - disabledLabelWidth?: boolean; - // render component - component: ComponentType; - // Component parameters - componentProps?: - | ((opt: { - schema: FormSchema; - tableAction: TableActionType; - formActionType: FormActionType; - formModel: Recordable; - }) => Recordable) - | object; - // Required - required?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); - - suffix?: string | number | ((values: RenderCallbackParams) => string | number); - - // Validation rules - rules?: Rule[]; - // Check whether the information is added to the label - rulesMessageJoinLabel?: boolean; - - // Reference formModelItem - itemProps?: Partial; - - // col configuration outside formModelItem - colProps?: Partial; - - // 默认值 - defaultValue?: any; - isAdvanced?: boolean; - - // Matching details components - span?: number; - - ifShow?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); - - show?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); - - // Render the content in the form-item tag - render?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string; - - // Rendering col content requires outer wrapper form-item - renderColContent?: (renderCallbackParams: RenderCallbackParams) => VNode | VNode[] | string; - - renderComponentContent?: - | ((renderCallbackParams: RenderCallbackParams) => any) - | VNode - | VNode[] - | string; - - // Custom slot, in from-item - slot?: string; - - // Custom slot, similar to renderColContent - colSlot?: string; - - dynamicDisabled?: boolean | ((renderCallbackParams: RenderCallbackParams) => boolean); - - dynamicRules?: (renderCallbackParams: RenderCallbackParams) => Rule[]; -} -export interface HelpComponentProps { - maxWidth: string; - // Whether to display the serial number - showIndex: boolean; - // Text list - text: any; - // colour - color: string; - // font size - fontSize: string; - icon: string; - absolute: boolean; - // Positioning - position: any; -} diff --git a/src/components/Form/src/types/formItem.ts b/src/components/Form/src/types/formItem.ts deleted file mode 100644 index 77b238ac..00000000 --- a/src/components/Form/src/types/formItem.ts +++ /dev/null @@ -1,91 +0,0 @@ -import type { NamePath } from 'ant-design-vue/lib/form/interface'; -import type { ColProps } from 'ant-design-vue/lib/grid/Col'; -import type { HTMLAttributes, VNodeChild } from 'vue'; - -export interface FormItem { - /** - * Used with label, whether to display : after label text. - * @default true - * @type boolean - */ - colon?: boolean; - - /** - * The extra prompt message. It is similar to help. Usage example: to display error message and prompt message at the same time. - * @type any (string | slot) - */ - extra?: string | VNodeChild | JSX.Element; - - /** - * Used with validateStatus, this option specifies the validation status icon. Recommended to be used only with Input. - * @default false - * @type boolean - */ - hasFeedback?: boolean; - - /** - * The prompt message. If not provided, the prompt message will be generated by the validation rule. - * @type any (string | slot) - */ - help?: string | VNodeChild | JSX.Element; - - /** - * Label test - * @type any (string | slot) - */ - label?: string | VNodeChild | JSX.Element; - - /** - * The layout of label. You can set span offset to something like {span: 3, offset: 12} or sm: {span: 3, offset: 12} same as with - * @type Col - */ - labelCol?: ColProps & HTMLAttributes; - - /** - * Whether provided or not, it will be generated by the validation rule. - * @default false - * @type boolean - */ - required?: boolean; - - /** - * The validation status. If not provided, it will be generated by validation rule. options: 'success' 'warning' 'error' 'validating' - * @type string - */ - validateStatus?: '' | 'success' | 'warning' | 'error' | 'validating'; - - /** - * The layout for input controls, same as labelCol - * @type Col - */ - wrapperCol?: ColProps; - /** - * Set sub label htmlFor. - */ - htmlFor?: string; - /** - * text align of label - */ - labelAlign?: 'left' | 'right'; - /** - * a key of model. In the setting of validate and resetFields method, the attribute is required - */ - name?: NamePath; - /** - * validation rules of form - */ - rules?: object | object[]; - /** - * Whether to automatically associate form fields. In most cases, you can setting automatic association. - * If the conditions for automatic association are not met, you can manually associate them. See the notes below. - */ - autoLink?: boolean; - /** - * Whether stop validate on first rule of error for this field. - */ - validateFirst?: boolean; - /** - * When to validate the value of children node - */ - validateTrigger?: string | string[] | false; -} diff --git a/src/components/Form/src/types/hooks.ts b/src/components/Form/src/types/hooks.ts deleted file mode 100644 index 0308e73b..00000000 --- a/src/components/Form/src/types/hooks.ts +++ /dev/null @@ -1,6 +0,0 @@ -export interface AdvanceState { - isAdvanced: boolean; - hideAdvanceBtn: boolean; - isLoad: boolean; - actionSpan: number; -} diff --git a/src/components/Form/src/types/index.ts b/src/components/Form/src/types/index.ts deleted file mode 100644 index 294b0805..00000000 --- a/src/components/Form/src/types/index.ts +++ /dev/null @@ -1,117 +0,0 @@ -type ColSpanType = number | string; -export interface ColEx { - style?: any; - /** - * raster number of cells to occupy, 0 corresponds to display: none - * @default none (0) - * @type ColSpanType - */ - span?: ColSpanType; - - /** - * raster order, used in flex layout mode - * @default 0 - * @type ColSpanType - */ - order?: ColSpanType; - - /** - * the layout fill of flex - * @default none - * @type ColSpanType - */ - flex?: ColSpanType; - - /** - * the number of cells to offset Col from the left - * @default 0 - * @type ColSpanType - */ - offset?: ColSpanType; - - /** - * the number of cells that raster is moved to the right - * @default 0 - * @type ColSpanType - */ - push?: ColSpanType; - - /** - * the number of cells that raster is moved to the left - * @default 0 - * @type ColSpanType - */ - pull?: ColSpanType; - - /** - * <576px and also default setting, could be a span value or an object containing above props - * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType - */ - xs?: { span: ColSpanType; offset: ColSpanType } | ColSpanType; - - /** - * ≥576px, could be a span value or an object containing above props - * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType - */ - sm?: { span: ColSpanType; offset: ColSpanType } | ColSpanType; - - /** - * ≥768px, could be a span value or an object containing above props - * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType - */ - md?: { span: ColSpanType; offset: ColSpanType } | ColSpanType; - - /** - * ≥992px, could be a span value or an object containing above props - * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType - */ - lg?: { span: ColSpanType; offset: ColSpanType } | ColSpanType; - - /** - * ≥1200px, could be a span value or an object containing above props - * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType - */ - xl?: { span: ColSpanType; offset: ColSpanType } | ColSpanType; - - /** - * ≥1600px, could be a span value or an object containing above props - * @type { span: ColSpanType, offset: ColSpanType } | ColSpanType - */ - xxl?: { span: ColSpanType; offset: ColSpanType } | ColSpanType; -} - -export type ComponentType = - | 'Input' - | 'InputGroup' - | 'InputPassword' - | 'InputSearch' - | 'InputTextArea' - | 'InputNumber' - | 'InputCountDown' - | 'Select' - | 'ApiSelect' - | 'TreeSelect' - | 'ApiTree' - | 'ApiTreeSelect' - | 'ApiRadioGroup' - | 'RadioButtonGroup' - | 'RadioGroup' - | 'Checkbox' - | 'CheckboxGroup' - | 'AutoComplete' - | 'ApiCascader' - | 'Cascader' - | 'DatePicker' - | 'MonthPicker' - | 'RangePicker' - | 'WeekPicker' - | 'TimePicker' - | 'Switch' - | 'StrengthMeter' - | 'Upload' - | 'IconPicker' - | 'Render' - | 'Slider' - | 'Rate' - | 'Divider' - | 'ApiTransfer'; diff --git a/src/components/Icon/data/icons.data.ts b/src/components/Icon/data/icons.data.ts index e5fe3e26..a7ab42a3 100644 --- a/src/components/Icon/data/icons.data.ts +++ b/src/components/Icon/data/icons.data.ts @@ -456,9 +456,6 @@ export default { 'linkedin-outlined', 'loading-3-quarters-outlined', 'loading-outlined', - 'lock-filled', - 'lock-outlined', - 'lock-twotone', 'login-outlined', 'logout-outlined', 'mac-command-filled', @@ -566,7 +563,6 @@ export default { 'qq-circle-filled', 'qq-outlined', 'qq-square-filled', - 'qrcode-outlined', 'question-circle-filled', 'question-circle-outlined', 'question-circle-twotone', @@ -729,9 +725,6 @@ export default { 'underline-outlined', 'undo-outlined', 'ungroup-outlined', - 'unlock-filled', - 'unlock-outlined', - 'unlock-twotone', 'unordered-list-outlined', 'up-circle-filled', 'up-circle-outlined', @@ -790,4 +783,4 @@ export default { 'zoom-in-outlined', 'zoom-out-outlined', ], -}; +} diff --git a/src/components/Icon/index.ts b/src/components/Icon/index.ts index 01e7d236..bda6c81d 100644 --- a/src/components/Icon/index.ts +++ b/src/components/Icon/index.ts @@ -1,7 +1,7 @@ -import Icon from './src/Icon.vue'; -import SvgIcon from './src/SvgIcon.vue'; -import IconPicker from './src/IconPicker.vue'; +import Icon from './src/Icon.vue' +import SvgIcon from './src/SvgIcon.vue' +import IconPicker from './src/IconPicker.vue' -export { Icon, IconPicker, SvgIcon }; +export { Icon, IconPicker, SvgIcon } -export default Icon; +export default Icon diff --git a/src/components/Icon/src/Icon.vue b/src/components/Icon/src/Icon.vue index 4956cf07..5dfb6719 100644 --- a/src/components/Icon/src/Icon.vue +++ b/src/components/Icon/src/Icon.vue @@ -14,7 +14,7 @@ > diff --git a/src/components/Preview/src/Preview.vue b/src/components/Preview/src/Preview.vue deleted file mode 100644 index 9996d0b7..00000000 --- a/src/components/Preview/src/Preview.vue +++ /dev/null @@ -1,94 +0,0 @@ - - - diff --git a/src/components/Preview/src/functional.ts b/src/components/Preview/src/functional.ts deleted file mode 100644 index 74073a20..00000000 --- a/src/components/Preview/src/functional.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type { Options, Props } from './typing'; -import ImgPreview from './Functional.vue'; -import { isClient } from '/@/utils/is'; -import { createVNode, render } from 'vue'; - -let instance: ReturnType | null = null; -export function createImgPreview(options: Options) { - if (!isClient) return; - const propsData: Partial = {}; - const container = document.createElement('div'); - Object.assign(propsData, { show: true, index: 0, scaleStep: 100 }, options); - - instance = createVNode(ImgPreview, propsData); - render(instance, container); - document.body.appendChild(container); - return instance.component?.exposed; -} diff --git a/src/components/Preview/src/typing.ts b/src/components/Preview/src/typing.ts deleted file mode 100644 index bbb8a83e..00000000 --- a/src/components/Preview/src/typing.ts +++ /dev/null @@ -1,49 +0,0 @@ -export interface Options { - show?: boolean; - imageList: string[]; - index?: number; - scaleStep?: number; - defaultWidth?: number; - maskClosable?: boolean; - rememberState?: boolean; - onImgLoad?: ({ index: number, url: string, dom: HTMLImageElement }) => void; - onImgError?: ({ index: number, url: string, dom: HTMLImageElement }) => void; -} - -export interface Props { - show: boolean; - instance: Props; - imageList: string[]; - index: number; - scaleStep: number; - defaultWidth: number; - maskClosable: boolean; - rememberState: boolean; -} - -export interface PreviewActions { - resume: () => void; - close: () => void; - prev: () => void; - next: () => void; - setScale: (scale: number) => void; - setRotate: (rotate: number) => void; -} - -export interface ImageProps { - alt?: string; - fallback?: string; - src: string; - width: string | number; - height?: string | number; - placeholder?: string | boolean; - preview?: - | boolean - | { - visible?: boolean; - onVisibleChange?: (visible: boolean, prevVisible: boolean) => void; - getContainer: string | HTMLElement | (() => HTMLElement); - }; -} - -export type ImageItem = string | ImageProps; diff --git a/src/components/Qrcode/index.ts b/src/components/Qrcode/index.ts deleted file mode 100644 index 16a2f408..00000000 --- a/src/components/Qrcode/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { withInstall } from '/@/utils'; -import qrCode from './src/Qrcode.vue'; - -export const QrCode = withInstall(qrCode); -export * from './src/typing'; diff --git a/src/components/Qrcode/src/Qrcode.vue b/src/components/Qrcode/src/Qrcode.vue deleted file mode 100644 index 81194e14..00000000 --- a/src/components/Qrcode/src/Qrcode.vue +++ /dev/null @@ -1,112 +0,0 @@ - - diff --git a/src/components/Qrcode/src/drawCanvas.ts b/src/components/Qrcode/src/drawCanvas.ts deleted file mode 100644 index 53198e88..00000000 --- a/src/components/Qrcode/src/drawCanvas.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { toCanvas } from 'qrcode'; -import type { QRCodeRenderersOptions } from 'qrcode'; -import { RenderQrCodeParams, ContentType } from './typing'; -import { cloneDeep } from 'lodash-es'; - -export const renderQrCode = ({ - canvas, - content, - width = 0, - options: params = {}, -}: RenderQrCodeParams) => { - const options = cloneDeep(params); - // 容错率,默认对内容少的二维码采用高容错率,内容多的二维码采用低容错率 - options.errorCorrectionLevel = options.errorCorrectionLevel || getErrorCorrectionLevel(content); - - return getOriginWidth(content, options).then((_width: number) => { - options.scale = width === 0 ? undefined : (width / _width) * 4; - return toCanvas(canvas, content, options); - }); -}; - -// 得到原QrCode的大小,以便缩放得到正确的QrCode大小 -function getOriginWidth(content: ContentType, options: QRCodeRenderersOptions) { - const _canvas = document.createElement('canvas'); - return toCanvas(_canvas, content, options).then(() => _canvas.width); -} - -// 对于内容少的QrCode,增大容错率 -function getErrorCorrectionLevel(content: ContentType) { - if (content.length > 36) { - return 'M'; - } else if (content.length > 16) { - return 'Q'; - } else { - return 'H'; - } -} diff --git a/src/components/Qrcode/src/drawLogo.ts b/src/components/Qrcode/src/drawLogo.ts deleted file mode 100644 index 85a160f2..00000000 --- a/src/components/Qrcode/src/drawLogo.ts +++ /dev/null @@ -1,88 +0,0 @@ -import { isString } from '/@/utils/is'; -import { RenderQrCodeParams, LogoType } from './typing'; -export const drawLogo = ({ canvas, logo }: RenderQrCodeParams) => { - if (!logo) { - return new Promise((resolve) => { - resolve((canvas as HTMLCanvasElement).toDataURL()); - }); - } - const canvasWidth = (canvas as HTMLCanvasElement).width; - const { - logoSize = 0.15, - bgColor = '#ffffff', - borderSize = 0.05, - crossOrigin, - borderRadius = 8, - logoRadius = 0, - } = logo as LogoType; - - const logoSrc: string = isString(logo) ? logo : logo.src; - const logoWidth = canvasWidth * logoSize; - const logoXY = (canvasWidth * (1 - logoSize)) / 2; - const logoBgWidth = canvasWidth * (logoSize + borderSize); - const logoBgXY = (canvasWidth * (1 - logoSize - borderSize)) / 2; - - const ctx = canvas.getContext('2d'); - if (!ctx) return; - - // logo 底色 - canvasRoundRect(ctx)(logoBgXY, logoBgXY, logoBgWidth, logoBgWidth, borderRadius); - ctx.fillStyle = bgColor; - ctx.fill(); - - // logo - const image = new Image(); - if (crossOrigin || logoRadius) { - image.setAttribute('crossOrigin', crossOrigin || 'anonymous'); - } - image.src = logoSrc; - - // 使用image绘制可以避免某些跨域情况 - const drawLogoWithImage = (image: CanvasImageSource) => { - ctx.drawImage(image, logoXY, logoXY, logoWidth, logoWidth); - }; - - // 使用canvas绘制以获得更多的功能 - const drawLogoWithCanvas = (image: HTMLImageElement) => { - const canvasImage = document.createElement('canvas'); - canvasImage.width = logoXY + logoWidth; - canvasImage.height = logoXY + logoWidth; - const imageCanvas = canvasImage.getContext('2d'); - if (!imageCanvas || !ctx) return; - imageCanvas.drawImage(image, logoXY, logoXY, logoWidth, logoWidth); - - canvasRoundRect(ctx)(logoXY, logoXY, logoWidth, logoWidth, logoRadius); - if (!ctx) return; - const fillStyle = ctx.createPattern(canvasImage, 'no-repeat'); - if (fillStyle) { - ctx.fillStyle = fillStyle; - ctx.fill(); - } - }; - - // 将 logo绘制到 canvas上 - return new Promise((resolve) => { - image.onload = () => { - logoRadius ? drawLogoWithCanvas(image) : drawLogoWithImage(image); - resolve((canvas as HTMLCanvasElement).toDataURL()); - }; - }); -}; - -// copy来的方法,用于绘制圆角 -function canvasRoundRect(ctx: CanvasRenderingContext2D) { - return (x: number, y: number, w: number, h: number, r: number) => { - const minSize = Math.min(w, h); - if (r > minSize / 2) { - r = minSize / 2; - } - ctx.beginPath(); - ctx.moveTo(x + r, y); - ctx.arcTo(x + w, y, x + w, y + h, r); - ctx.arcTo(x + w, y + h, x, y + h, r); - ctx.arcTo(x, y + h, x, y, r); - ctx.arcTo(x, y, x + w, y, r); - ctx.closePath(); - return ctx; - }; -} diff --git a/src/components/Qrcode/src/qrcodePlus.ts b/src/components/Qrcode/src/qrcodePlus.ts deleted file mode 100644 index 64398617..00000000 --- a/src/components/Qrcode/src/qrcodePlus.ts +++ /dev/null @@ -1,4 +0,0 @@ -// 参考 qr-code-with-logo 进行ts版本修改 -import { toCanvas } from './toCanvas'; -export * from './typing'; -export { toCanvas }; diff --git a/src/components/Qrcode/src/toCanvas.ts b/src/components/Qrcode/src/toCanvas.ts deleted file mode 100644 index f74d5968..00000000 --- a/src/components/Qrcode/src/toCanvas.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { renderQrCode } from './drawCanvas'; -import { drawLogo } from './drawLogo'; -import { RenderQrCodeParams } from './typing'; -export const toCanvas = (options: RenderQrCodeParams) => { - return renderQrCode(options) - .then(() => { - return options; - }) - .then(drawLogo) as Promise; -}; diff --git a/src/components/Qrcode/src/typing.ts b/src/components/Qrcode/src/typing.ts deleted file mode 100644 index 3a037e9d..00000000 --- a/src/components/Qrcode/src/typing.ts +++ /dev/null @@ -1,38 +0,0 @@ -import type { QRCodeSegment, QRCodeRenderersOptions } from 'qrcode'; - -export type ContentType = string | QRCodeSegment[]; - -export type { QRCodeRenderersOptions }; - -export type LogoType = { - src: string; - logoSize: number; - borderColor: string; - bgColor: string; - borderSize: number; - crossOrigin: string; - borderRadius: number; - logoRadius: number; -}; - -export interface RenderQrCodeParams { - canvas: any; - content: ContentType; - width?: number; - options?: QRCodeRenderersOptions; - logo?: LogoType | string; - image?: HTMLImageElement; - downloadName?: string; - download?: boolean | Fn; -} - -export type ToCanvasFn = (options: RenderQrCodeParams) => Promise; - -export interface QrCodeActionType { - download: (fileName?: string) => void; -} - -export interface QrcodeDoneEventParams { - url: string; - ctx?: CanvasRenderingContext2D | null; -} diff --git a/src/components/Scrollbar/index.ts b/src/components/Scrollbar/index.ts index e5b2cb24..1c567ff4 100644 --- a/src/components/Scrollbar/index.ts +++ b/src/components/Scrollbar/index.ts @@ -2,7 +2,7 @@ * copy from element-ui */ -import Scrollbar from './src/Scrollbar.vue'; +import Scrollbar from './src/Scrollbar.vue' -export { Scrollbar }; -export type { ScrollbarType } from './src/types'; +export { Scrollbar } +export type { ScrollbarType } from './src/types' diff --git a/src/components/Scrollbar/src/Scrollbar.vue b/src/components/Scrollbar/src/Scrollbar.vue index ed08026a..91197d1f 100644 --- a/src/components/Scrollbar/src/Scrollbar.vue +++ b/src/components/Scrollbar/src/Scrollbar.vue @@ -17,10 +17,10 @@
diff --git a/src/components/Table/src/componentMap.ts b/src/components/Table/src/componentMap.ts deleted file mode 100644 index 3f724719..00000000 --- a/src/components/Table/src/componentMap.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { Component } from 'vue'; -import { - Input, - Select, - Checkbox, - InputNumber, - Switch, - DatePicker, - TimePicker, - AutoComplete, -} from 'ant-design-vue'; -import type { ComponentType } from './types/componentType'; -import { ApiSelect, ApiTreeSelect } from '/@/components/Form'; - -const componentMap = new Map(); - -componentMap.set('Input', Input); -componentMap.set('InputNumber', InputNumber); -componentMap.set('Select', Select); -componentMap.set('ApiSelect', ApiSelect); -componentMap.set('AutoComplete', AutoComplete); -componentMap.set('ApiTreeSelect', ApiTreeSelect); -componentMap.set('Switch', Switch); -componentMap.set('Checkbox', Checkbox); -componentMap.set('DatePicker', DatePicker); -componentMap.set('TimePicker', TimePicker); - -export function add(compName: ComponentType, component: Component) { - componentMap.set(compName, component); -} - -export function del(compName: ComponentType) { - componentMap.delete(compName); -} - -export { componentMap }; diff --git a/src/components/Table/src/components/EditTableHeaderIcon.vue b/src/components/Table/src/components/EditTableHeaderIcon.vue deleted file mode 100644 index 369820e7..00000000 --- a/src/components/Table/src/components/EditTableHeaderIcon.vue +++ /dev/null @@ -1,16 +0,0 @@ - - diff --git a/src/components/Table/src/components/HeaderCell.vue b/src/components/Table/src/components/HeaderCell.vue deleted file mode 100644 index c21bfd04..00000000 --- a/src/components/Table/src/components/HeaderCell.vue +++ /dev/null @@ -1,48 +0,0 @@ - - - diff --git a/src/components/Table/src/components/TableAction.vue b/src/components/Table/src/components/TableAction.vue deleted file mode 100644 index 4c5c1ed9..00000000 --- a/src/components/Table/src/components/TableAction.vue +++ /dev/null @@ -1,202 +0,0 @@ - - - diff --git a/src/components/Table/src/components/TableFooter.vue b/src/components/Table/src/components/TableFooter.vue deleted file mode 100644 index 68e556b3..00000000 --- a/src/components/Table/src/components/TableFooter.vue +++ /dev/null @@ -1,94 +0,0 @@ - - diff --git a/src/components/Table/src/components/TableHeader.vue b/src/components/Table/src/components/TableHeader.vue deleted file mode 100644 index 189e913d..00000000 --- a/src/components/Table/src/components/TableHeader.vue +++ /dev/null @@ -1,81 +0,0 @@ - - - diff --git a/src/components/Table/src/components/TableImg.vue b/src/components/Table/src/components/TableImg.vue deleted file mode 100644 index 6b533aa0..00000000 --- a/src/components/Table/src/components/TableImg.vue +++ /dev/null @@ -1,85 +0,0 @@ - - - diff --git a/src/components/Table/src/components/TableTitle.vue b/src/components/Table/src/components/TableTitle.vue deleted file mode 100644 index 0b797e13..00000000 --- a/src/components/Table/src/components/TableTitle.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - diff --git a/src/components/Table/src/components/editable/CellComponent.ts b/src/components/Table/src/components/editable/CellComponent.ts deleted file mode 100644 index 3a166938..00000000 --- a/src/components/Table/src/components/editable/CellComponent.ts +++ /dev/null @@ -1,44 +0,0 @@ -import type { FunctionalComponent, defineComponent } from 'vue'; -import type { ComponentType } from '../../types/componentType'; -import { componentMap } from '/@/components/Table/src/componentMap'; - -import { Popover } from 'ant-design-vue'; -import { h } from 'vue'; - -export interface ComponentProps { - component: ComponentType; - rule: boolean; - popoverVisible: boolean; - ruleMessage: string; - getPopupContainer?: Fn; -} - -export const CellComponent: FunctionalComponent = ( - { - component = 'Input', - rule = true, - ruleMessage, - popoverVisible, - getPopupContainer, - }: ComponentProps, - { attrs }, -) => { - const Comp = componentMap.get(component) as typeof defineComponent; - - const DefaultComp = h(Comp, attrs); - if (!rule) { - return DefaultComp; - } - return h( - Popover, - { - overlayClassName: 'edit-cell-rule-popover', - visible: !!popoverVisible, - ...(getPopupContainer ? { getPopupContainer } : {}), - }, - { - default: () => DefaultComp, - content: () => ruleMessage, - }, - ); -}; diff --git a/src/components/Table/src/components/editable/EditableCell.vue b/src/components/Table/src/components/editable/EditableCell.vue deleted file mode 100644 index 90e5f9ac..00000000 --- a/src/components/Table/src/components/editable/EditableCell.vue +++ /dev/null @@ -1,531 +0,0 @@ - - diff --git a/src/components/Table/src/components/editable/helper.ts b/src/components/Table/src/components/editable/helper.ts deleted file mode 100644 index 9c600c9f..00000000 --- a/src/components/Table/src/components/editable/helper.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { ComponentType } from '../../types/componentType'; -import { useI18n } from '/@/hooks/web/useI18n'; - -const { t } = useI18n(); - -/** - * @description: 生成placeholder - */ -export function createPlaceholderMessage(component: ComponentType) { - if (component.includes('Input') || component.includes('AutoComplete')) { - return t('common.inputText'); - } - if (component.includes('Picker')) { - return t('common.chooseText'); - } - - if ( - component.includes('Select') || - component.includes('Checkbox') || - component.includes('Radio') || - component.includes('Switch') || - component.includes('DatePicker') || - component.includes('TimePicker') - ) { - return t('common.chooseText'); - } - return ''; -} diff --git a/src/components/Table/src/components/editable/index.ts b/src/components/Table/src/components/editable/index.ts deleted file mode 100644 index 4f7d4dac..00000000 --- a/src/components/Table/src/components/editable/index.ts +++ /dev/null @@ -1,68 +0,0 @@ -import type { BasicColumn } from '/@/components/Table/src/types/table'; - -import { h, Ref } from 'vue'; - -import EditableCell from './EditableCell.vue'; -import { isArray } from '/@/utils/is'; - -interface Params { - text: string; - record: Recordable; - index: number; -} - -export function renderEditCell(column: BasicColumn) { - return ({ text: value, record, index }: Params) => { - record.onValid = async () => { - if (isArray(record?.validCbs)) { - const validFns = (record?.validCbs || []).map((fn) => fn()); - const res = await Promise.all(validFns); - return res.every((item) => !!item); - } else { - return false; - } - }; - - record.onEdit = async (edit: boolean, submit = false) => { - if (!submit) { - record.editable = edit; - } - - if (!edit && submit) { - if (!(await record.onValid())) return false; - const res = await record.onSubmitEdit?.(); - if (res) { - record.editable = false; - return true; - } - return false; - } - // cancel - if (!edit && !submit) { - record.onCancelEdit?.(); - } - return true; - }; - - return h(EditableCell, { - value, - record, - column, - index, - }); - }; -} - -export type EditRecordRow = Partial< - { - onEdit: (editable: boolean, submit?: boolean) => Promise; - onValid: () => Promise; - editable: boolean; - onCancel: Fn; - onSubmit: Fn; - submitCbs: Fn[]; - cancelCbs: Fn[]; - validCbs: Fn[]; - editValueRefs: Recordable; - } & T ->; diff --git a/src/components/Table/src/components/settings/ColumnSetting.vue b/src/components/Table/src/components/settings/ColumnSetting.vue deleted file mode 100644 index dc72a353..00000000 --- a/src/components/Table/src/components/settings/ColumnSetting.vue +++ /dev/null @@ -1,482 +0,0 @@ - - - diff --git a/src/components/Table/src/components/settings/FullScreenSetting.vue b/src/components/Table/src/components/settings/FullScreenSetting.vue deleted file mode 100644 index af07f84c..00000000 --- a/src/components/Table/src/components/settings/FullScreenSetting.vue +++ /dev/null @@ -1,38 +0,0 @@ - - diff --git a/src/components/Table/src/components/settings/RedoSetting.vue b/src/components/Table/src/components/settings/RedoSetting.vue deleted file mode 100644 index 81829a17..00000000 --- a/src/components/Table/src/components/settings/RedoSetting.vue +++ /dev/null @@ -1,33 +0,0 @@ - - diff --git a/src/components/Table/src/components/settings/SizeSetting.vue b/src/components/Table/src/components/settings/SizeSetting.vue deleted file mode 100644 index 79c4a228..00000000 --- a/src/components/Table/src/components/settings/SizeSetting.vue +++ /dev/null @@ -1,64 +0,0 @@ - - diff --git a/src/components/Table/src/components/settings/index.vue b/src/components/Table/src/components/settings/index.vue deleted file mode 100644 index ab03cb22..00000000 --- a/src/components/Table/src/components/settings/index.vue +++ /dev/null @@ -1,76 +0,0 @@ - - - diff --git a/src/components/Table/src/const.ts b/src/components/Table/src/const.ts deleted file mode 100644 index 2a45fac7..00000000 --- a/src/components/Table/src/const.ts +++ /dev/null @@ -1,38 +0,0 @@ -import componentSetting from '/@/settings/componentSetting'; - -const { table } = componentSetting; - -const { - pageSizeOptions, - defaultPageSize, - fetchSetting, - defaultSize, - defaultSortFn, - defaultFilterFn, -} = table; - -export const ROW_KEY = 'key'; - -// Optional display number per page; -export const PAGE_SIZE_OPTIONS = pageSizeOptions; - -// Number of items displayed per page -export const PAGE_SIZE = defaultPageSize; - -// Common interface field settings -export const FETCH_SETTING = fetchSetting; - -// Default Size -export const DEFAULT_SIZE = defaultSize; - -// Configure general sort function -export const DEFAULT_SORT_FN = defaultSortFn; - -export const DEFAULT_FILTER_FN = defaultFilterFn; - -// Default layout of table cells -export const DEFAULT_ALIGN = 'center'; - -export const INDEX_COLUMN_FLAG = 'INDEX'; - -export const ACTION_COLUMN_FLAG = 'ACTION'; diff --git a/src/components/Table/src/hooks/useColumns.ts b/src/components/Table/src/hooks/useColumns.ts deleted file mode 100644 index e450d9b3..00000000 --- a/src/components/Table/src/hooks/useColumns.ts +++ /dev/null @@ -1,317 +0,0 @@ -import type { BasicColumn, BasicTableProps, CellFormat, GetColumnsParams } from '../types/table'; -import type { PaginationProps } from '../types/pagination'; -import type { ComputedRef } from 'vue'; -import { computed, Ref, ref, reactive, toRaw, unref, watch } from 'vue'; -import { renderEditCell } from '../components/editable'; -import { usePermission } from '/@/hooks/web/usePermission'; -import { useI18n } from '/@/hooks/web/useI18n'; -import { isArray, isBoolean, isFunction, isMap, isString } from '/@/utils/is'; -import { cloneDeep, isEqual } from 'lodash-es'; -import { formatToDate } from '/@/utils/dateUtil'; -import { ACTION_COLUMN_FLAG, DEFAULT_ALIGN, INDEX_COLUMN_FLAG, PAGE_SIZE } from '../const'; - -function handleItem(item: BasicColumn, ellipsis: boolean) { - const { key, dataIndex, children } = item; - item.align = item.align || DEFAULT_ALIGN; - if (ellipsis) { - if (!key) { - item.key = dataIndex; - } - if (!isBoolean(item.ellipsis)) { - Object.assign(item, { - ellipsis, - }); - } - } - if (children && children.length) { - handleChildren(children, !!ellipsis); - } -} - -function handleChildren(children: BasicColumn[] | undefined, ellipsis: boolean) { - if (!children) return; - children.forEach((item) => { - const { children } = item; - handleItem(item, ellipsis); - handleChildren(children, ellipsis); - }); -} - -function handleIndexColumn( - propsRef: ComputedRef, - getPaginationRef: ComputedRef, - columns: BasicColumn[], -) { - const { t } = useI18n(); - - const { showIndexColumn, indexColumnProps, isTreeTable } = unref(propsRef); - - let pushIndexColumns = false; - if (unref(isTreeTable)) { - return; - } - columns.forEach(() => { - const indIndex = columns.findIndex((column) => column.flag === INDEX_COLUMN_FLAG); - if (showIndexColumn) { - pushIndexColumns = indIndex === -1; - } else if (!showIndexColumn && indIndex !== -1) { - columns.splice(indIndex, 1); - } - }); - - if (!pushIndexColumns) return; - - const isFixedLeft = columns.some((item) => item.fixed === 'left'); - - columns.unshift({ - flag: INDEX_COLUMN_FLAG, - width: 50, - title: t('component.table.index'), - align: 'center', - customRender: ({ index }) => { - const getPagination = unref(getPaginationRef); - if (isBoolean(getPagination)) { - return `${index + 1}`; - } - const { current = 1, pageSize = PAGE_SIZE } = getPagination; - return ((current < 1 ? 1 : current) - 1) * pageSize + index + 1; - }, - ...(isFixedLeft - ? { - fixed: 'left', - } - : {}), - ...indexColumnProps, - }); -} - -function handleActionColumn(propsRef: ComputedRef, columns: BasicColumn[]) { - const { actionColumn } = unref(propsRef); - if (!actionColumn) return; - - const hasIndex = columns.findIndex((column) => column.flag === ACTION_COLUMN_FLAG); - if (hasIndex === -1) { - columns.push({ - ...columns[hasIndex], - fixed: 'right', - ...actionColumn, - flag: ACTION_COLUMN_FLAG, - }); - } -} - -export function useColumns( - propsRef: ComputedRef, - getPaginationRef: ComputedRef, -) { - const columnsRef = ref(unref(propsRef).columns) as unknown as Ref; - let cacheColumns = unref(propsRef).columns; - - const getColumnsRef = computed(() => { - const columns = cloneDeep(unref(columnsRef)); - - handleIndexColumn(propsRef, getPaginationRef, columns); - handleActionColumn(propsRef, columns); - if (!columns) { - return []; - } - const { ellipsis } = unref(propsRef); - - columns.forEach((item) => { - const { customRender, slots } = item; - - handleItem( - item, - Reflect.has(item, 'ellipsis') ? !!item.ellipsis : !!ellipsis && !customRender && !slots, - ); - }); - return columns; - }); - - function isIfShow(column: BasicColumn): boolean { - const ifShow = column.ifShow; - - let isIfShow = true; - - if (isBoolean(ifShow)) { - isIfShow = ifShow; - } - if (isFunction(ifShow)) { - isIfShow = ifShow(column); - } - return isIfShow; - } - const { hasPermission } = usePermission(); - - const getViewColumns = computed(() => { - const viewColumns = sortFixedColumn(unref(getColumnsRef)); - - const columns = cloneDeep(viewColumns); - return columns - .filter((column) => { - return hasPermission(column.auth) && isIfShow(column); - }) - .map((column) => { - const { slots, customRender, format, edit, editRow, flag } = column; - - if (!slots || !slots?.title) { - // column.slots = { title: `header-${dataIndex}`, ...(slots || {}) }; - column.customTitle = column.title; - Reflect.deleteProperty(column, 'title'); - } - const isDefaultAction = [INDEX_COLUMN_FLAG, ACTION_COLUMN_FLAG].includes(flag!); - if (!customRender && format && !edit && !isDefaultAction) { - column.customRender = ({ text, record, index }) => { - return formatCell(text, format, record, index); - }; - } - - // edit table - if ((edit || editRow) && !isDefaultAction) { - column.customRender = renderEditCell(column); - } - return reactive(column); - }); - }); - - watch( - () => unref(propsRef).columns, - (columns) => { - columnsRef.value = columns; - cacheColumns = columns?.filter((item) => !item.flag) ?? []; - }, - ); - - function setCacheColumnsByField(dataIndex: string | undefined, value: Partial) { - if (!dataIndex || !value) { - return; - } - cacheColumns.forEach((item) => { - if (item.dataIndex === dataIndex) { - Object.assign(item, value); - return; - } - }); - } - /** - * set columns - * @param columnList key|column - */ - function setColumns(columnList: Partial[] | (string | string[])[]) { - const columns = cloneDeep(columnList); - if (!isArray(columns)) return; - - if (columns.length <= 0) { - columnsRef.value = []; - return; - } - - const firstColumn = columns[0]; - - const cacheKeys = cacheColumns.map((item) => item.dataIndex); - - if (!isString(firstColumn) && !isArray(firstColumn)) { - columnsRef.value = columns as BasicColumn[]; - } else { - const columnKeys = (columns as (string | string[])[]).map((m) => m.toString()); - const newColumns: BasicColumn[] = []; - cacheColumns.forEach((item) => { - newColumns.push({ - ...item, - defaultHidden: !columnKeys.includes(item.dataIndex?.toString() || (item.key as string)), - }); - }); - // Sort according to another array - if (!isEqual(cacheKeys, columns)) { - newColumns.sort((prev, next) => { - return ( - columnKeys.indexOf(prev.dataIndex?.toString() as string) - - columnKeys.indexOf(next.dataIndex?.toString() as string) - ); - }); - } - columnsRef.value = newColumns; - } - } - - function getColumns(opt?: GetColumnsParams) { - const { ignoreIndex, ignoreAction, sort } = opt || {}; - let columns = toRaw(unref(getColumnsRef)); - if (ignoreIndex) { - columns = columns.filter((item) => item.flag !== INDEX_COLUMN_FLAG); - } - if (ignoreAction) { - columns = columns.filter((item) => item.flag !== ACTION_COLUMN_FLAG); - } - - if (sort) { - columns = sortFixedColumn(columns); - } - - return columns; - } - function getCacheColumns() { - return cacheColumns; - } - - return { - getColumnsRef, - getCacheColumns, - getColumns, - setColumns, - getViewColumns, - setCacheColumnsByField, - }; -} - -function sortFixedColumn(columns: BasicColumn[]) { - const fixedLeftColumns: BasicColumn[] = []; - const fixedRightColumns: BasicColumn[] = []; - const defColumns: BasicColumn[] = []; - for (const column of columns) { - if (column.fixed === 'left') { - fixedLeftColumns.push(column); - continue; - } - if (column.fixed === 'right') { - fixedRightColumns.push(column); - continue; - } - defColumns.push(column); - } - return [...fixedLeftColumns, ...defColumns, ...fixedRightColumns].filter( - (item) => !item.defaultHidden, - ); -} - -// format cell -export function formatCell(text: string, format: CellFormat, record: Recordable, index: number) { - if (!format) { - return text; - } - - // custom function - if (isFunction(format)) { - return format(text, record, index); - } - - try { - // date type - const DATE_FORMAT_PREFIX = 'date|'; - if (isString(format) && format.startsWith(DATE_FORMAT_PREFIX) && text) { - const dateFormat = format.replace(DATE_FORMAT_PREFIX, ''); - - if (!dateFormat) { - return text; - } - return formatToDate(text, dateFormat); - } - - // Map - if (isMap(format)) { - return format.get(text); - } - } catch (error) { - return text; - } -} diff --git a/src/components/Table/src/hooks/useCustomRow.ts b/src/components/Table/src/hooks/useCustomRow.ts deleted file mode 100644 index 56187208..00000000 --- a/src/components/Table/src/hooks/useCustomRow.ts +++ /dev/null @@ -1,100 +0,0 @@ -import type { ComputedRef } from 'vue'; -import type { BasicTableProps } from '../types/table'; -import { unref } from 'vue'; -import { ROW_KEY } from '../const'; -import { isString, isFunction } from '/@/utils/is'; - -interface Options { - setSelectedRowKeys: (keys: string[]) => void; - getSelectRowKeys: () => string[]; - clearSelectedRowKeys: () => void; - emit: EmitType; - getAutoCreateKey: ComputedRef; -} - -function getKey( - record: Recordable, - rowKey: string | ((record: Record) => string) | undefined, - autoCreateKey?: boolean, -) { - if (!rowKey || autoCreateKey) { - return record[ROW_KEY]; - } - if (isString(rowKey)) { - return record[rowKey]; - } - if (isFunction(rowKey)) { - return record[rowKey(record)]; - } - return null; -} - -export function useCustomRow( - propsRef: ComputedRef, - { setSelectedRowKeys, getSelectRowKeys, getAutoCreateKey, clearSelectedRowKeys, emit }: Options, -) { - const customRow = (record: Recordable, index: number) => { - return { - onClick: (e: Event) => { - e?.stopPropagation(); - function handleClick() { - const { rowSelection, rowKey, clickToRowSelect } = unref(propsRef); - if (!rowSelection || !clickToRowSelect) return; - const keys = getSelectRowKeys(); - const key = getKey(record, rowKey, unref(getAutoCreateKey)); - if (!key) return; - - const isCheckbox = rowSelection.type === 'checkbox'; - if (isCheckbox) { - // 找到tr - const tr: HTMLElement = (e as MouseEvent) - .composedPath?.() - .find((dom: HTMLElement) => dom.tagName === 'TR') as HTMLElement; - if (!tr) return; - // 找到Checkbox,检查是否为disabled - const checkBox = tr.querySelector('input[type=checkbox]'); - if (!checkBox || checkBox.hasAttribute('disabled')) return; - if (!keys.includes(key)) { - setSelectedRowKeys([...keys, key]); - return; - } - const keyIndex = keys.findIndex((item) => item === key); - keys.splice(keyIndex, 1); - setSelectedRowKeys(keys); - return; - } - - const isRadio = rowSelection.type === 'radio'; - if (isRadio) { - if (!keys.includes(key)) { - if (keys.length) { - clearSelectedRowKeys(); - } - setSelectedRowKeys([key]); - return; - } - clearSelectedRowKeys(); - } - } - handleClick(); - emit('row-click', record, index, e); - }, - onDblclick: (event: Event) => { - emit('row-dbClick', record, index, event); - }, - onContextmenu: (event: Event) => { - emit('row-contextmenu', record, index, event); - }, - onMouseenter: (event: Event) => { - emit('row-mouseenter', record, index, event); - }, - onMouseleave: (event: Event) => { - emit('row-mouseleave', record, index, event); - }, - }; - }; - - return { - customRow, - }; -} diff --git a/src/components/Table/src/hooks/useDataSource.ts b/src/components/Table/src/hooks/useDataSource.ts deleted file mode 100644 index 7d6c00af..00000000 --- a/src/components/Table/src/hooks/useDataSource.ts +++ /dev/null @@ -1,374 +0,0 @@ -import type { BasicTableProps, FetchParams, SorterResult } from '../types/table'; -import type { PaginationProps } from '../types/pagination'; -import { - ref, - unref, - ComputedRef, - computed, - onMounted, - watch, - reactive, - Ref, - watchEffect, -} from 'vue'; -import { useTimeoutFn } from '/@/hooks/core/useTimeout'; -import { buildUUID } from '/@/utils/uuid'; -import { isFunction, isBoolean } from '/@/utils/is'; -import { get, cloneDeep, merge } from 'lodash-es'; -import { FETCH_SETTING, ROW_KEY, PAGE_SIZE } from '../const'; - -interface ActionType { - getPaginationInfo: ComputedRef; - setPagination: (info: Partial) => void; - setLoading: (loading: boolean) => void; - getFieldsValue: () => Recordable; - clearSelectedRowKeys: () => void; - tableData: Ref; -} - -interface SearchState { - sortInfo: Recordable; - filterInfo: Record; -} -export function useDataSource( - propsRef: ComputedRef, - { - getPaginationInfo, - setPagination, - setLoading, - getFieldsValue, - clearSelectedRowKeys, - tableData, - }: ActionType, - emit: EmitType, -) { - const searchState = reactive({ - sortInfo: {}, - filterInfo: {}, - }); - const dataSourceRef = ref([]); - const rawDataSourceRef = ref({}); - - watchEffect(() => { - tableData.value = unref(dataSourceRef); - }); - - watch( - () => unref(propsRef).dataSource, - () => { - const { dataSource, api } = unref(propsRef); - !api && dataSource && (dataSourceRef.value = dataSource); - }, - { - immediate: true, - }, - ); - - function handleTableChange( - pagination: PaginationProps, - filters: Partial>, - sorter: SorterResult, - ) { - const { clearSelectOnPageChange, sortFn, filterFn } = unref(propsRef); - if (clearSelectOnPageChange) { - clearSelectedRowKeys(); - } - setPagination(pagination); - - const params: Recordable = {}; - if (sorter && isFunction(sortFn)) { - const sortInfo = sortFn(sorter); - searchState.sortInfo = sortInfo; - params.sortInfo = sortInfo; - } - - if (filters && isFunction(filterFn)) { - const filterInfo = filterFn(filters); - searchState.filterInfo = filterInfo; - params.filterInfo = filterInfo; - } - fetch(params); - } - - function setTableKey(items: any[]) { - if (!items || !Array.isArray(items)) return; - items.forEach((item) => { - if (!item[ROW_KEY]) { - item[ROW_KEY] = buildUUID(); - } - if (item.children && item.children.length) { - setTableKey(item.children); - } - }); - } - - const getAutoCreateKey = computed(() => { - return unref(propsRef).autoCreateKey && !unref(propsRef).rowKey; - }); - - const getRowKey = computed(() => { - const { rowKey } = unref(propsRef); - return unref(getAutoCreateKey) ? ROW_KEY : rowKey; - }); - - const getDataSourceRef = computed(() => { - const dataSource = unref(dataSourceRef); - if (!dataSource || dataSource.length === 0) { - return unref(dataSourceRef); - } - if (unref(getAutoCreateKey)) { - const firstItem = dataSource[0]; - const lastItem = dataSource[dataSource.length - 1]; - - if (firstItem && lastItem) { - if (!firstItem[ROW_KEY] || !lastItem[ROW_KEY]) { - const data = cloneDeep(unref(dataSourceRef)); - data.forEach((item) => { - if (!item[ROW_KEY]) { - item[ROW_KEY] = buildUUID(); - } - if (item.children && item.children.length) { - setTableKey(item.children); - } - }); - dataSourceRef.value = data; - } - } - } - return unref(dataSourceRef); - }); - - async function updateTableData(index: number, key: string, value: any) { - const record = dataSourceRef.value[index]; - if (record) { - dataSourceRef.value[index][key] = value; - } - return dataSourceRef.value[index]; - } - - function updateTableDataRecord( - rowKey: string | number, - record: Recordable, - ): Recordable | undefined { - const row = findTableDataRecord(rowKey); - - if (row) { - for (const field in row) { - if (Reflect.has(record, field)) row[field] = record[field]; - } - return row; - } - } - - function deleteTableDataRecord(rowKey: string | number | string[] | number[]) { - if (!dataSourceRef.value || dataSourceRef.value.length == 0) return; - const rowKeyName = unref(getRowKey); - if (!rowKeyName) return; - const rowKeys = !Array.isArray(rowKey) ? [rowKey] : rowKey; - for (const key of rowKeys) { - let index: number | undefined = dataSourceRef.value.findIndex((row) => { - let targetKeyName: string; - if (typeof rowKeyName === 'function') { - targetKeyName = rowKeyName(row); - } else { - targetKeyName = rowKeyName as string; - } - return row[targetKeyName] === key; - }); - if (index >= 0) { - dataSourceRef.value.splice(index, 1); - } - index = unref(propsRef).dataSource?.findIndex((row) => { - let targetKeyName: string; - if (typeof rowKeyName === 'function') { - targetKeyName = rowKeyName(row); - } else { - targetKeyName = rowKeyName as string; - } - return row[targetKeyName] === key; - }); - if (typeof index !== 'undefined' && index !== -1) - unref(propsRef).dataSource?.splice(index, 1); - } - setPagination({ - total: unref(propsRef).dataSource?.length, - }); - } - - function insertTableDataRecord(record: Recordable, index: number): Recordable | undefined { - // if (!dataSourceRef.value || dataSourceRef.value.length == 0) return; - index = index ?? dataSourceRef.value?.length; - unref(dataSourceRef).splice(index, 0, record); - return unref(dataSourceRef); - } - - function findTableDataRecord(rowKey: string | number) { - if (!dataSourceRef.value || dataSourceRef.value.length == 0) return; - - const rowKeyName = unref(getRowKey); - if (!rowKeyName) return; - - const { childrenColumnName = 'children' } = unref(propsRef); - - const findRow = (array: any[]) => { - let ret; - array.some(function iter(r) { - if (typeof rowKeyName === 'function') { - if ((rowKeyName(r) as string) === rowKey) { - ret = r; - return true; - } - } else { - if (Reflect.has(r, rowKeyName) && r[rowKeyName] === rowKey) { - ret = r; - return true; - } - } - return r[childrenColumnName] && r[childrenColumnName].some(iter); - }); - return ret; - }; - - // const row = dataSourceRef.value.find(r => { - // if (typeof rowKeyName === 'function') { - // return (rowKeyName(r) as string) === rowKey - // } else { - // return Reflect.has(r, rowKeyName) && r[rowKeyName] === rowKey - // } - // }) - return findRow(dataSourceRef.value); - } - - async function fetch(opt?: FetchParams) { - const { - api, - searchInfo, - defSort, - fetchSetting, - beforeFetch, - afterFetch, - useSearchForm, - pagination, - } = unref(propsRef); - if (!api || !isFunction(api)) return; - try { - setLoading(true); - const { pageField, sizeField, listField, totalField } = Object.assign( - {}, - FETCH_SETTING, - fetchSetting, - ); - let pageParams: Recordable = {}; - - const { current = 1, pageSize = PAGE_SIZE } = unref(getPaginationInfo) as PaginationProps; - - if ((isBoolean(pagination) && !pagination) || isBoolean(getPaginationInfo)) { - pageParams = {}; - } else { - pageParams[pageField] = (opt && opt.page) || current; - pageParams[sizeField] = pageSize; - } - - const { sortInfo = {}, filterInfo } = searchState; - - let params: Recordable = merge( - pageParams, - useSearchForm ? getFieldsValue() : {}, - searchInfo, - opt?.searchInfo ?? {}, - defSort, - sortInfo, - filterInfo, - opt?.sortInfo ?? {}, - opt?.filterInfo ?? {}, - ); - if (beforeFetch && isFunction(beforeFetch)) { - params = (await beforeFetch(params)) || params; - } - - const res = await api(params); - rawDataSourceRef.value = res; - - const isArrayResult = Array.isArray(res); - - let resultItems: Recordable[] = isArrayResult ? res : get(res, listField); - const resultTotal: number = isArrayResult ? res.length : get(res, totalField); - - // 假如数据变少,导致总页数变少并小于当前选中页码,通过getPaginationRef获取到的页码是不正确的,需获取正确的页码再次执行 - if (resultTotal) { - const currentTotalPage = Math.ceil(resultTotal / pageSize); - if (current > currentTotalPage) { - setPagination({ - current: currentTotalPage, - }); - return await fetch(opt); - } - } - - if (afterFetch && isFunction(afterFetch)) { - resultItems = (await afterFetch(resultItems)) || resultItems; - } - dataSourceRef.value = resultItems; - setPagination({ - total: resultTotal || 0, - }); - if (opt && opt.page) { - setPagination({ - current: opt.page || 1, - }); - } - emit('fetch-success', { - items: unref(resultItems), - total: resultTotal, - }); - return resultItems; - } catch (error) { - emit('fetch-error', error); - dataSourceRef.value = []; - setPagination({ - total: 0, - }); - } finally { - setLoading(false); - } - } - - function setTableData(values: T[]) { - dataSourceRef.value = values; - } - - function getDataSource() { - return getDataSourceRef.value as T[]; - } - - function getRawDataSource() { - return rawDataSourceRef.value as T; - } - - async function reload(opt?: FetchParams) { - return await fetch(opt); - } - - onMounted(() => { - useTimeoutFn(() => { - unref(propsRef).immediate && fetch(); - }, 16); - }); - - return { - getDataSourceRef, - getDataSource, - getRawDataSource, - getRowKey, - setTableData, - getAutoCreateKey, - fetch, - reload, - updateTableData, - updateTableDataRecord, - deleteTableDataRecord, - insertTableDataRecord, - findTableDataRecord, - handleTableChange, - }; -} diff --git a/src/components/Table/src/hooks/useLoading.ts b/src/components/Table/src/hooks/useLoading.ts deleted file mode 100644 index fe8a0f16..00000000 --- a/src/components/Table/src/hooks/useLoading.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ref, ComputedRef, unref, computed, watch } from 'vue'; -import type { BasicTableProps } from '../types/table'; - -export function useLoading(props: ComputedRef) { - const loadingRef = ref(unref(props).loading); - - watch( - () => unref(props).loading, - (loading) => { - loadingRef.value = loading; - }, - ); - - const getLoading = computed(() => unref(loadingRef)); - - function setLoading(loading: boolean) { - loadingRef.value = loading; - } - - return { getLoading, setLoading }; -} diff --git a/src/components/Table/src/hooks/usePagination.tsx b/src/components/Table/src/hooks/usePagination.tsx deleted file mode 100644 index ba310bd1..00000000 --- a/src/components/Table/src/hooks/usePagination.tsx +++ /dev/null @@ -1,85 +0,0 @@ -import type { PaginationProps } from '../types/pagination'; -import type { BasicTableProps } from '../types/table'; -import { computed, unref, ref, ComputedRef, watch } from 'vue'; -import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue'; -import { isBoolean } from '/@/utils/is'; -import { PAGE_SIZE, PAGE_SIZE_OPTIONS } from '../const'; -import { useI18n } from '/@/hooks/web/useI18n'; - -interface ItemRender { - page: number; - type: 'page' | 'prev' | 'next'; - originalElement: any; -} - -function itemRender({ page, type, originalElement }: ItemRender) { - if (type === 'prev') { - return page === 0 ? null : ; - } else if (type === 'next') { - return page === 1 ? null : ; - } - return originalElement; -} - -export function usePagination(refProps: ComputedRef) { - const { t } = useI18n(); - - const configRef = ref({}); - const show = ref(true); - - watch( - () => unref(refProps).pagination, - (pagination) => { - if (!isBoolean(pagination) && pagination) { - configRef.value = { - ...unref(configRef), - ...(pagination ?? {}), - }; - } - }, - ); - - const getPaginationInfo = computed((): PaginationProps | boolean => { - const { pagination } = unref(refProps); - - if (!unref(show) || (isBoolean(pagination) && !pagination)) { - return false; - } - - return { - current: 1, - pageSize: PAGE_SIZE, - size: 'small', - defaultPageSize: PAGE_SIZE, - showTotal: (total) => t('component.table.total', { total }), - showSizeChanger: true, - pageSizeOptions: PAGE_SIZE_OPTIONS, - itemRender: itemRender, - showQuickJumper: true, - ...(isBoolean(pagination) ? {} : pagination), - ...unref(configRef), - }; - }); - - function setPagination(info: Partial) { - const paginationInfo = unref(getPaginationInfo); - configRef.value = { - ...(!isBoolean(paginationInfo) ? paginationInfo : {}), - ...info, - }; - } - - function getPagination() { - return unref(getPaginationInfo); - } - - function getShowPagination() { - return unref(show); - } - - async function setShowPagination(flag: boolean) { - show.value = flag; - } - - return { getPagination, getPaginationInfo, setShowPagination, getShowPagination, setPagination }; -} diff --git a/src/components/Table/src/hooks/useRowSelection.ts b/src/components/Table/src/hooks/useRowSelection.ts deleted file mode 100644 index 3439a223..00000000 --- a/src/components/Table/src/hooks/useRowSelection.ts +++ /dev/null @@ -1,122 +0,0 @@ -import { isFunction } from '/@/utils/is'; -import type { BasicTableProps, TableRowSelection } from '../types/table'; -import { computed, ComputedRef, nextTick, Ref, ref, toRaw, unref, watch } from 'vue'; -import { ROW_KEY } from '../const'; -import { omit } from 'lodash-es'; -import { findNodeAll } from '/@/utils/helper/treeHelper'; - -export function useRowSelection( - propsRef: ComputedRef, - tableData: Ref, - emit: EmitType, -) { - const selectedRowKeysRef = ref([]); - const selectedRowRef = ref([]); - - const getRowSelectionRef = computed((): TableRowSelection | null => { - const { rowSelection } = unref(propsRef); - if (!rowSelection) { - return null; - } - - return { - selectedRowKeys: unref(selectedRowKeysRef), - onChange: (selectedRowKeys: string[]) => { - setSelectedRowKeys(selectedRowKeys); - }, - ...omit(rowSelection, ['onChange']), - }; - }); - - watch( - () => unref(propsRef).rowSelection?.selectedRowKeys, - (v: string[]) => { - setSelectedRowKeys(v); - }, - ); - - watch( - () => unref(selectedRowKeysRef), - () => { - nextTick(() => { - const { rowSelection } = unref(propsRef); - if (rowSelection) { - const { onChange } = rowSelection; - if (onChange && isFunction(onChange)) onChange(getSelectRowKeys(), getSelectRows()); - } - emit('selection-change', { - keys: getSelectRowKeys(), - rows: getSelectRows(), - }); - }); - }, - { deep: true }, - ); - - const getAutoCreateKey = computed(() => { - return unref(propsRef).autoCreateKey && !unref(propsRef).rowKey; - }); - - const getRowKey = computed(() => { - const { rowKey } = unref(propsRef); - return unref(getAutoCreateKey) ? ROW_KEY : rowKey; - }); - - function setSelectedRowKeys(rowKeys: string[]) { - selectedRowKeysRef.value = rowKeys; - const allSelectedRows = findNodeAll( - toRaw(unref(tableData)).concat(toRaw(unref(selectedRowRef))), - (item) => rowKeys.includes(item[unref(getRowKey) as string]), - { - children: propsRef.value.childrenColumnName ?? 'children', - }, - ); - const trueSelectedRows: any[] = []; - rowKeys.forEach((key: string) => { - const found = allSelectedRows.find((item) => item[unref(getRowKey) as string] === key); - found && trueSelectedRows.push(found); - }); - selectedRowRef.value = trueSelectedRows; - } - - function setSelectedRows(rows: Recordable[]) { - selectedRowRef.value = rows; - } - - function clearSelectedRowKeys() { - selectedRowRef.value = []; - selectedRowKeysRef.value = []; - } - - function deleteSelectRowByKey(key: string) { - const selectedRowKeys = unref(selectedRowKeysRef); - const index = selectedRowKeys.findIndex((item) => item === key); - if (index !== -1) { - unref(selectedRowKeysRef).splice(index, 1); - } - } - - function getSelectRowKeys() { - return unref(selectedRowKeysRef); - } - - function getSelectRows() { - // const ret = toRaw(unref(selectedRowRef)).map((item) => toRaw(item)); - return unref(selectedRowRef) as T[]; - } - - function getRowSelection() { - return unref(getRowSelectionRef)!; - } - - return { - getRowSelection, - getRowSelectionRef, - getSelectRows, - getSelectRowKeys, - setSelectedRowKeys, - clearSelectedRowKeys, - deleteSelectRowByKey, - setSelectedRows, - }; -} diff --git a/src/components/Table/src/hooks/useScrollTo.ts b/src/components/Table/src/hooks/useScrollTo.ts deleted file mode 100644 index b368f81b..00000000 --- a/src/components/Table/src/hooks/useScrollTo.ts +++ /dev/null @@ -1,55 +0,0 @@ -import type { ComputedRef, Ref } from 'vue'; -import { nextTick, unref } from 'vue'; -import { warn } from '/@/utils/log'; - -export function useTableScrollTo( - tableElRef: Ref, - getDataSourceRef: ComputedRef, -) { - let bodyEl: HTMLElement | null; - - async function findTargetRowToScroll(targetRowData: Recordable) { - const { id } = targetRowData; - const targetRowEl: HTMLElement | null | undefined = bodyEl?.querySelector( - `[data-row-key="${id}"]`, - ); - //Add a delay to get new dataSource - await nextTick(); - bodyEl?.scrollTo({ - top: targetRowEl?.offsetTop ?? 0, - behavior: 'smooth', - }); - } - - function scrollTo(pos: string): void { - const table = unref(tableElRef); - if (!table) return; - - const tableEl: Element = table.$el; - if (!tableEl) return; - - if (!bodyEl) { - bodyEl = tableEl.querySelector('.ant-table-body'); - if (!bodyEl) return; - } - - const dataSource = unref(getDataSourceRef); - if (!dataSource) return; - - // judge pos type - if (pos === 'top') { - findTargetRowToScroll(dataSource[0]); - } else if (pos === 'bottom') { - findTargetRowToScroll(dataSource[dataSource.length - 1]); - } else { - const targetRowData = dataSource.find((data) => data.id === pos); - if (targetRowData) { - findTargetRowToScroll(targetRowData); - } else { - warn(`id: ${pos} doesn't exist`); - } - } - } - - return { scrollTo }; -} diff --git a/src/components/Table/src/hooks/useTable.ts b/src/components/Table/src/hooks/useTable.ts deleted file mode 100644 index 824249e0..00000000 --- a/src/components/Table/src/hooks/useTable.ts +++ /dev/null @@ -1,167 +0,0 @@ -import type { BasicTableProps, TableActionType, FetchParams, BasicColumn } from '../types/table'; -import type { PaginationProps } from '../types/pagination'; -import type { DynamicProps } from '/#/utils'; -import type { FormActionType } from '/@/components/Form'; -import type { WatchStopHandle } from 'vue'; -import { getDynamicProps } from '/@/utils'; -import { ref, onUnmounted, unref, watch, toRaw } from 'vue'; -import { isProdMode } from '/@/utils/env'; -import { error } from '/@/utils/log'; - -type Props = Partial>; - -type UseTableMethod = TableActionType & { - getForm: () => FormActionType; -}; - -export function useTable(tableProps?: Props): [ - (instance: TableActionType, formInstance: UseTableMethod) => void, - TableActionType & { - getForm: () => FormActionType; - }, -] { - const tableRef = ref>(null); - const loadedRef = ref>(false); - const formRef = ref>(null); - - let stopWatch: WatchStopHandle; - - function register(instance: TableActionType, formInstance: UseTableMethod) { - isProdMode() && - onUnmounted(() => { - tableRef.value = null; - loadedRef.value = null; - }); - - if (unref(loadedRef) && isProdMode() && instance === unref(tableRef)) return; - - tableRef.value = instance; - formRef.value = formInstance; - tableProps && instance.setProps(getDynamicProps(tableProps)); - loadedRef.value = true; - - stopWatch?.(); - - stopWatch = watch( - () => tableProps, - () => { - tableProps && instance.setProps(getDynamicProps(tableProps)); - }, - { - immediate: true, - deep: true, - }, - ); - } - - function getTableInstance(): TableActionType { - const table = unref(tableRef); - if (!table) { - error( - 'The table instance has not been obtained yet, please make sure the table is presented when performing the table operation!', - ); - } - return table as TableActionType; - } - - const methods: TableActionType & { - getForm: () => FormActionType; - } = { - reload: async (opt?: FetchParams) => { - return await getTableInstance().reload(opt); - }, - setProps: (props: Partial) => { - getTableInstance().setProps(props); - }, - redoHeight: () => { - getTableInstance().redoHeight(); - }, - setLoading: (loading: boolean) => { - getTableInstance().setLoading(loading); - }, - getDataSource: () => { - return getTableInstance().getDataSource(); - }, - getRawDataSource: () => { - return getTableInstance().getRawDataSource(); - }, - getColumns: ({ ignoreIndex = false }: { ignoreIndex?: boolean } = {}) => { - const columns = getTableInstance().getColumns({ ignoreIndex }) || []; - return toRaw(columns); - }, - setColumns: (columns: BasicColumn[]) => { - getTableInstance().setColumns(columns); - }, - setTableData: (values: any[]) => { - return getTableInstance().setTableData(values); - }, - setPagination: (info: Partial) => { - return getTableInstance().setPagination(info); - }, - deleteSelectRowByKey: (key: string) => { - getTableInstance().deleteSelectRowByKey(key); - }, - getSelectRowKeys: () => { - return toRaw(getTableInstance().getSelectRowKeys()); - }, - getSelectRows: () => { - return toRaw(getTableInstance().getSelectRows()); - }, - clearSelectedRowKeys: () => { - getTableInstance().clearSelectedRowKeys(); - }, - setSelectedRowKeys: (keys: string[] | number[]) => { - getTableInstance().setSelectedRowKeys(keys); - }, - getPaginationRef: () => { - return getTableInstance().getPaginationRef(); - }, - getSize: () => { - return toRaw(getTableInstance().getSize()); - }, - updateTableData: (index: number, key: string, value: any) => { - return getTableInstance().updateTableData(index, key, value); - }, - deleteTableDataRecord: (rowKey: string | number | string[] | number[]) => { - return getTableInstance().deleteTableDataRecord(rowKey); - }, - insertTableDataRecord: (record: Recordable | Recordable[], index?: number) => { - return getTableInstance().insertTableDataRecord(record, index); - }, - updateTableDataRecord: (rowKey: string | number, record: Recordable) => { - return getTableInstance().updateTableDataRecord(rowKey, record); - }, - findTableDataRecord: (rowKey: string | number) => { - return getTableInstance().findTableDataRecord(rowKey); - }, - getRowSelection: () => { - return toRaw(getTableInstance().getRowSelection()); - }, - getCacheColumns: () => { - return toRaw(getTableInstance().getCacheColumns()); - }, - getForm: () => { - return unref(formRef) as unknown as FormActionType; - }, - setShowPagination: async (show: boolean) => { - getTableInstance().setShowPagination(show); - }, - getShowPagination: () => { - return toRaw(getTableInstance().getShowPagination()); - }, - expandAll: () => { - getTableInstance().expandAll(); - }, - expandRows: (keys: string[]) => { - getTableInstance().expandRows(keys); - }, - collapseAll: () => { - getTableInstance().collapseAll(); - }, - scrollTo: (pos: string) => { - getTableInstance().scrollTo(pos); - }, - }; - - return [register, methods]; -} diff --git a/src/components/Table/src/hooks/useTableContext.ts b/src/components/Table/src/hooks/useTableContext.ts deleted file mode 100644 index b657bb27..00000000 --- a/src/components/Table/src/hooks/useTableContext.ts +++ /dev/null @@ -1,22 +0,0 @@ -import type { Ref } from 'vue'; -import type { BasicTableProps, TableActionType } from '../types/table'; -import { provide, inject, ComputedRef } from 'vue'; - -const key = Symbol('basic-table'); - -type Instance = TableActionType & { - wrapRef: Ref>; - getBindValues: ComputedRef; -}; - -type RetInstance = Omit & { - getBindValues: ComputedRef; -}; - -export function createTableContext(instance: Instance) { - provide(key, instance); -} - -export function useTableContext(): RetInstance { - return inject(key) as RetInstance; -} diff --git a/src/components/Table/src/hooks/useTableExpand.ts b/src/components/Table/src/hooks/useTableExpand.ts deleted file mode 100644 index 26283659..00000000 --- a/src/components/Table/src/hooks/useTableExpand.ts +++ /dev/null @@ -1,65 +0,0 @@ -import type { ComputedRef, Ref } from 'vue'; -import type { BasicTableProps } from '../types/table'; -import { computed, unref, ref, toRaw } from 'vue'; -import { ROW_KEY } from '../const'; - -export function useTableExpand( - propsRef: ComputedRef, - tableData: Ref, - emit: EmitType, -) { - const expandedRowKeys = ref([]); - - const getAutoCreateKey = computed(() => { - return unref(propsRef).autoCreateKey && !unref(propsRef).rowKey; - }); - - const getRowKey = computed(() => { - const { rowKey } = unref(propsRef); - return unref(getAutoCreateKey) ? ROW_KEY : rowKey; - }); - - const getExpandOption = computed(() => { - const { isTreeTable } = unref(propsRef); - if (!isTreeTable) return {}; - - return { - expandedRowKeys: unref(expandedRowKeys), - onExpandedRowsChange: (keys: string[]) => { - expandedRowKeys.value = keys; - emit('expanded-rows-change', keys); - }, - }; - }); - - function expandAll() { - const keys = getAllKeys(); - expandedRowKeys.value = keys; - } - - function expandRows(keys: string[]) { - // use row ID expands the specified table row - const { isTreeTable } = unref(propsRef); - if (!isTreeTable) return; - expandedRowKeys.value = [...expandedRowKeys.value, ...keys]; - } - - function getAllKeys(data?: Recordable[]) { - const keys: string[] = []; - const { childrenColumnName } = unref(propsRef); - toRaw(data || unref(tableData)).forEach((item) => { - keys.push(item[unref(getRowKey) as string]); - const children = item[childrenColumnName || 'children']; - if (children?.length) { - keys.push(...getAllKeys(children)); - } - }); - return keys; - } - - function collapseAll() { - expandedRowKeys.value = []; - } - - return { getExpandOption, expandAll, expandRows, collapseAll }; -} diff --git a/src/components/Table/src/hooks/useTableFooter.ts b/src/components/Table/src/hooks/useTableFooter.ts deleted file mode 100644 index 6a3aa580..00000000 --- a/src/components/Table/src/hooks/useTableFooter.ts +++ /dev/null @@ -1,56 +0,0 @@ -import type { ComputedRef, Ref } from 'vue'; -import type { BasicTableProps } from '../types/table'; -import { unref, computed, h, nextTick, watchEffect } from 'vue'; -import TableFooter from '../components/TableFooter.vue'; -import { useEventListener } from '/@/hooks/event/useEventListener'; - -export function useTableFooter( - propsRef: ComputedRef, - scrollRef: ComputedRef<{ - x: string | number | true; - y: string | number | null; - scrollToFirstRowOnChange: boolean; - }>, - tableElRef: Ref, - getDataSourceRef: ComputedRef, -) { - const getIsEmptyData = computed(() => { - return (unref(getDataSourceRef) || []).length === 0; - }); - - const getFooterProps = computed((): Recordable | undefined => { - const { summaryFunc, showSummary, summaryData } = unref(propsRef); - return showSummary && !unref(getIsEmptyData) - ? () => h(TableFooter, { summaryFunc, summaryData, scroll: unref(scrollRef) }) - : undefined; - }); - - watchEffect(() => { - handleSummary(); - }); - - function handleSummary() { - const { showSummary } = unref(propsRef); - if (!showSummary || unref(getIsEmptyData)) return; - - nextTick(() => { - const tableEl = unref(tableElRef); - if (!tableEl) return; - const bodyDom = tableEl.$el.querySelector('.ant-table-content'); - useEventListener({ - el: bodyDom, - name: 'scroll', - listener: () => { - const footerBodyDom = tableEl.$el.querySelector( - '.ant-table-footer .ant-table-content', - ) as HTMLDivElement; - if (!footerBodyDom || !bodyDom) return; - footerBodyDom.scrollLeft = bodyDom.scrollLeft; - }, - wait: 0, - options: true, - }); - }); - } - return { getFooterProps }; -} diff --git a/src/components/Table/src/hooks/useTableForm.ts b/src/components/Table/src/hooks/useTableForm.ts deleted file mode 100644 index bc09c7f6..00000000 --- a/src/components/Table/src/hooks/useTableForm.ts +++ /dev/null @@ -1,50 +0,0 @@ -import type { ComputedRef, Slots } from 'vue'; -import type { BasicTableProps, FetchParams } from '../types/table'; -import { unref, computed } from 'vue'; -import type { FormProps } from '/@/components/Form'; -import { isFunction } from '/@/utils/is'; - -export function useTableForm( - propsRef: ComputedRef, - slots: Slots, - fetch: (opt?: FetchParams | undefined) => Promise, - getLoading: ComputedRef, -) { - const getFormProps = computed((): Partial => { - const { formConfig } = unref(propsRef); - const { submitButtonOptions } = formConfig || {}; - return { - showAdvancedButton: true, - ...formConfig, - submitButtonOptions: { loading: unref(getLoading), ...submitButtonOptions }, - compact: true, - }; - }); - - const getFormSlotKeys: ComputedRef = computed(() => { - const keys = Object.keys(slots); - return keys - .map((item) => (item.startsWith('form-') ? item : null)) - .filter((item) => !!item) as string[]; - }); - - function replaceFormSlotKey(key: string) { - if (!key) return ''; - return key?.replace?.(/form\-/, '') ?? ''; - } - - function handleSearchInfoChange(info: Recordable) { - const { handleSearchInfoFn } = unref(propsRef); - if (handleSearchInfoFn && isFunction(handleSearchInfoFn)) { - info = handleSearchInfoFn(info) || info; - } - fetch({ searchInfo: info, page: 1 }); - } - - return { - getFormProps, - replaceFormSlotKey, - getFormSlotKeys, - handleSearchInfoChange, - }; -} diff --git a/src/components/Table/src/hooks/useTableHeader.ts b/src/components/Table/src/hooks/useTableHeader.ts deleted file mode 100644 index e7282075..00000000 --- a/src/components/Table/src/hooks/useTableHeader.ts +++ /dev/null @@ -1,54 +0,0 @@ -import type { ComputedRef, Slots } from 'vue'; -import type { BasicTableProps, InnerHandlers } from '../types/table'; -import { unref, computed, h } from 'vue'; -import TableHeader from '../components/TableHeader.vue'; -import { isString } from '/@/utils/is'; -import { getSlot } from '/@/utils/helper/tsxHelper'; - -export function useTableHeader( - propsRef: ComputedRef, - slots: Slots, - handlers: InnerHandlers, -) { - const getHeaderProps = computed((): Recordable => { - const { title, showTableSetting, titleHelpMessage, tableSetting } = unref(propsRef); - const hideTitle = !slots.tableTitle && !title && !slots.toolbar && !showTableSetting; - if (hideTitle && !isString(title)) { - return {}; - } - - return { - title: hideTitle - ? null - : () => - h( - TableHeader, - { - title, - titleHelpMessage, - showTableSetting, - tableSetting, - onColumnsChange: handlers.onColumnsChange, - } as Recordable, - { - ...(slots.toolbar - ? { - toolbar: () => getSlot(slots, 'toolbar'), - } - : {}), - ...(slots.tableTitle - ? { - tableTitle: () => getSlot(slots, 'tableTitle'), - } - : {}), - ...(slots.headerTop - ? { - headerTop: () => getSlot(slots, 'headerTop'), - } - : {}), - }, - ), - }; - }); - return { getHeaderProps }; -} diff --git a/src/components/Table/src/hooks/useTableScroll.ts b/src/components/Table/src/hooks/useTableScroll.ts deleted file mode 100644 index 839ae0f5..00000000 --- a/src/components/Table/src/hooks/useTableScroll.ts +++ /dev/null @@ -1,220 +0,0 @@ -import type { BasicTableProps, TableRowSelection, BasicColumn } from '../types/table'; -import { Ref, ComputedRef, ref } from 'vue'; -import { computed, unref, nextTick, watch } from 'vue'; -import { getViewportOffset } from '/@/utils/domUtils'; -import { isBoolean } from '/@/utils/is'; -import { useWindowSizeFn } from '/@/hooks/event/useWindowSizeFn'; -import { useModalContext } from '/@/components/Modal'; -import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated'; -import { useDebounceFn } from '@vueuse/core'; - -export function useTableScroll( - propsRef: ComputedRef, - tableElRef: Ref, - columnsRef: ComputedRef, - rowSelectionRef: ComputedRef, - getDataSourceRef: ComputedRef, - wrapRef: Ref, - formRef: Ref, -) { - const tableHeightRef: Ref> = ref(167); - const modalFn = useModalContext(); - - // Greater than animation time 280 - const debounceRedoHeight = useDebounceFn(redoHeight, 100); - - const getCanResize = computed(() => { - const { canResize, scroll } = unref(propsRef); - return canResize && !(scroll || {}).y; - }); - - watch( - () => [unref(getCanResize), unref(getDataSourceRef)?.length], - () => { - debounceRedoHeight(); - }, - { - flush: 'post', - }, - ); - - function redoHeight() { - nextTick(() => { - calcTableHeight(); - }); - } - - function setHeight(height: number) { - tableHeightRef.value = height; - // Solve the problem of modal adaptive height calculation when the form is placed in the modal - modalFn?.redoModalHeight?.(); - } - - // No need to repeat queries - let paginationEl: HTMLElement | null; - let footerEl: HTMLElement | null; - let bodyEl: HTMLElement | null; - - async function calcTableHeight() { - const { resizeHeightOffset, pagination, maxHeight, isCanResizeParent, useSearchForm } = - unref(propsRef); - const tableData = unref(getDataSourceRef); - - const table = unref(tableElRef); - if (!table) return; - - const tableEl: Element = table.$el; - if (!tableEl) return; - - if (!bodyEl) { - bodyEl = tableEl.querySelector('.ant-table-body'); - if (!bodyEl) return; - } - - const hasScrollBarY = bodyEl.scrollHeight > bodyEl.clientHeight; - const hasScrollBarX = bodyEl.scrollWidth > bodyEl.clientWidth; - - if (hasScrollBarY) { - tableEl.classList.contains('hide-scrollbar-y') && - tableEl.classList.remove('hide-scrollbar-y'); - } else { - !tableEl.classList.contains('hide-scrollbar-y') && tableEl.classList.add('hide-scrollbar-y'); - } - - if (hasScrollBarX) { - tableEl.classList.contains('hide-scrollbar-x') && - tableEl.classList.remove('hide-scrollbar-x'); - } else { - !tableEl.classList.contains('hide-scrollbar-x') && tableEl.classList.add('hide-scrollbar-x'); - } - - bodyEl!.style.height = 'unset'; - - if (!unref(getCanResize) || !unref(tableData) || tableData.length === 0) return; - - await nextTick(); - // Add a delay to get the correct bottomIncludeBody paginationHeight footerHeight headerHeight - - const headEl = tableEl.querySelector('.ant-table-thead '); - - if (!headEl) return; - - // Table height from bottom height-custom offset - let paddingHeight = 32; - // Pager height - let paginationHeight = 2; - if (!isBoolean(pagination)) { - paginationEl = tableEl.querySelector('.ant-pagination') as HTMLElement; - if (paginationEl) { - const offsetHeight = paginationEl.offsetHeight; - paginationHeight += offsetHeight || 0; - } else { - // TODO First fix 24 - paginationHeight += 24; - } - } else { - paginationHeight = -8; - } - - let footerHeight = 0; - if (!isBoolean(pagination)) { - if (!footerEl) { - footerEl = tableEl.querySelector('.ant-table-footer') as HTMLElement; - } else { - const offsetHeight = footerEl.offsetHeight; - footerHeight += offsetHeight || 0; - } - } - - let headerHeight = 0; - if (headEl) { - headerHeight = (headEl as HTMLElement).offsetHeight; - } - - let bottomIncludeBody = 0; - if (unref(wrapRef) && isCanResizeParent) { - const tablePadding = 12; - const formMargin = 16; - let paginationMargin = 10; - const wrapHeight = unref(wrapRef)?.offsetHeight ?? 0; - - let formHeight = unref(formRef)?.$el.offsetHeight ?? 0; - if (formHeight) { - formHeight += formMargin; - } - if (isBoolean(pagination) && !pagination) { - paginationMargin = 0; - } - if (isBoolean(useSearchForm) && !useSearchForm) { - paddingHeight = 0; - } - - const headerCellHeight = - (tableEl.querySelector('.ant-table-title') as HTMLElement)?.offsetHeight ?? 0; - - console.log(wrapHeight - formHeight - headerCellHeight - tablePadding - paginationMargin); - bottomIncludeBody = - wrapHeight - formHeight - headerCellHeight - tablePadding - paginationMargin; - } else { - // Table height from bottom - bottomIncludeBody = getViewportOffset(headEl).bottomIncludeBody; - } - - let height = - bottomIncludeBody - - (resizeHeightOffset || 0) - - paddingHeight - - paginationHeight - - footerHeight - - headerHeight; - height = (height > maxHeight! ? (maxHeight as number) : height) ?? height; - setHeight(height); - - bodyEl!.style.height = `${height}px`; - } - useWindowSizeFn(calcTableHeight, 280); - onMountedOrActivated(() => { - calcTableHeight(); - nextTick(() => { - debounceRedoHeight(); - }); - }); - - const getScrollX = computed(() => { - let width = 0; - if (unref(rowSelectionRef)) { - width += 60; - } - - // TODO props ?? 0; - const NORMAL_WIDTH = 150; - - const columns = unref(columnsRef).filter((item) => !item.defaultHidden); - columns.forEach((item) => { - width += Number.parseFloat(item.width as string) || 0; - }); - const unsetWidthColumns = columns.filter((item) => !Reflect.has(item, 'width')); - - const len = unsetWidthColumns.length; - if (len !== 0) { - width += len * NORMAL_WIDTH; - } - - const table = unref(tableElRef); - const tableWidth = table?.$el?.offsetWidth ?? 0; - return tableWidth > width ? '100%' : width; - }); - - const getScrollRef = computed(() => { - const tableHeight = unref(tableHeightRef); - const { canResize, scroll } = unref(propsRef); - return { - x: unref(getScrollX), - y: canResize ? tableHeight : null, - scrollToFirstRowOnChange: false, - ...scroll, - }; - }); - - return { getScrollRef, redoHeight }; -} diff --git a/src/components/Table/src/hooks/useTableStyle.ts b/src/components/Table/src/hooks/useTableStyle.ts deleted file mode 100644 index 292187d8..00000000 --- a/src/components/Table/src/hooks/useTableStyle.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { ComputedRef } from 'vue'; -import type { BasicTableProps, TableCustomRecord } from '../types/table'; -import { unref } from 'vue'; -import { isFunction } from '/@/utils/is'; - -export function useTableStyle(propsRef: ComputedRef, prefixCls: string) { - function getRowClassName(record: TableCustomRecord, index: number) { - const { striped, rowClassName } = unref(propsRef); - const classNames: string[] = []; - if (striped) { - classNames.push((index || 0) % 2 === 1 ? `${prefixCls}-row__striped` : ''); - } - if (rowClassName && isFunction(rowClassName)) { - classNames.push(rowClassName(record, index)); - } - return classNames.filter((cls) => !!cls).join(' '); - } - - return { getRowClassName }; -} diff --git a/src/components/Table/src/props.ts b/src/components/Table/src/props.ts deleted file mode 100644 index 20e02098..00000000 --- a/src/components/Table/src/props.ts +++ /dev/null @@ -1,151 +0,0 @@ -import type { PropType } from 'vue'; -import type { PaginationProps } from './types/pagination'; -import type { - BasicColumn, - FetchSetting, - TableSetting, - SorterResult, - TableCustomRecord, - TableRowSelection, - SizeType, -} from './types/table'; -import type { FormProps } from '/@/components/Form'; - -import { DEFAULT_FILTER_FN, DEFAULT_SORT_FN, FETCH_SETTING, DEFAULT_SIZE } from './const'; -import { propTypes } from '/@/utils/propTypes'; - -export const basicProps = { - clickToRowSelect: { type: Boolean, default: true }, - isTreeTable: Boolean, - tableSetting: propTypes.shape({}), - inset: Boolean, - sortFn: { - type: Function as PropType<(sortInfo: SorterResult) => any>, - default: DEFAULT_SORT_FN, - }, - filterFn: { - type: Function as PropType<(data: Partial>) => any>, - default: DEFAULT_FILTER_FN, - }, - showTableSetting: Boolean, - autoCreateKey: { type: Boolean, default: true }, - striped: { type: Boolean, default: true }, - showSummary: Boolean, - summaryFunc: { - type: [Function, Array] as PropType<(...arg: any[]) => any[]>, - default: null, - }, - summaryData: { - type: Array as PropType, - default: null, - }, - indentSize: propTypes.number.def(24), - canColDrag: { type: Boolean, default: true }, - api: { - type: Function as PropType<(...arg: any[]) => Promise>, - default: null, - }, - beforeFetch: { - type: Function as PropType, - default: null, - }, - afterFetch: { - type: Function as PropType, - default: null, - }, - handleSearchInfoFn: { - type: Function as PropType, - default: null, - }, - fetchSetting: { - type: Object as PropType, - default: () => { - return FETCH_SETTING; - }, - }, - // 立即请求接口 - immediate: { type: Boolean, default: true }, - emptyDataIsShowTable: { type: Boolean, default: true }, - // 额外的请求参数 - searchInfo: { - type: Object as PropType, - default: null, - }, - // 默认的排序参数 - defSort: { - type: Object as PropType, - default: null, - }, - // 使用搜索表单 - useSearchForm: propTypes.bool, - // 表单配置 - formConfig: { - type: Object as PropType>, - default: null, - }, - columns: { - type: [Array] as PropType, - default: () => [], - }, - showIndexColumn: { type: Boolean, default: true }, - indexColumnProps: { - type: Object as PropType, - default: null, - }, - actionColumn: { - type: Object as PropType, - default: null, - }, - ellipsis: { type: Boolean, default: true }, - isCanResizeParent: { type: Boolean, default: false }, - canResize: { type: Boolean, default: true }, - clearSelectOnPageChange: propTypes.bool, - resizeHeightOffset: propTypes.number.def(0), - rowSelection: { - type: Object as PropType, - default: null, - }, - title: { - type: [String, Function] as PropType string)>, - default: null, - }, - titleHelpMessage: { - type: [String, Array] as PropType, - }, - maxHeight: propTypes.number, - dataSource: { - type: Array as PropType, - default: null, - }, - rowKey: { - type: [String, Function] as PropType string)>, - default: '', - }, - bordered: propTypes.bool, - pagination: { - type: [Object, Boolean] as PropType, - default: null, - }, - loading: propTypes.bool, - rowClassName: { - type: Function as PropType<(record: TableCustomRecord, index: number) => string>, - }, - scroll: { - type: Object as PropType<{ x: number | true; y: number }>, - default: null, - }, - beforeEditSubmit: { - type: Function as PropType< - (data: { - record: Recordable; - index: number; - key: string | number; - value: any; - }) => Promise - >, - }, - size: { - type: String as PropType, - default: DEFAULT_SIZE, - }, -}; diff --git a/src/components/Table/src/types/column.ts b/src/components/Table/src/types/column.ts deleted file mode 100644 index 785e6dfb..00000000 --- a/src/components/Table/src/types/column.ts +++ /dev/null @@ -1,198 +0,0 @@ -import { VNodeChild } from 'vue'; - -export interface ColumnFilterItem { - text?: string; - value?: string; - children?: any; -} - -export declare type SortOrder = 'ascend' | 'descend'; - -export interface RecordProps { - text: any; - record: T; - index: number; -} - -export interface FilterDropdownProps { - prefixCls?: string; - setSelectedKeys?: (selectedKeys: string[]) => void; - selectedKeys?: string[]; - confirm?: () => void; - clearFilters?: () => void; - filters?: ColumnFilterItem[]; - getPopupContainer?: (triggerNode: HTMLElement) => HTMLElement; - visible?: boolean; -} - -export declare type CustomRenderFunction = (record: RecordProps) => VNodeChild | JSX.Element; - -export interface ColumnProps { - /** - * specify how content is aligned - * @default 'left' - * @type string - */ - align?: 'left' | 'right' | 'center'; - - /** - * ellipsize cell content, not working with sorter and filters for now. - * tableLayout would be fixed when ellipsis is true. - * @default false - * @type boolean - */ - ellipsis?: boolean; - - /** - * Span of this column's title - * @type number - */ - colSpan?: number; - - /** - * Display field of the data record, could be set like a.b.c - * @type string - */ - dataIndex?: string; - - /** - * Default filtered values - * @type string[] - */ - defaultFilteredValue?: string[]; - - /** - * Default order of sorted values: 'ascend' 'descend' null - * @type string - */ - defaultSortOrder?: SortOrder; - - /** - * Customized filter overlay - * @type any (slot) - */ - filterDropdown?: - | VNodeChild - | JSX.Element - | ((props: FilterDropdownProps) => VNodeChild | JSX.Element); - - /** - * Whether filterDropdown is visible - * @type boolean - */ - filterDropdownVisible?: boolean; - - /** - * Whether the dataSource is filtered - * @default false - * @type boolean - */ - filtered?: boolean; - - /** - * Controlled filtered value, filter icon will highlight - * @type string[] - */ - filteredValue?: string[]; - - /** - * Customized filter icon - * @default false - * @type any - */ - filterIcon?: boolean | VNodeChild | JSX.Element; - - /** - * Whether multiple filters can be selected - * @default true - * @type boolean - */ - filterMultiple?: boolean; - - /** - * Filter menu config - * @type object[] - */ - filters?: ColumnFilterItem[]; - - /** - * Set column to be fixed: true(same as left) 'left' 'right' - * @default false - * @type boolean | string - */ - fixed?: boolean | 'left' | 'right'; - - /** - * Unique key of this column, you can ignore this prop if you've set a unique dataIndex - * @type string - */ - key?: string; - - /** - * Renderer of the table cell. The return value should be a VNode, or an object for colSpan/rowSpan config - * @type Function | ScopedSlot - */ - customRender?: CustomRenderFunction | VNodeChild | JSX.Element; - - /** - * Sort function for local sort, see Array.sort's compareFunction. If you need sort buttons only, set to true - * @type boolean | Function - */ - sorter?: boolean | Function; - - /** - * Order of sorted values: 'ascend' 'descend' false - * @type boolean | string - */ - sortOrder?: boolean | SortOrder; - - /** - * supported sort way, could be 'ascend', 'descend' - * @default ['ascend', 'descend'] - * @type string[] - */ - sortDirections?: SortOrder[]; - - /** - * Title of this column - * @type any (string | slot) - */ - title?: VNodeChild | JSX.Element; - - /** - * Width of this column - * @type string | number - */ - width?: string | number; - - /** - * Set props on per cell - * @type Function - */ - customCell?: (record: T, rowIndex: number) => object; - - /** - * Set props on per header cell - * @type object - */ - customHeaderCell?: (column: ColumnProps) => object; - - /** - * Callback executed when the confirm filter button is clicked, Use as a filter event when using template or jsx - * @type Function - */ - onFilter?: (value: any, record: T) => boolean; - - /** - * Callback executed when filterDropdownVisible is changed, Use as a filterDropdownVisible event when using template or jsx - * @type Function - */ - onFilterDropdownVisibleChange?: (visible: boolean) => void; - - /** - * When using columns, you can setting this property to configure the properties that support the slot, - * such as slots: { filterIcon: 'XXX'} - * @type object - */ - slots?: Recordable; -} diff --git a/src/components/Table/src/types/componentType.ts b/src/components/Table/src/types/componentType.ts deleted file mode 100644 index a683f1df..00000000 --- a/src/components/Table/src/types/componentType.ts +++ /dev/null @@ -1,11 +0,0 @@ -export type ComponentType = - | 'Input' - | 'InputNumber' - | 'Select' - | 'ApiSelect' - | 'AutoComplete' - | 'ApiTreeSelect' - | 'Checkbox' - | 'Switch' - | 'DatePicker' - | 'TimePicker'; diff --git a/src/components/Table/src/types/pagination.ts b/src/components/Table/src/types/pagination.ts deleted file mode 100644 index c705f33f..00000000 --- a/src/components/Table/src/types/pagination.ts +++ /dev/null @@ -1,115 +0,0 @@ -import Pagination from 'ant-design-vue/lib/pagination'; -import { VNodeChild } from 'vue'; - -interface PaginationRenderProps { - page: number; - type: 'page' | 'prev' | 'next'; - originalElement: any; -} - -type PaginationPositon = - | 'topLeft' - | 'topCenter' - | 'topRight' - | 'bottomLeft' - | 'bottomCenter' - | 'bottomRight'; - -export declare class PaginationConfig extends Pagination { - position?: PaginationPositon[]; -} - -export interface PaginationProps { - /** - * total number of data items - * @default 0 - * @type number - */ - total?: number; - - /** - * default initial page number - * @default 1 - * @type number - */ - defaultCurrent?: number; - - /** - * current page number - * @type number - */ - current?: number; - - /** - * default number of data items per page - * @default 10 - * @type number - */ - defaultPageSize?: number; - - /** - * number of data items per page - * @type number - */ - pageSize?: number; - - /** - * Whether to hide pager on single page - * @default false - * @type boolean - */ - hideOnSinglePage?: boolean; - - /** - * determine whether pageSize can be changed - * @default false - * @type boolean - */ - showSizeChanger?: boolean; - - /** - * specify the sizeChanger options - * @default ['10', '20', '30', '40'] - * @type string[] - */ - pageSizeOptions?: string[]; - - /** - * determine whether you can jump to pages directly - * @default false - * @type boolean - */ - showQuickJumper?: boolean | object; - - /** - * to display the total number and range - * @type Function - */ - showTotal?: (total: number, range: [number, number]) => any; - - /** - * specify the size of Pagination, can be set to small - * @default '' - * @type string - */ - size?: string; - - /** - * whether to setting simple mode - * @type boolean - */ - simple?: boolean; - - /** - * to customize item innerHTML - * @type Function - */ - itemRender?: (props: PaginationRenderProps) => VNodeChild | JSX.Element; - - /** - * specify the position of Pagination - * @default ['bottomRight'] - * @type string[] - */ - position?: PaginationPositon[]; -} diff --git a/src/components/Table/src/types/table.ts b/src/components/Table/src/types/table.ts deleted file mode 100644 index 24b177b2..00000000 --- a/src/components/Table/src/types/table.ts +++ /dev/null @@ -1,478 +0,0 @@ -import type { VNodeChild } from 'vue'; -import type { PaginationProps } from './pagination'; -import type { FormProps } from '/@/components/Form'; -import type { TableRowSelection as ITableRowSelection } from 'ant-design-vue/lib/table/interface'; -import type { ColumnProps } from 'ant-design-vue/lib/table'; - -import { ComponentType } from './componentType'; -import { VueNode } from '/@/utils/propTypes'; -import { RoleEnum } from '/@/enums/roleEnum'; - -export declare type SortOrder = 'ascend' | 'descend'; - -export interface TableCurrentDataSource { - currentDataSource: T[]; -} - -export interface TableRowSelection extends ITableRowSelection { - /** - * Callback executed when selected rows change - * @type Function - */ - onChange?: (selectedRowKeys: string[] | number[], selectedRows: T[]) => any; - - /** - * Callback executed when select/deselect one row - * @type Function - */ - onSelect?: (record: T, selected: boolean, selectedRows: Object[], nativeEvent: Event) => any; - - /** - * Callback executed when select/deselect all rows - * @type Function - */ - onSelectAll?: (selected: boolean, selectedRows: T[], changeRows: T[]) => any; - - /** - * Callback executed when row selection is inverted - * @type Function - */ - onSelectInvert?: (selectedRows: string[] | number[]) => any; -} - -export interface TableCustomRecord { - record?: T; - index?: number; -} - -export interface ExpandedRowRenderRecord extends TableCustomRecord { - indent?: number; - expanded?: boolean; -} -export interface ColumnFilterItem { - text?: string; - value?: string; - children?: any; -} - -export interface TableCustomRecord { - record?: T; - index?: number; -} - -export interface SorterResult { - column: ColumnProps; - order: SortOrder; - field: string; - columnKey: string; -} - -export interface FetchParams { - searchInfo?: Recordable; - page?: number; - sortInfo?: Recordable; - filterInfo?: Recordable; -} - -export interface GetColumnsParams { - ignoreIndex?: boolean; - ignoreAction?: boolean; - sort?: boolean; -} - -export type SizeType = 'default' | 'middle' | 'small' | 'large'; - -export interface TableActionType { - reload: (opt?: FetchParams) => Promise; - getSelectRows: () => T[]; - clearSelectedRowKeys: () => void; - expandAll: () => void; - expandRows: (keys: string[] | number[]) => void; - collapseAll: () => void; - scrollTo: (pos: string) => void; // pos: id | "top" | "bottom" - getSelectRowKeys: () => string[]; - deleteSelectRowByKey: (key: string) => void; - setPagination: (info: Partial) => void; - setTableData: (values: T[]) => void; - updateTableDataRecord: (rowKey: string | number, record: Recordable) => Recordable | void; - deleteTableDataRecord: (rowKey: string | number | string[] | number[]) => void; - insertTableDataRecord: (record: Recordable, index?: number) => Recordable | void; - findTableDataRecord: (rowKey: string | number) => Recordable | void; - getColumns: (opt?: GetColumnsParams) => BasicColumn[]; - setColumns: (columns: BasicColumn[] | string[]) => void; - getDataSource: () => T[]; - getRawDataSource: () => T; - setLoading: (loading: boolean) => void; - setProps: (props: Partial) => void; - redoHeight: () => void; - setSelectedRowKeys: (rowKeys: string[] | number[]) => void; - getPaginationRef: () => PaginationProps | boolean; - getSize: () => SizeType; - getRowSelection: () => TableRowSelection; - getCacheColumns: () => BasicColumn[]; - emit?: EmitType; - updateTableData: (index: number, key: string, value: any) => Recordable; - setShowPagination: (show: boolean) => Promise; - getShowPagination: () => boolean; - setCacheColumnsByField?: (dataIndex: string | undefined, value: BasicColumn) => void; -} - -export interface FetchSetting { - // 请求接口当前页数 - pageField: string; - // 每页显示多少条 - sizeField: string; - // 请求结果列表字段 支持 a.b.c - listField: string; - // 请求结果总数字段 支持 a.b.c - totalField: string; -} - -export interface TableSetting { - redo?: boolean; - size?: boolean; - setting?: boolean; - fullScreen?: boolean; -} - -export interface BasicTableProps { - // 点击行选中 - clickToRowSelect?: boolean; - isTreeTable?: boolean; - // 自定义排序方法 - sortFn?: (sortInfo: SorterResult) => any; - // 排序方法 - filterFn?: (data: Partial>) => any; - // 取消表格的默认padding - inset?: boolean; - // 显示表格设置 - showTableSetting?: boolean; - tableSetting?: TableSetting; - // 斑马纹 - striped?: boolean; - // 是否自动生成key - autoCreateKey?: boolean; - // 计算合计行的方法 - summaryFunc?: (...arg: any) => Recordable[]; - // 自定义合计表格内容 - summaryData?: Recordable[]; - // 是否显示合计行 - showSummary?: boolean; - // 是否可拖拽列 - canColDrag?: boolean; - // 接口请求对象 - api?: (...arg: any) => Promise; - // 请求之前处理参数 - beforeFetch?: Fn; - // 自定义处理接口返回参数 - afterFetch?: Fn; - // 查询条件请求之前处理 - handleSearchInfoFn?: Fn; - // 请求接口配置 - fetchSetting?: Partial; - // 立即请求接口 - immediate?: boolean; - // 在开起搜索表单的时候,如果没有数据是否显示表格 - emptyDataIsShowTable?: boolean; - // 额外的请求参数 - searchInfo?: Recordable; - // 默认的排序参数 - defSort?: Recordable; - // 使用搜索表单 - useSearchForm?: boolean; - // 表单配置 - formConfig?: Partial; - // 列配置 - columns: BasicColumn[]; - // 是否显示序号列 - showIndexColumn?: boolean; - // 序号列配置 - indexColumnProps?: BasicColumn; - actionColumn?: BasicColumn; - // 文本超过宽度是否显示。。。 - ellipsis?: boolean; - // 是否继承父级高度(父级高度-表单高度-padding高度) - isCanResizeParent?: boolean; - // 是否可以自适应高度 - canResize?: boolean; - // 自适应高度偏移, 计算结果-偏移量 - resizeHeightOffset?: number; - - // 在分页改变的时候清空选项 - clearSelectOnPageChange?: boolean; - // - rowKey?: string | ((record: Recordable) => string); - // 数据 - dataSource?: Recordable[]; - // 标题右侧提示 - titleHelpMessage?: string | string[]; - // 表格滚动最大高度 - maxHeight?: number; - // 是否显示边框 - bordered?: boolean; - // 分页配置 - pagination?: PaginationProps | boolean; - // loading加载 - loading?: boolean; - - /** - * The column contains children to display - * @default 'children' - * @type string | string[] - */ - childrenColumnName?: string; - - /** - * Override default table elements - * @type object - */ - components?: object; - - /** - * Expand all rows initially - * @default false - * @type boolean - */ - defaultExpandAllRows?: boolean; - - /** - * Initial expanded row keys - * @type string[] - */ - defaultExpandedRowKeys?: string[]; - - /** - * Current expanded row keys - * @type string[] - */ - expandedRowKeys?: string[]; - - /** - * Expanded container render for each row - * @type Function - */ - expandedRowRender?: (record?: ExpandedRowRenderRecord) => VNodeChild | JSX.Element; - - /** - * Customize row expand Icon. - * @type Function | VNodeChild - */ - expandIcon?: Function | VNodeChild | JSX.Element; - - /** - * Whether to expand row by clicking anywhere in the whole row - * @default false - * @type boolean - */ - expandRowByClick?: boolean; - - /** - * The index of `expandIcon` which column will be inserted when `expandIconAsCell` is false. default 0 - */ - expandIconColumnIndex?: number; - - /** - * Table footer renderer - * @type Function | VNodeChild - */ - footer?: Function | VNodeChild | JSX.Element; - - /** - * Indent size in pixels of tree data - * @default 15 - * @type number - */ - indentSize?: number; - - /** - * i18n text including filter, sort, empty text, etc - * @default { filterConfirm: 'Ok', filterReset: 'Reset', emptyText: 'No Data' } - * @type object - */ - locale?: object; - - /** - * Row's className - * @type Function - */ - rowClassName?: (record: TableCustomRecord, index: number) => string; - - /** - * Row selection config - * @type object - */ - rowSelection?: TableRowSelection; - - /** - * Set horizontal or vertical scrolling, can also be used to specify the width and height of the scroll area. - * It is recommended to set a number for x, if you want to set it to true, - * you need to add style .ant-table td { white-space: nowrap; }. - * @type object - */ - scroll?: { x?: number | true; y?: number }; - - /** - * Whether to show table header - * @default true - * @type boolean - */ - showHeader?: boolean; - - /** - * Size of table - * @default 'default' - * @type string - */ - size?: SizeType; - - /** - * Table title renderer - * @type Function | ScopedSlot - */ - title?: VNodeChild | JSX.Element | string | ((data: Recordable) => string); - - /** - * Set props on per header row - * @type Function - */ - customHeaderRow?: (column: ColumnProps, index: number) => object; - - /** - * Set props on per row - * @type Function - */ - customRow?: (record: T, index: number) => object; - - /** - * `table-layout` attribute of table element - * `fixed` when header/columns are fixed, or using `column.ellipsis` - * - * @see https://developer.mozilla.org/en-US/docs/Web/CSS/table-layout - * @version 1.5.0 - */ - tableLayout?: 'auto' | 'fixed' | string; - - /** - * the render container of dropdowns in table - * @param triggerNode - * @version 1.5.0 - */ - getPopupContainer?: (triggerNode?: HTMLElement) => HTMLElement; - - /** - * Data can be changed again before rendering. - * The default configuration of general user empty data. - * You can configured globally through [ConfigProvider](https://antdv.com/components/config-provider-cn/) - * - * @version 1.5.4 - */ - transformCellText?: Function; - - /** - * Callback executed before editable cell submit value, not for row-editor - * - * The cell will not submit data while callback return false - */ - beforeEditSubmit?: (data: { - record: Recordable; - index: number; - key: string | number; - value: any; - }) => Promise; - - /** - * Callback executed when pagination, filters or sorter is changed - * @param pagination - * @param filters - * @param sorter - * @param currentDataSource - */ - onChange?: (pagination: any, filters: any, sorter: any, extra: any) => void; - - /** - * Callback executed when the row expand icon is clicked - * - * @param expanded - * @param record - */ - onExpand?: (expande: boolean, record: T) => void; - - /** - * Callback executed when the expanded rows change - * @param expandedRows - */ - onExpandedRowsChange?: (expandedRows: string[] | number[]) => void; - - onColumnsChange?: (data: ColumnChangeParam[]) => void; -} - -export type CellFormat = - | string - | ((text: string, record: Recordable, index: number) => string | number) - | Map; - -// @ts-ignore -export interface BasicColumn extends ColumnProps { - children?: BasicColumn[]; - filters?: { - text: string; - value: string; - children?: - | unknown[] - | (((props: Record) => unknown[]) & (() => unknown[]) & (() => unknown[])); - }[]; - - // - flag?: 'INDEX' | 'DEFAULT' | 'CHECKBOX' | 'RADIO' | 'ACTION'; - customTitle?: VueNode; - - slots?: Recordable; - - // Whether to hide the column by default, it can be displayed in the column configuration - defaultHidden?: boolean; - - // Help text for table column header - helpMessage?: string | string[]; - - format?: CellFormat; - - // Editable - edit?: boolean; - editRow?: boolean; - editable?: boolean; - editComponent?: ComponentType; - editComponentProps?: - | ((opt: { - text: string | number | boolean | Recordable; - record: Recordable; - column: BasicColumn; - index: number; - }) => Recordable) - | Recordable; - editRule?: boolean | ((text: string, record: Recordable) => Promise); - editValueMap?: (value: any) => string; - onEditRow?: () => void; - // 权限编码控制是否显示 - auth?: RoleEnum | RoleEnum[] | string | string[]; - // 业务控制是否显示 - ifShow?: boolean | ((column: BasicColumn) => boolean); - // 自定义修改后显示的内容 - editRender?: (opt: { - text: string | number | boolean | Recordable; - record: Recordable; - column: BasicColumn; - index: number; - }) => VNodeChild | JSX.Element; - // 动态 Disabled - editDynamicDisabled?: boolean | ((record: Recordable) => boolean); -} - -export type ColumnChangeParam = { - dataIndex: string; - fixed: boolean | 'left' | 'right' | undefined; - visible: boolean; -}; - -export interface InnerHandlers { - onColumnsChange: (data: ColumnChangeParam[]) => void; -} diff --git a/src/components/Table/src/types/tableAction.ts b/src/components/Table/src/types/tableAction.ts deleted file mode 100644 index 028cf80c..00000000 --- a/src/components/Table/src/types/tableAction.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { ButtonProps } from 'ant-design-vue/es/button/buttonTypes'; -import { TooltipProps } from 'ant-design-vue/es/tooltip/Tooltip'; -import { RoleEnum } from '/@/enums/roleEnum'; -export interface ActionItem extends ButtonProps { - onClick?: Fn; - label?: string; - color?: 'success' | 'error' | 'warning'; - icon?: string; - popConfirm?: PopConfirm; - disabled?: boolean; - divider?: boolean; - // 权限编码控制是否显示 - auth?: RoleEnum | RoleEnum[] | string | string[]; - // 业务控制是否显示 - ifShow?: boolean | ((action: ActionItem) => boolean); - tooltip?: string | TooltipProps; -} - -export interface PopConfirm { - title: string; - okText?: string; - cancelText?: string; - confirm: Fn; - cancel?: Fn; - icon?: string; - placement?: - | 'top' - | 'left' - | 'right' - | 'bottom' - | 'topLeft' - | 'topRight' - | 'leftTop' - | 'leftBottom' - | 'rightTop' - | 'rightBottom' - | 'bottomLeft' - | 'bottomRight'; -} diff --git a/src/components/Time/index.ts b/src/components/Time/index.ts deleted file mode 100644 index 7e2f4c02..00000000 --- a/src/components/Time/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { withInstall } from '/@/utils/index'; -import time from './src/Time.vue'; - -export const Time = withInstall(time); diff --git a/src/components/Time/src/Time.vue b/src/components/Time/src/Time.vue deleted file mode 100644 index 27893688..00000000 --- a/src/components/Time/src/Time.vue +++ /dev/null @@ -1,108 +0,0 @@ - - diff --git a/src/components/Tinymce/index.ts b/src/components/Tinymce/index.ts deleted file mode 100644 index ce07f95e..00000000 --- a/src/components/Tinymce/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { withInstall } from '/@/utils/index'; -import tinymce from './src/Editor.vue'; - -export const Tinymce = withInstall(tinymce); diff --git a/src/components/Tinymce/src/Editor.vue b/src/components/Tinymce/src/Editor.vue deleted file mode 100644 index b84c5fbb..00000000 --- a/src/components/Tinymce/src/Editor.vue +++ /dev/null @@ -1,346 +0,0 @@ - - - - - - - diff --git a/src/components/Tinymce/src/ImgUpload.vue b/src/components/Tinymce/src/ImgUpload.vue deleted file mode 100644 index f878709d..00000000 --- a/src/components/Tinymce/src/ImgUpload.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - diff --git a/src/components/Tinymce/src/helper.ts b/src/components/Tinymce/src/helper.ts deleted file mode 100644 index 2526ae78..00000000 --- a/src/components/Tinymce/src/helper.ts +++ /dev/null @@ -1,81 +0,0 @@ -const validEvents = [ - 'onActivate', - 'onAddUndo', - 'onBeforeAddUndo', - 'onBeforeExecCommand', - 'onBeforeGetContent', - 'onBeforeRenderUI', - 'onBeforeSetContent', - 'onBeforePaste', - 'onBlur', - 'onChange', - 'onClearUndos', - 'onClick', - 'onContextMenu', - 'onCopy', - 'onCut', - 'onDblclick', - 'onDeactivate', - 'onDirty', - 'onDrag', - 'onDragDrop', - 'onDragEnd', - 'onDragGesture', - 'onDragOver', - 'onDrop', - 'onExecCommand', - 'onFocus', - 'onFocusIn', - 'onFocusOut', - 'onGetContent', - 'onHide', - 'onInit', - 'onKeyDown', - 'onKeyPress', - 'onKeyUp', - 'onLoadContent', - 'onMouseDown', - 'onMouseEnter', - 'onMouseLeave', - 'onMouseMove', - 'onMouseOut', - 'onMouseOver', - 'onMouseUp', - 'onNodeChange', - 'onObjectResizeStart', - 'onObjectResized', - 'onObjectSelected', - 'onPaste', - 'onPostProcess', - 'onPostRender', - 'onPreProcess', - 'onProgressState', - 'onRedo', - 'onRemove', - 'onReset', - 'onSaveContent', - 'onSelectionChange', - 'onSetAttrib', - 'onSetContent', - 'onShow', - 'onSubmit', - 'onUndo', - 'onVisualAid', -]; - -const isValidKey = (key: string) => validEvents.indexOf(key) !== -1; - -export const bindHandlers = (initEvent: Event, listeners: any, editor: any): void => { - Object.keys(listeners) - .filter(isValidKey) - .forEach((key: string) => { - const handler = listeners[key]; - if (typeof handler === 'function') { - if (key === 'onInit') { - handler(initEvent, editor); - } else { - editor.on(key.substring(2), (e: any) => handler(e, editor)); - } - } - }); -}; diff --git a/src/components/Tinymce/src/tinymce.ts b/src/components/Tinymce/src/tinymce.ts deleted file mode 100644 index 1374b4da..00000000 --- a/src/components/Tinymce/src/tinymce.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Any plugins you want to setting has to be imported -// Detail plugins list see https://www.tinymce.com/docs/plugins/ -// Custom builds see https://www.tinymce.com/download/custom-builds/ -// colorpicker/contextmenu/textcolor plugin is now built in to the core editor, please remove it from your editor configuration - -export const plugins = [ - 'advlist anchor autolink autosave code codesample directionality fullscreen hr insertdatetime link lists media nonbreaking noneditable pagebreak paste preview print save searchreplace spellchecker tabfocus template textpattern visualblocks visualchars wordcount', -]; - -export const toolbar = [ - 'fontsizeselect lineheight searchreplace bold italic underline strikethrough alignleft aligncenter alignright outdent indent blockquote undo redo removeformat subscript superscript code codesample', - 'hr bullist numlist link preview anchor pagebreak insertdatetime media forecolor backcolor fullscreen', -]; diff --git a/src/components/Transition/index.ts b/src/components/Transition/index.ts index 7eb79b53..411bb02f 100644 --- a/src/components/Transition/index.ts +++ b/src/components/Transition/index.ts @@ -1,27 +1,27 @@ -import { createSimpleTransition, createJavascriptTransition } from './src/CreateTransition'; +import { createSimpleTransition, createJavascriptTransition } from './src/CreateTransition' -import ExpandTransitionGenerator from './src/ExpandTransition'; +import ExpandTransitionGenerator from './src/ExpandTransition' -export { default as CollapseTransition } from './src/CollapseTransition.vue'; +export { default as CollapseTransition } from './src/CollapseTransition.vue' -export const FadeTransition = createSimpleTransition('fade-transition'); -export const ScaleTransition = createSimpleTransition('scale-transition'); -export const SlideYTransition = createSimpleTransition('slide-y-transition'); -export const ScrollYTransition = createSimpleTransition('scroll-y-transition'); -export const SlideYReverseTransition = createSimpleTransition('slide-y-reverse-transition'); -export const ScrollYReverseTransition = createSimpleTransition('scroll-y-reverse-transition'); -export const SlideXTransition = createSimpleTransition('slide-x-transition'); -export const ScrollXTransition = createSimpleTransition('scroll-x-transition'); -export const SlideXReverseTransition = createSimpleTransition('slide-x-reverse-transition'); -export const ScrollXReverseTransition = createSimpleTransition('scroll-x-reverse-transition'); -export const ScaleRotateTransition = createSimpleTransition('scale-rotate-transition'); +export const FadeTransition = createSimpleTransition('fade-transition') +export const ScaleTransition = createSimpleTransition('scale-transition') +export const SlideYTransition = createSimpleTransition('slide-y-transition') +export const ScrollYTransition = createSimpleTransition('scroll-y-transition') +export const SlideYReverseTransition = createSimpleTransition('slide-y-reverse-transition') +export const ScrollYReverseTransition = createSimpleTransition('scroll-y-reverse-transition') +export const SlideXTransition = createSimpleTransition('slide-x-transition') +export const ScrollXTransition = createSimpleTransition('scroll-x-transition') +export const SlideXReverseTransition = createSimpleTransition('slide-x-reverse-transition') +export const ScrollXReverseTransition = createSimpleTransition('scroll-x-reverse-transition') +export const ScaleRotateTransition = createSimpleTransition('scale-rotate-transition') export const ExpandXTransition = createJavascriptTransition( 'expand-x-transition', ExpandTransitionGenerator('', true), -); +) export const ExpandTransition = createJavascriptTransition( 'expand-transition', ExpandTransitionGenerator(''), -); +) diff --git a/src/components/Transition/src/CollapseTransition.vue b/src/components/Transition/src/CollapseTransition.vue index 6b50fa19..a320e854 100644 --- a/src/components/Transition/src/CollapseTransition.vue +++ b/src/components/Transition/src/CollapseTransition.vue @@ -4,8 +4,8 @@ diff --git a/src/components/Transition/src/CreateTransition.tsx b/src/components/Transition/src/CreateTransition.tsx index d12518de..6b49e934 100644 --- a/src/components/Transition/src/CreateTransition.tsx +++ b/src/components/Transition/src/CreateTransition.tsx @@ -1,9 +1,9 @@ -import type { PropType } from 'vue'; +import type { PropType } from 'vue' -import { defineComponent, Transition, TransitionGroup } from 'vue'; -import { getSlot } from '/@/utils/helper/tsxHelper'; +import { defineComponent, Transition, TransitionGroup } from 'vue' +import { getSlot } from '/@/utils/helper/tsxHelper' -type Mode = 'in-out' | 'out-in' | 'default' | undefined; +type Mode = 'in-out' | 'out-in' | 'default' | undefined export function createSimpleTransition(name: string, origin = 'top center 0', mode?: Mode) { return defineComponent({ @@ -24,19 +24,19 @@ export function createSimpleTransition(name: string, origin = 'top center 0', mo }, setup(props, { slots, attrs }) { const onBeforeEnter = (el: HTMLElement) => { - el.style.transformOrigin = props.origin; - }; + el.style.transformOrigin = props.origin + } return () => { - const Tag = !props.group ? Transition : TransitionGroup; + const Tag = !props.group ? Transition : TransitionGroup return ( {() => getSlot(slots)} - ); - }; + ) + } }, - }); + }) } export function createJavascriptTransition( name: string, @@ -66,8 +66,8 @@ export function createJavascriptTransition( > {() => getSlot(slots)} - ); - }; + ) + } }, - }); + }) } diff --git a/src/components/Transition/src/ExpandTransition.ts b/src/components/Transition/src/ExpandTransition.ts index 2aaef9a7..226daa02 100644 --- a/src/components/Transition/src/ExpandTransition.ts +++ b/src/components/Transition/src/ExpandTransition.ts @@ -2,53 +2,53 @@ * Makes the first character of a string uppercase */ export function upperFirst(str: string): string { - return str.charAt(0).toUpperCase() + str.slice(1); + return str.charAt(0).toUpperCase() + str.slice(1) } interface HTMLExpandElement extends HTMLElement { - _parent?: (Node & ParentNode & HTMLElement) | null; + _parent?: (Node & ParentNode & HTMLElement) | null _initialStyle: { - transition: string; - overflow: string | null; - height?: string | null; - width?: string | null; - }; + transition: string + overflow: string | null + height?: string | null + width?: string | null + } } export default function (expandedParentClass = '', x = false) { - const sizeProperty = x ? 'width' : ('height' as 'width' | 'height'); - const offsetProperty = `offset${upperFirst(sizeProperty)}` as 'offsetHeight' | 'offsetWidth'; + const sizeProperty = x ? 'width' : ('height' as 'width' | 'height') + const offsetProperty = `offset${upperFirst(sizeProperty)}` as 'offsetHeight' | 'offsetWidth' return { beforeEnter(el: HTMLExpandElement) { - el._parent = el.parentNode as (Node & ParentNode & HTMLElement) | null; + el._parent = el.parentNode as (Node & ParentNode & HTMLElement) | null el._initialStyle = { transition: el.style.transition, overflow: el.style.overflow, [sizeProperty]: el.style[sizeProperty], - }; + } }, enter(el: HTMLExpandElement) { - const initialStyle = el._initialStyle; + const initialStyle = el._initialStyle - el.style.setProperty('transition', 'none', 'important'); - el.style.overflow = 'hidden'; + el.style.setProperty('transition', 'none', 'important') + el.style.overflow = 'hidden' // const offset = `${el[offsetProperty]}px`; // el.style[sizeProperty] = '0'; - void el.offsetHeight; // force reflow + void el.offsetHeight // force reflow - el.style.transition = initialStyle.transition; + el.style.transition = initialStyle.transition if (expandedParentClass && el._parent) { - el._parent.classList.add(expandedParentClass); + el._parent.classList.add(expandedParentClass) } requestAnimationFrame(() => { // el.style[sizeProperty] = offset; - }); + }) }, afterEnter: resetStyles, @@ -59,31 +59,31 @@ export default function (expandedParentClass = '', x = false) { transition: '', overflow: el.style.overflow, [sizeProperty]: el.style[sizeProperty], - }; + } - el.style.overflow = 'hidden'; - el.style[sizeProperty] = `${el[offsetProperty]}px`; + el.style.overflow = 'hidden' + el.style[sizeProperty] = `${el[offsetProperty]}px` /* eslint-disable-next-line */ - void el.offsetHeight; // force reflow + void el.offsetHeight // force reflow - requestAnimationFrame(() => (el.style[sizeProperty] = '0')); + requestAnimationFrame(() => (el.style[sizeProperty] = '0')) }, afterLeave, leaveCancelled: afterLeave, - }; + } function afterLeave(el: HTMLExpandElement) { if (expandedParentClass && el._parent) { - el._parent.classList.remove(expandedParentClass); + el._parent.classList.remove(expandedParentClass) } - resetStyles(el); + resetStyles(el) } function resetStyles(el: HTMLExpandElement) { - const size = el._initialStyle[sizeProperty]; - el.style.overflow = el._initialStyle.overflow!; - if (size != null) el.style[sizeProperty] = size; - Reflect.deleteProperty(el, '_initialStyle'); + const size = el._initialStyle[sizeProperty] + el.style.overflow = el._initialStyle.overflow! + if (size != null) el.style[sizeProperty] = size + Reflect.deleteProperty(el, '_initialStyle') } } diff --git a/src/components/Tree/index.ts b/src/components/Tree/index.ts deleted file mode 100644 index 169035aa..00000000 --- a/src/components/Tree/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -import BasicTree from './src/BasicTree.vue'; -import './style'; - -export { BasicTree }; -export type { ContextMenuItem } from '/@/hooks/web/useContextMenu'; -export * from './src/types/tree'; diff --git a/src/components/Tree/src/BasicTree.vue b/src/components/Tree/src/BasicTree.vue deleted file mode 100644 index d4ff6b66..00000000 --- a/src/components/Tree/src/BasicTree.vue +++ /dev/null @@ -1,455 +0,0 @@ - diff --git a/src/components/Tree/src/TreeIcon.ts b/src/components/Tree/src/TreeIcon.ts deleted file mode 100644 index 900d6bfc..00000000 --- a/src/components/Tree/src/TreeIcon.ts +++ /dev/null @@ -1,13 +0,0 @@ -import type { VNode, FunctionalComponent } from 'vue'; - -import { h } from 'vue'; -import { isString } from '@vue/shared'; -import { Icon } from '/@/components/Icon'; - -export const TreeIcon: FunctionalComponent = ({ icon }: { icon: VNode | string }) => { - if (!icon) return null; - if (isString(icon)) { - return h(Icon, { icon, class: 'mr-1' }); - } - return Icon; -}; diff --git a/src/components/Tree/src/components/TreeHeader.vue b/src/components/Tree/src/components/TreeHeader.vue deleted file mode 100644 index 74aac097..00000000 --- a/src/components/Tree/src/components/TreeHeader.vue +++ /dev/null @@ -1,170 +0,0 @@ - - diff --git a/src/components/Tree/src/hooks/useTree.ts b/src/components/Tree/src/hooks/useTree.ts deleted file mode 100644 index 17345a26..00000000 --- a/src/components/Tree/src/hooks/useTree.ts +++ /dev/null @@ -1,207 +0,0 @@ -import type { InsertNodeParams, KeyType, FieldNames, TreeItem } from '../types/tree'; -import type { Ref, ComputedRef } from 'vue'; -import type { TreeDataItem } from 'ant-design-vue/es/tree/Tree'; - -import { cloneDeep } from 'lodash-es'; -import { unref } from 'vue'; -import { forEach } from '/@/utils/helper/treeHelper'; - -export function useTree(treeDataRef: Ref, getFieldNames: ComputedRef) { - function getAllKeys(list?: TreeDataItem[]) { - const keys: string[] = []; - const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getFieldNames); - if (!childrenField || !keyField) return keys; - - for (let index = 0; index < treeData.length; index++) { - const node = treeData[index]; - keys.push(node[keyField]!); - const children = node[childrenField]; - if (children && children.length) { - keys.push(...(getAllKeys(children) as string[])); - } - } - return keys as KeyType[]; - } - - // get keys that can be checked and selected - function getEnabledKeys(list?: TreeDataItem[]) { - const keys: string[] = []; - const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getFieldNames); - if (!childrenField || !keyField) return keys; - - for (let index = 0; index < treeData.length; index++) { - const node = treeData[index]; - node.disabled !== true && node.selectable !== false && keys.push(node[keyField]!); - const children = node[childrenField]; - if (children && children.length) { - keys.push(...(getEnabledKeys(children) as string[])); - } - } - return keys as KeyType[]; - } - - function getChildrenKeys(nodeKey: string | number, list?: TreeDataItem[]) { - const keys: KeyType[] = []; - const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getFieldNames); - if (!childrenField || !keyField) return keys; - for (let index = 0; index < treeData.length; index++) { - const node = treeData[index]; - const children = node[childrenField]; - if (nodeKey === node[keyField]) { - keys.push(node[keyField]!); - if (children && children.length) { - keys.push(...(getAllKeys(children) as string[])); - } - } else { - if (children && children.length) { - keys.push(...getChildrenKeys(nodeKey, children)); - } - } - } - return keys as KeyType[]; - } - - // Update node - function updateNodeByKey(key: string, node: TreeDataItem, list?: TreeDataItem[]) { - if (!key) return; - const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getFieldNames); - - if (!childrenField || !keyField) return; - - for (let index = 0; index < treeData.length; index++) { - const element: any = treeData[index]; - const children = element[childrenField]; - - if (element[keyField] === key) { - treeData[index] = { ...treeData[index], ...node }; - break; - } else if (children && children.length) { - updateNodeByKey(key, node, element[childrenField]); - } - } - } - - // Expand the specified level - function filterByLevel(level = 1, list?: TreeDataItem[], currentLevel = 1) { - if (!level) { - return []; - } - const res: (string | number)[] = []; - const data = list || unref(treeDataRef) || []; - for (let index = 0; index < data.length; index++) { - const item = data[index]; - - const { key: keyField, children: childrenField } = unref(getFieldNames); - const key = keyField ? item[keyField] : ''; - const children = childrenField ? item[childrenField] : []; - res.push(key); - if (children && children.length && currentLevel < level) { - currentLevel += 1; - res.push(...filterByLevel(level, children, currentLevel)); - } - } - return res as string[] | number[]; - } - - /** - * 添加节点 - */ - function insertNodeByKey({ parentKey = null, node, push = 'push' }: InsertNodeParams) { - const treeData: any = cloneDeep(unref(treeDataRef)); - if (!parentKey) { - treeData[push](node); - treeDataRef.value = treeData; - return; - } - const { key: keyField, children: childrenField } = unref(getFieldNames); - if (!childrenField || !keyField) return; - - forEach(treeData, (treeItem) => { - if (treeItem[keyField] === parentKey) { - treeItem[childrenField] = treeItem[childrenField] || []; - treeItem[childrenField][push](node); - return true; - } - }); - treeDataRef.value = treeData; - } - /** - * 批量添加节点 - */ - function insertNodesByKey({ parentKey = null, list, push = 'push' }: InsertNodeParams) { - const treeData: any = cloneDeep(unref(treeDataRef)); - if (!list || list.length < 1) { - return; - } - if (!parentKey) { - for (let i = 0; i < list.length; i++) { - treeData[push](list[i]); - } - } else { - const { key: keyField, children: childrenField } = unref(getFieldNames); - if (!childrenField || !keyField) return; - - forEach(treeData, (treeItem) => { - if (treeItem[keyField] === parentKey) { - treeItem[childrenField] = treeItem[childrenField] || []; - for (let i = 0; i < list.length; i++) { - treeItem[childrenField][push](list[i]); - } - treeDataRef.value = treeData; - return true; - } - }); - } - } - // Delete node - function deleteNodeByKey(key: string, list?: TreeDataItem[]) { - if (!key) return; - const treeData = list || unref(treeDataRef); - const { key: keyField, children: childrenField } = unref(getFieldNames); - if (!childrenField || !keyField) return; - - for (let index = 0; index < treeData.length; index++) { - const element: any = treeData[index]; - const children = element[childrenField]; - - if (element[keyField] === key) { - treeData.splice(index, 1); - break; - } else if (children && children.length) { - deleteNodeByKey(key, element[childrenField]); - } - } - } - - // Get selected node - function getSelectedNode(key: KeyType, list?: TreeItem[], selectedNode?: TreeItem | null) { - if (!key && key !== 0) return null; - const treeData = list || unref(treeDataRef); - treeData.forEach((item) => { - if (selectedNode?.key || selectedNode?.key === 0) return selectedNode; - if (item.key === key) { - selectedNode = item; - return; - } - if (item.children && item.children.length) { - selectedNode = getSelectedNode(key, item.children, selectedNode); - } - }); - return selectedNode || null; - } - return { - deleteNodeByKey, - insertNodeByKey, - insertNodesByKey, - filterByLevel, - updateNodeByKey, - getAllKeys, - getChildrenKeys, - getEnabledKeys, - getSelectedNode, - }; -} diff --git a/src/components/Tree/src/types/tree.ts b/src/components/Tree/src/types/tree.ts deleted file mode 100644 index 0b68b4b4..00000000 --- a/src/components/Tree/src/types/tree.ts +++ /dev/null @@ -1,195 +0,0 @@ -import type { ExtractPropTypes } from 'vue'; -import type { TreeDataItem } from 'ant-design-vue/es/tree/Tree'; - -import { buildProps } from '/@/utils/props'; - -export enum ToolbarEnum { - SELECT_ALL, - UN_SELECT_ALL, - EXPAND_ALL, - UN_EXPAND_ALL, - CHECK_STRICTLY, - CHECK_UN_STRICTLY, -} - -export const treeEmits = [ - 'update:expandedKeys', - 'update:selectedKeys', - 'update:value', - 'change', - 'check', - 'update:searchValue', -]; - -export interface TreeState { - expandedKeys: KeyType[]; - selectedKeys: KeyType[]; - checkedKeys: CheckKeys; - checkStrictly: boolean; -} - -export interface FieldNames { - children?: string; - title?: string; - key?: string; -} - -export type KeyType = string | number; - -export type CheckKeys = - | KeyType[] - | { checked: string[] | number[]; halfChecked: string[] | number[] }; - -export const treeProps = buildProps({ - value: { - type: [Object, Array] as PropType, - }, - - renderIcon: { - type: Function as PropType<(params: Recordable) => string>, - }, - - helpMessage: { - type: [String, Array] as PropType, - default: '', - }, - - title: { - type: String, - default: '', - }, - toolbar: Boolean, - search: Boolean, - searchValue: { - type: String, - default: '', - }, - checkStrictly: Boolean, - clickRowToExpand: { - type: Boolean, - default: false, - }, - checkable: Boolean, - defaultExpandLevel: { - type: [String, Number] as PropType, - default: '', - }, - defaultExpandAll: Boolean, - - fieldNames: { - type: Object as PropType, - }, - - treeData: { - type: Array as PropType, - }, - - actionList: { - type: Array as PropType, - default: () => [], - }, - - expandedKeys: { - type: Array as PropType, - default: () => [], - }, - - selectedKeys: { - type: Array as PropType, - default: () => [], - }, - - checkedKeys: { - type: Array as PropType, - default: () => [], - }, - - beforeRightClick: { - type: Function as PropType<(...arg: any) => ContextMenuItem[] | ContextMenuOptions>, - default: undefined, - }, - - rightMenuList: { - type: Array as PropType, - }, - // 自定义数据过滤判断方法(注: 不是整个过滤方法,而是内置过滤的判断方法,用于增强原本仅能通过title进行过滤的方式) - filterFn: { - type: Function as PropType< - (searchValue: any, node: TreeItem, fieldNames: FieldNames) => boolean - >, - default: undefined, - }, - // 高亮搜索值,仅高亮具体匹配值(通过title)值为true时使用默认色值,值为#xxx时使用此值替代且高亮开启 - highlight: { - type: [Boolean, String] as PropType, - default: false, - }, - // 搜索完成时自动展开结果 - expandOnSearch: Boolean, - // 搜索完成自动选中所有结果,当且仅当 checkable===true 时生效 - checkOnSearch: Boolean, - // 搜索完成自动select所有结果 - selectedOnSearch: Boolean, - loading: { - type: Boolean, - default: false, - }, - treeWrapperClassName: String -}); - -export type TreeProps = ExtractPropTypes; - -export interface ContextMenuItem { - label: string; - icon?: string; - hidden?: boolean; - disabled?: boolean; - handler?: Fn; - divider?: boolean; - children?: ContextMenuItem[]; -} - -export interface ContextMenuOptions { - icon?: string; - styles?: any; - items?: ContextMenuItem[]; -} - -export interface TreeItem extends TreeDataItem { - icon?: any; -} - -export interface TreeActionItem { - render: (record: Recordable) => any; - show?: boolean | ((record: Recordable) => boolean); -} - -export interface InsertNodeParams { - parentKey: string | null; - node: TreeDataItem; - list?: TreeDataItem[]; - push?: 'push' | 'unshift'; -} - -export interface TreeActionType { - checkAll: (checkAll: boolean) => void; - expandAll: (expandAll: boolean) => void; - setExpandedKeys: (keys: KeyType[]) => void; - getExpandedKeys: () => KeyType[]; - setSelectedKeys: (keys: KeyType[]) => void; - getSelectedKeys: () => KeyType[]; - setCheckedKeys: (keys: CheckKeys) => void; - getCheckedKeys: () => CheckKeys; - filterByLevel: (level: number) => void; - insertNodeByKey: (opt: InsertNodeParams) => void; - insertNodesByKey: (opt: InsertNodeParams) => void; - deleteNodeByKey: (key: string) => void; - updateNodeByKey: (key: string, node: Omit) => void; - setSearchValue: (value: string) => void; - getSearchValue: () => string; - getSelectedNode: ( - key: KeyType, - treeList?: TreeItem[], - selectNode?: TreeItem | null, - ) => TreeItem | null; -} diff --git a/src/components/Tree/style/index.less b/src/components/Tree/style/index.less deleted file mode 100644 index 472d4caa..00000000 --- a/src/components/Tree/style/index.less +++ /dev/null @@ -1,52 +0,0 @@ -@tree-prefix-cls: ~'@{namespace}-tree'; - -.@{tree-prefix-cls} { - background-color: @component-background; - - .ant-tree-node-content-wrapper { - position: relative; - - .ant-tree-title { - position: absolute; - left: 0; - width: 100%; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - } - } - - &__title { - position: relative; - display: flex; - align-items: center; - width: 100%; - padding-right: 10px; - - &:hover { - .@{tree-prefix-cls}__action { - visibility: visible; - } - } - } - - &__content { - overflow: hidden; - } - - &__actions { - position: absolute; - //top: 2px; - right: 3px; - display: flex; - } - - &__action { - margin-left: 4px; - visibility: hidden; - } - - &-header { - border-bottom: 1px solid @border-color-base; - } -} diff --git a/src/components/Tree/style/index.ts b/src/components/Tree/style/index.ts deleted file mode 100644 index d74e52ee..00000000 --- a/src/components/Tree/style/index.ts +++ /dev/null @@ -1 +0,0 @@ -import './index.less'; diff --git a/src/components/Upload/index.ts b/src/components/Upload/index.ts deleted file mode 100644 index 568a7d98..00000000 --- a/src/components/Upload/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { withInstall } from '/@/utils'; -import basicUpload from './src/BasicUpload.vue'; - -export const BasicUpload = withInstall(basicUpload); diff --git a/src/components/Upload/src/BasicUpload.vue b/src/components/Upload/src/BasicUpload.vue deleted file mode 100644 index 1d3b9c04..00000000 --- a/src/components/Upload/src/BasicUpload.vue +++ /dev/null @@ -1,123 +0,0 @@ - - diff --git a/src/components/Upload/src/FileList.vue b/src/components/Upload/src/FileList.vue deleted file mode 100644 index ddb087e5..00000000 --- a/src/components/Upload/src/FileList.vue +++ /dev/null @@ -1,104 +0,0 @@ - - diff --git a/src/components/Upload/src/ThumbUrl.vue b/src/components/Upload/src/ThumbUrl.vue deleted file mode 100644 index 80fb203d..00000000 --- a/src/components/Upload/src/ThumbUrl.vue +++ /dev/null @@ -1,29 +0,0 @@ - - - diff --git a/src/components/Upload/src/UploadModal.vue b/src/components/Upload/src/UploadModal.vue deleted file mode 100644 index e39cd18e..00000000 --- a/src/components/Upload/src/UploadModal.vue +++ /dev/null @@ -1,322 +0,0 @@ - - - diff --git a/src/components/Upload/src/UploadPreviewModal.vue b/src/components/Upload/src/UploadPreviewModal.vue deleted file mode 100644 index bc4091b1..00000000 --- a/src/components/Upload/src/UploadPreviewModal.vue +++ /dev/null @@ -1,99 +0,0 @@ - - - diff --git a/src/components/Upload/src/data.tsx b/src/components/Upload/src/data.tsx deleted file mode 100644 index 8e088332..00000000 --- a/src/components/Upload/src/data.tsx +++ /dev/null @@ -1,153 +0,0 @@ -import type { BasicColumn, ActionItem } from '/@/components/Table'; -import { FileItem, PreviewFileItem, UploadResultStatus } from './typing'; -import { - // checkImgType, - isImgTypeByName, -} from './helper'; -import { Progress, Tag } from 'ant-design-vue'; -import TableAction from '/@/components/Table/src/components/TableAction.vue'; -import ThumbUrl from './ThumbUrl.vue'; -import { useI18n } from '/@/hooks/web/useI18n'; - -const { t } = useI18n(); - -// 文件上传列表 -export function createTableColumns(): BasicColumn[] { - return [ - { - dataIndex: 'thumbUrl', - title: t('component.upload.legend'), - width: 100, - customRender: ({ record }) => { - const { thumbUrl } = (record as FileItem) || {}; - return thumbUrl && ; - }, - }, - { - dataIndex: 'name', - title: t('component.upload.fileName'), - align: 'left', - customRender: ({ text, record }) => { - const { percent, status: uploadStatus } = (record as FileItem) || {}; - let status: 'normal' | 'exception' | 'active' | 'success' = 'normal'; - if (uploadStatus === UploadResultStatus.ERROR) { - status = 'exception'; - } else if (uploadStatus === UploadResultStatus.UPLOADING) { - status = 'active'; - } else if (uploadStatus === UploadResultStatus.SUCCESS) { - status = 'success'; - } - return ( - -

- {text} -

- -
- ); - }, - }, - { - dataIndex: 'size', - title: t('component.upload.fileSize'), - width: 100, - customRender: ({ text = 0 }) => { - return text && (text / 1024).toFixed(2) + 'KB'; - }, - }, - // { - // dataIndex: 'type', - // title: '文件类型', - // width: 100, - // }, - { - dataIndex: 'status', - title: t('component.upload.fileStatue'), - width: 100, - customRender: ({ text }) => { - if (text === UploadResultStatus.SUCCESS) { - return {() => t('component.upload.uploadSuccess')}; - } else if (text === UploadResultStatus.ERROR) { - return {() => t('component.upload.uploadError')}; - } else if (text === UploadResultStatus.UPLOADING) { - return {() => t('component.upload.uploading')}; - } - - return text; - }, - }, - ]; -} -export function createActionColumn(handleRemove: Function): BasicColumn { - return { - width: 120, - title: t('component.upload.operating'), - dataIndex: 'action', - fixed: false, - customRender: ({ record }) => { - const actions: ActionItem[] = [ - { - label: t('component.upload.del'), - color: 'error', - onClick: handleRemove.bind(null, record), - }, - ]; - // if (checkImgType(record)) { - // actions.unshift({ - // label: t('component.upload.preview'), - // onClick: handlePreview.bind(null, record), - // }); - // } - return ; - }, - }; -} -// 文件预览列表 -export function createPreviewColumns(): BasicColumn[] { - return [ - { - dataIndex: 'url', - title: t('component.upload.legend'), - width: 100, - customRender: ({ record }) => { - const { url } = (record as PreviewFileItem) || {}; - return isImgTypeByName(url) && ; - }, - }, - { - dataIndex: 'name', - title: t('component.upload.fileName'), - align: 'left', - }, - ]; -} - -export function createPreviewActionColumn({ - handleRemove, - handleDownload, -}: { - handleRemove: Fn; - handleDownload: Fn; -}): BasicColumn { - return { - width: 160, - title: t('component.upload.operating'), - dataIndex: 'action', - fixed: false, - customRender: ({ record }) => { - const actions: ActionItem[] = [ - { - label: t('component.upload.del'), - color: 'error', - onClick: handleRemove.bind(null, record), - }, - { - label: t('component.upload.download'), - onClick: handleDownload.bind(null, record), - }, - ]; - - return ; - }, - }; -} diff --git a/src/components/Upload/src/helper.ts b/src/components/Upload/src/helper.ts deleted file mode 100644 index a0c574b7..00000000 --- a/src/components/Upload/src/helper.ts +++ /dev/null @@ -1,27 +0,0 @@ -export function checkFileType(file: File, accepts: string[]) { - const newTypes = accepts.join('|'); - // const reg = /\.(jpg|jpeg|png|gif|txt|doc|docx|xls|xlsx|xml)$/i; - const reg = new RegExp('\\.(' + newTypes + ')$', 'i'); - - return reg.test(file.name); -} - -export function checkImgType(file: File) { - return isImgTypeByName(file.name); -} - -export function isImgTypeByName(name: string) { - return /\.(jpg|jpeg|png|gif)$/i.test(name); -} - -export function getBase64WithFile(file: File) { - return new Promise<{ - result: string; - file: File; - }>((resolve, reject) => { - const reader = new FileReader(); - reader.readAsDataURL(file); - reader.onload = () => resolve({ result: reader.result as string, file }); - reader.onerror = (error) => reject(error); - }); -} diff --git a/src/components/Upload/src/props.ts b/src/components/Upload/src/props.ts deleted file mode 100644 index 413b95d7..00000000 --- a/src/components/Upload/src/props.ts +++ /dev/null @@ -1,83 +0,0 @@ -import type { PropType } from 'vue'; -import { FileBasicColumn } from './typing'; - -export const basicProps = { - helpText: { - type: String as PropType, - default: '', - }, - // 文件最大多少MB - maxSize: { - type: Number as PropType, - default: 2, - }, - // 最大数量的文件,Infinity不限制 - maxNumber: { - type: Number as PropType, - default: Infinity, - }, - // 根据后缀,或者其他 - accept: { - type: Array as PropType, - default: () => [], - }, - multiple: { - type: Boolean as PropType, - default: true, - }, - uploadParams: { - type: Object as PropType, - default: {}, - }, - api: { - type: Function as PropType, - default: null, - required: true, - }, - name: { - type: String as PropType, - default: 'file', - }, - filename: { - type: String as PropType, - default: null, - }, -}; - -export const uploadContainerProps = { - value: { - type: Array as PropType, - default: () => [], - }, - ...basicProps, - showPreviewNumber: { - type: Boolean as PropType, - default: true, - }, - emptyHidePreview: { - type: Boolean as PropType, - default: false, - }, -}; - -export const previewProps = { - value: { - type: Array as PropType, - default: () => [], - }, -}; - -export const fileListProps = { - columns: { - type: [Array] as PropType, - default: null, - }, - actionColumn: { - type: Object as PropType, - default: null, - }, - dataSource: { - type: Array as PropType, - default: null, - }, -}; diff --git a/src/components/Upload/src/typing.ts b/src/components/Upload/src/typing.ts deleted file mode 100644 index c6301100..00000000 --- a/src/components/Upload/src/typing.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { UploadApiResult } from '/@/api/sys/model/uploadModel'; - -export enum UploadResultStatus { - SUCCESS = 'success', - ERROR = 'error', - UPLOADING = 'uploading', -} - -export interface FileItem { - thumbUrl?: string; - name: string; - size: string | number; - type?: string; - percent: number; - file: File; - status?: UploadResultStatus; - responseData?: UploadApiResult; - uuid: string; -} - -export interface PreviewFileItem { - url: string; - name: string; - type: string; -} - -export interface FileBasicColumn { - /** - * Renderer of the table cell. The return value should be a VNode, or an object for colSpan/rowSpan config - * @type Function | ScopedSlot - */ - customRender?: Function; - /** - * Title of this column - * @type any (string | slot) - */ - title: string; - - /** - * Width of this column - * @type string | number - */ - width?: number; - /** - * Display field of the data record, could be set like a.b.c - * @type string - */ - dataIndex: string; - /** - * specify how content is aligned - * @default 'left' - * @type string - */ - align?: 'left' | 'right' | 'center'; -} diff --git a/src/components/Upload/src/useUpload.ts b/src/components/Upload/src/useUpload.ts deleted file mode 100644 index 694cc275..00000000 --- a/src/components/Upload/src/useUpload.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { Ref, unref, computed } from 'vue'; -import { useI18n } from '/@/hooks/web/useI18n'; -const { t } = useI18n(); -export function useUploadType({ - acceptRef, - helpTextRef, - maxNumberRef, - maxSizeRef, -}: { - acceptRef: Ref; - helpTextRef: Ref; - maxNumberRef: Ref; - maxSizeRef: Ref; -}) { - // 文件类型限制 - const getAccept = computed(() => { - const accept = unref(acceptRef); - if (accept && accept.length > 0) { - return accept; - } - return []; - }); - const getStringAccept = computed(() => { - return unref(getAccept) - .map((item) => { - if (item.indexOf('/') > 0 || item.startsWith('.')) { - return item; - } else { - return `.${item}`; - } - }) - .join(','); - }); - - // 支持jpg、jpeg、png格式,不超过2M,最多可选择10张图片,。 - const getHelpText = computed(() => { - const helpText = unref(helpTextRef); - if (helpText) { - return helpText; - } - const helpTexts: string[] = []; - - const accept = unref(acceptRef); - if (accept.length > 0) { - helpTexts.push(t('component.upload.accept', [accept.join(',')])); - } - - const maxSize = unref(maxSizeRef); - if (maxSize) { - helpTexts.push(t('component.upload.maxSize', [maxSize])); - } - - const maxNumber = unref(maxNumberRef); - if (maxNumber && maxNumber !== Infinity) { - helpTexts.push(t('component.upload.maxNumber', [maxNumber])); - } - return helpTexts.join(','); - }); - return { getAccept, getStringAccept, getHelpText }; -} diff --git a/src/components/Verify/index.ts b/src/components/Verify/index.ts deleted file mode 100644 index 7c67101b..00000000 --- a/src/components/Verify/index.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { withInstall } from '/@/utils/index'; -import basicDragVerify from './src/DragVerify.vue'; -import rotateDragVerify from './src/ImgRotate.vue'; - -export const BasicDragVerify = withInstall(basicDragVerify); -export const RotateDragVerify = withInstall(rotateDragVerify); -export * from './src/typing'; diff --git a/src/components/Verify/src/DragVerify.vue b/src/components/Verify/src/DragVerify.vue deleted file mode 100644 index c457bc03..00000000 --- a/src/components/Verify/src/DragVerify.vue +++ /dev/null @@ -1,371 +0,0 @@ - - diff --git a/src/components/Verify/src/ImgRotate.vue b/src/components/Verify/src/ImgRotate.vue deleted file mode 100644 index 53788ed6..00000000 --- a/src/components/Verify/src/ImgRotate.vue +++ /dev/null @@ -1,220 +0,0 @@ - - diff --git a/src/components/Verify/src/props.ts b/src/components/Verify/src/props.ts deleted file mode 100644 index 1e149703..00000000 --- a/src/components/Verify/src/props.ts +++ /dev/null @@ -1,87 +0,0 @@ -import type { PropType } from 'vue'; -import { useI18n } from '/@/hooks/web/useI18n'; - -const { t } = useI18n(); -export const basicProps = { - value: { - type: Boolean as PropType, - default: false, - }, - - isSlot: { - type: Boolean as PropType, - default: false, - }, - - text: { - type: [String] as PropType, - default: t('component.verify.dragText'), - }, - successText: { - type: [String] as PropType, - default: t('component.verify.successText'), - }, - height: { - type: [Number, String] as PropType, - default: 40, - }, - - width: { - type: [Number, String] as PropType, - default: 220, - }, - - circle: { - type: Boolean as PropType, - default: false, - }, - - wrapStyle: { - type: Object as PropType, - default: {}, - }, - contentStyle: { - type: Object as PropType, - default: {}, - }, - barStyle: { - type: Object as PropType, - default: {}, - }, - actionStyle: { - type: Object as PropType, - default: {}, - }, -}; - -export const rotateProps = { - ...basicProps, - src: { - type: String as PropType, - }, - - imgWidth: { - type: Number as PropType, - default: 260, - }, - - imgWrapStyle: { - type: Object as PropType, - default: {}, - }, - - minDegree: { - type: Number as PropType, - default: 90, - }, - - maxDegree: { - type: Number as PropType, - default: 270, - }, - - diffDegree: { - type: Number as PropType, - default: 20, - }, -}; diff --git a/src/components/Verify/src/typing.ts b/src/components/Verify/src/typing.ts deleted file mode 100644 index 48f7d4c7..00000000 --- a/src/components/Verify/src/typing.ts +++ /dev/null @@ -1,14 +0,0 @@ -export interface DragVerifyActionType { - resume: () => void; -} - -export interface PassingData { - isPassing: boolean; - time: number; -} - -export interface MoveData { - event: MouseEvent | TouchEvent; - moveDistance: number; - moveX: number; -} diff --git a/src/components/VirtualScroll/index.ts b/src/components/VirtualScroll/index.ts deleted file mode 100644 index a4c60897..00000000 --- a/src/components/VirtualScroll/index.ts +++ /dev/null @@ -1,4 +0,0 @@ -import { withInstall } from '/@/utils/index'; -import vScroll from './src/VirtualScroll.vue'; - -export const VScroll = withInstall(vScroll); diff --git a/src/components/VirtualScroll/src/VirtualScroll.vue b/src/components/VirtualScroll/src/VirtualScroll.vue deleted file mode 100644 index b37a0587..00000000 --- a/src/components/VirtualScroll/src/VirtualScroll.vue +++ /dev/null @@ -1,190 +0,0 @@ - - diff --git a/src/components/registerGlobComp.ts b/src/components/registerGlobComp.ts index a3ee3103..21099736 100644 --- a/src/components/registerGlobComp.ts +++ b/src/components/registerGlobComp.ts @@ -1,7 +1,7 @@ -import type { App } from 'vue'; -import { Button } from './Button'; -import { Input, Layout } from 'ant-design-vue'; +import type { App } from 'vue' +import { Button } from './Button' +import { Input, Layout } from 'ant-design-vue' export function registerGlobComp(app: App) { - app.use(Input).use(Button).use(Layout); + app.use(Input).use(Button).use(Layout) } diff --git a/src/directives/clickOutside.ts b/src/directives/clickOutside.ts index f6f3051a..948b50cd 100644 --- a/src/directives/clickOutside.ts +++ b/src/directives/clickOutside.ts @@ -1,56 +1,56 @@ -import { on } from '/@/utils/domUtils'; -import { isServer } from '/@/utils/is'; -import type { ComponentPublicInstance, DirectiveBinding, ObjectDirective } from 'vue'; +import { on } from '/@/utils/domUtils' +import { isServer } from '/@/utils/is' +import type { ComponentPublicInstance, DirectiveBinding, ObjectDirective } from 'vue' -type DocumentHandler = (mouseup: T, mousedown: T) => void; +type DocumentHandler = (mouseup: T, mousedown: T) => void type FlushList = Map< HTMLElement, { - documentHandler: DocumentHandler; - bindingFn: (...args: unknown[]) => unknown; + documentHandler: DocumentHandler + bindingFn: (...args: unknown[]) => unknown } ->; +> -const nodeList: FlushList = new Map(); +const nodeList: FlushList = new Map() -let startClick: MouseEvent; +let startClick: MouseEvent if (!isServer) { - on(document, 'mousedown', (e: MouseEvent) => (startClick = e)); + on(document, 'mousedown', (e: MouseEvent) => (startClick = e)) on(document, 'mouseup', (e: MouseEvent) => { for (const { documentHandler } of nodeList.values()) { - documentHandler(e, startClick); + documentHandler(e, startClick) } - }); + }) } function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): DocumentHandler { - let excludes: HTMLElement[] = []; + let excludes: HTMLElement[] = [] if (Array.isArray(binding.arg)) { - excludes = binding.arg; + excludes = binding.arg } else { // due to current implementation on binding type is wrong the type casting is necessary here - excludes.push(binding.arg as unknown as HTMLElement); + excludes.push(binding.arg as unknown as HTMLElement) } return function (mouseup, mousedown) { const popperRef = ( binding.instance as ComponentPublicInstance<{ - popperRef: Nullable; + popperRef: Nullable }> - ).popperRef; - const mouseUpTarget = mouseup.target as Node; - const mouseDownTarget = mousedown.target as Node; - const isBound = !binding || !binding.instance; - const isTargetExists = !mouseUpTarget || !mouseDownTarget; - const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget); - const isSelf = el === mouseUpTarget; + ).popperRef + const mouseUpTarget = mouseup.target as Node + const mouseDownTarget = mousedown.target as Node + const isBound = !binding || !binding.instance + const isTargetExists = !mouseUpTarget || !mouseDownTarget + const isContainedByEl = el.contains(mouseUpTarget) || el.contains(mouseDownTarget) + const isSelf = el === mouseUpTarget const isTargetExcluded = (excludes.length && excludes.some((item) => item?.contains(mouseUpTarget))) || - (excludes.length && excludes.includes(mouseDownTarget as HTMLElement)); + (excludes.length && excludes.includes(mouseDownTarget as HTMLElement)) const isContainedByPopper = - popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget)); + popperRef && (popperRef.contains(mouseUpTarget) || popperRef.contains(mouseDownTarget)) if ( isBound || isTargetExists || @@ -59,10 +59,10 @@ function createDocumentHandler(el: HTMLElement, binding: DirectiveBinding): Docu isTargetExcluded || isContainedByPopper ) { - return; + return } - binding.value(); - }; + binding.value() + } } const ClickOutside: ObjectDirective = { @@ -70,17 +70,17 @@ const ClickOutside: ObjectDirective = { nodeList.set(el, { documentHandler: createDocumentHandler(el, binding), bindingFn: binding.value, - }); + }) }, updated(el, binding) { nodeList.set(el, { documentHandler: createDocumentHandler(el, binding), bindingFn: binding.value, - }); + }) }, unmounted(el) { - nodeList.delete(el); + nodeList.delete(el) }, -}; +} -export default ClickOutside; +export default ClickOutside diff --git a/src/directives/index.ts b/src/directives/index.ts index 0329eb65..11df4421 100644 --- a/src/directives/index.ts +++ b/src/directives/index.ts @@ -1,11 +1,11 @@ /** * Configure and register global directives */ -import type { App } from 'vue'; -import { setupPermissionDirective } from './permission'; -import { setupLoadingDirective } from './loading'; +import type { App } from 'vue' +import { setupPermissionDirective } from './permission' +import { setupLoadingDirective } from './loading' export function setupGlobDirectives(app: App) { - setupPermissionDirective(app); - setupLoadingDirective(app); + setupPermissionDirective(app) + setupLoadingDirective(app) } diff --git a/src/directives/loading.ts b/src/directives/loading.ts index 712b71ce..4b445a65 100644 --- a/src/directives/loading.ts +++ b/src/directives/loading.ts @@ -1,12 +1,12 @@ -import { createLoading } from '/@/components/Loading'; -import type { Directive, App } from 'vue'; +import { createLoading } from '/@/components/Loading' +import type { Directive, App } from 'vue' const loadingDirective: Directive = { mounted(el, binding) { - const tip = el.getAttribute('loading-tip'); - const background = el.getAttribute('loading-background'); - const size = el.getAttribute('loading-size'); - const fullscreen = !!binding.modifiers.fullscreen; + const tip = el.getAttribute('loading-tip') + const background = el.getAttribute('loading-background') + const size = el.getAttribute('loading-size') + const fullscreen = !!binding.modifiers.fullscreen const instance = createLoading( { tip, @@ -16,24 +16,24 @@ const loadingDirective: Directive = { absolute: !fullscreen, }, fullscreen ? document.body : el, - ); - el.instance = instance; + ) + el.instance = instance }, updated(el, binding) { - const instance = el.instance; - if (!instance) return; - instance.setTip(el.getAttribute('loading-tip')); + const instance = el.instance + if (!instance) return + instance.setTip(el.getAttribute('loading-tip')) if (binding.oldValue !== binding.value) { - instance.setLoading?.(binding.value && !instance.loading); + instance.setLoading?.(binding.value && !instance.loading) } }, unmounted(el) { - el?.instance?.close(); + el?.instance?.close() }, -}; - -export function setupLoadingDirective(app: App) { - app.directive('loading', loadingDirective); } -export default loadingDirective; +export function setupLoadingDirective(app: App) { + app.directive('loading', loadingDirective) +} + +export default loadingDirective diff --git a/src/directives/permission.ts b/src/directives/permission.ts index ca5d0fca..dbdf5400 100644 --- a/src/directives/permission.ts +++ b/src/directives/permission.ts @@ -3,30 +3,30 @@ * Used for fine-grained control of component permissions * @Example v-auth="RoleEnum.TEST" */ -import type { App, Directive, DirectiveBinding } from 'vue'; +import type { App, Directive, DirectiveBinding } from 'vue' -import { usePermission } from '/@/hooks/web/usePermission'; +import { usePermission } from '/@/hooks/web/usePermission' function isAuth(el: Element, binding: any) { - const { hasPermission } = usePermission(); + const { hasPermission } = usePermission() - const value = binding.value; - if (!value) return; + const value = binding.value + if (!value) return if (!hasPermission(value)) { - el.parentNode?.removeChild(el); + el.parentNode?.removeChild(el) } } const mounted = (el: Element, binding: DirectiveBinding) => { - isAuth(el, binding); -}; + isAuth(el, binding) +} const authDirective: Directive = { mounted, -}; - -export function setupPermissionDirective(app: App) { - app.directive('auth', authDirective); } -export default authDirective; +export function setupPermissionDirective(app: App) { + app.directive('auth', authDirective) +} + +export default authDirective diff --git a/src/directives/repeatClick.ts b/src/directives/repeatClick.ts index d4ef150d..9324e9ef 100644 --- a/src/directives/repeatClick.ts +++ b/src/directives/repeatClick.ts @@ -2,30 +2,30 @@ * Prevent repeated clicks * @Example v-repeat-click="()=>{}" */ -import { on, once } from '/@/utils/domUtils'; -import type { Directive, DirectiveBinding } from 'vue'; +import { on, once } from '/@/utils/domUtils' +import type { Directive, DirectiveBinding } from 'vue' const repeatDirective: Directive = { beforeMount(el: Element, binding: DirectiveBinding) { - let interval: Nullable = null; - let startTime = 0; - const handler = (): void => binding?.value(); + let interval: Nullable = null + let startTime = 0 + const handler = (): void => binding?.value() const clear = (): void => { if (Date.now() - startTime < 100) { - handler(); + handler() } - interval && clearInterval(interval); - interval = null; - }; + interval && clearInterval(interval) + interval = null + } on(el, 'mousedown', (e: MouseEvent): void => { - if ((e as any).button !== 0) return; - startTime = Date.now(); - once(document as any, 'mouseup', clear); - interval && clearInterval(interval); - interval = setInterval(handler, 100); - }); + if ((e as any).button !== 0) return + startTime = Date.now() + once(document as any, 'mouseup', clear) + interval && clearInterval(interval) + interval = setInterval(handler, 100) + }) }, -}; +} -export default repeatDirective; +export default repeatDirective diff --git a/src/directives/ripple/index.ts b/src/directives/ripple/index.ts index 85a80e8f..bc889927 100644 --- a/src/directives/ripple/index.ts +++ b/src/directives/ripple/index.ts @@ -1,31 +1,31 @@ -import type { Directive } from 'vue'; -import './index.less'; +import type { Directive } from 'vue' +import './index.less' export interface RippleOptions { - event: string; - transition: number; + event: string + transition: number } export interface RippleProto { - background?: string; - zIndex?: string; + background?: string + zIndex?: string } -export type EventType = Event & MouseEvent & TouchEvent; +export type EventType = Event & MouseEvent & TouchEvent const options: RippleOptions = { event: 'mousedown', transition: 400, -}; +} const RippleDirective: Directive & RippleProto = { beforeMount: (el: HTMLElement, binding) => { - if (binding.value === false) return; + if (binding.value === false) return - const bg = el.getAttribute('ripple-background'); - setProps(Object.keys(binding.modifiers), options); + const bg = el.getAttribute('ripple-background') + setProps(Object.keys(binding.modifiers), options) - const background = bg || RippleDirective.background; - const zIndex = RippleDirective.zIndex; + const background = bg || RippleDirective.background + const zIndex = RippleDirective.zIndex el.addEventListener(options.event, (event: EventType) => { rippler({ @@ -33,18 +33,18 @@ const RippleDirective: Directive & RippleProto = { el, background, zIndex, - }); - }); + }) + }) }, updated(el, binding) { if (!binding.value) { - el?.clearRipple?.(); - return; + el?.clearRipple?.() + return } - const bg = el.getAttribute('ripple-background'); - el?.setBackground?.(bg); + const bg = el.getAttribute('ripple-background') + el?.setBackground?.(bg) }, -}; +} function rippler({ event, @@ -52,27 +52,27 @@ function rippler({ zIndex, background, }: { event: EventType; el: HTMLElement } & RippleProto) { - const targetBorder = parseInt(getComputedStyle(el).borderWidth.replace('px', '')); - const clientX = event.clientX || event.touches[0].clientX; - const clientY = event.clientY || event.touches[0].clientY; + const targetBorder = parseInt(getComputedStyle(el).borderWidth.replace('px', '')) + const clientX = event.clientX || event.touches[0].clientX + const clientY = event.clientY || event.touches[0].clientY - const rect = el.getBoundingClientRect(); - const { left, top } = rect; - const { offsetWidth: width, offsetHeight: height } = el; - const { transition } = options; - const dx = clientX - left; - const dy = clientY - top; - const maxX = Math.max(dx, width - dx); - const maxY = Math.max(dy, height - dy); - const style = window.getComputedStyle(el); - const radius = Math.sqrt(maxX * maxX + maxY * maxY); - const border = targetBorder > 0 ? targetBorder : 0; + const rect = el.getBoundingClientRect() + const { left, top } = rect + const { offsetWidth: width, offsetHeight: height } = el + const { transition } = options + const dx = clientX - left + const dy = clientY - top + const maxX = Math.max(dx, width - dx) + const maxY = Math.max(dy, height - dy) + const style = window.getComputedStyle(el) + const radius = Math.sqrt(maxX * maxX + maxY * maxY) + const border = targetBorder > 0 ? targetBorder : 0 - const ripple = document.createElement('div'); - const rippleContainer = document.createElement('div'); + const ripple = document.createElement('div') + const rippleContainer = document.createElement('div') // Styles for ripple - ripple.className = 'ripple'; + ripple.className = 'ripple' Object.assign(ripple.style ?? {}, { marginTop: '0px', @@ -85,10 +85,10 @@ function rippler({ position: 'relative', zIndex: zIndex ?? '9999', backgroundColor: background ?? 'rgba(0, 0, 0, 0.12)', - }); + }) // Styles for rippleContainer - rippleContainer.className = 'ripple-container'; + rippleContainer.className = 'ripple-container' Object.assign(rippleContainer.style ?? {}, { position: 'absolute', left: `${0 - border}px`, @@ -97,29 +97,29 @@ function rippler({ width: '0', pointerEvents: 'none', overflow: 'hidden', - }); + }) const storedTargetPosition = - el.style.position.length > 0 ? el.style.position : getComputedStyle(el).position; + el.style.position.length > 0 ? el.style.position : getComputedStyle(el).position if (storedTargetPosition !== 'relative') { - el.style.position = 'relative'; + el.style.position = 'relative' } - rippleContainer.appendChild(ripple); - el.appendChild(rippleContainer); + rippleContainer.appendChild(ripple) + el.appendChild(rippleContainer) Object.assign(ripple.style, { marginTop: `${dy}px`, marginLeft: `${dx}px`, - }); + }) const { borderTopLeftRadius, borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius, - } = style; + } = style Object.assign(rippleContainer.style, { width: `${width}px`, height: `${height}px`, @@ -128,64 +128,64 @@ function rippler({ borderTopRightRadius, borderBottomLeftRadius, borderBottomRightRadius, - }); + }) setTimeout(() => { - const wh = `${radius * 2}px`; + const wh = `${radius * 2}px` Object.assign(ripple.style ?? {}, { width: wh, height: wh, marginLeft: `${dx - radius}px`, marginTop: `${dy - radius}px`, - }); - }, 0); + }) + }, 0) function clearRipple() { setTimeout(() => { - ripple.style.backgroundColor = 'rgba(0, 0, 0, 0)'; - }, 250); + ripple.style.backgroundColor = 'rgba(0, 0, 0, 0)' + }, 250) setTimeout(() => { - rippleContainer?.parentNode?.removeChild(rippleContainer); - }, 850); - el.removeEventListener('mouseup', clearRipple, false); - el.removeEventListener('mouseleave', clearRipple, false); - el.removeEventListener('dragstart', clearRipple, false); + rippleContainer?.parentNode?.removeChild(rippleContainer) + }, 850) + el.removeEventListener('mouseup', clearRipple, false) + el.removeEventListener('mouseleave', clearRipple, false) + el.removeEventListener('dragstart', clearRipple, false) setTimeout(() => { - let clearPosition = true; + let clearPosition = true for (let i = 0; i < el.childNodes.length; i++) { if ((el.childNodes[i] as Recordable).className === 'ripple-container') { - clearPosition = false; + clearPosition = false } } if (clearPosition) { - el.style.position = storedTargetPosition !== 'static' ? storedTargetPosition : ''; + el.style.position = storedTargetPosition !== 'static' ? storedTargetPosition : '' } - }, options.transition + 260); + }, options.transition + 260) } if (event.type === 'mousedown') { - el.addEventListener('mouseup', clearRipple, false); - el.addEventListener('mouseleave', clearRipple, false); - el.addEventListener('dragstart', clearRipple, false); + el.addEventListener('mouseup', clearRipple, false) + el.addEventListener('mouseleave', clearRipple, false) + el.addEventListener('dragstart', clearRipple, false) } else { - clearRipple(); + clearRipple() } - (el as Recordable).setBackground = (bgColor: string) => { + ;(el as Recordable).setBackground = (bgColor: string) => { if (!bgColor) { - return; + return } - ripple.style.backgroundColor = bgColor; - }; + ripple.style.backgroundColor = bgColor + } } function setProps(modifiers: Recordable, props: Recordable) { modifiers.forEach((item: Recordable) => { - if (isNaN(Number(item))) props.event = item; - else props.transition = item; - }); + if (isNaN(Number(item))) props.event = item + else props.transition = item + }) } -export default RippleDirective; +export default RippleDirective diff --git a/src/enums/appEnum.ts b/src/enums/appEnum.ts index 1fc3989f..0b3a1ae5 100644 --- a/src/enums/appEnum.ts +++ b/src/enums/appEnum.ts @@ -1,5 +1,5 @@ -export const SIDE_BAR_MINI_WIDTH = 48; -export const SIDE_BAR_SHOW_TIT_MINI_WIDTH = 80; +export const SIDE_BAR_MINI_WIDTH = 48 +export const SIDE_BAR_SHOW_TIT_MINI_WIDTH = 80 export enum ContentEnum { // auto width diff --git a/src/enums/breakpointEnum.ts b/src/enums/breakpointEnum.ts index 93acc1a3..fa42ea31 100644 --- a/src/enums/breakpointEnum.ts +++ b/src/enums/breakpointEnum.ts @@ -16,13 +16,13 @@ export enum screenEnum { XXL = 1600, } -const screenMap = new Map(); +const screenMap = new Map() -screenMap.set(sizeEnum.XS, screenEnum.XS); -screenMap.set(sizeEnum.SM, screenEnum.SM); -screenMap.set(sizeEnum.MD, screenEnum.MD); -screenMap.set(sizeEnum.LG, screenEnum.LG); -screenMap.set(sizeEnum.XL, screenEnum.XL); -screenMap.set(sizeEnum.XXL, screenEnum.XXL); +screenMap.set(sizeEnum.XS, screenEnum.XS) +screenMap.set(sizeEnum.SM, screenEnum.SM) +screenMap.set(sizeEnum.MD, screenEnum.MD) +screenMap.set(sizeEnum.LG, screenEnum.LG) +screenMap.set(sizeEnum.XL, screenEnum.XL) +screenMap.set(sizeEnum.XXL, screenEnum.XXL) -export { screenMap }; +export { screenMap } diff --git a/src/enums/cacheEnum.ts b/src/enums/cacheEnum.ts index 4a5cc11b..c7d59b9f 100644 --- a/src/enums/cacheEnum.ts +++ b/src/enums/cacheEnum.ts @@ -1,29 +1,26 @@ // token key -export const TOKEN_KEY = 'TOKEN__'; +export const TOKEN_KEY = 'TOKEN__' -export const LOCALE_KEY = 'LOCALE__'; +export const LOCALE_KEY = 'LOCALE__' // user info key -export const USER_INFO_KEY = 'USER__INFO__'; +export const USER_INFO_KEY = 'USER__INFO__' // role info key -export const ROLES_KEY = 'ROLES__KEY__'; +export const ROLES_KEY = 'ROLES__KEY__' // project config key -export const PROJ_CFG_KEY = 'PROJ__CFG__KEY__'; +export const PROJ_CFG_KEY = 'PROJ__CFG__KEY__' -// lock info -export const LOCK_INFO_KEY = 'LOCK__INFO__KEY__'; +export const MULTIPLE_TABS_KEY = 'MULTIPLE_TABS__KEY__' -export const MULTIPLE_TABS_KEY = 'MULTIPLE_TABS__KEY__'; - -export const APP_DARK_MODE_KEY_ = '__APP__DARK__MODE__'; +export const APP_DARK_MODE_KEY_ = '__APP__DARK__MODE__' // base global local key -export const APP_LOCAL_CACHE_KEY = 'COMMON__LOCAL__KEY__'; +export const APP_LOCAL_CACHE_KEY = 'COMMON__LOCAL__KEY__' // base global session key -export const APP_SESSION_CACHE_KEY = 'COMMON__SESSION__KEY__'; +export const APP_SESSION_CACHE_KEY = 'COMMON__SESSION__KEY__' export enum CacheTypeEnum { SESSION, diff --git a/src/enums/menuEnum.ts b/src/enums/menuEnum.ts index 89cfa9f5..215c8499 100644 --- a/src/enums/menuEnum.ts +++ b/src/enums/menuEnum.ts @@ -22,7 +22,7 @@ export enum TriggerEnum { HEADER = 'HEADER', } -export type Mode = 'vertical' | 'vertical-right' | 'horizontal' | 'inline'; +export type Mode = 'vertical' | 'vertical-right' | 'horizontal' | 'inline' // menu mode export enum MenuModeEnum { diff --git a/src/enums/sizeEnum.ts b/src/enums/sizeEnum.ts index 9bac1843..73b84096 100644 --- a/src/enums/sizeEnum.ts +++ b/src/enums/sizeEnum.ts @@ -11,9 +11,9 @@ export enum SizeNumberEnum { } export const sizeMap: Map = (() => { - const map = new Map(); - map.set(SizeEnum.DEFAULT, SizeNumberEnum.DEFAULT); - map.set(SizeEnum.SMALL, SizeNumberEnum.SMALL); - map.set(SizeEnum.LARGE, SizeNumberEnum.LARGE); - return map; -})(); + const map = new Map() + map.set(SizeEnum.DEFAULT, SizeNumberEnum.DEFAULT) + map.set(SizeEnum.SMALL, SizeNumberEnum.SMALL) + map.set(SizeEnum.LARGE, SizeNumberEnum.LARGE) + return map +})() diff --git a/src/hooks/component/useFormItem.ts b/src/hooks/component/useFormItem.ts index cee415e8..43f55240 100644 --- a/src/hooks/component/useFormItem.ts +++ b/src/hooks/component/useFormItem.ts @@ -1,4 +1,4 @@ -import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue'; +import type { UnwrapRef, Ref, WritableComputedRef, DeepReadonly } from 'vue' import { reactive, readonly, @@ -8,16 +8,16 @@ import { unref, nextTick, toRaw, -} from 'vue'; +} from 'vue' -import { isEqual } from 'lodash-es'; +import { isEqual } from 'lodash-es' export function useRuleFormItem>( props: T, key?: K, changeEvent?, emitData?: Ref, -): [WritableComputedRef, (val: V) => void, DeepReadonly]; +): [WritableComputedRef, (val: V) => void, DeepReadonly] export function useRuleFormItem( props: T, @@ -25,36 +25,36 @@ export function useRuleFormItem( changeEvent = 'change', emitData?: Ref, ) { - const instance = getCurrentInstance(); - const emit = instance?.emit; + const instance = getCurrentInstance() + const emit = instance?.emit const innerState = reactive({ value: props[key], - }); + }) - const defaultState = readonly(innerState); + const defaultState = readonly(innerState) const setState = (val: UnwrapRef): void => { - innerState.value = val as T[keyof T]; - }; + innerState.value = val as T[keyof T] + } watchEffect(() => { - innerState.value = props[key]; - }); + innerState.value = props[key] + }) const state: any = computed({ get() { - return innerState.value; + return innerState.value }, set(value) { - if (isEqual(value, defaultState.value)) return; + if (isEqual(value, defaultState.value)) return - innerState.value = value as T[keyof T]; + innerState.value = value as T[keyof T] nextTick(() => { - emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])); - }); + emit?.(changeEvent, value, ...(toRaw(unref(emitData)) || [])) + }) }, - }); + }) - return [state, setState, defaultState]; + return [state, setState, defaultState] } diff --git a/src/hooks/component/usePageContext.ts b/src/hooks/component/usePageContext.ts index 12cc1605..7e78b4d9 100644 --- a/src/hooks/component/usePageContext.ts +++ b/src/hooks/component/usePageContext.ts @@ -1,18 +1,18 @@ -import type { InjectionKey, ComputedRef, Ref } from 'vue'; -import { createContext, useContext } from '/@/hooks/core/useContext'; +import type { InjectionKey, ComputedRef, Ref } from 'vue' +import { createContext, useContext } from '/@/hooks/core/useContext' export interface PageContextProps { - contentHeight: ComputedRef; - pageHeight: Ref; - setPageHeight: (height: number) => Promise; + contentHeight: ComputedRef + pageHeight: Ref + setPageHeight: (height: number) => Promise } -const key: InjectionKey = Symbol(); +const key: InjectionKey = Symbol() export function createPageContext(context: PageContextProps) { - return createContext(context, key, { native: true }); + return createContext(context, key, { native: true }) } export function usePageContext() { - return useContext(key); + return useContext(key) } diff --git a/src/hooks/core/onMountedOrActivated.ts b/src/hooks/core/onMountedOrActivated.ts index ffabf18d..2c92181a 100644 --- a/src/hooks/core/onMountedOrActivated.ts +++ b/src/hooks/core/onMountedOrActivated.ts @@ -1,18 +1,18 @@ -import { nextTick, onMounted, onActivated } from 'vue'; +import { nextTick, onMounted, onActivated } from 'vue' export function onMountedOrActivated(hook: Fn) { - let mounted: boolean; + let mounted: boolean onMounted(() => { - hook(); + hook() nextTick(() => { - mounted = true; - }); - }); + mounted = true + }) + }) onActivated(() => { if (mounted) { - hook(); + hook() } - }); + }) } diff --git a/src/hooks/core/useAttrs.ts b/src/hooks/core/useAttrs.ts index a7c5bd74..1bd35095 100644 --- a/src/hooks/core/useAttrs.ts +++ b/src/hooks/core/useAttrs.ts @@ -1,40 +1,40 @@ -import { getCurrentInstance, reactive, shallowRef, watchEffect } from 'vue'; -import type { Ref } from 'vue'; +import { getCurrentInstance, reactive, shallowRef, watchEffect } from 'vue' +import type { Ref } from 'vue' interface Params { - excludeListeners?: boolean; - excludeKeys?: string[]; - excludeDefaultKeys?: boolean; + excludeListeners?: boolean + excludeKeys?: string[] + excludeDefaultKeys?: boolean } -const DEFAULT_EXCLUDE_KEYS = ['class', 'style']; -const LISTENER_PREFIX = /^on[A-Z]/; +const DEFAULT_EXCLUDE_KEYS = ['class', 'style'] +const LISTENER_PREFIX = /^on[A-Z]/ export function entries(obj: Recordable): [string, T][] { - return Object.keys(obj).map((key: string) => [key, obj[key]]); + return Object.keys(obj).map((key: string) => [key, obj[key]]) } export function useAttrs(params: Params = {}): Ref | {} { - const instance = getCurrentInstance(); - if (!instance) return {}; + const instance = getCurrentInstance() + if (!instance) return {} - const { excludeListeners = false, excludeKeys = [], excludeDefaultKeys = true } = params; - const attrs = shallowRef({}); - const allExcludeKeys = excludeKeys.concat(excludeDefaultKeys ? DEFAULT_EXCLUDE_KEYS : []); + const { excludeListeners = false, excludeKeys = [], excludeDefaultKeys = true } = params + const attrs = shallowRef({}) + const allExcludeKeys = excludeKeys.concat(excludeDefaultKeys ? DEFAULT_EXCLUDE_KEYS : []) // Since attrs are not reactive, make it reactive instead of doing in `onUpdated` hook for better performance - instance.attrs = reactive(instance.attrs); + instance.attrs = reactive(instance.attrs) watchEffect(() => { const res = entries(instance.attrs).reduce((acm, [key, val]) => { if (!allExcludeKeys.includes(key) && !(excludeListeners && LISTENER_PREFIX.test(key))) { - acm[key] = val; + acm[key] = val } - return acm; - }, {} as Recordable); + return acm + }, {} as Recordable) - attrs.value = res; - }); + attrs.value = res + }) - return attrs; + return attrs } diff --git a/src/hooks/core/useContext.ts b/src/hooks/core/useContext.ts index c6861874..f1389603 100644 --- a/src/hooks/core/useContext.ts +++ b/src/hooks/core/useContext.ts @@ -6,39 +6,39 @@ import { readonly as defineReadonly, // defineComponent, UnwrapRef, -} from 'vue'; +} from 'vue' export interface CreateContextOptions { - readonly?: boolean; - createProvider?: boolean; - native?: boolean; + readonly?: boolean + createProvider?: boolean + native?: boolean } type ShallowUnwrap = { - [P in keyof T]: UnwrapRef; -}; + [P in keyof T]: UnwrapRef +} export function createContext( context: any, key: InjectionKey = Symbol(), options: CreateContextOptions = {}, ) { - const { readonly = true, createProvider = false, native = false } = options; + const { readonly = true, createProvider = false, native = false } = options - const state = reactive(context); - const provideData = readonly ? defineReadonly(state) : state; - !createProvider && provide(key, native ? context : provideData); + const state = reactive(context) + const provideData = readonly ? defineReadonly(state) : state + !createProvider && provide(key, native ? context : provideData) return { state, - }; + } } -export function useContext(key: InjectionKey, native?: boolean): T; +export function useContext(key: InjectionKey, native?: boolean): T export function useContext( key: InjectionKey = Symbol(), defaultValue?: any, ): ShallowUnwrap { - return inject(key, defaultValue || {}); + return inject(key, defaultValue || {}) } diff --git a/src/hooks/core/useLockFn.ts b/src/hooks/core/useLockFn.ts deleted file mode 100644 index 0a8b3a79..00000000 --- a/src/hooks/core/useLockFn.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ref, unref } from 'vue'; - -export function useLockFn

(fn: (...args: P) => Promise) { - const lockRef = ref(false); - return async function (...args: P) { - if (unref(lockRef)) return; - lockRef.value = true; - try { - const ret = await fn(...args); - lockRef.value = false; - return ret; - } catch (e) { - lockRef.value = false; - throw e; - } - }; -} diff --git a/src/hooks/core/useRefs.ts b/src/hooks/core/useRefs.ts index 180bb149..6ffb3513 100644 --- a/src/hooks/core/useRefs.ts +++ b/src/hooks/core/useRefs.ts @@ -1,16 +1,16 @@ -import type { Ref } from 'vue'; -import { ref, onBeforeUpdate } from 'vue'; +import type { Ref } from 'vue' +import { ref, onBeforeUpdate } from 'vue' export function useRefs(): [Ref, (index: number) => (el: HTMLElement) => void] { - const refs = ref([]) as Ref; + const refs = ref([]) as Ref onBeforeUpdate(() => { - refs.value = []; - }); + refs.value = [] + }) const setRefs = (index: number) => (el: HTMLElement) => { - refs.value[index] = el; - }; + refs.value[index] = el + } - return [refs, setRefs]; + return [refs, setRefs] } diff --git a/src/hooks/core/useTimeout.ts b/src/hooks/core/useTimeout.ts index 9905c2b6..6bb0f5c4 100644 --- a/src/hooks/core/useTimeout.ts +++ b/src/hooks/core/useTimeout.ts @@ -1,45 +1,45 @@ -import { ref, watch } from 'vue'; -import { tryOnUnmounted } from '@vueuse/core'; -import { isFunction } from '/@/utils/is'; +import { ref, watch } from 'vue' +import { tryOnUnmounted } from '@vueuse/core' +import { isFunction } from '/@/utils/is' export function useTimeoutFn(handle: Fn, wait: number, native = false) { if (!isFunction(handle)) { - throw new Error('handle is not Function!'); + throw new Error('handle is not Function!') } - const { readyRef, stop, start } = useTimeoutRef(wait); + const { readyRef, stop, start } = useTimeoutRef(wait) if (native) { - handle(); + handle() } else { watch( readyRef, (maturity) => { - maturity && handle(); + maturity && handle() }, { immediate: false }, - ); + ) } - return { readyRef, stop, start }; + return { readyRef, stop, start } } export function useTimeoutRef(wait: number) { - const readyRef = ref(false); + const readyRef = ref(false) - let timer: TimeoutHandle; + let timer: TimeoutHandle function stop(): void { - readyRef.value = false; - timer && window.clearTimeout(timer); + readyRef.value = false + timer && window.clearTimeout(timer) } function start(): void { - stop(); + stop() timer = setTimeout(() => { - readyRef.value = true; - }, wait); + readyRef.value = true + }, wait) } - start(); + start() - tryOnUnmounted(stop); + tryOnUnmounted(stop) - return { readyRef, stop, start }; + return { readyRef, stop, start } } diff --git a/src/hooks/event/useBreakpoint.ts b/src/hooks/event/useBreakpoint.ts index 01bbbecc..343e1f58 100644 --- a/src/hooks/event/useBreakpoint.ts +++ b/src/hooks/event/useBreakpoint.ts @@ -1,18 +1,18 @@ -import { ref, computed, ComputedRef, unref } from 'vue'; -import { useEventListener } from '/@/hooks/event/useEventListener'; -import { screenMap, sizeEnum, screenEnum } from '/@/enums/breakpointEnum'; +import { ref, computed, ComputedRef, unref } from 'vue' +import { useEventListener } from '/@/hooks/event/useEventListener' +import { screenMap, sizeEnum, screenEnum } from '/@/enums/breakpointEnum' -let globalScreenRef: ComputedRef; -let globalWidthRef: ComputedRef; -let globalRealWidthRef: ComputedRef; +let globalScreenRef: ComputedRef +let globalWidthRef: ComputedRef +let globalRealWidthRef: ComputedRef export interface CreateCallbackParams { - screen: ComputedRef; - width: ComputedRef; - realWidth: ComputedRef; - screenEnum: typeof screenEnum; - screenMap: Map; - sizeEnum: typeof sizeEnum; + screen: ComputedRef + width: ComputedRef + realWidth: ComputedRef + screenEnum: typeof screenEnum + screenMap: Map + sizeEnum: typeof sizeEnum } export function useBreakpoint() { @@ -21,35 +21,35 @@ export function useBreakpoint() { widthRef: globalWidthRef, screenEnum, realWidthRef: globalRealWidthRef, - }; + } } // Just call it once export function createBreakpointListen(fn?: (opt: CreateCallbackParams) => void) { - const screenRef = ref(sizeEnum.XL); - const realWidthRef = ref(window.innerWidth); + const screenRef = ref(sizeEnum.XL) + const realWidthRef = ref(window.innerWidth) function getWindowWidth() { - const width = document.body.clientWidth; - const xs = screenMap.get(sizeEnum.XS)!; - const sm = screenMap.get(sizeEnum.SM)!; - const md = screenMap.get(sizeEnum.MD)!; - const lg = screenMap.get(sizeEnum.LG)!; - const xl = screenMap.get(sizeEnum.XL)!; + const width = document.body.clientWidth + const xs = screenMap.get(sizeEnum.XS)! + const sm = screenMap.get(sizeEnum.SM)! + const md = screenMap.get(sizeEnum.MD)! + const lg = screenMap.get(sizeEnum.LG)! + const xl = screenMap.get(sizeEnum.XL)! if (width < xs) { - screenRef.value = sizeEnum.XS; + screenRef.value = sizeEnum.XS } else if (width < sm) { - screenRef.value = sizeEnum.SM; + screenRef.value = sizeEnum.SM } else if (width < md) { - screenRef.value = sizeEnum.MD; + screenRef.value = sizeEnum.MD } else if (width < lg) { - screenRef.value = sizeEnum.LG; + screenRef.value = sizeEnum.LG } else if (width < xl) { - screenRef.value = sizeEnum.XL; + screenRef.value = sizeEnum.XL } else { - screenRef.value = sizeEnum.XXL; + screenRef.value = sizeEnum.XXL } - realWidthRef.value = width; + realWidthRef.value = width } useEventListener({ @@ -57,16 +57,16 @@ export function createBreakpointListen(fn?: (opt: CreateCallbackParams) => void) name: 'resize', listener: () => { - getWindowWidth(); - resizeFn(); + getWindowWidth() + resizeFn() }, // wait: 100, - }); + }) - getWindowWidth(); - globalScreenRef = computed(() => unref(screenRef)); - globalWidthRef = computed((): number => screenMap.get(unref(screenRef)!)!); - globalRealWidthRef = computed((): number => unref(realWidthRef)); + getWindowWidth() + globalScreenRef = computed(() => unref(screenRef)) + globalWidthRef = computed((): number => screenMap.get(unref(screenRef)!)!) + globalRealWidthRef = computed((): number => unref(realWidthRef)) function resizeFn() { fn?.({ @@ -76,14 +76,14 @@ export function createBreakpointListen(fn?: (opt: CreateCallbackParams) => void) screenEnum, screenMap, sizeEnum, - }); + }) } - resizeFn(); + resizeFn() return { screenRef: globalScreenRef, screenEnum, widthRef: globalWidthRef, realWidthRef: globalRealWidthRef, - }; + } } diff --git a/src/hooks/event/useEventListener.ts b/src/hooks/event/useEventListener.ts index 892cd92e..6926eef6 100644 --- a/src/hooks/event/useEventListener.ts +++ b/src/hooks/event/useEventListener.ts @@ -1,16 +1,16 @@ -import type { Ref } from 'vue'; -import { ref, watch, unref } from 'vue'; -import { useThrottleFn, useDebounceFn } from '@vueuse/core'; +import type { Ref } from 'vue' +import { ref, watch, unref } from 'vue' +import { useThrottleFn, useDebounceFn } from '@vueuse/core' -export type RemoveEventFn = () => void; +export type RemoveEventFn = () => void export interface UseEventParams { - el?: Element | Ref | Window | any; - name: string; - listener: EventListener; - options?: boolean | AddEventListenerOptions; - autoRemove?: boolean; - isDebounce?: boolean; - wait?: number; + el?: Element | Ref | Window | any + name: string + listener: EventListener + options?: boolean | AddEventListenerOptions + autoRemove?: boolean + isDebounce?: boolean + wait?: number } export function useEventListener({ el = window, @@ -22,37 +22,37 @@ export function useEventListener({ wait = 80, }: UseEventParams): { removeEvent: RemoveEventFn } { /* eslint-disable-next-line */ - let remove: RemoveEventFn = () => {}; - const isAddRef = ref(false); + let remove: RemoveEventFn = () => {} + const isAddRef = ref(false) if (el) { - const element = ref(el as Element) as Ref; + const element = ref(el as Element) as Ref - const handler = isDebounce ? useDebounceFn(listener, wait) : useThrottleFn(listener, wait); - const realHandler = wait ? handler : listener; + const handler = isDebounce ? useDebounceFn(listener, wait) : useThrottleFn(listener, wait) + const realHandler = wait ? handler : listener const removeEventListener = (e: Element) => { - isAddRef.value = true; - e.removeEventListener(name, realHandler, options); - }; - const addEventListener = (e: Element) => e.addEventListener(name, realHandler, options); + isAddRef.value = true + e.removeEventListener(name, realHandler, options) + } + const addEventListener = (e: Element) => e.addEventListener(name, realHandler, options) const removeWatch = watch( element, (v, _ov, cleanUp) => { if (v) { - !unref(isAddRef) && addEventListener(v); + !unref(isAddRef) && addEventListener(v) cleanUp(() => { - autoRemove && removeEventListener(v); - }); + autoRemove && removeEventListener(v) + }) } }, { immediate: true }, - ); + ) remove = () => { - removeEventListener(element.value); - removeWatch(); - }; + removeEventListener(element.value) + removeWatch() + } } - return { removeEvent: remove }; + return { removeEvent: remove } } diff --git a/src/hooks/event/useIntersectionObserver.ts b/src/hooks/event/useIntersectionObserver.ts index b9badcae..9329366b 100644 --- a/src/hooks/event/useIntersectionObserver.ts +++ b/src/hooks/event/useIntersectionObserver.ts @@ -1,11 +1,11 @@ -import { Ref, watchEffect, ref } from 'vue'; +import { Ref, watchEffect, ref } from 'vue' interface IntersectionObserverProps { - target: Ref; - root?: Ref; - onIntersect: IntersectionObserverCallback; - rootMargin?: string; - threshold?: number; + target: Ref + root?: Ref + onIntersect: IntersectionObserverCallback + rootMargin?: string + threshold?: number } export function useIntersectionObserver({ @@ -15,34 +15,34 @@ export function useIntersectionObserver({ rootMargin = '0px', threshold = 0.1, }: IntersectionObserverProps) { - let cleanup = () => {}; - const observer: Ref> = ref(null); + let cleanup = () => {} + const observer: Ref> = ref(null) const stopEffect = watchEffect(() => { - cleanup(); + cleanup() observer.value = new IntersectionObserver(onIntersect, { root: root ? root.value : null, rootMargin, threshold, - }); + }) - const current = target.value; + const current = target.value - current && observer.value.observe(current); + current && observer.value.observe(current) cleanup = () => { if (observer.value) { - observer.value.disconnect(); - target.value && observer.value.unobserve(target.value); + observer.value.disconnect() + target.value && observer.value.unobserve(target.value) } - }; - }); + } + }) return { observer, stop: () => { - cleanup(); - stopEffect(); + cleanup() + stopEffect() }, - }; + } } diff --git a/src/hooks/event/useScroll.ts b/src/hooks/event/useScroll.ts index cc60f9bf..b82c46f3 100644 --- a/src/hooks/event/useScroll.ts +++ b/src/hooks/event/useScroll.ts @@ -1,65 +1,65 @@ -import type { Ref } from 'vue'; +import type { Ref } from 'vue' -import { ref, onMounted, watch, onUnmounted } from 'vue'; -import { isWindow, isObject } from '/@/utils/is'; -import { useThrottleFn } from '@vueuse/core'; +import { ref, onMounted, watch, onUnmounted } from 'vue' +import { isWindow, isObject } from '/@/utils/is' +import { useThrottleFn } from '@vueuse/core' export function useScroll( refEl: Ref, options?: { - wait?: number; - leading?: boolean; - trailing?: boolean; + wait?: number + leading?: boolean + trailing?: boolean }, ) { - const refX = ref(0); - const refY = ref(0); + const refX = ref(0) + const refY = ref(0) let handler = () => { if (isWindow(refEl.value)) { - refX.value = refEl.value.scrollX; - refY.value = refEl.value.scrollY; + refX.value = refEl.value.scrollX + refY.value = refEl.value.scrollY } else if (refEl.value) { - refX.value = (refEl.value as Element).scrollLeft; - refY.value = (refEl.value as Element).scrollTop; + refX.value = (refEl.value as Element).scrollLeft + refY.value = (refEl.value as Element).scrollTop } - }; - - if (isObject(options)) { - let wait = 0; - if (options.wait && options.wait > 0) { - wait = options.wait; - Reflect.deleteProperty(options, 'wait'); - } - - handler = useThrottleFn(handler, wait); } - let stopWatch: () => void; + if (isObject(options)) { + let wait = 0 + if (options.wait && options.wait > 0) { + wait = options.wait + Reflect.deleteProperty(options, 'wait') + } + + handler = useThrottleFn(handler, wait) + } + + let stopWatch: () => void onMounted(() => { stopWatch = watch( refEl, (el, prevEl, onCleanup) => { if (el) { - el.addEventListener('scroll', handler); + el.addEventListener('scroll', handler) } else if (prevEl) { - prevEl.removeEventListener('scroll', handler); + prevEl.removeEventListener('scroll', handler) } onCleanup(() => { - refX.value = refY.value = 0; - el && el.removeEventListener('scroll', handler); - }); + refX.value = refY.value = 0 + el && el.removeEventListener('scroll', handler) + }) }, { immediate: true }, - ); - }); + ) + }) onUnmounted(() => { - refEl.value && refEl.value.removeEventListener('scroll', handler); - }); + refEl.value && refEl.value.removeEventListener('scroll', handler) + }) function stop() { - stopWatch && stopWatch(); + stopWatch && stopWatch() } - return { refX, refY, stop }; + return { refX, refY, stop } } diff --git a/src/hooks/event/useScrollTo.ts b/src/hooks/event/useScrollTo.ts index f6d5dc61..6e1b4552 100644 --- a/src/hooks/event/useScrollTo.ts +++ b/src/hooks/event/useScrollTo.ts @@ -1,59 +1,59 @@ -import { isFunction, isUnDef } from '/@/utils/is'; -import { ref, unref } from 'vue'; +import { isFunction, isUnDef } from '/@/utils/is' +import { ref, unref } from 'vue' export interface ScrollToParams { - el: any; - to: number; - duration?: number; - callback?: () => any; + el: any + to: number + duration?: number + callback?: () => any } const easeInOutQuad = (t: number, b: number, c: number, d: number) => { - t /= d / 2; + t /= d / 2 if (t < 1) { - return (c / 2) * t * t + b; + return (c / 2) * t * t + b } - t--; - return (-c / 2) * (t * (t - 2) - 1) + b; -}; + t-- + return (-c / 2) * (t * (t - 2) - 1) + b +} const move = (el: HTMLElement, amount: number) => { - el.scrollTop = amount; -}; + el.scrollTop = amount +} const position = (el: HTMLElement) => { - return el.scrollTop; -}; + return el.scrollTop +} export function useScrollTo({ el, to, duration = 500, callback }: ScrollToParams) { - const isActiveRef = ref(false); - const start = position(el); - const change = to - start; - const increment = 20; - let currentTime = 0; - duration = isUnDef(duration) ? 500 : duration; + const isActiveRef = ref(false) + const start = position(el) + const change = to - start + const increment = 20 + let currentTime = 0 + duration = isUnDef(duration) ? 500 : duration const animateScroll = function () { if (!unref(isActiveRef)) { - return; + return } - currentTime += increment; - const val = easeInOutQuad(currentTime, start, change, duration); - move(el, val); + currentTime += increment + const val = easeInOutQuad(currentTime, start, change, duration) + move(el, val) if (currentTime < duration && unref(isActiveRef)) { - requestAnimationFrame(animateScroll); + requestAnimationFrame(animateScroll) } else { if (callback && isFunction(callback)) { - callback(); + callback() } } - }; + } const run = () => { - isActiveRef.value = true; - animateScroll(); - }; + isActiveRef.value = true + animateScroll() + } const stop = () => { - isActiveRef.value = false; - }; + isActiveRef.value = false + } - return { start: run, stop }; + return { start: run, stop } } diff --git a/src/hooks/event/useWindowSizeFn.ts b/src/hooks/event/useWindowSizeFn.ts index 01cdc752..14c437c7 100644 --- a/src/hooks/event/useWindowSizeFn.ts +++ b/src/hooks/event/useWindowSizeFn.ts @@ -1,35 +1,35 @@ -import { tryOnMounted, tryOnUnmounted, useDebounceFn } from '@vueuse/core'; +import { tryOnMounted, tryOnUnmounted, useDebounceFn } from '@vueuse/core' interface WindowSizeOptions { - once?: boolean; - immediate?: boolean; - listenerOptions?: AddEventListenerOptions | boolean; + once?: boolean + immediate?: boolean + listenerOptions?: AddEventListenerOptions | boolean } export function useWindowSizeFn(fn: Fn, wait = 150, options?: WindowSizeOptions) { let handler = () => { - fn(); - }; - const handleSize = useDebounceFn(handler, wait); - handler = handleSize; + fn() + } + const handleSize = useDebounceFn(handler, wait) + handler = handleSize const start = () => { if (options && options.immediate) { - handler(); + handler() } - window.addEventListener('resize', handler); - }; + window.addEventListener('resize', handler) + } const stop = () => { - window.removeEventListener('resize', handler); - }; + window.removeEventListener('resize', handler) + } tryOnMounted(() => { - start(); - }); + start() + }) tryOnUnmounted(() => { - stop(); - }); - return [start, stop]; + stop() + }) + return [start, stop] } diff --git a/src/hooks/setting/index.ts b/src/hooks/setting/index.ts index 56e393fa..d0780dbc 100644 --- a/src/hooks/setting/index.ts +++ b/src/hooks/setting/index.ts @@ -1,7 +1,7 @@ -import type { GlobConfig } from '/#/config'; +import type { GlobConfig } from '/#/config' -import { warn } from '/@/utils/log'; -import { getAppEnvConfig } from '/@/utils/env'; +import { warn } from '/@/utils/log' +import { getAppEnvConfig } from '/@/utils/env' export const useGlobSetting = (): Readonly => { const { @@ -10,12 +10,12 @@ export const useGlobSetting = (): Readonly => { VITE_GLOB_APP_SHORT_NAME, VITE_GLOB_API_URL_PREFIX, VITE_GLOB_UPLOAD_URL, - } = getAppEnvConfig(); + } = getAppEnvConfig() if (!/[a-zA-Z\_]*/.test(VITE_GLOB_APP_SHORT_NAME)) { warn( `VITE_GLOB_APP_SHORT_NAME Variables can only be characters/underscores, please modify in the environment variables and re-running.`, - ); + ) } // Take global configuration @@ -25,6 +25,6 @@ export const useGlobSetting = (): Readonly => { shortName: VITE_GLOB_APP_SHORT_NAME, urlPrefix: VITE_GLOB_API_URL_PREFIX, uploadUrl: VITE_GLOB_UPLOAD_URL, - }; - return glob as Readonly; -}; + } + return glob as Readonly +} diff --git a/src/hooks/setting/useHeaderSetting.ts b/src/hooks/setting/useHeaderSetting.ts index d590be8c..bbb8f892 100644 --- a/src/hooks/setting/useHeaderSetting.ts +++ b/src/hooks/setting/useHeaderSetting.ts @@ -1,17 +1,17 @@ -import type { HeaderSetting } from '/#/config'; +import type { HeaderSetting } from '/#/config' -import { computed, unref } from 'vue'; +import { computed, unref } from 'vue' -import { useAppStore } from '/@/store/modules/app'; +import { useAppStore } from '/@/store/modules/app' -import { useMenuSetting } from '/@/hooks/setting/useMenuSetting'; -import { useRootSetting } from '/@/hooks/setting/useRootSetting'; -import { useFullContent } from '/@/hooks/web/useFullContent'; -import { MenuModeEnum } from '/@/enums/menuEnum'; +import { useMenuSetting } from '/@/hooks/setting/useMenuSetting' +import { useRootSetting } from '/@/hooks/setting/useRootSetting' +import { useFullContent } from '/@/hooks/web/useFullContent' +import { MenuModeEnum } from '/@/enums/menuEnum' export function useHeaderSetting() { - const { getFullContent } = useFullContent(); - const appStore = useAppStore(); + const { getFullContent } = useFullContent() + const appStore = useAppStore() const getShowFullHeaderRef = computed(() => { return ( @@ -20,19 +20,19 @@ export function useHeaderSetting() { unref(getShowHeader) && !unref(getIsTopMenu) && !unref(getIsMixSidebar) - ); - }); + ) + }) - const getUnFixedAndFull = computed(() => !unref(getFixed) && !unref(getShowFullHeaderRef)); + const getUnFixedAndFull = computed(() => !unref(getFixed) && !unref(getShowFullHeaderRef)) const getShowInsetHeaderRef = computed(() => { - const need = !unref(getFullContent) && unref(getShowHeader); + const need = !unref(getFullContent) && unref(getShowHeader) return ( (need && !unref(getShowMixHeaderRef)) || (need && unref(getIsTopMenu)) || (need && unref(getIsMixSidebar)) - ); - }); + ) + }) const { getMenuMode, @@ -41,46 +41,44 @@ export function useHeaderSetting() { getIsSidebarType, getIsMixSidebar, getIsTopMenu, - } = useMenuSetting(); - const { getShowBreadCrumb, getShowLogo } = useRootSetting(); + } = useMenuSetting() + const { getShowBreadCrumb, getShowLogo } = useRootSetting() - const getShowMixHeaderRef = computed(() => !unref(getIsSidebarType) && unref(getShowHeader)); + const getShowMixHeaderRef = computed(() => !unref(getIsSidebarType) && unref(getShowHeader)) - const getShowDoc = computed(() => appStore.getHeaderSetting.showDoc); + const getShowDoc = computed(() => appStore.getHeaderSetting.showDoc) - const getHeaderTheme = computed(() => appStore.getHeaderSetting.theme); + const getHeaderTheme = computed(() => appStore.getHeaderSetting.theme) - const getShowHeader = computed(() => appStore.getHeaderSetting.show); + const getShowHeader = computed(() => appStore.getHeaderSetting.show) - const getFixed = computed(() => appStore.getHeaderSetting.fixed); + const getFixed = computed(() => appStore.getHeaderSetting.fixed) - const getHeaderBgColor = computed(() => appStore.getHeaderSetting.bgColor); + const getHeaderBgColor = computed(() => appStore.getHeaderSetting.bgColor) - const getShowSearch = computed(() => appStore.getHeaderSetting.showSearch); + const getShowSearch = computed(() => appStore.getHeaderSetting.showSearch) - const getUseLockPage = computed(() => appStore.getHeaderSetting.useLockPage); + const getShowFullScreen = computed(() => appStore.getHeaderSetting.showFullScreen) - const getShowFullScreen = computed(() => appStore.getHeaderSetting.showFullScreen); - - const getShowNotice = computed(() => appStore.getHeaderSetting.showNotice); + const getShowNotice = computed(() => appStore.getHeaderSetting.showNotice) const getShowBread = computed(() => { return ( unref(getMenuMode) !== MenuModeEnum.HORIZONTAL && unref(getShowBreadCrumb) && !unref(getSplit) - ); - }); + ) + }) const getShowHeaderLogo = computed(() => { - return unref(getShowLogo) && !unref(getIsSidebarType) && !unref(getIsMixSidebar); - }); + return unref(getShowLogo) && !unref(getIsSidebarType) && !unref(getIsMixSidebar) + }) const getShowContent = computed(() => { - return unref(getShowBread) || unref(getShowHeaderTrigger); - }); + return unref(getShowBread) || unref(getShowHeaderTrigger) + }) // Set header configuration function setHeaderSetting(headerSetting: Partial) { - appStore.setProjectConfig({ headerSetting }); + appStore.setProjectConfig({ headerSetting }) } return { setHeaderSetting, @@ -88,7 +86,6 @@ export function useHeaderSetting() { getShowDoc, getShowSearch, getHeaderTheme, - getUseLockPage, getShowFullScreen, getShowNotice, getShowBread, @@ -101,5 +98,5 @@ export function useHeaderSetting() { getShowInsetHeaderRef, getUnFixedAndFull, getHeaderBgColor, - }; + } } diff --git a/src/hooks/setting/useMenuSetting.ts b/src/hooks/setting/useMenuSetting.ts index 3566bfd2..9d74f1b5 100644 --- a/src/hooks/setting/useMenuSetting.ts +++ b/src/hooks/setting/useMenuSetting.ts @@ -1,71 +1,69 @@ -import type { MenuSetting } from '/#/config'; +import type { MenuSetting } from '/#/config' -import { computed, unref, ref } from 'vue'; +import { computed, unref, ref } from 'vue' -import { useAppStore } from '/@/store/modules/app'; +import { useAppStore } from '/@/store/modules/app' -import { SIDE_BAR_MINI_WIDTH, SIDE_BAR_SHOW_TIT_MINI_WIDTH } from '/@/enums/appEnum'; -import { MenuModeEnum, MenuTypeEnum, TriggerEnum } from '/@/enums/menuEnum'; -import { useFullContent } from '/@/hooks/web/useFullContent'; +import { SIDE_BAR_MINI_WIDTH, SIDE_BAR_SHOW_TIT_MINI_WIDTH } from '/@/enums/appEnum' +import { MenuModeEnum, MenuTypeEnum, TriggerEnum } from '/@/enums/menuEnum' +import { useFullContent } from '/@/hooks/web/useFullContent' -const mixSideHasChildren = ref(false); +const mixSideHasChildren = ref(false) export function useMenuSetting() { - const { getFullContent: fullContent } = useFullContent(); - const appStore = useAppStore(); + const { getFullContent: fullContent } = useFullContent() + const appStore = useAppStore() const getShowSidebar = computed(() => { return ( unref(getSplit) || (unref(getShowMenu) && unref(getMenuMode) !== MenuModeEnum.HORIZONTAL && !unref(fullContent)) - ); - }); + ) + }) - const getCollapsed = computed(() => appStore.getMenuSetting.collapsed); + const getCollapsed = computed(() => appStore.getMenuSetting.collapsed) - const getMenuType = computed(() => appStore.getMenuSetting.type); + const getMenuType = computed(() => appStore.getMenuSetting.type) - const getMenuMode = computed(() => appStore.getMenuSetting.mode); + const getMenuMode = computed(() => appStore.getMenuSetting.mode) - const getMenuFixed = computed(() => appStore.getMenuSetting.fixed); + const getMenuFixed = computed(() => appStore.getMenuSetting.fixed) - const getShowMenu = computed(() => appStore.getMenuSetting.show); + const getShowMenu = computed(() => appStore.getMenuSetting.show) - const getMenuHidden = computed(() => appStore.getMenuSetting.hidden); + const getMenuHidden = computed(() => appStore.getMenuSetting.hidden) - const getMenuWidth = computed(() => appStore.getMenuSetting.menuWidth); + const getMenuWidth = computed(() => appStore.getMenuSetting.menuWidth) - const getTrigger = computed(() => appStore.getMenuSetting.trigger); + const getTrigger = computed(() => appStore.getMenuSetting.trigger) - const getMenuTheme = computed(() => appStore.getMenuSetting.theme); + const getMenuTheme = computed(() => appStore.getMenuSetting.theme) - const getSplit = computed(() => appStore.getMenuSetting.split); + const getSplit = computed(() => appStore.getMenuSetting.split) - const getMenuBgColor = computed(() => appStore.getMenuSetting.bgColor); + const getMenuBgColor = computed(() => appStore.getMenuSetting.bgColor) - const getMixSideTrigger = computed(() => appStore.getMenuSetting.mixSideTrigger); + const getMixSideTrigger = computed(() => appStore.getMenuSetting.mixSideTrigger) - const getCanDrag = computed(() => appStore.getMenuSetting.canDrag); + const getCanDrag = computed(() => appStore.getMenuSetting.canDrag) - const getAccordion = computed(() => appStore.getMenuSetting.accordion); + const getAccordion = computed(() => appStore.getMenuSetting.accordion) - const getMixSideFixed = computed(() => appStore.getMenuSetting.mixSideFixed); + const getMixSideFixed = computed(() => appStore.getMenuSetting.mixSideFixed) - const getTopMenuAlign = computed(() => appStore.getMenuSetting.topMenuAlign); + const getTopMenuAlign = computed(() => appStore.getMenuSetting.topMenuAlign) - const getCloseMixSidebarOnChange = computed( - () => appStore.getMenuSetting.closeMixSidebarOnChange, - ); + const getCloseMixSidebarOnChange = computed(() => appStore.getMenuSetting.closeMixSidebarOnChange) - const getIsSidebarType = computed(() => unref(getMenuType) === MenuTypeEnum.SIDEBAR); + const getIsSidebarType = computed(() => unref(getMenuType) === MenuTypeEnum.SIDEBAR) - const getIsTopMenu = computed(() => unref(getMenuType) === MenuTypeEnum.TOP_MENU); + const getIsTopMenu = computed(() => unref(getMenuType) === MenuTypeEnum.TOP_MENU) - const getCollapsedShowTitle = computed(() => appStore.getMenuSetting.collapsedShowTitle); + const getCollapsedShowTitle = computed(() => appStore.getMenuSetting.collapsedShowTitle) const getShowTopMenu = computed(() => { - return unref(getMenuMode) === MenuModeEnum.HORIZONTAL || unref(getSplit); - }); + return unref(getMenuMode) === MenuModeEnum.HORIZONTAL || unref(getSplit) + }) const getShowHeaderTrigger = computed(() => { if ( @@ -73,41 +71,37 @@ export function useMenuSetting() { !unref(getShowMenu) || unref(getMenuHidden) ) { - return false; + return false } - return unref(getTrigger) === TriggerEnum.HEADER; - }); + return unref(getTrigger) === TriggerEnum.HEADER + }) const getIsHorizontal = computed(() => { - return unref(getMenuMode) === MenuModeEnum.HORIZONTAL; - }); + return unref(getMenuMode) === MenuModeEnum.HORIZONTAL + }) const getIsMixSidebar = computed(() => { - return unref(getMenuType) === MenuTypeEnum.MIX_SIDEBAR; - }); + return unref(getMenuType) === MenuTypeEnum.MIX_SIDEBAR + }) const getIsMixMode = computed(() => { - return unref(getMenuMode) === MenuModeEnum.INLINE && unref(getMenuType) === MenuTypeEnum.MIX; - }); + return unref(getMenuMode) === MenuModeEnum.INLINE && unref(getMenuType) === MenuTypeEnum.MIX + }) const getRealWidth = computed(() => { if (unref(getIsMixSidebar)) { return unref(getCollapsed) && !unref(getMixSideFixed) ? unref(getMiniWidthNumber) - : unref(getMenuWidth); + : unref(getMenuWidth) } - return unref(getCollapsed) ? unref(getMiniWidthNumber) : unref(getMenuWidth); - }); + return unref(getCollapsed) ? unref(getMiniWidthNumber) : unref(getMenuWidth) + }) const getMiniWidthNumber = computed(() => { - const { collapsedShowTitle, siderHidden } = appStore.getMenuSetting; - return siderHidden - ? 0 - : collapsedShowTitle - ? SIDE_BAR_SHOW_TIT_MINI_WIDTH - : SIDE_BAR_MINI_WIDTH; - }); + const { collapsedShowTitle, siderHidden } = appStore.getMenuSetting + return siderHidden ? 0 : collapsedShowTitle ? SIDE_BAR_SHOW_TIT_MINI_WIDTH : SIDE_BAR_MINI_WIDTH + }) const getCalcContentWidth = computed(() => { const width = @@ -116,20 +110,20 @@ export function useMenuSetting() { : unref(getIsMixSidebar) ? (unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH) + (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0) - : unref(getRealWidth); + : unref(getRealWidth) - return `calc(100% - ${unref(width)}px)`; - }); + return `calc(100% - ${unref(width)}px)` + }) // Set menu configuration function setMenuSetting(menuSetting: Partial): void { - appStore.setProjectConfig({ menuSetting }); + appStore.setProjectConfig({ menuSetting }) } function toggleCollapsed() { setMenuSetting({ collapsed: !unref(getCollapsed), - }); + }) } return { setMenuSetting, @@ -166,5 +160,5 @@ export function useMenuSetting() { getMixSideTrigger, getMixSideFixed, mixSideHasChildren, - }; + } } diff --git a/src/hooks/setting/useMultipleTabSetting.ts b/src/hooks/setting/useMultipleTabSetting.ts index 7caa7537..b8f23f4b 100644 --- a/src/hooks/setting/useMultipleTabSetting.ts +++ b/src/hooks/setting/useMultipleTabSetting.ts @@ -1,22 +1,22 @@ -import type { MultiTabsSetting } from '/#/config'; +import type { MultiTabsSetting } from '/#/config' -import { computed } from 'vue'; +import { computed } from 'vue' -import { useAppStore } from '/@/store/modules/app'; +import { useAppStore } from '/@/store/modules/app' export function useMultipleTabSetting() { - const appStore = useAppStore(); + const appStore = useAppStore() - const getShowMultipleTab = computed(() => appStore.getMultiTabsSetting.show); + const getShowMultipleTab = computed(() => appStore.getMultiTabsSetting.show) - const getShowQuick = computed(() => appStore.getMultiTabsSetting.showQuick); + const getShowQuick = computed(() => appStore.getMultiTabsSetting.showQuick) - const getShowRedo = computed(() => appStore.getMultiTabsSetting.showRedo); + const getShowRedo = computed(() => appStore.getMultiTabsSetting.showRedo) - const getShowFold = computed(() => appStore.getMultiTabsSetting.showFold); + const getShowFold = computed(() => appStore.getMultiTabsSetting.showFold) function setMultipleTabSetting(multiTabsSetting: Partial) { - appStore.setProjectConfig({ multiTabsSetting }); + appStore.setProjectConfig({ multiTabsSetting }) } return { setMultipleTabSetting, @@ -24,5 +24,5 @@ export function useMultipleTabSetting() { getShowQuick, getShowRedo, getShowFold, - }; + } } diff --git a/src/hooks/setting/useRootSetting.ts b/src/hooks/setting/useRootSetting.ts index 4976e40a..162617c3 100644 --- a/src/hooks/setting/useRootSetting.ts +++ b/src/hooks/setting/useRootSetting.ts @@ -1,70 +1,68 @@ -import type { ProjectConfig } from '/#/config'; +import type { ProjectConfig } from '/#/config' -import { computed } from 'vue'; +import { computed } from 'vue' -import { useAppStore } from '/@/store/modules/app'; -import { ContentEnum, ThemeEnum } from '/@/enums/appEnum'; +import { useAppStore } from '/@/store/modules/app' +import { ContentEnum, ThemeEnum } from '/@/enums/appEnum' type RootSetting = Omit< ProjectConfig, 'locale' | 'headerSetting' | 'menuSetting' | 'multiTabsSetting' ->; +> export function useRootSetting() { - const appStore = useAppStore(); + const appStore = useAppStore() - const getPageLoading = computed(() => appStore.getPageLoading); + const getPageLoading = computed(() => appStore.getPageLoading) - const getOpenKeepAlive = computed(() => appStore.getProjectConfig.openKeepAlive); + const getOpenKeepAlive = computed(() => appStore.getProjectConfig.openKeepAlive) - const getSettingButtonPosition = computed(() => appStore.getProjectConfig.settingButtonPosition); + const getSettingButtonPosition = computed(() => appStore.getProjectConfig.settingButtonPosition) - const getCanEmbedIFramePage = computed(() => appStore.getProjectConfig.canEmbedIFramePage); + const getCanEmbedIFramePage = computed(() => appStore.getProjectConfig.canEmbedIFramePage) - const getPermissionMode = computed(() => appStore.getProjectConfig.permissionMode); + const getPermissionMode = computed(() => appStore.getProjectConfig.permissionMode) - const getShowLogo = computed(() => appStore.getProjectConfig.showLogo); + const getShowLogo = computed(() => appStore.getProjectConfig.showLogo) - const getContentMode = computed(() => appStore.getProjectConfig.contentMode); + const getContentMode = computed(() => appStore.getProjectConfig.contentMode) - const getUseOpenBackTop = computed(() => appStore.getProjectConfig.useOpenBackTop); + const getUseOpenBackTop = computed(() => appStore.getProjectConfig.useOpenBackTop) - const getShowSettingButton = computed(() => appStore.getProjectConfig.showSettingButton); + const getShowSettingButton = computed(() => appStore.getProjectConfig.showSettingButton) - const getUseErrorHandle = computed(() => appStore.getProjectConfig.useErrorHandle); + const getUseErrorHandle = computed(() => appStore.getProjectConfig.useErrorHandle) - const getShowFooter = computed(() => appStore.getProjectConfig.showFooter); + const getShowFooter = computed(() => appStore.getProjectConfig.showFooter) - const getShowBreadCrumb = computed(() => appStore.getProjectConfig.showBreadCrumb); + const getShowBreadCrumb = computed(() => appStore.getProjectConfig.showBreadCrumb) - const getThemeColor = computed(() => appStore.getProjectConfig.themeColor); + const getThemeColor = computed(() => appStore.getProjectConfig.themeColor) - const getShowBreadCrumbIcon = computed(() => appStore.getProjectConfig.showBreadCrumbIcon); + const getShowBreadCrumbIcon = computed(() => appStore.getProjectConfig.showBreadCrumbIcon) - const getFullContent = computed(() => appStore.getProjectConfig.fullContent); + const getFullContent = computed(() => appStore.getProjectConfig.fullContent) - const getColorWeak = computed(() => appStore.getProjectConfig.colorWeak); + const getColorWeak = computed(() => appStore.getProjectConfig.colorWeak) - const getGrayMode = computed(() => appStore.getProjectConfig.grayMode); + const getGrayMode = computed(() => appStore.getProjectConfig.grayMode) - const getLockTime = computed(() => appStore.getProjectConfig.lockTime); + const getShowDarkModeToggle = computed(() => appStore.getProjectConfig.showDarkModeToggle) - const getShowDarkModeToggle = computed(() => appStore.getProjectConfig.showDarkModeToggle); - - const getDarkMode = computed(() => appStore.getDarkMode); + const getDarkMode = computed(() => appStore.getDarkMode) const getLayoutContentMode = computed(() => appStore.getProjectConfig.contentMode === ContentEnum.FULL ? ContentEnum.FULL : ContentEnum.FIXED, - ); + ) function setRootSetting(setting: Partial) { - appStore.setProjectConfig(setting); + appStore.setProjectConfig(setting) } function setDarkMode(mode: ThemeEnum) { - appStore.setDarkMode(mode); + appStore.setDarkMode(mode) } return { setRootSetting, @@ -86,10 +84,9 @@ export function useRootSetting() { getShowSettingButton, getShowFooter, getContentMode, - getLockTime, getThemeColor, getDarkMode, setDarkMode, getShowDarkModeToggle, - }; + } } diff --git a/src/hooks/setting/useTransitionSetting.ts b/src/hooks/setting/useTransitionSetting.ts index b6d421af..f6848a47 100644 --- a/src/hooks/setting/useTransitionSetting.ts +++ b/src/hooks/setting/useTransitionSetting.ts @@ -1,24 +1,24 @@ -import type { TransitionSetting } from '/#/config'; +import type { TransitionSetting } from '/#/config' -import { computed } from 'vue'; +import { computed } from 'vue' -import { useAppStore } from '/@/store/modules/app'; +import { useAppStore } from '/@/store/modules/app' export function useTransitionSetting() { - const appStore = useAppStore(); + const appStore = useAppStore() - const getEnableTransition = computed(() => appStore.getTransitionSetting?.enable); + const getEnableTransition = computed(() => appStore.getTransitionSetting?.enable) - const getOpenNProgress = computed(() => appStore.getTransitionSetting?.openNProgress); + const getOpenNProgress = computed(() => appStore.getTransitionSetting?.openNProgress) const getOpenPageLoading = computed((): boolean => { - return !!appStore.getTransitionSetting?.openPageLoading; - }); + return !!appStore.getTransitionSetting?.openPageLoading + }) - const getBasicTransition = computed(() => appStore.getTransitionSetting?.basicTransition); + const getBasicTransition = computed(() => appStore.getTransitionSetting?.basicTransition) function setTransitionSetting(transitionSetting: Partial) { - appStore.setProjectConfig({ transitionSetting }); + appStore.setProjectConfig({ transitionSetting }) } return { setTransitionSetting, @@ -27,5 +27,5 @@ export function useTransitionSetting() { getOpenNProgress, getOpenPageLoading, getBasicTransition, - }; + } } diff --git a/src/hooks/web/useAppInject.ts b/src/hooks/web/useAppInject.ts index 7d6efb2b..96571302 100644 --- a/src/hooks/web/useAppInject.ts +++ b/src/hooks/web/useAppInject.ts @@ -1,10 +1,10 @@ -import { useAppProviderContext } from '/@/components/Application'; -import { computed, unref } from 'vue'; +import { useAppProviderContext } from '/@/components/Application' +import { computed, unref } from 'vue' export function useAppInject() { - const values = useAppProviderContext(); + const values = useAppProviderContext() return { getIsMobile: computed(() => unref(values.isMobile)), - }; + } } diff --git a/src/hooks/web/useContentHeight.ts b/src/hooks/web/useContentHeight.ts index d51f4ca4..59d977a5 100644 --- a/src/hooks/web/useContentHeight.ts +++ b/src/hooks/web/useContentHeight.ts @@ -1,18 +1,18 @@ -import { ComputedRef, isRef, nextTick, Ref, ref, unref, watch } from 'vue'; -import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated'; -import { useWindowSizeFn } from '/@/hooks/event/useWindowSizeFn'; -import { useLayoutHeight } from '/@/layouts/default/content/useContentViewHeight'; -import { getViewportOffset } from '/@/utils/domUtils'; -import { isNumber, isString } from '/@/utils/is'; +import { ComputedRef, isRef, nextTick, Ref, ref, unref, watch } from 'vue' +import { onMountedOrActivated } from '/@/hooks/core/onMountedOrActivated' +import { useWindowSizeFn } from '/@/hooks/event/useWindowSizeFn' +import { useLayoutHeight } from '/@/layouts/default/content/useContentViewHeight' +import { getViewportOffset } from '/@/utils/domUtils' +import { isNumber, isString } from '/@/utils/is' export interface CompensationHeight { // 使用 layout Footer 高度作为判断补偿高度的条件 - useLayoutFooter: boolean; + useLayoutFooter: boolean // refs HTMLElement - elements?: Ref[]; + elements?: Ref[] } -type Upward = number | string | null | undefined; +type Upward = number | string | null | undefined /** * 动态计算内容高度,根据锚点dom最下坐标到屏幕最下坐标,根据传入dom的高度、padding、margin等值进行动态计算 @@ -34,20 +34,20 @@ export function useContentHeight( upwardSpace: Ref | ComputedRef | Upward = 0, offsetHeightRef: Ref = ref(0), ) { - const contentHeight: Ref> = ref(null); - const { footerHeightRef: layoutFooterHeightRef } = useLayoutHeight(); + const contentHeight: Ref> = ref(null) + const { footerHeightRef: layoutFooterHeightRef } = useLayoutHeight() let compensationHeight: CompensationHeight = { useLayoutFooter: true, - }; + } const setCompensation = (params: CompensationHeight) => { - compensationHeight = params; - }; + compensationHeight = params + } function redoHeight() { nextTick(() => { - calcContentHeight(); - }); + calcContentHeight() + }) } function calcSubtractSpace( @@ -55,90 +55,90 @@ export function useContentHeight( direction: 'all' | 'top' | 'bottom' = 'all', ): number { function numberPx(px: string) { - return Number(px.replace(/[^\d]/g, '')); + return Number(px.replace(/[^\d]/g, '')) } - let subtractHeight = 0; - const ZERO_PX = '0px'; + let subtractHeight = 0 + const ZERO_PX = '0px' if (element) { - const cssStyle = getComputedStyle(element); - const marginTop = numberPx(cssStyle?.marginTop ?? ZERO_PX); - const marginBottom = numberPx(cssStyle?.marginBottom ?? ZERO_PX); - const paddingTop = numberPx(cssStyle?.paddingTop ?? ZERO_PX); - const paddingBottom = numberPx(cssStyle?.paddingBottom ?? ZERO_PX); + const cssStyle = getComputedStyle(element) + const marginTop = numberPx(cssStyle?.marginTop ?? ZERO_PX) + const marginBottom = numberPx(cssStyle?.marginBottom ?? ZERO_PX) + const paddingTop = numberPx(cssStyle?.paddingTop ?? ZERO_PX) + const paddingBottom = numberPx(cssStyle?.paddingBottom ?? ZERO_PX) if (direction === 'all') { - subtractHeight += marginTop; - subtractHeight += marginBottom; - subtractHeight += paddingTop; - subtractHeight += paddingBottom; + subtractHeight += marginTop + subtractHeight += marginBottom + subtractHeight += paddingTop + subtractHeight += paddingBottom } else if (direction === 'top') { - subtractHeight += marginTop; - subtractHeight += paddingTop; + subtractHeight += marginTop + subtractHeight += paddingTop } else { - subtractHeight += marginBottom; - subtractHeight += paddingBottom; + subtractHeight += marginBottom + subtractHeight += paddingBottom } } - return subtractHeight; + return subtractHeight } function getEl(element: any): Nullable { if (element == null) { - return null; + return null } - return (element instanceof HTMLDivElement ? element : element.$el) as HTMLDivElement; + return (element instanceof HTMLDivElement ? element : element.$el) as HTMLDivElement } async function calcContentHeight() { if (!flag.value) { - return; + return } // Add a delay to get the correct height - await nextTick(); + await nextTick() - const anchorEl = getEl(unref(anchorRef)); + const anchorEl = getEl(unref(anchorRef)) if (!anchorEl) { - return; + return } - const { bottomIncludeBody } = getViewportOffset(anchorEl); + const { bottomIncludeBody } = getViewportOffset(anchorEl) // substract elements height - let substractHeight = 0; + let substractHeight = 0 subtractHeightRefs.forEach((item) => { - substractHeight += getEl(unref(item))?.offsetHeight ?? 0; - }); + substractHeight += getEl(unref(item))?.offsetHeight ?? 0 + }) // subtract margins / paddings - let substractSpaceHeight = calcSubtractSpace(anchorEl) ?? 0; + let substractSpaceHeight = calcSubtractSpace(anchorEl) ?? 0 substractSpaceRefs.forEach((item) => { - substractSpaceHeight += calcSubtractSpace(getEl(unref(item))); - }); + substractSpaceHeight += calcSubtractSpace(getEl(unref(item))) + }) // upwardSpace - let upwardSpaceHeight = 0; + let upwardSpaceHeight = 0 function upward(element: Element | null, upwardLvlOrClass: number | string | null | undefined) { if (element && upwardLvlOrClass) { - const parent = element.parentElement; + const parent = element.parentElement if (parent) { if (isString(upwardLvlOrClass)) { if (!parent.classList.contains(upwardLvlOrClass)) { - upwardSpaceHeight += calcSubtractSpace(parent, 'bottom'); - upward(parent, upwardLvlOrClass); + upwardSpaceHeight += calcSubtractSpace(parent, 'bottom') + upward(parent, upwardLvlOrClass) } else { - upwardSpaceHeight += calcSubtractSpace(parent, 'bottom'); + upwardSpaceHeight += calcSubtractSpace(parent, 'bottom') } } else if (isNumber(upwardLvlOrClass)) { if (upwardLvlOrClass > 0) { - upwardSpaceHeight += calcSubtractSpace(parent, 'bottom'); - upward(parent, --upwardLvlOrClass); + upwardSpaceHeight += calcSubtractSpace(parent, 'bottom') + upward(parent, --upwardLvlOrClass) } } } } } if (isRef(upwardSpace)) { - upward(anchorEl, unref(upwardSpace)); + upward(anchorEl, unref(upwardSpace)) } else { - upward(anchorEl, upwardSpace); + upward(anchorEl, upwardSpace) } let height = @@ -147,45 +147,45 @@ export function useContentHeight( unref(offsetHeightRef) - substractHeight - substractSpaceHeight - - upwardSpaceHeight; + upwardSpaceHeight // compensation height const calcCompensationHeight = () => { compensationHeight.elements?.forEach((item) => { - height += getEl(unref(item))?.offsetHeight ?? 0; - }); - }; + height += getEl(unref(item))?.offsetHeight ?? 0 + }) + } if (compensationHeight.useLayoutFooter && unref(layoutFooterHeightRef) > 0) { - calcCompensationHeight(); + calcCompensationHeight() } else { - calcCompensationHeight(); + calcCompensationHeight() } - contentHeight.value = height; + contentHeight.value = height } onMountedOrActivated(() => { nextTick(() => { - calcContentHeight(); - }); - }); + calcContentHeight() + }) + }) useWindowSizeFn( () => { - calcContentHeight(); + calcContentHeight() }, 50, { immediate: true }, - ); + ) watch( () => [layoutFooterHeightRef.value], () => { - calcContentHeight(); + calcContentHeight() }, { flush: 'post', immediate: true, }, - ); + ) - return { redoHeight, setCompensation, contentHeight }; + return { redoHeight, setCompensation, contentHeight } } diff --git a/src/hooks/web/useContextMenu.ts b/src/hooks/web/useContextMenu.ts deleted file mode 100644 index d3c53ce6..00000000 --- a/src/hooks/web/useContextMenu.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { onUnmounted, getCurrentInstance } from 'vue'; -import { createContextMenu, destroyContextMenu } from '/@/components/ContextMenu'; -import type { ContextMenuItem } from '/@/components/ContextMenu'; -export type { ContextMenuItem }; -export function useContextMenu(authRemove = true) { - if (getCurrentInstance() && authRemove) { - onUnmounted(() => { - destroyContextMenu(); - }); - } - return [createContextMenu, destroyContextMenu]; -} diff --git a/src/hooks/web/useCopyToClipboard.ts b/src/hooks/web/useCopyToClipboard.ts index 69abf26d..ebe1a8c0 100644 --- a/src/hooks/web/useCopyToClipboard.ts +++ b/src/hooks/web/useCopyToClipboard.ts @@ -1,69 +1,68 @@ -import { ref, watch } from 'vue'; +import { ref, watch } from 'vue' -import { isDef } from '/@/utils/is'; +import { isDef } from '/@/utils/is' interface Options { - target?: HTMLElement; + target?: HTMLElement } export function useCopyToClipboard(initial?: string) { - const clipboardRef = ref(initial || ''); - const isSuccessRef = ref(false); - const copiedRef = ref(false); + const clipboardRef = ref(initial || '') + const isSuccessRef = ref(false) + const copiedRef = ref(false) watch( clipboardRef, (str?: string) => { if (isDef(str)) { - copiedRef.value = true; - isSuccessRef.value = copyTextToClipboard(str); + copiedRef.value = true + isSuccessRef.value = copyTextToClipboard(str) } }, { immediate: !!initial, flush: 'sync' }, - ); + ) - return { clipboardRef, isSuccessRef, copiedRef }; + return { clipboardRef, isSuccessRef, copiedRef } } export function copyTextToClipboard(input: string, { target = document.body }: Options = {}) { - const element = document.createElement('textarea'); - const previouslyFocusedElement = document.activeElement; + const element = document.createElement('textarea') + const previouslyFocusedElement = document.activeElement - element.value = input; + element.value = input - element.setAttribute('readonly', ''); + element.setAttribute('readonly', '') + ;(element.style as any).contain = 'strict' + element.style.position = 'absolute' + element.style.left = '-9999px' + element.style.fontSize = '12pt' - (element.style as any).contain = 'strict'; - element.style.position = 'absolute'; - element.style.left = '-9999px'; - element.style.fontSize = '12pt'; - - const selection = document.getSelection(); - let originalRange; + const selection = document.getSelection() + let originalRange if (selection && selection.rangeCount > 0) { - originalRange = selection.getRangeAt(0); + originalRange = selection.getRangeAt(0) } - target.append(element); - element.select(); + target.append(element) + element.select() - element.selectionStart = 0; - element.selectionEnd = input.length; + element.selectionStart = 0 + element.selectionEnd = input.length - let isSuccess = false; + let isSuccess = false try { - isSuccess = document.execCommand('copy'); + isSuccess = document.execCommand('copy') } catch (e: any) { - throw new Error(e); + throw new Error(e) } - element.remove(); + element.remove() if (originalRange && selection) { - selection.removeAllRanges(); - selection.addRange(originalRange); + selection.removeAllRanges() + selection.addRange(originalRange) } if (previouslyFocusedElement) { - (previouslyFocusedElement as HTMLElement).focus(); + ;(previouslyFocusedElement as HTMLElement).focus() } - return isSuccess; + return isSuccess } diff --git a/src/hooks/web/useDesign.ts b/src/hooks/web/useDesign.ts index 046674b6..f32b1463 100644 --- a/src/hooks/web/useDesign.ts +++ b/src/hooks/web/useDesign.ts @@ -1,8 +1,8 @@ -import { useAppProviderContext } from '/@/components/Application'; +import { useAppProviderContext } from '/@/components/Application' // import { computed } from 'vue'; // import { lowerFirst } from 'lodash-es'; export function useDesign(scope: string) { - const values = useAppProviderContext(); + const values = useAppProviderContext() // const $style = cssModule ? useCssModule() : {}; // const style: Record = {}; @@ -18,5 +18,5 @@ export function useDesign(scope: string) { prefixCls: `${values.prefixCls}-${scope}`, prefixVar: values.prefixCls, // style, - }; + } } diff --git a/src/hooks/web/useECharts.ts b/src/hooks/web/useECharts.ts index cdc02efc..13b3b94a 100644 --- a/src/hooks/web/useECharts.ts +++ b/src/hooks/web/useECharts.ts @@ -1,81 +1,81 @@ -import type { EChartsOption } from 'echarts'; -import type { Ref } from 'vue'; -import { useTimeoutFn } from '/@/hooks/core/useTimeout'; -import { tryOnUnmounted } from '@vueuse/core'; -import { unref, nextTick, watch, computed, ref } from 'vue'; -import { useDebounceFn } from '@vueuse/core'; -import { useEventListener } from '/@/hooks/event/useEventListener'; -import { useBreakpoint } from '/@/hooks/event/useBreakpoint'; -import echarts from '/@/utils/lib/echarts'; -import { useRootSetting } from '/@/hooks/setting/useRootSetting'; +import type { EChartsOption } from 'echarts' +import type { Ref } from 'vue' +import { useTimeoutFn } from '/@/hooks/core/useTimeout' +import { tryOnUnmounted } from '@vueuse/core' +import { unref, nextTick, watch, computed, ref } from 'vue' +import { useDebounceFn } from '@vueuse/core' +import { useEventListener } from '/@/hooks/event/useEventListener' +import { useBreakpoint } from '/@/hooks/event/useBreakpoint' +import echarts from '/@/utils/lib/echarts' +import { useRootSetting } from '/@/hooks/setting/useRootSetting' export function useECharts( elRef: Ref, theme: 'light' | 'dark' | 'default' = 'default', ) { - const { getDarkMode: getSysDarkMode } = useRootSetting(); + const { getDarkMode: getSysDarkMode } = useRootSetting() const getDarkMode = computed(() => { - return theme === 'default' ? getSysDarkMode.value : theme; - }); - let chartInstance: echarts.ECharts | null = null; - let resizeFn: Fn = resize; - const cacheOptions = ref({}) as Ref; - let removeResizeFn: Fn = () => {}; + return theme === 'default' ? getSysDarkMode.value : theme + }) + let chartInstance: echarts.ECharts | null = null + let resizeFn: Fn = resize + const cacheOptions = ref({}) as Ref + let removeResizeFn: Fn = () => {} - resizeFn = useDebounceFn(resize, 200); + resizeFn = useDebounceFn(resize, 200) const getOptions = computed(() => { if (getDarkMode.value !== 'dark') { - return cacheOptions.value as EChartsOption; + return cacheOptions.value as EChartsOption } return { backgroundColor: 'transparent', ...cacheOptions.value, - } as EChartsOption; - }); + } as EChartsOption + }) function initCharts(t = theme) { - const el = unref(elRef); + const el = unref(elRef) if (!el || !unref(el)) { - return; + return } - chartInstance = echarts.init(el, t); + chartInstance = echarts.init(el, t) const { removeEvent } = useEventListener({ el: window, name: 'resize', listener: resizeFn, - }); - removeResizeFn = removeEvent; - const { widthRef, screenEnum } = useBreakpoint(); + }) + removeResizeFn = removeEvent + const { widthRef, screenEnum } = useBreakpoint() if (unref(widthRef) <= screenEnum.MD || el.offsetHeight === 0) { useTimeoutFn(() => { - resizeFn(); - }, 30); + resizeFn() + }, 30) } } function setOptions(options: EChartsOption, clear = true) { - cacheOptions.value = options; + cacheOptions.value = options if (unref(elRef)?.offsetHeight === 0) { useTimeoutFn(() => { - setOptions(unref(getOptions)); - }, 30); - return; + setOptions(unref(getOptions)) + }, 30) + return } nextTick(() => { useTimeoutFn(() => { if (!chartInstance) { - initCharts(getDarkMode.value as 'default'); + initCharts(getDarkMode.value as 'default') - if (!chartInstance) return; + if (!chartInstance) return } - clear && chartInstance?.clear(); + clear && chartInstance?.clear() - chartInstance?.setOption(unref(getOptions)); - }, 30); - }); + chartInstance?.setOption(unref(getOptions)) + }, 30) + }) } function resize() { @@ -84,32 +84,32 @@ export function useECharts( duration: 300, easing: 'quadraticIn', }, - }); + }) } watch( () => getDarkMode.value, (theme) => { if (chartInstance) { - chartInstance.dispose(); - initCharts(theme as 'default'); - setOptions(cacheOptions.value); + chartInstance.dispose() + initCharts(theme as 'default') + setOptions(cacheOptions.value) } }, - ); + ) tryOnUnmounted(() => { - if (!chartInstance) return; - removeResizeFn(); - chartInstance.dispose(); - chartInstance = null; - }); + if (!chartInstance) return + removeResizeFn() + chartInstance.dispose() + chartInstance = null + }) function getInstance(): echarts.ECharts | null { if (!chartInstance) { - initCharts(getDarkMode.value as 'default'); + initCharts(getDarkMode.value as 'default') } - return chartInstance; + return chartInstance } return { @@ -117,5 +117,5 @@ export function useECharts( resize, echarts, getInstance, - }; + } } diff --git a/src/hooks/web/useFullContent.ts b/src/hooks/web/useFullContent.ts index 7dea0770..d6ca5ebd 100644 --- a/src/hooks/web/useFullContent.ts +++ b/src/hooks/web/useFullContent.ts @@ -1,28 +1,28 @@ -import { computed, unref } from 'vue'; +import { computed, unref } from 'vue' -import { useAppStore } from '/@/store/modules/app'; +import { useAppStore } from '/@/store/modules/app' -import { useRouter } from 'vue-router'; +import { useRouter } from 'vue-router' /** * @description: Full screen display content */ export const useFullContent = () => { - const appStore = useAppStore(); - const router = useRouter(); - const { currentRoute } = router; + const appStore = useAppStore() + const router = useRouter() + const { currentRoute } = router // Whether to display the content in full screen without displaying the menu const getFullContent = computed(() => { // Query parameters, the full screen is displayed when the address bar has a full parameter - const route = unref(currentRoute); - const query = route.query; + const route = unref(currentRoute) + const query = route.query if (query && Reflect.has(query, '__full__')) { - return true; + return true } // Return to the configuration in the configuration file - return appStore.getProjectConfig.fullContent; - }); + return appStore.getProjectConfig.fullContent + }) - return { getFullContent }; -}; + return { getFullContent } +} diff --git a/src/hooks/web/useI18n.ts b/src/hooks/web/useI18n.ts index 2a777b78..e1a960e9 100644 --- a/src/hooks/web/useI18n.ts +++ b/src/hooks/web/useI18n.ts @@ -1,50 +1,50 @@ -import { i18n } from '/@/locales/setupI18n'; +import { i18n } from '/@/locales/setupI18n' type I18nGlobalTranslation = { - (key: string): string; - (key: string, locale: string): string; - (key: string, locale: string, list: unknown[]): string; - (key: string, locale: string, named: Record): string; - (key: string, list: unknown[]): string; - (key: string, named: Record): string; -}; + (key: string): string + (key: string, locale: string): string + (key: string, locale: string, list: unknown[]): string + (key: string, locale: string, named: Record): string + (key: string, list: unknown[]): string + (key: string, named: Record): string +} -type I18nTranslationRestParameters = [string, any]; +type I18nTranslationRestParameters = [string, any] function getKey(namespace: string | undefined, key: string) { if (!namespace) { - return key; + return key } if (key.startsWith(namespace)) { - return key; + return key } - return `${namespace}.${key}`; + return `${namespace}.${key}` } export function useI18n(namespace?: string): { - t: I18nGlobalTranslation; + t: I18nGlobalTranslation } { const normalFn = { t: (key: string) => { - return getKey(namespace, key); + return getKey(namespace, key) }, - }; - - if (!i18n) { - return normalFn; } - const { t, ...methods } = i18n.global; + if (!i18n) { + return normalFn + } + + const { t, ...methods } = i18n.global const tFn: I18nGlobalTranslation = (key: string, ...arg: any[]) => { - if (!key) return ''; - if (!key.includes('.') && !namespace) return key; - return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters)); - }; + if (!key) return '' + if (!key.includes('.') && !namespace) return key + return t(getKey(namespace, key), ...(arg as I18nTranslationRestParameters)) + } return { ...methods, t: tFn, - }; + } } // Why write this function? @@ -52,4 +52,4 @@ export function useI18n(namespace?: string): { // 为什么要编写此函数? // 主要用于配合vscode i18nn ally插件。此功能仅用于路由和菜单。请在其他地方使用useI18n -export const t = (key: string) => key; +export const t = (key: string) => key diff --git a/src/hooks/web/useLockPage.ts b/src/hooks/web/useLockPage.ts deleted file mode 100644 index c543be95..00000000 --- a/src/hooks/web/useLockPage.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { computed, onUnmounted, unref, watchEffect } from 'vue'; -import { useThrottleFn } from '@vueuse/core'; - -import { useAppStore } from '/@/store/modules/app'; -import { useLockStore } from '/@/store/modules/lock'; - -import { useUserStore } from '/@/store/modules/user'; -import { useRootSetting } from '../setting/useRootSetting'; - -export function useLockPage() { - const { getLockTime } = useRootSetting(); - const lockStore = useLockStore(); - const userStore = useUserStore(); - const appStore = useAppStore(); - - let timeId: TimeoutHandle; - - function clear(): void { - window.clearTimeout(timeId); - } - - function resetCalcLockTimeout(): void { - // not login - if (!userStore.getToken) { - clear(); - return; - } - const lockTime = appStore.getProjectConfig.lockTime; - if (!lockTime || lockTime < 1) { - clear(); - return; - } - clear(); - - timeId = setTimeout(() => { - lockPage(); - }, lockTime * 60 * 1000); - } - - function lockPage(): void { - lockStore.setLockInfo({ - isLock: true, - pwd: undefined, - }); - } - - watchEffect((onClean) => { - if (userStore.getToken) { - resetCalcLockTimeout(); - } else { - clear(); - } - onClean(() => { - clear(); - }); - }); - - onUnmounted(() => { - clear(); - }); - - const keyupFn = useThrottleFn(resetCalcLockTimeout, 2000); - - return computed(() => { - if (unref(getLockTime)) { - return { onKeyup: keyupFn, onMousemove: keyupFn }; - } else { - clear(); - return {}; - } - }); -} diff --git a/src/hooks/web/useMessage.tsx b/src/hooks/web/useMessage.tsx index 91112f34..23fe44b2 100644 --- a/src/hooks/web/useMessage.tsx +++ b/src/hooks/web/useMessage.tsx @@ -1,56 +1,56 @@ -import type { ModalFunc, ModalFuncProps } from 'ant-design-vue/lib/modal/Modal'; +import type { ModalFunc, ModalFuncProps } from 'ant-design-vue/lib/modal/Modal' -import { Modal, message as Message, notification } from 'ant-design-vue'; -import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue'; +import { Modal, message as Message, notification } from 'ant-design-vue' +import { InfoCircleFilled, CheckCircleFilled, CloseCircleFilled } from '@ant-design/icons-vue' -import { NotificationArgsProps, ConfigProps } from 'ant-design-vue/lib/notification'; -import { useI18n } from './useI18n'; -import { isString } from '/@/utils/is'; +import { NotificationArgsProps, ConfigProps } from 'ant-design-vue/lib/notification' +import { useI18n } from './useI18n' +import { isString } from '/@/utils/is' export interface NotifyApi { - info(config: NotificationArgsProps): void; - success(config: NotificationArgsProps): void; - error(config: NotificationArgsProps): void; - warn(config: NotificationArgsProps): void; - warning(config: NotificationArgsProps): void; - open(args: NotificationArgsProps): void; - close(key: String): void; - config(options: ConfigProps): void; - destroy(): void; + info(config: NotificationArgsProps): void + success(config: NotificationArgsProps): void + error(config: NotificationArgsProps): void + warn(config: NotificationArgsProps): void + warning(config: NotificationArgsProps): void + open(args: NotificationArgsProps): void + close(key: String): void + config(options: ConfigProps): void + destroy(): void } -export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight'; -export declare type IconType = 'success' | 'info' | 'error' | 'warning'; +export declare type NotificationPlacement = 'topLeft' | 'topRight' | 'bottomLeft' | 'bottomRight' +export declare type IconType = 'success' | 'info' | 'error' | 'warning' export interface ModalOptionsEx extends Omit { - iconType: 'warning' | 'success' | 'error' | 'info'; + iconType: 'warning' | 'success' | 'error' | 'info' } -export type ModalOptionsPartial = Partial & Pick; +export type ModalOptionsPartial = Partial & Pick interface ConfirmOptions { - info: ModalFunc; - success: ModalFunc; - error: ModalFunc; - warn: ModalFunc; - warning: ModalFunc; + info: ModalFunc + success: ModalFunc + error: ModalFunc + warn: ModalFunc + warning: ModalFunc } function getIcon(iconType: string) { if (iconType === 'warning') { - return ; + return } else if (iconType === 'success') { - return ; + return } else if (iconType === 'info') { - return ; + return } else { - return ; + return } } function renderContent({ content }: Pick) { if (isString(content)) { - return

${content as string}
`}>; + return
${content as string}
`}> } else { - return content; + return content } } @@ -58,24 +58,24 @@ function renderContent({ content }: Pick) { * @description: Create confirmation box */ function createConfirm(options: ModalOptionsEx): ConfirmOptions { - const iconType = options.iconType || 'warning'; - Reflect.deleteProperty(options, 'iconType'); + const iconType = options.iconType || 'warning' + Reflect.deleteProperty(options, 'iconType') const opt: ModalFuncProps = { centered: true, icon: getIcon(iconType), ...options, content: renderContent(options), - }; - return Modal.confirm(opt) as unknown as ConfirmOptions; + } + return Modal.confirm(opt) as unknown as ConfirmOptions } const getBaseOptions = () => { - const { t } = useI18n(); + const { t } = useI18n() return { okText: t('common.okText'), centered: true, - }; -}; + } +} function createModalOptions(options: ModalOptionsPartial, icon: string): ModalOptionsPartial { return { @@ -83,29 +83,29 @@ function createModalOptions(options: ModalOptionsPartial, icon: string): ModalOp ...options, content: renderContent(options), icon: getIcon(icon), - }; + } } function createSuccessModal(options: ModalOptionsPartial) { - return Modal.success(createModalOptions(options, 'success')); + return Modal.success(createModalOptions(options, 'success')) } function createErrorModal(options: ModalOptionsPartial) { - return Modal.error(createModalOptions(options, 'close')); + return Modal.error(createModalOptions(options, 'close')) } function createInfoModal(options: ModalOptionsPartial) { - return Modal.info(createModalOptions(options, 'info')); + return Modal.info(createModalOptions(options, 'info')) } function createWarningModal(options: ModalOptionsPartial) { - return Modal.warning(createModalOptions(options, 'warning')); + return Modal.warning(createModalOptions(options, 'warning')) } notification.config({ placement: 'topRight', duration: 3, -}); +}) /** * @description: message @@ -119,5 +119,5 @@ export function useMessage() { createErrorModal, createInfoModal, createWarningModal, - }; + } } diff --git a/src/hooks/web/usePage.ts b/src/hooks/web/usePage.ts index 06180705..78a405d9 100644 --- a/src/hooks/web/usePage.ts +++ b/src/hooks/web/usePage.ts @@ -1,53 +1,53 @@ -import type { RouteLocationRaw, Router } from 'vue-router'; +import type { RouteLocationRaw, Router } from 'vue-router' -import { PageEnum } from '/@/enums/pageEnum'; -import { unref } from 'vue'; +import { PageEnum } from '/@/enums/pageEnum' +import { unref } from 'vue' -import { useRouter } from 'vue-router'; -import { REDIRECT_NAME } from '/@/router/constant'; +import { useRouter } from 'vue-router' +import { REDIRECT_NAME } from '/@/router/constant' -export type PathAsPageEnum = T extends { path: string } ? T & { path: PageEnum } : T; -export type RouteLocationRawEx = PathAsPageEnum; +export type PathAsPageEnum = T extends { path: string } ? T & { path: PageEnum } : T +export type RouteLocationRawEx = PathAsPageEnum function handleError(e: Error) { - console.error(e); + console.error(e) } /** * page switch */ export function useGo(_router?: Router) { - const { push, replace } = _router || useRouter(); + const { push, replace } = _router || useRouter() function go(opt: RouteLocationRawEx = PageEnum.BASE_HOME, isReplace = false) { if (!opt) { - return; + return } - isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError); + isReplace ? replace(opt).catch(handleError) : push(opt).catch(handleError) } - return go; + return go } /** * @description: redo current page */ export const useRedo = (_router?: Router) => { - const { replace, currentRoute } = _router || useRouter(); - const { query, params = {}, name, fullPath } = unref(currentRoute.value); + const { replace, currentRoute } = _router || useRouter() + const { query, params = {}, name, fullPath } = unref(currentRoute.value) function redo(): Promise { return new Promise((resolve) => { if (name === REDIRECT_NAME) { - resolve(false); - return; + resolve(false) + return } if (name && Object.keys(params).length > 0) { - params['_redirect_type'] = 'name'; - params['path'] = String(name); + params['_redirect_type'] = 'name' + params['path'] = String(name) } else { - params['_redirect_type'] = 'path'; - params['path'] = fullPath; + params['_redirect_type'] = 'path' + params['path'] = fullPath } - replace({ name: REDIRECT_NAME, params, query }).then(() => resolve(true)); - }); + replace({ name: REDIRECT_NAME, params, query }).then(() => resolve(true)) + }) } - return redo; -}; + return redo +} diff --git a/src/hooks/web/usePagination.ts b/src/hooks/web/usePagination.ts index 1e199139..bf630785 100644 --- a/src/hooks/web/usePagination.ts +++ b/src/hooks/web/usePagination.ts @@ -1,34 +1,34 @@ -import type { Ref } from 'vue'; -import { ref, unref, computed } from 'vue'; +import type { Ref } from 'vue' +import { ref, unref, computed } from 'vue' function pagination(list: T[], pageNo: number, pageSize: number): T[] { - const offset = (pageNo - 1) * Number(pageSize); + const offset = (pageNo - 1) * Number(pageSize) const ret = offset + Number(pageSize) >= list.length ? list.slice(offset, list.length) - : list.slice(offset, offset + Number(pageSize)); - return ret; + : list.slice(offset, offset + Number(pageSize)) + return ret } export function usePagination(list: Ref, pageSize: number) { - const currentPage = ref(1); - const pageSizeRef = ref(pageSize); + const currentPage = ref(1) + const pageSizeRef = ref(pageSize) const getPaginationList = computed(() => { - return pagination(unref(list), unref(currentPage), unref(pageSizeRef)); - }); + return pagination(unref(list), unref(currentPage), unref(pageSizeRef)) + }) const getTotal = computed(() => { - return unref(list).length; - }); + return unref(list).length + }) function setCurrentPage(page: number) { - currentPage.value = page; + currentPage.value = page } function setPageSize(pageSize: number) { - pageSizeRef.value = pageSize; + pageSizeRef.value = pageSize } - return { setCurrentPage, getTotal, setPageSize, getPaginationList }; + return { setCurrentPage, getTotal, setPageSize, getPaginationList } } diff --git a/src/hooks/web/usePermission.ts b/src/hooks/web/usePermission.ts index bfff591d..069e7534 100644 --- a/src/hooks/web/usePermission.ts +++ b/src/hooks/web/usePermission.ts @@ -1,28 +1,28 @@ -import type { RouteRecordRaw } from 'vue-router'; +import type { RouteRecordRaw } from 'vue-router' -import { useAppStore } from '/@/store/modules/app'; -import { usePermissionStore } from '/@/store/modules/permission'; -import { useUserStore } from '/@/store/modules/user'; +import { useAppStore } from '/@/store/modules/app' +import { usePermissionStore } from '/@/store/modules/permission' +import { useUserStore } from '/@/store/modules/user' -import { useTabs } from './useTabs'; +import { useTabs } from './useTabs' -import { router, resetRouter } from '/@/router'; +import { router, resetRouter } from '/@/router' // import { RootRoute } from '/@/router/routes'; -import projectSetting from '/@/settings/projectSetting'; -import { PermissionModeEnum } from '/@/enums/appEnum'; -import { RoleEnum } from '/@/enums/roleEnum'; +import projectSetting from '/@/settings/projectSetting' +import { PermissionModeEnum } from '/@/enums/appEnum' +import { RoleEnum } from '/@/enums/roleEnum' -import { intersection } from 'lodash-es'; -import { isArray } from '/@/utils/is'; -import { useMultipleTabStore } from '/@/store/modules/multipleTab'; +import { intersection } from 'lodash-es' +import { isArray } from '/@/utils/is' +import { useMultipleTabStore } from '/@/store/modules/multipleTab' // User permissions related operations export function usePermission() { - const userStore = useUserStore(); - const appStore = useAppStore(); - const permissionStore = usePermissionStore(); - const { closeAll } = useTabs(router); + const userStore = useUserStore() + const appStore = useAppStore() + const permissionStore = usePermissionStore() + const { closeAll } = useTabs(router) /** * Change permission mode @@ -33,8 +33,8 @@ export function usePermission() { projectSetting.permissionMode === PermissionModeEnum.BACK ? PermissionModeEnum.ROUTE_MAPPING : PermissionModeEnum.BACK, - }); - location.reload(); + }) + location.reload() } /** @@ -43,15 +43,15 @@ export function usePermission() { * @param id */ async function resume() { - const tabStore = useMultipleTabStore(); - tabStore.clearCacheTabs(); - resetRouter(); - const routes = await permissionStore.buildRoutesAction(); + const tabStore = useMultipleTabStore() + tabStore.clearCacheTabs() + resetRouter() + const routes = await permissionStore.buildRoutesAction() routes.forEach((route) => { - router.addRoute(route as unknown as RouteRecordRaw); - }); - permissionStore.setLastBuildMenuTime(); - closeAll(); + router.addRoute(route as unknown as RouteRecordRaw) + }) + permissionStore.setLastBuildMenuTime() + closeAll() } /** @@ -60,26 +60,26 @@ export function usePermission() { function hasPermission(value?: RoleEnum | RoleEnum[] | string | string[], def = true): boolean { // Visible by default if (!value) { - return def; + return def } - const permMode = projectSetting.permissionMode; + const permMode = projectSetting.permissionMode if ([PermissionModeEnum.ROUTE_MAPPING, PermissionModeEnum.ROLE].includes(permMode)) { if (!isArray(value)) { - return userStore.getRoleList?.includes(value as RoleEnum); + return userStore.getRoleList?.includes(value as RoleEnum) } - return (intersection(value, userStore.getRoleList) as RoleEnum[]).length > 0; + return (intersection(value, userStore.getRoleList) as RoleEnum[]).length > 0 } if (PermissionModeEnum.BACK === permMode) { - const allCodeList = permissionStore.getPermCodeList as string[]; + const allCodeList = permissionStore.getPermCodeList as string[] if (!isArray(value)) { - return allCodeList.includes(value); + return allCodeList.includes(value) } - return (intersection(value, allCodeList) as string[]).length > 0; + return (intersection(value, allCodeList) as string[]).length > 0 } - return true; + return true } /** @@ -90,22 +90,22 @@ export function usePermission() { if (projectSetting.permissionMode !== PermissionModeEnum.ROUTE_MAPPING) { throw new Error( 'Please switch PermissionModeEnum to ROUTE_MAPPING mode in the configuration to operate!', - ); + ) } if (!isArray(roles)) { - roles = [roles]; + roles = [roles] } - userStore.setRoleList(roles); - await resume(); + userStore.setRoleList(roles) + await resume() } /** * refresh menu data */ async function refreshMenu() { - resume(); + resume() } - return { changeRole, hasPermission, togglePermissionMode, refreshMenu }; + return { changeRole, hasPermission, togglePermissionMode, refreshMenu } } diff --git a/src/hooks/web/useScript.ts b/src/hooks/web/useScript.ts index 9707116a..70f8afe1 100644 --- a/src/hooks/web/useScript.ts +++ b/src/hooks/web/useScript.ts @@ -1,46 +1,46 @@ -import { onMounted, onUnmounted, ref } from 'vue'; +import { onMounted, onUnmounted, ref } from 'vue' interface ScriptOptions { - src: string; + src: string } export function useScript(opts: ScriptOptions) { - const isLoading = ref(false); - const error = ref(false); - const success = ref(false); - let script: HTMLScriptElement; + const isLoading = ref(false) + const error = ref(false) + const success = ref(false) + let script: HTMLScriptElement const promise = new Promise((resolve, reject) => { onMounted(() => { - script = document.createElement('script'); - script.type = 'text/javascript'; + script = document.createElement('script') + script.type = 'text/javascript' script.onload = function () { - isLoading.value = false; - success.value = true; - error.value = false; - resolve(''); - }; + isLoading.value = false + success.value = true + error.value = false + resolve('') + } script.onerror = function (err) { - isLoading.value = false; - success.value = false; - error.value = true; - reject(err); - }; + isLoading.value = false + success.value = false + error.value = true + reject(err) + } - script.src = opts.src; - document.head.appendChild(script); - }); - }); + script.src = opts.src + document.head.appendChild(script) + }) + }) onUnmounted(() => { - script && script.remove(); - }); + script && script.remove() + }) return { isLoading, error, success, toPromise: () => promise, - }; + } } diff --git a/src/hooks/web/useSortable.ts b/src/hooks/web/useSortable.ts index 4c66b6af..626fbbd3 100644 --- a/src/hooks/web/useSortable.ts +++ b/src/hooks/web/useSortable.ts @@ -1,21 +1,21 @@ -import { nextTick, unref } from 'vue'; -import type { Ref } from 'vue'; -import type { Options } from 'sortablejs'; +import { nextTick, unref } from 'vue' +import type { Ref } from 'vue' +import type { Options } from 'sortablejs' export function useSortable(el: HTMLElement | Ref, options?: Options) { function initSortable() { nextTick(async () => { - if (!el) return; + if (!el) return - const Sortable = (await import('sortablejs')).default; + const Sortable = (await import('sortablejs')).default Sortable.create(unref(el), { animation: 500, delay: 400, delayOnTouchOnly: true, ...options, - }); - }); + }) + }) } - return { initSortable }; + return { initSortable } } diff --git a/src/hooks/web/useTabs.ts b/src/hooks/web/useTabs.ts index 14dde2f8..d7163840 100644 --- a/src/hooks/web/useTabs.ts +++ b/src/hooks/web/useTabs.ts @@ -1,10 +1,10 @@ -import type { RouteLocationNormalized, Router } from 'vue-router'; +import type { RouteLocationNormalized, Router } from 'vue-router' -import { useRouter } from 'vue-router'; -import { unref } from 'vue'; +import { useRouter } from 'vue-router' +import { unref } from 'vue' -import { useMultipleTabStore } from '/@/store/modules/multipleTab'; -import { useAppStore } from '/@/store/modules/app'; +import { useMultipleTabStore } from '/@/store/modules/multipleTab' +import { useAppStore } from '/@/store/modules/app' enum TableActionEnum { REFRESH, @@ -17,75 +17,75 @@ enum TableActionEnum { } export function useTabs(_router?: Router) { - const appStore = useAppStore(); + const appStore = useAppStore() function canIUseTabs(): boolean { - const { show } = appStore.getMultiTabsSetting; + const { show } = appStore.getMultiTabsSetting if (!show) { - throw new Error('The multi-tab page is currently not open, please open it in the settings!'); + throw new Error('The multi-tab page is currently not open, please open it in the settings!') } - return !!show; + return !!show } - const tabStore = useMultipleTabStore(); - const router = _router || useRouter(); + const tabStore = useMultipleTabStore() + const router = _router || useRouter() - const { currentRoute } = router; + const { currentRoute } = router function getCurrentTab() { - const route = unref(currentRoute); - return tabStore.getTabList.find((item) => item.fullPath === route.fullPath)!; + const route = unref(currentRoute) + return tabStore.getTabList.find((item) => item.fullPath === route.fullPath)! } async function updateTabTitle(title: string, tab?: RouteLocationNormalized) { - const canIUse = canIUseTabs; + const canIUse = canIUseTabs if (!canIUse) { - return; + return } - const targetTab = tab || getCurrentTab(); - await tabStore.setTabTitle(title, targetTab); + const targetTab = tab || getCurrentTab() + await tabStore.setTabTitle(title, targetTab) } async function updateTabPath(path: string, tab?: RouteLocationNormalized) { - const canIUse = canIUseTabs; + const canIUse = canIUseTabs if (!canIUse) { - return; + return } - const targetTab = tab || getCurrentTab(); - await tabStore.updateTabPath(path, targetTab); + const targetTab = tab || getCurrentTab() + await tabStore.updateTabPath(path, targetTab) } async function handleTabAction(action: TableActionEnum, tab?: RouteLocationNormalized) { - const canIUse = canIUseTabs; + const canIUse = canIUseTabs if (!canIUse) { - return; + return } - const currentTab = getCurrentTab(); + const currentTab = getCurrentTab() switch (action) { case TableActionEnum.REFRESH: - await tabStore.refreshPage(router); - break; + await tabStore.refreshPage(router) + break case TableActionEnum.CLOSE_ALL: - await tabStore.closeAllTab(router); - break; + await tabStore.closeAllTab(router) + break case TableActionEnum.CLOSE_LEFT: - await tabStore.closeLeftTabs(currentTab, router); - break; + await tabStore.closeLeftTabs(currentTab, router) + break case TableActionEnum.CLOSE_RIGHT: - await tabStore.closeRightTabs(currentTab, router); - break; + await tabStore.closeRightTabs(currentTab, router) + break case TableActionEnum.CLOSE_OTHER: - await tabStore.closeOtherTabs(currentTab, router); - break; + await tabStore.closeOtherTabs(currentTab, router) + break case TableActionEnum.CLOSE_CURRENT: case TableActionEnum.CLOSE: - await tabStore.closeTab(tab || currentTab, router); - break; + await tabStore.closeTab(tab || currentTab, router) + break } } @@ -99,5 +99,5 @@ export function useTabs(_router?: Router) { close: (tab?: RouteLocationNormalized) => handleTabAction(TableActionEnum.CLOSE, tab), setTitle: (title: string, tab?: RouteLocationNormalized) => updateTabTitle(title, tab), updatePath: (fullPath: string, tab?: RouteLocationNormalized) => updateTabPath(fullPath, tab), - }; + } } diff --git a/src/hooks/web/useTitle.ts b/src/hooks/web/useTitle.ts index a7f48d85..13b7845e 100644 --- a/src/hooks/web/useTitle.ts +++ b/src/hooks/web/useTitle.ts @@ -1,35 +1,35 @@ -import { watch, unref } from 'vue'; -import { useI18n } from '/@/hooks/web/useI18n'; -import { useTitle as usePageTitle } from '@vueuse/core'; -import { useGlobSetting } from '/@/hooks/setting'; -import { useRouter } from 'vue-router'; -import { useLocaleStore } from '/@/store/modules/locale'; +import { watch, unref } from 'vue' +import { useI18n } from '/@/hooks/web/useI18n' +import { useTitle as usePageTitle } from '@vueuse/core' +import { useGlobSetting } from '/@/hooks/setting' +import { useRouter } from 'vue-router' +import { useLocaleStore } from '/@/store/modules/locale' -import { REDIRECT_NAME } from '/@/router/constant'; +import { REDIRECT_NAME } from '/@/router/constant' /** * Listening to page changes and dynamically changing site titles */ export function useTitle() { - const { title } = useGlobSetting(); - const { t } = useI18n(); - const { currentRoute } = useRouter(); - const localeStore = useLocaleStore(); + const { title } = useGlobSetting() + const { t } = useI18n() + const { currentRoute } = useRouter() + const localeStore = useLocaleStore() - const pageTitle = usePageTitle(); + const pageTitle = usePageTitle() watch( [() => currentRoute.value.path, () => localeStore.getLocale], () => { - const route = unref(currentRoute); + const route = unref(currentRoute) if (route.name === REDIRECT_NAME) { - return; + return } - const tTitle = t(route?.meta?.title as string); - pageTitle.value = tTitle ? ` ${tTitle} - ${title} ` : `${title}`; + const tTitle = t(route?.meta?.title as string) + pageTitle.value = tTitle ? ` ${tTitle} - ${title} ` : `${title}` }, { immediate: true }, - ); + ) } diff --git a/src/hooks/web/useWatermark.ts b/src/hooks/web/useWatermark.ts index a42b84b2..e5ddee91 100644 --- a/src/hooks/web/useWatermark.ts +++ b/src/hooks/web/useWatermark.ts @@ -1,100 +1,100 @@ -import { getCurrentInstance, onBeforeUnmount, ref, Ref, shallowRef, unref } from 'vue'; -import { useRafThrottle } from '/@/utils/domUtils'; -import { addResizeListener, removeResizeListener } from '/@/utils/event'; -import { isDef } from '/@/utils/is'; +import { getCurrentInstance, onBeforeUnmount, ref, Ref, shallowRef, unref } from 'vue' +import { useRafThrottle } from '/@/utils/domUtils' +import { addResizeListener, removeResizeListener } from '/@/utils/event' +import { isDef } from '/@/utils/is' -const domSymbol = Symbol('watermark-dom'); +const domSymbol = Symbol('watermark-dom') export function useWatermark( appendEl: Ref = ref(document.body) as Ref, ) { const func = useRafThrottle(function () { - const el = unref(appendEl); - if (!el) return; - const { clientHeight: height, clientWidth: width } = el; - updateWatermark({ height, width }); - }); - const id = domSymbol.toString(); - const watermarkEl = shallowRef(); + const el = unref(appendEl) + if (!el) return + const { clientHeight: height, clientWidth: width } = el + updateWatermark({ height, width }) + }) + const id = domSymbol.toString() + const watermarkEl = shallowRef() const clear = () => { - const domId = unref(watermarkEl); - watermarkEl.value = undefined; - const el = unref(appendEl); - if (!el) return; - domId && el.removeChild(domId); - removeResizeListener(el, func); - }; + const domId = unref(watermarkEl) + watermarkEl.value = undefined + const el = unref(appendEl) + if (!el) return + domId && el.removeChild(domId) + removeResizeListener(el, func) + } function createBase64(str: string) { - const can = document.createElement('canvas'); - const width = 300; - const height = 240; - Object.assign(can, { width, height }); + const can = document.createElement('canvas') + const width = 300 + const height = 240 + Object.assign(can, { width, height }) - const cans = can.getContext('2d'); + const cans = can.getContext('2d') if (cans) { - cans.rotate((-20 * Math.PI) / 120); - cans.font = '15px Vedana'; - cans.fillStyle = 'rgba(0, 0, 0, 0.15)'; - cans.textAlign = 'left'; - cans.textBaseline = 'middle'; - cans.fillText(str, width / 20, height); + cans.rotate((-20 * Math.PI) / 120) + cans.font = '15px Vedana' + cans.fillStyle = 'rgba(0, 0, 0, 0.15)' + cans.textAlign = 'left' + cans.textBaseline = 'middle' + cans.fillText(str, width / 20, height) } - return can.toDataURL('image/png'); + return can.toDataURL('image/png') } function updateWatermark( options: { - width?: number; - height?: number; - str?: string; + width?: number + height?: number + str?: string } = {}, ) { - const el = unref(watermarkEl); - if (!el) return; + const el = unref(watermarkEl) + if (!el) return if (isDef(options.width)) { - el.style.width = `${options.width}px`; + el.style.width = `${options.width}px` } if (isDef(options.height)) { - el.style.height = `${options.height}px`; + el.style.height = `${options.height}px` } if (isDef(options.str)) { - el.style.background = `url(${createBase64(options.str)}) left top repeat`; + el.style.background = `url(${createBase64(options.str)}) left top repeat` } } const createWatermark = (str: string) => { if (unref(watermarkEl)) { - updateWatermark({ str }); - return id; + updateWatermark({ str }) + return id } - const div = document.createElement('div'); - watermarkEl.value = div; - div.id = id; - div.style.pointerEvents = 'none'; - div.style.top = '0px'; - div.style.left = '0px'; - div.style.position = 'absolute'; - div.style.zIndex = '100000'; - const el = unref(appendEl); - if (!el) return id; - const { clientHeight: height, clientWidth: width } = el; - updateWatermark({ str, width, height }); - el.appendChild(div); - return id; - }; + const div = document.createElement('div') + watermarkEl.value = div + div.id = id + div.style.pointerEvents = 'none' + div.style.top = '0px' + div.style.left = '0px' + div.style.position = 'absolute' + div.style.zIndex = '100000' + const el = unref(appendEl) + if (!el) return id + const { clientHeight: height, clientWidth: width } = el + updateWatermark({ str, width, height }) + el.appendChild(div) + return id + } function setWatermark(str: string) { - createWatermark(str); - addResizeListener(document.documentElement, func); - const instance = getCurrentInstance(); + createWatermark(str) + addResizeListener(document.documentElement, func) + const instance = getCurrentInstance() if (instance) { onBeforeUnmount(() => { - clear(); - }); + clear() + }) } } - return { setWatermark, clear }; + return { setWatermark, clear } } diff --git a/src/layouts/default/content/index.vue b/src/layouts/default/content/index.vue index 3f6d193b..989ac775 100644 --- a/src/layouts/default/content/index.vue +++ b/src/layouts/default/content/index.vue @@ -4,30 +4,30 @@ diff --git a/src/layouts/default/header/components/notify/NoticeList.vue b/src/layouts/default/header/components/notify/NoticeList.vue index dbc09398..7e474b25 100644 --- a/src/layouts/default/header/components/notify/NoticeList.vue +++ b/src/layouts/default/header/components/notify/NoticeList.vue @@ -54,11 +54,11 @@ diff --git a/src/views/demo/comp/cropper/index.vue b/src/views/demo/comp/cropper/index.vue deleted file mode 100644 index 49a6c6c5..00000000 --- a/src/views/demo/comp/cropper/index.vue +++ /dev/null @@ -1,100 +0,0 @@ - - - - diff --git a/src/views/demo/comp/desc/index.vue b/src/views/demo/comp/desc/index.vue deleted file mode 100644 index 28736a6f..00000000 --- a/src/views/demo/comp/desc/index.vue +++ /dev/null @@ -1,85 +0,0 @@ - - diff --git a/src/views/demo/comp/drawer/Drawer1.vue b/src/views/demo/comp/drawer/Drawer1.vue deleted file mode 100644 index 7f296134..00000000 --- a/src/views/demo/comp/drawer/Drawer1.vue +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/src/views/demo/comp/drawer/Drawer2.vue b/src/views/demo/comp/drawer/Drawer2.vue deleted file mode 100644 index 020b298b..00000000 --- a/src/views/demo/comp/drawer/Drawer2.vue +++ /dev/null @@ -1,17 +0,0 @@ - - diff --git a/src/views/demo/comp/drawer/Drawer3.vue b/src/views/demo/comp/drawer/Drawer3.vue deleted file mode 100644 index 61d25dc5..00000000 --- a/src/views/demo/comp/drawer/Drawer3.vue +++ /dev/null @@ -1,35 +0,0 @@ - - diff --git a/src/views/demo/comp/drawer/Drawer4.vue b/src/views/demo/comp/drawer/Drawer4.vue deleted file mode 100644 index 454156e9..00000000 --- a/src/views/demo/comp/drawer/Drawer4.vue +++ /dev/null @@ -1,53 +0,0 @@ - - diff --git a/src/views/demo/comp/drawer/Drawer5.vue b/src/views/demo/comp/drawer/Drawer5.vue deleted file mode 100644 index b39c23b1..00000000 --- a/src/views/demo/comp/drawer/Drawer5.vue +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/src/views/demo/comp/drawer/index.vue b/src/views/demo/comp/drawer/index.vue deleted file mode 100644 index 44f1e26f..00000000 --- a/src/views/demo/comp/drawer/index.vue +++ /dev/null @@ -1,69 +0,0 @@ - - diff --git a/src/views/demo/comp/flow-chart/dataTurbo.json b/src/views/demo/comp/flow-chart/dataTurbo.json deleted file mode 100644 index f6432c4e..00000000 --- a/src/views/demo/comp/flow-chart/dataTurbo.json +++ /dev/null @@ -1,240 +0,0 @@ -{ - "flowElementList": [ - { - "incoming": [], - "outgoing": ["Flow_33inf2k"], - "dockers": [], - "type": 2, - "properties": { - "a": "efrwe", - "b": "wewe", - "name": "开始", - "x": 280, - "y": 200, - "text": { - "x": 280, - "y": 200, - "value": "开始" - }, - "logicFlowType": "bpmn:startEvent" - }, - "key": "Event_1d42u4p" - }, - { - "incoming": ["Flow_379e0o9"], - "outgoing": [], - "dockers": [], - "type": 3, - "properties": { - "a": "efrwe", - "b": "wewe", - "name": "结束", - "x": 920, - "y": 200, - "text": { - "x": 920, - "y": 200, - "value": "结束" - }, - "logicFlowType": "bpmn:endEvent" - }, - "key": "Event_08p8i6q" - }, - { - "incoming": ["Flow_0pfouf0"], - "outgoing": ["Flow_3918lhh"], - "dockers": [], - "type": 6, - "properties": { - "a": "efrwe", - "b": "wewe", - "name": "网关", - "x": 580, - "y": 200, - "text": { - "x": 580, - "y": 200, - "value": "网关" - }, - "logicFlowType": "bpmn:exclusiveGateway" - }, - "key": "Gateway_1fngqgj" - }, - { - "incoming": ["Flow_33inf2k"], - "outgoing": ["Flow_0pfouf0"], - "dockers": [], - "type": 4, - "properties": { - "a": "efrwe", - "b": "wewe", - "name": "用户", - "x": 420, - "y": 200, - "text": { - "x": 420, - "y": 200, - "value": "用户" - }, - "logicFlowType": "bpmn:userTask" - }, - "key": "Activity_2mgtaia" - }, - { - "incoming": ["Flow_3918lhh"], - "outgoing": ["Flow_379e0o9"], - "dockers": [], - "type": 5, - "properties": { - "a": "efrwe", - "b": "wewe", - "name": "服务", - "x": 760, - "y": 200, - "text": { - "x": 760, - "y": 200, - "value": "服务" - }, - "logicFlowType": "bpmn:serviceTask" - }, - "key": "Activity_1sp8qc8" - }, - { - "incoming": ["Event_1d42u4p"], - "outgoing": ["Activity_2mgtaia"], - "type": 1, - "dockers": [], - "properties": { - "name": "边", - "text": { - "x": 331, - "y": 200, - "value": "边" - }, - "startPoint": { - "x": 298, - "y": 200 - }, - "endPoint": { - "x": 370, - "y": 200 - }, - "pointsList": [ - { - "x": 298, - "y": 200 - }, - { - "x": 370, - "y": 200 - } - ], - "logicFlowType": "bpmn:sequenceFlow" - }, - "key": "Flow_33inf2k" - }, - { - "incoming": ["Activity_2mgtaia"], - "outgoing": ["Gateway_1fngqgj"], - "type": 1, - "dockers": [], - "properties": { - "name": "边2", - "text": { - "x": 507, - "y": 200, - "value": "边2" - }, - "startPoint": { - "x": 470, - "y": 200 - }, - "endPoint": { - "x": 555, - "y": 200 - }, - "pointsList": [ - { - "x": 470, - "y": 200 - }, - { - "x": 555, - "y": 200 - } - ], - "logicFlowType": "bpmn:sequenceFlow" - }, - "key": "Flow_0pfouf0" - }, - { - "incoming": ["Gateway_1fngqgj"], - "outgoing": ["Activity_1sp8qc8"], - "type": 1, - "dockers": [], - "properties": { - "name": "边3", - "text": { - "x": 664, - "y": 200, - "value": "边3" - }, - "startPoint": { - "x": 605, - "y": 200 - }, - "endPoint": { - "x": 710, - "y": 200 - }, - "pointsList": [ - { - "x": 605, - "y": 200 - }, - { - "x": 710, - "y": 200 - } - ], - "logicFlowType": "bpmn:sequenceFlow" - }, - "key": "Flow_3918lhh" - }, - { - "incoming": ["Activity_1sp8qc8"], - "outgoing": ["Event_08p8i6q"], - "type": 1, - "dockers": [], - "properties": { - "name": "边4", - "text": { - "x": 871, - "y": 200, - "value": "边4" - }, - "startPoint": { - "x": 810, - "y": 200 - }, - "endPoint": { - "x": 902, - "y": 200 - }, - "pointsList": [ - { - "x": 810, - "y": 200 - }, - { - "x": 902, - "y": 200 - } - ], - "logicFlowType": "bpmn:sequenceFlow" - }, - "key": "Flow_379e0o9" - } - ] -} diff --git a/src/views/demo/comp/flow-chart/index.vue b/src/views/demo/comp/flow-chart/index.vue deleted file mode 100644 index 4d28c4f0..00000000 --- a/src/views/demo/comp/flow-chart/index.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - diff --git a/src/views/demo/comp/lazy/TargetContent.vue b/src/views/demo/comp/lazy/TargetContent.vue deleted file mode 100644 index e0982542..00000000 --- a/src/views/demo/comp/lazy/TargetContent.vue +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/src/views/demo/comp/lazy/Transition.vue b/src/views/demo/comp/lazy/Transition.vue deleted file mode 100644 index b8c69ae1..00000000 --- a/src/views/demo/comp/lazy/Transition.vue +++ /dev/null @@ -1,77 +0,0 @@ - - - diff --git a/src/views/demo/comp/lazy/index.vue b/src/views/demo/comp/lazy/index.vue deleted file mode 100644 index 426cc3a0..00000000 --- a/src/views/demo/comp/lazy/index.vue +++ /dev/null @@ -1,52 +0,0 @@ - - - diff --git a/src/views/demo/comp/loading/index.vue b/src/views/demo/comp/loading/index.vue deleted file mode 100644 index 351277fd..00000000 --- a/src/views/demo/comp/loading/index.vue +++ /dev/null @@ -1,113 +0,0 @@ - - diff --git a/src/views/demo/comp/modal/Modal1.vue b/src/views/demo/comp/modal/Modal1.vue deleted file mode 100644 index 90c3c9aa..00000000 --- a/src/views/demo/comp/modal/Modal1.vue +++ /dev/null @@ -1,65 +0,0 @@ - - - diff --git a/src/views/demo/comp/modal/Modal2.vue b/src/views/demo/comp/modal/Modal2.vue deleted file mode 100644 index 1446b18b..00000000 --- a/src/views/demo/comp/modal/Modal2.vue +++ /dev/null @@ -1,28 +0,0 @@ - - diff --git a/src/views/demo/comp/modal/Modal3.vue b/src/views/demo/comp/modal/Modal3.vue deleted file mode 100644 index b53d1347..00000000 --- a/src/views/demo/comp/modal/Modal3.vue +++ /dev/null @@ -1,15 +0,0 @@ - - diff --git a/src/views/demo/comp/modal/Modal4.vue b/src/views/demo/comp/modal/Modal4.vue deleted file mode 100644 index 299f3cbf..00000000 --- a/src/views/demo/comp/modal/Modal4.vue +++ /dev/null @@ -1,85 +0,0 @@ - - diff --git a/src/views/demo/comp/modal/index.vue b/src/views/demo/comp/modal/index.vue deleted file mode 100644 index 7e2af344..00000000 --- a/src/views/demo/comp/modal/index.vue +++ /dev/null @@ -1,113 +0,0 @@ - - diff --git a/src/views/demo/comp/qrcode/index.vue b/src/views/demo/comp/qrcode/index.vue deleted file mode 100644 index 9075a6a8..00000000 --- a/src/views/demo/comp/qrcode/index.vue +++ /dev/null @@ -1,128 +0,0 @@ - - - diff --git a/src/views/demo/comp/scroll/Action.vue b/src/views/demo/comp/scroll/Action.vue deleted file mode 100644 index 78148a14..00000000 --- a/src/views/demo/comp/scroll/Action.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/src/views/demo/comp/scroll/VirtualScroll.vue b/src/views/demo/comp/scroll/VirtualScroll.vue deleted file mode 100644 index f7ebc3b4..00000000 --- a/src/views/demo/comp/scroll/VirtualScroll.vue +++ /dev/null @@ -1,64 +0,0 @@ - - - diff --git a/src/views/demo/comp/scroll/index.vue b/src/views/demo/comp/scroll/index.vue deleted file mode 100644 index b9bb6515..00000000 --- a/src/views/demo/comp/scroll/index.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - diff --git a/src/views/demo/comp/strength-meter/index.vue b/src/views/demo/comp/strength-meter/index.vue deleted file mode 100644 index a5c62930..00000000 --- a/src/views/demo/comp/strength-meter/index.vue +++ /dev/null @@ -1,32 +0,0 @@ - - - - diff --git a/src/views/demo/comp/time/index.vue b/src/views/demo/comp/time/index.vue deleted file mode 100644 index 49f6c571..00000000 --- a/src/views/demo/comp/time/index.vue +++ /dev/null @@ -1,44 +0,0 @@ - - diff --git a/src/views/demo/comp/transition/index.vue b/src/views/demo/comp/transition/index.vue deleted file mode 100644 index 71c7ca8c..00000000 --- a/src/views/demo/comp/transition/index.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - diff --git a/src/views/demo/comp/upload/index.vue b/src/views/demo/comp/upload/index.vue deleted file mode 100644 index d619681e..00000000 --- a/src/views/demo/comp/upload/index.vue +++ /dev/null @@ -1,61 +0,0 @@ - - diff --git a/src/views/demo/comp/verify/Rotate.vue b/src/views/demo/comp/verify/Rotate.vue deleted file mode 100644 index 1ef552d2..00000000 --- a/src/views/demo/comp/verify/Rotate.vue +++ /dev/null @@ -1,33 +0,0 @@ - - - diff --git a/src/views/demo/comp/verify/index.vue b/src/views/demo/comp/verify/index.vue deleted file mode 100644 index aa93473e..00000000 --- a/src/views/demo/comp/verify/index.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - diff --git a/src/views/demo/editor/json/index.vue b/src/views/demo/editor/json/index.vue deleted file mode 100644 index f370ac57..00000000 --- a/src/views/demo/editor/json/index.vue +++ /dev/null @@ -1,98 +0,0 @@ - - diff --git a/src/views/demo/editor/markdown/Editor.vue b/src/views/demo/editor/markdown/Editor.vue deleted file mode 100644 index e0dabf63..00000000 --- a/src/views/demo/editor/markdown/Editor.vue +++ /dev/null @@ -1,59 +0,0 @@ - - diff --git a/src/views/demo/editor/markdown/index.vue b/src/views/demo/editor/markdown/index.vue deleted file mode 100644 index d88689c9..00000000 --- a/src/views/demo/editor/markdown/index.vue +++ /dev/null @@ -1,97 +0,0 @@ - - diff --git a/src/views/demo/editor/tinymce/Editor.vue b/src/views/demo/editor/tinymce/Editor.vue deleted file mode 100644 index c148a3cc..00000000 --- a/src/views/demo/editor/tinymce/Editor.vue +++ /dev/null @@ -1,59 +0,0 @@ - - diff --git a/src/views/demo/editor/tinymce/index.vue b/src/views/demo/editor/tinymce/index.vue deleted file mode 100644 index 9bba89bf..00000000 --- a/src/views/demo/editor/tinymce/index.vue +++ /dev/null @@ -1,21 +0,0 @@ - - diff --git a/src/views/demo/excel/ArrayExport.vue b/src/views/demo/excel/ArrayExport.vue deleted file mode 100644 index 676832d0..00000000 --- a/src/views/demo/excel/ArrayExport.vue +++ /dev/null @@ -1,37 +0,0 @@ - - - diff --git a/src/views/demo/excel/CustomExport.vue b/src/views/demo/excel/CustomExport.vue deleted file mode 100644 index 8f5980a7..00000000 --- a/src/views/demo/excel/CustomExport.vue +++ /dev/null @@ -1,44 +0,0 @@ - - - diff --git a/src/views/demo/excel/ImportExcel.vue b/src/views/demo/excel/ImportExcel.vue deleted file mode 100644 index bc4ccb91..00000000 --- a/src/views/demo/excel/ImportExcel.vue +++ /dev/null @@ -1,57 +0,0 @@ - - diff --git a/src/views/demo/excel/JsonExport.vue b/src/views/demo/excel/JsonExport.vue deleted file mode 100644 index 413d9b9e..00000000 --- a/src/views/demo/excel/JsonExport.vue +++ /dev/null @@ -1,58 +0,0 @@ - - - diff --git a/src/views/demo/excel/data.ts b/src/views/demo/excel/data.ts deleted file mode 100644 index 3e528d42..00000000 --- a/src/views/demo/excel/data.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { BasicColumn } from '/@/components/Table'; - -export const columns: BasicColumn[] = [ - { - title: 'ID', - dataIndex: 'id', - width: 80, - }, - { - title: '姓名', - dataIndex: 'name', - width: 120, - }, - { - title: '年龄', - dataIndex: 'age', - width: 80, - }, - { - title: '编号', - dataIndex: 'no', - width: 80, - }, - { - title: '地址', - dataIndex: 'address', - }, - { - title: '开始时间', - dataIndex: 'beginTime', - }, - { - title: '结束时间', - dataIndex: 'endTime', - }, -]; - -export const data: any[] = (() => { - const arr: any[] = []; - for (let index = 0; index < 40; index++) { - arr.push({ - id: `${index}`, - name: `${index} John Brown`, - age: `${index + 10}`, - no: `${index}98678`, - address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', - beginTime: new Date().toLocaleString(), - endTime: new Date().toLocaleString(), - }); - } - return arr; -})(); - -// ["ID", "姓名", "年龄", "编号", "地址", "开始时间", "结束时间"] -export const arrHeader = columns.map((column) => column.title); -// [["ID", "姓名", "年龄", "编号", "地址", "开始时间", "结束时间"],["0", "0 John Brown", "10", "098678"]] -export const arrData = data.map((item) => { - return Object.keys(item).map((key) => item[key]); -}); diff --git a/src/views/demo/feat/breadcrumb/ChildrenList.vue b/src/views/demo/feat/breadcrumb/ChildrenList.vue deleted file mode 100644 index cc2b26d5..00000000 --- a/src/views/demo/feat/breadcrumb/ChildrenList.vue +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/src/views/demo/feat/breadcrumb/ChildrenListDetail.vue b/src/views/demo/feat/breadcrumb/ChildrenListDetail.vue deleted file mode 100644 index 6e576fda..00000000 --- a/src/views/demo/feat/breadcrumb/ChildrenListDetail.vue +++ /dev/null @@ -1,10 +0,0 @@ - - diff --git a/src/views/demo/feat/breadcrumb/FlatList.vue b/src/views/demo/feat/breadcrumb/FlatList.vue deleted file mode 100644 index d480bab1..00000000 --- a/src/views/demo/feat/breadcrumb/FlatList.vue +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/src/views/demo/feat/breadcrumb/FlatListDetail.vue b/src/views/demo/feat/breadcrumb/FlatListDetail.vue deleted file mode 100644 index 67525278..00000000 --- a/src/views/demo/feat/breadcrumb/FlatListDetail.vue +++ /dev/null @@ -1,8 +0,0 @@ - - diff --git a/src/views/demo/feat/click-out-side/index.vue b/src/views/demo/feat/click-out-side/index.vue deleted file mode 100644 index 7e8138a3..00000000 --- a/src/views/demo/feat/click-out-side/index.vue +++ /dev/null @@ -1,43 +0,0 @@ - - - - diff --git a/src/views/demo/feat/context-menu/index.vue b/src/views/demo/feat/context-menu/index.vue deleted file mode 100644 index 0bde0cfc..00000000 --- a/src/views/demo/feat/context-menu/index.vue +++ /dev/null @@ -1,85 +0,0 @@ - - diff --git a/src/views/demo/feat/copy/index.vue b/src/views/demo/feat/copy/index.vue deleted file mode 100644 index b4420569..00000000 --- a/src/views/demo/feat/copy/index.vue +++ /dev/null @@ -1,40 +0,0 @@ - - diff --git a/src/views/demo/feat/download/imgBase64.ts b/src/views/demo/feat/download/imgBase64.ts deleted file mode 100644 index 306bdd1a..00000000 --- a/src/views/demo/feat/download/imgBase64.ts +++ /dev/null @@ -1 +0,0 @@ -export default `data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAMAAAADACAYAAABS3GwHAAAABGdBTUEAALGPC/xhBQAAACBjSFJNAAB6JgAAgIQAAPoAAACA6AAAdTAAAOpgAAA6mAAAF3CculE8AAAABmJLR0QA/wAAAAAzJ3zzAAAACXBIWXMAABYlAAAWJQFJUiTwAAAAB3RJTUUH5AodAjIGrlVB/QAAABBjYU52AAAAygAAAMAAAAAFAAAAAASpeQ4AAC6ASURBVHja7b133G1Vdaj9jDnXWruXt7+ncDhIEVCKaCiidATsgIjRm1gTu1FjTbl++ZmYqMmNRPOZm5tc400+Y65iwUQFEUSRIkixgNI5cA6nvX33veYc3x97v2IBpZzzzvdw1sNvc/5gH/ZYY80xy5ijQEZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkZGRkbG7kZCC7CaeevLu3QSyPXBKBL3RSIHKOE050EtULdqakaXvr/E+EiR9kbLRz6Wvc5HSxRagNVMIw+bnhyz/m6HbTtNvGjsAQENMNZk+FGB1EOjBfu9okLvbvj6N0Nra88kmzIegte+yDEapbRKMPp/EuZe3rcqOm37sjFKqQOKMDSFFUXxRFicVO1mqZi7/QMLS70DahS2QO9guOB92St9NGQrwEPgUBZFKHZVtr28p3ko5PucWko5MZfKmD5oACuKAM5jU6WP5S7N8+W0XLm6NYomHuZMaM3teWQG8BAkKoypknThoAM3c9ed6548lcrrJvpyTFElBUQDyCUKqUK3iMYJaTevhdufZG470LEzl0dSpyHE2qPJ1stf4vfO6eOdYTTpykc+V9BXn+02rvP+NQf25C1jTkaWvxfEADy4BJJJGB+D+aLcdGXefPCGIpf859tpvPUjsF8v5Ue5iP/9nuzVPhKyFeCXaKSGMsIb0qa+71yopsnhY44Xl5SKCpqysk6gn/+ttsHZEm6yhh2PiaI+B6y1+tI7nNz8nI/RqKXIxVWrLlsHHjHZrnHI61/S4/Uv7ZFDeJZxfK1TN7f7/NSY46RJJ4fESuQGXxV50CGz2z8CMjxxCHl8voKvxBgDWvFa3q+vJ2zo6bPmYgovWPSMpDDi4R1/mVnBIyEzgCG5rrJUEwq5vlxUUX5U0uJG6b90BP+CopcIFdUAW0ZhsAqkIloti5muSZxYJPVIrDCd6uRBHf3dExf1hOtKhn+/aompLqzph9bonkFmAMAdP/XMN6HaFSYMVNqKWibXpJw27uQAA6oS5rwkCl7QbpFOroIbSTSyg+MATtCSYg/qc+z+PZ711QrF9adWGffIXAR/8iHlbR/LVoJfR2YAQLEIb7kgIul6+br36lLqlT7PH03NYWUnKGEOvTC48PIWLdehUhq+sKEwDsQAk47ilOPkw1uc8pp5H310Ek0FZhPo5kJrd3WTGQCQ7oC/f5Njcga+9zlHtctR421eVVT2UyHI1gcGP9q3eM3jp8ok4wkJyi9cQHjAojrZ12MP6uorjTf7vmIzTPSQdV1lrB1au6ubvd4AvvLvjn4VvvWdlD/+RsynPpVbW0NOnOyZA4pecKEEU8CD5PDxiPQLOSVGf+X+wQ8/U07tfqkeVVROcnVG3nMe2lKRpoW3fzTbBj0ce70BnPYyKBeRe7SAyL9ptSPPGlF5YcmRN0DIg29LcKaAn6pi8xGSPvzds+SAMafTa1N96VifA//gIjhiUbHAfDmUdlc/e60BvOF8x++90DNzr3DZxxwX/YGamdYr1ud2csaY40hjNHYSaO8ztLo0jy+U0fFY45xg/MN/nZ6gBU9h354+c21fT7m3Rm1tpHLMnZ5SCu/6s2wVeCj22ouwnKRcMJ6w9m+cbF4b6fQDfuTWd7tzp3bIs+siSIR6DTP+vYJa0XodGauptYLob4g8ciAxMOG1tK7NuYd57v2vgrnw+3V6hy8if310sHP8qmavNYA2lnXXwuw+0L3Hs7kvk/v25XkGDogi1AWa/I1Cx+B6eXrrStjRhFiV33gWWQ6TThQ29DiyqZx6TY5vrumxfawPR18PZ/6ZosAHP5CFSSyzV26B3vrbbSIVzjsk5e++bjUp6/iagp6xIWcOq0UiyzkvIXADt44UalAuKMnQ1fmI/u7wz3HVaK3j2HWOM+uqxU9UVU/30JS99IX/GvZKfex3f0JsUk7ZIfLBs1uMOPesMe9fVVKdMhrG7SkMLr16gto8ur6quXpC7PxgS/RI8QOD0RGvh+6X6msnvDzlBT1ho1MZ8craYG6t1cleZQB/9D7HO/5bj1LJUBDkhb+1qD+tMz7iOGayL4cmTsSF2h0Mb9t8gZ6tS7eUg/gxhF0rkAIjXuVJTp9ad3pyLmXqdTs62jHCJgt/+sHsOLDMXmUAqXpmY88t9Y7cU3T6h/cW4jUNe1alL88pOyLDYAZdabmEwfalLfhCCZmsYhID/jGm3OjwQDzqtTLtOXfa8YwPTeb54LVLxEB7xVN5Vi97jQH80XsdiRdG+obygvDZf/oP+mI2TLTlnHpfjgLESxi3z3Ca17SAq5Qx0wm5+Ne4PR8JPUGtEq93+oy1Ts/YHsn0l44smcOcp+DhT/9S+dM/z1aCvcYA2nenfOPGNgbkK2+J9V3v+92xInLmSCqHVYf7nlDDwQ/jGcoj4ksVQUQfd8aZBzGKjnk1E16fs1b1JTcUTeXzIwZyyP0VKHYDPfAqYq8xABk1PP/wMhNtOO0rjmKffcdTObfsZR8TsNDJstuzk9P+aFFlJFHj9NEdfB/yeQEVxCo67fSgjY6zxDC5TwtGVZlogJ4Z4olXF3uFAbz9vC65kkH3gbKK6IiZKC7oaeN9jsoriZNAs7+CejAJ5Gui1Ty2AGZXWeJynFDdI2t7evhYX5+vjrGvedFKpFI8Hj6wZe/eBu0VBjCRxnQ3p3Lx3U3uKXqJ73Sn5nb680upVKxIuHgfgZ6IzxdF14xIVEwwzu9aY/SDrDKtqq5f1+Y1ky2OO/tvPS+51NP8O/jRxEo/+eriCW0Af/CylLe/LKWRE/JdWLNTmO27ymiLZ4515PDIY0IUuAKWR7l2inSlQq+WqI1BdoebPgVKCvumesC4cuJt/2w2HPy1lOQLcPB2+MB3995V4AltAHnnmE0MHdfjmprq+n5UGk/NC6qYE6sqkQx2IEFwHvpAuYKMVjAJu08YD2KBuiee9PrcdX1OfSs5ueZyiArI/DMDKWEV8IQ1gHed5zjurp2M9ZWSE9m/bTBi9htL7e+UHYcLoIGC3YyCM2iaJx0rEU/nyBkZpDnuDoTBKiComXZ66IYl/7zKPPs/8zo1T/lXpdKC9/+x8icf2vtWgiesASjwzSdPoqry8f1RiUytqHL8VN8cXHWCH+T5BsErSILPjZAWSuqjXeD2fCS/iYG6USbu02Mn/1V/e8f1Mv3pUdHkfyNLFZiIw+gjJE/YaFAnUOjDvj3Pq+5T8s4fOdKTV5Q8kxboBywK1ha8yalfVxFbSTDpLj74PhQ/c4sKOrbEuo0NnteM+cZxli0HtT3NimG2GEoj4XjCGcA7X+oxCqjy5Jl76FYOkK7vjU/1/emjqT0mUpJUwvj9ZRjvo3l8riI6kiMqgFmpCibLcUIVA+usHrQt5nl35GTLeTXu3bTFs5B7wm4IHpYn3BP3XYcj5n+Egnxr7QFsikkqXk4vOfOcqpPYarh4Hw/0EV8qi47XRWKLPNZ4n8fK0OWrZdX6Oqe/8yT09Fcfa+Rd/8MwbldaK+F5whmAtxGfnSqS81Dpe3qG8njfnF53cmSkA997qHgfD76V125SVDeWDDK9QkQnpwKxh7WODdOeJ31rEcOVUA7kFAjJE8oA3nxel09cGnNwdyMfeqGqVa3lvD9rxMlxFSfx8s1oCJwHNUi5hqmXMXnBmEBOF8NgImgLSx1YrMVAZeCW3dt4whjAxW9OOeqS7fzes3tUUy9v/KrDqj+4lvpXl7w/wGqYCg8wrO8jqMvhJmsSjRUkVh5/vM9jxSjSNvTvzfGdTTn53ifm8Hrkq1mM9r684SeMAYwlcMqrxpksiXxgCp2LbbHiePpUj8OKTqyXQC93GO+jOVIzIp1CXjU3LDQaQiAD2gNmI3lgZ1k+/aM1fLdxi+dtf/spFgpBNBSUJ4wB9EX5xBbh6S/YobV9YyZa7sRaKudXnNRCzf7L9X3aoFEe1taIStGuj/d5pBggAlkUadwfyXfnErl+dInuTwuG28vQyg7Bex63vc9z27s8zS7cP6dyzsvW8qYf9iZrPZ470ud4A7ELNPvL0OpcDpevwESiuYJgAqblageYtdy21crnupbtf/dGaAj6uxen1HvhBAvFHn8P8JrrPd+50NL9oOGz38grf05hBE4SJ0ePOLFGBiVOQmz+vYKz+GKNtFoTMaKDW+AAslgGq84OI90dVq7sK9/acS+NT/4p0i6jL/98DJ8PIFhg9vgVoBgr3Aqttsq17/GkjolJJ+eVHUfYYaJLiAFnBhUefCvRXrWETOQ1EkFCHHwVsApOJJ2xcvkDVr783G5//t6N0IjRhT1+FDx29uhHf+fLPO8/0PCfn0r55Lcts11GL93sTs935Zi6Ss5JOLenejAR5OtCpYQtgl0+E6w0BrQrsN3QmjdyyQMR1x7RhDNngc6gmNbeyh577PmD8/psfa5l583Q3NaVzlp0c1OOaSz4t1S7cmgJsT5AU4vl3kZdwZuS+MkJMaNFjPFhOkvCoLzKkpH+3bFcsT2Wz6jRu7ZHIg2ErTF88I/3uvuvn7FHrgBvO29wZXP/n30N1/O8++tet47GSaEnT6/1zDMSL0lQt6dCL0ffV7RbTVQKDCo8BOksyaCx35Llztmc/NNckRv+n39rs6lg1NZgbC8vkbJHmv47XtJjcylmfdvJA7Hoho7mvPFn7NMz71rX5dmRH0SDrjTC4OCbKmpHceNT4qbymiSChOjcaIYybRe6dyfmwvsK8t6W5f6RPrLZoh95PwTq/LRq2ONWgA+/wfHDO3qs73gS5ymkjqbxIyM9zq729TgT6IIJBm5PBe0WSEtlmM6Ti02Ywb9MH2jGcnMjz5dqkc41q5CL0dfNe/7mL8LJtVrY4wwA4APvKIF6/urd29R6SYoqx46l9ohaKhGgPmCii7doUqNfrJDaZYsIIIsFnMKckXa/IF9fv1a++vr/2W4eN6dy0hh8qW541168919mjzOAnnhmroNS28kb/3qMqnMH1nv66qLXg4cn+mDxPh3QXqxuskQ8kScGgvn9I4W+0N1i5aodkXz70zfRPFJzRCVRm4f3vj8b/LCHGcCH3+iInfAPNzZ45mhCdSSulVROGE85vuC14AYN7YJgBvV9fFLD1wrYooTzsMnQ7TlnZWnW8qUlw02f2ejkhBdbWg5u2hlKstXHHmUA57/CEMeGr3/3B5z16Vs03+PpZS8vqjkp5zRcfR8UOuCjAn58REw+gdQRxBqFwfX+kpH+1kiubxr51pYWM/8yZ3lz3OO4Frz07dnsv8weEwrx7vM77FsC11R55f95ph6zlUJ6kzup1OfZsZKE2vcP9/jazkmvWkbHE03ygkkDbX0E1KtI08iPdsbyqbboHX85plwwY/TWiYReGkhPq5Q9YgV49/kdDgL+7IKUH06lut83++UdP07PyLX19JqTohCunakfdHKXchUzVsPmLUbCDX4UZKdRv81yc8Py7WYsnX/cIRJbuOy2QEpaxewRK0CnkvJDZyg3kNp9qs1Uxkd65vykJ0fGDKodhAov7gnay9GfKiMTeSIhnNvTMEh3nInl+q2Jfq0iMjsXQdPBnIGPf1z4eBjRVi2rfgV4x3ldnoKQaxv+4tKcakRcUI6c6JunVZ3J+zBbbWAQ7+MjvKnRKxTV50RlOfl9pTGgTmFWZHEuks9vrpv/fP3tvr9P22OKovW9Md/xEbDqDaBr4c6FiKmuyBvP7FJsm6NKqXlNWdkYq6KPoY3QrkCAjqLEsKZKMpIn8j6g2xOkZejfb7l5ZyTfm5jT1hfHlW5sWMzOvA/LqjWAt5/teNfZPQookRNeviWmK1Kq9OXZo105MXHkQsX7yNDqfB5na6SjeeKiwQa88NW2B5/I1skx+ewBY9z6zv8uFNcZPaqqFDvw9j/NrOChWLVngA5QBCQV/nJjn/GOkdE+R1e9nDyamlIEOAlT3NADKWhcwo2MiI+tqneB6owyMMYdIp68XH/CPvJfVy3o9p/8PXLG0aI8A04IkhGxZ7BqV4BTeoZRJxScl9+/Dx7I92vjfc6uOk62qNn91TQfGjPw+mgz0X6hiKzJaRIbTKiD77DekMxbbn4gki9TYNszXyBM1EWxIFNh5NpTWJUG8LazlWuTPnPW88Fvpxq7QiXy5qR6KidUnRQ0dKILQqkmVKtIQbChAvDMMO5p1oifM3LVXMSlpL73hj9Wdrbh3h/Cpr8JpKg9hFVpALMemlFMUY38/kklYmVt1cv5ZSf7J4ORHyzepye4Xo7+WFVktIBd7ucVKM9XUiHdHssNC5F842LH5nNefI9/xgbB5mDjK4UNv5Ntf34dq84A3nOuUgFihX17cE0spuw5ciI1x5eUsg8Y74OHNMH7Gr1KXikN9RdIHnUKLTGzjUj+v5kyV+wowZkffpJctsOT7OWJLo+UVXcI/knU5cmaY7YOjW7EaT3/7Ir6V1Q805EX0kBpjqrQU8jlseMjxJUEE6q9jDCwvCWBbYbbO3DVPovMv21J5WtHbtdrTt7Ki3oxR1z5490vi4Iay32ThtkDxoE68dLd9Kv7h1HOo2RVGcBLL2hw5DU5miDtFnpzmfz+bU4ec5ycUwlW23YY1k8vT69aQSfymhQMkg7jL1ZaIBnYo6TYu2Zj/cyPpxt3/OA9ZUb/eQs/nJ6TSs/iVuCUZHTQZaSXeNpFUVgCGugelGm+agzg5rtT/uKiDjt3wpsnvP53cWa8HT1tIpVjxlJTtqh6CVPiZLmbQKGCq9ZEE1HEhdk/Dp1fsiSmO5PTb85X0/9YKvVmL1n4Fw6/+niFBF0hLYkqNhVKM4LrCOsnLKU4TztKMbqVS2Q6gIYeHavGAHqp8rT9DZft05QjOqlOOzN5kk9e1hF77KwFL4pnZWfb5S4aTsW7mP5oVSQtk2yBQY+lAPIYBa/idsb+zhunG3dc/NSttXbO5Q+/6pgCpD5aqZvx4aroBWmVTTo7aeZ+WosXpLWdSlpkKdkz2tCvGgN4xgER/3xll298qQuxY+msZOONvnfcjsjURQdLfogBJ6r4yPT9SPxAeVQqhTxjzj/YYmalDsCD31KMmo6J3c7u2Lx/YP3MGc2kc5R4ceLFDgtSrJSKVME4QTpFu3WpwmWjre636ozMO9cUuEcv1xYny+ruu7QqDOCYP0yBLt++QeUzX6xqPmHynf/SOvm2NF2/uSDByogDoNqVUjTv18R9VzSDRNtQojiLxL6bjC9tqazZOZ0UWk+13iAefABflHHgLbSqZq5bZd99Ef2pn76ECu2/YZyTKLCP3sN9sjGYzn7jM4QWAODog4SrfmK55eN36stP/H+5d7s72qDniDJlFKyqWFVW7MPwTw82tvNSiuZMZCatMmIZlBm0rNBHf+5PxSX5brs8sTOOi+0ENYhf7jy2oiz/XifNm83NehRRNKcr7rcvN+2Nr2UH/8iCABzL6q65HnQFOOiNHVDBo/zeJxfgzKfK77/wkH0uur57snP6lFIsEg0CPlf27KsPfrQQ4WtJhJE8Ts0vfGel8ACC5PpbctXGjkKuM21UR7w3g/8QAOOhVzTdual4sV21OYHKdtxxf8LsCRNED/yUDfPPZgvrsBT0LtrypBBi/kaCGsD6OMdOB1++2ks1HtOD1pFceFXnNCQ9vRBLPo4CNbMebPCd5sxOLUddzZkxwIbai6kKqPik1G4nY/Me4+vem1wQYZb1o8z38jK/NGrr/ZiSBRbxU1fROhfMbXkal3fpYshzGDluDibsryfYFmif189ze39+cGqLOsz0UyT264s5PSsXc5gIEi7TRUGkTyWa0aJNUa2iGmyyEFFnk3R7UmuYuNRcL9bHBOryvRwK3s/LbLNmG/0cNUUKgBrIWeT4BE7LY0dOo0ANkZuZ4UzdynXaCaXChyXcGcArxkIjXZI4cVrIt8d7rvU8I+5pkSzXWgiFpMTSphTVJGfGGBwLgqDOgNFuMrqwKa4vdhAdU5UwPd0H6W4KtBpjcX5hKprwVnLDtAwZFgYuAqc2cc+5FC3MoVqnJoeRo78KW5AFMYDD3t8gzg3udNPU0e+kONyTU9JzvOoGXXkX+4N4IDENrSVbtGBzKloLXD6zZyK3GNeXSlGxMxj8gWZ/FNTQ65bM5kbdpN2cjKsMyr7//Lc8engKL4qRtaDM0+UWety2CvtQBjGANRtytFse8YYFr6qxmRQvp4jKEUCY2W2AgvY1b9u+FhuNJCJUWWcGe3+TuMW43twaFdsTiK4JNvgBk+I0ktbiuE3bFRPJw5bXlwL4Y2vIadeyT0U5SGdIZQnPvnpPMPkf8plC/Gja7GJFiIp9pkfVaE9PUMcLVLU6/EqYgy+giZ3Vgu0SyQZEaiH0MxBEFC8uKrdahemdXZvvGnWBvdZCo1cw843RaLqTM1PLvRB++VuDLZFuEPT862g/Tfgm13Ab51PmeFbXxdiKavTkD3c49eM97t8M/Y6XO/5uJ6LJOlU9BdXDV1qeX2C5b2klams97mPIDdwvIWQRAG8Stzkqt5dsobMv1lcf7//2sSI6dHuWTH9xMu50iybh1zRXGeyUxDbxT/tnFk85l6eugZ6ewBYET1HvCvUov8KKDrjL3/ttJqZjDjg0L2/56Ki+8otPLoroc1Q5USFHyIOvSE9js11LkZA3dQyhWmwsGwBJrbGUjCx4xI/jJQmmm8HRd7ZTNs3FUVvzlug3eAXEIHTQyo10nnchSyfCgXYTnn+nKeXVcf8KrKABHPK6BX734tPpO+W+29r8+5832XZv+iSf6ouBg4dTbaCDr4KVPpVkh+ZthNdxNFxxW0WdSdxcPLIYR+XmCCjqwwyaYWSd7xXNzmbddvsJEx7JP6K/C9YiR8XIWWVY36JDGWE7Hc5YJW7RFdNqzwg/urjJj77blJFiXuOEybtv6ZzWbesR1krI+RbAayyp1qIyOVNCw0mjXjCxW4xHlu6MSi0jolME7OUmHvVGegsTcWFxNBrxhuiRKkcGa5kBju3iXwDR6CJe15GXkymQrgK36IoZQN5DY6djy1KXOzctsjSbHtZYTM9NnU4PAx3CHHwVSOwM1Xir5k0FQ2XF5fh5vDgTu35udD5v852qOhOvWID/Q4ljafaK9r5m3dhuwgg8qhc1TKbT/VI42yAHQpPNzDCD41jyXK6tUI8GrJABPOkNi6gqncRRz+Wo2miCmJNNJE8XISbk3l9xWrBtrSUpljw+VD6TDNyeuXQ2rjVmo2JrrURuNJheAJvi3MDt2e8WJZFB6MxjMcZY0SNzcOZfsXHqt9moH2VOAF7LjpCPuDIGUCzm6EYixVyBHJK0RU9LRU8HzQXd+4MnlnmKNtKc2YBIIdzWB0VxcbU5l5ucXZA4zauTcLFag6vIhW7ZdBbHzD69REaXm+49SkRAwY8Kes52eid8hlGjPEm/RJNnBY4W3a0K3v/NKT5t0uum9L2Suj7WyLT3cqZXjpCQtzqDg6/TWjyj1SgGnUbDuScEUon8zrjcJiq2N4hoIdzBd5B93a6Y5uJE1OrnzRSPY7JUBrWUUvSQr9E67R623fwF5u8oEvvzKVPSu/AQJGJ0t2vY2Bz9vpPEODXeV7zT01COFTRcNOOAHrGZpxxFmrclQkTVD1FvwKom9caOqNowIn6NasBIXZVUYGezZtOlkajmDfI4B4qYQQ+H+Fa6J3+BpedCXHAIn6YhFuFwwgyH3WYA+78lBf0JzvVJ05ROx+FVD/bOvwT1+y0rJshTeyAybS3HM5qzdZRJJOQlHKlJ0qVkfM7ElUZOFQ0Z7amGtFsyO1o1a/sJU7Br7iBkcEF2YIQ8rwAHdZmhgtDAESFB3KK77aW7Xg/kENCejKzdpkmpPA56AvijlIAHXx38SwvWaT02GpsIH6658MDtmc7F5cYmW2jXET8VNA7Woy6WdG46LjTrtgSYXekTHp4jDkvhHGF0QwN0X2K5kjVB3KK7zQBsUgCUl757VH/wrxegytGq8mKFZc9GoCkOT2K3aSma05wZxfCILnV2CyrgBVvopcnEPDbpl9WbZMUz4H6mGlDLfLdgtjRrptiLqMqunRqW3aITDn2hok9L2Y+7uUbfy1wQt+guN4B9Xtdg3WuXQDyu15V/+It75IDn//2UOn8aym8x2NuGmeOGM72WbINK1MdQRTVgiIGqSdzOqNpsxZXmtESuEHDro8bhennbWhyPer2c5GWwUu8OgQzoQQY965XsPBA28BFuF4CT+faKPvcuN4Buv89E1eJ7HfL5go4kU8V+t3ma9/1nK+SQFa9u8jNE8BLLEsWooAU7CRKF3Pogksb1xgO50YUFMa6uKiEdA4phvl0zLI5H+6SxKe+m7cGwmozmQc9skz5XObagHK2fZlGUM1b0oXe5p2H7nKdcUJx30mg31RpZo/gXq+phBE10UTQybarx/VqKqkCdkG5YlVSMW0qqzUJUbo4BOQL1eh1OSdoqm7mlUUsaMz3IcNx9Pzl80n2vo3Pqi9h69Tb6N1xLO/0v2pT1bgAast/j+IlHxi59yJvvTuEOIYm8bPpMXrs9al79SQi/BYH8XA/SJzZtrcaR5kwBr4YQCfcMZn+JXDepL22OKo2cGL+GUKHgAuLpKcwujVjTrJqyyO4XRhAVhHvoP+MiGudcS38sIeZCmiLAaSv0+LvsOTt9z+EbLaeeG5N6B0c36afuiNS5l6C6XCQyULyPQmwalOyS5swaDOMrLscvyCTO5nuN/ORsLyq2rXoJFnwnHtTQ7ZbMzlYtKvdjmdKVCb4TBm7RNRHy3AI87VAKxtNDgCtWSCG7zABy0WBs33i3k0++oaSvPy83gvBs9XIMoWP9FbRo2zqatIkkWHmT5fhIE/mdcbk7awud9Rg3PtiJhdn+GK/0C8bPrY2TdsUkK119e+gW3ejh7FvpPKVAXtqktFZIjF260n36sh6z/1bX0w6LYq/6LEHPUtX68D+H2m+nxGa7FqKez9lxNRIHM0U/yPONK61ufny2J3FaHbg9A6HgRXZ0i7KjWbf11EpphU1x2S1acugZDn12Hxk3lHErJMAuOwRf+N0+Lzsh4d7/aNuLv58eum3Ov9Aanm4G2gxz+PUKRlTL8TzlKAEdxz/eW/3HjgpOrFuMq0tpVF0cRdSETHQRj+tUpLk0FvX6ESXCFCRYtrkNoKcL/n6le9EwTmy3T1W7zAA+/KWuXPDVvnZ7Pv7K99KnzDf9ofmYvAgapLrbACW2XapRnqItoBqswZJ6gzG+n9SWNkXVZk7R9UK4+j7i1amRhaXRKLcwFo14S2LC7VKHvU/0ADCHgrtopXbMu8wAbt2WaqcnFCKcWt1ajmQxEUFDKdUrxHaBSrRFC3ZEhXqw1pIAHjWJ7yUjS/mo3KyikoTKuRcP3kjarthtrbotphHTITrv/LxIDCzgTsHfqitYeH6Xrb9rppTIwYYy6dS0/2Ec6ZXesyXI+B8U1PXkTE+rsWpkCnjdXbeaj0CeYZpjrbklrjSrErkxAjoFjKOrkSwsTti4VbLFcEfwgXaGn83ApcDV8aCA1oroZ9dtQFPL+vWGbV8tKt7M5ZLo63FkLkMkXS65sxIP9DNis6DFqKd5sw5DJWSFB/WitthdSiZmliTXi9UFjPdR8JZWp2zmm7VovB/LRMDZXxkoomkwlxjMlYLOpOQxe5oX6IP3VnnKVIX15yt3/uud6bFPLf+gXIovE8PWFXU7Dpr2ei3bWa1Fi2oooIHSHIcVFYzVWVvqpFGpvUGsq4UubNup2HRuOpZeQeKwtQh+Nv1vjpAvV8n/qI/3EUJhhdIhdpkBvHPdTpo9pZizTJ25UW66pdXPJfZqQS5RkSVWqqOQSF+smacYWc3bMSRgYdvBQJe4tjSXG5tvi01H8YEOvgOcwgPtklls1OyoN5KErjXn0RkHl3q4sUUvjYjxeGorFKS7y56/ms+zo9kl7Xqq5bz+8IIi5UJ8J8oXBe5ckafxihhxWopmtBDlEKYI2gNBUoncfDyy6OPaYl5EJeTBF8V3KnaxWbfeWWoasA7rsJ8ZJeKb11D6wjTF7U2uY5qSGgw7WZmw6F02OH7y18NqIn+UckhHWf/aBfGqfWvkJhH5jsC+io6wO+8EFNVYer4eowVjf1buMATeINa140rz/qjYroGuUSTMVmwQ75O6RBqLk1GlMWZLGGxIt+cw5W12lPwVz2f6ujx0v8Vz5ARq+rEVPB7t8hXwOGB8tEQUGT2gUgXDNhHzBRW5YTjud9fgh1hmfSnapgVTx1ALub1VDzZONTcxZ6JSu4CXYPV9xIOPpdWu2M3NqpHUUFvBbpK/ohoGv50ClyWYr/89LP0P1rIPZf3bFRZmlxvA1R+K2DHbJooM97aaYiVKxZjrgMuBneyOOXk54K1gu9SSFCtlfMCkewWTuLm41toRVVojEqflgI5GNY5umkhrYSpKugWTD+z2XGYz6FfLRDcD7MP1fJnncTormxe8W85AP/lEiW4vRQwqvRbdfrNpjHzLGK4Q6O36X1RPxKIWI6FoJwgY7zPo52U0KrfnkvH5OROlZZwJVvxGFPGWxU7Vtho1u64fyUhgn78AS4K5TDHX3sSObsSdch+38Sy+wKWysqrabU4AI5a4INh8HvGRJAXzfRvJV0TY+XPKePwM4n1SrcSbtRI1VKiiGuxwJ4oXo4241I7iSmOtGF8MdvBVRRRt12xvfiJK0+SR1/XcrXIhd1rs5xNyt++HIyZWqFMIkBKx235x0/+qECXgOoYksfi+64jwPYUrURrsulXYYU2bSpyjaKug4WZ/bxCjaVJb2hzXF3pi3IQSrrkeKj01bGnVbK9ZNWMq2NCFyRVmgCsM5vuC9rdQlD6GA5jkGys8+8NuTvzpNpTI9okKsR58fhWTjzdF+fhzEpnbHtTH40ABa9qUop3ko5qKTIbK8hrK44jSZjI2l0aVZqyKDZbm6EGN+FY1WmjWrHURoxCw1OJQrAjzvYT4yxaZq1AmJtIyOTbRDSLQbjWAuz9ZhYKlNF3kpxd1JRkpNAuTpSttbK9Vpf24B6uqat50dCRuaSLgQuX4DsqbSOSbUaUzY4vdSbF+3cDrE+zWN01jac9NRbVm1dT5WeuiIKhH8egMRJeNMnZ1k9/pLdJkP9bRoU0vUCPt3b4i3vGJKrkqJMVY1x8DlWl2iuGrgn4PHkd8pqJYmaEQLfmcmVIj5ZVU3C/KoqgKUbHTz0/NtG2xk6iXx1pJ+XEjCi6W+U7Fbm5XTC41VHZxfZ/HIlLbwzdT5Iot3NuBvxKIeQFCV/YNJtiKbAkbW1Jc23PLZ2dIKjhBrxK4BFgYfuXRvZyB2QiluKWVqI+VUcIm3XuJ/FxUbi3GlUZNojQJWd/HOrq9vHQWJm2S5iRvHkw6CYGmKKOYzc+n/OU3Ufux41ucw/76JhL+gW2BxBqwIgZw64di4iTCRjF3fmVG+jt7s8B3EK5HSHm0L0fwRNLUSiSUo8qggXOoRJdBnm9Ubu2I64stET+Jl5CtENVFzLZrxjdqZkNqKYd3e2pzgug7f87oNYdA67mcLRcywRgRszL9uH/k8bBiTgGHY/auHUSVCCmCWLlJjHxeRLb8nLJ+M6pgpaOl6F4tWK/COAFbCKGiYrWX1Bu5pLpUQzQOleZovKLgGyO2tTge91wUNPBuiADmBynmc0eQ2/QmapxCUQG+szuuhB4lK/ambv1QxNHP2x9A1VhRkSURvo3KdSAdHuEqIJ5BXf9qbDVviniNQ9b3MZFrx7Xmpri6ZCRyEyup018VSDpYtjZGItuqmFFWoL7PI2AW5Irt+GtHuD9NuEvexfu5gg4Xy0Ro2VZWP7f9eB4Z/mPEgMr9IBcJ8tPhV379KqBAJEsUo3nydhwjI4H0NsCLSpJ2cuOz7ajYjtSbXOB4n16rFs23K6bojIwScmXkZ76xqy1y8SJufp4ODhSewUkBfP4PxYoawKZ/GkFV8baqznmZ6dsGxl6iwnfhN5wFBpGdqsVoQUfiOY0lRgNdMimggkTaiIrtVlRurZM4HQ9ZaVGUtJuXdHZNVG2XTUGCXogwaHGAzgjyX3ny1/4W9/lRYhyGs3huOMl+iRVfIe/9xzqWFCTS6kiJpXpxm8BlwA0wSAZ9aMRhWNC8xRfsNDZcPy+GxSWiSmsxPzk3Z5J+IWSiy9Dtub1TNltbZVN1QilwsJsADYUrBK529No3sFYc8EymgtYm+GWCzKDqu1TiiF67QTrbo1wqXdV36Vd6Lj3QqY7IL+cMDOJ9oBzPaSUyGJkIOsEJTsQ34nKzF9caFTHeBqvv41Gj9Fp121uYiCMXST7w1l8VlYjonjyF/xsR3THD0dS5Wg2W77M9qN//lwmiKK/CLZt3MFkq0+sL9811HohILuv0uKWfqv+VXbTisNL2tdhpObLDm6cwGvMGBB9X2jviStOIuPWDUt9hEMG5WGYaIyZp1uwGbyQfOs1R0VZMfM0k01dVqDWmuEmexhQm8KXXQxFEV/f9rxLVeomeh4lynqPW1cjH9qe5yHzRGu7Vny8MMzj4NrUYbdGcKSFMEDK4XkEi55LRBaLqUqwQBZz98Vb6jVE736zbvjfkw0d7KgLfE+SLFdjxcmKKlDQFdq5QZuyjIdhkcVC9inrHu8+JVJNFWTdiZv/w7NzXDloT3djto84P+suKV4iNaj32JFLAay7Y9mcw+JfiSmtLVG0UTJLWh9X1g2A8TWeYWRy1xXbR1AyhAq+XtQMgcyCXAVd/FPof5jaZYY57aLOBw8NJ9zAEiw68/oKIf7nU86oXtbjyuhLHH4JCcteNd6eX3HSve6qIHhQZgcgsUYoaWopGiSQfrLKzDsKd42KnnRubW7K5Xh1nisHKmiukiXRadbvYrth1zkgtWPmLoUhAH+Rqgcs7tOZO5UYS6lqlyn1Bm988PEG3i1ffqjDuOf4Qo3LKgohs6ni4BJFLRekO6gZH230tmcdQDrnXBlQs7ajU0bjSmDZxvxwu0QWMV9ctGz+3Ni71ChIHTHCH4ewvyAOCXCjIDSkpeUakx+2E35Y9PEEN4H++1XL1xRVSL5x1SqRwE59+a/Eer3KFwE/ESEuLtqRFO46QC+Q/Ux3G9MfVxvbc+Py8SdK66q7pnfuYBALvrDzQrpiFdsmMeSQfPt6HJnAV6NUgrYhEQDTPoSwwE06630Dwm/LjDrb8eJPja5/pc/jbT5XohUsaW3OdzUWf10p8OyU7imGKUCVFBkVFkMj3kvqijapLNRUSQhSbk2EoiBHXGIv80qgteqFM2PcoAAa5xWI/Z7CbInJYrAI4eizKuoDi/XpCZwgBcOR+ESd9oMNd21VlC9TXR/e5WC/zFbuP5mwBqCH44etfiQpzy78hgBFDx0R+0SQpYtOSYlIUGXa83N08KIsgopp6kVarajutapRTQc2DprFSZZWXFxwF4kGDSXNtQnKtQLNHX8qUdZFF+rL/Cojz2FkVBgBw8x1dqsUcx312kRveN5JOTLvvgbkJiPFIuGh2BUQHQc8IXgLKAsMAN1UZiMIw+Cho/ykApJfiO5OsZ5ZtupPtIE8JJtUjZdUYQKlkKJcs37kQ6rUGUa6S9mKTYuTBdI4Qb3n5Vk4UMQpmOcQ9kKKGxe58BB4h8OGX5RcjQJEKs2zF4yhSXqHiho+PVWMAkYlodlL2u7yO32BJ+w76RvAKNnBkiw7q/SwfhoOPOcD2Fat+0FcltDAMMlR7NNUQ4ehjwh8vMzIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjJWHf8/ftAmPsVSYvIAAAAldEVYdGRhdGU6Y3JlYXRlADIwMjAtMTAtMjlUMDI6NTA6MDYrMDA6MDASZ++eAAAAJXRFWHRkYXRlOm1vZGlmeQAyMDIwLTEwLTI5VDAyOjUwOjA2KzAwOjAwYzpXIgAAAABJRU5ErkJggg==`; diff --git a/src/views/demo/feat/download/index.vue b/src/views/demo/feat/download/index.vue deleted file mode 100644 index 159b1e8a..00000000 --- a/src/views/demo/feat/download/index.vue +++ /dev/null @@ -1,66 +0,0 @@ - - diff --git a/src/views/demo/feat/full-screen/index.vue b/src/views/demo/feat/full-screen/index.vue deleted file mode 100644 index a8fa2c7e..00000000 --- a/src/views/demo/feat/full-screen/index.vue +++ /dev/null @@ -1,48 +0,0 @@ - - diff --git a/src/views/demo/feat/icon/index.vue b/src/views/demo/feat/icon/index.vue deleted file mode 100644 index 7e3d50f8..00000000 --- a/src/views/demo/feat/icon/index.vue +++ /dev/null @@ -1,96 +0,0 @@ - - diff --git a/src/views/demo/feat/img-preview/index.vue b/src/views/demo/feat/img-preview/index.vue deleted file mode 100644 index b5ece2ea..00000000 --- a/src/views/demo/feat/img-preview/index.vue +++ /dev/null @@ -1,31 +0,0 @@ - - diff --git a/src/views/demo/feat/menu-params/index.vue b/src/views/demo/feat/menu-params/index.vue deleted file mode 100644 index 1a566b21..00000000 --- a/src/views/demo/feat/menu-params/index.vue +++ /dev/null @@ -1,42 +0,0 @@ - - diff --git a/src/views/demo/feat/msg/index.vue b/src/views/demo/feat/msg/index.vue deleted file mode 100644 index 6e8763f9..00000000 --- a/src/views/demo/feat/msg/index.vue +++ /dev/null @@ -1,100 +0,0 @@ - - diff --git a/src/views/demo/feat/print/index.vue b/src/views/demo/feat/print/index.vue deleted file mode 100644 index 556a3b78..00000000 --- a/src/views/demo/feat/print/index.vue +++ /dev/null @@ -1,49 +0,0 @@ - - diff --git a/src/views/demo/feat/request-demo/index.vue b/src/views/demo/feat/request-demo/index.vue deleted file mode 100644 index eb01a231..00000000 --- a/src/views/demo/feat/request-demo/index.vue +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/src/views/demo/feat/ripple/index.vue b/src/views/demo/feat/ripple/index.vue deleted file mode 100644 index a7956e8a..00000000 --- a/src/views/demo/feat/ripple/index.vue +++ /dev/null @@ -1,31 +0,0 @@ - - - - diff --git a/src/views/demo/feat/session-timeout/index.vue b/src/views/demo/feat/session-timeout/index.vue deleted file mode 100644 index 2a0c3282..00000000 --- a/src/views/demo/feat/session-timeout/index.vue +++ /dev/null @@ -1,54 +0,0 @@ - - diff --git a/src/views/demo/feat/tab-params/index.vue b/src/views/demo/feat/tab-params/index.vue deleted file mode 100644 index c2e06fee..00000000 --- a/src/views/demo/feat/tab-params/index.vue +++ /dev/null @@ -1,27 +0,0 @@ - - diff --git a/src/views/demo/feat/tabs/TabDetail.vue b/src/views/demo/feat/tabs/TabDetail.vue deleted file mode 100644 index d768cca1..00000000 --- a/src/views/demo/feat/tabs/TabDetail.vue +++ /dev/null @@ -1,28 +0,0 @@ - - - diff --git a/src/views/demo/feat/tabs/index.vue b/src/views/demo/feat/tabs/index.vue deleted file mode 100644 index a1bb519e..00000000 --- a/src/views/demo/feat/tabs/index.vue +++ /dev/null @@ -1,69 +0,0 @@ - - diff --git a/src/views/demo/feat/watermark/index.vue b/src/views/demo/feat/watermark/index.vue deleted file mode 100644 index a8a22d22..00000000 --- a/src/views/demo/feat/watermark/index.vue +++ /dev/null @@ -1,32 +0,0 @@ - - diff --git a/src/views/demo/feat/ws/index.vue b/src/views/demo/feat/ws/index.vue deleted file mode 100644 index 31deafd3..00000000 --- a/src/views/demo/feat/ws/index.vue +++ /dev/null @@ -1,127 +0,0 @@ - - diff --git a/src/views/demo/form/AdvancedForm.vue b/src/views/demo/form/AdvancedForm.vue deleted file mode 100644 index 48726989..00000000 --- a/src/views/demo/form/AdvancedForm.vue +++ /dev/null @@ -1,195 +0,0 @@ - - diff --git a/src/views/demo/form/AppendForm.vue b/src/views/demo/form/AppendForm.vue deleted file mode 100644 index eda61878..00000000 --- a/src/views/demo/form/AppendForm.vue +++ /dev/null @@ -1,118 +0,0 @@ - - diff --git a/src/views/demo/form/CustomerForm.vue b/src/views/demo/form/CustomerForm.vue deleted file mode 100644 index abb384d6..00000000 --- a/src/views/demo/form/CustomerForm.vue +++ /dev/null @@ -1,85 +0,0 @@ - - diff --git a/src/views/demo/form/DynamicForm.vue b/src/views/demo/form/DynamicForm.vue deleted file mode 100644 index 08fa8ab5..00000000 --- a/src/views/demo/form/DynamicForm.vue +++ /dev/null @@ -1,246 +0,0 @@ - - diff --git a/src/views/demo/form/RefForm.vue b/src/views/demo/form/RefForm.vue deleted file mode 100644 index 20fa7b6b..00000000 --- a/src/views/demo/form/RefForm.vue +++ /dev/null @@ -1,188 +0,0 @@ - - diff --git a/src/views/demo/form/RuleForm.vue b/src/views/demo/form/RuleForm.vue deleted file mode 100644 index 8124dae7..00000000 --- a/src/views/demo/form/RuleForm.vue +++ /dev/null @@ -1,258 +0,0 @@ - - diff --git a/src/views/demo/form/TabsForm.vue b/src/views/demo/form/TabsForm.vue deleted file mode 100644 index 16152d43..00000000 --- a/src/views/demo/form/TabsForm.vue +++ /dev/null @@ -1,136 +0,0 @@ - - - - - diff --git a/src/views/demo/form/UseForm.vue b/src/views/demo/form/UseForm.vue deleted file mode 100644 index 95e8fb9c..00000000 --- a/src/views/demo/form/UseForm.vue +++ /dev/null @@ -1,268 +0,0 @@ - - diff --git a/src/views/demo/form/index.vue b/src/views/demo/form/index.vue deleted file mode 100644 index c6e96bf6..00000000 --- a/src/views/demo/form/index.vue +++ /dev/null @@ -1,667 +0,0 @@ - - diff --git a/src/views/demo/level/Menu111.vue b/src/views/demo/level/Menu111.vue deleted file mode 100644 index 23305d37..00000000 --- a/src/views/demo/level/Menu111.vue +++ /dev/null @@ -1,12 +0,0 @@ - - diff --git a/src/views/demo/level/Menu12.vue b/src/views/demo/level/Menu12.vue deleted file mode 100644 index 2f696825..00000000 --- a/src/views/demo/level/Menu12.vue +++ /dev/null @@ -1,12 +0,0 @@ - - diff --git a/src/views/demo/level/Menu2.vue b/src/views/demo/level/Menu2.vue deleted file mode 100644 index 527ff2f9..00000000 --- a/src/views/demo/level/Menu2.vue +++ /dev/null @@ -1,15 +0,0 @@ - - diff --git a/src/views/demo/main-out/index.vue b/src/views/demo/main-out/index.vue deleted file mode 100644 index 2406632f..00000000 --- a/src/views/demo/main-out/index.vue +++ /dev/null @@ -1,6 +0,0 @@ - diff --git a/src/views/demo/page/account/center/Application.vue b/src/views/demo/page/account/center/Application.vue deleted file mode 100644 index 636e57ce..00000000 --- a/src/views/demo/page/account/center/Application.vue +++ /dev/null @@ -1,92 +0,0 @@ - - - diff --git a/src/views/demo/page/account/center/Article.vue b/src/views/demo/page/account/center/Article.vue deleted file mode 100644 index bb71cc91..00000000 --- a/src/views/demo/page/account/center/Article.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - diff --git a/src/views/demo/page/account/center/Project.vue b/src/views/demo/page/account/center/Project.vue deleted file mode 100644 index 296cbc7e..00000000 --- a/src/views/demo/page/account/center/Project.vue +++ /dev/null @@ -1,71 +0,0 @@ - - - diff --git a/src/views/demo/page/account/center/data.tsx b/src/views/demo/page/account/center/data.tsx deleted file mode 100644 index 51a4d2b0..00000000 --- a/src/views/demo/page/account/center/data.tsx +++ /dev/null @@ -1,132 +0,0 @@ -export interface ListItem { - title: string; - icon: string; - color?: string; -} - -export interface TabItem { - key: string; - name: string; - component: string; -} - -export const tags: string[] = [ - '很有想法的', - '专注设计', - '川妹子', - '大长腿', - '海纳百川', - '前端开发', - 'vue3', -]; - -export const teams: ListItem[] = [ - { - icon: 'ri:alipay-fill', - title: '科学搬砖组', - color: '#ff4000', - }, - { - icon: 'emojione-monotone:letter-a', - title: '中二少年团', - color: '#7c51b8', - }, - { - icon: 'ri:alipay-fill', - title: '高逼格设计', - color: '#00adf7', - }, - { - icon: 'jam:codepen-circle', - title: '程序员日常', - color: '#00adf7', - }, - { - icon: 'fa:behance-square', - title: '科学搬砖组', - color: '#7c51b8', - }, - { - icon: 'jam:codepen-circle', - title: '程序员日常', - color: '#ff4000', - }, -]; - -export const details: ListItem[] = [ - { - icon: 'ic:outline-contacts', - title: '交互专家', - }, - { - icon: 'grommet-icons:cluster', - title: '某某某事业群', - }, - { - icon: 'bx:bx-home-circle', - title: '福建省厦门市', - }, -]; - -export const achieveList: TabItem[] = [ - { - key: '1', - name: '文章', - component: 'Article', - }, - { - key: '2', - name: '应用', - component: 'Application', - }, - { - key: '3', - name: '项目', - component: 'Project', - }, -]; - -export const actions: any[] = [ - { icon: 'clarity:star-line', text: '156', color: '#018ffb' }, - { icon: 'bx:bxs-like', text: '156', color: '#459ae8' }, - { icon: 'bx:bxs-message-dots', text: '2', color: '#42d27d' }, -]; - -export const articleList = (() => { - const result: any[] = []; - for (let i = 0; i < 4; i++) { - result.push({ - title: 'Vben Admin', - description: ['Vben', '设计语言', 'Typescript'], - content: '基于Vue Next, TypeScript, Ant Design实现的一套完整的企业级后台管理系统。', - time: '2020-11-14 11:20', - }); - } - return result; -})(); - -export const applicationList = (() => { - const result: any[] = []; - for (let i = 0; i < 8; i++) { - result.push({ - title: 'Vben Admin', - icon: 'emojione-monotone:letter-a', - color: '#1890ff', - active: '100', - new: '1,799', - download: 'bx:bx-download', - }); - } - return result; -})(); - -export const projectList = (() => { - const result: any[] = []; - for (let i = 0; i < 8; i++) { - result.push({ - title: 'Vben Admin', - content: '基于Vue Next, TypeScript, Ant Design实现的一套完整的企业级后台管理系统。', - }); - } - return result; -})(); diff --git a/src/views/demo/page/account/center/index.vue b/src/views/demo/page/account/center/index.vue deleted file mode 100644 index ae82aeba..00000000 --- a/src/views/demo/page/account/center/index.vue +++ /dev/null @@ -1,155 +0,0 @@ - - - - diff --git a/src/views/demo/page/account/setting/AccountBind.vue b/src/views/demo/page/account/setting/AccountBind.vue deleted file mode 100644 index 4f904081..00000000 --- a/src/views/demo/page/account/setting/AccountBind.vue +++ /dev/null @@ -1,59 +0,0 @@ - - - diff --git a/src/views/demo/page/account/setting/BaseSetting.vue b/src/views/demo/page/account/setting/BaseSetting.vue deleted file mode 100644 index 36467ac5..00000000 --- a/src/views/demo/page/account/setting/BaseSetting.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - - diff --git a/src/views/demo/page/account/setting/MsgNotify.vue b/src/views/demo/page/account/setting/MsgNotify.vue deleted file mode 100644 index 3d0220a5..00000000 --- a/src/views/demo/page/account/setting/MsgNotify.vue +++ /dev/null @@ -1,53 +0,0 @@ - - - diff --git a/src/views/demo/page/account/setting/SecureSetting.vue b/src/views/demo/page/account/setting/SecureSetting.vue deleted file mode 100644 index 693f6ffc..00000000 --- a/src/views/demo/page/account/setting/SecureSetting.vue +++ /dev/null @@ -1,47 +0,0 @@ - - - diff --git a/src/views/demo/page/account/setting/data.ts b/src/views/demo/page/account/setting/data.ts deleted file mode 100644 index 01478a50..00000000 --- a/src/views/demo/page/account/setting/data.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { FormSchema } from '/@/components/Form/index'; - -export interface ListItem { - key: string; - title: string; - description: string; - extra?: string; - avatar?: string; - color?: string; -} - -// tab的list -export const settingList = [ - { - key: '1', - name: '基本设置', - component: 'BaseSetting', - }, - { - key: '2', - name: '安全设置', - component: 'SecureSetting', - }, - { - key: '3', - name: '账号绑定', - component: 'AccountBind', - }, - { - key: '4', - name: '新消息通知', - component: 'MsgNotify', - }, -]; - -// 基础设置 form -export const baseSetschemas: FormSchema[] = [ - { - field: 'email', - component: 'Input', - label: '邮箱', - colProps: { span: 18 }, - }, - { - field: 'name', - component: 'Input', - label: '昵称', - colProps: { span: 18 }, - }, - { - field: 'introduction', - component: 'InputTextArea', - label: '个人简介', - colProps: { span: 18 }, - }, - { - field: 'phone', - component: 'Input', - label: '联系电话', - colProps: { span: 18 }, - }, - { - field: 'address', - component: 'Input', - label: '所在地区', - colProps: { span: 18 }, - }, -]; - -// 安全设置 list -export const secureSettingList: ListItem[] = [ - { - key: '1', - title: '账户密码', - description: '当前密码强度::强', - extra: '修改', - }, - { - key: '2', - title: '密保手机', - description: '已绑定手机::138****8293', - extra: '修改', - }, - { - key: '3', - title: '密保问题', - description: '未设置密保问题,密保问题可有效保护账户安全', - extra: '修改', - }, - { - key: '4', - title: '备用邮箱', - description: '已绑定邮箱::ant***sign.com', - extra: '修改', - }, - { - key: '5', - title: 'MFA 设备', - description: '未绑定 MFA 设备,绑定后,可以进行二次确认', - extra: '修改', - }, -]; - -// 账号绑定 list -export const accountBindList: ListItem[] = [ - { - key: '1', - title: '绑定淘宝', - description: '当前未绑定淘宝账号', - extra: '绑定', - avatar: 'ri:taobao-fill', - color: '#ff4000', - }, - { - key: '2', - title: '绑定支付宝', - description: '当前未绑定支付宝账号', - extra: '绑定', - avatar: 'fa-brands:alipay', - color: '#2eabff', - }, - { - key: '3', - title: '绑定钉钉', - description: '当前未绑定钉钉账号', - extra: '绑定', - avatar: 'ri:dingding-fill', - color: '#2eabff', - }, -]; - -// 新消息通知 list -export const msgNotifyList: ListItem[] = [ - { - key: '1', - title: '账户密码', - description: '其他用户的消息将以站内信的形式通知', - }, - { - key: '2', - title: '系统消息', - description: '系统消息将以站内信的形式通知', - }, - { - key: '3', - title: '待办任务', - description: '待办任务将以站内信的形式通知', - }, -]; diff --git a/src/views/demo/page/account/setting/index.vue b/src/views/demo/page/account/setting/index.vue deleted file mode 100644 index dffa2f62..00000000 --- a/src/views/demo/page/account/setting/index.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - - diff --git a/src/views/demo/page/desc/basic/data.tsx b/src/views/demo/page/desc/basic/data.tsx deleted file mode 100644 index d640b62a..00000000 --- a/src/views/demo/page/desc/basic/data.tsx +++ /dev/null @@ -1,196 +0,0 @@ -import { DescItem } from '/@/components/Description/index'; -import { BasicColumn } from '/@/components/Table/src/types/table'; -import { Button } from '/@/components/Button'; - -import { Badge } from 'ant-design-vue'; - -export const refundData = { - a1: '1000000000', - a2: '已取货', - a3: '1234123421', - a4: '3214321432', -}; - -export const personData = { - b1: '付小小', - b2: '18100000000', - b3: '菜鸟仓储', - b4: '浙江省杭州市西湖区万塘路18号', - b5: '无', -}; -export const refundSchema: DescItem[] = [ - { - field: 'a1', - label: '取货单号', - }, - { - field: 'a2', - label: '状态', - }, - { - field: 'a3', - label: '销售单号', - }, - { - field: 'a4', - label: '子订单', - }, -]; -export const personSchema: DescItem[] = [ - { - field: 'b1', - label: '用户姓名', - }, - { - field: 'b2', - label: '联系电话', - }, - { - field: 'b3', - label: '常用快递', - }, - { - field: 'b4', - label: '取货地址', - }, - { - field: 'b5', - label: '备注', - }, -]; - -export const refundTableSchema: BasicColumn[] = [ - { - title: '商品编号', - width: 150, - dataIndex: 't1', - customRender: ({ record }) => { - return ( - - ); - }, - }, - { - title: '商品名称', - width: 150, - dataIndex: 't2', - }, - { - title: '商品条码', - width: 150, - dataIndex: 't3', - }, - { - title: '单价 ', - width: 150, - dataIndex: 't4', - }, - { - title: '数量(件) ', - width: 150, - dataIndex: 't5', - }, - { - title: '金额', - width: 150, - dataIndex: 't6', - }, -]; -export const refundTimeTableSchema: BasicColumn[] = [ - { - title: '时间', - width: 150, - dataIndex: 't1', - }, - { - title: '当前进度', - width: 150, - dataIndex: 't2', - }, - { - title: '状态', - width: 150, - dataIndex: 't3', - customRender: ({ record }) => { - return ; - }, - }, - { - title: '操作员ID ', - width: 150, - dataIndex: 't4', - }, - { - title: '耗时', - width: 150, - dataIndex: 't5', - }, -]; - -export const refundTableData: any[] = [ - { - t1: 1234561, - t2: '矿泉水 550ml', - t3: '12421432143214321', - t4: '2.00', - t5: 1, - t6: 2.0, - }, - { - t1: 1234562, - t2: '矿泉水 550ml', - t3: '12421432143214321', - t4: '2.00', - t5: 2, - t6: 2.0, - }, - { - t1: 1234562, - t2: '矿泉水 550ml', - t3: '12421432143214321', - t4: '2.00', - t5: 2, - t6: 2.0, - }, - { - t1: 1234562, - t2: '矿泉水 550ml', - t3: '12421432143214321', - t4: '2.00', - t5: 2, - t6: 2.0, - }, -]; - -export const refundTimeTableData: any[] = [ - { - t1: '2017-10-01 14:10', - t2: '联系客户', - t3: '进行中', - t4: '取货员 ID1234', - t5: '5mins', - }, - { - t1: '2017-10-01 14:10', - t2: '取货员出发', - t3: '成功', - t4: '取货员 ID1234', - t5: '5mins', - }, - { - t1: '2017-10-01 14:10', - t2: '取货员接单', - t3: '成功', - t4: '系统', - t5: '5mins', - }, - { - t1: '2017-10-01 14:10', - t2: '申请审批通过', - t3: '成功', - t4: '用户', - t5: '1h', - }, -]; diff --git a/src/views/demo/page/desc/basic/index.vue b/src/views/demo/page/desc/basic/index.vue deleted file mode 100644 index 7dfbc56d..00000000 --- a/src/views/demo/page/desc/basic/index.vue +++ /dev/null @@ -1,98 +0,0 @@ - - - diff --git a/src/views/demo/page/desc/high/data.tsx b/src/views/demo/page/desc/high/data.tsx deleted file mode 100644 index ec7a7c39..00000000 --- a/src/views/demo/page/desc/high/data.tsx +++ /dev/null @@ -1,65 +0,0 @@ -import { BasicColumn } from '/@/components/Table/src/types/table'; - -import { Badge } from 'ant-design-vue'; - -export const refundTimeTableSchema: BasicColumn[] = [ - { - title: '时间', - width: 150, - dataIndex: 't1', - }, - { - title: '当前进度', - width: 150, - dataIndex: 't2', - }, - { - title: '状态', - width: 150, - dataIndex: 't3', - customRender: ({ record }) => { - return ; - }, - }, - { - title: '操作员ID ', - width: 150, - dataIndex: 't4', - }, - { - title: '耗时', - width: 150, - dataIndex: 't5', - }, -]; - -export const refundTimeTableData: any[] = [ - { - t1: '2017-10-01 14:10', - t2: '联系客户', - t3: '进行中', - t4: '取货员 ID1234', - t5: '5mins', - }, - { - t1: '2017-10-01 14:10', - t2: '取货员出发', - t3: '成功', - t4: '取货员 ID1234', - t5: '5mins', - }, - { - t1: '2017-10-01 14:10', - t2: '取货员接单', - t3: '成功', - t4: '系统', - t5: '5mins', - }, - { - t1: '2017-10-01 14:10', - t2: '申请审批通过', - t3: '成功', - t4: '用户', - t5: '1h', - }, -]; diff --git a/src/views/demo/page/desc/high/index.vue b/src/views/demo/page/desc/high/index.vue deleted file mode 100644 index 908d4d29..00000000 --- a/src/views/demo/page/desc/high/index.vue +++ /dev/null @@ -1,131 +0,0 @@ - - diff --git a/src/views/demo/page/form/basic/data.ts b/src/views/demo/page/form/basic/data.ts deleted file mode 100644 index f1f8e676..00000000 --- a/src/views/demo/page/form/basic/data.ts +++ /dev/null @@ -1,138 +0,0 @@ -import { FormSchema } from '/@/components/Form'; -const colProps = { - span: 8, -}; - -export const schemas: FormSchema[] = [ - { - field: 'title', - component: 'Input', - label: '标题', - colProps, - componentProps: { - placeholder: '给目标起个名字', - }, - required: true, - }, - { - field: 'time', - component: 'RangePicker', - label: '起止日期', - colProps, - required: true, - }, - { - field: 'client', - component: 'Input', - colProps, - label: '客户', - helpMessage: '目标的服务对象', - subLabel: '( 选填 )', - componentProps: { - placeholder: '请描述你服务的客户,内部客户直接 @姓名/工号', - }, - }, - { - field: 'weights', - component: 'InputNumber', - label: '权重', - colProps, - subLabel: '( 选填 )', - componentProps: { - formatter: (value: string) => (value ? `${value}%` : ''), - parser: (value: string) => value.replace('%', ''), - placeholder: '请输入', - }, - }, - { - field: 'target', - component: 'InputTextArea', - label: '目标描述', - colProps, - componentProps: { - placeholder: '请输入你的阶段性工作目标', - rows: 4, - }, - required: true, - }, - { - field: 'metrics', - component: 'InputTextArea', - label: '衡量标准', - colProps, - componentProps: { - placeholder: '请输入衡量标准', - rows: 4, - }, - required: true, - }, - - { - field: 'inviteer', - component: 'Input', - label: '邀评人', - colProps: { - span: 8, - }, - subLabel: '( 选填 )', - componentProps: { - placeholder: '请直接 @姓名/工号,最多可邀请 5 人', - }, - }, - { - field: 'disclosure', - component: 'RadioGroup', - label: '目标公开', - colProps: { - span: 16, - }, - itemProps: { - extra: '客户、邀评人默认被分享', - }, - componentProps: { - options: [ - { - label: '公开', - value: '1', - }, - { - label: '部分公开', - value: '2', - }, - { - label: '不公开', - value: '3', - }, - ], - }, - }, - { - field: 'disclosure', - component: 'Select', - label: ' ', - colProps: { - span: 8, - }, - show: ({ model }) => { - return model.disclosure === '2'; - }, - componentProps: { - placeholder: '公开给', - mode: 'multiple', - options: [ - { - label: '同事1', - value: '1', - }, - { - label: '同事2', - value: '2', - }, - { - label: '同事3', - value: '3', - }, - ], - }, - }, -]; diff --git a/src/views/demo/page/form/basic/index.vue b/src/views/demo/page/form/basic/index.vue deleted file mode 100644 index d91a79c5..00000000 --- a/src/views/demo/page/form/basic/index.vue +++ /dev/null @@ -1,69 +0,0 @@ - - - diff --git a/src/views/demo/page/form/high/PersonTable.vue b/src/views/demo/page/form/high/PersonTable.vue deleted file mode 100644 index 734bdf54..00000000 --- a/src/views/demo/page/form/high/PersonTable.vue +++ /dev/null @@ -1,146 +0,0 @@ - - diff --git a/src/views/demo/page/form/high/data.ts b/src/views/demo/page/form/high/data.ts deleted file mode 100644 index 73d17d88..00000000 --- a/src/views/demo/page/form/high/data.ts +++ /dev/null @@ -1,149 +0,0 @@ -import { FormSchema } from '/@/components/Form'; - -const basicOptions: LabelValueOptions = [ - { - label: '付晓晓', - value: '1', - }, - { - label: '周毛毛', - value: '2', - }, -]; - -const storeTypeOptions: LabelValueOptions = [ - { - label: '私密', - value: '1', - }, - { - label: '公开', - value: '2', - }, -]; - -export const schemas: FormSchema[] = [ - { - field: 'f1', - component: 'Input', - label: '仓库名', - required: true, - }, - { - field: 'f2', - component: 'Input', - label: '仓库域名', - required: true, - componentProps: { - addonBefore: 'http://', - addonAfter: 'com', - }, - colProps: { - offset: 2, - }, - }, - { - field: 'f3', - component: 'Select', - label: '仓库管理员', - componentProps: { - options: basicOptions, - }, - required: true, - colProps: { - offset: 2, - }, - }, - { - field: 'f4', - component: 'Select', - label: '审批人', - componentProps: { - options: basicOptions, - }, - required: true, - }, - { - field: 'f5', - component: 'RangePicker', - label: '生效日期', - required: true, - colProps: { - offset: 2, - }, - }, - { - field: 'f6', - component: 'Select', - label: '仓库类型', - componentProps: { - options: storeTypeOptions, - }, - required: true, - colProps: { - offset: 2, - }, - }, -]; -export const taskSchemas: FormSchema[] = [ - { - field: 't1', - component: 'Input', - label: '任务名', - required: true, - }, - { - field: 't2', - component: 'Input', - label: '任务描述', - required: true, - colProps: { - offset: 2, - }, - }, - { - field: 't3', - component: 'Select', - label: '执行人', - componentProps: { - options: basicOptions, - }, - required: true, - colProps: { - offset: 2, - }, - }, - { - field: 't4', - component: 'Select', - label: '责任人', - componentProps: { - options: basicOptions, - }, - required: true, - }, - { - field: 't5', - component: 'TimePicker', - label: '生效日期', - required: true, - componentProps: { - style: { width: '100%' }, - }, - colProps: { - offset: 2, - }, - }, - { - field: 't6', - component: 'Select', - label: '任务类型', - componentProps: { - options: storeTypeOptions, - }, - required: true, - colProps: { - offset: 2, - }, - }, -]; diff --git a/src/views/demo/page/form/high/index.vue b/src/views/demo/page/form/high/index.vue deleted file mode 100644 index f73d3d13..00000000 --- a/src/views/demo/page/form/high/index.vue +++ /dev/null @@ -1,73 +0,0 @@ - - - diff --git a/src/views/demo/page/form/step/Step1.vue b/src/views/demo/page/form/step/Step1.vue deleted file mode 100644 index 29f16577..00000000 --- a/src/views/demo/page/form/step/Step1.vue +++ /dev/null @@ -1,103 +0,0 @@ - - - diff --git a/src/views/demo/page/form/step/Step2.vue b/src/views/demo/page/form/step/Step2.vue deleted file mode 100644 index 75ae50c6..00000000 --- a/src/views/demo/page/form/step/Step2.vue +++ /dev/null @@ -1,78 +0,0 @@ - - - diff --git a/src/views/demo/page/form/step/Step3.vue b/src/views/demo/page/form/step/Step3.vue deleted file mode 100644 index ac0380af..00000000 --- a/src/views/demo/page/form/step/Step3.vue +++ /dev/null @@ -1,49 +0,0 @@ - - - diff --git a/src/views/demo/page/form/step/data.tsx b/src/views/demo/page/form/step/data.tsx deleted file mode 100644 index 81659cd9..00000000 --- a/src/views/demo/page/form/step/data.tsx +++ /dev/null @@ -1,78 +0,0 @@ -import { FormSchema } from '/@/components/Form'; - -export const step1Schemas: FormSchema[] = [ - { - field: 'account', - component: 'Select', - label: '付款账户', - required: true, - defaultValue: '1', - componentProps: { - options: [ - { - label: 'anncwb@126.com', - value: '1', - }, - ], - }, - colProps: { - span: 24, - }, - }, - { - field: 'fac', - component: 'InputGroup', - label: '收款账户', - required: true, - defaultValue: 'test@example.com', - slot: 'fac', - colProps: { - span: 24, - }, - }, - { - field: 'pay', - component: 'Input', - label: '', - defaultValue: 'zfb', - show: false, - }, - { - field: 'payeeName', - component: 'Input', - label: '收款人姓名', - defaultValue: 'Vben', - required: true, - colProps: { - span: 24, - }, - }, - { - field: 'money', - component: 'Input', - label: '转账金额', - defaultValue: '500', - required: true, - renderComponentContent: () => { - return { - prefix: () => '¥', - }; - }, - colProps: { - span: 24, - }, - }, -]; - -export const step2Schemas: FormSchema[] = [ - { - field: 'pwd', - component: 'InputPassword', - label: '支付密码', - required: true, - defaultValue: '123456', - colProps: { - span: 24, - }, - }, -]; diff --git a/src/views/demo/page/form/step/index.vue b/src/views/demo/page/form/step/index.vue deleted file mode 100644 index a3a24ca5..00000000 --- a/src/views/demo/page/form/step/index.vue +++ /dev/null @@ -1,96 +0,0 @@ - - - diff --git a/src/views/demo/page/list/basic/data.tsx b/src/views/demo/page/list/basic/data.tsx deleted file mode 100644 index f452c905..00000000 --- a/src/views/demo/page/list/basic/data.tsx +++ /dev/null @@ -1,17 +0,0 @@ -export const cardList = (() => { - const result: any[] = []; - for (let i = 0; i < 6; i++) { - result.push({ - id: i, - title: 'Vben Admin', - description: '基于Vue Next, TypeScript, Ant Design Vue实现的一套完整的企业级后台管理系统', - datetime: '2020-11-26 17:39', - extra: '编辑', - icon: 'logos:vue', - color: '#1890ff', - author: 'Vben', - percent: 20 * (i + 1), - }); - } - return result; -})(); diff --git a/src/views/demo/page/list/basic/index.vue b/src/views/demo/page/list/basic/index.vue deleted file mode 100644 index 7232195e..00000000 --- a/src/views/demo/page/list/basic/index.vue +++ /dev/null @@ -1,161 +0,0 @@ - - - diff --git a/src/views/demo/page/list/card/data.tsx b/src/views/demo/page/list/card/data.tsx deleted file mode 100644 index c4a156aa..00000000 --- a/src/views/demo/page/list/card/data.tsx +++ /dev/null @@ -1,14 +0,0 @@ -export const cardList = (() => { - const result: any[] = []; - for (let i = 0; i < 12; i++) { - result.push({ - title: 'Vben Admin', - icon: 'logos:vue', - color: '#1890ff', - active: '100', - new: '1,799', - download: 'bx:bx-download', - }); - } - return result; -})(); diff --git a/src/views/demo/page/list/card/index.vue b/src/views/demo/page/list/card/index.vue deleted file mode 100644 index 40b46c10..00000000 --- a/src/views/demo/page/list/card/index.vue +++ /dev/null @@ -1,104 +0,0 @@ - - - diff --git a/src/views/demo/page/list/search/data.tsx b/src/views/demo/page/list/search/data.tsx deleted file mode 100644 index e2a163f6..00000000 --- a/src/views/demo/page/list/search/data.tsx +++ /dev/null @@ -1,37 +0,0 @@ -import { FormSchema } from '/@/components/Form/index'; - -export const searchList = (() => { - const result: any[] = []; - for (let i = 0; i < 6; i++) { - result.push({ - id: i, - title: 'Vben Admin', - description: ['Vben', '设计语言', 'Typescript'], - content: '基于Vue Next, TypeScript, Ant Design实现的一套完整的企业级后台管理系统。', - time: '2020-11-14 11:20', - }); - } - return result; -})(); - -export const actions: any[] = [ - { icon: 'clarity:star-line', text: '156', color: '#018ffb' }, - { icon: 'bx:bxs-like', text: '156', color: '#459ae8' }, - { icon: 'bx:bxs-message-dots', text: '2', color: '#42d27d' }, -]; - -export const schemas: FormSchema[] = [ - { - field: 'field1', - component: 'InputSearch', - label: '项目名', - colProps: { - span: 8, - }, - componentProps: { - onChange: (e: any) => { - console.log(e); - }, - }, - }, -]; diff --git a/src/views/demo/page/list/search/index.vue b/src/views/demo/page/list/search/index.vue deleted file mode 100644 index 9ada74f3..00000000 --- a/src/views/demo/page/list/search/index.vue +++ /dev/null @@ -1,135 +0,0 @@ - - - diff --git a/src/views/demo/page/result/fail/index.vue b/src/views/demo/page/result/fail/index.vue deleted file mode 100644 index 727d141d..00000000 --- a/src/views/demo/page/result/fail/index.vue +++ /dev/null @@ -1,54 +0,0 @@ - - - diff --git a/src/views/demo/page/result/success/index.vue b/src/views/demo/page/result/success/index.vue deleted file mode 100644 index 79b9947e..00000000 --- a/src/views/demo/page/result/success/index.vue +++ /dev/null @@ -1,61 +0,0 @@ - - - diff --git a/src/views/demo/permission/CurrentPermissionMode.vue b/src/views/demo/permission/CurrentPermissionMode.vue deleted file mode 100644 index 43b9eb33..00000000 --- a/src/views/demo/permission/CurrentPermissionMode.vue +++ /dev/null @@ -1,32 +0,0 @@ - - diff --git a/src/views/demo/permission/back/Btn.vue b/src/views/demo/permission/back/Btn.vue deleted file mode 100644 index bc8b7024..00000000 --- a/src/views/demo/permission/back/Btn.vue +++ /dev/null @@ -1,107 +0,0 @@ - - - diff --git a/src/views/demo/permission/back/index.vue b/src/views/demo/permission/back/index.vue deleted file mode 100644 index d9ef5d47..00000000 --- a/src/views/demo/permission/back/index.vue +++ /dev/null @@ -1,70 +0,0 @@ - - - diff --git a/src/views/demo/permission/front/AuthPageA.vue b/src/views/demo/permission/front/AuthPageA.vue deleted file mode 100644 index 518c89b5..00000000 --- a/src/views/demo/permission/front/AuthPageA.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/src/views/demo/permission/front/AuthPageB.vue b/src/views/demo/permission/front/AuthPageB.vue deleted file mode 100644 index 7c4042dd..00000000 --- a/src/views/demo/permission/front/AuthPageB.vue +++ /dev/null @@ -1,19 +0,0 @@ - - - diff --git a/src/views/demo/permission/front/Btn.vue b/src/views/demo/permission/front/Btn.vue deleted file mode 100644 index 40656156..00000000 --- a/src/views/demo/permission/front/Btn.vue +++ /dev/null @@ -1,93 +0,0 @@ - - - diff --git a/src/views/demo/permission/front/index.vue b/src/views/demo/permission/front/index.vue deleted file mode 100644 index cb093582..00000000 --- a/src/views/demo/permission/front/index.vue +++ /dev/null @@ -1,57 +0,0 @@ - - - diff --git a/src/views/demo/system/account/AccountDetail.vue b/src/views/demo/system/account/AccountDetail.vue deleted file mode 100644 index 150cc8b5..00000000 --- a/src/views/demo/system/account/AccountDetail.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - - diff --git a/src/views/demo/system/account/AccountModal.vue b/src/views/demo/system/account/AccountModal.vue deleted file mode 100644 index 167bb720..00000000 --- a/src/views/demo/system/account/AccountModal.vue +++ /dev/null @@ -1,74 +0,0 @@ - - diff --git a/src/views/demo/system/account/DeptTree.vue b/src/views/demo/system/account/DeptTree.vue deleted file mode 100644 index 81f082a9..00000000 --- a/src/views/demo/system/account/DeptTree.vue +++ /dev/null @@ -1,43 +0,0 @@ - - diff --git a/src/views/demo/system/account/account.data.ts b/src/views/demo/system/account/account.data.ts deleted file mode 100644 index ade68c10..00000000 --- a/src/views/demo/system/account/account.data.ts +++ /dev/null @@ -1,127 +0,0 @@ -import { getAllRoleList, isAccountExist } from '/@/api/demo/system'; -import { BasicColumn } from '/@/components/Table'; -import { FormSchema } from '/@/components/Table'; - -export const columns: BasicColumn[] = [ - { - title: '用户名', - dataIndex: 'account', - width: 120, - }, - { - title: '昵称', - dataIndex: 'nickname', - width: 120, - }, - { - title: '邮箱', - dataIndex: 'email', - width: 120, - }, - { - title: '创建时间', - dataIndex: 'createTime', - width: 180, - }, - { - title: '角色', - dataIndex: 'role', - width: 200, - }, - { - title: '备注', - dataIndex: 'remark', - }, -]; - -export const searchFormSchema: FormSchema[] = [ - { - field: 'account', - label: '用户名', - component: 'Input', - colProps: { span: 8 }, - }, - { - field: 'nickname', - label: '昵称', - component: 'Input', - colProps: { span: 8 }, - }, -]; - -export const accountFormSchema: FormSchema[] = [ - { - field: 'account', - label: '用户名', - component: 'Input', - helpMessage: ['本字段演示异步验证', '不能输入带有admin的用户名'], - rules: [ - { - required: true, - message: '请输入用户名', - }, - { - validator(_, value) { - return new Promise((resolve, reject) => { - isAccountExist(value) - .then(() => resolve()) - .catch((err) => { - reject(err.message || '验证失败'); - }); - }); - }, - }, - ], - }, - { - field: 'pwd', - label: '密码', - component: 'InputPassword', - required: true, - ifShow: false, - }, - { - label: '角色', - field: 'role', - component: 'ApiSelect', - componentProps: { - api: getAllRoleList, - labelField: 'roleName', - valueField: 'roleValue', - }, - required: true, - }, - { - field: 'dept', - label: '所属部门', - component: 'TreeSelect', - componentProps: { - fieldNames: { - label: 'deptName', - key: 'id', - value: 'id', - }, - getPopupContainer: () => document.body, - }, - required: true, - }, - { - field: 'nickname', - label: '昵称', - component: 'Input', - required: true, - }, - - { - label: '邮箱', - field: 'email', - component: 'Input', - required: true, - }, - - { - label: '备注', - field: 'remark', - component: 'InputTextArea', - }, -]; diff --git a/src/views/demo/system/account/index.vue b/src/views/demo/system/account/index.vue deleted file mode 100644 index 8e129023..00000000 --- a/src/views/demo/system/account/index.vue +++ /dev/null @@ -1,137 +0,0 @@ - - diff --git a/src/views/demo/system/dept/DeptModal.vue b/src/views/demo/system/dept/DeptModal.vue deleted file mode 100644 index 95f8b321..00000000 --- a/src/views/demo/system/dept/DeptModal.vue +++ /dev/null @@ -1,62 +0,0 @@ - - diff --git a/src/views/demo/system/dept/dept.data.ts b/src/views/demo/system/dept/dept.data.ts deleted file mode 100644 index 2a3a4139..00000000 --- a/src/views/demo/system/dept/dept.data.ts +++ /dev/null @@ -1,108 +0,0 @@ -import { BasicColumn } from '/@/components/Table'; -import { FormSchema } from '/@/components/Table'; -import { h } from 'vue'; -import { Tag } from 'ant-design-vue'; - -export const columns: BasicColumn[] = [ - { - title: '部门名称', - dataIndex: 'deptName', - width: 160, - align: 'left', - }, - { - title: '排序', - dataIndex: 'orderNo', - width: 50, - }, - { - title: '状态', - dataIndex: 'status', - width: 80, - customRender: ({ record }) => { - const status = record.status; - const enable = ~~status === 0; - const color = enable ? 'green' : 'red'; - const text = enable ? '启用' : '停用'; - return h(Tag, { color: color }, () => text); - }, - }, - { - title: '创建时间', - dataIndex: 'createTime', - width: 180, - }, - { - title: '备注', - dataIndex: 'remark', - }, -]; - -export const searchFormSchema: FormSchema[] = [ - { - field: 'deptName', - label: '部门名称', - component: 'Input', - colProps: { span: 8 }, - }, - { - field: 'status', - label: '状态', - component: 'Select', - componentProps: { - options: [ - { label: '启用', value: '0' }, - { label: '停用', value: '1' }, - ], - }, - colProps: { span: 8 }, - }, -]; - -export const formSchema: FormSchema[] = [ - { - field: 'deptName', - label: '部门名称', - component: 'Input', - required: true, - }, - { - field: 'parentDept', - label: '上级部门', - component: 'TreeSelect', - - componentProps: { - fieldNames: { - label: 'deptName', - key: 'id', - value: 'id', - }, - getPopupContainer: () => document.body, - }, - required: true, - }, - { - field: 'orderNo', - label: '排序', - component: 'InputNumber', - required: true, - }, - { - field: 'status', - label: '状态', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '启用', value: '0' }, - { label: '停用', value: '1' }, - ], - }, - required: true, - }, - { - label: '备注', - field: 'remark', - component: 'InputTextArea', - }, -]; diff --git a/src/views/demo/system/dept/index.vue b/src/views/demo/system/dept/index.vue deleted file mode 100644 index a3d2cf05..00000000 --- a/src/views/demo/system/dept/index.vue +++ /dev/null @@ -1,103 +0,0 @@ - - diff --git a/src/views/demo/system/menu/MenuDrawer.vue b/src/views/demo/system/menu/MenuDrawer.vue deleted file mode 100644 index 04025102..00000000 --- a/src/views/demo/system/menu/MenuDrawer.vue +++ /dev/null @@ -1,70 +0,0 @@ - - diff --git a/src/views/demo/system/menu/index.vue b/src/views/demo/system/menu/index.vue deleted file mode 100644 index 96d3f9a1..00000000 --- a/src/views/demo/system/menu/index.vue +++ /dev/null @@ -1,110 +0,0 @@ - - diff --git a/src/views/demo/system/menu/menu.data.ts b/src/views/demo/system/menu/menu.data.ts deleted file mode 100644 index a7e04612..00000000 --- a/src/views/demo/system/menu/menu.data.ts +++ /dev/null @@ -1,202 +0,0 @@ -import { BasicColumn } from '/@/components/Table'; -import { FormSchema } from '/@/components/Table'; -import { h } from 'vue'; -import { Tag } from 'ant-design-vue'; -import { Icon } from '/@/components/Icon'; - -export const columns: BasicColumn[] = [ - { - title: '菜单名称', - dataIndex: 'menuName', - width: 200, - align: 'left', - }, - { - title: '图标', - dataIndex: 'icon', - width: 50, - customRender: ({ record }) => { - return h(Icon, { icon: record.icon }); - }, - }, - { - title: '权限标识', - dataIndex: 'permission', - width: 180, - }, - { - title: '组件', - dataIndex: 'component', - }, - { - title: '排序', - dataIndex: 'orderNo', - width: 50, - }, - { - title: '状态', - dataIndex: 'status', - width: 80, - customRender: ({ record }) => { - const status = record.status; - const enable = ~~status === 0; - const color = enable ? 'green' : 'red'; - const text = enable ? '启用' : '停用'; - return h(Tag, { color: color }, () => text); - }, - }, - { - title: '创建时间', - dataIndex: 'createTime', - width: 180, - }, -]; - -const isDir = (type: string) => type === '0'; -const isMenu = (type: string) => type === '1'; -const isButton = (type: string) => type === '2'; - -export const searchFormSchema: FormSchema[] = [ - { - field: 'menuName', - label: '菜单名称', - component: 'Input', - colProps: { span: 8 }, - }, - { - field: 'status', - label: '状态', - component: 'Select', - componentProps: { - options: [ - { label: '启用', value: '0' }, - { label: '停用', value: '1' }, - ], - }, - colProps: { span: 8 }, - }, -]; - -export const formSchema: FormSchema[] = [ - { - field: 'type', - label: '菜单类型', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '目录', value: '0' }, - { label: '菜单', value: '1' }, - { label: '按钮', value: '2' }, - ], - }, - colProps: { lg: 24, md: 24 }, - }, - { - field: 'menuName', - label: '菜单名称', - component: 'Input', - required: true, - }, - - { - field: 'parentMenu', - label: '上级菜单', - component: 'TreeSelect', - componentProps: { - fieldNames: { - label: 'menuName', - key: 'id', - value: 'id', - }, - getPopupContainer: () => document.body, - }, - }, - - { - field: 'orderNo', - label: '排序', - component: 'InputNumber', - required: true, - }, - { - field: 'icon', - label: '图标', - component: 'IconPicker', - required: true, - ifShow: ({ values }) => !isButton(values.type), - }, - - { - field: 'routePath', - label: '路由地址', - component: 'Input', - required: true, - ifShow: ({ values }) => !isButton(values.type), - }, - { - field: 'component', - label: '组件路径', - component: 'Input', - ifShow: ({ values }) => isMenu(values.type), - }, - { - field: 'permission', - label: '权限标识', - component: 'Input', - ifShow: ({ values }) => !isDir(values.type), - }, - { - field: 'status', - label: '状态', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '启用', value: '0' }, - { label: '禁用', value: '1' }, - ], - }, - }, - { - field: 'isExt', - label: '是否外链', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '否', value: '0' }, - { label: '是', value: '1' }, - ], - }, - ifShow: ({ values }) => !isButton(values.type), - }, - - { - field: 'keepalive', - label: '是否缓存', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '否', value: '0' }, - { label: '是', value: '1' }, - ], - }, - ifShow: ({ values }) => isMenu(values.type), - }, - - { - field: 'show', - label: '是否显示', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '是', value: '0' }, - { label: '否', value: '1' }, - ], - }, - ifShow: ({ values }) => !isButton(values.type), - }, -]; diff --git a/src/views/demo/system/password/index.vue b/src/views/demo/system/password/index.vue deleted file mode 100644 index 8fd720bd..00000000 --- a/src/views/demo/system/password/index.vue +++ /dev/null @@ -1,45 +0,0 @@ - - diff --git a/src/views/demo/system/password/pwd.data.ts b/src/views/demo/system/password/pwd.data.ts deleted file mode 100644 index a6007ce3..00000000 --- a/src/views/demo/system/password/pwd.data.ts +++ /dev/null @@ -1,46 +0,0 @@ -import { FormSchema } from '/@/components/Form'; - -export const formSchema: FormSchema[] = [ - { - field: 'passwordOld', - label: '当前密码', - component: 'InputPassword', - required: true, - }, - { - field: 'passwordNew', - label: '新密码', - component: 'StrengthMeter', - componentProps: { - placeholder: '新密码', - }, - rules: [ - { - required: true, - message: '请输入新密码', - }, - ], - }, - { - field: 'confirmPassword', - label: '确认密码', - component: 'InputPassword', - - dynamicRules: ({ values }) => { - return [ - { - required: true, - validator: (_, value) => { - if (!value) { - return Promise.reject('密码不能为空'); - } - if (value !== values.passwordNew) { - return Promise.reject('两次输入的密码不一致!'); - } - return Promise.resolve(); - }, - }, - ]; - }, - }, -]; diff --git a/src/views/demo/system/role/RoleDrawer.vue b/src/views/demo/system/role/RoleDrawer.vue deleted file mode 100644 index 16fa395d..00000000 --- a/src/views/demo/system/role/RoleDrawer.vue +++ /dev/null @@ -1,88 +0,0 @@ - - diff --git a/src/views/demo/system/role/index.vue b/src/views/demo/system/role/index.vue deleted file mode 100644 index b1e41411..00000000 --- a/src/views/demo/system/role/index.vue +++ /dev/null @@ -1,100 +0,0 @@ - - diff --git a/src/views/demo/system/role/role.data.ts b/src/views/demo/system/role/role.data.ts deleted file mode 100644 index f7854277..00000000 --- a/src/views/demo/system/role/role.data.ts +++ /dev/null @@ -1,124 +0,0 @@ -import { BasicColumn } from '/@/components/Table'; -import { FormSchema } from '/@/components/Table'; -import { h } from 'vue'; -import { Switch } from 'ant-design-vue'; -import { setRoleStatus } from '/@/api/demo/system'; -import { useMessage } from '/@/hooks/web/useMessage'; - -export const columns: BasicColumn[] = [ - { - title: '角色名称', - dataIndex: 'roleName', - width: 200, - }, - { - title: '角色值', - dataIndex: 'roleValue', - width: 180, - }, - { - title: '排序', - dataIndex: 'orderNo', - width: 50, - }, - { - title: '状态', - dataIndex: 'status', - width: 120, - customRender: ({ record }) => { - if (!Reflect.has(record, 'pendingStatus')) { - record.pendingStatus = false; - } - return h(Switch, { - checked: record.status === '1', - checkedChildren: '已启用', - unCheckedChildren: '已禁用', - loading: record.pendingStatus, - onChange(checked: boolean) { - record.pendingStatus = true; - const newStatus = checked ? '1' : '0'; - const { createMessage } = useMessage(); - setRoleStatus(record.id, newStatus) - .then(() => { - record.status = newStatus; - createMessage.success(`已成功修改角色状态`); - }) - .catch(() => { - createMessage.error('修改角色状态失败'); - }) - .finally(() => { - record.pendingStatus = false; - }); - }, - }); - }, - }, - { - title: '创建时间', - dataIndex: 'createTime', - width: 180, - }, - { - title: '备注', - dataIndex: 'remark', - }, -]; - -export const searchFormSchema: FormSchema[] = [ - { - field: 'roleNme', - label: '角色名称', - component: 'Input', - colProps: { span: 8 }, - }, - { - field: 'status', - label: '状态', - component: 'Select', - componentProps: { - options: [ - { label: '启用', value: '0' }, - { label: '停用', value: '1' }, - ], - }, - colProps: { span: 8 }, - }, -]; - -export const formSchema: FormSchema[] = [ - { - field: 'roleName', - label: '角色名称', - required: true, - component: 'Input', - }, - { - field: 'roleValue', - label: '角色值', - required: true, - component: 'Input', - }, - { - field: 'status', - label: '状态', - component: 'RadioButtonGroup', - defaultValue: '0', - componentProps: { - options: [ - { label: '启用', value: '0' }, - { label: '停用', value: '1' }, - ], - }, - }, - { - label: '备注', - field: 'remark', - component: 'InputTextArea', - }, - { - label: ' ', - field: 'menu', - slot: 'menu', - component: 'Input', - }, -]; diff --git a/src/views/demo/table/AuthColumn.vue b/src/views/demo/table/AuthColumn.vue deleted file mode 100644 index 9a3b2547..00000000 --- a/src/views/demo/table/AuthColumn.vue +++ /dev/null @@ -1,154 +0,0 @@ - - diff --git a/src/views/demo/table/Basic.vue b/src/views/demo/table/Basic.vue deleted file mode 100644 index cb438a39..00000000 --- a/src/views/demo/table/Basic.vue +++ /dev/null @@ -1,80 +0,0 @@ - - diff --git a/src/views/demo/table/CustomerCell.vue b/src/views/demo/table/CustomerCell.vue deleted file mode 100644 index d7b33b49..00000000 --- a/src/views/demo/table/CustomerCell.vue +++ /dev/null @@ -1,108 +0,0 @@ - - diff --git a/src/views/demo/table/EditCellTable.vue b/src/views/demo/table/EditCellTable.vue deleted file mode 100644 index 058da933..00000000 --- a/src/views/demo/table/EditCellTable.vue +++ /dev/null @@ -1,224 +0,0 @@ - - diff --git a/src/views/demo/table/EditRowTable.vue b/src/views/demo/table/EditRowTable.vue deleted file mode 100644 index 128d9032..00000000 --- a/src/views/demo/table/EditRowTable.vue +++ /dev/null @@ -1,264 +0,0 @@ - - diff --git a/src/views/demo/table/ExpandTable.vue b/src/views/demo/table/ExpandTable.vue deleted file mode 100644 index 3b76f9fe..00000000 --- a/src/views/demo/table/ExpandTable.vue +++ /dev/null @@ -1,77 +0,0 @@ - - diff --git a/src/views/demo/table/FetchTable.vue b/src/views/demo/table/FetchTable.vue deleted file mode 100644 index 8d9efa35..00000000 --- a/src/views/demo/table/FetchTable.vue +++ /dev/null @@ -1,43 +0,0 @@ - - diff --git a/src/views/demo/table/FixedColumn.vue b/src/views/demo/table/FixedColumn.vue deleted file mode 100644 index 74e58d9f..00000000 --- a/src/views/demo/table/FixedColumn.vue +++ /dev/null @@ -1,95 +0,0 @@ - - diff --git a/src/views/demo/table/FixedHeight.vue b/src/views/demo/table/FixedHeight.vue deleted file mode 100644 index 4f8b28e0..00000000 --- a/src/views/demo/table/FixedHeight.vue +++ /dev/null @@ -1,47 +0,0 @@ - - diff --git a/src/views/demo/table/FooterTable.vue b/src/views/demo/table/FooterTable.vue deleted file mode 100644 index 1967bbd7..00000000 --- a/src/views/demo/table/FooterTable.vue +++ /dev/null @@ -1,50 +0,0 @@ - - diff --git a/src/views/demo/table/FormTable.vue b/src/views/demo/table/FormTable.vue deleted file mode 100644 index 23300aa7..00000000 --- a/src/views/demo/table/FormTable.vue +++ /dev/null @@ -1,66 +0,0 @@ - - diff --git a/src/views/demo/table/MergeHeader.vue b/src/views/demo/table/MergeHeader.vue deleted file mode 100644 index 2c3b612e..00000000 --- a/src/views/demo/table/MergeHeader.vue +++ /dev/null @@ -1,27 +0,0 @@ - - diff --git a/src/views/demo/table/MultipleHeader.vue b/src/views/demo/table/MultipleHeader.vue deleted file mode 100644 index fa0bf430..00000000 --- a/src/views/demo/table/MultipleHeader.vue +++ /dev/null @@ -1,26 +0,0 @@ - - diff --git a/src/views/demo/table/RefTable.vue b/src/views/demo/table/RefTable.vue deleted file mode 100644 index f2a0c6dd..00000000 --- a/src/views/demo/table/RefTable.vue +++ /dev/null @@ -1,125 +0,0 @@ - - diff --git a/src/views/demo/table/ResizeParentHeightTable.vue b/src/views/demo/table/ResizeParentHeightTable.vue deleted file mode 100644 index b10444c9..00000000 --- a/src/views/demo/table/ResizeParentHeightTable.vue +++ /dev/null @@ -1,79 +0,0 @@ - - diff --git a/src/views/demo/table/TreeTable.vue b/src/views/demo/table/TreeTable.vue deleted file mode 100644 index 88afe637..00000000 --- a/src/views/demo/table/TreeTable.vue +++ /dev/null @@ -1,41 +0,0 @@ - - diff --git a/src/views/demo/table/UseTable.vue b/src/views/demo/table/UseTable.vue deleted file mode 100644 index 3c549979..00000000 --- a/src/views/demo/table/UseTable.vue +++ /dev/null @@ -1,147 +0,0 @@ - - diff --git a/src/views/demo/table/tableData.tsx b/src/views/demo/table/tableData.tsx deleted file mode 100644 index 7c45a1be..00000000 --- a/src/views/demo/table/tableData.tsx +++ /dev/null @@ -1,304 +0,0 @@ -import { FormProps, FormSchema } from '/@/components/Table'; -import { BasicColumn } from '/@/components/Table/src/types/table'; - -export function getBasicColumns(): BasicColumn[] { - return [ - { - title: 'ID', - dataIndex: 'id', - fixed: 'left', - width: 200, - }, - { - title: '姓名', - dataIndex: 'name', - width: 150, - filters: [ - { text: 'Male', value: 'male' }, - { text: 'Female', value: 'female' }, - ], - }, - { - title: '地址', - dataIndex: 'address', - }, - { - title: '编号', - dataIndex: 'no', - width: 150, - sorter: true, - defaultHidden: true, - }, - { - title: '开始时间', - width: 150, - sorter: true, - dataIndex: 'beginTime', - }, - { - title: '结束时间', - width: 150, - sorter: true, - dataIndex: 'endTime', - }, - ]; -} - -export function getBasicShortColumns(): BasicColumn[] { - return [ - { - title: 'ID', - width: 150, - dataIndex: 'id', - sorter: true, - sortOrder: 'ascend', - }, - { - title: '姓名', - dataIndex: 'name', - width: 120, - }, - { - title: '地址', - dataIndex: 'address', - }, - { - title: '编号', - dataIndex: 'no', - width: 80, - }, - ]; -} - -export function getMultipleHeaderColumns(): BasicColumn[] { - return [ - { - title: 'ID', - dataIndex: 'id', - width: 200, - }, - { - title: '姓名', - dataIndex: 'name', - width: 120, - }, - { - title: '地址', - dataIndex: 'address', - sorter: true, - children: [ - { - title: '编号', - dataIndex: 'no', - width: 120, - filters: [ - { text: 'Male', value: 'male', children: [] }, - { text: 'Female', value: 'female', children: [] }, - ], - }, - - { - title: '开始时间', - dataIndex: 'beginTime', - width: 120, - }, - { - title: '结束时间', - dataIndex: 'endTime', - width: 120, - }, - ], - }, - ]; -} - -export function getCustomHeaderColumns(): BasicColumn[] { - return [ - { - title: 'ID', - dataIndex: 'id', - helpMessage: 'headerHelpMessage方式1', - width: 200, - }, - { - // title: '姓名', - dataIndex: 'name', - width: 120, - // slots: { title: 'customTitle' }, - }, - { - // title: '地址', - dataIndex: 'address', - width: 120, - // slots: { title: 'customAddress' }, - sorter: true, - }, - - { - title: '编号', - dataIndex: 'no', - width: 120, - filters: [ - { text: 'Male', value: 'male', children: [] }, - { text: 'Female', value: 'female', children: [] }, - ], - }, - { - title: '开始时间', - dataIndex: 'beginTime', - width: 120, - }, - { - title: '结束时间', - dataIndex: 'endTime', - width: 120, - }, - ]; -} -const renderContent = ({ text, index }: { text: any; index: number }) => { - const obj: any = { - children: text, - attrs: {}, - }; - if (index === 9) { - obj.attrs.colSpan = 0; - } - return obj; -}; -export function getMergeHeaderColumns(): BasicColumn[] { - return [ - { - title: 'ID', - dataIndex: 'id', - width: 300, - customRender: renderContent, - }, - { - title: '姓名', - dataIndex: 'name', - width: 300, - customRender: renderContent, - }, - { - title: '地址', - dataIndex: 'address', - colSpan: 2, - width: 120, - sorter: true, - customRender: ({ text, index }: { text: any; index: number }) => { - const obj: any = { - children: text, - attrs: {}, - }; - if (index === 2) { - obj.attrs.rowSpan = 2; - } - if (index === 3) { - obj.attrs.colSpan = 0; - } - return obj; - }, - }, - { - title: '编号', - dataIndex: 'no', - colSpan: 0, - filters: [ - { text: 'Male', value: 'male', children: [] }, - { text: 'Female', value: 'female', children: [] }, - ], - customRender: renderContent, - }, - { - title: '开始时间', - dataIndex: 'beginTime', - width: 200, - customRender: renderContent, - }, - { - title: '结束时间', - dataIndex: 'endTime', - width: 200, - customRender: renderContent, - }, - ]; -} -export const getAdvanceSchema = (itemNumber = 6): FormSchema[] => { - const arr: any = []; - for (let index = 0; index < itemNumber; index++) { - arr.push({ - field: `field${index}`, - label: `字段${index}`, - component: 'Input', - colProps: { - xl: 12, - xxl: 8, - }, - }); - } - return arr; -}; -export function getFormConfig(): Partial { - return { - labelWidth: 100, - schemas: [ - ...getAdvanceSchema(5), - { - field: `field11`, - label: `Slot示例`, - component: 'Select', - slot: 'custom', - colProps: { - xl: 12, - xxl: 8, - }, - }, - ], - }; -} -export function getBasicData() { - return (() => { - const arr: any = []; - for (let index = 0; index < 40; index++) { - arr.push({ - id: `${index}`, - name: 'John Brown', - age: `1${index}`, - no: `${index + 10}`, - address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', - beginTime: new Date().toLocaleString(), - endTime: new Date().toLocaleString(), - }); - } - return arr; - })(); -} - -export function getTreeTableData() { - return (() => { - const arr: any = []; - for (let index = 0; index < 40; index++) { - arr.push({ - id: `${index}`, - name: 'John Brown', - age: `1${index}`, - no: `${index + 10}`, - address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', - beginTime: new Date().toLocaleString(), - endTime: new Date().toLocaleString(), - children: [ - { - id: `l2-${index}`, - name: 'John Brown', - age: `1${index}`, - no: `${index + 10}`, - address: 'New York No. 1 Lake ParkNew York No. 1 Lake Park', - beginTime: new Date().toLocaleString(), - endTime: new Date().toLocaleString(), - }, - ], - }); - } - return arr; - })(); -} diff --git a/src/views/demo/tree/ActionTree.vue b/src/views/demo/tree/ActionTree.vue deleted file mode 100644 index 613000ed..00000000 --- a/src/views/demo/tree/ActionTree.vue +++ /dev/null @@ -1,139 +0,0 @@ - - diff --git a/src/views/demo/tree/EditTree.vue b/src/views/demo/tree/EditTree.vue deleted file mode 100644 index c2f2ad49..00000000 --- a/src/views/demo/tree/EditTree.vue +++ /dev/null @@ -1,120 +0,0 @@ - - diff --git a/src/views/demo/tree/data.ts b/src/views/demo/tree/data.ts deleted file mode 100644 index 485efb8f..00000000 --- a/src/views/demo/tree/data.ts +++ /dev/null @@ -1,118 +0,0 @@ -import { TreeItem } from '/@/components/Tree/index'; - -export const treeData: TreeItem[] = [ - { - title: 'parent ', - key: '0-0', - children: [ - { title: 'leaf', key: '0-0-0' }, - { - title: 'leaf', - key: '0-0-1', - children: [ - { title: 'leaf', key: '0-0-0-0', children: [{ title: 'leaf', key: '0-0-0-0-1' }] }, - { title: 'leaf', key: '0-0-0-1' }, - ], - }, - ], - }, - { - title: 'parent 2', - key: '1-1', - children: [ - { title: 'leaf', key: '1-1-0' }, - { title: 'leaf', key: '1-1-1' }, - ], - }, - { - title: 'parent 3', - key: '2-2', - children: [ - { title: 'leaf', key: '2-2-0' }, - { title: 'leaf', key: '2-2-1' }, - ], - }, -]; - -export const treeData2: any[] = [ - { - name: 'parent ', - id: '0-0', - - children: [ - { name: 'leaf', id: '0-0-0' }, - { - name: 'leaf', - id: '0-0-1', - - children: [ - { - name: 'leaf', - - id: '0-0-0-0', - children: [{ name: 'leaf', id: '0-0-0-0-1' }], - }, - { name: 'leaf', id: '0-0-0-1' }, - ], - }, - ], - }, - { - name: 'parent 2', - id: '1-1', - - children: [ - { name: 'leaf', id: '1-1-0' }, - { name: 'leaf', id: '1-1-1' }, - ], - }, - { - name: 'parent 3', - id: '2-2', - - children: [ - { name: 'leaf', id: '2-2-0' }, - { name: 'leaf', id: '2-2-1' }, - ], - }, -]; - -export const treeData3: any[] = [ - { - name: 'parent ', - key: '0-0', - children: [ - { name: 'leaf', key: '0-0-0' }, - { - name: 'leaf', - key: '0-0-1', - children: [ - { - name: 'leaf', - key: '0-0-0-0', - children: [{ name: 'leaf', key: '0-0-0-0-1' }], - }, - { name: 'leaf', key: '0-0-0-1' }, - ], - }, - ], - }, - { - name: 'parent 2', - key: '1-1', - - children: [ - { name: 'leaf', key: '1-1-0' }, - { name: 'leaf', key: '1-1-1' }, - ], - }, - { - name: 'parent 3', - key: '2-2', - - children: [ - { name: 'leaf', key: '2-2-0' }, - { name: 'leaf', key: '2-2-1' }, - ], - }, -]; diff --git a/src/views/demo/tree/index.vue b/src/views/demo/tree/index.vue deleted file mode 100644 index 1526fb35..00000000 --- a/src/views/demo/tree/index.vue +++ /dev/null @@ -1,148 +0,0 @@ - - diff --git a/src/views/demo/setup/index.vue b/src/views/setup/index.vue similarity index 75% rename from src/views/demo/setup/index.vue rename to src/views/setup/index.vue index 17d254f2..fb83f55a 100644 --- a/src/views/demo/setup/index.vue +++ b/src/views/setup/index.vue @@ -4,16 +4,16 @@ diff --git a/src/views/sys/about/index.vue b/src/views/sys/about/index.vue index 1b2cf372..a72d6bc4 100644 --- a/src/views/sys/about/index.vue +++ b/src/views/sys/about/index.vue @@ -15,21 +15,21 @@ diff --git a/src/views/sys/error-log/DetailModal.vue b/src/views/sys/error-log/DetailModal.vue deleted file mode 100644 index 20477070..00000000 --- a/src/views/sys/error-log/DetailModal.vue +++ /dev/null @@ -1,27 +0,0 @@ - - diff --git a/src/views/sys/error-log/data.tsx b/src/views/sys/error-log/data.tsx deleted file mode 100644 index 3ffc2f45..00000000 --- a/src/views/sys/error-log/data.tsx +++ /dev/null @@ -1,67 +0,0 @@ -import { Tag } from 'ant-design-vue'; -import { BasicColumn } from '/@/components/Table/index'; -import { ErrorTypeEnum } from '/@/enums/exceptionEnum'; -import { useI18n } from '/@/hooks/web/useI18n'; - -const { t } = useI18n(); - -export function getColumns(): BasicColumn[] { - return [ - { - dataIndex: 'type', - title: t('sys.errorLog.tableColumnType'), - width: 80, - customRender: ({ text }) => { - const color = - text === ErrorTypeEnum.VUE - ? 'green' - : text === ErrorTypeEnum.RESOURCE - ? 'cyan' - : text === ErrorTypeEnum.PROMISE - ? 'blue' - : ErrorTypeEnum.AJAX - ? 'red' - : 'purple'; - return {() => text}; - }, - }, - { - dataIndex: 'url', - title: 'URL', - width: 200, - }, - { - dataIndex: 'time', - title: t('sys.errorLog.tableColumnDate'), - width: 160, - }, - { - dataIndex: 'file', - title: t('sys.errorLog.tableColumnFile'), - width: 200, - }, - { - dataIndex: 'name', - title: 'Name', - width: 200, - }, - { - dataIndex: 'message', - title: t('sys.errorLog.tableColumnMsg'), - width: 300, - }, - { - dataIndex: 'stack', - title: t('sys.errorLog.tableColumnStackMsg'), - }, - ]; -} - -export function getDescSchema(): any { - return getColumns().map((column) => { - return { - field: column.dataIndex!, - label: column.title, - }; - }); -} diff --git a/src/views/sys/error-log/index.vue b/src/views/sys/error-log/index.vue deleted file mode 100644 index 7c546b26..00000000 --- a/src/views/sys/error-log/index.vue +++ /dev/null @@ -1,97 +0,0 @@ - - - diff --git a/src/views/sys/exception/Exception.vue b/src/views/sys/exception/Exception.vue index 6e56f086..06d9694b 100644 --- a/src/views/sys/exception/Exception.vue +++ b/src/views/sys/exception/Exception.vue @@ -1,23 +1,23 @@ diff --git a/src/views/sys/lock/LockPage.vue b/src/views/sys/lock/LockPage.vue deleted file mode 100644 index d19dd98a..00000000 --- a/src/views/sys/lock/LockPage.vue +++ /dev/null @@ -1,234 +0,0 @@ - - - diff --git a/src/views/sys/lock/index.vue b/src/views/sys/lock/index.vue deleted file mode 100644 index e8c4d552..00000000 --- a/src/views/sys/lock/index.vue +++ /dev/null @@ -1,13 +0,0 @@ - - diff --git a/src/views/sys/lock/useNow.ts b/src/views/sys/lock/useNow.ts deleted file mode 100644 index ee461fc3..00000000 --- a/src/views/sys/lock/useNow.ts +++ /dev/null @@ -1,60 +0,0 @@ -import { dateUtil } from '/@/utils/dateUtil'; -import { reactive, toRefs } from 'vue'; -import { tryOnMounted, tryOnUnmounted } from '@vueuse/core'; - -export function useNow(immediate = true) { - let timer: IntervalHandle; - - const state = reactive({ - year: 0, - month: 0, - week: '', - day: 0, - hour: '', - minute: '', - second: 0, - meridiem: '', - }); - - const update = () => { - const now = dateUtil(); - - const h = now.format('HH'); - const m = now.format('mm'); - const s = now.get('s'); - - state.year = now.get('y'); - state.month = now.get('M') + 1; - state.week = '星期' + ['日', '一', '二', '三', '四', '五', '六'][now.day()]; - state.day = now.get('date'); - state.hour = h; - state.minute = m; - state.second = s; - - state.meridiem = now.format('A'); - }; - - function start() { - update(); - clearInterval(timer); - timer = setInterval(() => update(), 1000); - } - - function stop() { - clearInterval(timer); - } - - tryOnMounted(() => { - immediate && start(); - }); - - tryOnUnmounted(() => { - stop(); - }); - - return { - ...toRefs(state), - start, - stop, - }; -} diff --git a/src/views/sys/login/ForgetPasswordForm.vue b/src/views/sys/login/ForgetPasswordForm.vue index aca24aa4..291f62b6 100644 --- a/src/views/sys/login/ForgetPasswordForm.vue +++ b/src/views/sys/login/ForgetPasswordForm.vue @@ -33,32 +33,32 @@ diff --git a/src/views/sys/login/Login.vue b/src/views/sys/login/Login.vue index c537b17a..8364e13b 100644 --- a/src/views/sys/login/Login.vue +++ b/src/views/sys/login/Login.vue @@ -40,7 +40,6 @@ - @@ -48,31 +47,30 @@