From 0680435c5d5e14e15bec58b7e5d71cc9801c884a Mon Sep 17 00:00:00 2001 From: hans Date: Tue, 23 Jan 2024 16:28:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?REPORT-112276=20=E5=85=AC=E5=85=B1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8F=96=E6=95=B0=E7=AE=80=E9=81=93=E4=BA=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=83=A8=E5=88=86=E9=80=82=E9=85=8D?= =?UTF-8?q?=20=E5=BC=95=E7=94=A8lodash.uniqWith?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/src/core/1.lodash.js | 25 +++++++++++++++++++++++++ packages/fineui/src/core/2.base.js | 6 ++++-- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/packages/fineui/src/core/1.lodash.js b/packages/fineui/src/core/1.lodash.js index ca3a3ade0..2658bdf48 100644 --- a/packages/fineui/src/core/1.lodash.js +++ b/packages/fineui/src/core/1.lodash.js @@ -6142,6 +6142,30 @@ return (array && array.length) ? baseUniq(array, baseIteratee(iteratee, 2)) : []; } + /** + * This method is like `uniq` except that it accepts `comparator` which + * is invoked to compare elements of `array`. The order of result values is + * determined by the order they occur in the array. The comparator is invoked + * with two arguments: (arrVal, othVal). + * + * @since 4.0.0 + * @category Array + * @param {Array} array The array to inspect. + * @param {Function} [comparator] The comparator invoked per element. + * @returns {Array} Returns the new duplicate free array. + * @see uniq, uniqBy + * @example + * + * const objects = [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }, { 'x': 1, 'y': 2 }] + * + * uniqWith(objects, isEqual) + * // => [{ 'x': 1, 'y': 2 }, { 'x': 2, 'y': 1 }] + */ + function uniqWith(array, comparator) { + comparator = typeof comparator === 'function' ? comparator : undefined; + return (array && array.length) ? baseUniq(array, undefined, comparator) : []; + } + /** * This method is like `_.zip` except that it accepts an array of grouped * elements and creates an array regrouping the elements to their pre-zip @@ -10041,6 +10065,7 @@ lodash.union = union; lodash.uniq = uniq; lodash.uniqBy = uniqBy; + lodash.uniqWith = uniqWith; lodash.unzip = unzip; lodash.values = values; lodash.without = without; diff --git a/packages/fineui/src/core/2.base.js b/packages/fineui/src/core/2.base.js index 15502e37b..fe0c611f2 100644 --- a/packages/fineui/src/core/2.base.js +++ b/packages/fineui/src/core/2.base.js @@ -482,6 +482,7 @@ _.each( "take", "takeRight", "uniqBy", + "uniqWith" ], name => { lodashFns[name] = _apply(name); @@ -510,6 +511,7 @@ export const range = lodashFns.range; export const take = lodashFns.take; export const takeRight = lodashFns.takeRight; export const uniqBy = lodashFns.uniqBy; +export const uniqWith = lodashFns.uniqWith; export const findIndex = lodashFns.findIndex; export const findLastIndex = lodashFns.findLastIndex; @@ -972,7 +974,7 @@ export let nextTick = /*!PURE*/(function () { pending = true; timerFunc(); } - + if (!cb && typeof Promise !== "undefined") { return new Promise((resolve, reject) => { _resolve = resolve; @@ -983,7 +985,7 @@ export let nextTick = /*!PURE*/(function () { export const setNextTick = (fn) => { nextTick = fn; -} +} // 数字相关方法 _.each(["random"], name => { From 7a884527b7d17c9c8539c39a57cad7cba6d5edd3 Mon Sep 17 00:00:00 2001 From: hans Date: Thu, 25 Jan 2024 14:26:53 +0800 Subject: [PATCH 2/2] =?UTF-8?q?REPORT-112276=20=E5=85=AC=E5=85=B1=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8F=96=E6=95=B0=E7=AE=80=E9=81=93=E4=BA=91=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E8=BF=9E=E6=8E=A5=E9=83=A8=E5=88=86=E9=80=82=E9=85=8D?= =?UTF-8?q?=20=E8=A1=A5=E5=85=85=E4=B8=8Bts=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/fineui/typescript/core/base.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/fineui/typescript/core/base.ts b/packages/fineui/typescript/core/base.ts index 10d9794ec..07b481d34 100644 --- a/packages/fineui/typescript/core/base.ts +++ b/packages/fineui/typescript/core/base.ts @@ -172,6 +172,8 @@ export declare function uniq(array: T[], isSorted?: boolean, iteratee?: any, export declare function uniqBy(array: T[], iteratee?: any, context?: any): T[]; +export declare function uniqWith(array: T[], comparator?: any): T[]; + // 对象相关方法 export declare function keys(object: object): string[];