@pisell/utils 3.0.6 → 3.0.7
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/es/arrayUtils.d.ts +23 -26
- package/es/arrayUtils.js +157 -97
- package/es/common/index.d.ts +5 -0
- package/es/common/index.js +5 -0
- package/es/common/stateHelper.d.ts +2 -6
- package/es/common/stateHelper.js +24 -22
- package/es/common/types.d.ts +10 -13
- package/es/common/types.js +1 -0
- package/es/componentStorage.d.ts +25 -27
- package/es/componentStorage.js +130 -94
- package/es/constants/index.js +9 -7
- package/es/date.js +53 -36
- package/es/document.js +67 -43
- package/es/escPosPrinter/EscPosPrinter.js +490 -353
- package/es/escPosPrinter/index.d.ts +9 -9
- package/es/escPosPrinter/index.js +52 -37
- package/es/firebase/config/index.js +54 -0
- package/es/firebase/index.js +232 -0
- package/es/format.d.ts +15 -12
- package/es/format.js +156 -89
- package/es/image.js +60 -48
- package/es/index.d.ts +24 -39
- package/es/index.js +35 -40
- package/es/jsBridge/index.d.ts +4 -8
- package/es/jsBridge/index.js +55 -56
- package/es/jsBridge/regDeviceApi.js +126 -87
- package/es/jsBridge/types.d.ts +115 -95
- package/es/jsBridge/types.js +1 -0
- package/es/locales.d.ts +8 -11
- package/es/locales.js +96 -77
- package/es/log.d.ts +6 -11
- package/es/log.js +59 -37
- package/es/miniRedux.d.ts +13 -20
- package/es/miniRedux.js +76 -42
- package/es/number-input/hooks/index.d.ts +4 -0
- package/es/number-input/hooks/index.js +5 -0
- package/es/number-input/hooks/useNumberInputState.d.ts +2 -6
- package/es/number-input/hooks/useNumberInputState.js +128 -71
- package/es/number-input/index.d.ts +14 -0
- package/es/number-input/index.js +21 -0
- package/es/number-input/types.d.ts +88 -88
- package/es/number-input/types.js +1 -0
- package/es/number-input/utils/formatter.d.ts +10 -13
- package/es/number-input/utils/formatter.js +77 -51
- package/es/number-input/utils/index.d.ts +7 -0
- package/es/number-input/utils/index.js +8 -0
- package/es/number-input/utils/validation.d.ts +2 -7
- package/es/number-input/utils/validation.js +66 -51
- package/es/otherUtils.d.ts +9 -12
- package/es/otherUtils.js +129 -71
- package/es/platform.d.ts +9 -12
- package/es/platform.js +85 -61
- package/es/select/hooks/index.d.ts +5 -0
- package/es/select/hooks/index.js +6 -0
- package/es/select/hooks/useDebouncedSearch.d.ts +1 -4
- package/es/select/hooks/useDebouncedSearch.js +53 -39
- package/es/select/hooks/useSelectState.d.ts +7 -7
- package/es/select/hooks/useSelectState.js +113 -56
- package/es/select/index.d.ts +8 -7
- package/es/select/index.js +13 -0
- package/es/select/types.d.ts +211 -211
- package/es/select/types.js +1 -0
- package/es/select/utils/filterOptions.d.ts +6 -7
- package/es/select/utils/filterOptions.js +31 -26
- package/es/select/utils/helpers.d.ts +9 -10
- package/es/select/utils/helpers.js +52 -42
- package/es/select/utils/index.d.ts +7 -4
- package/es/select/utils/index.js +8 -0
- package/es/select/utils/sortOptions.d.ts +5 -6
- package/es/select/utils/sortOptions.js +31 -19
- package/es/select/utils/tagAggregation.d.ts +6 -6
- package/es/select/utils/tagAggregation.js +47 -34
- package/es/text-input/hooks/index.d.ts +4 -0
- package/es/text-input/hooks/index.js +5 -0
- package/es/text-input/hooks/useTextInputState.d.ts +2 -6
- package/es/text-input/hooks/useTextInputState.js +126 -69
- package/es/text-input/index.d.ts +14 -0
- package/es/text-input/index.js +20 -0
- package/es/text-input/types.d.ts +48 -48
- package/es/text-input/types.js +1 -0
- package/es/text-input/utils/index.d.ts +5 -0
- package/es/text-input/utils/index.js +7 -0
- package/es/text-input/utils/validation.d.ts +2 -7
- package/es/text-input/utils/validation.js +70 -50
- package/es/typeUtils.js +84 -61
- package/es/walletValidity.d.ts +42 -44
- package/es/walletValidity.js +557 -396
- package/es/weighing.d.ts +45 -48
- package/es/weighing.js +106 -83
- package/lib/arrayUtils.d.ts +23 -26
- package/lib/arrayUtils.js +111 -101
- package/lib/common/index.d.ts +5 -0
- package/lib/common/index.js +29 -0
- package/lib/common/stateHelper.d.ts +2 -6
- package/lib/common/stateHelper.js +32 -21
- package/lib/common/types.d.ts +10 -13
- package/lib/common/types.js +17 -0
- package/lib/componentStorage.d.ts +25 -27
- package/lib/componentStorage.js +126 -96
- package/lib/constants/index.js +36 -7
- package/lib/date.js +65 -43
- package/lib/document.js +62 -46
- package/lib/escPosPrinter/EscPosPrinter.js +403 -327
- package/lib/escPosPrinter/index.d.ts +9 -9
- package/lib/escPosPrinter/index.js +84 -38
- package/lib/firebase/config/index.js +79 -0
- package/lib/firebase/index.js +180 -0
- package/lib/format.d.ts +15 -12
- package/lib/format.js +133 -91
- package/lib/image.js +74 -48
- package/lib/index.d.ts +24 -39
- package/lib/index.js +80 -137
- package/lib/jsBridge/index.d.ts +4 -8
- package/lib/jsBridge/index.js +76 -57
- package/lib/jsBridge/regDeviceApi.js +133 -86
- package/lib/jsBridge/types.d.ts +115 -95
- package/lib/jsBridge/types.js +17 -0
- package/lib/locales.d.ts +8 -11
- package/lib/locales.js +90 -79
- package/lib/log.d.ts +6 -11
- package/lib/log.js +61 -37
- package/lib/miniRedux.d.ts +13 -20
- package/lib/miniRedux.js +89 -43
- package/lib/number-input/hooks/index.d.ts +4 -0
- package/lib/number-input/hooks/index.js +29 -0
- package/lib/number-input/hooks/useNumberInputState.d.ts +2 -6
- package/lib/number-input/hooks/useNumberInputState.js +81 -71
- package/lib/number-input/index.d.ts +14 -0
- package/lib/number-input/index.js +41 -0
- package/lib/number-input/types.d.ts +88 -88
- package/lib/number-input/types.js +17 -0
- package/lib/number-input/utils/formatter.d.ts +10 -13
- package/lib/number-input/utils/formatter.js +49 -52
- package/lib/number-input/utils/index.d.ts +7 -0
- package/lib/number-input/utils/index.js +39 -0
- package/lib/number-input/utils/validation.d.ts +2 -7
- package/lib/number-input/utils/validation.js +52 -50
- package/lib/otherUtils.d.ts +9 -12
- package/lib/otherUtils.js +98 -86
- package/lib/platform.d.ts +9 -12
- package/lib/platform.js +123 -68
- package/lib/select/hooks/index.d.ts +5 -0
- package/lib/select/hooks/index.js +34 -0
- package/lib/select/hooks/useDebouncedSearch.d.ts +1 -4
- package/lib/select/hooks/useDebouncedSearch.js +41 -40
- package/lib/select/hooks/useSelectState.d.ts +7 -7
- package/lib/select/hooks/useSelectState.js +93 -58
- package/lib/select/index.d.ts +8 -7
- package/lib/select/index.js +53 -0
- package/lib/select/types.d.ts +211 -211
- package/lib/select/types.js +17 -0
- package/lib/select/utils/filterOptions.d.ts +6 -7
- package/lib/select/utils/filterOptions.js +37 -26
- package/lib/select/utils/helpers.d.ts +9 -10
- package/lib/select/utils/helpers.js +41 -45
- package/lib/select/utils/index.d.ts +7 -4
- package/lib/select/utils/index.js +48 -0
- package/lib/select/utils/sortOptions.d.ts +5 -6
- package/lib/select/utils/sortOptions.js +39 -18
- package/lib/select/utils/tagAggregation.d.ts +6 -6
- package/lib/select/utils/tagAggregation.js +41 -33
- package/lib/text-input/hooks/index.d.ts +4 -0
- package/lib/text-input/hooks/index.js +29 -0
- package/lib/text-input/hooks/useTextInputState.d.ts +2 -6
- package/lib/text-input/hooks/useTextInputState.js +79 -69
- package/lib/text-input/index.d.ts +14 -0
- package/lib/text-input/index.js +35 -0
- package/lib/text-input/types.d.ts +48 -48
- package/lib/text-input/types.js +17 -0
- package/lib/text-input/utils/index.d.ts +5 -0
- package/lib/text-input/utils/index.js +32 -0
- package/lib/text-input/utils/validation.d.ts +2 -7
- package/lib/text-input/utils/validation.js +58 -49
- package/lib/typeUtils.js +73 -68
- package/lib/walletValidity.d.ts +42 -44
- package/lib/walletValidity.js +393 -410
- package/lib/weighing.d.ts +45 -48
- package/lib/weighing.js +149 -104
- package/package.json +1 -1
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
- package/es/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -11
- package/es/date.d.ts +0 -31
- package/es/document.d.ts +0 -16
- package/es/image.d.ts +0 -14
- package/es/typeUtils.d.ts +0 -45
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/asyncToGenerator.js +0 -27
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/defineProperty.js +0 -12
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/objectSpread2.js +0 -25
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPrimitive.js +0 -14
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/toPropertyKey.js +0 -9
- package/lib/_virtual/_@oxc-project_runtime@0.122.0/helpers/typeof.js +0 -16
- package/lib/_virtual/_rolldown/runtime.js +0 -23
- package/lib/date.d.ts +0 -31
- package/lib/document.d.ts +0 -16
- package/lib/image.d.ts +0 -14
- package/lib/typeUtils.d.ts +0 -45
|
@@ -1,52 +1,67 @@
|
|
|
1
|
-
//#region src/number-input/utils/validation.ts
|
|
2
1
|
/**
|
|
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
|
-
function validateValue(value, props) {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
|
|
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
|
+
*/
|
|
26
|
+
export function validateValue(value, props) {
|
|
27
|
+
var errors = [];
|
|
28
|
+
|
|
29
|
+
// 1. 必填校验
|
|
30
|
+
if (props.required && (value === null || value === undefined)) {
|
|
31
|
+
errors.push(props.errorMessage || '此字段为必填项');
|
|
32
|
+
return {
|
|
33
|
+
isValid: false,
|
|
34
|
+
errors: errors
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// 如果值为空且非必填,直接返回有效
|
|
39
|
+
if (value === null || value === undefined) {
|
|
40
|
+
return {
|
|
41
|
+
isValid: true,
|
|
42
|
+
errors: errors
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// 2. 最小值校验
|
|
47
|
+
if (props.min !== undefined && value < props.min) {
|
|
48
|
+
errors.push("\u4E0D\u80FD\u5C0F\u4E8E ".concat(props.min));
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// 3. 最大值校验
|
|
52
|
+
if (props.max !== undefined && value > props.max) {
|
|
53
|
+
errors.push("\u4E0D\u80FD\u5927\u4E8E ".concat(props.max));
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// 4. 自定义校验函数
|
|
57
|
+
if (props.validator) {
|
|
58
|
+
var result = props.validator(value);
|
|
59
|
+
if (result !== true) {
|
|
60
|
+
errors.push(typeof result === 'string' ? result : '校验失败');
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
return {
|
|
64
|
+
isValid: errors.length === 0,
|
|
65
|
+
errors: errors
|
|
66
|
+
};
|
|
67
|
+
}
|
package/es/otherUtils.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/otherUtils.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* @title: 判断是否无痕模式
|
|
4
3
|
* @description:
|
|
@@ -6,11 +5,11 @@
|
|
|
6
5
|
* @Author: shengjie.zuo
|
|
7
6
|
* @Date: 2024-09-4 09:58:22
|
|
8
7
|
*/
|
|
9
|
-
declare const detectIncognito: () => Promise<{
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export declare const detectIncognito: () => Promise<{
|
|
9
|
+
isPrivate: boolean;
|
|
10
|
+
browserName: string;
|
|
12
11
|
} | {
|
|
13
|
-
|
|
12
|
+
isPrivate: boolean;
|
|
14
13
|
}>;
|
|
15
14
|
/**
|
|
16
15
|
* @Description: 生成唯一id
|
|
@@ -19,7 +18,7 @@ declare const detectIncognito: () => Promise<{
|
|
|
19
18
|
* @param {*}
|
|
20
19
|
* @return {*}
|
|
21
20
|
*/
|
|
22
|
-
declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
|
|
21
|
+
export declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
|
|
23
22
|
/**
|
|
24
23
|
* @title: 对数组进行增|删
|
|
25
24
|
* @description: 用于多选选中和取消选中的处理
|
|
@@ -30,7 +29,7 @@ declare const getUniqueId: (prefix?: string, maxLength?: number) => string;
|
|
|
30
29
|
* @Author: zhiwei.Wang
|
|
31
30
|
* @Date: 2023-12-19 16:44
|
|
32
31
|
*/
|
|
33
|
-
declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
|
|
32
|
+
export declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) => T[];
|
|
34
33
|
/**
|
|
35
34
|
* @title: 判断某个字段是否在列表内
|
|
36
35
|
* @description:
|
|
@@ -40,12 +39,10 @@ declare const changeArray: <T>(list: T[] | undefined, item: T, key?: string) =>
|
|
|
40
39
|
* @Author: zhiwei.Wang
|
|
41
40
|
* @Date: 2023-12-19 16:54
|
|
42
41
|
*/
|
|
43
|
-
declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
|
|
44
|
-
declare const createArray: (length: number, returnItem: any) => unknown[];
|
|
42
|
+
export declare const getItemByArray: <T>(list: T[] | undefined, item: T, key?: string) => boolean;
|
|
43
|
+
export declare const createArray: (length: number, returnItem: any) => unknown[];
|
|
45
44
|
/**
|
|
46
45
|
* 根据对象内容生成唯一id
|
|
47
46
|
* @param obj
|
|
48
47
|
*/
|
|
49
|
-
declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
|
|
50
|
-
//#endregion
|
|
51
|
-
export { changeArray, createArray, detectIncognito, generateUniqueIdByObj, getItemByArray, getUniqueId };
|
|
48
|
+
export declare const generateUniqueIdByObj: (obj: Record<string, any>) => any;
|
package/es/otherUtils.js
CHANGED
|
@@ -1,83 +1,141 @@
|
|
|
1
|
-
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = "function" == typeof Symbol ? Symbol : {}, a = i.iterator || "@@iterator", c = i.asyncIterator || "@@asyncIterator", u = i.toStringTag || "@@toStringTag"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, ""); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, "_invoke", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } e.wrap = wrap; var h = "suspendedStart", l = "suspendedYield", f = "executing", s = "completed", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { ["next", "throw", "return"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if ("throw" !== c.type) { var u = c.arg, h = u.value; return h && "object" == _typeof(h) && n.call(h, "__await") ? e.resolve(h.__await).then(function (t) { invoke("next", t, i, a); }, function (t) { invoke("throw", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke("throw", t, i, a); }); } a(c.arg); } var r; o(this, "_invoke", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw new Error("Generator is already running"); if (o === s) { if ("throw" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if ("next" === n.method) n.sent = n._sent = n.arg;else if ("throw" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else "return" === n.method && n.abrupt("return", n.arg); o = f; var p = tryCatch(e, r, n); if ("normal" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } "throw" === p.type && (o = s, n.method = "throw", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, "throw" === n && e.iterator.return && (r.method = "return", r.arg = t, maybeInvokeDelegate(e, r), "throw" === r.method) || "return" !== n && (r.method = "throw", r.arg = new TypeError("The iterator does not provide a '" + n + "' method")), y; var i = tryCatch(o, e.iterator, r.arg); if ("throw" === i.type) return r.method = "throw", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, "return" !== r.method && (r.method = "next", r.arg = t), r.delegate = null, y) : a : (r.method = "throw", r.arg = new TypeError("iterator result is not an object"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || "" === e) { var r = e[a]; if (r) return r.call(e); if ("function" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + " is not iterable"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, "GeneratorFunction"), e.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || "GeneratorFunction" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, "GeneratorFunction")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, "Generator"), define(g, a, function () { return this; }), define(g, "toString", function () { return "[object Generator]"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = "next", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) "t" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = "throw", a.arg = e, r.next = n, o && (r.method = "next", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if ("root" === i.tryLoc) return handle("end"); if (i.tryLoc <= this.prev) { var c = n.call(i, "catchLoc"), u = n.call(i, "finallyLoc"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw new Error("try statement without catch or finally"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, "finallyLoc") && this.prev < o.finallyLoc) { var i = o; break; } } i && ("break" === t || "continue" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = "next", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, catch: function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, "next" === this.method && (this.arg = t), y; } }, e; }
|
|
3
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
4
|
+
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
5
|
+
// @ts-ignore
|
|
2
6
|
import md5 from "crypto-js/md5";
|
|
7
|
+
// @ts-ignore
|
|
3
8
|
import enc from "crypto-js/enc-hex";
|
|
4
|
-
import { detectIncognito } from "detectincognitojs";
|
|
5
|
-
|
|
9
|
+
import { detectIncognito as originDetectIncognito } from "detectincognitojs";
|
|
10
|
+
|
|
6
11
|
/**
|
|
7
|
-
* @title: 判断是否无痕模式
|
|
8
|
-
* @description:
|
|
9
|
-
* @return: *
|
|
10
|
-
* @Author: shengjie.zuo
|
|
11
|
-
* @Date: 2024-09-4 09:58:22
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
12
|
+
* @title: 判断是否无痕模式
|
|
13
|
+
* @description:
|
|
14
|
+
* @return: *
|
|
15
|
+
* @Author: shengjie.zuo
|
|
16
|
+
* @Date: 2024-09-4 09:58:22
|
|
17
|
+
*/
|
|
18
|
+
export var detectIncognito = /*#__PURE__*/function () {
|
|
19
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
20
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
21
|
+
while (1) switch (_context.prev = _context.next) {
|
|
22
|
+
case 0:
|
|
23
|
+
_context.prev = 0;
|
|
24
|
+
if (!navigator.userAgent.toLowerCase().includes('honor')) {
|
|
25
|
+
_context.next = 3;
|
|
26
|
+
break;
|
|
27
|
+
}
|
|
28
|
+
return _context.abrupt("return", {
|
|
29
|
+
isPrivate: false
|
|
30
|
+
});
|
|
31
|
+
case 3:
|
|
32
|
+
_context.next = 5;
|
|
33
|
+
return originDetectIncognito();
|
|
34
|
+
case 5:
|
|
35
|
+
return _context.abrupt("return", _context.sent);
|
|
36
|
+
case 8:
|
|
37
|
+
_context.prev = 8;
|
|
38
|
+
_context.t0 = _context["catch"](0);
|
|
39
|
+
// 当无法检测浏览器类型时,默认返回非隐私模式,确保支付流程可以继续
|
|
40
|
+
console.warn('detectIncognito failed:', _context.t0);
|
|
41
|
+
return _context.abrupt("return", {
|
|
42
|
+
isPrivate: false
|
|
43
|
+
});
|
|
44
|
+
case 12:
|
|
45
|
+
case "end":
|
|
46
|
+
return _context.stop();
|
|
47
|
+
}
|
|
48
|
+
}, _callee, null, [[0, 8]]);
|
|
49
|
+
}));
|
|
50
|
+
return function detectIncognito() {
|
|
51
|
+
return _ref.apply(this, arguments);
|
|
52
|
+
};
|
|
26
53
|
}();
|
|
54
|
+
|
|
27
55
|
/**
|
|
28
|
-
* @Description: 生成唯一id
|
|
29
|
-
* @Author: wzw
|
|
30
|
-
* @Date: 2020-12-01 14:20:29
|
|
31
|
-
* @param {*}
|
|
32
|
-
* @return {*}
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
|
|
56
|
+
* @Description: 生成唯一id
|
|
57
|
+
* @Author: wzw
|
|
58
|
+
* @Date: 2020-12-01 14:20:29
|
|
59
|
+
* @param {*}
|
|
60
|
+
* @return {*}
|
|
61
|
+
*/
|
|
62
|
+
export var getUniqueId = function getUniqueId() {
|
|
63
|
+
var prefix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
64
|
+
var maxLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 11;
|
|
65
|
+
return prefix + (Math.random() + '').replace(/\D/g, '').substring(0, maxLength);
|
|
36
66
|
};
|
|
67
|
+
|
|
37
68
|
/**
|
|
38
|
-
* @title: 对数组进行增|删
|
|
39
|
-
* @description: 用于多选选中和取消选中的处理
|
|
40
|
-
* @param {any} list
|
|
41
|
-
* @param {any} item
|
|
42
|
-
* @param {string} key
|
|
43
|
-
* @return {*}
|
|
44
|
-
* @Author: zhiwei.Wang
|
|
45
|
-
* @Date: 2023-12-19 16:44
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
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
|
+
*/
|
|
78
|
+
export var changeArray = function changeArray() {
|
|
79
|
+
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
80
|
+
var item = arguments.length > 1 ? arguments[1] : undefined;
|
|
81
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'this';
|
|
82
|
+
var _list = JSON.parse(JSON.stringify(list));
|
|
83
|
+
var isSome = false;
|
|
84
|
+
if (key === 'this') {
|
|
85
|
+
isSome = _list.includes(item);
|
|
86
|
+
} else {
|
|
87
|
+
//@ts-ignore
|
|
88
|
+
isSome = _list.some(function (d) {
|
|
89
|
+
return d[key] === item[key];
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
if (isSome) {
|
|
93
|
+
_list = _list.filter(function (d) {
|
|
94
|
+
if (key === 'this') {
|
|
95
|
+
return d !== item;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
//@ts-ignore
|
|
99
|
+
return d[key] !== item[key];
|
|
100
|
+
});
|
|
101
|
+
} else {
|
|
102
|
+
_list.push(item);
|
|
103
|
+
}
|
|
104
|
+
return _list;
|
|
58
105
|
};
|
|
106
|
+
|
|
59
107
|
/**
|
|
60
|
-
* @title: 判断某个字段是否在列表内
|
|
61
|
-
* @description:
|
|
62
|
-
* @param {*} T
|
|
63
|
-
* @param {boolean} param2
|
|
64
|
-
* @return {*}
|
|
65
|
-
* @Author: zhiwei.Wang
|
|
66
|
-
* @Date: 2023-12-19 16:54
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
+
*/
|
|
116
|
+
export var getItemByArray = function getItemByArray() {
|
|
117
|
+
var list = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
118
|
+
var item = arguments.length > 1 ? arguments[1] : undefined;
|
|
119
|
+
var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'this';
|
|
120
|
+
if (key === 'this') {
|
|
121
|
+
return list.includes(item);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
//@ts-ignore
|
|
125
|
+
return list.some(function (d) {
|
|
126
|
+
return d[key] === item[key];
|
|
127
|
+
});
|
|
71
128
|
};
|
|
72
|
-
|
|
73
|
-
|
|
129
|
+
export var createArray = function createArray(length, returnItem) {
|
|
130
|
+
return Array.from(new Array(length)).map(returnItem);
|
|
74
131
|
};
|
|
132
|
+
|
|
75
133
|
/**
|
|
76
|
-
* 根据对象内容生成唯一id
|
|
77
|
-
* @param obj
|
|
78
|
-
*/
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
134
|
+
* 根据对象内容生成唯一id
|
|
135
|
+
* @param obj
|
|
136
|
+
*/
|
|
137
|
+
export var generateUniqueIdByObj = function generateUniqueIdByObj(obj) {
|
|
138
|
+
var jsonString = JSON.stringify(obj);
|
|
139
|
+
var hash = md5(jsonString);
|
|
140
|
+
return hash.toString(enc.Hex);
|
|
141
|
+
};
|
package/es/platform.d.ts
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
declare const
|
|
3
|
-
declare const
|
|
4
|
-
declare const
|
|
5
|
-
declare const
|
|
6
|
-
declare const
|
|
7
|
-
declare const
|
|
8
|
-
declare const
|
|
9
|
-
declare const
|
|
10
|
-
declare const isSafari: () => boolean;
|
|
11
|
-
//#endregion
|
|
12
|
-
export { checkEnv, isAndroid, isIOS, isIos, isIpad, isMobile, isSafari, isWx, isWxApp };
|
|
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;
|
package/es/platform.js
CHANGED
|
@@ -1,69 +1,93 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
var isBrowser = typeof window != 'undefined' && window.document;
|
|
2
|
+
export var isIpad = function isIpad() {
|
|
3
|
+
var ua = navigator.userAgent;
|
|
4
|
+
var isSafari = ua.indexOf("Safari") != -1 && ua.indexOf("Version") != -1;
|
|
5
|
+
var isIphone = ua.indexOf("iPhone") != -1 && ua.indexOf("Version") != -1;
|
|
6
|
+
var isIPad = isSafari && !isIphone && "ontouchend" in document;
|
|
7
|
+
if (!/iphone|ios|ipad|android|mobile/i.test(navigator.userAgent.toLowerCase()) && !isIPad) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return true;
|
|
10
11
|
};
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
12
|
+
export var isMobile = function isMobile() {
|
|
13
|
+
var sUserAgent = window.navigator.userAgent.toLowerCase();
|
|
14
|
+
var bIsIpad = sUserAgent.match(/ipad/i) == "ipad";
|
|
15
|
+
var bIsIphoneOs = sUserAgent.match(/iphone os/i) == "iphone os";
|
|
16
|
+
var bIsMidp = sUserAgent.match(/midp/i) == "midp";
|
|
17
|
+
var bIsUc7 = sUserAgent.match(/rv:1.2.3.4/i) == "rv:1.2.3.4";
|
|
18
|
+
var bIsUc = sUserAgent.match(/ucweb/i) == "ucweb";
|
|
19
|
+
var bIsAndroid = sUserAgent.match(/android/i) == "android";
|
|
20
|
+
var bIsCE = sUserAgent.match(/windows ce/i) == "windows ce";
|
|
21
|
+
var bIsWM = sUserAgent.match(/windows mobile/i) == "windows mobile";
|
|
22
|
+
if (bIsIpad || bIsIphoneOs || bIsMidp || bIsUc7 || bIsUc || bIsAndroid || bIsCE || bIsWM || isIpad()) {
|
|
23
|
+
return true;
|
|
24
|
+
} else {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
23
27
|
};
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
|
|
29
|
+
// 是否是安卓平台
|
|
30
|
+
export var isAndroid = function isAndroid() {
|
|
31
|
+
return navigator.userAgent.toLowerCase().indexOf("android") !== -1;
|
|
26
32
|
};
|
|
27
|
-
|
|
28
|
-
|
|
33
|
+
|
|
34
|
+
// 是否是ios平台
|
|
35
|
+
export var isIos = function isIos() {
|
|
36
|
+
return /iphone|ipad|ipod/.test(navigator.userAgent.toLowerCase());
|
|
29
37
|
};
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
38
|
+
export var checkEnv = function checkEnv() {
|
|
39
|
+
// 0: 非浏览器环境
|
|
40
|
+
var env = 0;
|
|
41
|
+
var userAgent = window.navigator.userAgent;
|
|
42
|
+
var isOpera = userAgent.indexOf('Opera') > -1 || userAgent.indexOf('OPR') > -1; //判断是否Opera浏览器
|
|
43
|
+
var isIE = userAgent.indexOf('compatible') > -1 && userAgent.indexOf('MSIE') > -1; //判断是否IE7~IE10浏览器
|
|
44
|
+
var isIE11 = userAgent.indexOf('compatible') === -1 && userAgent.indexOf('Trident') > -1; //判断是否IE11浏览器
|
|
45
|
+
var isEdge = userAgent.indexOf('Edge') > -1; //判断是否IE的Edge浏览器
|
|
46
|
+
var isFF = userAgent.indexOf('Firefox') > -1; //判断是否Firefox浏览器
|
|
47
|
+
var isSafari = userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1; //判断是否Safari浏览器
|
|
48
|
+
var isChrome = userAgent.indexOf('Chrome') > -1 && userAgent.indexOf('; Win') > -1 && userAgent.indexOf('Safari') > -1; //判断Chrome浏览器
|
|
49
|
+
//常用浏览器
|
|
50
|
+
if (isOpera || isIE || isIE11 || isEdge || isFF || isSafari || isChrome) {
|
|
51
|
+
env = 0;
|
|
52
|
+
} else {
|
|
53
|
+
env = 1;
|
|
54
|
+
}
|
|
55
|
+
return env;
|
|
43
56
|
};
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
57
|
+
export var isWx = function isWx() {
|
|
58
|
+
if (isBrowser) {
|
|
59
|
+
var ua = '';
|
|
60
|
+
if (isBrowser) {
|
|
61
|
+
ua = window.navigator.userAgent.toLowerCase();
|
|
62
|
+
}
|
|
63
|
+
//@ts-ignore
|
|
64
|
+
if (ua.match(/MicroMessenger/i) == 'micromessenger') {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return false;
|
|
52
70
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
71
|
+
export var isIOS = function isIOS() {
|
|
72
|
+
if (isBrowser) {
|
|
73
|
+
var u = navigator.userAgent;
|
|
74
|
+
var isiOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/); //ios终端
|
|
75
|
+
return isiOS;
|
|
76
|
+
}
|
|
77
|
+
return false;
|
|
56
78
|
};
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
79
|
+
export var isWxApp = function isWxApp() {
|
|
80
|
+
if (isBrowser) {
|
|
81
|
+
var u = navigator.userAgent;
|
|
82
|
+
var isWxapp = u.indexOf('miniProgram') !== -1;
|
|
83
|
+
return isWxapp;
|
|
84
|
+
}
|
|
85
|
+
return false;
|
|
60
86
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
};
|
|
68
|
-
//#endregion
|
|
69
|
-
export { checkEnv, isAndroid, isIOS, isIos, isIpad, isMobile, isSafari, isWx, isWxApp };
|
|
87
|
+
export var isSafari = function isSafari() {
|
|
88
|
+
if (isBrowser) {
|
|
89
|
+
var userAgent = window.navigator.userAgent;
|
|
90
|
+
return userAgent.indexOf('Safari') > -1 && userAgent.indexOf('Chrome') === -1 && userAgent.indexOf('CriOS') === -1 && userAgent.indexOf('ChannelName/Feishu') === -1;
|
|
91
|
+
}
|
|
92
|
+
return false;
|
|
93
|
+
};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/select/hooks/useDebouncedSearch.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* 防抖搜索 Hook
|
|
4
3
|
* 对用户输入进行防抖处理,避免频繁触发搜索
|
|
@@ -18,6 +17,4 @@
|
|
|
18
17
|
* });
|
|
19
18
|
* ```
|
|
20
19
|
*/
|
|
21
|
-
declare function useDebouncedSearch<T = string>(initialValue: T, delay: number, callback?: (value: T) => void): [T, (value: T) => void];
|
|
22
|
-
//#endregion
|
|
23
|
-
export { useDebouncedSearch };
|
|
20
|
+
export declare function useDebouncedSearch<T = string>(initialValue: T, delay: number, callback?: (value: T) => void): [T, (value: T) => void];
|