@sybz-components/utils 1.0.19 → 1.0.21
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.mjs +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.mjs +1 -1
- 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/shared/{utils.C6JV38T7.mjs → utils.D0Voi5F1.mjs} +19 -6
- package/dist/shared/{utils.s3A3s_9I.cjs → utils.nuyKxZXX.cjs} +19 -6
- package/package.json +8 -4
package/dist/base.cjs
CHANGED
package/dist/base.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
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 configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.
|
|
4
|
+
export { $ as $toast, c as clearStorage, a as clone, b as configureUtils, d as confirm, e as copy, f as debounce, g as delay, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.D0Voi5F1.mjs';
|
|
5
5
|
import './confirmSemantic.mjs';
|
|
6
6
|
import 'element-plus';
|
|
7
7
|
import 'axios';
|
package/dist/format.cjs
CHANGED
package/dist/format.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.
|
|
1
|
+
export { z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed } from './shared/utils.D0Voi5F1.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
package/dist/http.cjs
CHANGED
package/dist/http.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import 'axios';
|
|
2
|
-
export { H as HttpError, G as configureHttp, I as createHttp, J as http } from './shared/utils.
|
|
2
|
+
export { H as HttpError, G as configureHttp, I as createHttp, J as http } from './shared/utils.D0Voi5F1.mjs';
|
|
3
3
|
import 'vue';
|
|
4
4
|
import 'consola';
|
|
5
5
|
import 'es-toolkit';
|
package/dist/index.cjs
CHANGED
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { $ as $toast, H as HttpError, c as clearStorage, a as clone, G as configureHttp, b as configureUtils, d as confirm, e as copy, I as createHttp, f as debounce, g as delay, z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, J as http, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.
|
|
1
|
+
export { $ as $toast, H as HttpError, c as clearStorage, a as clone, G as configureHttp, b as configureUtils, d as confirm, e as copy, I as createHttp, f as debounce, g as delay, z as formatBytes, A as formatBytesConvert, B as formatDurationTime, C as formatTextToHtml, D as formatThousands, E as formatTime, F as formatToFixed, h as getStorage, i as getType, j as getUtilsBuildTime, k as getVariable, J as http, l as isEmpty, m as log, n as merge, o as mockValue, p as processWidth, r as random, s as setStorage, t as test, q as throttle, u as toLine, v as tryCatch, w as validate, x as validateForm, y as validateOnSubmit } from './shared/utils.D0Voi5F1.mjs';
|
|
2
2
|
export { resolveConfirmSemantic } from './confirmSemantic.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 { SYBZ_THEME_PREFIX, isSybzTheme, resolveSybzComponentTheme } from './theme.mjs';
|
|
@@ -418,7 +418,8 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
418
418
|
}
|
|
419
419
|
function showToast(options) {
|
|
420
420
|
const { theme = utilsConfig.theme, customClass, iconAttrs, handlers, ...messageOptions } = options;
|
|
421
|
-
const
|
|
421
|
+
const appContext = _resolveAppContext(null);
|
|
422
|
+
const appComponents = appContext?.components;
|
|
422
423
|
if (typeof messageOptions.icon === "string") {
|
|
423
424
|
const icon = appComponents?.SIcon ?? appComponents?.["s-icon"];
|
|
424
425
|
if (icon) {
|
|
@@ -445,11 +446,13 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
445
446
|
customClass !== "el" && theme !== "default" && `s-antd-message--${theme}`,
|
|
446
447
|
customClass !== "el" && customClass
|
|
447
448
|
);
|
|
448
|
-
|
|
449
|
+
const resolvedMessageOptions = {
|
|
449
450
|
...messageOptions,
|
|
450
451
|
showClose: options.showClose ?? true,
|
|
451
452
|
customClass: resolvedCustomClass
|
|
452
|
-
}
|
|
453
|
+
};
|
|
454
|
+
if (appContext) ElMessage(resolvedMessageOptions, appContext);
|
|
455
|
+
else ElMessage(resolvedMessageOptions);
|
|
453
456
|
}
|
|
454
457
|
if (isToastOptions(message)) {
|
|
455
458
|
showToast(message);
|
|
@@ -1240,8 +1243,18 @@ function _resolveAppContext(appContext) {
|
|
|
1240
1243
|
if (typeof document === "undefined") {
|
|
1241
1244
|
return elementPlusContext;
|
|
1242
1245
|
}
|
|
1243
|
-
|
|
1244
|
-
|
|
1246
|
+
return elementPlusContext || _mountedAppContext();
|
|
1247
|
+
}
|
|
1248
|
+
function _mountedAppContext() {
|
|
1249
|
+
const roots = [document.querySelector("#app"), document.querySelector("[data-v-app]")];
|
|
1250
|
+
for (const root of roots) {
|
|
1251
|
+
const element = root;
|
|
1252
|
+
const context = element?.__vue_app__?._context ?? element?._vue_app?._context;
|
|
1253
|
+
if (context) {
|
|
1254
|
+
return context;
|
|
1255
|
+
}
|
|
1256
|
+
}
|
|
1257
|
+
return null;
|
|
1245
1258
|
}
|
|
1246
1259
|
function getVariable(propertyName, fallback = "") {
|
|
1247
1260
|
if (typeof document === "undefined") {
|
|
@@ -1253,7 +1266,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1253
1266
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1254
1267
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1255
1268
|
{
|
|
1256
|
-
return "2026-11-
|
|
1269
|
+
return "2026-11-22 20:04:30";
|
|
1257
1270
|
}
|
|
1258
1271
|
}
|
|
1259
1272
|
function test() {
|
|
@@ -424,7 +424,8 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
424
424
|
}
|
|
425
425
|
function showToast(options) {
|
|
426
426
|
const { theme = utilsConfig.theme, customClass, iconAttrs, handlers, ...messageOptions } = options;
|
|
427
|
-
const
|
|
427
|
+
const appContext = _resolveAppContext(null);
|
|
428
|
+
const appComponents = appContext?.components;
|
|
428
429
|
if (typeof messageOptions.icon === "string") {
|
|
429
430
|
const icon = appComponents?.SIcon ?? appComponents?.["s-icon"];
|
|
430
431
|
if (icon) {
|
|
@@ -451,11 +452,13 @@ function $toast(message, type = "success", otherParams = {}) {
|
|
|
451
452
|
customClass !== "el" && theme !== "default" && `s-antd-message--${theme}`,
|
|
452
453
|
customClass !== "el" && customClass
|
|
453
454
|
);
|
|
454
|
-
|
|
455
|
+
const resolvedMessageOptions = {
|
|
455
456
|
...messageOptions,
|
|
456
457
|
showClose: options.showClose ?? true,
|
|
457
458
|
customClass: resolvedCustomClass
|
|
458
|
-
}
|
|
459
|
+
};
|
|
460
|
+
if (appContext) elementPlus.ElMessage(resolvedMessageOptions, appContext);
|
|
461
|
+
else elementPlus.ElMessage(resolvedMessageOptions);
|
|
459
462
|
}
|
|
460
463
|
if (isToastOptions(message)) {
|
|
461
464
|
showToast(message);
|
|
@@ -1246,8 +1249,18 @@ function _resolveAppContext(appContext) {
|
|
|
1246
1249
|
if (typeof document === "undefined") {
|
|
1247
1250
|
return elementPlusContext;
|
|
1248
1251
|
}
|
|
1249
|
-
|
|
1250
|
-
|
|
1252
|
+
return elementPlusContext || _mountedAppContext();
|
|
1253
|
+
}
|
|
1254
|
+
function _mountedAppContext() {
|
|
1255
|
+
const roots = [document.querySelector("#app"), document.querySelector("[data-v-app]")];
|
|
1256
|
+
for (const root of roots) {
|
|
1257
|
+
const element = root;
|
|
1258
|
+
const context = element?.__vue_app__?._context ?? element?._vue_app?._context;
|
|
1259
|
+
if (context) {
|
|
1260
|
+
return context;
|
|
1261
|
+
}
|
|
1262
|
+
}
|
|
1263
|
+
return null;
|
|
1251
1264
|
}
|
|
1252
1265
|
function getVariable(propertyName, fallback = "") {
|
|
1253
1266
|
if (typeof document === "undefined") {
|
|
@@ -1259,7 +1272,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1259
1272
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1260
1273
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1261
1274
|
{
|
|
1262
|
-
return "2026-11-
|
|
1275
|
+
return "2026-11-22 20:04:30";
|
|
1263
1276
|
}
|
|
1264
1277
|
}
|
|
1265
1278
|
function test() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sybz-components/utils",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.21",
|
|
4
4
|
"description": "utils of sybz-components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "commonjs",
|
|
@@ -64,7 +64,6 @@
|
|
|
64
64
|
"axios": "^1.19.0",
|
|
65
65
|
"code-inspector-plugin": "^2.0.9",
|
|
66
66
|
"consola": "^3.4.2",
|
|
67
|
-
"element-plus": "^2.11.5",
|
|
68
67
|
"es-toolkit": "^1.39.10",
|
|
69
68
|
"eslint": "9.39.4",
|
|
70
69
|
"eslint-config-prettier": "9.1.2",
|
|
@@ -75,10 +74,15 @@
|
|
|
75
74
|
"lodash-es": "^4.17.21",
|
|
76
75
|
"prettier": "3.8.4",
|
|
77
76
|
"tailwindcss": "^4.3.3",
|
|
78
|
-
"vue": "3.4.15",
|
|
79
77
|
"vue-eslint-parser": "10.4.1"
|
|
80
78
|
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"element-plus": "^2.11.5",
|
|
81
|
+
"vue": "3.4.15"
|
|
82
|
+
},
|
|
81
83
|
"peerDependencies": {
|
|
82
|
-
"
|
|
84
|
+
"element-plus": ">=2.3.0 <3",
|
|
85
|
+
"vite": ">=5 <7",
|
|
86
|
+
"vue": ">=3.4.0 <4"
|
|
83
87
|
}
|
|
84
88
|
}
|