@sybz-components/utils 0.0.9 → 0.0.11
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/dist/base.cjs +5 -5
- package/dist/base.d.cts +25 -20
- package/dist/base.d.mts +25 -20
- package/dist/base.d.ts +25 -20
- package/dist/base.mjs +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.mjs +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{utils.1NRU16hJ.mjs → utils.CCqAduBt.mjs} +93 -61
- package/dist/shared/{utils.DQLx7A8M.cjs → utils.D_mBxLLy.cjs} +97 -65
- package/package.json +1 -1
package/dist/base.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require('vue');
|
|
4
4
|
require('consola');
|
|
5
5
|
require('es-toolkit');
|
|
6
|
-
const format = require('./shared/utils.
|
|
6
|
+
const format = require('./shared/utils.D_mBxLLy.cjs');
|
|
7
7
|
require('element-plus');
|
|
8
8
|
require('./is.cjs');
|
|
9
9
|
|
|
@@ -15,6 +15,7 @@ exports.clone = format.clone;
|
|
|
15
15
|
exports.confirm = format.confirm;
|
|
16
16
|
exports.copy = format.copy;
|
|
17
17
|
exports.debounce = format.debounce;
|
|
18
|
+
exports.delay = format.delay;
|
|
18
19
|
exports.getStorage = format.getStorage;
|
|
19
20
|
exports.getType = format.getType;
|
|
20
21
|
exports.getUtilsBuildTime = format.getUtilsBuildTime;
|
|
@@ -22,15 +23,14 @@ exports.getVariable = format.getVariable;
|
|
|
22
23
|
exports.isEmpty = format.isEmpty;
|
|
23
24
|
exports.log = format.log;
|
|
24
25
|
exports.merge = format.merge;
|
|
26
|
+
exports.mockValue = format.mockValue;
|
|
25
27
|
exports.processWidth = format.processWidth;
|
|
26
28
|
exports.random = format.random;
|
|
27
29
|
exports.setStorage = format.setStorage;
|
|
28
|
-
exports.sleep = format.sleep;
|
|
29
30
|
exports.test = format.test;
|
|
30
31
|
exports.throttle = format.throttle;
|
|
31
32
|
exports.toLine = format.toLine;
|
|
32
33
|
exports.tryCatch = format.tryCatch;
|
|
33
|
-
exports.uuid = format.uuid;
|
|
34
|
-
exports.validForm = format.validForm;
|
|
35
34
|
exports.validate = format.validate;
|
|
36
|
-
exports.
|
|
35
|
+
exports.validateForm = format.validateForm;
|
|
36
|
+
exports.validateOnSubmit = format.validateOnSubmit;
|
package/dist/base.d.cts
CHANGED
|
@@ -12,6 +12,7 @@ type WidthStyleResult = {
|
|
|
12
12
|
};
|
|
13
13
|
type ValidateTriggerType = 'blur' | 'change';
|
|
14
14
|
type ValidateInput = ValidateRules | ValidatePrimitiveValue;
|
|
15
|
+
type ValidateTypeInput = string | ValidateRules;
|
|
15
16
|
type ValidateRuleResult = {
|
|
16
17
|
required?: boolean;
|
|
17
18
|
message?: string;
|
|
@@ -21,7 +22,7 @@ type ValidateRuleResult = {
|
|
|
21
22
|
max?: number;
|
|
22
23
|
};
|
|
23
24
|
type ValidatePrimitiveValue = string | number | boolean | null | undefined;
|
|
24
|
-
type
|
|
25
|
+
type MockValueOptionItem<T = any> = {
|
|
25
26
|
label: string;
|
|
26
27
|
value: T;
|
|
27
28
|
};
|
|
@@ -38,7 +39,7 @@ interface ClearStorageExcludeOptions {
|
|
|
38
39
|
exclude: string[];
|
|
39
40
|
}
|
|
40
41
|
type ClearStorageInput = string | string[] | ClearStorageExcludeOptions;
|
|
41
|
-
interface
|
|
42
|
+
interface ValidateFormOptions {
|
|
42
43
|
/**
|
|
43
44
|
* 校验失败时的提示文案。
|
|
44
45
|
*/
|
|
@@ -55,7 +56,7 @@ interface ValidFormOptions {
|
|
|
55
56
|
interface FormValidateTarget {
|
|
56
57
|
validate: (callback: (valid: boolean, status: StorageMap) => void) => void;
|
|
57
58
|
}
|
|
58
|
-
interface
|
|
59
|
+
interface MockValueOptions {
|
|
59
60
|
/**
|
|
60
61
|
* `email` 模式下的邮箱后缀,默认 `@qq.com`。
|
|
61
62
|
*/
|
|
@@ -74,6 +75,10 @@ interface UuidOptions {
|
|
|
74
75
|
optionsIndex?: number | null;
|
|
75
76
|
}
|
|
76
77
|
interface ValidateRules {
|
|
78
|
+
/**
|
|
79
|
+
* 校验类型。作为 `validate({ type: 'mobile' })` 使用时生效。
|
|
80
|
+
*/
|
|
81
|
+
type?: string;
|
|
77
82
|
/**
|
|
78
83
|
* 校验失败提示文案。
|
|
79
84
|
*/
|
|
@@ -238,12 +243,12 @@ declare function clearStorage(str?: ClearStorageInput): void;
|
|
|
238
243
|
* @returns 校验通过时返回表单状态对象,失败时 reject 对应状态对象。
|
|
239
244
|
*
|
|
240
245
|
* @example
|
|
241
|
-
* await
|
|
246
|
+
* await validateForm(formRef)
|
|
242
247
|
*
|
|
243
248
|
* @example
|
|
244
|
-
* await
|
|
249
|
+
* await validateForm(formRef, { message: '请检查表单信息', detail: true })
|
|
245
250
|
*/
|
|
246
|
-
declare function
|
|
251
|
+
declare function validateForm(ref: MaybeRef<FormValidateTarget>, { message, detail, showMessage }?: ValidateFormOptions): Promise<StorageMap>;
|
|
247
252
|
/**
|
|
248
253
|
* 判断值是否为空。
|
|
249
254
|
*
|
|
@@ -308,17 +313,17 @@ declare function clone<T>(data: T, times?: number): T;
|
|
|
308
313
|
* @returns 生成结果。
|
|
309
314
|
*
|
|
310
315
|
* @example
|
|
311
|
-
*
|
|
316
|
+
* mockValue()
|
|
312
317
|
* // => 'aB3d'
|
|
313
318
|
*
|
|
314
319
|
* @example
|
|
315
|
-
*
|
|
320
|
+
* mockValue('phone')
|
|
316
321
|
* // => '13603312460'
|
|
317
322
|
*
|
|
318
323
|
* @example
|
|
319
|
-
*
|
|
324
|
+
* mockValue('time', 0, { startStr: 'andy', timeStr: '{h}:{i}:{s}' })
|
|
320
325
|
*/
|
|
321
|
-
declare function
|
|
326
|
+
declare function mockValue(type?: string | Array<MockValueOptionItem>, length?: number, options?: MockValueOptions): string | number | any;
|
|
322
327
|
/**
|
|
323
328
|
* 获取值的原始类型名称,返回值统一为小写字符串。
|
|
324
329
|
*
|
|
@@ -336,7 +341,7 @@ declare function uuid(type?: string | Array<UuidOptionItem>, length?: number, op
|
|
|
336
341
|
declare function getType(type: unknown): string;
|
|
337
342
|
/**
|
|
338
343
|
* 一个辅助函数,用于在代码中创建一个暂停(延迟)。
|
|
339
|
-
* 它返回一个 Promise,你可以在 `await` 后使用它来实现类似 "
|
|
344
|
+
* 它返回一个 Promise,你可以在 `await` 后使用它来实现类似 "delay" 的效果。
|
|
340
345
|
*
|
|
341
346
|
* @param delay - 等待的毫秒数。默认值为 0,表示不延迟。
|
|
342
347
|
* @param fn - (可选) 一个在延迟结束后立即执行的函数。
|
|
@@ -346,12 +351,12 @@ declare function getType(type: unknown): string;
|
|
|
346
351
|
* @example
|
|
347
352
|
* // 基本用法:延迟 2 秒后打印消息
|
|
348
353
|
* console.log('开始');
|
|
349
|
-
* await
|
|
354
|
+
* await delay(2000);
|
|
350
355
|
* console.log('2秒后执行');
|
|
351
356
|
*
|
|
352
357
|
* @example
|
|
353
358
|
* // 带回调函数的用法:延迟 1 秒后执行清理工作
|
|
354
|
-
*
|
|
359
|
+
* delay(1000, () => {
|
|
355
360
|
* console.log('执行清理操作...');
|
|
356
361
|
* // 清理代码...
|
|
357
362
|
* });
|
|
@@ -360,12 +365,12 @@ declare function getType(type: unknown): string;
|
|
|
360
365
|
* // 在循环中使用:每次迭代后延迟 500 毫秒
|
|
361
366
|
* for (let i = 0; i < 5; i++) {
|
|
362
367
|
* console.log(`当前值: ${i}`);
|
|
363
|
-
* await
|
|
368
|
+
* await delay(500);
|
|
364
369
|
* }
|
|
365
370
|
*/
|
|
366
|
-
declare function
|
|
371
|
+
declare function delay(delay?: number, fn?: () => void): Promise<void>;
|
|
367
372
|
/**
|
|
368
|
-
* 为 `validate`
|
|
373
|
+
* 为 `validate` 预置空触发时机,只在提交或手动调用表单校验时触发。
|
|
369
374
|
*
|
|
370
375
|
* @param type 校验类型。
|
|
371
376
|
* @param rules 校验规则。
|
|
@@ -373,10 +378,10 @@ declare function sleep(delay?: number, fn?: () => void): Promise<void>;
|
|
|
373
378
|
* @returns 与 `validate` 一致。
|
|
374
379
|
*
|
|
375
380
|
* @example
|
|
376
|
-
* const rule =
|
|
381
|
+
* const rule = validateOnSubmit('required', { message: '请输入名称' })
|
|
377
382
|
*/
|
|
378
|
-
declare function
|
|
379
|
-
declare function validate(type?:
|
|
383
|
+
declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
|
|
384
|
+
declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
|
|
380
385
|
/**
|
|
381
386
|
* 复制文本到剪贴板。
|
|
382
387
|
*
|
|
@@ -559,4 +564,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
559
564
|
*/
|
|
560
565
|
declare function test(): string;
|
|
561
566
|
|
|
562
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage,
|
|
567
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
package/dist/base.d.mts
CHANGED
|
@@ -12,6 +12,7 @@ type WidthStyleResult = {
|
|
|
12
12
|
};
|
|
13
13
|
type ValidateTriggerType = 'blur' | 'change';
|
|
14
14
|
type ValidateInput = ValidateRules | ValidatePrimitiveValue;
|
|
15
|
+
type ValidateTypeInput = string | ValidateRules;
|
|
15
16
|
type ValidateRuleResult = {
|
|
16
17
|
required?: boolean;
|
|
17
18
|
message?: string;
|
|
@@ -21,7 +22,7 @@ type ValidateRuleResult = {
|
|
|
21
22
|
max?: number;
|
|
22
23
|
};
|
|
23
24
|
type ValidatePrimitiveValue = string | number | boolean | null | undefined;
|
|
24
|
-
type
|
|
25
|
+
type MockValueOptionItem<T = any> = {
|
|
25
26
|
label: string;
|
|
26
27
|
value: T;
|
|
27
28
|
};
|
|
@@ -38,7 +39,7 @@ interface ClearStorageExcludeOptions {
|
|
|
38
39
|
exclude: string[];
|
|
39
40
|
}
|
|
40
41
|
type ClearStorageInput = string | string[] | ClearStorageExcludeOptions;
|
|
41
|
-
interface
|
|
42
|
+
interface ValidateFormOptions {
|
|
42
43
|
/**
|
|
43
44
|
* 校验失败时的提示文案。
|
|
44
45
|
*/
|
|
@@ -55,7 +56,7 @@ interface ValidFormOptions {
|
|
|
55
56
|
interface FormValidateTarget {
|
|
56
57
|
validate: (callback: (valid: boolean, status: StorageMap) => void) => void;
|
|
57
58
|
}
|
|
58
|
-
interface
|
|
59
|
+
interface MockValueOptions {
|
|
59
60
|
/**
|
|
60
61
|
* `email` 模式下的邮箱后缀,默认 `@qq.com`。
|
|
61
62
|
*/
|
|
@@ -74,6 +75,10 @@ interface UuidOptions {
|
|
|
74
75
|
optionsIndex?: number | null;
|
|
75
76
|
}
|
|
76
77
|
interface ValidateRules {
|
|
78
|
+
/**
|
|
79
|
+
* 校验类型。作为 `validate({ type: 'mobile' })` 使用时生效。
|
|
80
|
+
*/
|
|
81
|
+
type?: string;
|
|
77
82
|
/**
|
|
78
83
|
* 校验失败提示文案。
|
|
79
84
|
*/
|
|
@@ -238,12 +243,12 @@ declare function clearStorage(str?: ClearStorageInput): void;
|
|
|
238
243
|
* @returns 校验通过时返回表单状态对象,失败时 reject 对应状态对象。
|
|
239
244
|
*
|
|
240
245
|
* @example
|
|
241
|
-
* await
|
|
246
|
+
* await validateForm(formRef)
|
|
242
247
|
*
|
|
243
248
|
* @example
|
|
244
|
-
* await
|
|
249
|
+
* await validateForm(formRef, { message: '请检查表单信息', detail: true })
|
|
245
250
|
*/
|
|
246
|
-
declare function
|
|
251
|
+
declare function validateForm(ref: MaybeRef<FormValidateTarget>, { message, detail, showMessage }?: ValidateFormOptions): Promise<StorageMap>;
|
|
247
252
|
/**
|
|
248
253
|
* 判断值是否为空。
|
|
249
254
|
*
|
|
@@ -308,17 +313,17 @@ declare function clone<T>(data: T, times?: number): T;
|
|
|
308
313
|
* @returns 生成结果。
|
|
309
314
|
*
|
|
310
315
|
* @example
|
|
311
|
-
*
|
|
316
|
+
* mockValue()
|
|
312
317
|
* // => 'aB3d'
|
|
313
318
|
*
|
|
314
319
|
* @example
|
|
315
|
-
*
|
|
320
|
+
* mockValue('phone')
|
|
316
321
|
* // => '13603312460'
|
|
317
322
|
*
|
|
318
323
|
* @example
|
|
319
|
-
*
|
|
324
|
+
* mockValue('time', 0, { startStr: 'andy', timeStr: '{h}:{i}:{s}' })
|
|
320
325
|
*/
|
|
321
|
-
declare function
|
|
326
|
+
declare function mockValue(type?: string | Array<MockValueOptionItem>, length?: number, options?: MockValueOptions): string | number | any;
|
|
322
327
|
/**
|
|
323
328
|
* 获取值的原始类型名称,返回值统一为小写字符串。
|
|
324
329
|
*
|
|
@@ -336,7 +341,7 @@ declare function uuid(type?: string | Array<UuidOptionItem>, length?: number, op
|
|
|
336
341
|
declare function getType(type: unknown): string;
|
|
337
342
|
/**
|
|
338
343
|
* 一个辅助函数,用于在代码中创建一个暂停(延迟)。
|
|
339
|
-
* 它返回一个 Promise,你可以在 `await` 后使用它来实现类似 "
|
|
344
|
+
* 它返回一个 Promise,你可以在 `await` 后使用它来实现类似 "delay" 的效果。
|
|
340
345
|
*
|
|
341
346
|
* @param delay - 等待的毫秒数。默认值为 0,表示不延迟。
|
|
342
347
|
* @param fn - (可选) 一个在延迟结束后立即执行的函数。
|
|
@@ -346,12 +351,12 @@ declare function getType(type: unknown): string;
|
|
|
346
351
|
* @example
|
|
347
352
|
* // 基本用法:延迟 2 秒后打印消息
|
|
348
353
|
* console.log('开始');
|
|
349
|
-
* await
|
|
354
|
+
* await delay(2000);
|
|
350
355
|
* console.log('2秒后执行');
|
|
351
356
|
*
|
|
352
357
|
* @example
|
|
353
358
|
* // 带回调函数的用法:延迟 1 秒后执行清理工作
|
|
354
|
-
*
|
|
359
|
+
* delay(1000, () => {
|
|
355
360
|
* console.log('执行清理操作...');
|
|
356
361
|
* // 清理代码...
|
|
357
362
|
* });
|
|
@@ -360,12 +365,12 @@ declare function getType(type: unknown): string;
|
|
|
360
365
|
* // 在循环中使用:每次迭代后延迟 500 毫秒
|
|
361
366
|
* for (let i = 0; i < 5; i++) {
|
|
362
367
|
* console.log(`当前值: ${i}`);
|
|
363
|
-
* await
|
|
368
|
+
* await delay(500);
|
|
364
369
|
* }
|
|
365
370
|
*/
|
|
366
|
-
declare function
|
|
371
|
+
declare function delay(delay?: number, fn?: () => void): Promise<void>;
|
|
367
372
|
/**
|
|
368
|
-
* 为 `validate`
|
|
373
|
+
* 为 `validate` 预置空触发时机,只在提交或手动调用表单校验时触发。
|
|
369
374
|
*
|
|
370
375
|
* @param type 校验类型。
|
|
371
376
|
* @param rules 校验规则。
|
|
@@ -373,10 +378,10 @@ declare function sleep(delay?: number, fn?: () => void): Promise<void>;
|
|
|
373
378
|
* @returns 与 `validate` 一致。
|
|
374
379
|
*
|
|
375
380
|
* @example
|
|
376
|
-
* const rule =
|
|
381
|
+
* const rule = validateOnSubmit('required', { message: '请输入名称' })
|
|
377
382
|
*/
|
|
378
|
-
declare function
|
|
379
|
-
declare function validate(type?:
|
|
383
|
+
declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
|
|
384
|
+
declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
|
|
380
385
|
/**
|
|
381
386
|
* 复制文本到剪贴板。
|
|
382
387
|
*
|
|
@@ -559,4 +564,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
559
564
|
*/
|
|
560
565
|
declare function test(): string;
|
|
561
566
|
|
|
562
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage,
|
|
567
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
package/dist/base.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ type WidthStyleResult = {
|
|
|
12
12
|
};
|
|
13
13
|
type ValidateTriggerType = 'blur' | 'change';
|
|
14
14
|
type ValidateInput = ValidateRules | ValidatePrimitiveValue;
|
|
15
|
+
type ValidateTypeInput = string | ValidateRules;
|
|
15
16
|
type ValidateRuleResult = {
|
|
16
17
|
required?: boolean;
|
|
17
18
|
message?: string;
|
|
@@ -21,7 +22,7 @@ type ValidateRuleResult = {
|
|
|
21
22
|
max?: number;
|
|
22
23
|
};
|
|
23
24
|
type ValidatePrimitiveValue = string | number | boolean | null | undefined;
|
|
24
|
-
type
|
|
25
|
+
type MockValueOptionItem<T = any> = {
|
|
25
26
|
label: string;
|
|
26
27
|
value: T;
|
|
27
28
|
};
|
|
@@ -38,7 +39,7 @@ interface ClearStorageExcludeOptions {
|
|
|
38
39
|
exclude: string[];
|
|
39
40
|
}
|
|
40
41
|
type ClearStorageInput = string | string[] | ClearStorageExcludeOptions;
|
|
41
|
-
interface
|
|
42
|
+
interface ValidateFormOptions {
|
|
42
43
|
/**
|
|
43
44
|
* 校验失败时的提示文案。
|
|
44
45
|
*/
|
|
@@ -55,7 +56,7 @@ interface ValidFormOptions {
|
|
|
55
56
|
interface FormValidateTarget {
|
|
56
57
|
validate: (callback: (valid: boolean, status: StorageMap) => void) => void;
|
|
57
58
|
}
|
|
58
|
-
interface
|
|
59
|
+
interface MockValueOptions {
|
|
59
60
|
/**
|
|
60
61
|
* `email` 模式下的邮箱后缀,默认 `@qq.com`。
|
|
61
62
|
*/
|
|
@@ -74,6 +75,10 @@ interface UuidOptions {
|
|
|
74
75
|
optionsIndex?: number | null;
|
|
75
76
|
}
|
|
76
77
|
interface ValidateRules {
|
|
78
|
+
/**
|
|
79
|
+
* 校验类型。作为 `validate({ type: 'mobile' })` 使用时生效。
|
|
80
|
+
*/
|
|
81
|
+
type?: string;
|
|
77
82
|
/**
|
|
78
83
|
* 校验失败提示文案。
|
|
79
84
|
*/
|
|
@@ -238,12 +243,12 @@ declare function clearStorage(str?: ClearStorageInput): void;
|
|
|
238
243
|
* @returns 校验通过时返回表单状态对象,失败时 reject 对应状态对象。
|
|
239
244
|
*
|
|
240
245
|
* @example
|
|
241
|
-
* await
|
|
246
|
+
* await validateForm(formRef)
|
|
242
247
|
*
|
|
243
248
|
* @example
|
|
244
|
-
* await
|
|
249
|
+
* await validateForm(formRef, { message: '请检查表单信息', detail: true })
|
|
245
250
|
*/
|
|
246
|
-
declare function
|
|
251
|
+
declare function validateForm(ref: MaybeRef<FormValidateTarget>, { message, detail, showMessage }?: ValidateFormOptions): Promise<StorageMap>;
|
|
247
252
|
/**
|
|
248
253
|
* 判断值是否为空。
|
|
249
254
|
*
|
|
@@ -308,17 +313,17 @@ declare function clone<T>(data: T, times?: number): T;
|
|
|
308
313
|
* @returns 生成结果。
|
|
309
314
|
*
|
|
310
315
|
* @example
|
|
311
|
-
*
|
|
316
|
+
* mockValue()
|
|
312
317
|
* // => 'aB3d'
|
|
313
318
|
*
|
|
314
319
|
* @example
|
|
315
|
-
*
|
|
320
|
+
* mockValue('phone')
|
|
316
321
|
* // => '13603312460'
|
|
317
322
|
*
|
|
318
323
|
* @example
|
|
319
|
-
*
|
|
324
|
+
* mockValue('time', 0, { startStr: 'andy', timeStr: '{h}:{i}:{s}' })
|
|
320
325
|
*/
|
|
321
|
-
declare function
|
|
326
|
+
declare function mockValue(type?: string | Array<MockValueOptionItem>, length?: number, options?: MockValueOptions): string | number | any;
|
|
322
327
|
/**
|
|
323
328
|
* 获取值的原始类型名称,返回值统一为小写字符串。
|
|
324
329
|
*
|
|
@@ -336,7 +341,7 @@ declare function uuid(type?: string | Array<UuidOptionItem>, length?: number, op
|
|
|
336
341
|
declare function getType(type: unknown): string;
|
|
337
342
|
/**
|
|
338
343
|
* 一个辅助函数,用于在代码中创建一个暂停(延迟)。
|
|
339
|
-
* 它返回一个 Promise,你可以在 `await` 后使用它来实现类似 "
|
|
344
|
+
* 它返回一个 Promise,你可以在 `await` 后使用它来实现类似 "delay" 的效果。
|
|
340
345
|
*
|
|
341
346
|
* @param delay - 等待的毫秒数。默认值为 0,表示不延迟。
|
|
342
347
|
* @param fn - (可选) 一个在延迟结束后立即执行的函数。
|
|
@@ -346,12 +351,12 @@ declare function getType(type: unknown): string;
|
|
|
346
351
|
* @example
|
|
347
352
|
* // 基本用法:延迟 2 秒后打印消息
|
|
348
353
|
* console.log('开始');
|
|
349
|
-
* await
|
|
354
|
+
* await delay(2000);
|
|
350
355
|
* console.log('2秒后执行');
|
|
351
356
|
*
|
|
352
357
|
* @example
|
|
353
358
|
* // 带回调函数的用法:延迟 1 秒后执行清理工作
|
|
354
|
-
*
|
|
359
|
+
* delay(1000, () => {
|
|
355
360
|
* console.log('执行清理操作...');
|
|
356
361
|
* // 清理代码...
|
|
357
362
|
* });
|
|
@@ -360,12 +365,12 @@ declare function getType(type: unknown): string;
|
|
|
360
365
|
* // 在循环中使用:每次迭代后延迟 500 毫秒
|
|
361
366
|
* for (let i = 0; i < 5; i++) {
|
|
362
367
|
* console.log(`当前值: ${i}`);
|
|
363
|
-
* await
|
|
368
|
+
* await delay(500);
|
|
364
369
|
* }
|
|
365
370
|
*/
|
|
366
|
-
declare function
|
|
371
|
+
declare function delay(delay?: number, fn?: () => void): Promise<void>;
|
|
367
372
|
/**
|
|
368
|
-
* 为 `validate`
|
|
373
|
+
* 为 `validate` 预置空触发时机,只在提交或手动调用表单校验时触发。
|
|
369
374
|
*
|
|
370
375
|
* @param type 校验类型。
|
|
371
376
|
* @param rules 校验规则。
|
|
@@ -373,10 +378,10 @@ declare function sleep(delay?: number, fn?: () => void): Promise<void>;
|
|
|
373
378
|
* @returns 与 `validate` 一致。
|
|
374
379
|
*
|
|
375
380
|
* @example
|
|
376
|
-
* const rule =
|
|
381
|
+
* const rule = validateOnSubmit('required', { message: '请输入名称' })
|
|
377
382
|
*/
|
|
378
|
-
declare function
|
|
379
|
-
declare function validate(type?:
|
|
383
|
+
declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
|
|
384
|
+
declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
|
|
380
385
|
/**
|
|
381
386
|
* 复制文本到剪贴板。
|
|
382
387
|
*
|
|
@@ -559,4 +564,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
559
564
|
*/
|
|
560
565
|
declare function test(): string;
|
|
561
566
|
|
|
562
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage,
|
|
567
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
|
package/dist/base.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import 'vue';
|
|
2
2
|
import 'consola';
|
|
3
3
|
import 'es-toolkit';
|
|
4
|
-
export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, g as getStorage,
|
|
4
|
+
export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, f as delay, g as getStorage, h as getType, i as getUtilsBuildTime, j as getVariable, k as isEmpty, l as log, m as merge, n as mockValue, p as processWidth, r as random, s as setStorage, t as test, o as throttle, q as toLine, u as tryCatch, v as validate, w as validateForm, x as validateOnSubmit } from './shared/utils.CCqAduBt.mjs';
|
|
5
5
|
import 'element-plus';
|
|
6
6
|
import './is.mjs';
|
package/dist/format.cjs
CHANGED
package/dist/format.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.
|
|
1
|
+
export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.CCqAduBt.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const format = require('./shared/utils.
|
|
3
|
+
const format = require('./shared/utils.D_mBxLLy.cjs');
|
|
4
4
|
const day = require('./day.cjs');
|
|
5
5
|
const is = require('./is.cjs');
|
|
6
6
|
const ws = require('./ws.cjs');
|
|
@@ -19,6 +19,7 @@ exports.clone = format.clone;
|
|
|
19
19
|
exports.confirm = format.confirm;
|
|
20
20
|
exports.copy = format.copy;
|
|
21
21
|
exports.debounce = format.debounce;
|
|
22
|
+
exports.delay = format.delay;
|
|
22
23
|
exports.formatBytes = format.formatBytes;
|
|
23
24
|
exports.formatBytesConvert = format.formatBytesConvert;
|
|
24
25
|
exports.formatDurationTime = format.formatDurationTime;
|
|
@@ -34,18 +35,17 @@ exports.getVariable = format.getVariable;
|
|
|
34
35
|
exports.isEmpty = format.isEmpty;
|
|
35
36
|
exports.log = format.log;
|
|
36
37
|
exports.merge = format.merge;
|
|
38
|
+
exports.mockValue = format.mockValue;
|
|
37
39
|
exports.processWidth = format.processWidth;
|
|
38
40
|
exports.random = format.random;
|
|
39
41
|
exports.setStorage = format.setStorage;
|
|
40
|
-
exports.sleep = format.sleep;
|
|
41
42
|
exports.test = format.test;
|
|
42
43
|
exports.throttle = format.throttle;
|
|
43
44
|
exports.toLine = format.toLine;
|
|
44
45
|
exports.tryCatch = format.tryCatch;
|
|
45
|
-
exports.uuid = format.uuid;
|
|
46
|
-
exports.validForm = format.validForm;
|
|
47
46
|
exports.validate = format.validate;
|
|
48
|
-
exports.
|
|
47
|
+
exports.validateForm = format.validateForm;
|
|
48
|
+
exports.validateOnSubmit = format.validateOnSubmit;
|
|
49
49
|
exports.diffDate = day.diffDate;
|
|
50
50
|
exports.diffDateFromCurrent = day.diffDateFromCurrent;
|
|
51
51
|
exports.formatDate = day.formatDate;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage,
|
|
1
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.cjs';
|
|
2
2
|
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.cjs';
|
|
3
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.cjs';
|
|
4
4
|
export { WS, WSAutoReconnectOptions, WSHeartbeatOptions, WSOptions } from './ws.cjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage,
|
|
1
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.mjs';
|
|
2
2
|
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.mjs';
|
|
3
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.mjs';
|
|
4
4
|
export { WS, WSAutoReconnectOptions, WSHeartbeatOptions, WSOptions } from './ws.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage,
|
|
1
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.js';
|
|
2
2
|
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.js';
|
|
3
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.js';
|
|
4
4
|
export { WS, WSAutoReconnectOptions, WSHeartbeatOptions, WSOptions } from './ws.js';
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, g as getStorage,
|
|
1
|
+
export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, f as delay, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatImg, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, g as getStorage, h as getType, i as getUtilsBuildTime, j as getVariable, k as isEmpty, l as log, m as merge, n as mockValue, p as processWidth, r as random, s as setStorage, t as test, o as throttle, q as toLine, u as tryCatch, v as validate, w as validateForm, x as validateOnSubmit } from './shared/utils.CCqAduBt.mjs';
|
|
2
2
|
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.mjs';
|
|
3
3
|
export { isArray, isBoolean, isComponent, isDate, isEmptyObject, isFunction, isIOS, isMap, isNumber, isObject, isPlainObject, isPromise, isRegExp, isSVGElement, isSet, isString, isStringNumber, isSymbol, isUrl, objectToString, toRawType, toTypeString } from './is.mjs';
|
|
4
4
|
export { WS } from './ws.mjs';
|
|
@@ -373,7 +373,7 @@ function clearStorage(str = "") {
|
|
|
373
373
|
function _isObjectWithExclude(obj) {
|
|
374
374
|
return typeof obj === "object" && obj !== null && "exclude" in obj && Array.isArray(obj.exclude);
|
|
375
375
|
}
|
|
376
|
-
function
|
|
376
|
+
function validateForm(ref, { message = "\u8868\u5355\u6821\u9A8C\u9519\u8BEF, \u8BF7\u68C0\u67E5", detail = false, showMessage = true } = {}) {
|
|
377
377
|
return new Promise((resolve, reject) => {
|
|
378
378
|
unref(ref).validate((valid, status) => {
|
|
379
379
|
if (valid) {
|
|
@@ -455,7 +455,7 @@ function clone(data, times = 1) {
|
|
|
455
455
|
}
|
|
456
456
|
return result;
|
|
457
457
|
}
|
|
458
|
-
function
|
|
458
|
+
function mockValue(type = "", length = 4, options = {}) {
|
|
459
459
|
const { emailStr = "@qq.com", timeStr = "{y}-{m}-{d} {h}:{i}:{s}", startStr = "", optionsIndex = null } = options;
|
|
460
460
|
function isRef2(obj) {
|
|
461
461
|
return obj && typeof obj === "object" && obj._isRef === true;
|
|
@@ -487,11 +487,11 @@ function uuid(type = "", length = 4, options = {}) {
|
|
|
487
487
|
return result;
|
|
488
488
|
}
|
|
489
489
|
if (type === "email") {
|
|
490
|
-
result =
|
|
490
|
+
result = mockValue(startStr, length) + emailStr;
|
|
491
491
|
return result;
|
|
492
492
|
}
|
|
493
493
|
if (type === "time") {
|
|
494
|
-
return
|
|
494
|
+
return mockValue(startStr, length, options) + " " + formatTime(/* @__PURE__ */ new Date(), timeStr);
|
|
495
495
|
}
|
|
496
496
|
if (type === "number") {
|
|
497
497
|
const numChars = "123456789";
|
|
@@ -521,23 +521,31 @@ function getType(type) {
|
|
|
521
521
|
return typeof type;
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
function
|
|
524
|
+
function delay(delay2 = 0, fn) {
|
|
525
525
|
return new Promise(
|
|
526
526
|
(resolve) => setTimeout(() => {
|
|
527
527
|
fn?.();
|
|
528
528
|
resolve();
|
|
529
|
-
},
|
|
529
|
+
}, delay2)
|
|
530
530
|
);
|
|
531
531
|
}
|
|
532
|
-
function
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
}
|
|
537
|
-
return validate(
|
|
532
|
+
function validateOnSubmit(type = "required", rules = {}, pureValid = false) {
|
|
533
|
+
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
534
|
+
if (normalized.pureValid) {
|
|
535
|
+
return validate(normalized.type, normalized.rawRules, true);
|
|
536
|
+
}
|
|
537
|
+
return validate(
|
|
538
|
+
normalized.type,
|
|
539
|
+
{
|
|
540
|
+
...normalized.rulesObject,
|
|
541
|
+
trigger: normalized.rulesObject.trigger ?? []
|
|
542
|
+
},
|
|
543
|
+
normalized.pureValid
|
|
544
|
+
);
|
|
538
545
|
}
|
|
539
546
|
var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
540
547
|
ValidateType2["REQUIRED"] = "required";
|
|
548
|
+
ValidateType2["CHANGE"] = "change";
|
|
541
549
|
ValidateType2["PASSWORD"] = "password";
|
|
542
550
|
ValidateType2["NUMBER"] = "number";
|
|
543
551
|
ValidateType2["POSITIVE"] = "positive";
|
|
@@ -555,25 +563,31 @@ var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
|
555
563
|
return ValidateType2;
|
|
556
564
|
})(ValidateType || {});
|
|
557
565
|
function validate(type = "required", rules = {}, pureValid = false) {
|
|
558
|
-
const
|
|
559
|
-
|
|
566
|
+
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
567
|
+
const rulesObject = normalized.rulesObject;
|
|
568
|
+
const rawRules = normalized.rawRules;
|
|
569
|
+
const validType = normalized.type;
|
|
570
|
+
const isPureValid = normalized.pureValid;
|
|
571
|
+
const trigger = rulesObject.trigger ?? ["blur", "change"];
|
|
560
572
|
const typeMaps = Object.values(ValidateType);
|
|
561
|
-
|
|
562
|
-
|
|
573
|
+
const parseRequired = rulesObject.required ?? true;
|
|
574
|
+
const defaultRequiredMessage = validType === "change" /* CHANGE */ ? "\u8BF7\u9009\u62E9" : "\u8BF7\u8F93\u5165";
|
|
575
|
+
const getPureValue = () => Object.prototype.hasOwnProperty.call(rulesObject, "value") ? rulesObject.value : rawRules;
|
|
576
|
+
if (!typeMaps.includes(validType)) {
|
|
563
577
|
return {
|
|
564
578
|
required: parseRequired,
|
|
565
|
-
message:
|
|
579
|
+
message: validType,
|
|
566
580
|
trigger
|
|
567
581
|
};
|
|
568
582
|
}
|
|
569
|
-
if (
|
|
583
|
+
if (validType === "required" /* REQUIRED */ || validType === "change" /* CHANGE */) {
|
|
570
584
|
return {
|
|
571
585
|
required: parseRequired,
|
|
572
|
-
message: rulesObject.message ??
|
|
586
|
+
message: rulesObject.message ?? defaultRequiredMessage,
|
|
573
587
|
trigger
|
|
574
588
|
};
|
|
575
589
|
}
|
|
576
|
-
if (
|
|
590
|
+
if (validType === "password" /* PASSWORD */) {
|
|
577
591
|
const validateName = (rule, value, callback) => {
|
|
578
592
|
let validFlag = /^[a-zA-Z0-9_-]+$/.test(value);
|
|
579
593
|
if (!validFlag) {
|
|
@@ -587,41 +601,46 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
587
601
|
trigger
|
|
588
602
|
};
|
|
589
603
|
}
|
|
590
|
-
if (
|
|
591
|
-
return _validValue(
|
|
604
|
+
if (validType === "positive" /* POSITIVE */ || validType === "number" /* NUMBER */) {
|
|
605
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6B63\u6574\u6570", isPureValid, /^[1-9]+\d*$/);
|
|
592
606
|
}
|
|
593
|
-
if (
|
|
594
|
-
return _validValue(
|
|
607
|
+
if (validType === "zeroPositive" /* ZERO_POSITIVE */) {
|
|
608
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u975E\u8D1F\u6574\u6570", isPureValid, /^(0|[1-9]+\d*)$/);
|
|
595
609
|
}
|
|
596
|
-
if (
|
|
597
|
-
return _validValue(
|
|
610
|
+
if (validType === "integer" /* INTEGER */) {
|
|
611
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6574\u6570", isPureValid, /^(0|[-]?[1-9]\d*)$/);
|
|
598
612
|
}
|
|
599
|
-
if (
|
|
600
|
-
return _validValue(
|
|
613
|
+
if (validType === "decimal" /* DECIMAL */) {
|
|
614
|
+
return _validValue(
|
|
615
|
+
getPureValue(),
|
|
616
|
+
"\u8BF7\u8F93\u5165\u975E\u8D1F\u6570\u5B57, \u5305\u542B\u5C0F\u6570\u4E14\u6700\u591A2\u4F4D",
|
|
617
|
+
isPureValid,
|
|
618
|
+
/(0|[1-9]\d*)(\.\d{1, 2})?|0\.\d{1,2}/
|
|
619
|
+
);
|
|
601
620
|
}
|
|
602
|
-
if (
|
|
603
|
-
return _validValue(
|
|
621
|
+
if (validType === "mobile" /* MOBILE */) {
|
|
622
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7", isPureValid, /^[1][0-9]{10}$/);
|
|
604
623
|
}
|
|
605
|
-
if (
|
|
606
|
-
return _validValue(
|
|
624
|
+
if (validType === "email" /* EMAIL */) {
|
|
625
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6B63\u786E\u7684email", isPureValid, /^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
|
607
626
|
}
|
|
608
|
-
if (
|
|
627
|
+
if (validType === "ip" /* IP */) {
|
|
609
628
|
return _validValue(
|
|
610
|
-
|
|
629
|
+
getPureValue(),
|
|
611
630
|
"\u8BF7\u8F93\u5165\u6B63\u786E\u7684ip\u5730\u5740",
|
|
612
|
-
|
|
631
|
+
isPureValid,
|
|
613
632
|
/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
|
614
633
|
);
|
|
615
634
|
}
|
|
616
|
-
if (
|
|
635
|
+
if (validType === "port" /* PORT */) {
|
|
617
636
|
return _validValue(
|
|
618
|
-
|
|
637
|
+
getPureValue(),
|
|
619
638
|
"\u8BF7\u8F93\u51651-65535\u7684\u7AEF\u53E3\u53F7",
|
|
620
|
-
|
|
639
|
+
isPureValid,
|
|
621
640
|
/^([1-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-5][0-5][0-3][0-5])$/
|
|
622
641
|
);
|
|
623
642
|
}
|
|
624
|
-
if (
|
|
643
|
+
if (validType === "between" /* BETWEEN */) {
|
|
625
644
|
let minValue = rulesObject.min ?? "";
|
|
626
645
|
let maxValue = rulesObject.max ?? "";
|
|
627
646
|
const validateBetween = (rule, value, callback) => {
|
|
@@ -643,7 +662,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
643
662
|
required: parseRequired
|
|
644
663
|
};
|
|
645
664
|
}
|
|
646
|
-
if (
|
|
665
|
+
if (validType === "length" /* LENGTH */) {
|
|
647
666
|
return {
|
|
648
667
|
min: rulesObject.min,
|
|
649
668
|
max: rulesObject.max,
|
|
@@ -652,7 +671,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
652
671
|
required: parseRequired
|
|
653
672
|
};
|
|
654
673
|
}
|
|
655
|
-
if (
|
|
674
|
+
if (validType === "same" /* SAME */) {
|
|
656
675
|
const validateSame = (rule, value, callback) => {
|
|
657
676
|
let isSame = value === rulesObject.value;
|
|
658
677
|
if (!isSame) {
|
|
@@ -671,33 +690,46 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
671
690
|
};
|
|
672
691
|
return res;
|
|
673
692
|
}
|
|
674
|
-
if (
|
|
675
|
-
|
|
676
|
-
return _validValue(rulesObject.value, rulesObject.message, pureValid, rulesObject.reg);
|
|
677
|
-
} else {
|
|
678
|
-
return _validValue(rulesObject, rulesObject.message, pureValid, rulesObject.reg);
|
|
679
|
-
}
|
|
693
|
+
if (validType === "custom" /* CUSTOM */) {
|
|
694
|
+
return _validValue(getPureValue(), rulesObject.message, isPureValid, rulesObject.reg);
|
|
680
695
|
}
|
|
681
|
-
function _validValue(
|
|
682
|
-
if (pureValid2
|
|
683
|
-
return reg.test(
|
|
696
|
+
function _validValue(value, msg, pureValid2, reg) {
|
|
697
|
+
if (pureValid2) {
|
|
698
|
+
return reg.test(value);
|
|
684
699
|
}
|
|
685
|
-
const validatePhone = (rule,
|
|
686
|
-
let validFlag = reg.test(
|
|
700
|
+
const validatePhone = (rule, value2, callback) => {
|
|
701
|
+
let validFlag = reg.test(value2);
|
|
687
702
|
if (!validFlag) {
|
|
688
|
-
callback(new Error(
|
|
703
|
+
callback(new Error(rulesObject.message ?? msg));
|
|
689
704
|
} else {
|
|
690
705
|
callback();
|
|
691
706
|
}
|
|
692
707
|
};
|
|
693
708
|
return {
|
|
694
709
|
validator: validatePhone,
|
|
695
|
-
required:
|
|
710
|
+
required: rulesObject.required ?? true,
|
|
696
711
|
trigger
|
|
697
712
|
};
|
|
698
713
|
}
|
|
699
714
|
return {};
|
|
700
715
|
}
|
|
716
|
+
function normalizeValidateParams(type, rules, pureValid) {
|
|
717
|
+
if (typeof type === "object" && type !== null) {
|
|
718
|
+
const rulesObject = type;
|
|
719
|
+
return {
|
|
720
|
+
type: rulesObject.type || "required" /* REQUIRED */,
|
|
721
|
+
rulesObject,
|
|
722
|
+
rawRules: rulesObject,
|
|
723
|
+
pureValid: typeof rules === "boolean" ? rules : pureValid
|
|
724
|
+
};
|
|
725
|
+
}
|
|
726
|
+
return {
|
|
727
|
+
type,
|
|
728
|
+
rulesObject: typeof rules === "object" && rules !== null ? rules : {},
|
|
729
|
+
rawRules: rules,
|
|
730
|
+
pureValid
|
|
731
|
+
};
|
|
732
|
+
}
|
|
701
733
|
const copy = (text, toastParams = {}) => {
|
|
702
734
|
const textarea = document.createElement("textarea");
|
|
703
735
|
textarea.value = text;
|
|
@@ -782,18 +814,18 @@ function processWidth(initValue, isBase = false) {
|
|
|
782
814
|
}
|
|
783
815
|
return isBase ? res : { width: res };
|
|
784
816
|
}
|
|
785
|
-
function throttle(fn,
|
|
817
|
+
function throttle(fn, delay2 = 1e3) {
|
|
786
818
|
let last = 0;
|
|
787
819
|
let timer = void 0;
|
|
788
820
|
return function(...args) {
|
|
789
821
|
let context = this;
|
|
790
822
|
let now = +/* @__PURE__ */ new Date();
|
|
791
|
-
if (now - last <
|
|
823
|
+
if (now - last < delay2) {
|
|
792
824
|
clearTimeout(timer);
|
|
793
825
|
timer = setTimeout(function() {
|
|
794
826
|
last = now;
|
|
795
827
|
fn.apply(context, args);
|
|
796
|
-
},
|
|
828
|
+
}, delay2);
|
|
797
829
|
} else {
|
|
798
830
|
last = now;
|
|
799
831
|
fn.apply(context, args);
|
|
@@ -818,7 +850,7 @@ async function tryCatch(task, sendLoading) {
|
|
|
818
850
|
updateLoading(false);
|
|
819
851
|
}
|
|
820
852
|
}
|
|
821
|
-
function debounce(func,
|
|
853
|
+
function debounce(func, delay2 = 500, immediate, resultCallback) {
|
|
822
854
|
let timer = null;
|
|
823
855
|
let isInvoke = false;
|
|
824
856
|
const _debounce = function(...args) {
|
|
@@ -844,7 +876,7 @@ function debounce(func, delay = 500, immediate, resultCallback) {
|
|
|
844
876
|
}
|
|
845
877
|
isInvoke = false;
|
|
846
878
|
timer = null;
|
|
847
|
-
},
|
|
879
|
+
}, delay2);
|
|
848
880
|
}
|
|
849
881
|
});
|
|
850
882
|
};
|
|
@@ -946,11 +978,11 @@ function getVariable(propertyName, fallback = "") {
|
|
|
946
978
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
947
979
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
948
980
|
{
|
|
949
|
-
return "2026-
|
|
981
|
+
return "2026-07-02 11:57:59";
|
|
950
982
|
}
|
|
951
983
|
}
|
|
952
984
|
function test() {
|
|
953
985
|
return `build time: ${getUtilsBuildTime()}`;
|
|
954
986
|
}
|
|
955
987
|
|
|
956
|
-
export { $toast as $, formatDurationTime as A, formatImg as B, formatTextToHtml as C, formatThousands as D, formatTime as E, formatToFixed as F, clone as a, confirm as b, clearStorage as c, copy as d, debounce as e,
|
|
988
|
+
export { $toast as $, formatDurationTime as A, formatImg as B, formatTextToHtml as C, formatThousands as D, formatTime as E, formatToFixed as F, clone as a, confirm as b, clearStorage as c, copy as d, debounce as e, delay as f, getStorage as g, getType as h, getUtilsBuildTime as i, getVariable as j, isEmpty as k, log as l, merge as m, mockValue as n, throttle as o, processWidth as p, toLine as q, random as r, setStorage as s, test as t, tryCatch as u, validate as v, validateForm as w, validateOnSubmit as x, formatBytes as y, formatBytesConvert as z };
|
|
@@ -190,7 +190,7 @@ function formatImg(photoName, addPath = "", { basePath = "assets/images" } = {})
|
|
|
190
190
|
const addLastSlash = addPath.endsWith("/") || !addPath ? addPath : `${addPath}/`;
|
|
191
191
|
const addLastBasePathSlash = basePath.endsWith("/") || !basePath ? basePath : `${basePath}/`;
|
|
192
192
|
const mergeSrc = `${addLastSlash}${photoName}`;
|
|
193
|
-
return new URL(`../${addLastBasePathSlash}${mergeSrc}`, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/utils.
|
|
193
|
+
return new URL(`../${addLastBasePathSlash}${mergeSrc}`, (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('shared/utils.D_mBxLLy.cjs', document.baseURI).href))).href;
|
|
194
194
|
}
|
|
195
195
|
function formatToFixed(value, options) {
|
|
196
196
|
if (typeof options === "number") {
|
|
@@ -376,7 +376,7 @@ function clearStorage(str = "") {
|
|
|
376
376
|
function _isObjectWithExclude(obj) {
|
|
377
377
|
return typeof obj === "object" && obj !== null && "exclude" in obj && Array.isArray(obj.exclude);
|
|
378
378
|
}
|
|
379
|
-
function
|
|
379
|
+
function validateForm(ref, { message = "\u8868\u5355\u6821\u9A8C\u9519\u8BEF, \u8BF7\u68C0\u67E5", detail = false, showMessage = true } = {}) {
|
|
380
380
|
return new Promise((resolve, reject) => {
|
|
381
381
|
vue.unref(ref).validate((valid, status) => {
|
|
382
382
|
if (valid) {
|
|
@@ -458,7 +458,7 @@ function clone(data, times = 1) {
|
|
|
458
458
|
}
|
|
459
459
|
return result;
|
|
460
460
|
}
|
|
461
|
-
function
|
|
461
|
+
function mockValue(type = "", length = 4, options = {}) {
|
|
462
462
|
const { emailStr = "@qq.com", timeStr = "{y}-{m}-{d} {h}:{i}:{s}", startStr = "", optionsIndex = null } = options;
|
|
463
463
|
function isRef2(obj) {
|
|
464
464
|
return obj && typeof obj === "object" && obj._isRef === true;
|
|
@@ -490,11 +490,11 @@ function uuid(type = "", length = 4, options = {}) {
|
|
|
490
490
|
return result;
|
|
491
491
|
}
|
|
492
492
|
if (type === "email") {
|
|
493
|
-
result =
|
|
493
|
+
result = mockValue(startStr, length) + emailStr;
|
|
494
494
|
return result;
|
|
495
495
|
}
|
|
496
496
|
if (type === "time") {
|
|
497
|
-
return
|
|
497
|
+
return mockValue(startStr, length, options) + " " + formatTime(/* @__PURE__ */ new Date(), timeStr);
|
|
498
498
|
}
|
|
499
499
|
if (type === "number") {
|
|
500
500
|
const numChars = "123456789";
|
|
@@ -524,23 +524,31 @@ function getType(type) {
|
|
|
524
524
|
return typeof type;
|
|
525
525
|
}
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function delay(delay2 = 0, fn) {
|
|
528
528
|
return new Promise(
|
|
529
529
|
(resolve) => setTimeout(() => {
|
|
530
530
|
fn?.();
|
|
531
531
|
resolve();
|
|
532
|
-
},
|
|
532
|
+
}, delay2)
|
|
533
533
|
);
|
|
534
534
|
}
|
|
535
|
-
function
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
}
|
|
540
|
-
return validate(
|
|
535
|
+
function validateOnSubmit(type = "required", rules = {}, pureValid = false) {
|
|
536
|
+
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
537
|
+
if (normalized.pureValid) {
|
|
538
|
+
return validate(normalized.type, normalized.rawRules, true);
|
|
539
|
+
}
|
|
540
|
+
return validate(
|
|
541
|
+
normalized.type,
|
|
542
|
+
{
|
|
543
|
+
...normalized.rulesObject,
|
|
544
|
+
trigger: normalized.rulesObject.trigger ?? []
|
|
545
|
+
},
|
|
546
|
+
normalized.pureValid
|
|
547
|
+
);
|
|
541
548
|
}
|
|
542
549
|
var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
543
550
|
ValidateType2["REQUIRED"] = "required";
|
|
551
|
+
ValidateType2["CHANGE"] = "change";
|
|
544
552
|
ValidateType2["PASSWORD"] = "password";
|
|
545
553
|
ValidateType2["NUMBER"] = "number";
|
|
546
554
|
ValidateType2["POSITIVE"] = "positive";
|
|
@@ -558,25 +566,31 @@ var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
|
558
566
|
return ValidateType2;
|
|
559
567
|
})(ValidateType || {});
|
|
560
568
|
function validate(type = "required", rules = {}, pureValid = false) {
|
|
561
|
-
const
|
|
562
|
-
|
|
569
|
+
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
570
|
+
const rulesObject = normalized.rulesObject;
|
|
571
|
+
const rawRules = normalized.rawRules;
|
|
572
|
+
const validType = normalized.type;
|
|
573
|
+
const isPureValid = normalized.pureValid;
|
|
574
|
+
const trigger = rulesObject.trigger ?? ["blur", "change"];
|
|
563
575
|
const typeMaps = Object.values(ValidateType);
|
|
564
|
-
|
|
565
|
-
|
|
576
|
+
const parseRequired = rulesObject.required ?? true;
|
|
577
|
+
const defaultRequiredMessage = validType === "change" /* CHANGE */ ? "\u8BF7\u9009\u62E9" : "\u8BF7\u8F93\u5165";
|
|
578
|
+
const getPureValue = () => Object.prototype.hasOwnProperty.call(rulesObject, "value") ? rulesObject.value : rawRules;
|
|
579
|
+
if (!typeMaps.includes(validType)) {
|
|
566
580
|
return {
|
|
567
581
|
required: parseRequired,
|
|
568
|
-
message:
|
|
582
|
+
message: validType,
|
|
569
583
|
trigger
|
|
570
584
|
};
|
|
571
585
|
}
|
|
572
|
-
if (
|
|
586
|
+
if (validType === "required" /* REQUIRED */ || validType === "change" /* CHANGE */) {
|
|
573
587
|
return {
|
|
574
588
|
required: parseRequired,
|
|
575
|
-
message: rulesObject.message ??
|
|
589
|
+
message: rulesObject.message ?? defaultRequiredMessage,
|
|
576
590
|
trigger
|
|
577
591
|
};
|
|
578
592
|
}
|
|
579
|
-
if (
|
|
593
|
+
if (validType === "password" /* PASSWORD */) {
|
|
580
594
|
const validateName = (rule, value, callback) => {
|
|
581
595
|
let validFlag = /^[a-zA-Z0-9_-]+$/.test(value);
|
|
582
596
|
if (!validFlag) {
|
|
@@ -590,41 +604,46 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
590
604
|
trigger
|
|
591
605
|
};
|
|
592
606
|
}
|
|
593
|
-
if (
|
|
594
|
-
return _validValue(
|
|
607
|
+
if (validType === "positive" /* POSITIVE */ || validType === "number" /* NUMBER */) {
|
|
608
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6B63\u6574\u6570", isPureValid, /^[1-9]+\d*$/);
|
|
595
609
|
}
|
|
596
|
-
if (
|
|
597
|
-
return _validValue(
|
|
610
|
+
if (validType === "zeroPositive" /* ZERO_POSITIVE */) {
|
|
611
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u975E\u8D1F\u6574\u6570", isPureValid, /^(0|[1-9]+\d*)$/);
|
|
598
612
|
}
|
|
599
|
-
if (
|
|
600
|
-
return _validValue(
|
|
613
|
+
if (validType === "integer" /* INTEGER */) {
|
|
614
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6574\u6570", isPureValid, /^(0|[-]?[1-9]\d*)$/);
|
|
601
615
|
}
|
|
602
|
-
if (
|
|
603
|
-
return _validValue(
|
|
616
|
+
if (validType === "decimal" /* DECIMAL */) {
|
|
617
|
+
return _validValue(
|
|
618
|
+
getPureValue(),
|
|
619
|
+
"\u8BF7\u8F93\u5165\u975E\u8D1F\u6570\u5B57, \u5305\u542B\u5C0F\u6570\u4E14\u6700\u591A2\u4F4D",
|
|
620
|
+
isPureValid,
|
|
621
|
+
/(0|[1-9]\d*)(\.\d{1, 2})?|0\.\d{1,2}/
|
|
622
|
+
);
|
|
604
623
|
}
|
|
605
|
-
if (
|
|
606
|
-
return _validValue(
|
|
624
|
+
if (validType === "mobile" /* MOBILE */) {
|
|
625
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6B63\u786E\u7684\u624B\u673A\u53F7", isPureValid, /^[1][0-9]{10}$/);
|
|
607
626
|
}
|
|
608
|
-
if (
|
|
609
|
-
return _validValue(
|
|
627
|
+
if (validType === "email" /* EMAIL */) {
|
|
628
|
+
return _validValue(getPureValue(), "\u8BF7\u8F93\u5165\u6B63\u786E\u7684email", isPureValid, /^[^\s@]+@[^\s@]+\.[^\s@]+$/);
|
|
610
629
|
}
|
|
611
|
-
if (
|
|
630
|
+
if (validType === "ip" /* IP */) {
|
|
612
631
|
return _validValue(
|
|
613
|
-
|
|
632
|
+
getPureValue(),
|
|
614
633
|
"\u8BF7\u8F93\u5165\u6B63\u786E\u7684ip\u5730\u5740",
|
|
615
|
-
|
|
634
|
+
isPureValid,
|
|
616
635
|
/^((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/
|
|
617
636
|
);
|
|
618
637
|
}
|
|
619
|
-
if (
|
|
638
|
+
if (validType === "port" /* PORT */) {
|
|
620
639
|
return _validValue(
|
|
621
|
-
|
|
640
|
+
getPureValue(),
|
|
622
641
|
"\u8BF7\u8F93\u51651-65535\u7684\u7AEF\u53E3\u53F7",
|
|
623
|
-
|
|
642
|
+
isPureValid,
|
|
624
643
|
/^([1-9]|[1-9][0-9]{1,3}|[1-5][0-9]{4}|6[0-5][0-5][0-3][0-5])$/
|
|
625
644
|
);
|
|
626
645
|
}
|
|
627
|
-
if (
|
|
646
|
+
if (validType === "between" /* BETWEEN */) {
|
|
628
647
|
let minValue = rulesObject.min ?? "";
|
|
629
648
|
let maxValue = rulesObject.max ?? "";
|
|
630
649
|
const validateBetween = (rule, value, callback) => {
|
|
@@ -646,7 +665,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
646
665
|
required: parseRequired
|
|
647
666
|
};
|
|
648
667
|
}
|
|
649
|
-
if (
|
|
668
|
+
if (validType === "length" /* LENGTH */) {
|
|
650
669
|
return {
|
|
651
670
|
min: rulesObject.min,
|
|
652
671
|
max: rulesObject.max,
|
|
@@ -655,7 +674,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
655
674
|
required: parseRequired
|
|
656
675
|
};
|
|
657
676
|
}
|
|
658
|
-
if (
|
|
677
|
+
if (validType === "same" /* SAME */) {
|
|
659
678
|
const validateSame = (rule, value, callback) => {
|
|
660
679
|
let isSame = value === rulesObject.value;
|
|
661
680
|
if (!isSame) {
|
|
@@ -674,33 +693,46 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
674
693
|
};
|
|
675
694
|
return res;
|
|
676
695
|
}
|
|
677
|
-
if (
|
|
678
|
-
|
|
679
|
-
return _validValue(rulesObject.value, rulesObject.message, pureValid, rulesObject.reg);
|
|
680
|
-
} else {
|
|
681
|
-
return _validValue(rulesObject, rulesObject.message, pureValid, rulesObject.reg);
|
|
682
|
-
}
|
|
696
|
+
if (validType === "custom" /* CUSTOM */) {
|
|
697
|
+
return _validValue(getPureValue(), rulesObject.message, isPureValid, rulesObject.reg);
|
|
683
698
|
}
|
|
684
|
-
function _validValue(
|
|
685
|
-
if (pureValid2
|
|
686
|
-
return reg.test(
|
|
699
|
+
function _validValue(value, msg, pureValid2, reg) {
|
|
700
|
+
if (pureValid2) {
|
|
701
|
+
return reg.test(value);
|
|
687
702
|
}
|
|
688
|
-
const validatePhone = (rule,
|
|
689
|
-
let validFlag = reg.test(
|
|
703
|
+
const validatePhone = (rule, value2, callback) => {
|
|
704
|
+
let validFlag = reg.test(value2);
|
|
690
705
|
if (!validFlag) {
|
|
691
|
-
callback(new Error(
|
|
706
|
+
callback(new Error(rulesObject.message ?? msg));
|
|
692
707
|
} else {
|
|
693
708
|
callback();
|
|
694
709
|
}
|
|
695
710
|
};
|
|
696
711
|
return {
|
|
697
712
|
validator: validatePhone,
|
|
698
|
-
required:
|
|
713
|
+
required: rulesObject.required ?? true,
|
|
699
714
|
trigger
|
|
700
715
|
};
|
|
701
716
|
}
|
|
702
717
|
return {};
|
|
703
718
|
}
|
|
719
|
+
function normalizeValidateParams(type, rules, pureValid) {
|
|
720
|
+
if (typeof type === "object" && type !== null) {
|
|
721
|
+
const rulesObject = type;
|
|
722
|
+
return {
|
|
723
|
+
type: rulesObject.type || "required" /* REQUIRED */,
|
|
724
|
+
rulesObject,
|
|
725
|
+
rawRules: rulesObject,
|
|
726
|
+
pureValid: typeof rules === "boolean" ? rules : pureValid
|
|
727
|
+
};
|
|
728
|
+
}
|
|
729
|
+
return {
|
|
730
|
+
type,
|
|
731
|
+
rulesObject: typeof rules === "object" && rules !== null ? rules : {},
|
|
732
|
+
rawRules: rules,
|
|
733
|
+
pureValid
|
|
734
|
+
};
|
|
735
|
+
}
|
|
704
736
|
const copy = (text, toastParams = {}) => {
|
|
705
737
|
const textarea = document.createElement("textarea");
|
|
706
738
|
textarea.value = text;
|
|
@@ -785,18 +817,18 @@ function processWidth(initValue, isBase = false) {
|
|
|
785
817
|
}
|
|
786
818
|
return isBase ? res : { width: res };
|
|
787
819
|
}
|
|
788
|
-
function throttle(fn,
|
|
820
|
+
function throttle(fn, delay2 = 1e3) {
|
|
789
821
|
let last = 0;
|
|
790
822
|
let timer = void 0;
|
|
791
823
|
return function(...args) {
|
|
792
824
|
let context = this;
|
|
793
825
|
let now = +/* @__PURE__ */ new Date();
|
|
794
|
-
if (now - last <
|
|
826
|
+
if (now - last < delay2) {
|
|
795
827
|
clearTimeout(timer);
|
|
796
828
|
timer = setTimeout(function() {
|
|
797
829
|
last = now;
|
|
798
830
|
fn.apply(context, args);
|
|
799
|
-
},
|
|
831
|
+
}, delay2);
|
|
800
832
|
} else {
|
|
801
833
|
last = now;
|
|
802
834
|
fn.apply(context, args);
|
|
@@ -821,7 +853,7 @@ async function tryCatch(task, sendLoading) {
|
|
|
821
853
|
updateLoading(false);
|
|
822
854
|
}
|
|
823
855
|
}
|
|
824
|
-
function debounce(func,
|
|
856
|
+
function debounce(func, delay2 = 500, immediate, resultCallback) {
|
|
825
857
|
let timer = null;
|
|
826
858
|
let isInvoke = false;
|
|
827
859
|
const _debounce = function(...args) {
|
|
@@ -847,7 +879,7 @@ function debounce(func, delay = 500, immediate, resultCallback) {
|
|
|
847
879
|
}
|
|
848
880
|
isInvoke = false;
|
|
849
881
|
timer = null;
|
|
850
|
-
},
|
|
882
|
+
}, delay2);
|
|
851
883
|
}
|
|
852
884
|
});
|
|
853
885
|
};
|
|
@@ -949,7 +981,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
949
981
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
950
982
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
951
983
|
{
|
|
952
|
-
return "2026-
|
|
984
|
+
return "2026-07-02 11:57:59";
|
|
953
985
|
}
|
|
954
986
|
}
|
|
955
987
|
function test() {
|
|
@@ -962,6 +994,7 @@ exports.clone = clone;
|
|
|
962
994
|
exports.confirm = confirm;
|
|
963
995
|
exports.copy = copy;
|
|
964
996
|
exports.debounce = debounce;
|
|
997
|
+
exports.delay = delay;
|
|
965
998
|
exports.formatBytes = formatBytes;
|
|
966
999
|
exports.formatBytesConvert = formatBytesConvert;
|
|
967
1000
|
exports.formatDurationTime = formatDurationTime;
|
|
@@ -977,15 +1010,14 @@ exports.getVariable = getVariable;
|
|
|
977
1010
|
exports.isEmpty = isEmpty;
|
|
978
1011
|
exports.log = log;
|
|
979
1012
|
exports.merge = merge;
|
|
1013
|
+
exports.mockValue = mockValue;
|
|
980
1014
|
exports.processWidth = processWidth;
|
|
981
1015
|
exports.random = random;
|
|
982
1016
|
exports.setStorage = setStorage;
|
|
983
|
-
exports.sleep = sleep;
|
|
984
1017
|
exports.test = test;
|
|
985
1018
|
exports.throttle = throttle;
|
|
986
1019
|
exports.toLine = toLine;
|
|
987
1020
|
exports.tryCatch = tryCatch;
|
|
988
|
-
exports.uuid = uuid;
|
|
989
|
-
exports.validForm = validForm;
|
|
990
1021
|
exports.validate = validate;
|
|
991
|
-
exports.
|
|
1022
|
+
exports.validateForm = validateForm;
|
|
1023
|
+
exports.validateOnSubmit = validateOnSubmit;
|