From 16574395697669052b000df857a886c0a3121a11 Mon Sep 17 00:00:00 2001 From: Cyrus Zhou Date: Wed, 18 Jan 2023 04:17:44 +0100 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20updateSchema=20=E5=A4=9A?= =?UTF-8?q?=E4=B8=AAfield=20=E5=B1=9E=E6=80=A7=E6=97=B6=EF=BC=8C=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E4=B8=AA=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98=E3=80=82?= =?UTF-8?q?=20(#2493)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Table BasicColumn 添加 editDynamicDisabled Co-authored-by: Cyrus Zhou <6802207@qq.com> 使用方式同 Form FormSchema dynamicDisabled ``` export const Columns: BasicColumn[] = [ { title: 'Title', dataIndex: 'Title', editRow: true, editComponent: 'Select', editDynamicDisabled: ({ record }) => record.isDisabled, }, * editComponentProps onChange 功能恢复 Co-authored-by: Cyrus Zhou <6802207@qq.com> 说明: ...omit(compProps, 'onChange') 这会忽略 onChange ,导致 editComponentProps onChange 被取消 如下功能将不支持: ``` editComponentProps: ({ record }) => { return { options: effectTypeData, onChange: () => { }, }; }, ``` * tableData == null 报错 * ApiSelect 第一次选择触发required错误提示问题 * 恢复 虽然可以解决第一次选择提示报错问题,但是会导致 onChange: (e: any, options: any) => 无法获得 options 的值 * 修复标签页切换灰屏不显示内容问题 Co-authored-by: Cyrus Zhou <6802207@qq.com> 问题描述页面没有用 div 包括 会提示 Component inside renders non-element root node that cannot be animated , 导致页灰屏必须刷新页面才可以显示内容 * 添加 Form ApiTransfer ## 使用方式 api 方式: ``` ...... component: 'ApiTransfer', componentProps: { api: sysUserSelector, labelField: 'name', valueField: 'id', }, ..... ``` 数据方式: ``` .... componentProps: { dataSource: [ { title: 'Test01', key: '0', disabled: false, description: 'description 01' }, { title: 'Test02', key: '1', disabled: false, description: 'description 02' }, { title: 'Test03', key: '2', disabled: false, description: 'description 03' }, { title: 'Test04', key: '3', disabled: false, description: 'description 04' }, { title: 'Test05', key: '4', disabled: false, description: 'description 05' }, ], }, .... ``` * style: eslint 书写规范 * fix: 频繁切换页面导致灰屏 * fix: 修复 updateSchema 多个field 属性时,第二个无效问题。 如: ``` updateSchema([ { field: 'password', ifShow: !unref(isUpdate), }, { field: 'confirm', ifShow: !unref(isUpdate), }, ]); ``` Co-authored-by: CyrusZhou <6802207@qq.com> --- .vscode/settings.json | 20 ++++++++++++++++++- .../Form/src/hooks/useFormEvents.ts | 16 +++++++++------ src/components/Tree/src/types/tree.ts | 2 +- src/layouts/page/index.vue | 4 +++- src/utils/dateUtil.ts | 1 - src/utils/index.ts | 2 +- 6 files changed, 34 insertions(+), 11 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index a947eb977..748642425 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -138,5 +138,23 @@ ], "vetur.format.scriptInitialIndent": true, "vetur.format.styleInitialIndent": true, - "vetur.validation.script": false + "vetur.validation.script": false, + "MicroPython.executeButton": [ + { + "text": "▶", + "tooltip": "运行", + "alignment": "left", + "command": "extension.executeFile", + "priority": 3.5 + } + ], + "MicroPython.syncButton": [ + { + "text": "$(sync)", + "tooltip": "同步", + "alignment": "left", + "command": "extension.execute", + "priority": 4 + } + ] } diff --git a/src/components/Form/src/hooks/useFormEvents.ts b/src/components/Form/src/hooks/useFormEvents.ts index 66b833719..7af80a562 100644 --- a/src/components/Form/src/hooks/useFormEvents.ts +++ b/src/components/Form/src/hooks/useFormEvents.ts @@ -220,15 +220,19 @@ export function useFormEvents({ return; } const schema: FormSchema[] = []; - updateData.forEach((item) => { - unref(getSchema).forEach((val) => { + unref(getSchema).forEach((val) => { + let _val; + updateData.forEach((item) => { if (val.field === item.field) { - const newSchema = deepMerge(val, item); - schema.push(newSchema as FormSchema); - } else { - schema.push(val); + _val = item; } }); + if (_val !== undefined && val.field === _val.field) { + const newSchema = deepMerge(val, _val); + schema.push(newSchema as FormSchema); + } else { + schema.push(val); + } }); _setDefaultValue(schema); diff --git a/src/components/Tree/src/types/tree.ts b/src/components/Tree/src/types/tree.ts index 0b68b4b44..8d75e8b3e 100644 --- a/src/components/Tree/src/types/tree.ts +++ b/src/components/Tree/src/types/tree.ts @@ -134,7 +134,7 @@ export const treeProps = buildProps({ type: Boolean, default: false, }, - treeWrapperClassName: String + treeWrapperClassName: String, }); export type TreeProps = ExtractPropTypes; diff --git a/src/layouts/page/index.vue b/src/layouts/page/index.vue index d1cd11431..34cb5c4b0 100644 --- a/src/layouts/page/index.vue +++ b/src/layouts/page/index.vue @@ -15,7 +15,9 @@ appear > - +
+ +
diff --git a/src/utils/dateUtil.ts b/src/utils/dateUtil.ts index 265635dc0..e18387dfa 100644 --- a/src/utils/dateUtil.ts +++ b/src/utils/dateUtil.ts @@ -15,4 +15,3 @@ export function formatToDate(date?: dayjs.ConfigType, format = DATE_FORMAT): str } export const dateUtil = dayjs; - diff --git a/src/utils/index.ts b/src/utils/index.ts index d90e67310..20952adc3 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -36,7 +36,7 @@ export function setObjToUrlParams(baseUrl: string, obj: any): string { // 深度合并 export function deepMerge(src: any = {}, target: any = {}): T { let key: string; - const res: any = cloneDeep(src) + const res: any = cloneDeep(src); for (key in target) { res[key] = isObject(res[key]) ? deepMerge(res[key], target[key]) : (res[key] = target[key]); }