From 02d41197b6555b20f3b084abacb9e32affbcbcc1 Mon Sep 17 00:00:00 2001 From: Cherelle Spencer <454690789@qq.com> Date: Tue, 4 Apr 2023 16:59:19 +0800 Subject: [PATCH 1/4] =?UTF-8?q?fix:=20propTypes.extend()=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=BA=9F=E5=BC=83,=20=E6=94=B9=E4=B8=BA?= =?UTF-8?q?=E5=AE=98=E6=96=B9=E6=8E=A8=E8=8D=90=E7=9A=84ES6+=E6=96=B9?= =?UTF-8?q?=E6=B3=95=20(#2670)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 苗大 --- src/utils/propTypes.ts | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/utils/propTypes.ts b/src/utils/propTypes.ts index a5b0a47a4..16cf9cd40 100644 --- a/src/utils/propTypes.ts +++ b/src/utils/propTypes.ts @@ -1,5 +1,5 @@ import { CSSProperties, VNodeChild } from 'vue'; -import { createTypes, VueTypeValidableDef, VueTypesInterface } from 'vue-types'; +import { createTypes, VueTypeValidableDef, VueTypesInterface, toValidableType } from 'vue-types'; export type VueNode = VNodeChild | JSX.Element; @@ -8,8 +8,7 @@ type PropTypes = VueTypesInterface & { readonly VNodeChild: VueTypeValidableDef; // readonly trueBool: VueTypeValidableDef; }; - -const propTypes = createTypes({ +const newPropTypes = createTypes({ func: undefined, bool: undefined, string: undefined, @@ -18,17 +17,19 @@ const propTypes = createTypes({ integer: undefined, }) as PropTypes; -propTypes.extend([ - { - name: 'style', - getter: true, - type: [String, Object], - default: undefined, - }, - { - name: 'VNodeChild', - getter: true, - type: undefined, - }, -]); +// 从 vue-types v5.0 开始,extend()方法已经废弃,当前已改为官方推荐的ES6+方法 https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method +class propTypes extends newPropTypes { + // a native-like validator that supports the `.validable` method + static get style() { + return toValidableType('style', { + type: [String, Object], + }); + } + + static get VNodeChild() { + return toValidableType('VNodeChild', { + type: undefined, + }); + } +} export { propTypes }; From 4418eccfab178bbca5cf54ca74692598f19f5a6e Mon Sep 17 00:00:00 2001 From: Cherelle Spencer <454690789@qq.com> Date: Tue, 4 Apr 2023 16:59:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?fix(deepMerge):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E9=80=92=E5=BD=92=E5=90=88=E5=B9=B6=E6=93=8D=E4=BD=9C,=20?= =?UTF-8?q?=E5=90=88=E5=B9=B6=E6=95=B0=E7=BB=84=E6=9C=AA=E5=8E=BB=E9=87=8D?= =?UTF-8?q?=E7=9A=84bug=20(#2667)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 苗大 --- src/utils/index.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/index.ts b/src/utils/index.ts index 0ef6b074f..945ed086a 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -3,7 +3,7 @@ import type { App, Component } from 'vue'; import { unref } from 'vue'; import { isArray, isObject } from '/@/utils/is'; -import { cloneDeep, mergeWith } from 'lodash-es'; +import { cloneDeep, isEqual, mergeWith, unionWith } from 'lodash-es'; export const noop = () => {}; @@ -48,7 +48,8 @@ export function deepMerge { if (isObject(objValue) && isObject(srcValue)) { return mergeWith(cloneDeep(objValue), srcValue, (prevValue, nextValue) => { - return isArray(prevValue) ? prevValue.concat(nextValue) : undefined; + // 如果是数组,合并数组(去重) If it is an array, merge the array (remove duplicates) + return isArray(prevValue) ? unionWith(prevValue, nextValue, isEqual) : undefined; }); } }); From af54b0fbc6a69b77114f290514bd8d7c80c068ff Mon Sep 17 00:00:00 2001 From: oooplz <51434344+oooplz@users.noreply.github.com> Date: Tue, 4 Apr 2023 16:59:43 +0800 Subject: [PATCH 3/4] =?UTF-8?q?feat:=20=E5=A4=9A=E8=B7=AF=E5=BE=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=8E=B7=E5=8F=96=E5=80=BC=20(#2664)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Form/src/hooks/useFormEvents.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/Form/src/hooks/useFormEvents.ts b/src/components/Form/src/hooks/useFormEvents.ts index deec7cbf6..5981693e8 100644 --- a/src/components/Form/src/hooks/useFormEvents.ts +++ b/src/components/Form/src/hooks/useFormEvents.ts @@ -14,7 +14,7 @@ import { import { deepMerge } from '/@/utils'; import { dateItemType, handleInputNumberValue, defaultValueComponents } from '../helper'; import { dateUtil } from '/@/utils/dateUtil'; -import { cloneDeep, set, uniqBy } from 'lodash-es'; +import { cloneDeep, set, uniqBy, get } from 'lodash-es'; import { error } from '/@/utils/log'; interface UseFormActionContext { @@ -112,9 +112,8 @@ export function useFormEvents({ const validKeys: string[] = []; fields.forEach((key) => { const schema = unref(getSchema).find((item) => item.field === key); - let value = values[key]; - - const hasKey = Reflect.has(values, key); + let value = get(values, key); + const hasKey = !!get(values, key); value = handleInputNumberValue(schema?.component, value); const { componentProps } = schema || {}; From 7a8978dcff77a0da534cc059e50d94098ab8eb79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=8D=E7=AB=AF=E7=88=B1=E7=A0=81=E5=A3=AB?= Date: Tue, 4 Apr 2023 17:11:03 +0800 Subject: [PATCH 4/4] =?UTF-8?q?fix:=20=E8=A7=A3=E5=86=B3=E6=89=93=E5=8C=85?= =?UTF-8?q?=E6=8A=A5=E5=86=85=E5=AD=98=E6=BA=A2=E5=87=BA=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#2672)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 67ced9de1..418a13d74 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "bootstrap": "pnpm install", "serve": "npm run dev", "dev": "vite", - "build": "cross-env NODE_ENV=production vite build && esno ./build/script/postBuild.ts", - "build:test": "cross-env vite build --mode test && esno ./build/script/postBuild.ts", + "build": "cross-env NODE_ENV=production NODE_OPTIONS=--max-old-space-size=8192 vite build && esno ./build/script/postBuild.ts", + "build:test": "cross-env NODE_OPTIONS=--max-old-space-size=8192 vite build --mode test && esno ./build/script/postBuild.ts", "build:no-cache": "pnpm clean:cache && npm run build", "report": "cross-env REPORT=true npm run build", "type:check": "vue-tsc --noEmit --skipLibCheck",