diff --git a/CHANGELOG.zh_CN.md b/CHANGELOG.zh_CN.md index aa333a8b4cd..e6bee002a9c 100644 --- a/CHANGELOG.zh_CN.md +++ b/CHANGELOG.zh_CN.md @@ -1,5 +1,9 @@ ## Wip +### ✨ Refactor + +独立组件配置到 `/@/settings/componentsSetting` + ### ✨ Features - 新增`mixSideTrigger`配置。用于配置左侧混合模式菜单打开方式。可选`hover`,默认`click` @@ -16,6 +20,10 @@ - 修复`layout` 收缩展开功能在分割模式下失效 - 修复 modal 高度计算错误 +### 🎫 Chores + +- 文档更新 + ## 2.0.0-rc.15 (2020-12-31) ### ✨ 表格破坏性更新 diff --git a/package.json b/package.json index d3ec170ab55..45874ab20c4 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,5 @@ { - "name": "vben-admin-2.0", + "name": "vben-admin", "version": "2.0.0-rc.15", "scripts": { "bootstrap": "yarn install", @@ -35,7 +35,7 @@ "path-to-regexp": "^6.2.0", "qrcode": "^1.4.4", "sortablejs": "^1.12.0", - "vditor": "^3.7.4", + "vditor": "^3.7.5", "vue": "^3.0.5", "vue-i18n": "9.0.0-beta.14", "vue-router": "^4.0.2", @@ -48,7 +48,7 @@ "devDependencies": { "@commitlint/cli": "^11.0.0", "@commitlint/config-conventional": "^11.0.0", - "@iconify/json": "^1.1.278", + "@iconify/json": "^1.1.282", "@ls-lint/ls-lint": "^1.9.2", "@purge-icons/generated": "^0.4.1", "@types/echarts": "^4.9.3", @@ -63,8 +63,8 @@ "@types/sortablejs": "^1.10.6", "@types/yargs": "^15.0.12", "@types/zxcvbn": "^4.4.0", - "@typescript-eslint/eslint-plugin": "^4.11.1", - "@typescript-eslint/parser": "^4.11.1", + "@typescript-eslint/eslint-plugin": "^4.12.0", + "@typescript-eslint/parser": "^4.12.0", "@vue/compiler-sfc": "^3.0.5", "@vuedx/typecheck": "^0.4.1", "@vuedx/typescript-plugin-vue": "^0.4.1", @@ -75,11 +75,11 @@ "cross-env": "^7.0.3", "dot-prop": "^6.0.1", "dotenv": "^8.2.0", - "eslint": "^7.16.0", + "eslint": "^7.17.0", "eslint-config-prettier": "^7.1.0", - "eslint-plugin-prettier": "^3.3.0", - "eslint-plugin-vue": "^7.4.0", - "esno": "^0.3.0", + "eslint-plugin-prettier": "^3.3.1", + "eslint-plugin-vue": "^7.4.1", + "esno": "^0.4.0", "fs-extra": "^9.0.1", "globrex": "^0.1.2", "husky": "^4.3.6", diff --git a/src/components/Form/src/BasicForm.vue b/src/components/Form/src/BasicForm.vue index 1b1835c0b83..2ac326786ce 100644 --- a/src/components/Form/src/BasicForm.vue +++ b/src/components/Form/src/BasicForm.vue @@ -18,10 +18,14 @@ - + + + diff --git a/src/components/Form/src/hooks/useForm.ts b/src/components/Form/src/hooks/useForm.ts index 6d159890f0a..88144b0f7fa 100644 --- a/src/components/Form/src/hooks/useForm.ts +++ b/src/components/Form/src/hooks/useForm.ts @@ -88,9 +88,13 @@ export function useForm(props?: Props): UseFormReturnType { form.setFieldsValue(values); }, - appendSchemaByField: async (schema: FormSchema, prefixField?: string | undefined) => { + appendSchemaByField: async ( + schema: FormSchema, + prefixField: string | undefined, + first: boolean + ) => { const form = await getForm(); - form.appendSchemaByField(schema, prefixField); + form.appendSchemaByField(schema, prefixField, first); }, submit: async (): Promise => { diff --git a/src/components/Form/src/types/form.ts b/src/components/Form/src/types/form.ts index dcc4bbd09d1..47289d83f9b 100644 --- a/src/components/Form/src/types/form.ts +++ b/src/components/Form/src/types/form.ts @@ -33,7 +33,11 @@ export interface FormActionType { updateSchema: (data: Partial | Partial[]) => Promise; setProps: (formProps: Partial) => Promise; removeSchemaByFiled: (field: string | string[]) => Promise; - appendSchemaByField: (schema: FormSchema, prefixField?: 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; diff --git a/src/components/Page/src/PageWrapper.vue b/src/components/Page/src/PageWrapper.vue index e482d646a02..ef05f00ce68 100644 --- a/src/components/Page/src/PageWrapper.vue +++ b/src/components/Page/src/PageWrapper.vue @@ -45,7 +45,7 @@ contentStyle: { type: Object as PropType, }, - contentBackgrond: propTypes.bool, + contentBackground: propTypes.bool, contentFullHeight: propTypes.bool, }, setup(props, { slots }) { @@ -71,8 +71,8 @@ const getContentStyle = computed( (): CSSProperties => { - const { contentBackgrond, contentFullHeight, contentStyle } = props; - const bg = contentBackgrond ? { backgroundColor: '#fff' } : {}; + const { contentBackground, contentFullHeight, contentStyle } = props; + const bg = contentBackground ? { backgroundColor: '#fff' } : {}; if (!contentFullHeight) { return { ...bg, ...contentStyle }; } diff --git a/src/components/Table/src/BasicTable.vue b/src/components/Table/src/BasicTable.vue index 4d02ce11072..723f1a58757 100644 --- a/src/components/Table/src/BasicTable.vue +++ b/src/components/Table/src/BasicTable.vue @@ -87,6 +87,7 @@ 'row-mouseleave', 'edit-end', 'edit-cancel', + 'edit-row-end', ], setup(props, { attrs, emit, slots }) { const tableElRef = ref(null); diff --git a/src/components/Table/src/components/editable/EditableCell.vue b/src/components/Table/src/components/editable/EditableCell.vue index a0b6e2f9483..4e3974f3557 100644 --- a/src/components/Table/src/components/editable/EditableCell.vue +++ b/src/components/Table/src/components/editable/EditableCell.vue @@ -210,7 +210,7 @@ return true; } - async function handleSubmit() { + async function handleSubmit(needEmit = true) { const isPass = await handleSubmiRule(); if (!isPass) return false; const { column, index } = props; @@ -220,7 +220,7 @@ const dataKey = (dataIndex || key) as string; const record = await table.updateTableData(index, dataKey, unref(getValues)); - table.emit?.('edit-end', { record, index, key, value: unref(currentValueRef) }); + needEmit && table.emit?.('edit-end', { record, index, key, value: unref(currentValueRef) }); isEdit.value = false; } @@ -274,7 +274,8 @@ if (!pass) return; const submitFns = props.record?.submitCbs || []; - submitFns.forEach((fn) => fn()); + submitFns.forEach((fn) => fn(false)); + table.emit?.('edit-row-end'); return true; } // isArray(props.record?.submitCbs) && props.record?.submitCbs.forEach((fn) => fn()); diff --git a/src/hooks/setting/useMenuSetting.ts b/src/hooks/setting/useMenuSetting.ts index e63beff2a05..bb30c5ee87f 100644 --- a/src/hooks/setting/useMenuSetting.ts +++ b/src/hooks/setting/useMenuSetting.ts @@ -93,11 +93,10 @@ const getCalcContentWidth = computed(() => { unref(getIsTopMenu) || !unref(getShowMenu) || (unref(getSplit) && unref(getMenuHidden)) ? 0 : unref(getIsMixSidebar) - ? unref(getCollapsed) - ? SIDE_BAR_MINI_WIDTH - : SIDE_BAR_SHOW_TIT_MINI_WIDTH + - (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0) + ? (unref(getCollapsed) ? SIDE_BAR_MINI_WIDTH : SIDE_BAR_SHOW_TIT_MINI_WIDTH) + + (unref(getMixSideFixed) && unref(mixSideHasChildren) ? unref(getRealWidth) : 0) : unref(getRealWidth); + return `calc(100% - ${unref(width)}px)`; }); diff --git a/src/utils/http/axios/index.ts b/src/utils/http/axios/index.ts index f644b7171e8..6522f4a7629 100644 --- a/src/utils/http/axios/index.ts +++ b/src/utils/http/axios/index.ts @@ -154,8 +154,8 @@ const transform: AxiosTransform = { const { t } = useI18n(); errorStore.setupErrorHandle(error); const { response, code, message } = error || {}; - const msg: string = response?.data?.error ? response.data.error.message : ''; - const err: string = error?.toString(); + const msg: string = response?.data?.error?.message ?? ''; + const err: string = error?.toString?.() ?? ''; try { if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { createMessage.error(t('sys.api.apiTimeoutMessage')); diff --git a/src/views/demo/page/desc/basic/index.vue b/src/views/demo/page/desc/basic/index.vue index 1b7546f9e69..ae4a8cf5ad9 100644 --- a/src/views/demo/page/desc/basic/index.vue +++ b/src/views/demo/page/desc/basic/index.vue @@ -1,5 +1,5 @@