From 4ff1c408dc1acfc49e0adc61dc2e539c0c198158 Mon Sep 17 00:00:00 2001 From: vben Date: Fri, 25 Dec 2020 01:09:44 +0800 Subject: [PATCH] wip(form): perf form --- package.json | 6 +- src/components/Basic/index.ts | 5 +- .../src/collapse/CollapseContainer.vue | 3 + src/components/Form/src/BasicForm.vue | 102 ++- src/components/Form/src/FormAction.tsx | 141 ----- src/components/Form/src/componentMap.ts | 5 +- .../Form/src/components/FormAction.vue | 139 ++++ .../Form/src/{ => components}/FormItem.tsx | 132 ++-- .../Form/src/components/RadioButtonGroup.vue | 43 +- src/components/Form/src/helper.ts | 11 + src/components/Form/src/hooks/useAdvanced.ts | 50 +- .../Form/src/hooks/useComponentRegister.ts | 4 +- src/components/Form/src/hooks/useForm.ts | 91 ++- .../Form/src/hooks/useFormContext.ts | 17 + .../{useFormAction.ts => useFormEvents.ts} | 100 ++- .../Form/src/hooks/useFormValues.ts | 17 +- .../Form/src/hooks/useLabelWidth.ts | 19 +- src/components/Form/src/props.ts | 91 +-- src/components/Form/src/types/form.ts | 34 +- src/components/Modal/src/useModalContext.ts | 6 +- src/components/Scrollbar/src/util.ts | 2 +- src/components/Table/src/BasicTable.vue | 2 +- .../Table/src/components/renderEditable.tsx | 2 +- src/components/Table/src/types/column.ts | 2 +- .../Transition/src/CreateTransition.tsx | 2 +- src/components/VirtualScroll/src/index.tsx | 2 +- src/components/util.tsx | 6 +- src/directives/ripple/index.ts | 8 +- src/hooks/component/useFormItem.ts | 35 + src/hooks/core/useAttrs.ts | 39 ++ src/hooks/event/useKeyPress.ts | 6 +- src/hooks/web/useI18n.ts | 2 +- src/layouts/page/index.tsx | 2 +- src/router/guard/permissionGuard.ts | 2 +- src/router/types.ts | 2 +- src/settings/colorSetting.ts | 2 +- src/types/global.d.ts | 10 +- src/utils/helper/persistent.ts | 4 +- src/utils/helper/tsxHelper.tsx | 2 +- src/utils/helper/vueHelper.ts | 3 +- src/utils/http/axios/types.ts | 2 +- src/utils/index.ts | 2 +- src/utils/log.ts | 4 + src/views/demo/form/RuleForm.vue | 5 +- yarn.lock | 599 ++++++++---------- 45 files changed, 901 insertions(+), 862 deletions(-) delete mode 100644 src/components/Form/src/FormAction.tsx create mode 100644 src/components/Form/src/components/FormAction.vue rename src/components/Form/src/{ => components}/FormItem.tsx (74%) create mode 100644 src/components/Form/src/hooks/useFormContext.ts rename src/components/Form/src/hooks/{useFormAction.ts => useFormEvents.ts} (70%) create mode 100644 src/hooks/component/useFormItem.ts create mode 100644 src/hooks/core/useAttrs.ts diff --git a/package.json b/package.json index e86aa547..7af8cb78 100644 --- a/package.json +++ b/package.json @@ -48,11 +48,11 @@ "devDependencies": { "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", - "@iconify/json": "^1.1.275", + "@iconify/json": "^1.1.276", "@ls-lint/ls-lint": "^1.9.2", "@purge-icons/generated": "^0.4.1", "@types/echarts": "^4.9.3", - "@types/fs-extra": "^9.0.5", + "@types/fs-extra": "^9.0.6", "@types/globrex": "^0.1.0", "@types/koa-static": "^4.0.1", "@types/lodash-es": "^4.17.4", @@ -102,7 +102,7 @@ "vite-plugin-html": "^1.0.0-beta.2", "vite-plugin-mock": "^1.0.9", "vite-plugin-purge-icons": "^0.4.5", - "vite-plugin-pwa": "^0.1.7", + "vite-plugin-pwa": "^0.2.0", "vue-eslint-parser": "^7.3.0", "yargs": "^16.2.0" }, diff --git a/src/components/Basic/index.ts b/src/components/Basic/index.ts index 73fed745..5c86c28f 100644 --- a/src/components/Basic/index.ts +++ b/src/components/Basic/index.ts @@ -1,5 +1,8 @@ import { createAsyncComponent } from '/@/utils/factory/createAsyncComponent'; +import BasicArrow from './src/BasicArrow.vue'; -export const BasicArrow = createAsyncComponent(() => import('./src/BasicArrow.vue')); +export { BasicArrow }; + +// export const BasicArrow = createAsyncComponent(() => import('./src/BasicArrow.vue')); export const BasicHelp = createAsyncComponent(() => import('./src/BasicHelp.vue')); export const BasicTitle = createAsyncComponent(() => import('./src/BasicTitle.vue')); diff --git a/src/components/Container/src/collapse/CollapseContainer.vue b/src/components/Container/src/collapse/CollapseContainer.vue index a0642140..bf20cc19 100644 --- a/src/components/Container/src/collapse/CollapseContainer.vue +++ b/src/components/Container/src/collapse/CollapseContainer.vue @@ -101,7 +101,10 @@ &__action { display: flex; + text-align: right; + flex: 1; align-items: center; + justify-content: flex-end; } } diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index d1fd5662..fd2f697f 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -1,6 +1,6 @@