@gx-design-vue/pro-utils 0.2.0-beta.8 → 0.2.0-beta.80
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.
- package/dist/base64/index.d.ts +20 -0
- package/dist/cloneDeep/index.d.ts +48 -0
- package/dist/getValueFromObjectByKey/index.d.ts +3 -0
- package/dist/index.d.ts +15 -9
- package/dist/isImg/index.d.ts +2 -0
- package/dist/isNil/index.d.ts +1 -0
- package/dist/isUrl/index.d.ts +6 -0
- package/dist/merge/index.d.ts +18 -2
- package/dist/nanoid/index.d.ts +6 -0
- package/dist/omitUndefined/index.d.ts +2 -5
- package/dist/omitUndefinedAndEmptyArr/index.d.ts +1 -0
- package/dist/pro-utils.js +1058 -0
- package/dist/pro-utils.umd.cjs +13 -0
- package/dist/slots/index.d.ts +67 -8
- package/dist/typings/index.d.ts +17 -16
- package/dist/utils/config.d.ts +1 -2
- package/dist/utils/getSymbols.d.ts +1 -0
- package/dist/utils/index.d.ts +145 -22
- package/dist/utils/isNotNil.d.ts +1 -0
- package/dist/utils/isPlainObject.d.ts +43 -0
- package/dist/utils/isPrimitive.d.ts +29 -0
- package/dist/utils/isTypedArray.d.ts +27 -0
- package/dist/utils/isValid.d.ts +2 -0
- package/dist/utils/raf.d.ts +5 -0
- package/dist/utils/validate.d.ts +11 -8
- package/package.json +26 -49
- package/dist/pro-utils.mjs +0 -562
- package/dist/pro-utils.umd.js +0 -1
- package/dist/scroll/raf.d.ts +0 -9
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default class Base64 {
|
|
2
|
+
_keyStr: string;
|
|
3
|
+
constructor();
|
|
4
|
+
_utf8_encode(string: string): string;
|
|
5
|
+
_utf8_decode(utftext: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* @Author gx12358
|
|
8
|
+
* @DateTime 2024/12/21
|
|
9
|
+
* @lastTime 2024/12/21
|
|
10
|
+
* @description 加密方法
|
|
11
|
+
*/
|
|
12
|
+
encode(input: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* @Author gx12358
|
|
15
|
+
* @DateTime 2024/12/21
|
|
16
|
+
* @lastTime 2024/12/21
|
|
17
|
+
* @description 解密
|
|
18
|
+
*/
|
|
19
|
+
decode(input: string): string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a deep clone of the given object.
|
|
3
|
+
*
|
|
4
|
+
* @template T - The type of the object.
|
|
5
|
+
* @param {T} obj - The object to clone.
|
|
6
|
+
* @returns {T} - A deep clone of the given object.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* // Clone a primitive values
|
|
10
|
+
* const num = 29;
|
|
11
|
+
* const clonedNum = clone(num);
|
|
12
|
+
* console.log(clonedNum); // 29
|
|
13
|
+
* console.log(clonedNum === num) ; // true
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* // Clone an array
|
|
17
|
+
* const arr = [1, 2, 3];
|
|
18
|
+
* const clonedArr = clone(arr);
|
|
19
|
+
* console.log(clonedArr); // [1, 2, 3]
|
|
20
|
+
* console.log(clonedArr === arr); // false
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* // Clone an array with nested objects
|
|
24
|
+
* const arr = [1, { a: 1 }, [1, 2, 3]];
|
|
25
|
+
* const clonedArr = clone(arr);
|
|
26
|
+
* arr[1].a = 2;
|
|
27
|
+
* console.log(arr); // [2, { a: 2 }, [1, 2, 3]]
|
|
28
|
+
* console.log(clonedArr); // [1, { a: 1 }, [1, 2, 3]]
|
|
29
|
+
* console.log(clonedArr === arr); // false
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // Clone an object
|
|
33
|
+
* const obj = { a: 1, b: 'es-toolkit', c: [1, 2, 3] };
|
|
34
|
+
* const clonedObj = clone(obj);
|
|
35
|
+
* console.log(clonedObj); // { a: 1, b: 'es-toolkit', c: [1, 2, 3] }
|
|
36
|
+
* console.log(clonedObj === obj); // false
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* // Clone an object with nested objects
|
|
40
|
+
* const obj = { a: 1, b: { c: 1 } };
|
|
41
|
+
* const clonedObj = clone(obj);
|
|
42
|
+
* obj.b.c = 2;
|
|
43
|
+
* console.log(obj); // { a: 1, b: { c: 2 } }
|
|
44
|
+
* console.log(clonedObj); // { a: 1, b: { c: 1 } }
|
|
45
|
+
* console.log(clonedObj === obj); // false
|
|
46
|
+
*/
|
|
47
|
+
export declare function cloneDeep<T>(obj: T): T;
|
|
48
|
+
export declare function copyProperties(target: any, source: any, stack?: Map<any, any>): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
type DeepValueOf<T, K> = K extends `${infer First}:${infer Rest}` ? First extends keyof T ? Rest extends '' ? T[First] : DeepValueOf<T[First], Rest> : undefined : K extends keyof T ? T[K] : undefined;
|
|
2
|
+
export declare function getValueFromObjectByKey<T extends object, K extends string | string[] = string>(object: T, key: K): DeepValueOf<T, K extends string ? K : string> | undefined;
|
|
3
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { isScroll, getScrollContainer, isInContainer } from './scroll';
|
|
1
|
+
import Base64 from './base64';
|
|
3
2
|
import classNames from './classNames';
|
|
4
|
-
import
|
|
3
|
+
import { getValueFromObjectByKey } from './getValueFromObjectByKey';
|
|
4
|
+
import isServer from './isServer';
|
|
5
|
+
import { getScrollContainer, isInContainer, isScroll } from './scroll';
|
|
5
6
|
import getScroll from './scroll/getScroll';
|
|
7
|
+
import scrollTo from './scroll/scrollTo';
|
|
6
8
|
import throttleByAnimationFrame from './scroll/throttleByAnimationFrame';
|
|
7
|
-
|
|
8
|
-
export * from './merge';
|
|
9
|
-
export * from './isDeepEqualReact';
|
|
9
|
+
export * from './cloneDeep';
|
|
10
10
|
export * from './isBrowser';
|
|
11
|
+
export * from './isDeepEqualReact';
|
|
12
|
+
export * from './isImg';
|
|
13
|
+
export * from './isNil';
|
|
14
|
+
export * from './isUrl';
|
|
15
|
+
export * from './merge';
|
|
16
|
+
export * from './nanoid';
|
|
11
17
|
export * from './omitBoolean';
|
|
12
18
|
export * from './omitUndefined';
|
|
19
|
+
export * from './omitUndefinedAndEmptyArr';
|
|
13
20
|
export * from './slots';
|
|
14
|
-
export * from './utils';
|
|
15
|
-
export * from './utils/validate';
|
|
16
21
|
export * from './typings';
|
|
17
|
-
export
|
|
22
|
+
export * from './utils';
|
|
23
|
+
export { Base64, classNames, getScroll, getScrollContainer, getValueFromObjectByKey, isInContainer, isScroll, isServer, scrollTo, throttleByAnimationFrame };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const isNil: (value: any) => value is null | undefined;
|
package/dist/merge/index.d.ts
CHANGED
|
@@ -1,7 +1,23 @@
|
|
|
1
|
+
import type { DeepPartial } from '../typings';
|
|
1
2
|
/**
|
|
2
3
|
* 用于合并 n 个对象
|
|
3
4
|
* @param {any[]} ...rest
|
|
4
5
|
* @returns T
|
|
5
6
|
*/
|
|
6
|
-
declare const merge: <T>(...rest: any[]) => T;
|
|
7
|
-
|
|
7
|
+
declare const merge: <T = any>(...rest: any[]) => T;
|
|
8
|
+
/**
|
|
9
|
+
* @Author gx12358
|
|
10
|
+
* @DateTime 2024/12/6
|
|
11
|
+
* @lastTime 2024/12/6
|
|
12
|
+
* @description 深度合并对象
|
|
13
|
+
* @description target 目标值
|
|
14
|
+
* @description source 合并值
|
|
15
|
+
* @description options 参数配置
|
|
16
|
+
* @description options - omitNil 去除空值
|
|
17
|
+
* @description options - omitEmpty 去除空数组或对象
|
|
18
|
+
*/
|
|
19
|
+
declare function deepMerge<T extends object>(target: T, source: DeepPartial<T>, options?: {
|
|
20
|
+
omitNil?: boolean;
|
|
21
|
+
omitEmpty?: boolean;
|
|
22
|
+
}): T;
|
|
23
|
+
export { deepMerge, merge };
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
type OmitUndefined
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
export declare const omitUndefined: <T>(obj: T) => OmitUndefined<T>;
|
|
5
|
-
export {};
|
|
1
|
+
import type { OmitUndefined } from '../typings';
|
|
2
|
+
export declare const omitUndefined: <T extends Record<string, any>>(obj: T) => OmitUndefined<T>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const omitUndefinedAndEmptyArr: <T extends Record<string, any>>(obj: T) => T;
|