@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.
Files changed (129) hide show
  1. package/README.md +2 -2
  2. package/es/arrayUtils.d.ts +1 -1
  3. package/es/common/index.d.ts +5 -5
  4. package/es/common/index.js +2 -2
  5. package/es/common/stateHelper.d.ts +18 -18
  6. package/es/common/stateHelper.js +15 -15
  7. package/es/common/types.d.ts +28 -28
  8. package/es/componentStorage.d.ts +36 -36
  9. package/es/componentStorage.js +7 -7
  10. package/es/constants/index.d.ts +7 -7
  11. package/es/date.d.ts +28 -28
  12. package/es/date.js +22 -22
  13. package/es/document.d.ts +13 -13
  14. package/es/document.js +7 -7
  15. package/es/escPosPrinter/index.d.ts +9 -9
  16. package/es/firebase/config/index.d.ts +13 -13
  17. package/es/firebase/index.d.ts +28 -28
  18. package/es/format.js +14 -14
  19. package/es/image.d.ts +11 -11
  20. package/es/image.js +5 -5
  21. package/es/index.d.ts +25 -25
  22. package/es/jsBridge/index.js +15 -15
  23. package/es/jsBridge/regDeviceApi.d.ts +15 -15
  24. package/es/jsBridge/regDeviceApi.js +3 -3
  25. package/es/locales.js +15 -15
  26. package/es/log.d.ts +10 -10
  27. package/es/number-input/hooks/index.d.ts +4 -4
  28. package/es/number-input/hooks/index.js +2 -2
  29. package/es/number-input/hooks/useNumberInputState.d.ts +25 -25
  30. package/es/number-input/hooks/useNumberInputState.js +39 -39
  31. package/es/number-input/index.d.ts +14 -14
  32. package/es/number-input/index.js +8 -8
  33. package/es/number-input/types.d.ts +96 -96
  34. package/es/number-input/utils/formatter.d.ts +53 -53
  35. package/es/number-input/utils/formatter.js +37 -37
  36. package/es/number-input/utils/index.d.ts +7 -7
  37. package/es/number-input/utils/index.js +2 -2
  38. package/es/number-input/utils/validation.d.ts +27 -27
  39. package/es/number-input/utils/validation.js +24 -24
  40. package/es/otherUtils.d.ts +48 -48
  41. package/es/otherUtils.js +32 -32
  42. package/es/platform.d.ts +9 -9
  43. package/es/select/hooks/index.d.ts +5 -5
  44. package/es/select/hooks/index.js +2 -2
  45. package/es/select/hooks/useDebouncedSearch.d.ts +20 -20
  46. package/es/select/hooks/useDebouncedSearch.js +17 -17
  47. package/es/select/hooks/useSelectState.d.ts +19 -19
  48. package/es/select/hooks/useSelectState.js +13 -13
  49. package/es/select/index.d.ts +8 -8
  50. package/es/select/index.js +3 -3
  51. package/es/select/types.d.ts +256 -256
  52. package/es/select/utils/filterOptions.d.ts +22 -22
  53. package/es/select/utils/filterOptions.js +16 -16
  54. package/es/select/utils/helpers.d.ts +42 -42
  55. package/es/select/utils/helpers.js +30 -30
  56. package/es/select/utils/index.d.ts +7 -7
  57. package/es/select/utils/index.js +2 -2
  58. package/es/select/utils/sortOptions.d.ts +12 -12
  59. package/es/select/utils/sortOptions.js +8 -8
  60. package/es/select/utils/tagAggregation.d.ts +25 -25
  61. package/es/select/utils/tagAggregation.js +21 -21
  62. package/es/text-input/hooks/index.d.ts +4 -4
  63. package/es/text-input/hooks/index.js +2 -2
  64. package/es/text-input/hooks/useTextInputState.d.ts +24 -24
  65. package/es/text-input/hooks/useTextInputState.js +38 -38
  66. package/es/text-input/index.d.ts +14 -14
  67. package/es/text-input/index.js +9 -9
  68. package/es/text-input/types.d.ts +56 -56
  69. package/es/text-input/utils/index.d.ts +5 -5
  70. package/es/text-input/utils/index.js +2 -2
  71. package/es/text-input/utils/validation.d.ts +23 -23
  72. package/es/text-input/utils/validation.js +20 -20
  73. package/es/typeUtils.d.ts +42 -42
  74. package/es/typeUtils.js +26 -26
  75. package/es/walletValidity.d.ts +44 -44
  76. package/es/walletValidity.js +85 -85
  77. package/lib/arrayUtils.d.ts +1 -1
  78. package/lib/common/index.d.ts +5 -5
  79. package/lib/common/stateHelper.d.ts +18 -18
  80. package/lib/common/types.d.ts +28 -28
  81. package/lib/componentStorage.d.ts +36 -36
  82. package/lib/constants/index.d.ts +7 -7
  83. package/lib/date.d.ts +28 -28
  84. package/lib/document.d.ts +13 -13
  85. package/lib/escPosPrinter/index.d.ts +9 -9
  86. package/lib/firebase/config/index.d.ts +13 -13
  87. package/lib/firebase/index.d.ts +28 -28
  88. package/lib/image.d.ts +11 -11
  89. package/lib/index.d.ts +25 -25
  90. package/lib/jsBridge/regDeviceApi.d.ts +15 -15
  91. package/lib/log.d.ts +10 -10
  92. package/lib/number-input/hooks/index.d.ts +4 -4
  93. package/lib/number-input/hooks/useNumberInputState.d.ts +25 -25
  94. package/lib/number-input/index.d.ts +14 -14
  95. package/lib/number-input/types.d.ts +96 -96
  96. package/lib/number-input/utils/formatter.d.ts +53 -53
  97. package/lib/number-input/utils/index.d.ts +7 -7
  98. package/lib/number-input/utils/validation.d.ts +27 -27
  99. package/lib/otherUtils.d.ts +48 -48
  100. package/lib/platform.d.ts +9 -9
  101. package/lib/select/hooks/index.d.ts +5 -5
  102. package/lib/select/hooks/useDebouncedSearch.d.ts +20 -20
  103. package/lib/select/hooks/useSelectState.d.ts +19 -19
  104. package/lib/select/index.d.ts +8 -8
  105. package/lib/select/types.d.ts +256 -256
  106. package/lib/select/utils/filterOptions.d.ts +22 -22
  107. package/lib/select/utils/helpers.d.ts +42 -42
  108. package/lib/select/utils/index.d.ts +7 -7
  109. package/lib/select/utils/sortOptions.d.ts +12 -12
  110. package/lib/select/utils/tagAggregation.d.ts +25 -25
  111. package/lib/text-input/hooks/index.d.ts +4 -4
  112. package/lib/text-input/hooks/useTextInputState.d.ts +24 -24
  113. package/lib/text-input/index.d.ts +14 -14
  114. package/lib/text-input/types.d.ts +56 -56
  115. package/lib/text-input/utils/index.d.ts +5 -5
  116. package/lib/text-input/utils/validation.d.ts +23 -23
  117. package/lib/typeUtils.d.ts +42 -42
  118. package/lib/walletValidity.d.ts +44 -44
  119. package/package.json +1 -1
  120. package/es/format.d.ts +0 -28
  121. package/es/jsBridge/index.d.ts +0 -22
  122. package/es/jsBridge/types.d.ts +0 -149
  123. package/es/locales.d.ts +0 -9
  124. package/es/miniRedux.d.ts +0 -16
  125. package/lib/format.d.ts +0 -28
  126. package/lib/jsBridge/index.d.ts +0 -22
  127. package/lib/jsBridge/types.d.ts +0 -149
  128. package/lib/locales.d.ts +0 -9
  129. package/lib/miniRedux.d.ts +0 -16
