@pisell/utils 1.0.68 → 1.0.71
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/README.md +2 -2
- package/es/arrayUtils.d.ts +1 -1
- package/es/common/index.d.ts +5 -5
- package/es/common/index.js +2 -2
- package/es/common/stateHelper.d.ts +18 -18
- package/es/common/stateHelper.js +15 -15
- package/es/common/types.d.ts +28 -28
- package/es/componentStorage.d.ts +36 -36
- package/es/componentStorage.js +7 -7
- package/es/constants/index.d.ts +7 -7
- package/es/date.d.ts +28 -28
- package/es/date.js +22 -22
- package/es/document.d.ts +13 -13
- package/es/document.js +7 -7
- package/es/escPosPrinter/index.d.ts +9 -9
- package/es/firebase/config/index.d.ts +13 -13
- package/es/firebase/index.d.ts +28 -28
- package/es/format.d.ts +28 -28
- package/es/format.js +14 -14
- package/es/image.d.ts +11 -11
- package/es/image.js +5 -5
- package/es/index.d.ts +25 -25
- package/es/jsBridge/index.d.ts +22 -22
- package/es/jsBridge/index.js +15 -15
- package/es/jsBridge/regDeviceApi.d.ts +15 -15
- package/es/jsBridge/regDeviceApi.js +3 -3
- package/es/jsBridge/types.d.ts +149 -149
- package/es/locales.d.ts +9 -9
- package/es/locales.js +40 -21
- package/es/log.d.ts +10 -10
- package/es/miniRedux.d.ts +16 -16
- package/es/number-input/hooks/index.d.ts +4 -4
- package/es/number-input/hooks/index.js +2 -2
- package/es/number-input/hooks/useNumberInputState.d.ts +25 -25
- package/es/number-input/hooks/useNumberInputState.js +39 -39
- package/es/number-input/index.d.ts +14 -14
- package/es/number-input/index.js +8 -8
- package/es/number-input/types.d.ts +96 -96
- package/es/number-input/utils/formatter.d.ts +53 -53
- package/es/number-input/utils/formatter.js +37 -37
- package/es/number-input/utils/index.d.ts +7 -7
- package/es/number-input/utils/index.js +2 -2
- package/es/number-input/utils/validation.d.ts +27 -27
- package/es/number-input/utils/validation.js +24 -24
- package/es/otherUtils.d.ts +48 -48
- package/es/otherUtils.js +32 -32
- package/es/platform.d.ts +9 -9
- package/es/select/hooks/index.d.ts +5 -5
- package/es/select/hooks/index.js +2 -2
- package/es/select/hooks/useDebouncedSearch.d.ts +20 -20
- package/es/select/hooks/useDebouncedSearch.js +17 -17
- package/es/select/hooks/useSelectState.d.ts +19 -19
- package/es/select/hooks/useSelectState.js +13 -13
- package/es/select/index.d.ts +8 -8
- package/es/select/index.js +3 -3
- package/es/select/types.d.ts +256 -256
- package/es/select/utils/filterOptions.d.ts +22 -22
- package/es/select/utils/filterOptions.js +16 -16
- package/es/select/utils/helpers.d.ts +42 -42
- package/es/select/utils/helpers.js +30 -30
- package/es/select/utils/index.d.ts +7 -7
- package/es/select/utils/index.js +2 -2
- package/es/select/utils/sortOptions.d.ts +12 -12
- package/es/select/utils/sortOptions.js +8 -8
- package/es/select/utils/tagAggregation.d.ts +25 -25
- package/es/select/utils/tagAggregation.js +21 -21
- package/es/text-input/hooks/index.d.ts +4 -4
- package/es/text-input/hooks/index.js +2 -2
- package/es/text-input/hooks/useTextInputState.d.ts +24 -24
- package/es/text-input/hooks/useTextInputState.js +38 -38
- package/es/text-input/index.d.ts +14 -14
- package/es/text-input/index.js +9 -9
- package/es/text-input/types.d.ts +56 -56
- package/es/text-input/utils/index.d.ts +5 -5
- package/es/text-input/utils/index.js +2 -2
- package/es/text-input/utils/validation.d.ts +23 -23
- package/es/text-input/utils/validation.js +20 -20
- package/es/typeUtils.d.ts +42 -42
- package/es/typeUtils.js +26 -26
- package/es/walletValidity.d.ts +44 -44
- package/es/walletValidity.js +85 -85
- package/lib/arrayUtils.d.ts +1 -1
- package/lib/common/index.d.ts +5 -5
- package/lib/common/stateHelper.d.ts +18 -18
- package/lib/common/types.d.ts +28 -28
- package/lib/componentStorage.d.ts +36 -36
- package/lib/constants/index.d.ts +7 -7
- package/lib/date.d.ts +28 -28
- package/lib/document.d.ts +13 -13
- package/lib/escPosPrinter/index.d.ts +9 -9
- package/lib/firebase/config/index.d.ts +13 -13
- package/lib/firebase/index.d.ts +28 -28
- package/lib/format.d.ts +28 -28
- package/lib/image.d.ts +11 -11
- package/lib/index.d.ts +25 -25
- package/lib/jsBridge/index.d.ts +22 -22
- package/lib/jsBridge/regDeviceApi.d.ts +15 -15
- package/lib/jsBridge/types.d.ts +149 -149
- package/lib/locales.d.ts +9 -9
- package/lib/locales.js +25 -6
- package/lib/log.d.ts +10 -10
- package/lib/miniRedux.d.ts +16 -16
- package/lib/number-input/hooks/index.d.ts +4 -4
- package/lib/number-input/hooks/useNumberInputState.d.ts +25 -25
- package/lib/number-input/index.d.ts +14 -14
- package/lib/number-input/types.d.ts +96 -96
- package/lib/number-input/utils/formatter.d.ts +53 -53
- package/lib/number-input/utils/index.d.ts +7 -7
- package/lib/number-input/utils/validation.d.ts +27 -27
- package/lib/otherUtils.d.ts +48 -48
- package/lib/platform.d.ts +9 -9
- package/lib/select/hooks/index.d.ts +5 -5
- package/lib/select/hooks/useDebouncedSearch.d.ts +20 -20
- package/lib/select/hooks/useSelectState.d.ts +19 -19
- package/lib/select/index.d.ts +8 -8
- package/lib/select/types.d.ts +256 -256
- package/lib/select/utils/filterOptions.d.ts +22 -22
- package/lib/select/utils/helpers.d.ts +42 -42
- package/lib/select/utils/index.d.ts +7 -7
- package/lib/select/utils/sortOptions.d.ts +12 -12
- package/lib/select/utils/tagAggregation.d.ts +25 -25
- package/lib/text-input/hooks/index.d.ts +4 -4
- package/lib/text-input/hooks/useTextInputState.d.ts +24 -24
- package/lib/text-input/index.d.ts +14 -14
- package/lib/text-input/types.d.ts +56 -56
- package/lib/text-input/utils/index.d.ts +5 -5
- package/lib/text-input/utils/validation.d.ts +23 -23
- package/lib/typeUtils.d.ts +42 -42
- package/lib/walletValidity.d.ts +44 -44
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 数值输入工具函数导出
|
|
3
|
-
*/
|
|
4
|
-
export { validateValue } from './validation';
|
|
5
|
-
export { getDisplayState } from '../../common';
|
|
6
|
-
export { formatNumber, addThousandsSeparator, formatPrecision } from './formatter';
|
|
7
|
-
export type { NumberFormatOptions } from './formatter';
|
|
1
|
+
/**
|
|
2
|
+
* 数值输入工具函数导出
|
|
3
|
+
*/
|
|
4
|
+
export { validateValue } from './validation';
|
|
5
|
+
export { getDisplayState } from '../../common';
|
|
6
|
+
export { formatNumber, addThousandsSeparator, formatPrecision } from './formatter';
|
|
7
|
+
export type { NumberFormatOptions } from './formatter';
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { BaseNumberInputProps, ValidationResult } from '../types';
|
|
2
|
-
/**
|
|
3
|
-
* 校验数值输入
|
|
4
|
-
*
|
|
5
|
-
* 按照优先级执行校验规则:
|
|
6
|
-
* 1. 必填校验(required)
|
|
7
|
-
* 2. 最小值校验(min)
|
|
8
|
-
* 3. 最大值校验(max)
|
|
9
|
-
* 4. 自定义校验函数(validator)
|
|
10
|
-
*
|
|
11
|
-
* @param value 待校验的值
|
|
12
|
-
* @param props 校验配置
|
|
13
|
-
* @returns 校验结果对象,包含 isValid 和 errors
|
|
14
|
-
*
|
|
15
|
-
* @example
|
|
16
|
-
* validateValue(10, { required: true, min: 0, max: 100 })
|
|
17
|
-
* // { isValid: true, errors: [] }
|
|
18
|
-
*
|
|
19
|
-
* @example
|
|
20
|
-
* validateValue(null, { required: true })
|
|
21
|
-
* // { isValid: false, errors: ['此字段为必填项'] }
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* validateValue(150, { min: 0, max: 100 })
|
|
25
|
-
* // { isValid: false, errors: ['不能大于 100'] }
|
|
26
|
-
*/
|
|
27
|
-
export declare function validateValue(value: number | null | undefined, props: BaseNumberInputProps): ValidationResult;
|
|
1
|
+
import type { BaseNumberInputProps, ValidationResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* 校验数值输入
|
|
4
|
+
*
|
|
5
|
+
* 按照优先级执行校验规则:
|
|
6
|
+
* 1. 必填校验(required)
|
|
7
|
+
* 2. 最小值校验(min)
|
|
8
|
+
* 3. 最大值校验(max)
|
|
9
|
+
* 4. 自定义校验函数(validator)
|
|
10
|
+
*
|
|
11
|
+
* @param value 待校验的值
|
|
12
|
+
* @param props 校验配置
|
|
13
|
+
* @returns 校验结果对象,包含 isValid 和 errors
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* validateValue(10, { required: true, min: 0, max: 100 })
|
|
17
|
+
* // { isValid: true, errors: [] }
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* validateValue(null, { required: true })
|
|
21
|
+
* // { isValid: false, errors: ['此字段为必填项'] }
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* validateValue(150, { min: 0, max: 100 })
|
|
25
|
+
* // { isValid: false, errors: ['不能大于 100'] }
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateValue(value: number | null | undefined, props: BaseNumberInputProps): ValidationResult;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 校验数值输入
|
|
3
|
-
*
|
|
4
|
-
* 按照优先级执行校验规则:
|
|
5
|
-
* 1. 必填校验(required)
|
|
6
|
-
* 2. 最小值校验(min)
|
|
7
|
-
* 3. 最大值校验(max)
|
|
8
|
-
* 4. 自定义校验函数(validator)
|
|
9
|
-
*
|
|
10
|
-
* @param value 待校验的值
|
|
11
|
-
* @param props 校验配置
|
|
12
|
-
* @returns 校验结果对象,包含 isValid 和 errors
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* validateValue(10, { required: true, min: 0, max: 100 })
|
|
16
|
-
* // { isValid: true, errors: [] }
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* validateValue(null, { required: true })
|
|
20
|
-
* // { isValid: false, errors: ['此字段为必填项'] }
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* validateValue(150, { min: 0, max: 100 })
|
|
24
|
-
* // { isValid: false, errors: ['不能大于 100'] }
|
|
1
|
+
/**
|
|
2
|
+
* 校验数值输入
|
|
3
|
+
*
|
|
4
|
+
* 按照优先级执行校验规则:
|
|
5
|
+
* 1. 必填校验(required)
|
|
6
|
+
* 2. 最小值校验(min)
|
|
7
|
+
* 3. 最大值校验(max)
|
|
8
|
+
* 4. 自定义校验函数(validator)
|
|
9
|
+
*
|
|
10
|
+
* @param value 待校验的值
|
|
11
|
+
* @param props 校验配置
|
|
12
|
+
* @returns 校验结果对象,包含 isValid 和 errors
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* validateValue(10, { required: true, min: 0, max: 100 })
|
|
16
|
+
* // { isValid: true, errors: [] }
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* validateValue(null, { required: true })
|
|
20
|
+
* // { isValid: false, errors: ['此字段为必填项'] }
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* validateValue(150, { min: 0, max: 100 })
|
|
24
|
+
* // { isValid: false, errors: ['不能大于 100'] }
|
|
25
25
|
*/
|
|
26
26
|
export function validateValue(value, props) {
|
|
27
27
|
var errors = [];
|
package/es/otherUtils.d.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @title: 判断是否无痕模式
|
|
3
|
-
* @description:
|
|
4
|
-
* @return: *
|
|
5
|
-
* @Author: shengjie.zuo
|
|
6
|
-
* @Date: 2024-09-4 09:58:22
|
|
7
|
-
*/
|
|
8
|
-
export declare const detectIncognito: () => Promise<{
|
|
9
|
-
isPrivate: boolean;
|
|
10
|
-
browserName: string;
|
|
11
|
-
} | {
|
|
12
|
-
isPrivate: boolean;
|
|
13
|
-
}>;
|
|
14
|
-
/**
|
|
15
|
-
* @Description: 生成唯一id
|
|
16
|
-
* @Author: wzw
|
|
17
|
-
* @Date: 2020-12-01 14:20:29
|
|
18
|
-
* @param {*}
|
|
19
|
-
* @return {*}
|
|
20
|
-
*/
|
|
21
|
-
export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
|
|
22
|
-
/**
|
|
23
|
-
* @title: 对数组进行增|删
|
|
24
|
-
* @description: 用于多选选中和取消选中的处理
|
|
25
|
-
* @param {any} list
|
|
26
|
-
* @param {any} item
|
|
27
|
-
* @param {string} key
|
|
28
|
-
* @return {*}
|
|
29
|
-
* @Author: zhiwei.Wang
|
|
30
|
-
* @Date: 2023-12-19 16:44
|
|
31
|
-
*/
|
|
32
|
-
export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
|
|
33
|
-
/**
|
|
34
|
-
* @title: 判断某个字段是否在列表内
|
|
35
|
-
* @description:
|
|
36
|
-
* @param {*} T
|
|
37
|
-
* @param {boolean} param2
|
|
38
|
-
* @return {*}
|
|
39
|
-
* @Author: zhiwei.Wang
|
|
40
|
-
* @Date: 2023-12-19 16:54
|
|
41
|
-
*/
|
|
42
|
-
export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
|
|
43
|
-
export declare const createArray: (length: number, returnItem: any) => unknown[];
|
|
44
|
-
/**
|
|
45
|
-
* 根据对象内容生成唯一id
|
|
46
|
-
* @param obj
|
|
47
|
-
*/
|
|
48
|
-
export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
|
|
1
|
+
/**
|
|
2
|
+
* @title: 判断是否无痕模式
|
|
3
|
+
* @description:
|
|
4
|
+
* @return: *
|
|
5
|
+
* @Author: shengjie.zuo
|
|
6
|
+
* @Date: 2024-09-4 09:58:22
|
|
7
|
+
*/
|
|
8
|
+
export declare const detectIncognito: () => Promise<{
|
|
9
|
+
isPrivate: boolean;
|
|
10
|
+
browserName: string;
|
|
11
|
+
} | {
|
|
12
|
+
isPrivate: boolean;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* @Description: 生成唯一id
|
|
16
|
+
* @Author: wzw
|
|
17
|
+
* @Date: 2020-12-01 14:20:29
|
|
18
|
+
* @param {*}
|
|
19
|
+
* @return {*}
|
|
20
|
+
*/
|
|
21
|
+
export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
|
|
22
|
+
/**
|
|
23
|
+
* @title: 对数组进行增|删
|
|
24
|
+
* @description: 用于多选选中和取消选中的处理
|
|
25
|
+
* @param {any} list
|
|
26
|
+
* @param {any} item
|
|
27
|
+
* @param {string} key
|
|
28
|
+
* @return {*}
|
|
29
|
+
* @Author: zhiwei.Wang
|
|
30
|
+
* @Date: 2023-12-19 16:44
|
|
31
|
+
*/
|
|
32
|
+
export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
|
|
33
|
+
/**
|
|
34
|
+
* @title: 判断某个字段是否在列表内
|
|
35
|
+
* @description:
|
|
36
|
+
* @param {*} T
|
|
37
|
+
* @param {boolean} param2
|
|
38
|
+
* @return {*}
|
|
39
|
+
* @Author: zhiwei.Wang
|
|
40
|
+
* @Date: 2023-12-19 16:54
|
|
41
|
+
*/
|
|
42
|
+
export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
|
|
43
|
+
export declare const createArray: (length: number, returnItem: any) => unknown[];
|
|
44
|
+
/**
|
|
45
|
+
* 根据对象内容生成唯一id
|
|
46
|
+
* @param obj
|
|
47
|
+
*/
|
|
48
|
+
export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
|
package/es/otherUtils.js
CHANGED
|
@@ -8,12 +8,12 @@ import md5 from "crypto-js/md5";
|
|
|
8
8
|
import enc from "crypto-js/enc-hex";
|
|
9
9
|
import { detectIncognito as originDetectIncognito } from "detectincognitojs";
|
|
10
10
|
|
|
11
|
-
/**
|
|
12
|
-
* @title: 判断是否无痕模式
|
|
13
|
-
* @description:
|
|
14
|
-
* @return: *
|
|
15
|
-
* @Author: shengjie.zuo
|
|
16
|
-
* @Date: 2024-09-4 09:58:22
|
|
11
|
+
/**
|
|
12
|
+
* @title: 判断是否无痕模式
|
|
13
|
+
* @description:
|
|
14
|
+
* @return: *
|
|
15
|
+
* @Author: shengjie.zuo
|
|
16
|
+
* @Date: 2024-09-4 09:58:22
|
|
17
17
|
*/
|
|
18
18
|
export var detectIncognito = /*#__PURE__*/function () {
|
|
19
19
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
@@ -52,12 +52,12 @@ export var detectIncognito = /*#__PURE__*/function () {
|
|
|
52
52
|
};
|
|
53
53
|
}();
|
|
54
54
|
|
|
55
|
-
/**
|
|
56
|
-
* @Description: 生成唯一id
|
|
57
|
-
* @Author: wzw
|
|
58
|
-
* @Date: 2020-12-01 14:20:29
|
|
59
|
-
* @param {*}
|
|
60
|
-
* @return {*}
|
|
55
|
+
/**
|
|
56
|
+
* @Description: 生成唯一id
|
|
57
|
+
* @Author: wzw
|
|
58
|
+
* @Date: 2020-12-01 14:20:29
|
|
59
|
+
* @param {*}
|
|
60
|
+
* @return {*}
|
|
61
61
|
*/
|
|
62
62
|
export var getUniqueId = function getUniqueId() {
|
|
63
63
|
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
@@ -65,15 +65,15 @@ export var getUniqueId = function getUniqueId() {
|
|
|
65
65
|
return prefix + (Math.random() + '').replace(/\D/g, '').substring(0, maxLength);
|
|
66
66
|
};
|
|
67
67
|
|
|
68
|
-
/**
|
|
69
|
-
* @title: 对数组进行增|删
|
|
70
|
-
* @description: 用于多选选中和取消选中的处理
|
|
71
|
-
* @param {any} list
|
|
72
|
-
* @param {any} item
|
|
73
|
-
* @param {string} key
|
|
74
|
-
* @return {*}
|
|
75
|
-
* @Author: zhiwei.Wang
|
|
76
|
-
* @Date: 2023-12-19 16:44
|
|
68
|
+
/**
|
|
69
|
+
* @title: 对数组进行增|删
|
|
70
|
+
* @description: 用于多选选中和取消选中的处理
|
|
71
|
+
* @param {any} list
|
|
72
|
+
* @param {any} item
|
|
73
|
+
* @param {string} key
|
|
74
|
+
* @return {*}
|
|
75
|
+
* @Author: zhiwei.Wang
|
|
76
|
+
* @Date: 2023-12-19 16:44
|
|
77
77
|
*/
|
|
78
78
|
export var changeArray = function changeArray() {
|
|
79
79
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -104,14 +104,14 @@ export var changeArray = function changeArray() {
|
|
|
104
104
|
return _list;
|
|
105
105
|
};
|
|
106
106
|
|
|
107
|
-
/**
|
|
108
|
-
* @title: 判断某个字段是否在列表内
|
|
109
|
-
* @description:
|
|
110
|
-
* @param {*} T
|
|
111
|
-
* @param {boolean} param2
|
|
112
|
-
* @return {*}
|
|
113
|
-
* @Author: zhiwei.Wang
|
|
114
|
-
* @Date: 2023-12-19 16:54
|
|
107
|
+
/**
|
|
108
|
+
* @title: 判断某个字段是否在列表内
|
|
109
|
+
* @description:
|
|
110
|
+
* @param {*} T
|
|
111
|
+
* @param {boolean} param2
|
|
112
|
+
* @return {*}
|
|
113
|
+
* @Author: zhiwei.Wang
|
|
114
|
+
* @Date: 2023-12-19 16:54
|
|
115
115
|
*/
|
|
116
116
|
export var getItemByArray = function getItemByArray() {
|
|
117
117
|
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
@@ -130,9 +130,9 @@ export var createArray = function createArray(length, returnItem) {
|
|
|
130
130
|
return Array.from(new Array(length)).map(returnItem);
|
|
131
131
|
};
|
|
132
132
|
|
|
133
|
-
/**
|
|
134
|
-
* 根据对象内容生成唯一id
|
|
135
|
-
* @param obj
|
|
133
|
+
/**
|
|
134
|
+
* 根据对象内容生成唯一id
|
|
135
|
+
* @param obj
|
|
136
136
|
*/
|
|
137
137
|
export var generateUniqueIdByObj = function generateUniqueIdByObj(obj) {
|
|
138
138
|
var jsonString = JSON.stringify(obj);
|
package/es/platform.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export declare const isIpad: () => boolean;
|
|
2
|
-
export declare const isMobile: () => boolean;
|
|
3
|
-
export declare const isAndroid: () => boolean;
|
|
4
|
-
export declare const isIos: () => boolean;
|
|
5
|
-
export declare const checkEnv: () => number;
|
|
6
|
-
export declare const isWx: () => boolean;
|
|
7
|
-
export declare const isIOS: () => boolean;
|
|
8
|
-
export declare const isWxApp: () => boolean;
|
|
9
|
-
export declare const isSafari: () => boolean;
|
|
1
|
+
export declare const isIpad: () => boolean;
|
|
2
|
+
export declare const isMobile: () => boolean;
|
|
3
|
+
export declare const isAndroid: () => boolean;
|
|
4
|
+
export declare const isIos: () => boolean;
|
|
5
|
+
export declare const checkEnv: () => number;
|
|
6
|
+
export declare const isWx: () => boolean;
|
|
7
|
+
export declare const isIOS: () => boolean;
|
|
8
|
+
export declare const isWxApp: () => boolean;
|
|
9
|
+
export declare const isSafari: () => boolean;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Select Hooks 导出
|
|
3
|
-
*/
|
|
4
|
-
export { useSelectState, useMultipleSelectState } from './useSelectState';
|
|
5
|
-
export { useDebouncedSearch } from './useDebouncedSearch';
|
|
1
|
+
/**
|
|
2
|
+
* Select Hooks 导出
|
|
3
|
+
*/
|
|
4
|
+
export { useSelectState, useMultipleSelectState } from './useSelectState';
|
|
5
|
+
export { useDebouncedSearch } from './useDebouncedSearch';
|
package/es/select/hooks/index.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 防抖搜索 Hook
|
|
3
|
-
* 对用户输入进行防抖处理,避免频繁触发搜索
|
|
4
|
-
*/
|
|
5
|
-
/**
|
|
6
|
-
* 防抖搜索 Hook
|
|
7
|
-
* @template T 值的类型
|
|
8
|
-
* @param initialValue 初始值
|
|
9
|
-
* @param delay 防抖延迟时间(毫秒)
|
|
10
|
-
* @param callback 防抖后的回调函数
|
|
11
|
-
* @returns [防抖后的值, 设置值函数]
|
|
12
|
-
*
|
|
13
|
-
* @example
|
|
14
|
-
* ```tsx
|
|
15
|
-
* const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
|
|
16
|
-
* console.log('搜索关键词:', text);
|
|
17
|
-
* });
|
|
18
|
-
* ```
|
|
19
|
-
*/
|
|
20
|
-
export declare function useDebouncedSearch<T = string>(initialValue: T, delay: number, callback?: (value: T) => void): [T, (value: T) => void];
|
|
1
|
+
/**
|
|
2
|
+
* 防抖搜索 Hook
|
|
3
|
+
* 对用户输入进行防抖处理,避免频繁触发搜索
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* 防抖搜索 Hook
|
|
7
|
+
* @template T 值的类型
|
|
8
|
+
* @param initialValue 初始值
|
|
9
|
+
* @param delay 防抖延迟时间(毫秒)
|
|
10
|
+
* @param callback 防抖后的回调函数
|
|
11
|
+
* @returns [防抖后的值, 设置值函数]
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```tsx
|
|
15
|
+
* const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
|
|
16
|
+
* console.log('搜索关键词:', text);
|
|
17
|
+
* });
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare function useDebouncedSearch<T = string>(initialValue: T, delay: number, callback?: (value: T) => void): [T, (value: T) => void];
|
|
@@ -4,27 +4,27 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
4
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
5
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
6
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
7
|
-
/**
|
|
8
|
-
* 防抖搜索 Hook
|
|
9
|
-
* 对用户输入进行防抖处理,避免频繁触发搜索
|
|
7
|
+
/**
|
|
8
|
+
* 防抖搜索 Hook
|
|
9
|
+
* 对用户输入进行防抖处理,避免频繁触发搜索
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { useState, useEffect } from 'react';
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* 防抖搜索 Hook
|
|
16
|
-
* @template T 值的类型
|
|
17
|
-
* @param initialValue 初始值
|
|
18
|
-
* @param delay 防抖延迟时间(毫秒)
|
|
19
|
-
* @param callback 防抖后的回调函数
|
|
20
|
-
* @returns [防抖后的值, 设置值函数]
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```tsx
|
|
24
|
-
* const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
|
|
25
|
-
* console.log('搜索关键词:', text);
|
|
26
|
-
* });
|
|
27
|
-
* ```
|
|
14
|
+
/**
|
|
15
|
+
* 防抖搜索 Hook
|
|
16
|
+
* @template T 值的类型
|
|
17
|
+
* @param initialValue 初始值
|
|
18
|
+
* @param delay 防抖延迟时间(毫秒)
|
|
19
|
+
* @param callback 防抖后的回调函数
|
|
20
|
+
* @returns [防抖后的值, 设置值函数]
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```tsx
|
|
24
|
+
* const [debouncedSearch, setSearchInput] = useDebouncedSearch('', 300, (text) => {
|
|
25
|
+
* console.log('搜索关键词:', text);
|
|
26
|
+
* });
|
|
27
|
+
* ```
|
|
28
28
|
*/
|
|
29
29
|
export function useDebouncedSearch(initialValue, delay, callback) {
|
|
30
30
|
// 实时值(用户输入)
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Select 状态管理 Hook
|
|
3
|
-
* 处理受控/非受控模式,适用于单选和多选
|
|
4
|
-
*/
|
|
5
|
-
import type { UseSelectStateOptions, UseMultipleSelectStateOptions, SelectState, MultipleSelectState } from '../types';
|
|
6
|
-
/**
|
|
7
|
-
* 单选状态管理 Hook
|
|
8
|
-
* @template T 值的类型
|
|
9
|
-
* @param options Hook 配置选项
|
|
10
|
-
* @returns 状态管理对象
|
|
11
|
-
*/
|
|
12
|
-
export declare function useSelectState<T = string | number>(options: UseSelectStateOptions<T>): SelectState<T>;
|
|
13
|
-
/**
|
|
14
|
-
* 多选状态管理 Hook
|
|
15
|
-
* @template T 值的类型
|
|
16
|
-
* @param options Hook 配置选项
|
|
17
|
-
* @returns 状态管理对象
|
|
18
|
-
*/
|
|
19
|
-
export declare function useMultipleSelectState<T = string | number>(options: UseMultipleSelectStateOptions<T>): MultipleSelectState<T>;
|
|
1
|
+
/**
|
|
2
|
+
* Select 状态管理 Hook
|
|
3
|
+
* 处理受控/非受控模式,适用于单选和多选
|
|
4
|
+
*/
|
|
5
|
+
import type { UseSelectStateOptions, UseMultipleSelectStateOptions, SelectState, MultipleSelectState } from '../types';
|
|
6
|
+
/**
|
|
7
|
+
* 单选状态管理 Hook
|
|
8
|
+
* @template T 值的类型
|
|
9
|
+
* @param options Hook 配置选项
|
|
10
|
+
* @returns 状态管理对象
|
|
11
|
+
*/
|
|
12
|
+
export declare function useSelectState<T = string | number>(options: UseSelectStateOptions<T>): SelectState<T>;
|
|
13
|
+
/**
|
|
14
|
+
* 多选状态管理 Hook
|
|
15
|
+
* @template T 值的类型
|
|
16
|
+
* @param options Hook 配置选项
|
|
17
|
+
* @returns 状态管理对象
|
|
18
|
+
*/
|
|
19
|
+
export declare function useMultipleSelectState<T = string | number>(options: UseMultipleSelectStateOptions<T>): MultipleSelectState<T>;
|
|
@@ -8,17 +8,17 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
8
8
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
9
9
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
10
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
11
|
-
/**
|
|
12
|
-
* Select 状态管理 Hook
|
|
13
|
-
* 处理受控/非受控模式,适用于单选和多选
|
|
11
|
+
/**
|
|
12
|
+
* Select 状态管理 Hook
|
|
13
|
+
* 处理受控/非受控模式,适用于单选和多选
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import { useState, useCallback } from 'react';
|
|
17
|
-
/**
|
|
18
|
-
* 单选状态管理 Hook
|
|
19
|
-
* @template T 值的类型
|
|
20
|
-
* @param options Hook 配置选项
|
|
21
|
-
* @returns 状态管理对象
|
|
17
|
+
/**
|
|
18
|
+
* 单选状态管理 Hook
|
|
19
|
+
* @template T 值的类型
|
|
20
|
+
* @param options Hook 配置选项
|
|
21
|
+
* @returns 状态管理对象
|
|
22
22
|
*/
|
|
23
23
|
export function useSelectState(options) {
|
|
24
24
|
var controlledValue = options.value,
|
|
@@ -57,11 +57,11 @@ export function useSelectState(options) {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
/**
|
|
61
|
-
* 多选状态管理 Hook
|
|
62
|
-
* @template T 值的类型
|
|
63
|
-
* @param options Hook 配置选项
|
|
64
|
-
* @returns 状态管理对象
|
|
60
|
+
/**
|
|
61
|
+
* 多选状态管理 Hook
|
|
62
|
+
* @template T 值的类型
|
|
63
|
+
* @param options Hook 配置选项
|
|
64
|
+
* @returns 状态管理对象
|
|
65
65
|
*/
|
|
66
66
|
export function useMultipleSelectState(options) {
|
|
67
67
|
var controlledValue = options.value,
|
package/es/select/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Select 组件相关工具和类型导出
|
|
3
|
-
* 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
|
|
4
|
-
*/
|
|
5
|
-
export type { SelectOption, FilterOptionFunc, SortDirection, SelectState, MultipleSelectState, TagDisplayInfo, UseSelectStateOptions, UseMultipleSelectStateOptions, BaseSelectProps, } from './types';
|
|
6
|
-
export { useSelectState, useMultipleSelectState } from './hooks/useSelectState';
|
|
7
|
-
export { useDebouncedSearch } from './hooks/useDebouncedSearch';
|
|
8
|
-
export { filterOptions, defaultFilterOption, sortOptions, calculateTagDisplay, findOptionByValue, findOptionsByValues, isOptionSelected, isOptionSelectedInMultiple, generateId, } from './utils';
|
|
1
|
+
/**
|
|
2
|
+
* Select 组件相关工具和类型导出
|
|
3
|
+
* 供 PisellSingleSelect、PisellMultipleSelect 等组件使用
|
|
4
|
+
*/
|
|
5
|
+
export type { SelectOption, FilterOptionFunc, SortDirection, SelectState, MultipleSelectState, TagDisplayInfo, UseSelectStateOptions, UseMultipleSelectStateOptions, BaseSelectProps, } from './types';
|
|
6
|
+
export { useSelectState, useMultipleSelectState } from './hooks/useSelectState';
|
|
7
|
+
export { useDebouncedSearch } from './hooks/useDebouncedSearch';
|
|
8
|
+
export { filterOptions, defaultFilterOption, sortOptions, calculateTagDisplay, findOptionByValue, findOptionsByValues, isOptionSelected, isOptionSelectedInMultiple, generateId, } from './utils';
|
package/es/select/index.js
CHANGED