@opentiny/utils 1.0.0 → 3.23.0

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 (92) hide show
  1. package/README.md +5 -1
  2. package/dist/after-leave/__tests__/index.test.d.ts +1 -0
  3. package/dist/after-leave/index.d.ts +25 -0
  4. package/dist/array/__tests__/index.test.d.ts +1 -0
  5. package/dist/array/index.d.ts +118 -0
  6. package/dist/bigInt/__tests__/index.test.d.ts +1 -0
  7. package/dist/bigInt/index.d.ts +249 -0
  8. package/dist/calendar/__test__/index.test.d.ts +1 -0
  9. package/dist/calendar/index.d.ts +96 -0
  10. package/dist/common/__tests__/index.test.d.ts +1 -0
  11. package/dist/common/index.d.ts +74 -0
  12. package/dist/crypt/__tests__/crypt.test.d.ts +1 -0
  13. package/dist/crypt/index.d.ts +5 -0
  14. package/dist/dataset/index.d.ts +102 -0
  15. package/dist/date/__test__/index.test.d.ts +1 -0
  16. package/dist/date/index.d.ts +95 -0
  17. package/dist/date-util/fecha.d.ts +14 -0
  18. package/dist/date-util/index.d.ts +50 -0
  19. package/dist/debounce/__tests__/debounce.test.d.ts +12 -0
  20. package/dist/debounce/index.d.ts +26 -0
  21. package/dist/decimal/__tests__/index.test.d.ts +1 -0
  22. package/dist/decimal/index.d.ts +92 -0
  23. package/dist/dom/index.d.ts +159 -0
  24. package/dist/espace-ctrl/index.d.ts +2 -0
  25. package/dist/event/index.d.ts +38 -0
  26. package/dist/fastdom/async.d.ts +12 -0
  27. package/dist/fastdom/index.d.ts +4 -0
  28. package/dist/fastdom/sandbox.d.ts +12 -0
  29. package/dist/fastdom/singleton.d.ts +10 -0
  30. package/dist/fecha/index.d.ts +13 -0
  31. package/dist/form/index.d.ts +5 -0
  32. package/dist/fullscreen/apis.d.ts +21 -0
  33. package/dist/fullscreen/index.d.ts +3 -0
  34. package/dist/fullscreen/screenfull.d.ts +35 -0
  35. package/dist/function/index.d.ts +7 -0
  36. package/dist/globalConfig/index.d.ts +20 -0
  37. package/dist/index.d.ts +43 -0
  38. package/dist/index.es.js +5351 -0
  39. package/dist/logger/index.d.ts +3 -0
  40. package/dist/memorize/index.d.ts +22 -0
  41. package/dist/nanoid/index.d.ts +11 -0
  42. package/dist/nanoid/nanoid.d.ts +4 -0
  43. package/dist/object/index.d.ts +137 -0
  44. package/dist/popup-manager/index.d.ts +42 -0
  45. package/dist/resize-event/index.d.ts +13 -0
  46. package/dist/resize-observer/index.d.ts +13 -0
  47. package/dist/scroll-into-view/index.d.ts +12 -0
  48. package/dist/scroll-width/index.d.ts +12 -0
  49. package/dist/string/index.d.ts +376 -0
  50. package/dist/throttle/index.d.ts +35 -0
  51. package/dist/touch/index.d.ts +15 -0
  52. package/dist/touch-emulator/index.d.ts +1 -0
  53. package/dist/tree-model/index.d.ts +3 -0
  54. package/dist/tree-model/node.d.ts +58 -0
  55. package/dist/tree-model/tree-store.d.ts +72 -0
  56. package/dist/tree-model/util.d.ts +14 -0
  57. package/dist/type/__tests__/type.test.d.ts +1 -0
  58. package/dist/type/index.d.ts +212 -0
  59. package/dist/upload-ajax/index.d.ts +12 -0
  60. package/dist/validate/__test__/util.test.d.ts +1 -0
  61. package/dist/validate/index.d.ts +2 -0
  62. package/dist/validate/messages.d.ts +73 -0
  63. package/dist/validate/rules/enum.d.ts +12 -0
  64. package/dist/validate/rules/index.d.ts +15 -0
  65. package/dist/validate/rules/pattern.d.ts +12 -0
  66. package/dist/validate/rules/range.d.ts +1 -0
  67. package/dist/validate/rules/required.d.ts +21 -0
  68. package/dist/validate/rules/type.d.ts +12 -0
  69. package/dist/validate/rules/whitespace.d.ts +12 -0
  70. package/dist/validate/schema.d.ts +22 -0
  71. package/dist/validate/util.d.ts +80 -0
  72. package/dist/validate/validations/__test__/date.test.d.ts +12 -0
  73. package/dist/validate/validations/__test__/integer.test.d.ts +12 -0
  74. package/dist/validate/validations/__test__/number.test.d.ts +12 -0
  75. package/dist/validate/validations/__test__/pattern.test.d.ts +1 -0
  76. package/dist/validate/validations/__test__/required.test.d.ts +1 -0
  77. package/dist/validate/validations/array.d.ts +30 -0
  78. package/dist/validate/validations/date.d.ts +29 -0
  79. package/dist/validate/validations/enum.d.ts +30 -0
  80. package/dist/validate/validations/float.d.ts +29 -0
  81. package/dist/validate/validations/index.d.ts +43 -0
  82. package/dist/validate/validations/integer.d.ts +34 -0
  83. package/dist/validate/validations/method.d.ts +33 -0
  84. package/dist/validate/validations/number.d.ts +30 -0
  85. package/dist/validate/validations/pattern.d.ts +31 -0
  86. package/dist/validate/validations/required.d.ts +24 -0
  87. package/dist/validate/validations/string.d.ts +32 -0
  88. package/dist/validate/validations/type.d.ts +28 -0
  89. package/dist/xss/__tests__/xss.test.d.ts +1 -0
  90. package/dist/xss/index.d.ts +16 -0
  91. package/package.json +11 -6
  92. package/dist/opentiny-utils.es.js +0 -1011
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ /**
13
+ * Throttle execution of a function. Especially useful for rate limiting
14
+ * execution of handlers on events like resize and scroll.
15
+ *
16
+ * @param {Number} delay A zero-or-greater delay in milliseconds. For event callbacks,
17
+ * values around 100 or 250 (or even higher) are most useful.
18
+ * @param {Boolean} [noTrailing] Optional, defaults to false. If noTrailing is true,
19
+ * callback will only execute every `delay` milliseconds while the
20
+ * throttled-function is being called. If noTrailing is false or unspecified,
21
+ * callback will be executed one final time
22
+ * after the last throttled-function call.
23
+ * (After the throttled-function has not been called for `delay` milliseconds,
24
+ * the internal counter is reset)
25
+ * @param {Function} callback A function to be executed after delay milliseconds.
26
+ * The `this` context and all arguments are passed through, as-is,
27
+ * to `callback` when the throttled-function is executed.
28
+ * @param {Boolean} [debounceMode] If `debounceMode` is true (at begin),
29
+ * schedule `clear` to execute after `delay` ms.
30
+ * If `debounceMode` is false (at end),
31
+ * schedule `callback` to execute after `delay` ms.
32
+ *
33
+ * @return {Function} A new, throttled, function.
34
+ */
35
+ export declare function throttle(delay: any, noTrailing: any, callback: any, debounceMode?: string): Function;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export declare const getDirection: (x: any, y: any) => "" | "horizontal" | "vertical";
13
+ export declare const touchStart: (state: any) => (event: any) => void;
14
+ export declare const touchMove: (state: any) => (event: any) => void;
15
+ export declare const resetTouchStatus: (state: any) => void;
@@ -0,0 +1 @@
1
+ export declare const emulate: () => void;
@@ -0,0 +1,3 @@
1
+ export { NODE_KEY, getNodeKey, markNodeData } from './util';
2
+ export { getChildState, Node } from './node';
3
+ export { TreeStore } from './tree-store';
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export declare const getChildState: (node: any) => {
13
+ all: boolean;
14
+ none: boolean;
15
+ allWithoutDisable: boolean;
16
+ half: boolean;
17
+ };
18
+ export declare class Node {
19
+ constructor(options: any);
20
+ initExpandState(): void;
21
+ init(options: any): void;
22
+ expandByDefaultKeys(): void;
23
+ setData(data: any): void;
24
+ get key(): any;
25
+ get label(): any;
26
+ get disabled(): any;
27
+ get nextSibling(): any;
28
+ get previousSibling(): any;
29
+ remove(): void;
30
+ contains(target: any, deep?: boolean): boolean;
31
+ insertChild(child: any, index?: any, batch?: any): any;
32
+ insertBefore(child: any, beforeNode: any): void;
33
+ insertAfter(child: any, afterNode: any): void;
34
+ removeChild(child: any): void;
35
+ removeChildByData(data: any): void;
36
+ expand(callback: any, expandParent: any): void;
37
+ doCreateChildren(array: any, defaultProps?: {}): void;
38
+ collapse(): void;
39
+ shouldLoadData(): any;
40
+ updateLeafState(): void;
41
+ getChildren(forceInit?: boolean): any;
42
+ setChecked(value: any, isDeepChecked: any, recursion: any, passValue: any, checkEasily: any): void;
43
+ setCheckedInner({ checkDescendants, value, isDeepChecked, passValue, checkEasily }: {
44
+ checkDescendants: any;
45
+ value: any;
46
+ isDeepChecked: any;
47
+ passValue: any;
48
+ checkEasily: any;
49
+ }): {
50
+ value: any;
51
+ passValue: any;
52
+ returnFlag: boolean;
53
+ };
54
+ updateChildren(): void;
55
+ loadData(callback: any, defaultProps?: {}): void;
56
+ getPathData(key: any): any[];
57
+ getPathText(key: any, separator?: string): string;
58
+ }
@@ -0,0 +1,72 @@
1
+ import { Node } from './node';
2
+ interface TreeStoreOptions {
3
+ data: any;
4
+ key?: string;
5
+ props?: Record<string, any>;
6
+ load?: (node: Node, callback: (data: any) => void) => void;
7
+ lazy?: boolean;
8
+ checkStrictly?: boolean;
9
+ defaultCheckedKeys?: any[];
10
+ defaultExpandedKeys?: any[];
11
+ autoExpandParent?: boolean;
12
+ afterLoad?: (params: {
13
+ data: any;
14
+ init: boolean;
15
+ }) => void;
16
+ filterNodeMethod?: (value: any, data: any, node: Node) => boolean;
17
+ [key: string]: any;
18
+ }
19
+ type NodeType = any;
20
+ type FilterNodeMethodType = (value: any, data: any, node: NodeType) => boolean;
21
+ export declare class TreeStore {
22
+ currentNode: NodeType | null;
23
+ currentNodeKey: any;
24
+ nodesMap: Record<string, NodeType>;
25
+ root: NodeType;
26
+ data: any;
27
+ lazy: boolean;
28
+ load?: (node: NodeType, callback: (data: any) => void) => void;
29
+ afterLoad?: (params: {
30
+ data: any;
31
+ init: boolean;
32
+ }) => void;
33
+ props: Record<string, any>;
34
+ filterNodeMethod?: FilterNodeMethodType;
35
+ key: string;
36
+ defaultCheckedKeys: any[];
37
+ checkStrictly: boolean;
38
+ defaultExpandedKeys: any[];
39
+ autoExpandParent: boolean;
40
+ constructor(options: TreeStoreOptions);
41
+ getMappingData(data: any): any;
42
+ filter(value: any): void;
43
+ setData(newVal: any): void;
44
+ getNode(data: any): NodeType | null;
45
+ insertBefore(data: any, insertData: any): void;
46
+ insertAfter(data: any, insertData: any): void;
47
+ remove(data: any, isSaveChildNode?: boolean, isNode?: boolean): void;
48
+ append(data: any, parentData?: any, index?: number): void;
49
+ setDefaultCheckedKey(newValue: any[]): void;
50
+ _initDefaultCheckedNodes(): void;
51
+ _initDefaultCheckedNode(node: NodeType): void;
52
+ getCheckedKeys(leafOnly?: boolean): any[];
53
+ getHalfCheckedKeys(): any[];
54
+ deregisterNode(node: NodeType): void;
55
+ registerNode(node: NodeType): void;
56
+ getCheckedNodes(leafOnly?: boolean, includeHalfChecked?: boolean, isNode?: boolean): any[];
57
+ getHalfCheckedNodes(): any[];
58
+ _getAllNodes(): NodeType[];
59
+ updateChildren(key: string, data: any[]): void;
60
+ _setCheckedKeys(key: string, leafOnly?: boolean, checkedKeys?: {}): void;
61
+ setDefaultExpandedKeys(keys: any[]): void;
62
+ setCheckedKeys(keys: any[], leafOnly?: boolean): void;
63
+ setCheckedNodes(array: any[], leafOnly?: boolean): void;
64
+ setChecked(data: any, checked: boolean, deep: boolean): void;
65
+ setCurrentNode(currentNode: NodeType): void;
66
+ getCurrentNode(): any;
67
+ setCurrentNodeKey(key: any): void;
68
+ setUserCurrentNode(node: any): void;
69
+ getData(data: any): any;
70
+ getAllData(): any;
71
+ }
72
+ export {};
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export declare const NODE_KEY = "$treeNodeId";
13
+ export declare const getNodeKey: (key: any, data: any) => any;
14
+ export declare const markNodeData: (node: any, data: any) => void;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,212 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ /**
13
+ * 获取对象的字符串表示形式
14
+ * 用于类型判断,等同于 Object.prototype.toString
15
+ */
16
+ export declare const toString: () => string;
17
+ /**
18
+ * 检查对象是否具有指定的属性
19
+ * 等同于 Object.prototype.hasOwnProperty
20
+ */
21
+ export declare const hasOwn: (prop: PropertyKey) => boolean;
22
+ /**
23
+ * 判断值是否为 null 或 undefined
24
+ *
25
+ * @param {any} x - 要检查的值
26
+ * @returns {boolean} - 如果值为null或undefined则返回true,否则返回false
27
+ *
28
+ * @example
29
+ * isNull(null) // true
30
+ * isNull(undefined) // true
31
+ * isNull(0) // false
32
+ * isNull('') // false
33
+ */
34
+ export declare const isNull: (x: any) => boolean;
35
+ /**
36
+ * 返回 JavaScript 对象的类型。
37
+ *
38
+ * 如果对象是 undefined 或 null,则返回相应的'undefined'或'null'。
39
+ * 其他一切都将返回它的类型字符串表示。
40
+ *
41
+ * @param {any} obj - 要检查类型的对象
42
+ * @returns {string} - 类型的字符串表示
43
+ *
44
+ * @example
45
+ * typeOf(undefined) // 'undefined'
46
+ * typeOf(null) // 'null'
47
+ * typeOf(true) // 'boolean'
48
+ * typeOf(3) // 'number'
49
+ * typeOf("test") // 'string'
50
+ * typeOf(function(){}) // 'function'
51
+ * typeOf([]) // 'array'
52
+ * typeOf(new Date()) // 'date'
53
+ * typeOf(new Error()) // 'error'
54
+ * typeOf(/test/) // 'regExp'
55
+ * typeOf({}) // 'object'
56
+ */
57
+ export declare const typeOf: (obj: any) => string;
58
+ /**
59
+ * 判断对象是否为纯粹的对象类型(通过{}或new Object创建的对象)
60
+ *
61
+ * @param {any} obj - 要检查的对象
62
+ * @returns {boolean} - 如果是纯粹的对象类型则返回true,否则返回false
63
+ *
64
+ * @example
65
+ * isObject({}) // true
66
+ * isObject(new Object()) // true
67
+ * isObject([]) // false
68
+ * isObject(null) // false
69
+ */
70
+ export declare const isObject: (obj: any) => boolean;
71
+ /**
72
+ * 判断对象是否为函数类型(包括普通函数和异步函数)
73
+ *
74
+ * @param {any} fn - 要检查的对象
75
+ * @returns {boolean} - 如果是函数类型则返回true,否则返回false
76
+ *
77
+ * @example
78
+ * isFunction(function(){}) // true
79
+ * isFunction(async function(){}) // true
80
+ * isFunction(() => {}) // true
81
+ * isFunction({}) // false
82
+ */
83
+ export declare const isFunction: (fn: any) => boolean;
84
+ /**
85
+ * 判断对象是否为简单对象(纯粹的对象)
86
+ *
87
+ * 即不是 HTML 节点对象,也不是 window 对象,而是纯粹的对象
88
+ * (通过 '{}' 或者 'new Object' 创建的,或者原型为null的对象)
89
+ *
90
+ * @param {any} obj - 要检查的对象
91
+ * @returns {boolean} - 如果是简单对象则返回true,否则返回false
92
+ *
93
+ * @example
94
+ * isPlainObject({}) // true
95
+ * isPlainObject(new Object()) // true
96
+ * isPlainObject(Object.create(null)) // true
97
+ * isPlainObject([]) // false
98
+ * isPlainObject(new Date()) // false
99
+ */
100
+ export declare const isPlainObject: (obj: any) => boolean;
101
+ /**
102
+ * 检查对象是否为空(不包含任何属性)
103
+ *
104
+ * 对于对象和数组,检查是否有自有属性
105
+ * 对于其他类型,直接返回true
106
+ *
107
+ * @param {any} obj - 要检查的对象
108
+ * @returns {boolean} - 如果对象为空则返回true,否则返回false
109
+ *
110
+ * @example
111
+ * isEmptyObject({}) // true
112
+ * isEmptyObject([]) // true
113
+ * isEmptyObject({a: 1}) // false
114
+ * isEmptyObject([1, 2]) // false
115
+ */
116
+ export declare const isEmptyObject: (obj: any) => boolean;
117
+ /**
118
+ * 判断对象是否为数字类型(有限数字)
119
+ *
120
+ * 注意:NaN和Infinity不被视为有效数字
121
+ *
122
+ * @param {any} value - 要检查的值
123
+ * @returns {boolean} - 如果是有效数字则返回true,否则返回false
124
+ *
125
+ * @example
126
+ * isNumber(369) // true
127
+ * isNumber(0) // true
128
+ * isNumber(-1.5) // true
129
+ * isNumber(NaN) // false
130
+ * isNumber(Infinity) // false
131
+ * isNumber('123') // false
132
+ */
133
+ export declare const isNumber: (value: any) => boolean;
134
+ /**
135
+ * 判断对象是否代表一个数值(可以是数字类型或可转换为数字的字符串)
136
+ *
137
+ * @param {any} value - 要检查的值
138
+ * @returns {boolean} - 如果是数值则返回true,否则返回false
139
+ *
140
+ * @example
141
+ * isNumeric('-10') // true
142
+ * isNumeric(16) // true
143
+ * isNumeric(0xFF) // true
144
+ * isNumeric('0xFF') // true
145
+ * isNumeric('8e5') // true
146
+ * isNumeric(3.1415) // true
147
+ * isNumeric(+10) // true
148
+ * isNumeric('') // false
149
+ * isNumeric({}) // false
150
+ * isNumeric(NaN) // false
151
+ * isNumeric(null) // false
152
+ * isNumeric(true) // false
153
+ * isNumeric(Infinity) // false
154
+ * isNumeric(undefined) // false
155
+ */
156
+ export declare const isNumeric: (value: any) => boolean;
157
+ /**
158
+ * 判断对象是否为日期类型
159
+ *
160
+ * @param {any} value - 要检查的值
161
+ * @returns {boolean} - 如果是日期类型则返回true,否则返回false
162
+ *
163
+ * @example
164
+ * isDate(new Date()) // true
165
+ * isDate(Date.now()) // false
166
+ * isDate('2023-01-01') // false
167
+ */
168
+ export declare const isDate: (value: any) => boolean;
169
+ /**
170
+ * 判断两个值是否值相同且类型相同
171
+ *
172
+ * 特别处理了NaN的情况,在JavaScript中NaN !== NaN,但在此函数中认为它们相同
173
+ *
174
+ * @param {any} x - 第一个值
175
+ * @param {any} y - 第二个值
176
+ * @returns {boolean} - 如果两个值相同则返回true,否则返回false
177
+ *
178
+ * @example
179
+ * isSame(1, 1) // true
180
+ * isSame(NaN, NaN) // true
181
+ * isSame('a', 'a') // true
182
+ * isSame({}, {}) // false (引用不同)
183
+ * isSame(1, '1') // false (类型不同)
184
+ */
185
+ export declare const isSame: (x: any, y: any) => boolean;
186
+ /**
187
+ * 判断值是否是正则表达式
188
+ *
189
+ * @param {any} value - 要检查的值
190
+ * @returns {boolean} - 如果是正则表达式则返回true,否则返回false
191
+ *
192
+ * @example
193
+ * isRegExp(/test/) // true
194
+ * isRegExp(new RegExp('test')) // true
195
+ * isRegExp('/test/') // false (这是字符串)
196
+ */
197
+ export declare const isRegExp: (value: any) => boolean;
198
+ /**
199
+ * 判断值是否是Promise对象或类Promise对象
200
+ *
201
+ * 类Promise对象需要有then和catch方法
202
+ *
203
+ * @param {any} val - 要检查的值
204
+ * @returns {boolean} - 如果是Promise对象则返回true,否则返回false
205
+ *
206
+ * @example
207
+ * isPromise(Promise.resolve()) // true
208
+ * isPromise(new Promise(() => {})) // true
209
+ * isPromise({then: () => {}, catch: () => {}}) // true
210
+ * isPromise({then: () => {}}) // false (缺少catch方法)
211
+ */
212
+ export declare const isPromise: (val: any) => boolean;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export declare const uploadAjax: (option: any) => XMLHttpRequest | undefined;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ import { default as Schema } from './schema';
2
+ export declare const Validator: typeof Schema;
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ type TranslateFunction = (value: string) => string;
13
+ declare const _default: (translate?: TranslateFunction) => {
14
+ default: string;
15
+ required: string;
16
+ enum: string;
17
+ whitespace: string;
18
+ date: {
19
+ format: string;
20
+ parse: string;
21
+ invalid: string;
22
+ };
23
+ types: {
24
+ string: string;
25
+ method: string;
26
+ array: string;
27
+ object: string;
28
+ number: string;
29
+ date: string;
30
+ boolean: string;
31
+ integer: string;
32
+ float: string;
33
+ regexp: string;
34
+ email: string;
35
+ url: string;
36
+ hex: string;
37
+ digits: string;
38
+ time: string;
39
+ dateYM: string;
40
+ dateYMD: string;
41
+ dateTime: string;
42
+ longDateTime: string;
43
+ version: string;
44
+ speczh: string;
45
+ specialch: string;
46
+ specialch2: string;
47
+ acceptImg: string;
48
+ acceptFile: string;
49
+ fileSize: string;
50
+ };
51
+ string: {
52
+ len: string;
53
+ min: string;
54
+ max: string;
55
+ range: string;
56
+ };
57
+ number: {
58
+ len: string;
59
+ min: string;
60
+ max: string;
61
+ range: string;
62
+ };
63
+ array: {
64
+ len: string;
65
+ min: string;
66
+ max: string;
67
+ range: string;
68
+ };
69
+ pattern: {
70
+ mismatch: string;
71
+ };
72
+ };
73
+ export default _default;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export default function (rule: any, checkValue: any, source: any, errors: any, options: any): void;
@@ -0,0 +1,15 @@
1
+ import { default as type } from './type';
2
+ import { default as range } from './range';
3
+ import { default as enumRule } from './enum';
4
+ import { default as pattern } from './pattern';
5
+ import { default as required } from './required';
6
+ import { default as whitespace } from './whitespace';
7
+ declare const _default: {
8
+ type: typeof type;
9
+ range: typeof range;
10
+ pattern: typeof pattern;
11
+ required: typeof required;
12
+ whitespace: typeof whitespace;
13
+ enum: typeof enumRule;
14
+ };
15
+ export default _default;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export default function (rule: any, checkValue: any, source: any, errors: any, options: any): void;
@@ -0,0 +1 @@
1
+ export default function (rule: any, checkValue: any, source: any, errors: any, options: any): false | undefined;
@@ -0,0 +1,21 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ interface RequiredType {
13
+ rule: any;
14
+ checkValue?: any;
15
+ source: any;
16
+ errors: any;
17
+ options: any;
18
+ type?: any;
19
+ }
20
+ export default function ({ rule, checkValue, source, errors, options, type }: RequiredType): void;
21
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export default function (rule: any, value: any, source: any, errors: any, options: any): void;
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ export default function (rule: any, checkValue: any, source: any, errors: any, options: any): void;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Copyright (c) 2022 - present TinyVue Authors.
3
+ * Copyright (c) 2022 - present Huawei Cloud Computing Technologies Co., Ltd.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license.
6
+ *
7
+ * THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL,
8
+ * BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR
9
+ * A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
10
+ *
11
+ */
12
+ declare function Schema(descriptor: Record<string, any>, translate?: any): void;
13
+ declare namespace Schema {
14
+ var register: (type: any, validator: any) => void;
15
+ var validators: Record<string, any>;
16
+ var warning: () => undefined;
17
+ var messages: Record<string, any>;
18
+ var systemMessages: Record<string, any>;
19
+ var getDefaultMessage: () => undefined;
20
+ var getSystemMessage: () => undefined;
21
+ }
22
+ export default Schema;