@sybz-components/utils 0.0.11 → 1.0.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.
- package/dist/base.cjs +1 -1
- package/dist/base.d.cts +38 -3
- package/dist/base.d.mts +38 -3
- package/dist/base.d.ts +38 -3
- package/dist/base.mjs +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.mjs +1 -1
- package/dist/index.cjs +1 -11
- package/dist/index.d.cts +0 -3
- package/dist/index.d.mts +0 -3
- package/dist/index.d.ts +0 -3
- package/dist/index.mjs +1 -5
- package/dist/shared/{utils.CCqAduBt.mjs → utils.BEyMaMZg.mjs} +82 -16
- package/dist/shared/{utils.D_mBxLLy.cjs → utils.aC91nrkh.cjs} +83 -17
- package/package.json +3 -4
- package/dist/day.cjs +0 -41
- package/dist/day.d.cts +0 -81
- package/dist/day.d.mts +0 -81
- package/dist/day.d.ts +0 -81
- package/dist/day.mjs +0 -31
- package/dist/ws.cjs +0 -175
- package/dist/ws.d.cts +0 -165
- package/dist/ws.d.mts +0 -165
- package/dist/ws.d.ts +0 -165
- package/dist/ws.mjs +0 -169
package/dist/base.cjs
CHANGED
package/dist/base.d.cts
CHANGED
|
@@ -120,7 +120,7 @@ interface ConfirmOptions extends ElMessageBoxOptions {
|
|
|
120
120
|
/**
|
|
121
121
|
* 确认框主题。
|
|
122
122
|
*/
|
|
123
|
-
theme?: '' | 'chenghua';
|
|
123
|
+
theme?: 'default' | 'chenghua' | 'shijingshan';
|
|
124
124
|
/**
|
|
125
125
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
126
126
|
*/
|
|
@@ -455,19 +455,47 @@ declare function toLine(text: string, connect?: string): string;
|
|
|
455
455
|
*/
|
|
456
456
|
declare function processWidth(initValue: WidthInput, isBase: true): string;
|
|
457
457
|
declare function processWidth(initValue: WidthInput, isBase?: false): WidthStyleResult | {};
|
|
458
|
+
interface ThrottleOptions {
|
|
459
|
+
/**
|
|
460
|
+
* 是否在首次调用时立即执行,默认 `true`。
|
|
461
|
+
*/
|
|
462
|
+
leading?: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* 是否在节流周期结束时执行最后一次调用,默认 `true`。
|
|
465
|
+
*/
|
|
466
|
+
trailing?: boolean;
|
|
467
|
+
}
|
|
468
|
+
type ThrottleOptionsInput = boolean | ThrottleOptions;
|
|
469
|
+
type ThrottledFunction<T extends Func> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {
|
|
470
|
+
cancel: () => void;
|
|
471
|
+
flush: () => ReturnType<T> | undefined;
|
|
472
|
+
};
|
|
458
473
|
/**
|
|
459
474
|
* 创建节流函数。
|
|
460
475
|
*
|
|
461
476
|
* @param fn 需要节流执行的函数。
|
|
462
477
|
* @param delay 节流间隔,单位毫秒,默认 `1000`。
|
|
463
|
-
* @
|
|
478
|
+
* @param options 节流选项。传 `false` 等同于 `{ leading: false }`。
|
|
479
|
+
* @param resultCallback 每次真正执行后触发的结果回调。
|
|
480
|
+
* @returns 带 `cancel()` / `flush()` 方法的节流函数。
|
|
464
481
|
*
|
|
465
482
|
* @example
|
|
466
483
|
* const onResize = throttle(() => {
|
|
467
484
|
* console.log('resize')
|
|
468
485
|
* }, 300)
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* const save = throttle(saveDraft, 1000, { leading: false, trailing: true })
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* const track = throttle(trackPosition, 200, { trailing: false }, (result) => {
|
|
492
|
+
* console.log(result)
|
|
493
|
+
* })
|
|
494
|
+
*
|
|
495
|
+
* track.cancel()
|
|
496
|
+
* track.flush()
|
|
469
497
|
*/
|
|
470
|
-
declare function throttle<T extends Func>(fn: T, delay?: number
|
|
498
|
+
declare function throttle<T extends Func>(fn: T, delay?: number, options?: ThrottleOptionsInput, resultCallback?: (result: ReturnType<T>) => void): ThrottledFunction<T>;
|
|
471
499
|
/**
|
|
472
500
|
* 统一处理 Promise 或任务函数执行结果。
|
|
473
501
|
*
|
|
@@ -513,6 +541,13 @@ type DebouncedFunction<T extends Func> = ((...args: Parameters<T>) => Promise<Aw
|
|
|
513
541
|
* }, 300)
|
|
514
542
|
*
|
|
515
543
|
* await search('sybz')
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* const submit = debounce(saveForm, 500, true, (result) => {
|
|
547
|
+
* console.log(result)
|
|
548
|
+
* })
|
|
549
|
+
*
|
|
550
|
+
* submit.cancel()
|
|
516
551
|
*/
|
|
517
552
|
declare function debounce<T extends Func>(func: T, delay?: number, immediate?: boolean, resultCallback?: (result: ReturnType<T>) => void): DebouncedFunction<T>;
|
|
518
553
|
/**
|
package/dist/base.d.mts
CHANGED
|
@@ -120,7 +120,7 @@ interface ConfirmOptions extends ElMessageBoxOptions {
|
|
|
120
120
|
/**
|
|
121
121
|
* 确认框主题。
|
|
122
122
|
*/
|
|
123
|
-
theme?: '' | 'chenghua';
|
|
123
|
+
theme?: 'default' | 'chenghua' | 'shijingshan';
|
|
124
124
|
/**
|
|
125
125
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
126
126
|
*/
|
|
@@ -455,19 +455,47 @@ declare function toLine(text: string, connect?: string): string;
|
|
|
455
455
|
*/
|
|
456
456
|
declare function processWidth(initValue: WidthInput, isBase: true): string;
|
|
457
457
|
declare function processWidth(initValue: WidthInput, isBase?: false): WidthStyleResult | {};
|
|
458
|
+
interface ThrottleOptions {
|
|
459
|
+
/**
|
|
460
|
+
* 是否在首次调用时立即执行,默认 `true`。
|
|
461
|
+
*/
|
|
462
|
+
leading?: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* 是否在节流周期结束时执行最后一次调用,默认 `true`。
|
|
465
|
+
*/
|
|
466
|
+
trailing?: boolean;
|
|
467
|
+
}
|
|
468
|
+
type ThrottleOptionsInput = boolean | ThrottleOptions;
|
|
469
|
+
type ThrottledFunction<T extends Func> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {
|
|
470
|
+
cancel: () => void;
|
|
471
|
+
flush: () => ReturnType<T> | undefined;
|
|
472
|
+
};
|
|
458
473
|
/**
|
|
459
474
|
* 创建节流函数。
|
|
460
475
|
*
|
|
461
476
|
* @param fn 需要节流执行的函数。
|
|
462
477
|
* @param delay 节流间隔,单位毫秒,默认 `1000`。
|
|
463
|
-
* @
|
|
478
|
+
* @param options 节流选项。传 `false` 等同于 `{ leading: false }`。
|
|
479
|
+
* @param resultCallback 每次真正执行后触发的结果回调。
|
|
480
|
+
* @returns 带 `cancel()` / `flush()` 方法的节流函数。
|
|
464
481
|
*
|
|
465
482
|
* @example
|
|
466
483
|
* const onResize = throttle(() => {
|
|
467
484
|
* console.log('resize')
|
|
468
485
|
* }, 300)
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* const save = throttle(saveDraft, 1000, { leading: false, trailing: true })
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* const track = throttle(trackPosition, 200, { trailing: false }, (result) => {
|
|
492
|
+
* console.log(result)
|
|
493
|
+
* })
|
|
494
|
+
*
|
|
495
|
+
* track.cancel()
|
|
496
|
+
* track.flush()
|
|
469
497
|
*/
|
|
470
|
-
declare function throttle<T extends Func>(fn: T, delay?: number
|
|
498
|
+
declare function throttle<T extends Func>(fn: T, delay?: number, options?: ThrottleOptionsInput, resultCallback?: (result: ReturnType<T>) => void): ThrottledFunction<T>;
|
|
471
499
|
/**
|
|
472
500
|
* 统一处理 Promise 或任务函数执行结果。
|
|
473
501
|
*
|
|
@@ -513,6 +541,13 @@ type DebouncedFunction<T extends Func> = ((...args: Parameters<T>) => Promise<Aw
|
|
|
513
541
|
* }, 300)
|
|
514
542
|
*
|
|
515
543
|
* await search('sybz')
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* const submit = debounce(saveForm, 500, true, (result) => {
|
|
547
|
+
* console.log(result)
|
|
548
|
+
* })
|
|
549
|
+
*
|
|
550
|
+
* submit.cancel()
|
|
516
551
|
*/
|
|
517
552
|
declare function debounce<T extends Func>(func: T, delay?: number, immediate?: boolean, resultCallback?: (result: ReturnType<T>) => void): DebouncedFunction<T>;
|
|
518
553
|
/**
|
package/dist/base.d.ts
CHANGED
|
@@ -120,7 +120,7 @@ interface ConfirmOptions extends ElMessageBoxOptions {
|
|
|
120
120
|
/**
|
|
121
121
|
* 确认框主题。
|
|
122
122
|
*/
|
|
123
|
-
theme?: '' | 'chenghua';
|
|
123
|
+
theme?: 'default' | 'chenghua' | 'shijingshan';
|
|
124
124
|
/**
|
|
125
125
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
126
126
|
*/
|
|
@@ -455,19 +455,47 @@ declare function toLine(text: string, connect?: string): string;
|
|
|
455
455
|
*/
|
|
456
456
|
declare function processWidth(initValue: WidthInput, isBase: true): string;
|
|
457
457
|
declare function processWidth(initValue: WidthInput, isBase?: false): WidthStyleResult | {};
|
|
458
|
+
interface ThrottleOptions {
|
|
459
|
+
/**
|
|
460
|
+
* 是否在首次调用时立即执行,默认 `true`。
|
|
461
|
+
*/
|
|
462
|
+
leading?: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* 是否在节流周期结束时执行最后一次调用,默认 `true`。
|
|
465
|
+
*/
|
|
466
|
+
trailing?: boolean;
|
|
467
|
+
}
|
|
468
|
+
type ThrottleOptionsInput = boolean | ThrottleOptions;
|
|
469
|
+
type ThrottledFunction<T extends Func> = ((...args: Parameters<T>) => ReturnType<T> | undefined) & {
|
|
470
|
+
cancel: () => void;
|
|
471
|
+
flush: () => ReturnType<T> | undefined;
|
|
472
|
+
};
|
|
458
473
|
/**
|
|
459
474
|
* 创建节流函数。
|
|
460
475
|
*
|
|
461
476
|
* @param fn 需要节流执行的函数。
|
|
462
477
|
* @param delay 节流间隔,单位毫秒,默认 `1000`。
|
|
463
|
-
* @
|
|
478
|
+
* @param options 节流选项。传 `false` 等同于 `{ leading: false }`。
|
|
479
|
+
* @param resultCallback 每次真正执行后触发的结果回调。
|
|
480
|
+
* @returns 带 `cancel()` / `flush()` 方法的节流函数。
|
|
464
481
|
*
|
|
465
482
|
* @example
|
|
466
483
|
* const onResize = throttle(() => {
|
|
467
484
|
* console.log('resize')
|
|
468
485
|
* }, 300)
|
|
486
|
+
*
|
|
487
|
+
* @example
|
|
488
|
+
* const save = throttle(saveDraft, 1000, { leading: false, trailing: true })
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* const track = throttle(trackPosition, 200, { trailing: false }, (result) => {
|
|
492
|
+
* console.log(result)
|
|
493
|
+
* })
|
|
494
|
+
*
|
|
495
|
+
* track.cancel()
|
|
496
|
+
* track.flush()
|
|
469
497
|
*/
|
|
470
|
-
declare function throttle<T extends Func>(fn: T, delay?: number
|
|
498
|
+
declare function throttle<T extends Func>(fn: T, delay?: number, options?: ThrottleOptionsInput, resultCallback?: (result: ReturnType<T>) => void): ThrottledFunction<T>;
|
|
471
499
|
/**
|
|
472
500
|
* 统一处理 Promise 或任务函数执行结果。
|
|
473
501
|
*
|
|
@@ -513,6 +541,13 @@ type DebouncedFunction<T extends Func> = ((...args: Parameters<T>) => Promise<Aw
|
|
|
513
541
|
* }, 300)
|
|
514
542
|
*
|
|
515
543
|
* await search('sybz')
|
|
544
|
+
*
|
|
545
|
+
* @example
|
|
546
|
+
* const submit = debounce(saveForm, 500, true, (result) => {
|
|
547
|
+
* console.log(result)
|
|
548
|
+
* })
|
|
549
|
+
*
|
|
550
|
+
* submit.cancel()
|
|
516
551
|
*/
|
|
517
552
|
declare function debounce<T extends Func>(func: T, delay?: number, immediate?: boolean, resultCallback?: (result: ReturnType<T>) => void): DebouncedFunction<T>;
|
|
518
553
|
/**
|
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, 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.
|
|
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.BEyMaMZg.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.BEyMaMZg.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
package/dist/index.cjs
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const format = require('./shared/utils.
|
|
4
|
-
const day = require('./day.cjs');
|
|
3
|
+
const format = require('./shared/utils.aC91nrkh.cjs');
|
|
5
4
|
const is = require('./is.cjs');
|
|
6
|
-
const ws = require('./ws.cjs');
|
|
7
5
|
require('vue');
|
|
8
6
|
require('consola');
|
|
9
7
|
require('es-toolkit');
|
|
10
8
|
require('element-plus');
|
|
11
|
-
require('dayjs');
|
|
12
|
-
require('qs');
|
|
13
9
|
|
|
14
10
|
|
|
15
11
|
|
|
@@ -46,11 +42,6 @@ exports.tryCatch = format.tryCatch;
|
|
|
46
42
|
exports.validate = format.validate;
|
|
47
43
|
exports.validateForm = format.validateForm;
|
|
48
44
|
exports.validateOnSubmit = format.validateOnSubmit;
|
|
49
|
-
exports.diffDate = day.diffDate;
|
|
50
|
-
exports.diffDateFromCurrent = day.diffDateFromCurrent;
|
|
51
|
-
exports.formatDate = day.formatDate;
|
|
52
|
-
exports.formatDateToDay = day.formatDateToDay;
|
|
53
|
-
exports.formatDateToMinute = day.formatDateToMinute;
|
|
54
45
|
exports.isArray = is.isArray;
|
|
55
46
|
exports.isBoolean = is.isBoolean;
|
|
56
47
|
exports.isComponent = is.isComponent;
|
|
@@ -73,4 +64,3 @@ exports.isUrl = is.isUrl;
|
|
|
73
64
|
exports.objectToString = is.objectToString;
|
|
74
65
|
exports.toRawType = is.toRawType;
|
|
75
66
|
exports.toTypeString = is.toTypeString;
|
|
76
|
-
exports.WS = ws.WS;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
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
|
-
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.cjs';
|
|
3
2
|
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
|
-
export { WS, WSAutoReconnectOptions, WSHeartbeatOptions, WSOptions } from './ws.cjs';
|
|
5
3
|
export { FormatBytesConvertOptions, FormatBytesOptions, FormatImgOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.cjs';
|
|
6
4
|
import 'element-plus';
|
|
7
5
|
import 'vue';
|
|
8
|
-
import 'dayjs';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
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
|
-
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.mjs';
|
|
3
2
|
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
|
-
export { WS, WSAutoReconnectOptions, WSHeartbeatOptions, WSOptions } from './ws.mjs';
|
|
5
3
|
export { FormatBytesConvertOptions, FormatBytesOptions, FormatImgOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.mjs';
|
|
6
4
|
import 'element-plus';
|
|
7
5
|
import 'vue';
|
|
8
|
-
import 'dayjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
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
|
-
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.js';
|
|
3
2
|
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
|
-
export { WS, WSAutoReconnectOptions, WSHeartbeatOptions, WSOptions } from './ws.js';
|
|
5
3
|
export { FormatBytesConvertOptions, FormatBytesOptions, FormatImgOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatImg, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.js';
|
|
6
4
|
import 'element-plus';
|
|
7
5
|
import 'vue';
|
|
8
|
-
import 'dayjs';
|
package/dist/index.mjs
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
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.
|
|
2
|
-
export { diffDate, diffDateFromCurrent, formatDate, formatDateToDay, formatDateToMinute } from './day.mjs';
|
|
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.BEyMaMZg.mjs';
|
|
3
2
|
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
|
-
export { WS } from './ws.mjs';
|
|
5
3
|
import 'vue';
|
|
6
4
|
import 'consola';
|
|
7
5
|
import 'es-toolkit';
|
|
8
6
|
import 'element-plus';
|
|
9
|
-
import 'dayjs';
|
|
10
|
-
import 'qs';
|
|
@@ -234,6 +234,9 @@ const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
|
|
|
234
234
|
const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
|
|
235
235
|
const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
|
|
236
236
|
const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
|
|
237
|
+
const SHIJINGSHAN_CONFIRM_BOX_CLASS = "s-message-box--shijingshan";
|
|
238
|
+
const SHIJINGSHAN_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--shijingshan";
|
|
239
|
+
const SHIJINGSHAN_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--shijingshan";
|
|
237
240
|
function _getBrowserStorage(isSession = false) {
|
|
238
241
|
if (typeof window === "undefined") {
|
|
239
242
|
return null;
|
|
@@ -800,7 +803,7 @@ function toLine(text, connect = "-") {
|
|
|
800
803
|
const _CSS_UNIT_RE = /^[0-9]+(\.[0-9]+)?(px|%|em|rem|vw|vh|ch)$/;
|
|
801
804
|
function processWidth(initValue, isBase = false) {
|
|
802
805
|
const raw = unref(initValue);
|
|
803
|
-
if (
|
|
806
|
+
if (raw === void 0 || raw === null || raw === "") {
|
|
804
807
|
return isBase ? "" : {};
|
|
805
808
|
}
|
|
806
809
|
const str = typeof raw === "number" ? `${raw}` : raw;
|
|
@@ -814,23 +817,79 @@ function processWidth(initValue, isBase = false) {
|
|
|
814
817
|
}
|
|
815
818
|
return isBase ? res : { width: res };
|
|
816
819
|
}
|
|
817
|
-
|
|
818
|
-
|
|
820
|
+
const normalizeThrottleOptions = (options = {}) => {
|
|
821
|
+
const normalized = typeof options === "boolean" ? { leading: options } : options;
|
|
822
|
+
return {
|
|
823
|
+
leading: normalized.leading !== false,
|
|
824
|
+
trailing: normalized.trailing !== false
|
|
825
|
+
};
|
|
826
|
+
};
|
|
827
|
+
function throttle(fn, delay2 = 1e3, options = {}, resultCallback) {
|
|
828
|
+
const { leading, trailing } = normalizeThrottleOptions(options);
|
|
819
829
|
let timer = void 0;
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
830
|
+
let previous;
|
|
831
|
+
let lastArgs;
|
|
832
|
+
let lastThis;
|
|
833
|
+
let result;
|
|
834
|
+
const cancel = () => {
|
|
835
|
+
if (timer) {
|
|
824
836
|
clearTimeout(timer);
|
|
825
|
-
timer =
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
837
|
+
timer = void 0;
|
|
838
|
+
}
|
|
839
|
+
previous = void 0;
|
|
840
|
+
lastArgs = void 0;
|
|
841
|
+
lastThis = void 0;
|
|
842
|
+
};
|
|
843
|
+
const invoke = () => {
|
|
844
|
+
if (!lastArgs) return result;
|
|
845
|
+
previous = Date.now();
|
|
846
|
+
const args = lastArgs;
|
|
847
|
+
const context = lastThis;
|
|
848
|
+
lastArgs = void 0;
|
|
849
|
+
lastThis = void 0;
|
|
850
|
+
result = fn.apply(context, args);
|
|
851
|
+
resultCallback?.(result);
|
|
852
|
+
return result;
|
|
853
|
+
};
|
|
854
|
+
const flush = () => {
|
|
855
|
+
if (timer) {
|
|
856
|
+
clearTimeout(timer);
|
|
857
|
+
timer = void 0;
|
|
832
858
|
}
|
|
859
|
+
return invoke();
|
|
833
860
|
};
|
|
861
|
+
const throttled = function(...args) {
|
|
862
|
+
const now = Date.now();
|
|
863
|
+
lastArgs = args;
|
|
864
|
+
lastThis = this;
|
|
865
|
+
if (previous === void 0) {
|
|
866
|
+
if (leading) {
|
|
867
|
+
return invoke();
|
|
868
|
+
}
|
|
869
|
+
previous = now;
|
|
870
|
+
}
|
|
871
|
+
const remaining = delay2 - (now - previous);
|
|
872
|
+
if (remaining <= 0 || remaining > delay2) {
|
|
873
|
+
if (timer) {
|
|
874
|
+
clearTimeout(timer);
|
|
875
|
+
timer = void 0;
|
|
876
|
+
}
|
|
877
|
+
return invoke();
|
|
878
|
+
}
|
|
879
|
+
if (!timer && trailing) {
|
|
880
|
+
timer = setTimeout(() => {
|
|
881
|
+
timer = void 0;
|
|
882
|
+
if (!leading) {
|
|
883
|
+
previous = void 0;
|
|
884
|
+
}
|
|
885
|
+
invoke();
|
|
886
|
+
}, remaining);
|
|
887
|
+
}
|
|
888
|
+
return result;
|
|
889
|
+
};
|
|
890
|
+
throttled.cancel = cancel;
|
|
891
|
+
throttled.flush = flush;
|
|
892
|
+
return throttled;
|
|
834
893
|
}
|
|
835
894
|
async function tryCatch(task, sendLoading) {
|
|
836
895
|
const updateLoading = (value) => {
|
|
@@ -901,6 +960,7 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
901
960
|
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
902
961
|
const resolvedAppContext = _resolveAppContext(optionAppContext || appContext);
|
|
903
962
|
const isChenghuaTheme = theme === "chenghua";
|
|
963
|
+
const isShijingshanTheme = theme === "shijingshan";
|
|
904
964
|
const mergeOptions = {
|
|
905
965
|
title: "\u63D0\u793A",
|
|
906
966
|
draggable: true,
|
|
@@ -911,15 +971,21 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
911
971
|
...messageBoxOptions,
|
|
912
972
|
appendTo: resolvedAppendTo,
|
|
913
973
|
appContext: resolvedAppContext,
|
|
914
|
-
customClass: _mergeClassNames(
|
|
974
|
+
customClass: _mergeClassNames(
|
|
975
|
+
isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
|
|
976
|
+
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
|
|
977
|
+
customClass
|
|
978
|
+
),
|
|
915
979
|
confirmButtonClass: _mergeClassNames(
|
|
916
980
|
DEFAULT_CONFIRM_BUTTON_CLASS,
|
|
917
981
|
isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
|
|
982
|
+
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BUTTON_CLASS,
|
|
918
983
|
confirmButtonClass
|
|
919
984
|
),
|
|
920
985
|
cancelButtonClass: _mergeClassNames(
|
|
921
986
|
DEFAULT_CANCEL_BUTTON_CLASS,
|
|
922
987
|
isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
|
|
988
|
+
isShijingshanTheme && SHIJINGSHAN_CANCEL_BUTTON_CLASS,
|
|
923
989
|
cancelButtonClass
|
|
924
990
|
)
|
|
925
991
|
};
|
|
@@ -978,7 +1044,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
978
1044
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
979
1045
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
980
1046
|
{
|
|
981
|
-
return "2026-07-
|
|
1047
|
+
return "2026-07-08 15:30:00";
|
|
982
1048
|
}
|
|
983
1049
|
}
|
|
984
1050
|
function test() {
|
|
@@ -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.aC91nrkh.cjs', document.baseURI).href))).href;
|
|
194
194
|
}
|
|
195
195
|
function formatToFixed(value, options) {
|
|
196
196
|
if (typeof options === "number") {
|
|
@@ -237,6 +237,9 @@ const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
|
|
|
237
237
|
const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
|
|
238
238
|
const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
|
|
239
239
|
const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
|
|
240
|
+
const SHIJINGSHAN_CONFIRM_BOX_CLASS = "s-message-box--shijingshan";
|
|
241
|
+
const SHIJINGSHAN_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--shijingshan";
|
|
242
|
+
const SHIJINGSHAN_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--shijingshan";
|
|
240
243
|
function _getBrowserStorage(isSession = false) {
|
|
241
244
|
if (typeof window === "undefined") {
|
|
242
245
|
return null;
|
|
@@ -803,7 +806,7 @@ function toLine(text, connect = "-") {
|
|
|
803
806
|
const _CSS_UNIT_RE = /^[0-9]+(\.[0-9]+)?(px|%|em|rem|vw|vh|ch)$/;
|
|
804
807
|
function processWidth(initValue, isBase = false) {
|
|
805
808
|
const raw = vue.unref(initValue);
|
|
806
|
-
if (
|
|
809
|
+
if (raw === void 0 || raw === null || raw === "") {
|
|
807
810
|
return isBase ? "" : {};
|
|
808
811
|
}
|
|
809
812
|
const str = typeof raw === "number" ? `${raw}` : raw;
|
|
@@ -817,23 +820,79 @@ function processWidth(initValue, isBase = false) {
|
|
|
817
820
|
}
|
|
818
821
|
return isBase ? res : { width: res };
|
|
819
822
|
}
|
|
820
|
-
|
|
821
|
-
|
|
823
|
+
const normalizeThrottleOptions = (options = {}) => {
|
|
824
|
+
const normalized = typeof options === "boolean" ? { leading: options } : options;
|
|
825
|
+
return {
|
|
826
|
+
leading: normalized.leading !== false,
|
|
827
|
+
trailing: normalized.trailing !== false
|
|
828
|
+
};
|
|
829
|
+
};
|
|
830
|
+
function throttle(fn, delay2 = 1e3, options = {}, resultCallback) {
|
|
831
|
+
const { leading, trailing } = normalizeThrottleOptions(options);
|
|
822
832
|
let timer = void 0;
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
833
|
+
let previous;
|
|
834
|
+
let lastArgs;
|
|
835
|
+
let lastThis;
|
|
836
|
+
let result;
|
|
837
|
+
const cancel = () => {
|
|
838
|
+
if (timer) {
|
|
827
839
|
clearTimeout(timer);
|
|
828
|
-
timer =
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
840
|
+
timer = void 0;
|
|
841
|
+
}
|
|
842
|
+
previous = void 0;
|
|
843
|
+
lastArgs = void 0;
|
|
844
|
+
lastThis = void 0;
|
|
845
|
+
};
|
|
846
|
+
const invoke = () => {
|
|
847
|
+
if (!lastArgs) return result;
|
|
848
|
+
previous = Date.now();
|
|
849
|
+
const args = lastArgs;
|
|
850
|
+
const context = lastThis;
|
|
851
|
+
lastArgs = void 0;
|
|
852
|
+
lastThis = void 0;
|
|
853
|
+
result = fn.apply(context, args);
|
|
854
|
+
resultCallback?.(result);
|
|
855
|
+
return result;
|
|
856
|
+
};
|
|
857
|
+
const flush = () => {
|
|
858
|
+
if (timer) {
|
|
859
|
+
clearTimeout(timer);
|
|
860
|
+
timer = void 0;
|
|
835
861
|
}
|
|
862
|
+
return invoke();
|
|
836
863
|
};
|
|
864
|
+
const throttled = function(...args) {
|
|
865
|
+
const now = Date.now();
|
|
866
|
+
lastArgs = args;
|
|
867
|
+
lastThis = this;
|
|
868
|
+
if (previous === void 0) {
|
|
869
|
+
if (leading) {
|
|
870
|
+
return invoke();
|
|
871
|
+
}
|
|
872
|
+
previous = now;
|
|
873
|
+
}
|
|
874
|
+
const remaining = delay2 - (now - previous);
|
|
875
|
+
if (remaining <= 0 || remaining > delay2) {
|
|
876
|
+
if (timer) {
|
|
877
|
+
clearTimeout(timer);
|
|
878
|
+
timer = void 0;
|
|
879
|
+
}
|
|
880
|
+
return invoke();
|
|
881
|
+
}
|
|
882
|
+
if (!timer && trailing) {
|
|
883
|
+
timer = setTimeout(() => {
|
|
884
|
+
timer = void 0;
|
|
885
|
+
if (!leading) {
|
|
886
|
+
previous = void 0;
|
|
887
|
+
}
|
|
888
|
+
invoke();
|
|
889
|
+
}, remaining);
|
|
890
|
+
}
|
|
891
|
+
return result;
|
|
892
|
+
};
|
|
893
|
+
throttled.cancel = cancel;
|
|
894
|
+
throttled.flush = flush;
|
|
895
|
+
return throttled;
|
|
837
896
|
}
|
|
838
897
|
async function tryCatch(task, sendLoading) {
|
|
839
898
|
const updateLoading = (value) => {
|
|
@@ -904,6 +963,7 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
904
963
|
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
905
964
|
const resolvedAppContext = _resolveAppContext(optionAppContext || appContext);
|
|
906
965
|
const isChenghuaTheme = theme === "chenghua";
|
|
966
|
+
const isShijingshanTheme = theme === "shijingshan";
|
|
907
967
|
const mergeOptions = {
|
|
908
968
|
title: "\u63D0\u793A",
|
|
909
969
|
draggable: true,
|
|
@@ -914,15 +974,21 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
914
974
|
...messageBoxOptions,
|
|
915
975
|
appendTo: resolvedAppendTo,
|
|
916
976
|
appContext: resolvedAppContext,
|
|
917
|
-
customClass: _mergeClassNames(
|
|
977
|
+
customClass: _mergeClassNames(
|
|
978
|
+
isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
|
|
979
|
+
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
|
|
980
|
+
customClass
|
|
981
|
+
),
|
|
918
982
|
confirmButtonClass: _mergeClassNames(
|
|
919
983
|
DEFAULT_CONFIRM_BUTTON_CLASS,
|
|
920
984
|
isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
|
|
985
|
+
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BUTTON_CLASS,
|
|
921
986
|
confirmButtonClass
|
|
922
987
|
),
|
|
923
988
|
cancelButtonClass: _mergeClassNames(
|
|
924
989
|
DEFAULT_CANCEL_BUTTON_CLASS,
|
|
925
990
|
isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
|
|
991
|
+
isShijingshanTheme && SHIJINGSHAN_CANCEL_BUTTON_CLASS,
|
|
926
992
|
cancelButtonClass
|
|
927
993
|
)
|
|
928
994
|
};
|
|
@@ -981,7 +1047,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
981
1047
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
982
1048
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
983
1049
|
{
|
|
984
|
-
return "2026-07-
|
|
1050
|
+
return "2026-07-08 15:30:00";
|
|
985
1051
|
}
|
|
986
1052
|
}
|
|
987
1053
|
function test() {
|