@@ -1,56 +1,56 @@
1
- /**
2
- * 文本输入组件公共类型定义
3
- * 供 PisellSingleLineText、PisellLongText、PisellPhone、PisellEmail、PisellUrl 等组件使用
4
- */
5
- export type { DisplayState, ValidationResult } from '../common';
6
- /**
7
- * 文本输入状态 Hook 返回值
8
- */
9
- export interface TextInputState {
10
- /**
11
- * 当前值
12
- */
13
- value: string | undefined;
14
- /**
15
- * 是否已被触摸(交互过)
16
- */
17
- isTouched: boolean;
18
- /**
19
- * 是否校验通过
20
- */
21
- isValid: boolean;
22
- /**
23
- * 错误信息数组
24
- */
25
- errors: string[];
26
- /**
27
- * 值变更处理函数
28
- */
29
- handleChange: (value: string) => void;
30
- /**
31
- * 失焦处理函数
32
- */
33
- handleBlur: () => void;
34
- /**
35
- * 聚焦处理函数
36
- */
37
- handleFocus: () => void;
38
- }
39
- /**
40
- * 基础文本输入 Props(供校验和状态管理使用)
41
- */
42
- export interface BaseTextInputProps {
43
- value?: string;
44
- defaultValue?: string;
45
- required?: boolean;
46
- minLength?: number;
47
- maxLength?: number;
48
- pattern?: string | RegExp;
49
- validator?: (value: string) => boolean | string;
50
- validateTrigger?: 'onChange' | 'onBlur' | 'both';
51
- errorMessage?: string;
52
- onChange?: (value: string) => void;
53
- onBlur?: (value: string) => void;
54
- onFocus?: () => void;
55
- onValidate?: (isValid: boolean, errors: string[]) => void;
56
- }
1
+ /**
2
+ * 文本输入组件公共类型定义
3
+ * 供 PisellSingleLineText、PisellLongText、PisellPhone、PisellEmail、PisellUrl 等组件使用
4
+ */
5
+ export type { DisplayState, ValidationResult } from '../common';
6
+ /**
7
+ * 文本输入状态 Hook 返回值
8
+ */
9
+ export interface TextInputState {
10
+ /**
11
+ * 当前值
12
+ */
13
+ value: string | undefined;
14
+ /**
15
+ * 是否已被触摸(交互过)
16
+ */
17
+ isTouched: boolean;
18
+ /**
19
+ * 是否校验通过
20
+ */
21
+ isValid: boolean;
22
+ /**
23
+ * 错误信息数组
24
+ */
25
+ errors: string[];
26
+ /**
27
+ * 值变更处理函数
28
+ */
29
+ handleChange: (value: string) => void;
30
+ /**
31
+ * 失焦处理函数
32
+ */
33
+ handleBlur: () => void;
34
+ /**
35
+ * 聚焦处理函数
36
+ */
37
+ handleFocus: () => void;
38
+ }
39
+ /**
40
+ * 基础文本输入 Props(供校验和状态管理使用)
41
+ */
42
+ export interface BaseTextInputProps {
43
+ value?: string;
44
+ defaultValue?: string;
45
+ required?: boolean;
46
+ minLength?: number;
47
+ maxLength?: number;
48
+ pattern?: string | RegExp;
49
+ validator?: (value: string) => boolean | string;
50
+ validateTrigger?: 'onChange' | 'onBlur' | 'both';
51
+ errorMessage?: string;
52
+ onChange?: (value: string) => void;
53
+ onBlur?: (value: string) => void;
54
+ onFocus?: () => void;
55
+ onValidate?: (isValid: boolean, errors: string[]) => void;
56
+ }
@@ -1,5 +1,5 @@
1
- /**
2
- * 文本输入工具函数导出
3
- */
4
- export { getDisplayState } from '../../common';
5
- export { validateValue } from './validation';
1
+ /**
2
+ * 文本输入工具函数导出
3
+ */
4
+ export { getDisplayState } from '../../common';
5
+ export { validateValue } from './validation';
@@ -1,5 +1,5 @@
1
- /**
2
- * 文本输入工具函数导出
1
+ /**
2
+ * 文本输入工具函数导出
3
3
  */
