zy-react-library 1.0.109 → 1.0.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,8 @@
1
- /**
2
- * useIsExistenceDuplicateSelection 钩子的选项参数
3
- */
4
- interface UseIsExistenceDuplicateSelectionOptions<T> {
1
+ interface IsExistenceDuplicateSelectionOptions<T> {
5
2
  /** 需要检查重复项的目标数组 */
6
3
  data: T[];
7
4
  /** 用于去重判断的对象属性名 */
8
- key: keyof T;
5
+ key: keyof T | string;
9
6
  /** 可选的错误提示信息 */
10
7
  message?: string;
11
8
  }
@@ -14,10 +11,12 @@ interface UseIsExistenceDuplicateSelectionOptions<T> {
14
11
  * 检查数组中是否存在重复项的函数
15
12
  */
16
13
  interface IsExistenceDuplicateSelectionFunction {
17
- <T>(options: UseIsExistenceDuplicateSelectionOptions<T>): Promise<void>;
14
+ <T>(options: IsExistenceDuplicateSelectionOptions<T>): Promise<void>;
18
15
  }
19
16
 
20
17
  /**
21
18
  * 检查数组中是否存在重复项
22
19
  */
23
- export default function useIsExistenceDuplicateSelection(): IsExistenceDuplicateSelectionFunction;
20
+ export default function useIsExistenceDuplicateSelection(): {
21
+ isExistenceDuplicateSelection: IsExistenceDuplicateSelectionFunction;
22
+ };
@@ -5,7 +5,7 @@ import { uniqBy } from "lodash-es";
5
5
  * 检查数组中是否存在重复项
6
6
  */
7
7
  export default function useIsExistenceDuplicateSelection() {
8
- const IsExistenceDuplicateSelection = (options) => {
8
+ const isExistenceDuplicateSelection = (options) => {
9
9
  const { data, key, message = "存在重复项,请勿重复选择" } = options;
10
10
  return new Promise((resolve, reject) => {
11
11
  if (uniqBy(data, key).length !== data.length) {
@@ -17,5 +17,5 @@ export default function useIsExistenceDuplicateSelection() {
17
17
  }
18
18
  });
19
19
  }
20
- return IsExistenceDuplicateSelection;
20
+ return { isExistenceDuplicateSelection };
21
21
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "zy-react-library",
3
3
  "private": false,
4
- "version": "1.0.109",
4
+ "version": "1.0.111",
5
5
  "type": "module",
6
6
  "description": "",
7
7
  "author": "LiuJiaNan",