@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
|
@@ -148,6 +148,7 @@ function formatTime(time = /* @__PURE__ */ new Date(), cFormat = "{y}-{m}-{d} {h
|
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
function formatDurationTime(timestamp, cFormat = "{d}\u5929{h}\u65F6{i}\u5206{s}\u79D2") {
|
|
151
|
+
var _a, _b, _c, _d, _e, _f;
|
|
151
152
|
const secondsPerMinute = 60;
|
|
152
153
|
const minutesPerHour = 60;
|
|
153
154
|
const hoursPerDay = 24;
|
|
@@ -169,11 +170,11 @@ function formatDurationTime(timestamp, cFormat = "{d}\u5929{h}\u65F6{i}\u5206{s}
|
|
|
169
170
|
};
|
|
170
171
|
let parseFormat = cFormat;
|
|
171
172
|
if (days === 0) {
|
|
172
|
-
parseFormat = cFormat.match(/{h}.*/g)
|
|
173
|
+
parseFormat = (_b = (_a = cFormat.match(/{h}.*/g)) == null ? void 0 : _a[0]) != null ? _b : "";
|
|
173
174
|
if (hours === 0) {
|
|
174
|
-
parseFormat = cFormat.match(/{i}.*/g)
|
|
175
|
+
parseFormat = (_d = (_c = cFormat.match(/{i}.*/g)) == null ? void 0 : _c[0]) != null ? _d : "";
|
|
175
176
|
if (minutes === 0) {
|
|
176
|
-
parseFormat = cFormat.match(/{s}.*/g)
|
|
177
|
+
parseFormat = (_f = (_e = cFormat.match(/{s}.*/g)) == null ? void 0 : _e[0]) != null ? _f : "";
|
|
177
178
|
}
|
|
178
179
|
}
|
|
179
180
|
}
|
|
@@ -225,13 +226,16 @@ function formatTextToHtml(str) {
|
|
|
225
226
|
return withBreaks.replace(/\t/g, " ");
|
|
226
227
|
}
|
|
227
228
|
|
|
229
|
+
var __defProp = Object.defineProperty;
|
|
230
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
231
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
228
232
|
class HttpError extends Error {
|
|
229
|
-
status;
|
|
230
|
-
code;
|
|
231
|
-
data;
|
|
232
|
-
cause;
|
|
233
233
|
constructor(message, options = {}) {
|
|
234
234
|
super(message);
|
|
235
|
+
__publicField(this, "status");
|
|
236
|
+
__publicField(this, "code");
|
|
237
|
+
__publicField(this, "data");
|
|
238
|
+
__publicField(this, "cause");
|
|
235
239
|
this.name = "HttpError";
|
|
236
240
|
Object.assign(this, options);
|
|
237
241
|
}
|
|
@@ -264,10 +268,10 @@ function createHttp(options = {}) {
|
|
|
264
268
|
return new HttpError(error instanceof Error ? error.message : "\u8BF7\u6C42\u5931\u8D25", { cause: error });
|
|
265
269
|
const response = error.response;
|
|
266
270
|
const message = error.code === axios.AxiosError.ECONNABORTED || error.code === "ETIMEDOUT" ? "\u8BF7\u6C42\u8D85\u65F6\uFF0C\u8BF7\u91CD\u8BD5" : error.code === axios.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";
|
|
267
|
-
return new HttpError(getBusinessMessage(response
|
|
268
|
-
status: response
|
|
271
|
+
return new HttpError(getBusinessMessage(response == null ? void 0 : response.data, message), {
|
|
272
|
+
status: response == null ? void 0 : response.status,
|
|
269
273
|
code: error.code,
|
|
270
|
-
data: response
|
|
274
|
+
data: response == null ? void 0 : response.data,
|
|
271
275
|
cause: error
|
|
272
276
|
});
|
|
273
277
|
};
|
|
@@ -275,11 +279,11 @@ function createHttp(options = {}) {
|
|
|
275
279
|
const requestConfig = config;
|
|
276
280
|
requestConfig.headers = axios.AxiosHeaders.from(requestConfig.headers);
|
|
277
281
|
if (!requestConfig.skipAuth) {
|
|
278
|
-
const token = getToken
|
|
282
|
+
const token = getToken == null ? void 0 : getToken();
|
|
279
283
|
if (token && !requestConfig.headers.has("Authorization"))
|
|
280
284
|
requestConfig.headers.set("Authorization", `Bearer ${token}`);
|
|
281
285
|
}
|
|
282
|
-
return onRequest
|
|
286
|
+
return (onRequest == null ? void 0 : onRequest(requestConfig)) || requestConfig;
|
|
283
287
|
});
|
|
284
288
|
instance.interceptors.response.use(
|
|
285
289
|
(response) => {
|
|
@@ -294,17 +298,18 @@ function createHttp(options = {}) {
|
|
|
294
298
|
response.data,
|
|
295
299
|
response
|
|
296
300
|
);
|
|
297
|
-
onResponse
|
|
301
|
+
onResponse == null ? void 0 : onResponse(response);
|
|
298
302
|
return response;
|
|
299
303
|
},
|
|
300
304
|
async (error) => {
|
|
305
|
+
var _a;
|
|
301
306
|
const normalized = normalizeError ? normalizeError(error) : normalize(error);
|
|
302
307
|
const response = axios__default.isAxiosError(error) ? error.response : void 0;
|
|
303
|
-
const requestConfig = response
|
|
304
|
-
const customMessage = requestConfig
|
|
308
|
+
const requestConfig = response == null ? void 0 : response.config;
|
|
309
|
+
const customMessage = requestConfig == null ? void 0 : requestConfig.message;
|
|
305
310
|
const message = typeof customMessage === "function" ? customMessage(normalized) : customMessage || normalized.message;
|
|
306
|
-
if (requestConfig
|
|
307
|
-
await onError
|
|
311
|
+
if ((_a = requestConfig == null ? void 0 : requestConfig.showErrorToast) != null ? _a : showErrorToast) toast == null ? void 0 : toast(message);
|
|
312
|
+
await (onError == null ? void 0 : onError(normalized, response));
|
|
308
313
|
throw normalized;
|
|
309
314
|
}
|
|
310
315
|
);
|
|
@@ -361,7 +366,7 @@ function _getBrowserStorage(isSession = false) {
|
|
|
361
366
|
}
|
|
362
367
|
try {
|
|
363
368
|
return isSession ? window.sessionStorage : window.localStorage;
|
|
364
|
-
} catch {
|
|
369
|
+
} catch (e) {
|
|
365
370
|
return null;
|
|
366
371
|
}
|
|
367
372
|
}
|
|
@@ -374,7 +379,7 @@ function _parseStorageValue(value) {
|
|
|
374
379
|
if (typeof parsed !== "number") {
|
|
375
380
|
return parsed;
|
|
376
381
|
}
|
|
377
|
-
} catch {
|
|
382
|
+
} catch (e) {
|
|
378
383
|
}
|
|
379
384
|
return value;
|
|
380
385
|
}
|
|
@@ -382,16 +387,17 @@ function renderToastComponents(message, components, handlers) {
|
|
|
382
387
|
const template = document.createElement("template");
|
|
383
388
|
template.innerHTML = message;
|
|
384
389
|
const renderNode = (node) => {
|
|
385
|
-
|
|
390
|
+
var _a, _b;
|
|
391
|
+
if (node.nodeType === Node.TEXT_NODE) return (_a = node.textContent) != null ? _a : "";
|
|
386
392
|
if (node.nodeType !== Node.ELEMENT_NODE) return null;
|
|
387
393
|
const element = node;
|
|
388
394
|
const tag = element.tagName.toLowerCase();
|
|
389
395
|
const pascalTag = tag.replace(/(^|-)([a-z])/g, (_, _separator, letter) => letter.toUpperCase());
|
|
390
|
-
const component = components[tag]
|
|
396
|
+
const component = (_b = components[tag]) != null ? _b : components[pascalTag];
|
|
391
397
|
const attrs = {};
|
|
392
398
|
for (const { name, value } of Array.from(element.attributes)) {
|
|
393
399
|
if (name.startsWith("@")) {
|
|
394
|
-
const handler = handlers
|
|
400
|
+
const handler = handlers == null ? void 0 : handlers[value];
|
|
395
401
|
if (handler) {
|
|
396
402
|
const eventName = name.slice(1).replace(/(^|-)([a-z])/g, (_, _separator, letter) => letter.toUpperCase());
|
|
397
403
|
attrs[`on${eventName}`] = handler;
|
|
@@ -423,11 +429,20 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
423
429
|
return typeof obj === "object" && obj !== null && !vue.isVNode(obj);
|
|
424
430
|
}
|
|
425
431
|
function showToast(options) {
|
|
426
|
-
|
|
432
|
+
var _a, _b;
|
|
433
|
+
const {
|
|
434
|
+
theme = utilsConfig.theme,
|
|
435
|
+
customClass,
|
|
436
|
+
iconAttrs,
|
|
437
|
+
handlers,
|
|
438
|
+
dangerouslyUseHTMLString = true,
|
|
439
|
+
...messageOptions
|
|
440
|
+
} = options;
|
|
441
|
+
let htmlStringEnabled = dangerouslyUseHTMLString;
|
|
427
442
|
const appContext = _resolveAppContext(null);
|
|
428
|
-
const appComponents = appContext
|
|
443
|
+
const appComponents = appContext == null ? void 0 : appContext.components;
|
|
429
444
|
if (typeof messageOptions.icon === "string") {
|
|
430
|
-
const icon = appComponents
|
|
445
|
+
const icon = (_a = appComponents == null ? void 0 : appComponents.SIcon) != null ? _a : appComponents == null ? void 0 : appComponents["s-icon"];
|
|
431
446
|
if (icon) {
|
|
432
447
|
const iconName = messageOptions.icon;
|
|
433
448
|
messageOptions.icon = () => vue.h(icon, { cursor: "default", ...iconAttrs, icon: iconName });
|
|
@@ -436,11 +451,11 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
436
451
|
const icon = messageOptions.icon;
|
|
437
452
|
messageOptions.icon = () => vue.h(icon, iconAttrs);
|
|
438
453
|
}
|
|
439
|
-
if (typeof messageOptions.message === "string" &&
|
|
440
|
-
const registeredComponents = appComponents
|
|
454
|
+
if (typeof messageOptions.message === "string" && htmlStringEnabled) {
|
|
455
|
+
const registeredComponents = appComponents != null ? appComponents : {};
|
|
441
456
|
if (Object.keys(registeredComponents).length > 0) {
|
|
442
457
|
messageOptions.message = renderToastComponents(messageOptions.message, registeredComponents, handlers);
|
|
443
|
-
|
|
458
|
+
htmlStringEnabled = false;
|
|
444
459
|
}
|
|
445
460
|
}
|
|
446
461
|
if (options.closeAll) {
|
|
@@ -454,7 +469,8 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
454
469
|
);
|
|
455
470
|
const resolvedMessageOptions = {
|
|
456
471
|
...messageOptions,
|
|
457
|
-
|
|
472
|
+
dangerouslyUseHTMLString: htmlStringEnabled,
|
|
473
|
+
showClose: (_b = options.showClose) != null ? _b : true,
|
|
458
474
|
customClass: resolvedCustomClass
|
|
459
475
|
};
|
|
460
476
|
if (appContext) elementPlus.ElMessage(resolvedMessageOptions, appContext);
|
|
@@ -510,14 +526,14 @@ function clearStorage(str = "") {
|
|
|
510
526
|
return;
|
|
511
527
|
}
|
|
512
528
|
if (isEmpty(str)) {
|
|
513
|
-
sessionStorageRef
|
|
514
|
-
localStorageRef
|
|
529
|
+
sessionStorageRef == null ? void 0 : sessionStorageRef.clear();
|
|
530
|
+
localStorageRef == null ? void 0 : localStorageRef.clear();
|
|
515
531
|
}
|
|
516
532
|
if (typeof str === "string" || Array.isArray(str)) {
|
|
517
533
|
const strArr = Array.isArray(str) ? str : [str];
|
|
518
534
|
for (let i = 0; i < strArr.length; i++) {
|
|
519
|
-
sessionStorageRef
|
|
520
|
-
localStorageRef
|
|
535
|
+
sessionStorageRef == null ? void 0 : sessionStorageRef.removeItem(strArr[i]);
|
|
536
|
+
localStorageRef == null ? void 0 : localStorageRef.removeItem(strArr[i]);
|
|
521
537
|
}
|
|
522
538
|
}
|
|
523
539
|
if (_isObjectWithExclude(str)) {
|
|
@@ -537,8 +553,8 @@ function clearStorage(str = "") {
|
|
|
537
553
|
}
|
|
538
554
|
}
|
|
539
555
|
}
|
|
540
|
-
sessionStorageRef
|
|
541
|
-
localStorageRef
|
|
556
|
+
sessionStorageRef == null ? void 0 : sessionStorageRef.clear();
|
|
557
|
+
localStorageRef == null ? void 0 : localStorageRef.clear();
|
|
542
558
|
for (const key in sessionStorageObj) {
|
|
543
559
|
setStorage(key, sessionStorageObj[key], true);
|
|
544
560
|
}
|
|
@@ -554,23 +570,24 @@ function _isObjectWithExclude(obj) {
|
|
|
554
570
|
function validateForm(ref, { message, detail = false, showMessage = true } = {}) {
|
|
555
571
|
return new Promise((resolve, reject) => {
|
|
556
572
|
vue.unref(ref).validate((valid, status) => {
|
|
573
|
+
var _a;
|
|
557
574
|
if (valid) {
|
|
558
575
|
resolve(status);
|
|
559
576
|
} else {
|
|
560
577
|
if (showMessage) {
|
|
561
|
-
const fieldNames = Object.keys(status
|
|
578
|
+
const fieldNames = Object.keys(status != null ? status : {});
|
|
562
579
|
const errors = fieldNames.flatMap((field) => {
|
|
563
580
|
const fieldErrors = status[field];
|
|
564
581
|
return Array.isArray(fieldErrors) ? fieldErrors : [fieldErrors];
|
|
565
582
|
});
|
|
566
|
-
const errorMessages = errors.map((error) => error
|
|
567
|
-
const nonRequiredMessage = errors.find((error) => {
|
|
568
|
-
const errorMessage = error
|
|
583
|
+
const errorMessages = errors.map((error) => error == null ? void 0 : error.message).filter((errorMessage) => typeof errorMessage === "string" && !!errorMessage.trim());
|
|
584
|
+
const nonRequiredMessage = (_a = errors.find((error) => {
|
|
585
|
+
const errorMessage = error == null ? void 0 : error.message;
|
|
569
586
|
if (typeof errorMessage !== "string" || !errorMessage.trim()) return false;
|
|
570
587
|
if ("fieldValue" in Object(error) && !isEmpty(error.fieldValue)) return true;
|
|
571
588
|
return !/^(请输入|请选择|请填写|请上传|请勾选|不能为空)/.test(errorMessage) || /^请输入(?:正确|非负|正|整数|数字|\d|至少|最多|不超过)/.test(errorMessage);
|
|
572
|
-
})
|
|
573
|
-
const defaultMessage = nonRequiredMessage
|
|
589
|
+
})) == null ? void 0 : _a.message;
|
|
590
|
+
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";
|
|
574
591
|
const toastMessage = message === void 0 ? defaultMessage : message;
|
|
575
592
|
if (toastMessage) $toast(detail ? toastMessage + fieldNames.join(",") : toastMessage, "e");
|
|
576
593
|
}
|
|
@@ -656,7 +673,7 @@ function mockValue(type = "", length = 4, options = {}) {
|
|
|
656
673
|
type = unref2(type);
|
|
657
674
|
if (Array.isArray(type)) {
|
|
658
675
|
if (type.length === 0) return "";
|
|
659
|
-
const randIndex = optionsIndex
|
|
676
|
+
const randIndex = optionsIndex != null ? optionsIndex : random2(0, type.length - 1);
|
|
660
677
|
const selectedItem = type[randIndex];
|
|
661
678
|
if (typeof selectedItem === "object" && selectedItem !== null && "value" in selectedItem) {
|
|
662
679
|
return selectedItem.value;
|
|
@@ -711,12 +728,13 @@ function getType(type) {
|
|
|
711
728
|
function delay(delay2 = 0, fn) {
|
|
712
729
|
return new Promise(
|
|
713
730
|
(resolve) => setTimeout(() => {
|
|
714
|
-
fn
|
|
731
|
+
fn == null ? void 0 : fn();
|
|
715
732
|
resolve();
|
|
716
733
|
}, delay2)
|
|
717
734
|
);
|
|
718
735
|
}
|
|
719
736
|
function validateOnSubmit(type = "required", rules = {}, pureValid = false) {
|
|
737
|
+
var _a;
|
|
720
738
|
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
721
739
|
if (normalized.pureValid) {
|
|
722
740
|
return validate(normalized.type, normalized.rawRules, true);
|
|
@@ -725,7 +743,7 @@ function validateOnSubmit(type = "required", rules = {}, pureValid = false) {
|
|
|
725
743
|
normalized.type,
|
|
726
744
|
{
|
|
727
745
|
...normalized.rulesObject,
|
|
728
|
-
trigger: normalized.rulesObject.trigger
|
|
746
|
+
trigger: (_a = normalized.rulesObject.trigger) != null ? _a : []
|
|
729
747
|
},
|
|
730
748
|
normalized.pureValid
|
|
731
749
|
);
|
|
@@ -750,14 +768,15 @@ var ValidateType = /* @__PURE__ */ ((ValidateType2) => {
|
|
|
750
768
|
return ValidateType2;
|
|
751
769
|
})(ValidateType || {});
|
|
752
770
|
function validate(type = "required", rules = {}, pureValid = false) {
|
|
771
|
+
var _a, _b, _c, _d, _e, _f;
|
|
753
772
|
const normalized = normalizeValidateParams(type, rules, pureValid);
|
|
754
773
|
const rulesObject = normalized.rulesObject;
|
|
755
774
|
const rawRules = normalized.rawRules;
|
|
756
775
|
const validType = normalized.type;
|
|
757
776
|
const isPureValid = normalized.pureValid;
|
|
758
|
-
const trigger = rulesObject.trigger
|
|
777
|
+
const trigger = (_a = rulesObject.trigger) != null ? _a : ["blur", "change"];
|
|
759
778
|
const typeMaps = Object.values(ValidateType);
|
|
760
|
-
const parseRequired = rulesObject.required
|
|
779
|
+
const parseRequired = (_b = rulesObject.required) != null ? _b : true;
|
|
761
780
|
const defaultRequiredMessage = validType === "change" /* CHANGE */ ? "\u8BF7\u9009\u62E9" : "\u8BF7\u8F93\u5165";
|
|
762
781
|
const getPureValue = () => Object.prototype.hasOwnProperty.call(rulesObject, "value") ? rulesObject.value : rawRules;
|
|
763
782
|
if (!typeMaps.includes(validType)) {
|
|
@@ -770,7 +789,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
770
789
|
if (validType === "required" /* REQUIRED */ || validType === "change" /* CHANGE */) {
|
|
771
790
|
return {
|
|
772
791
|
required: parseRequired,
|
|
773
|
-
message: rulesObject.message
|
|
792
|
+
message: (_c = rulesObject.message) != null ? _c : defaultRequiredMessage,
|
|
774
793
|
trigger
|
|
775
794
|
};
|
|
776
795
|
}
|
|
@@ -828,8 +847,8 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
828
847
|
);
|
|
829
848
|
}
|
|
830
849
|
if (validType === "between" /* BETWEEN */) {
|
|
831
|
-
let minValue = rulesObject.min
|
|
832
|
-
let maxValue = rulesObject.max
|
|
850
|
+
let minValue = (_d = rulesObject.min) != null ? _d : "";
|
|
851
|
+
let maxValue = (_e = rulesObject.max) != null ? _e : "";
|
|
833
852
|
const validateBetween = (rule, value, callback) => {
|
|
834
853
|
let validFlag = /^-?[0-9]+$/.test(value);
|
|
835
854
|
if (!validFlag) {
|
|
@@ -853,7 +872,7 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
853
872
|
return {
|
|
854
873
|
min: rulesObject.min,
|
|
855
874
|
max: rulesObject.max,
|
|
856
|
-
message: rulesObject.message
|
|
875
|
+
message: (_f = rulesObject.message) != null ? _f : `\u8BF7\u8F93\u5165${rulesObject.min}\u5230${rulesObject.max}\u4E2A\u5B57\u7B26`,
|
|
857
876
|
trigger,
|
|
858
877
|
required: parseRequired
|
|
859
878
|
};
|
|
@@ -881,20 +900,22 @@ function validate(type = "required", rules = {}, pureValid = false) {
|
|
|
881
900
|
return _validValue(getPureValue(), rulesObject.message, isPureValid, rulesObject.reg);
|
|
882
901
|
}
|
|
883
902
|
function _validValue(value, msg, pureValid2, reg) {
|
|
903
|
+
var _a2;
|
|
884
904
|
if (pureValid2) {
|
|
885
905
|
return reg.test(value);
|
|
886
906
|
}
|
|
887
907
|
const validatePhone = (rule, value2, callback) => {
|
|
908
|
+
var _a3;
|
|
888
909
|
let validFlag = reg.test(value2);
|
|
889
910
|
if (!validFlag) {
|
|
890
|
-
callback(new Error(rulesObject.message
|
|
911
|
+
callback(new Error((_a3 = rulesObject.message) != null ? _a3 : msg));
|
|
891
912
|
} else {
|
|
892
913
|
callback();
|
|
893
914
|
}
|
|
894
915
|
};
|
|
895
916
|
return {
|
|
896
917
|
validator: validatePhone,
|
|
897
|
-
required: rulesObject.required
|
|
918
|
+
required: (_a2 = rulesObject.required) != null ? _a2 : true,
|
|
898
919
|
trigger
|
|
899
920
|
};
|
|
900
921
|
}
|
|
@@ -933,7 +954,8 @@ const copy = (text, toastParams = {}) => {
|
|
|
933
954
|
return true;
|
|
934
955
|
};
|
|
935
956
|
function log(variableStr, variable, otherInfo = "") {
|
|
936
|
-
|
|
957
|
+
var _a, _b, _c;
|
|
958
|
+
const stack = (_c = (_b = (_a = new Error().stack) == null ? void 0 : _a.split("\n")[2]) == null ? void 0 : _b.trim()) != null ? _c : "";
|
|
937
959
|
const matchResult = stack.match(/\((.*):(\d+):(\d+)\)/);
|
|
938
960
|
let fileInfo = "";
|
|
939
961
|
try {
|
|
@@ -941,7 +963,7 @@ function log(variableStr, variable, otherInfo = "") {
|
|
|
941
963
|
const lineNumber = matchResult[2];
|
|
942
964
|
fileInfo = `vscode://file${JSON.parse(otherInfo)}:${lineNumber}`;
|
|
943
965
|
}
|
|
944
|
-
} catch {
|
|
966
|
+
} catch (e) {
|
|
945
967
|
fileInfo = otherInfo;
|
|
946
968
|
}
|
|
947
969
|
if (vue.isRef(variable)) {
|
|
@@ -1034,7 +1056,7 @@ function throttle(fn, delay2 = 1e3, options = {}, resultCallback) {
|
|
|
1034
1056
|
lastThis = void 0;
|
|
1035
1057
|
const nextResult = fn.apply(context, args);
|
|
1036
1058
|
result = nextResult;
|
|
1037
|
-
resultCallback
|
|
1059
|
+
resultCallback == null ? void 0 : resultCallback(nextResult);
|
|
1038
1060
|
return result;
|
|
1039
1061
|
};
|
|
1040
1062
|
const flush = () => {
|
|
@@ -1133,9 +1155,10 @@ function debounce(func, delay2 = 500, immediate, resultCallback) {
|
|
|
1133
1155
|
return _debounce;
|
|
1134
1156
|
}
|
|
1135
1157
|
function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null) {
|
|
1158
|
+
var _a;
|
|
1136
1159
|
const isOptionsCall = typeof messageOrOptions === "object" && messageOrOptions !== null && !vue.isVNode(messageOrOptions);
|
|
1137
|
-
const options = isOptionsCall ? messageOrOptions : optionsOrAppContext
|
|
1138
|
-
const message = isOptionsCall ? options.message
|
|
1160
|
+
const options = isOptionsCall ? messageOrOptions : optionsOrAppContext != null ? optionsOrAppContext : {};
|
|
1161
|
+
const message = isOptionsCall ? (_a = options.message) != null ? _a : "" : messageOrOptions;
|
|
1139
1162
|
const argumentAppContext = isOptionsCall ? optionsOrAppContext : appContext;
|
|
1140
1163
|
const {
|
|
1141
1164
|
message: _message,
|
|
@@ -1174,6 +1197,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
|
|
|
1174
1197
|
appendTo: resolvedAppendTo,
|
|
1175
1198
|
appContext: resolvedAppContext,
|
|
1176
1199
|
customClass: _mergeClassNames(
|
|
1200
|
+
"s-message-box--selectable-title",
|
|
1177
1201
|
isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
|
|
1178
1202
|
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
|
|
1179
1203
|
isSybzTheme && SYBZ_CONFIRM_BOX_CLASS,
|
|
@@ -1195,7 +1219,15 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
|
|
|
1195
1219
|
cancelButtonClass
|
|
1196
1220
|
)
|
|
1197
1221
|
};
|
|
1198
|
-
|
|
1222
|
+
const result = elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions);
|
|
1223
|
+
void vue.nextTick(() => {
|
|
1224
|
+
document.querySelectorAll(".s-message-box--selectable-title .el-message-box__title > span").forEach((title) => {
|
|
1225
|
+
if (title.dataset.selectableTitle) return;
|
|
1226
|
+
title.dataset.selectableTitle = "true";
|
|
1227
|
+
title.addEventListener("mousedown", (event) => event.stopPropagation());
|
|
1228
|
+
});
|
|
1229
|
+
});
|
|
1230
|
+
return result;
|
|
1199
1231
|
}
|
|
1200
1232
|
function _escapeHtml(value) {
|
|
1201
1233
|
return String(value).replace(/[&<>'"]/g, (character) => {
|
|
@@ -1224,7 +1256,7 @@ function _resolveAppendTarget(appendTo) {
|
|
|
1224
1256
|
try {
|
|
1225
1257
|
const selector = rawSelector.startsWith("#") || rawSelector.startsWith(".") || rawSelector.startsWith("[") ? rawSelector : `#${rawSelector}`;
|
|
1226
1258
|
return document.querySelector(selector) || appendTo;
|
|
1227
|
-
} catch {
|
|
1259
|
+
} catch (e) {
|
|
1228
1260
|
return appendTo;
|
|
1229
1261
|
}
|
|
1230
1262
|
}
|
|
@@ -1245,17 +1277,18 @@ function _resolveAppContext(appContext) {
|
|
|
1245
1277
|
}
|
|
1246
1278
|
const installWithContext = elementPlus.ElMessageBox.install;
|
|
1247
1279
|
const messageBoxWithContext = elementPlus.ElMessageBox;
|
|
1248
|
-
const elementPlusContext = installWithContext
|
|
1280
|
+
const elementPlusContext = (installWithContext == null ? void 0 : installWithContext.context) || messageBoxWithContext._context || null;
|
|
1249
1281
|
if (typeof document === "undefined") {
|
|
1250
1282
|
return elementPlusContext;
|
|
1251
1283
|
}
|
|
1252
1284
|
return elementPlusContext || _mountedAppContext();
|
|
1253
1285
|
}
|
|
1254
1286
|
function _mountedAppContext() {
|
|
1287
|
+
var _a, _b, _c;
|
|
1255
1288
|
const roots = [document.querySelector("#app"), document.querySelector("[data-v-app]")];
|
|
1256
1289
|
for (const root of roots) {
|
|
1257
1290
|
const element = root;
|
|
1258
|
-
const context = element
|
|
1291
|
+
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;
|
|
1259
1292
|
if (context) {
|
|
1260
1293
|
return context;
|
|
1261
1294
|
}
|
|
@@ -1272,7 +1305,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1272
1305
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1273
1306
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1274
1307
|
{
|
|
1275
|
-
return "2026-11-
|
|
1308
|
+
return "2026-11-24 15:42:10";
|
|
1276
1309
|
}
|
|
1277
1310
|
}
|
|
1278
1311
|
function test() {
|
|
@@ -67,11 +67,12 @@ const writeConfigFile = (relativePath, content, force) => {
|
|
|
67
67
|
console.log(`\u8986\u76D6 ${relativePath}\uFF08\u539F\u6587\u4EF6\u5DF2\u5907\u4EFD\u4E3A ${backupPath}\uFF09`);
|
|
68
68
|
};
|
|
69
69
|
const configurePackageJson = (force) => {
|
|
70
|
+
var _a;
|
|
70
71
|
const packageJsonPath = node_path.resolve(cwd, "package.json");
|
|
71
72
|
if (!node_fs.existsSync(packageJsonPath)) throw new Error(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5B58\u5728 package.json\uFF1A${cwd}`);
|
|
72
73
|
const packageJsonContent = node_fs.readFileSync(packageJsonPath, "utf8");
|
|
73
74
|
const packageJson = JSON.parse(packageJsonContent);
|
|
74
|
-
packageJson.scripts
|
|
75
|
+
(_a = packageJson.scripts) != null ? _a : packageJson.scripts = {};
|
|
75
76
|
let shouldBackup = false;
|
|
76
77
|
for (const [name, command2] of Object.entries(scripts)) {
|
|
77
78
|
const current = packageJson.scripts[name];
|
|
@@ -93,7 +94,7 @@ const configurePackageJson = (force) => {
|
|
|
93
94
|
const gitRoot = () => {
|
|
94
95
|
try {
|
|
95
96
|
return node_child_process.execFileSync("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8" }).trim();
|
|
96
|
-
} catch {
|
|
97
|
+
} catch (e) {
|
|
97
98
|
throw new Error(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5728 Git \u4ED3\u5E93\u4E2D\uFF0C\u65E0\u6CD5\u5B89\u88C5 Husky\uFF1A${cwd}`);
|
|
98
99
|
}
|
|
99
100
|
};
|
|
@@ -136,7 +137,7 @@ const configurePreCommit = () => {
|
|
|
136
137
|
node_fs.unlinkSync(obsoleteHook);
|
|
137
138
|
try {
|
|
138
139
|
node_fs.rmdirSync(obsoleteDir);
|
|
139
|
-
} catch {
|
|
140
|
+
} catch (e) {
|
|
140
141
|
}
|
|
141
142
|
}
|
|
142
143
|
}
|
|
@@ -60,11 +60,12 @@ const writeConfigFile = (relativePath, content, force) => {
|
|
|
60
60
|
console.log(`\u8986\u76D6 ${relativePath}\uFF08\u539F\u6587\u4EF6\u5DF2\u5907\u4EFD\u4E3A ${backupPath}\uFF09`);
|
|
61
61
|
};
|
|
62
62
|
const configurePackageJson = (force) => {
|
|
63
|
+
var _a;
|
|
63
64
|
const packageJsonPath = resolve(cwd, "package.json");
|
|
64
65
|
if (!existsSync(packageJsonPath)) throw new Error(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5B58\u5728 package.json\uFF1A${cwd}`);
|
|
65
66
|
const packageJsonContent = readFileSync(packageJsonPath, "utf8");
|
|
66
67
|
const packageJson = JSON.parse(packageJsonContent);
|
|
67
|
-
packageJson.scripts
|
|
68
|
+
(_a = packageJson.scripts) != null ? _a : packageJson.scripts = {};
|
|
68
69
|
let shouldBackup = false;
|
|
69
70
|
for (const [name, command2] of Object.entries(scripts)) {
|
|
70
71
|
const current = packageJson.scripts[name];
|
|
@@ -86,7 +87,7 @@ const configurePackageJson = (force) => {
|
|
|
86
87
|
const gitRoot = () => {
|
|
87
88
|
try {
|
|
88
89
|
return execFileSync("git", ["rev-parse", "--show-toplevel"], { cwd, encoding: "utf8" }).trim();
|
|
89
|
-
} catch {
|
|
90
|
+
} catch (e) {
|
|
90
91
|
throw new Error(`\u5F53\u524D\u76EE\u5F55\u4E0D\u5728 Git \u4ED3\u5E93\u4E2D\uFF0C\u65E0\u6CD5\u5B89\u88C5 Husky\uFF1A${cwd}`);
|
|
91
92
|
}
|
|
92
93
|
};
|
|
@@ -129,7 +130,7 @@ const configurePreCommit = () => {
|
|
|
129
130
|
unlinkSync(obsoleteHook);
|
|
130
131
|
try {
|
|
131
132
|
rmdirSync(obsoleteDir);
|
|
132
|
-
} catch {
|
|
133
|
+
} catch (e) {
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
}
|