4
4
 
5
5
  // getDisplayState 已移到公共模块,从 common 重新导出
@@ -1,23 +1,23 @@
1
- import type { BaseTextInputProps, ValidationResult } from '../types';
2
- /**
3
- * 校验文本输入值
4
- *
5
- * 按照优先级执行校验规则:
6
- * 1. 必填校验(required)
7
- * 2. 最小长度校验(minLength)
8
- * 3. 最大长度校验(maxLength)
9
- * 4. 正则校验(pattern)
10
- * 5. 自定义校验函数(validator)
11
- *
12
- * @param value 待校验的值
13
- * @param props 校验配置
14
- * @returns 校验结果对象,包含 isValid 和 errors
15
- *
16
- * @example
17
- * validateValue('hello', { required: true, minLength: 3 })
18
- * // { isValid: true, errors: [] }
19
- *
20
- * validateValue('', { required: true })
21
- * // { isValid: false, errors: ['此字段为必填项'] }
22
- */
23
- export declare function validateValue(value: string, props: BaseTextInputProps): ValidationResult;
1
+ import type { BaseTextInputProps, ValidationResult } from '../types';
2
+ /**
3
+ * 校验文本输入值
4
+ *
5
+ * 按照优先级执行校验规则:
6
+ * 1. 必填校验(required)
7
+ * 2. 最小长度校验(minLength)
8
+ * 3. 最大长度校验(maxLength)
9
+ * 4. 正则校验(pattern)
10
+ * 5. 自定义校验函数(validator)
11
+ *
12
+ * @param value 待校验的值
13
+ * @param props 校验配置
14
+ * @returns 校验结果对象,包含 isValid 和 errors
15
+ *
16
+ * @example
17
+ * validateValue('hello', { required: true, minLength: 3 })
18
+ * // { isValid: true, errors: [] }
19
+ *
20
+ * validateValue('', { required: true })
21
+ * // { isValid: false, errors: ['此字段为必填项'] }
22
+ */
23
+ export declare function validateValue(value: string, props: BaseTextInputProps): ValidationResult;
@@ -1,23 +1,23 @@
1
- /**
2
- * 校验文本输入值
3
- *
4
- * 按照优先级执行校验规则:
5
- * 1. 必填校验(required)
6
- * 2. 最小长度校验(minLength)
7
- * 3. 最大长度校验(maxLength)
8
- * 4. 正则校验(pattern)
9
- * 5. 自定义校验函数(validator)
10
- *
11
- * @param value 待校验的值
12
- * @param props 校验配置
13
- * @returns 校验结果对象,包含 isValid 和 errors
14
- *
15
- * @example
16
- * validateValue('hello', { required: true, minLength: 3 })
17
- * // { isValid: true, errors: [] }
18
- *
19
- * validateValue('', { required: true })
20
- * // { isValid: false, errors: ['此字段为必填项'] }
1
+ /**
2
+ * 校验文本输入值
3
+ *
4
+ * 按照优先级执行校验规则:
5
+ * 1. 必填校验(required)
6
+ * 2. 最小长度校验(minLength)
7
+ * 3. 最大长度校验(maxLength)
8
+ * 4. 正则校验(pattern)
9
+ * 5. 自定义校验函数(validator)
10
+ *
11
+ * @param value 待校验的值
12
+ * @param props 校验配置
13
+ * @returns 校验结果对象,包含 isValid 和 errors
14
+ *
15
+ * @example
16
+ * validateValue('hello', { required: true, minLength: 3 })
17
+ * // { isValid: true, errors: [] }
18
+ *
19
+ * validateValue('', { required: true })
20
+ * // { isValid: false, errors: ['此字段为必填项'] }
21
21
  */
