@sybz-components/utils 0.0.6 → 0.0.8
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 +2 -1
- package/dist/base.d.cts +12 -4
- package/dist/base.d.mts +12 -4
- package/dist/base.d.ts +12 -4
- package/dist/base.mjs +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.mjs +1 -1
- package/dist/index.cjs +2 -1
- 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.DrwfWQ1C.cjs → utils.CDpXB2JP.cjs} +36 -7
- package/dist/shared/{utils.SMYVKGgi.mjs → utils.cf1aBGgC.mjs} +35 -7
- package/package.json +2 -1
package/dist/base.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
require('@vue/reactivity');
|
|
4
4
|
require('consola');
|
|
5
5
|
require('es-toolkit');
|
|
6
|
-
const format = require('./shared/utils.
|
|
6
|
+
const format = require('./shared/utils.CDpXB2JP.cjs');
|
|
7
7
|
require('element-plus');
|
|
8
8
|
require('./is.cjs');
|
|
9
9
|
|
|
@@ -17,6 +17,7 @@ exports.copy = format.copy;
|
|
|
17
17
|
exports.debounce = format.debounce;
|
|
18
18
|
exports.getStorage = format.getStorage;
|
|
19
19
|
exports.getType = format.getType;
|
|
20
|
+
exports.getUtilsBuildTime = format.getUtilsBuildTime;
|
|
20
21
|
exports.getVariable = format.getVariable;
|
|
21
22
|
exports.isEmpty = format.isEmpty;
|
|
22
23
|
exports.log = format.log;
|
package/dist/base.d.cts
CHANGED
|
@@ -112,12 +112,11 @@ interface CopyOptions extends ToastOptions {
|
|
|
112
112
|
}
|
|
113
113
|
type WidthInput = string | number | Ref<string | number>;
|
|
114
114
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
115
|
-
type ConfirmAppendTarget = string | HTMLElement | null;
|
|
116
115
|
interface ConfirmOptions extends ElMessageBoxOptions {
|
|
117
116
|
/**
|
|
118
|
-
*
|
|
117
|
+
* 确认框主题。
|
|
119
118
|
*/
|
|
120
|
-
|
|
119
|
+
theme?: '' | 'chenghua';
|
|
121
120
|
/**
|
|
122
121
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
123
122
|
*/
|
|
@@ -542,6 +541,15 @@ declare function confirm(message: ConfirmMessage, options?: ConfirmOptions, appC
|
|
|
542
541
|
* getVariable('--vp-c-brand-1')
|
|
543
542
|
*/
|
|
544
543
|
declare function getVariable(propertyName: string, fallback?: string): string;
|
|
544
|
+
/**
|
|
545
|
+
* 返回当前 @sybz-components/utils 包的构建时间。
|
|
546
|
+
*
|
|
547
|
+
* @returns 构建时间字符串。
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* getUtilsBuildTime()
|
|
551
|
+
*/
|
|
552
|
+
declare function getUtilsBuildTime(fallback?: string): string;
|
|
545
553
|
/**
|
|
546
554
|
* 返回当前 utils 包的构建时间。
|
|
547
555
|
*
|
|
@@ -552,4 +560,4 @@ declare function getVariable(propertyName: string, fallback?: string): string;
|
|
|
552
560
|
*/
|
|
553
561
|
declare function test(): string;
|
|
554
562
|
|
|
555
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
|
|
563
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
|
package/dist/base.d.mts
CHANGED
|
@@ -112,12 +112,11 @@ interface CopyOptions extends ToastOptions {
|
|
|
112
112
|
}
|
|
113
113
|
type WidthInput = string | number | Ref<string | number>;
|
|
114
114
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
115
|
-
type ConfirmAppendTarget = string | HTMLElement | null;
|
|
116
115
|
interface ConfirmOptions extends ElMessageBoxOptions {
|
|
117
116
|
/**
|
|
118
|
-
*
|
|
117
|
+
* 确认框主题。
|
|
119
118
|
*/
|
|
120
|
-
|
|
119
|
+
theme?: '' | 'chenghua';
|
|
121
120
|
/**
|
|
122
121
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
123
122
|
*/
|
|
@@ -542,6 +541,15 @@ declare function confirm(message: ConfirmMessage, options?: ConfirmOptions, appC
|
|
|
542
541
|
* getVariable('--vp-c-brand-1')
|
|
543
542
|
*/
|
|
544
543
|
declare function getVariable(propertyName: string, fallback?: string): string;
|
|
544
|
+
/**
|
|
545
|
+
* 返回当前 @sybz-components/utils 包的构建时间。
|
|
546
|
+
*
|
|
547
|
+
* @returns 构建时间字符串。
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* getUtilsBuildTime()
|
|
551
|
+
*/
|
|
552
|
+
declare function getUtilsBuildTime(fallback?: string): string;
|
|
545
553
|
/**
|
|
546
554
|
* 返回当前 utils 包的构建时间。
|
|
547
555
|
*
|
|
@@ -552,4 +560,4 @@ declare function getVariable(propertyName: string, fallback?: string): string;
|
|
|
552
560
|
*/
|
|
553
561
|
declare function test(): string;
|
|
554
562
|
|
|
555
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
|
|
563
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
|
package/dist/base.d.ts
CHANGED
|
@@ -112,12 +112,11 @@ interface CopyOptions extends ToastOptions {
|
|
|
112
112
|
}
|
|
113
113
|
type WidthInput = string | number | Ref<string | number>;
|
|
114
114
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
115
|
-
type ConfirmAppendTarget = string | HTMLElement | null;
|
|
116
115
|
interface ConfirmOptions extends ElMessageBoxOptions {
|
|
117
116
|
/**
|
|
118
|
-
*
|
|
117
|
+
* 确认框主题。
|
|
119
118
|
*/
|
|
120
|
-
|
|
119
|
+
theme?: '' | 'chenghua';
|
|
121
120
|
/**
|
|
122
121
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
123
122
|
*/
|
|
@@ -542,6 +541,15 @@ declare function confirm(message: ConfirmMessage, options?: ConfirmOptions, appC
|
|
|
542
541
|
* getVariable('--vp-c-brand-1')
|
|
543
542
|
*/
|
|
544
543
|
declare function getVariable(propertyName: string, fallback?: string): string;
|
|
544
|
+
/**
|
|
545
|
+
* 返回当前 @sybz-components/utils 包的构建时间。
|
|
546
|
+
*
|
|
547
|
+
* @returns 构建时间字符串。
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* getUtilsBuildTime()
|
|
551
|
+
*/
|
|
552
|
+
declare function getUtilsBuildTime(fallback?: string): string;
|
|
545
553
|
/**
|
|
546
554
|
* 返回当前 utils 包的构建时间。
|
|
547
555
|
*
|
|
@@ -552,4 +560,4 @@ declare function getVariable(propertyName: string, fallback?: string): string;
|
|
|
552
560
|
*/
|
|
553
561
|
declare function test(): string;
|
|
554
562
|
|
|
555
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
|
|
563
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger };
|
package/dist/base.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '@vue/reactivity';
|
|
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, f as getType, h as
|
|
4
|
+
export { $ as $toast, c as clearStorage, a as clone, b as confirm, d as copy, e as debounce, g as getStorage, f as getType, h as getUtilsBuildTime, i as getVariable, j as isEmpty, l as log, m as merge, p as processWidth, r as random, s as setStorage, k as sleep, t as test, n as throttle, o as toLine, q as tryCatch, u as uuid, v as validForm, w as validate, x as validateTrigger } from './shared/utils.cf1aBGgC.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 {
|
|
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.cf1aBGgC.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import '@vue/reactivity';
|
|
4
4
|
import 'consola';
|
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.CDpXB2JP.cjs');
|
|
4
4
|
const day = require('./day.cjs');
|
|
5
5
|
const is = require('./is.cjs');
|
|
6
6
|
const ws = require('./ws.cjs');
|
|
@@ -30,6 +30,7 @@ exports.formatTime = format.formatTime;
|
|
|
30
30
|
exports.formatToFixed = format.formatToFixed;
|
|
31
31
|
exports.getStorage = format.getStorage;
|
|
32
32
|
exports.getType = format.getType;
|
|
33
|
+
exports.getUtilsBuildTime = format.getUtilsBuildTime;
|
|
33
34
|
exports.getVariable = format.getVariable;
|
|
34
35
|
exports.isEmpty = format.isEmpty;
|
|
35
36
|
exports.log = format.log;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger } from './base.cjs';
|
|
1
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger } 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, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger } from './base.mjs';
|
|
1
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger } 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, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger } from './base.js';
|
|
1
|
+
export { $toast, clearStorage, clone, confirm, copy, debounce, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, processWidth, random, setStorage, sleep, test, throttle, toLine, tryCatch, uuid, validForm, validate, validateTrigger } 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,
|
|
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, f as getType, h as getUtilsBuildTime, i as getVariable, j as isEmpty, l as log, m as merge, p as processWidth, r as random, s as setStorage, k as sleep, t as test, n as throttle, o as toLine, q as tryCatch, u as uuid, v as validForm, w as validate, x as validateTrigger } from './shared/utils.cf1aBGgC.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';
|
|
@@ -189,7 +189,7 @@ function formatImg(photoName, addPath = "", { basePath = "assets/images" } = {})
|
|
|
189
189
|
const addLastSlash = addPath.endsWith("/") || !addPath ? addPath : `${addPath}/`;
|
|
190
190
|
const addLastBasePathSlash = basePath.endsWith("/") || !basePath ? basePath : `${basePath}/`;
|
|
191
191
|
const mergeSrc = `${addLastSlash}${photoName}`;
|
|
192
|
-
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.
|
|
192
|
+
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.CDpXB2JP.cjs', document.baseURI).href))).href;
|
|
193
193
|
}
|
|
194
194
|
function formatToFixed(value, options) {
|
|
195
195
|
if (typeof options === "number") {
|
|
@@ -234,6 +234,9 @@ function formatTextToHtml(str) {
|
|
|
234
234
|
|
|
235
235
|
const DEFAULT_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn";
|
|
236
236
|
const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
|
|
237
|
+
const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
|
|
238
|
+
const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
|
|
239
|
+
const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
|
|
237
240
|
function _getBrowserStorage(isSession = false) {
|
|
238
241
|
if (typeof window === "undefined") {
|
|
239
242
|
return null;
|
|
@@ -855,9 +858,19 @@ function debounce(func, delay = 500, immediate, resultCallback) {
|
|
|
855
858
|
return _debounce;
|
|
856
859
|
}
|
|
857
860
|
function confirm(message, options = {}, appContext = null) {
|
|
861
|
+
const {
|
|
862
|
+
theme,
|
|
863
|
+
customClass,
|
|
864
|
+
confirmButtonClass,
|
|
865
|
+
cancelButtonClass,
|
|
866
|
+
appendTo,
|
|
867
|
+
appContext: optionAppContext,
|
|
868
|
+
...messageBoxOptions
|
|
869
|
+
} = options;
|
|
858
870
|
const resolvedMessage = typeof message === "function" ? message() : message;
|
|
859
|
-
const resolvedAppendTo = _resolveAppendTarget(
|
|
860
|
-
const resolvedAppContext = _resolveAppContext(
|
|
871
|
+
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
872
|
+
const resolvedAppContext = _resolveAppContext(optionAppContext || appContext);
|
|
873
|
+
const isChenghuaTheme = theme === "chenghua";
|
|
861
874
|
const mergeOptions = {
|
|
862
875
|
title: "\u63D0\u793A",
|
|
863
876
|
draggable: true,
|
|
@@ -865,11 +878,20 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
865
878
|
cancelButtonText: "\u53D6\u6D88",
|
|
866
879
|
confirmButtonText: "\u786E\u5B9A",
|
|
867
880
|
dangerouslyUseHTMLString: true,
|
|
868
|
-
...
|
|
881
|
+
...messageBoxOptions,
|
|
869
882
|
appendTo: resolvedAppendTo,
|
|
870
883
|
appContext: resolvedAppContext,
|
|
871
|
-
|
|
872
|
-
|
|
884
|
+
customClass: _mergeClassNames(isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS, customClass),
|
|
885
|
+
confirmButtonClass: _mergeClassNames(
|
|
886
|
+
DEFAULT_CONFIRM_BUTTON_CLASS,
|
|
887
|
+
isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
|
|
888
|
+
confirmButtonClass
|
|
889
|
+
),
|
|
890
|
+
cancelButtonClass: _mergeClassNames(
|
|
891
|
+
DEFAULT_CANCEL_BUTTON_CLASS,
|
|
892
|
+
isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
|
|
893
|
+
cancelButtonClass
|
|
894
|
+
)
|
|
873
895
|
};
|
|
874
896
|
return elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions);
|
|
875
897
|
}
|
|
@@ -919,8 +941,14 @@ function getVariable(propertyName, fallback = "") {
|
|
|
919
941
|
const res = getComputedStyle(document.documentElement).getPropertyValue(propertyName).trim();
|
|
920
942
|
return res || fallback;
|
|
921
943
|
}
|
|
944
|
+
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
945
|
+
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
946
|
+
{
|
|
947
|
+
return "2026-06-18 15:18:56";
|
|
948
|
+
}
|
|
949
|
+
}
|
|
922
950
|
function test() {
|
|
923
|
-
return `build time: ${
|
|
951
|
+
return `build time: ${getUtilsBuildTime()}`;
|
|
924
952
|
}
|
|
925
953
|
|
|
926
954
|
exports.$toast = $toast;
|
|
@@ -939,6 +967,7 @@ exports.formatTime = formatTime;
|
|
|
939
967
|
exports.formatToFixed = formatToFixed;
|
|
940
968
|
exports.getStorage = getStorage;
|
|
941
969
|
exports.getType = getType;
|
|
970
|
+
exports.getUtilsBuildTime = getUtilsBuildTime;
|
|
942
971
|
exports.getVariable = getVariable;
|
|
943
972
|
exports.isEmpty = isEmpty;
|
|
944
973
|
exports.log = log;
|
|
@@ -231,6 +231,9 @@ function formatTextToHtml(str) {
|
|
|
231
231
|
|
|
232
232
|
const DEFAULT_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn";
|
|
233
233
|
const DEFAULT_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn";
|
|
234
|
+
const CHENGHUA_CONFIRM_BOX_CLASS = "s-message-box--chenghua";
|
|
235
|
+
const CHENGHUA_CONFIRM_BUTTON_CLASS = "s-message-box__confirm-btn--chenghua";
|
|
236
|
+
const CHENGHUA_CANCEL_BUTTON_CLASS = "s-message-box__cancel-btn--chenghua";
|
|
234
237
|
function _getBrowserStorage(isSession = false) {
|
|
235
238
|
if (typeof window === "undefined") {
|
|
236
239
|
return null;
|
|
@@ -852,9 +855,19 @@ function debounce(func, delay = 500, immediate, resultCallback) {
|
|
|
852
855
|
return _debounce;
|
|
853
856
|
}
|
|
854
857
|
function confirm(message, options = {}, appContext = null) {
|
|
858
|
+
const {
|
|
859
|
+
theme,
|
|
860
|
+
customClass,
|
|
861
|
+
confirmButtonClass,
|
|
862
|
+
cancelButtonClass,
|
|
863
|
+
appendTo,
|
|
864
|
+
appContext: optionAppContext,
|
|
865
|
+
...messageBoxOptions
|
|
866
|
+
} = options;
|
|
855
867
|
const resolvedMessage = typeof message === "function" ? message() : message;
|
|
856
|
-
const resolvedAppendTo = _resolveAppendTarget(
|
|
857
|
-
const resolvedAppContext = _resolveAppContext(
|
|
868
|
+
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
869
|
+
const resolvedAppContext = _resolveAppContext(optionAppContext || appContext);
|
|
870
|
+
const isChenghuaTheme = theme === "chenghua";
|
|
858
871
|
const mergeOptions = {
|
|
859
872
|
title: "\u63D0\u793A",
|
|
860
873
|
draggable: true,
|
|
@@ -862,11 +875,20 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
862
875
|
cancelButtonText: "\u53D6\u6D88",
|
|
863
876
|
confirmButtonText: "\u786E\u5B9A",
|
|
864
877
|
dangerouslyUseHTMLString: true,
|
|
865
|
-
...
|
|
878
|
+
...messageBoxOptions,
|
|
866
879
|
appendTo: resolvedAppendTo,
|
|
867
880
|
appContext: resolvedAppContext,
|
|
868
|
-
|
|
869
|
-
|
|
881
|
+
customClass: _mergeClassNames(isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS, customClass),
|
|
882
|
+
confirmButtonClass: _mergeClassNames(
|
|
883
|
+
DEFAULT_CONFIRM_BUTTON_CLASS,
|
|
884
|
+
isChenghuaTheme && CHENGHUA_CONFIRM_BUTTON_CLASS,
|
|
885
|
+
confirmButtonClass
|
|
886
|
+
),
|
|
887
|
+
cancelButtonClass: _mergeClassNames(
|
|
888
|
+
DEFAULT_CANCEL_BUTTON_CLASS,
|
|
889
|
+
isChenghuaTheme && CHENGHUA_CANCEL_BUTTON_CLASS,
|
|
890
|
+
cancelButtonClass
|
|
891
|
+
)
|
|
870
892
|
};
|
|
871
893
|
return ElMessageBox.confirm(resolvedMessage, mergeOptions);
|
|
872
894
|
}
|
|
@@ -916,8 +938,14 @@ function getVariable(propertyName, fallback = "") {
|
|
|
916
938
|
const res = getComputedStyle(document.documentElement).getPropertyValue(propertyName).trim();
|
|
917
939
|
return res || fallback;
|
|
918
940
|
}
|
|
941
|
+
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
942
|
+
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
943
|
+
{
|
|
944
|
+
return "2026-06-18 15:18:56";
|
|
945
|
+
}
|
|
946
|
+
}
|
|
919
947
|
function test() {
|
|
920
|
-
return `build time: ${
|
|
948
|
+
return `build time: ${getUtilsBuildTime()}`;
|
|
921
949
|
}
|
|
922
950
|
|
|
923
|
-
export { $toast as $,
|
|
951
|
+
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, getType as f, getStorage as g, getUtilsBuildTime as h, getVariable as i, isEmpty as j, sleep as k, log as l, merge as m, throttle as n, toLine as o, processWidth as p, tryCatch as q, random as r, setStorage as s, test as t, uuid as u, validForm as v, validate as w, validateTrigger as x, formatBytes as y, formatBytesConvert as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybz-components/utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "utils of sybz-components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
"registry": "https://registry.npmjs.org"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {
|
|
18
|
+
"build": "npx unbuild",
|
|
18
19
|
"stub": "npx unbuild --stub",
|
|
19
20
|
"releaseOld": "npx unbuild && npm version patch && git add . && git commit -m \"chore: release @sybz-components/utils v$(npm pkg get version | sed 's/\"//g')\" && git push origin && npm publish",
|
|
20
21
|
"release": "node ./scripts/release.mjs"
|