@pisell/utils 1.0.70 → 1.0.72
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.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.js +15 -15
- package/es/jsBridge/regDeviceApi.d.ts +15 -15
- package/es/jsBridge/regDeviceApi.js +3 -3
- package/es/locales.js +15 -15
- package/es/log.d.ts +10 -10
- 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/image.d.ts +11 -11
- package/lib/index.d.ts +25 -25
- package/lib/jsBridge/regDeviceApi.d.ts +15 -15
- package/lib/log.d.ts +10 -10
- 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
- package/es/format.d.ts +0 -28
- package/es/jsBridge/index.d.ts +0 -22
- package/es/jsBridge/types.d.ts +0 -149
- package/es/locales.d.ts +0 -9
- package/es/miniRedux.d.ts +0 -16
- package/lib/format.d.ts +0 -28
- package/lib/jsBridge/index.d.ts +0 -22
- package/lib/jsBridge/types.d.ts +0 -149
- package/lib/locales.d.ts +0 -9
- package/lib/miniRedux.d.ts +0 -16
package/lib/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/lib/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';
|
|
@@ -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];
|
|
@@ -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>;
|
package/lib/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';
|