22
22
  export function validateValue(value, props) {
23
23
  var errors = [];
package/es/typeUtils.d.ts CHANGED
@@ -1,42 +1,42 @@
1
- /**
2
- * 判断是否是函数
3
- * @param obj
4
- */
5
- export declare const isFunction: (obj: any) => obj is Function;
6
- /**
7
- * 判断是否是数组
8
- * @param obj
9
- */
10
- export declare const isArr: (obj: any) => obj is any[];
11
- /**
12
- * 判断是否是字符串
13
- * @param obj
14
- */
15
- export declare const isString: (obj: any) => obj is string;
16
- /**
17
- * 判断是否是数字
18
- * @param obj
19
- */
20
- export declare const isNumber: (obj: any) => obj is number;
21
- /**
22
- * 判断是否是undefined
23
- * @param obj
24
- */
25
- export declare const isUndefined: (obj: any) => obj is undefined;
26
- /**
27
- * 判断是否是boolean
28
- * @param obj
29
- */
30
- export declare const isBoolean: (obj: any) => obj is boolean;
31
- /**
32
- * 判断是否是json字符串
33
- * @param v
34
- */
35
- export declare const isJson: (v: any) => boolean;
36
- /**
37
- * @Title: 判断是否为对象
38
- * @Describe:
39
- * @Author: Wzw
40
- * @param {any} obj
41
- */
42
- export declare const isPlainObject: (obj: any) => boolean;
1
+ /**
2
+ * 判断是否是函数
3
+ * @param obj
4
+ */
5
+ export declare const isFunction: (obj: any) => obj is Function;
6
+ /**
7
+ * 判断是否是数组
8
+ * @param obj
9
+ */
10
+ export declare const isArr: (obj: any) => obj is any[];
11
+ /**
12
+ * 判断是否是字符串
13
+ * @param obj
14
+ */
15
+ export declare const isString: (obj: any) => obj is string;
16
+ /**
17
+ * 判断是否是数字
18
+ * @param obj
19
+ */
20
+ export declare const isNumber: (obj: any) => obj is number;
21
+ /**
22
+ * 判断是否是undefined
23
+ * @param obj
24
+ */
25
+ export declare const isUndefined: (obj: any) => obj is undefined;
26
+ /**
27
+ * 判断是否是boolean
28
+ * @param obj
29
+ */
30
+ export declare const isBoolean: (obj: any) => obj is boolean;
31
+ /**
32
+ * 判断是否是json字符串
33
+ * @param v
34
+ */
35
+ export declare const isJson: (v: any) => boolean;
36
+ /**
37
+ * @Title: 判断是否为对象
38
+ * @Describe:
39
+ * @Author: Wzw
40
+ * @param {any} obj
41
+ */
42
+ export declare const isPlainObject: (obj: any) => boolean;
package/es/typeUtils.js CHANGED
@@ -1,54 +1,54 @@
1
- /**
2
- * 判断是否是函数
3
- * @param obj
1
+ /**
2
+ * 判断是否是函数
3
+ * @param obj
4
4
  */
5
5
  export var isFunction = function isFunction(obj) {
6
6
  return typeof obj === 'function';
7
7
  };
8
8
 
9
- /**
10
- * 判断是否是数组
11
- * @param obj
9
+ /**
10
+ * 判断是否是数组
11
+ * @param obj
12
12
  */
13
13
  export var isArr = function isArr(obj) {
14
14
  return Array.isArray(obj);
15
15
  };
16
16
 
17
- /**
18
- * 判断是否是字符串
19
- * @param obj
17
+ /**
18
+ * 判断是否是字符串
19
+ * @param obj
20
20
  */
21
21
  export var isString = function isString(obj) {
22
22
  return typeof obj === 'string';
23
23
  };
24
24
 
25
- /**
26
- * 判断是否是数字
27
- * @param obj
25
+ /**
26
+ * 判断是否是数字
27
+ * @param obj
28
28
  */
29
29
  export var isNumber = function isNumber(obj) {
30
30
  return typeof obj === 'number';
31
31
  };
32
32
 
33
- /**
34
- * 判断是否是undefined
35
- * @param obj
33
+ /**
34
+ * 判断是否是undefined
35
+ * @param obj
36
36
  */
37
37
  export var isUndefined = function isUndefined(obj) {
38
38
  return typeof obj === 'undefined';
39
39
  };
40
40
 
41
- /**
42
- * 判断是否是boolean
43
- * @param obj
41
+ /**
42
+ * 判断是否是boolean
43
+ * @param obj
44
44
  */
45
45
  export var isBoolean = function isBoolean(obj) {
46
46
  return typeof obj === 'boolean';
47
47
  };
48
48
 
49
- /**
50
- * 判断是否是json字符串
51
- * @param v
49
+ /**
50
+ * 判断是否是json字符串
51
+ * @param v
52
52
  */
53
53
  export var isJson = function isJson(v) {
54
54
  if (typeof v === 'string') {
@@ -66,11 +66,11 @@ var hasOwn = {}.hasOwnProperty;
66
66
  var fnToString = hasOwn.toString;
67
67
  var ObjectFunctionString = fnToString.call(Object);
68
68
 
69
- /**
70
- * @Title: 判断是否为对象
71
- * @Describe:
72
- * @Author: Wzw
73
- * @param {any} obj
69
+ /**
70
+ * @Title: 判断是否为对象
71
+ * @Describe:
72
+ * @Author: Wzw
73
+ * @param {any} obj
74
74
  */
75
75
  export var isPlainObject = function isPlainObject(obj) {
76
76
  var proto, Ctor;
@@ -1,44 +1,44 @@
1
- export declare type Locale = 'en' | 'zh-CN' | 'zh-HK';
2
- interface ScheduleItem {
3
- id: number;
4
- name: string | {
5
- [key: string]: string;
6
- };
7
- type: 'standard' | 'time-slots' | 'designation';
8
- start_time: string | null;
9
- end_time: string | null;
10
- repeat_type: 'none' | 'daily' | 'weekly' | 'monthly' | 'yearly';
11
- repeat_rule: {
12
- end: {
13
- type: 'never' | 'date' | 'occurrence';
14
- end_date: string | null;
15
- occurrence: number | null;
16
- };
17
- frequency: number;
18
- excluded_date: Array<{
19
- start: string;
20
- end: string;
21
- }>;
22
- included_date: any[];
23
- frequency_date: number[];
24
- } | null;
25
- designation: Array<{
26
- start_date: string;
27
- start_time: string;
28
- end_date: string;
29
- end_time: string;
30
- }> | null;
31
- is_all: number;
32
- time_slot: Array<{
33
- start_time: string;
34
- end_time: string;
35
- }>;
36
- }
37
- /**
38
- * 获取schedule摘要信息
39
- * @param scheduleList 日程列表
40
- * @param locale 语言设置
41
- * @returns 摘要文本
42
- */
43
- export declare function getScheduleSummary(scheduleList: ScheduleItem[], locale?: Locale): string;
44
- export {};
1
+ export declare type Locale = 'en' | 'zh-CN' | 'zh-HK';
2
+ interface ScheduleItem {
3
+ id: number;
4
+ name: string | {
5
+ [key: string]: string;
6
+ };
7
+ type: 'standard' | 'time-slots' | 'designation';
8
+ start_time: string | null;
9
+ end_time: string | null;
10
+ repeat_type: 'none' | 'daily' | 'weekly' | 'monthly' | 'yearly';
11
+ repeat_rule: {
12
+ end: {
13
+ type: 'never' | 'date' | 'occurrence';
14
+ end_date: string | null;
15
+ occurrence: number | null;
16
+ };
17
+ frequency: number;
18
+ excluded_date: Array<{
19
+ start: string;
20
+ end: string;
21
+ }>;
22
+ included_date: any[];
23
+ frequency_date: number[];
24
+ } | null;
25
+ designation: Array<{
26
+ start_date: string;
27
+ start_time: string;
28
+ end_date: string;
29
+ end_time: string;
30
+ }> | null;
31
+ is_all: number;
32
+ time_slot: Array<{
33
+ start_time: string;
34
+ end_time: string;
35
+ }>;
36
+ }
37
+ /**
38
+ * 获取schedule摘要信息
39
+ * @param scheduleList 日程列表
40
+ * @param locale 语言设置
41
+ * @returns 摘要文本
42
+ */
43
+ export declare function getScheduleSummary(scheduleList: ScheduleItem[], locale?: Locale): string;
44
+ export {};