@sybz-components/utils 1.0.21 → 1.0.23
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 +1 -1
- package/dist/base.d.mts +1 -1
- package/dist/base.d.ts +1 -1
- package/dist/base.mjs +1 -1
- package/dist/confirmSemantic.cjs +6 -5
- package/dist/confirmSemantic.mjs +6 -5
- package/dist/format.cjs +1 -1
- package/dist/format.mjs +1 -1
- package/dist/gitCommitLog.cjs +6 -4
- package/dist/gitCommitLog.mjs +6 -4
- package/dist/http.cjs +1 -1
- package/dist/http.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/postcss.cjs +99 -0
- package/dist/postcss.d.cts +16 -0
- package/dist/postcss.d.mts +16 -0
- package/dist/postcss.d.ts +16 -0
- package/dist/postcss.mjs +95 -0
- package/dist/shared/{utils.D0Voi5F1.mjs → utils.BNdsPonV.mjs} +96 -63
- package/dist/shared/{utils.nuyKxZXX.cjs → utils.CshLEFSw.cjs} +95 -62
- package/dist/sybz-code-standard.cjs +4 -3
- package/dist/sybz-code-standard.mjs +4 -3
- package/dist/vite.cjs +686 -6
- package/dist/vite.d.cts +96 -3
- package/dist/vite.d.mts +96 -3
- package/dist/vite.d.ts +96 -3
- package/dist/vite.mjs +686 -6
- package/package.json +10 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isVNode, h, Fragment, isRef, unref, toRaw } from 'vue';
|
|
1
|
+
import { isVNode, h, Fragment, isRef, unref, nextTick, toRaw } from 'vue';
|
|
2
2
|
import { consola } from 'consola';
|
|
3
3
|
import { cloneDeep } from 'es-toolkit';
|
|
4
4
|
import { resolveConfirmSemantic } from '../confirmSemantic.mjs';
|
|
@@ -142,6 +142,7 @@ function formatTime(time = /* @__PURE__ */ new Date(), cFormat = "{y}-{m}-{d} {h
|
|
|
142
142
|
});
|
|
143
143
|
}
|
|
144
144
|
function formatDurationTime(timestamp, cFormat = "{d}\u5929{h}\u65F6{i}\u5206{s}\u79D2") {
|
|
145
|
+
var _a, _b, _c, _d, _e, _f;
|
|
145
146
|
const secondsPerMinute = 60;
|
|
146
147
|
const minutesPerHour = 60;
|
|
147
148
|
const hoursPerDay = 24;
|
|
@@ -163,11 +164,11 @@ function formatDurationTime(timestamp, cFormat = "{d}\u5929{h}\u65F6{i}\u5206{s}
|
|
|
163
164
|
};
|
|
164
165
|
let parseFormat = cFormat;
|
|
165
166
|
if (days === 0) {
|
|
166
|
-
parseFormat = cFormat.match(/{h}.*/g)
|
|
167
|
+
parseFormat = (_b = (_a = cFormat.match(/{h}.*/g)) == null ? void 0 : _a[0]) != null ? _b : "";
|
|
167
168
|
if (hours === 0) {
|
|
168
|
-
parseFormat = cFormat.match(/{i}.*/g)
|
|
169
|
+
parseFormat = (_d = (_c = cFormat.match(/{i}.*/g)) == null ? void 0 : _c[0]) != null ? _d : "";
|
|
169
170
|
if (minutes === 0) {
|
|
170
|
-
parseFormat = cFormat.match(/{s}.*/g)
|
|
171
|
+
parseFormat = (_f = (_e = cFormat.match(/{s}.*/g)) == null ? void 0 : _e[0]) != null ? _f : "";
|
|
171
172
|
}
|
|
172
173
|
}
|
|
173
174
|
}
|
|
@@ -219,13 +220,16 @@ function formatTextToHtml(str) {
|
|
|
219
220
|
return withBreaks.replace(/\t/g, " ");
|
|
220
221
|
}
|
|
221
222
|
|
|
223
|
+
var __defProp = Object.defineProperty;
|
|
224
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
225
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
222
226
|
class HttpError extends Error {
|
|
223
|
-
status;
|
|
224
|
-
code;
|
|
225
|
-
data;
|
|
226
|
-
cause;
|
|
227
227
|
constructor(message, options = {}) {
|
|
228
228
|
super(message);
|
|
229
|
+
__publicField(this, "status");
|
|
230
|
+
__publicField(this, "code");
|
|
231
|
+
__publicField(this, "data");
|
|
232
|
+
__publicField(this, "cause");
|
|
229
233
|
this.name = "HttpError";
|
|
230
234
|
Object.assign(this, options);
|
|
231
235
|
}
|
|
@@ -258,10 +262,10 @@ function createHttp(options = {}) {
|
|
|
258
262
|
return new HttpError(error instanceof Error ? error.message : "\u8BF7\u6C42\u5931\u8D25", { cause: error });
|
|
259
263
|
const response = error.response;
|
|
260
264
|
const message = error.code === AxiosError.ECONNABORTED || error.code === "ETIMEDOUT" ? "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5" : error.code === AxiosError.ERR_CANCELED ? "\u8BF7\u6C42\u5DF2\u53D6\u6D88" : response ? `\u8BF7\u6C42\u5931\u8D25\uFF08${response.status}\uFF09` : "\u7F51\u7EDC\u8FDE\u63A5\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5\u7F51\u7EDC\u540E\u91CD\u8BD5";
|
|
261
|
-
return new HttpError(getBusinessMessage(response
|
|
262
|
-
status: response
|
|
265
|
+
return new HttpError(getBusinessMessage(response == null ? void 0 : response.data, message), {
|
|
266
|
+
status: response == null ? void 0 : response.status,
|
|
263
267
|
code: error.code,
|
|
264
|
-
data: response
|
|
268
|
+
data: response == null ? void 0 : response.data,
|
|
265
269
|
cause: error
|
|
266
270
|
});
|
|
267
271
|
};
|
|
@@ -269,11 +273,11 @@ function createHttp(options = {}) {
|
|
|
269
273
|
const requestConfig = config;
|
|
270
274
|
requestConfig.headers = AxiosHeaders.from(requestConfig.headers);
|
|
271
275
|
if (!requestConfig.skipAuth) {
|
|
272
|
-
const token = getToken
|
|
276
|
+
const token = getToken == null ? void 0 : getToken();
|
|
273
277
|
if (token && !requestConfig.headers.has("Authorization"))
|
|
274
278
|
requestConfig.headers.set("Authorization", `Bearer ${token}`);
|
|
275
279
|
}
|
|
276
|
-
return onRequest
|
|
280
|
+
return (onRequest == null ? void 0 : onRequest(requestConfig)) || requestConfig;
|
|
277
281
|
});
|
|
278
282
|
instance.interceptors.response.use(
|
|
279
283
|
(response) => {
|
|
@@ -288,17 +292,18 @@ function createHttp(options = {}) {
|
|
|
288
292
|
response.data,
|
|
289
293
|
response
|
|
290
294
|
);
|
|
291
|
-
onResponse
|
|
295
|
+
onResponse == null ? void 0 : onResponse(response);
|
|
292
296
|
return response;
|
|
293
297
|
},
|
|
294
298
|
async (error) => {
|
|
299
|
+
var _a;
|
|
295
300
|
const normalized = normalizeError ? normalizeError(error) : normalize(error);
|
|
296
301
|
const response = axios.isAxiosError(error) ? error.response : void 0;
|
|
297
|
-
const requestConfig = response
|
|
298
|
-
const customMessage = requestConfig
|
|
302
|
+
const requestConfig = response == null ? void 0 : response.config;
|
|
303
|
+
const customMessage = requestConfig == null ? void 0 : requestConfig.message;
|
|
299
304
|
const message = typeof customMessage === "function" ? customMessage(normalized) : customMessage || normalized.message;
|
|
300
|
-
if (requestConfig
|
|
301
|
-
await onError
|
|
305
|
+
if ((_a = requestConfig == null ? void 0 : requestConfig.showErrorToast) != null ? _a : showErrorToast) toast == null ? void 0 : toast(message);
|
|
306
|
+
await (onError == null ? void 0 : onError(normalized, response));
|
|
302
307
|
throw normalized;
|
|
303
308
|
}
|
|
304
309
|
);
|
|
@@ -355,7 +360,7 @@ function _getBrowserStorage(isSession = false) {
|
|
|
355
360
|
}
|
|
356
361
|
try {
|
|
357
362
|
return isSession ? window.sessionStorage : window.localStorage;
|
|
358
|
-
} catch {
|
|
363
|
+
} catch (e) {
|
|
359
364
|
return null;
|
|
360
365
|
}
|
|
361
366
|
}
|
|
@@ -368,7 +373,7 @@ function _parseStorageValue(value) {
|
|
|
368
373
|
if (typeof parsed !== "number") {
|
|
369
374
|
return parsed;
|
|
370
375
|
}
|
|
371
|
-
} catch {
|
|
376
|
+
} catch (e) {
|
|
372
377
|
}
|
|
373
378
|
return value;
|
|
374
379
|
}
|
|
@@ -376,16 +381,17 @@ function renderToastComponents(message, components, handlers) {
|
|
|
376
381
|
const template = document.createElement("template");
|
|
377
382
|
template.innerHTML = message;
|
|
378
383
|
const renderNode = (node) => {
|
|
379
|
-
|
|
384
|
+
var _a, _b;
|
|
385
|
+
if (node.nodeType === Node.TEXT_NODE) return (_a = node.textContent) != null ? _a : "";
|
|
380
386
|
if (node.nodeType !== Node.ELEMENT_NODE) return null;
|
|
381
387
|
const element = node;
|
|
382
388
|
const tag = element.tagName.toLowerCase();
|
|
383
389
|
const pascalTag = tag.replace(/(^|-)([a-z])/g, (_, _separator, letter) => letter.toUpperCase());
|
|
384
|
-
const component = components[tag]
|
|
390
|
+
const component = (_b = components[tag]) != null ? _b : components[pascalTag];
|
|
385
391
|
const attrs = {};
|
|
386
392
|
for (const { name, value } of Array.from(element.attributes)) {
|
|
387
393
|
if (name.startsWith("@")) {
|
|
388
|
-
const handler = handlers
|
|
394
|
+
const handler = handlers == null ? void 0 : handlers[value];
|
|
389
395
|
if (handler) {
|
|
390
396
|
const eventName = name.slice(1).replace(/(^|-)([a-z])/g, (_, _separator, letter) => letter.toUpperCase());
|
|
391
397
|
attrs[`on${eventName}`] = handler;
|
|
@@ -417,11 +423,20 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
417
423
|
return typeof obj === "object" && obj !== null && !isVNode(obj);
|
|
418
424
|
}
|
|
419
425
|
function showToast(options) {
|
|
420
|
-
|
|
426
|
+
var _a, _b;
|
|
427
|
+
const {
|
|
428
|
+
theme = utilsConfig.theme,
|
|
429
|
+
customClass,
|
|
430
|
+
iconAttrs,
|
|
431
|
+
handlers,
|
|
432
|
+
dangerouslyUseHTMLString = true,
|
|
433
|
+
...messageOptions
|
|
434
|
+
} = options;
|
|
435
|
+
let htmlStringEnabled = dangerouslyUseHTMLString;
|
|
421
436
|
const appContext = _resolveAppContext(null);
|
|
422
|
-
const appComponents = appContext
|
|
437
|
+
const appComponents = appContext == null ? void 0 : appContext.components;
|
|
423
438
|
if (typeof messageOptions.icon === "string") {
|
|
424
|
-
const icon = appComponents
|
|
439
|
+
const icon = (_a = appComponents == null ? void 0 : appComponents.SIcon) != null ? _a : appComponents == null ? void 0 : appComponents["s-icon"];
|
|
425
440
|
if (icon) {
|
|
426
441
|
const iconName = messageOptions.icon;
|
|
427
442
|
messageOptions.icon = () => h(icon, { cursor: "default", ...iconAttrs, icon: iconName });
|
|
@@ -430,11 +445,11 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
430
445
|
const icon = messageOptions.icon;
|
|
431
446
|
messageOptions.icon = () => h(icon, iconAttrs);
|
|
432
447
|
}
|
|
433
|
-
if (typeof messageOptions.message === "string" &&
|
|
434
|
-
const registeredComponents = appComponents
|
|
448
|
+
if (typeof messageOptions.message === "string" && htmlStringEnabled) {
|
|
449
|
+
const registeredComponents = appComponents != null ? appComponents : {};
|
|
435
450
|
if (Object.keys(registeredComponents).length > 0) {
|
|
436
451
|
messageOptions.message = renderToastComponents(messageOptions.message, registeredComponents, handlers);
|
|
437
|
-
|
|
452
|
+
htmlStringEnabled = false;
|
|
438
453
|
}
|
|
439
454
|
}
|
|
440
455
|
if (options.closeAll) {
|
|
@@ -448,7 +463,8 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
448
463
|
);
|
|
449
464
|
const resolvedMessageOptions = {
|
|
450
465
|
...messageOptions,
|
|
451
|
-
|
|
466
|
+
dangerouslyUseHTMLString: htmlStringEnabled,
|
|
467
|
+
showClose: (_b = options.showClose) != null ? _b : true,
|
|
452
468
|
customClass: resolvedCustomClass
|
|
453
469
|
};
|
|
454
470
|
if (appContext) ElMessage(resolvedMessageOptions, appContext);
|
|
@@ -504,14 +520,14 @@ function clearStorage(str = "") {
|
|
|
504
520
|
return;
|
|
505
521
|
}
|
|
506
522
|
if (isEmpty(str)) {
|
|
507
|
-
sessionStorageRef
|
|
508
|
-
localStorageRef
|
|
523
|
+
sessionStorageRef == null ? void 0 : sessionStorageRef.clear();
|
|
524
|
+
localStorageRef == null ? void 0 : localStorageRef.clear();
|
|
509
525
|
}
|
|
510
526
|
if (typeof str === "string" || Array.isArray(str)) {
|
|
511
527
|
const strArr = Array.isArray(str) ? str : [str];
|
|
512
528
|
for (let i = 0; i < strArr.length; i++) {
|
|
513
|
-
sessionStorageRef
|
|
514
|
-
localStorageRef
|
|
529
|
+
sessionStorageRef == null ? void 0 : sessionStorageRef.removeItem(strArr[i]);
|
|
530
|
+
localStorageRef == null ? void 0 : localStorageRef.removeItem(strArr[i]);
|
|
515
531
|
}
|
|
516
532
|
}
|
|
517
533
|
if (_isObjectWithExclude(str)) {
|
|
@@ -531,8 +547,8 @@ function clearStorage(str = "") {
|
|
|
531
547
|
}
|
|
532
548
|
}
|
|
533
549
|
}
|
|
534
|
-
sessionStorageRef
|
|
535
|
-
localStorageRef
|
|
550
|
+
sessionStorageRef == null ? void 0 : sessionStorageRef.clear();
|
|
551
|
+
localStorageRef == null ? void 0 : localStorageRef.clear();
|
|
536
552
|
for (const key in sessionStorageObj) {
|
|
537
553
|
setStorage(key, sessionStorageObj[key], true);
|
|
538
554
|
}
|
|
@@ -548,23 +564,24 @@ function _isObjectWithExclude(obj) {
|
|
|
548
564
|
function validateForm(ref, { message, detail = false, showMessage = true } = {}) {
|
|
549
565
|
return new Promise((resolve, reject) => {
|
|
550
566
|
unref(ref).validate((valid, status) => {
|
|
567
|
+
var _a;
|
|
551
568
|
if (valid) {
|
|
552
569
|
resolve(status);
|
|
553
570
|
} else {
|
|
554
571
|
if (showMessage) {
|
|
555
|
-
const fieldNames = Object.keys(status
|
|
572
|
+
const fieldNames = Object.keys(status != null ? status : {});
|
|
556
573
|
const errors = fieldNames.flatMap((field) => {
|
|
557
574
|
const fieldErrors = status[field];
|
|
558
575
|
return Array.isArray(fieldErrors) ? fieldErrors : [fieldErrors];
|
|
559
576
|
});
|
|
560
|
-
const errorMessages = errors.map((error) => error
|
|
561
|
-
const nonRequiredMessage = errors.find((error) => {
|
|
562
|
-
const errorMessage = error
|
|
577
|
+
const errorMessages = errors.map((error) => error == null ? void 0 : error.message).filter((errorMessage) => typeof errorMessage === "string" && !!errorMessage.trim());
|
|
578
|
+
const nonRequiredMessage = (_a = errors.find((error) => {
|
|
579
|
+
const errorMessage = error == null ? void 0 : error.message;
|
|
563
580
|
if (typeof errorMessage !== "string" || !errorMessage.trim()) return false;
|
|
564
581
|
if ("fieldValue" in Object(error) && !isEmpty(error.fieldValue)) return true;
|
|
565
582
|
return !/^(请输入|请选择|请填写|请上传|请勾选|不能为空)/.test(errorMessage) || /^请输入(?:正确|非负|正|整数|数字|\d|至少|最多|不超过)/.test(errorMessage);
|
|
566
|
-
})
|
|
567
|
-
const defaultMessage = nonRequiredMessage
|
|
583
|
+
})) == null ? void 0 : _a.message;
|
|
584
|
+
const defaultMessage = nonRequiredMessage != null ? nonRequiredMessage : errorMessages.length ? "\u5B58\u5728\u5FC5\u586B\u9879\u672A\u586B\u5199\uFF0C\u8BF7\u8865\u5145\u5B8C\u6574" : "\u8868\u5355\u6821\u9A8C\u672A\u901A\u8FC7\uFF0C\u8BF7\u68C0\u67E5\u8F93\u5165";
|
|
568
585
|
const toastMessage = message === void 0 ? defaultMessage : message;
|
|
569
586
|
if (toastMessage) $toast(detail ? toastMessage + fieldNames.join(",") : toastMessage, "e");
|
|
570
587
|
}
|
|
@@ -650,7 +667,7 @@ function mockValue(type = "", length = 4, options = {}) {
|
|
|
650
667
|
type = unref2(type);
|
|
651
668
|
if (Array.isArray(type)) {
|
|
652
669
|
if (type.length === 0) return "";
|
|
653
|
-
const randIndex = optionsIndex
|
|
670
|
+
const randIndex = optionsIndex != null ? optionsIndex : random2(0, type.length - 1);
|
|
654
671
|
const selectedItem = type[randIndex];
|
|
655
672
|
if (typeof selectedItem === "object" && selectedItem !== null && "value" in selectedItem) {
|
|
656
673
|
return selectedItem.value;
|
|
@@ -705,12 +722,13 @@ function getType(type) {
|
|
|
705
722
|
function delay(delay2 = 0, fn) {
|
|
706
723
|
return new Promise(
|
|
707
724
|
(resolve) => setTimeout(() => {
|
|
708
|
-
fn
|
|
725
|
+
fn == null ? void 0 : fn();
|
|
709
726
|
resolve();
|
|
710
727
|
}, delay2)
|
|
711
728
|
);
|
|
712
729
|
}
|
|
713
730
|
function validateOnSubmit(type = "required", rules = {}, pureValid = false) {
|
|
731
|
+
var _a;
|
|
714
732
|
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
715
733
|
if (normalized.pureValid) {
|
|
716
734
|
return validate(normalized.type, normalized.rawRules, true);
|
|
@@ -719,7 +737,7 @@ function validateOnSubmit(type = "required", rules = {}, pureValid = false) {
|
|
|
719
737
|
normalized.type,
|
|
720
738
|
{
|
|
721
739
|
...normalized.rulesObject,
|
|
722
|
-
trigger: normalized.rulesObject.trigger
|
|
740
|
+
trigger: (_a = normalized.rulesObject.trigger) != null ? _a : []
|
|
723
741
|
},
|
|
724
742
|
normalized.pureValid
|
|
725
743
|
);
|
|
@@ -744,14 +762,15 @@ var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
|
744
762
|
return ValidateType2;
|
|
745
763
|
})(ValidateType || {});
|
|
746
764
|
function validate(type = "required", rules = {}, pureValid = false) {
|
|
765
|
+
var _a, _b, _c, _d, _e, _f;
|
|
747
766
|
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
748
767
|
const rulesObject = normalized.rulesObject;
|
|
749
768
|
const rawRules = normalized.rawRules;
|
|
750
769
|
const validType = normalized.type;
|
|
751
770
|
const isPureValid = normalized.pureValid;
|
|
752
|
-
const trigger = rulesObject.trigger
|
|
771
|
+
const trigger = (_a = rulesObject.trigger) != null ? _a : ["blur", "change"];
|
|
753
772
|
const typeMaps = Object.values(ValidateType);
|
|
754
|
-
const parseRequired = rulesObject.required
|
|
773
|
+
const parseRequired = (_b = rulesObject.required) != null ? _b : true;
|
|
755
774
|
const defaultRequiredMessage = validType === "change" /* CHANGE */ ? "\u8BF7\u9009\u62E9" : "\u8BF7\u8F93\u5165";
|
|
756
775
|
const getPureValue = () => Object.prototype.hasOwnProperty.call(rulesObject, "value") ? rulesObject.value : rawRules;
|
|
757
776
|
if (!typeMaps.includes(validType)) {
|
|
@@ -764,7 +783,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
764
783
|
if (validType === "required" /* REQUIRED */ || validType === "change" /* CHANGE */) {
|
|
765
784
|
return {
|
|
766
785
|
required: parseRequired,
|
|
767
|
-
message: rulesObject.message
|
|
786
|
+
message: (_c = rulesObject.message) != null ? _c : defaultRequiredMessage,
|
|
768
787
|
trigger
|
|
769
788
|
};
|
|
770
789
|
}
|
|
@@ -822,8 +841,8 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
822
841
|
);
|
|
823
842
|
}
|
|
824
843
|
if (validType === "between" /* BETWEEN */) {
|
|
825
|
-
let minValue = rulesObject.min
|
|
826
|
-
let maxValue = rulesObject.max
|
|
844
|
+
let minValue = (_d = rulesObject.min) != null ? _d : "";
|
|
845
|
+
let maxValue = (_e = rulesObject.max) != null ? _e : "";
|
|
827
846
|
const validateBetween = (rule, value, callback) => {
|
|
828
847
|
let validFlag = /^-?[0-9]+$/.test(value);
|
|
829
848
|
if (!validFlag) {
|
|
@@ -847,7 +866,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
847
866
|
return {
|
|
848
867
|
min: rulesObject.min,
|
|
849
868
|
max: rulesObject.max,
|
|
850
|
-
message: rulesObject.message
|
|
869
|
+
message: (_f = rulesObject.message) != null ? _f : `\u8BF7\u8F93\u5165${rulesObject.min}\u5230${rulesObject.max}\u4E2A\u5B57\u7B26`,
|
|
851
870
|
trigger,
|
|
852
871
|
required: parseRequired
|
|
853
872
|
};
|
|
@@ -875,20 +894,22 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
875
894
|
return _validValue(getPureValue(), rulesObject.message, isPureValid, rulesObject.reg);
|
|
876
895
|
}
|
|
877
896
|
function _validValue(value, msg, pureValid2, reg) {
|
|
897
|
+
var _a2;
|
|
878
898
|
if (pureValid2) {
|
|
879
899
|
return reg.test(value);
|
|
880
900
|
}
|
|
881
901
|
const validatePhone = (rule, value2, callback) => {
|
|
902
|
+
var _a3;
|
|
882
903
|
let validFlag = reg.test(value2);
|
|
883
904
|
if (!validFlag) {
|
|
884
|
-
callback(new Error(rulesObject.message
|
|
905
|
+
callback(new Error((_a3 = rulesObject.message) != null ? _a3 : msg));
|
|
885
906
|
} else {
|
|
886
907
|
callback();
|
|
887
908
|
}
|
|
888
909
|
};
|
|
889
910
|
return {
|
|
890
911
|
validator: validatePhone,
|
|
891
|
-
required: rulesObject.required
|
|
912
|
+
required: (_a2 = rulesObject.required) != null ? _a2 : true,
|
|
892
913
|
trigger
|
|
893
914
|
};
|
|
894
915
|
}
|
|
@@ -927,7 +948,8 @@ const copy = (text, toastParams = {}) => {
|
|
|
927
948
|
return true;
|
|
928
949
|
};
|
|
929
950
|
function log(variableStr, variable, otherInfo = "") {
|
|
930
|
-
|
|
951
|
+
var _a, _b, _c;
|
|
952
|
+
const stack = (_c = (_b = (_a = new Error().stack) == null ? void 0 : _a.split("\n")[2]) == null ? void 0 : _b.trim()) != null ? _c : "";
|
|
931
953
|
const matchResult = stack.match(/\((.*):(\d+):(\d+)\)/);
|
|
932
954
|
let fileInfo = "";
|
|
933
955
|
try {
|
|
@@ -935,7 +957,7 @@ function log(variableStr, variable, otherInfo = "") {
|
|
|
935
957
|
const lineNumber = matchResult[2];
|
|
936
958
|
fileInfo = `vscode://file${JSON.parse(otherInfo)}:${lineNumber}`;
|
|
937
959
|
}
|
|
938
|
-
} catch {
|
|
960
|
+
} catch (e) {
|
|
939
961
|
fileInfo = otherInfo;
|
|
940
962
|
}
|
|
941
963
|
if (isRef(variable)) {
|
|
@@ -1028,7 +1050,7 @@ function throttle(fn, delay2 = 1e3, options = {}, resultCallback) {
|
|
|
1028
1050
|
lastThis = void 0;
|
|
1029
1051
|
const nextResult = fn.apply(context, args);
|
|
1030
1052
|
result = nextResult;
|
|
1031
|
-
resultCallback
|
|
1053
|
+
resultCallback == null ? void 0 : resultCallback(nextResult);
|
|
1032
1054
|
return result;
|
|
1033
1055
|
};
|
|
1034
1056
|
const flush = () => {
|
|
@@ -1127,9 +1149,10 @@ function debounce(func, delay2 = 500, immediate, resultCallback) {
|
|
|
1127
1149
|
return _debounce;
|
|
1128
1150
|
}
|
|
1129
1151
|
function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null) {
|
|
1152
|
+
var _a;
|
|
1130
1153
|
const isOptionsCall = typeof messageOrOptions === "object" && messageOrOptions !== null && !isVNode(messageOrOptions);
|
|
1131
|
-
const options = isOptionsCall ? messageOrOptions : optionsOrAppContext
|
|
1132
|
-
const message = isOptionsCall ? options.message
|
|
1154
|
+
const options = isOptionsCall ? messageOrOptions : optionsOrAppContext != null ? optionsOrAppContext : {};
|
|
1155
|
+
const message = isOptionsCall ? (_a = options.message) != null ? _a : "" : messageOrOptions;
|
|
1133
1156
|
const argumentAppContext = isOptionsCall ? optionsOrAppContext : appContext;
|
|
1134
1157
|
const {
|
|
1135
1158
|
message: _message,
|
|
@@ -1168,6 +1191,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
|
|
|
1168
1191
|
appendTo: resolvedAppendTo,
|
|
1169
1192
|
appContext: resolvedAppContext,
|
|
1170
1193
|
customClass: _mergeClassNames(
|
|
1194
|
+
"s-message-box--selectable-title",
|
|
1171
1195
|
isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
|
|
1172
1196
|
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
|
|
1173
1197
|
isSybzTheme && SYBZ_CONFIRM_BOX_CLASS,
|
|
@@ -1189,7 +1213,15 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
|
|
|
1189
1213
|
cancelButtonClass
|
|
1190
1214
|
)
|
|
1191
1215
|
};
|
|
1192
|
-
|
|
1216
|
+
const result = ElMessageBox.confirm(resolvedMessage, mergeOptions);
|
|
1217
|
+
void nextTick(() => {
|
|
1218
|
+
document.querySelectorAll(".s-message-box--selectable-title .el-message-box__title > span").forEach((title) => {
|
|
1219
|
+
if (title.dataset.selectableTitle) return;
|
|
1220
|
+
title.dataset.selectableTitle = "true";
|
|
1221
|
+
title.addEventListener("mousedown", (event) => event.stopPropagation());
|
|
1222
|
+
});
|
|
1223
|
+
});
|
|
1224
|
+
return result;
|
|
1193
1225
|
}
|
|
1194
1226
|
function _escapeHtml(value) {
|
|
1195
1227
|
return String(value).replace(/[&<>'"]/g, (character) => {
|
|
@@ -1218,7 +1250,7 @@ function _resolveAppendTarget(appendTo) {
|
|
|
1218
1250
|
try {
|
|
1219
1251
|
const selector = rawSelector.startsWith("#") || rawSelector.startsWith(".") || rawSelector.startsWith("[") ? rawSelector : `#${rawSelector}`;
|
|
1220
1252
|
return document.querySelector(selector) || appendTo;
|
|
1221
|
-
} catch {
|
|
1253
|
+
} catch (e) {
|
|
1222
1254
|
return appendTo;
|
|
1223
1255
|
}
|
|
1224
1256
|
}
|
|
@@ -1239,17 +1271,18 @@ function _resolveAppContext(appContext) {
|
|
|
1239
1271
|
}
|
|
1240
1272
|
const installWithContext = ElMessageBox.install;
|
|
1241
1273
|
const messageBoxWithContext = ElMessageBox;
|
|
1242
|
-
const elementPlusContext = installWithContext
|
|
1274
|
+
const elementPlusContext = (installWithContext == null ? void 0 : installWithContext.context) || messageBoxWithContext._context || null;
|
|
1243
1275
|
if (typeof document === "undefined") {
|
|
1244
1276
|
return elementPlusContext;
|
|
1245
1277
|
}
|
|
1246
1278
|
return elementPlusContext || _mountedAppContext();
|
|
1247
1279
|
}
|
|
1248
1280
|
function _mountedAppContext() {
|
|
1281
|
+
var _a, _b, _c;
|
|
1249
1282
|
const roots = [document.querySelector("#app"), document.querySelector("[data-v-app]")];
|
|
1250
1283
|
for (const root of roots) {
|
|
1251
1284
|
const element = root;
|
|
1252
|
-
const context = element
|
|
1285
|
+
const context = (_c = (_a = element == null ? void 0 : element.__vue_app__) == null ? void 0 : _a._context) != null ? _c : (_b = element == null ? void 0 : element._vue_app) == null ? void 0 : _b._context;
|
|
1253
1286
|
if (context) {
|
|
1254
1287
|
return context;
|
|
1255
1288
|
}
|
|
@@ -1266,7 +1299,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1266
1299
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1267
1300
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1268
1301
|
{
|
|
1269
|
-
return "2026-11-
|
|
1302
|
+
return "2026-11-24 15:42:10";
|
|
1270
1303
|
}
|
|
1271
1304
|
}
|
|
1272
1305
|
function test() {
|