@sybz-components/utils 1.0.1 → 1.0.2
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 +11 -8
- package/dist/base.d.mts +11 -8
- package/dist/base.d.ts +11 -8
- package/dist/base.mjs +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.mjs +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/shared/{utils.q3_d_9Nx.cjs → utils.CJVcMXo1.cjs} +3 -3
- package/dist/shared/{utils.C6HkWKyE.mjs → utils.D2T1ouSy.mjs} +3 -3
- package/package.json +1 -1
package/dist/base.cjs
CHANGED
package/dist/base.d.cts
CHANGED
|
@@ -136,8 +136,11 @@ interface TryCatchResult<T> {
|
|
|
136
136
|
*/
|
|
137
137
|
error: any;
|
|
138
138
|
}
|
|
139
|
+
type MessageType = 'success' | 'info' | 'error' | 'warning';
|
|
140
|
+
type ShortType = 's' | 'i' | 'e' | 'w';
|
|
141
|
+
type ToastType = MessageType | ShortType;
|
|
139
142
|
/**
|
|
140
|
-
*
|
|
143
|
+
* @description 显示消息提示。默认展示成功状态,并支持类型简写、完整配置和快捷调用。
|
|
141
144
|
*
|
|
142
145
|
* 支持三种常见写法:
|
|
143
146
|
* 1. `$toast('保存成功')`
|
|
@@ -150,22 +153,22 @@ interface TryCatchResult<T> {
|
|
|
150
153
|
* @returns 无返回值。
|
|
151
154
|
*
|
|
152
155
|
* @example
|
|
153
|
-
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { $toast } from '@sybz-components/utils'
|
|
154
158
|
*
|
|
155
|
-
*
|
|
159
|
+
* $toast('保存成功')
|
|
156
160
|
* $toast('保存失败', 'e')
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
161
|
* $toast({
|
|
160
162
|
* message: '自定义提示',
|
|
161
163
|
* type: 'warning',
|
|
162
164
|
* duration: 1000,
|
|
163
165
|
* closeAll: true,
|
|
164
166
|
* })
|
|
167
|
+
* $toast.error('接口请求失败', { showClose: true })
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @see {@link https://liulihao88.github.io/sybz-components/components/utils/$toast/home.html 详细文档}
|
|
165
171
|
*/
|
|
166
|
-
type MessageType = 'success' | 'info' | 'error' | 'warning';
|
|
167
|
-
type ShortType = 's' | 'i' | 'e' | 'w';
|
|
168
|
-
type ToastType = MessageType | ShortType;
|
|
169
172
|
declare function $toast(message: string | ToastOptions | VNode | (() => VNode), type?: ToastType | ToastOptions, otherParams?: ToastOptions): void;
|
|
170
173
|
declare namespace $toast {
|
|
171
174
|
var success: (message: string | ToastOptions | VNode<vue.RendererNode, vue.RendererElement, {
|
package/dist/base.d.mts
CHANGED
|
@@ -136,8 +136,11 @@ interface TryCatchResult<T> {
|
|
|
136
136
|
*/
|
|
137
137
|
error: any;
|
|
138
138
|
}
|
|
139
|
+
type MessageType = 'success' | 'info' | 'error' | 'warning';
|
|
140
|
+
type ShortType = 's' | 'i' | 'e' | 'w';
|
|
141
|
+
type ToastType = MessageType | ShortType;
|
|
139
142
|
/**
|
|
140
|
-
*
|
|
143
|
+
* @description 显示消息提示。默认展示成功状态,并支持类型简写、完整配置和快捷调用。
|
|
141
144
|
*
|
|
142
145
|
* 支持三种常见写法:
|
|
143
146
|
* 1. `$toast('保存成功')`
|
|
@@ -150,22 +153,22 @@ interface TryCatchResult<T> {
|
|
|
150
153
|
* @returns 无返回值。
|
|
151
154
|
*
|
|
152
155
|
* @example
|
|
153
|
-
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { $toast } from '@sybz-components/utils'
|
|
154
158
|
*
|
|
155
|
-
*
|
|
159
|
+
* $toast('保存成功')
|
|
156
160
|
* $toast('保存失败', 'e')
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
161
|
* $toast({
|
|
160
162
|
* message: '自定义提示',
|
|
161
163
|
* type: 'warning',
|
|
162
164
|
* duration: 1000,
|
|
163
165
|
* closeAll: true,
|
|
164
166
|
* })
|
|
167
|
+
* $toast.error('接口请求失败', { showClose: true })
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @see {@link https://liulihao88.github.io/sybz-components/components/utils/$toast/home.html 详细文档}
|
|
165
171
|
*/
|
|
166
|
-
type MessageType = 'success' | 'info' | 'error' | 'warning';
|
|
167
|
-
type ShortType = 's' | 'i' | 'e' | 'w';
|
|
168
|
-
type ToastType = MessageType | ShortType;
|
|
169
172
|
declare function $toast(message: string | ToastOptions | VNode | (() => VNode), type?: ToastType | ToastOptions, otherParams?: ToastOptions): void;
|
|
170
173
|
declare namespace $toast {
|
|
171
174
|
var success: (message: string | ToastOptions | VNode<vue.RendererNode, vue.RendererElement, {
|
package/dist/base.d.ts
CHANGED
|
@@ -136,8 +136,11 @@ interface TryCatchResult<T> {
|
|
|
136
136
|
*/
|
|
137
137
|
error: any;
|
|
138
138
|
}
|
|
139
|
+
type MessageType = 'success' | 'info' | 'error' | 'warning';
|
|
140
|
+
type ShortType = 's' | 'i' | 'e' | 'w';
|
|
141
|
+
type ToastType = MessageType | ShortType;
|
|
139
142
|
/**
|
|
140
|
-
*
|
|
143
|
+
* @description 显示消息提示。默认展示成功状态,并支持类型简写、完整配置和快捷调用。
|
|
141
144
|
*
|
|
142
145
|
* 支持三种常见写法:
|
|
143
146
|
* 1. `$toast('保存成功')`
|
|
@@ -150,22 +153,22 @@ interface TryCatchResult<T> {
|
|
|
150
153
|
* @returns 无返回值。
|
|
151
154
|
*
|
|
152
155
|
* @example
|
|
153
|
-
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* import { $toast } from '@sybz-components/utils'
|
|
154
158
|
*
|
|
155
|
-
*
|
|
159
|
+
* $toast('保存成功')
|
|
156
160
|
* $toast('保存失败', 'e')
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
161
|
* $toast({
|
|
160
162
|
* message: '自定义提示',
|
|
161
163
|
* type: 'warning',
|
|
162
164
|
* duration: 1000,
|
|
163
165
|
* closeAll: true,
|
|
164
166
|
* })
|
|
167
|
+
* $toast.error('接口请求失败', { showClose: true })
|
|
168
|
+
* ```
|
|
169
|
+
*
|
|
170
|
+
* @see {@link https://liulihao88.github.io/sybz-components/components/utils/$toast/home.html 详细文档}
|
|
165
171
|
*/
|
|
166
|
-
type MessageType = 'success' | 'info' | 'error' | 'warning';
|
|
167
|
-
type ShortType = 's' | 'i' | 'e' | 'w';
|
|
168
|
-
type ToastType = MessageType | ShortType;
|
|
169
172
|
declare function $toast(message: string | ToastOptions | VNode | (() => VNode), type?: ToastType | ToastOptions, otherParams?: ToastOptions): void;
|
|
170
173
|
declare namespace $toast {
|
|
171
174
|
var success: (message: string | ToastOptions | VNode<vue.RendererNode, vue.RendererElement, {
|
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.D2T1ouSy.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 formatTextToHtml, C as formatThousands, D as formatTime, E as formatToFixed } from './shared/utils.
|
|
1
|
+
export { y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatTextToHtml, C as formatThousands, D as formatTime, E as formatToFixed } from './shared/utils.D2T1ouSy.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
package/dist/index.cjs
CHANGED
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, f as delay, y as formatBytes, z as formatBytesConvert, A as formatDurationTime, B as formatTextToHtml, C as formatThousands, D as formatTime, E 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.
|
|
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 formatTextToHtml, C as formatThousands, D as formatTime, E 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.D2T1ouSy.mjs';
|
|
2
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';
|
|
3
3
|
import 'vue';
|
|
4
4
|
import 'consola';
|
|
@@ -110,7 +110,7 @@ function formatTime(time = /* @__PURE__ */ new Date(), cFormat = "{y}-{m}-{d} {h
|
|
|
110
110
|
} else if (dateOnlyRegex.test(timeStr)) {
|
|
111
111
|
const [, year, month, day] = timeStr.match(dateOnlyRegex);
|
|
112
112
|
date = new Date(Number(year), Number(month) - 1, Number(day));
|
|
113
|
-
} else if (
|
|
113
|
+
} else if (/^[+-]?\d+\.\d+$/.test(timeStr)) {
|
|
114
114
|
date = new Date(parseFloat(timeStr) * 1e3);
|
|
115
115
|
} else if (/^\d{10}$/.test(timeStr)) {
|
|
116
116
|
date = new Date(parseInt(timeStr) * 1e3);
|
|
@@ -366,7 +366,7 @@ function clearStorage(str = "") {
|
|
|
366
366
|
function _isObjectWithExclude(obj) {
|
|
367
367
|
return typeof obj === "object" && obj !== null && "exclude" in obj && Array.isArray(obj.exclude);
|
|
368
368
|
}
|
|
369
|
-
function validateForm(ref, { message = "\
|
|
369
|
+
function validateForm(ref, { message = "\u5B58\u5728\u5FC5\u586B\u9879\u672A\u586B\u5199\uFF0C\u8BF7\u8865\u5145\u5B8C\u6574", detail = false, showMessage = true } = {}) {
|
|
370
370
|
return new Promise((resolve, reject) => {
|
|
371
371
|
vue.unref(ref).validate((valid, status) => {
|
|
372
372
|
if (valid) {
|
|
@@ -1035,7 +1035,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1035
1035
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1036
1036
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1037
1037
|
{
|
|
1038
|
-
return "2026-07-
|
|
1038
|
+
return "2026-07-29 15:14:53";
|
|
1039
1039
|
}
|
|
1040
1040
|
}
|
|
1041
1041
|
function test() {
|
|
@@ -108,7 +108,7 @@ function formatTime(time = /* @__PURE__ */ new Date(), cFormat = "{y}-{m}-{d} {h
|
|
|
108
108
|
} else if (dateOnlyRegex.test(timeStr)) {
|
|
109
109
|
const [, year, month, day] = timeStr.match(dateOnlyRegex);
|
|
110
110
|
date = new Date(Number(year), Number(month) - 1, Number(day));
|
|
111
|
-
} else if (
|
|
111
|
+
} else if (/^[+-]?\d+\.\d+$/.test(timeStr)) {
|
|
112
112
|
date = new Date(parseFloat(timeStr) * 1e3);
|
|
113
113
|
} else if (/^\d{10}$/.test(timeStr)) {
|
|
114
114
|
date = new Date(parseInt(timeStr) * 1e3);
|
|
@@ -364,7 +364,7 @@ function clearStorage(str = "") {
|
|
|
364
364
|
function _isObjectWithExclude(obj) {
|
|
365
365
|
return typeof obj === "object" && obj !== null && "exclude" in obj && Array.isArray(obj.exclude);
|
|
366
366
|
}
|
|
367
|
-
function validateForm(ref, { message = "\
|
|
367
|
+
function validateForm(ref, { message = "\u5B58\u5728\u5FC5\u586B\u9879\u672A\u586B\u5199\uFF0C\u8BF7\u8865\u5145\u5B8C\u6574", detail = false, showMessage = true } = {}) {
|
|
368
368
|
return new Promise((resolve, reject) => {
|
|
369
369
|
unref(ref).validate((valid, status) => {
|
|
370
370
|
if (valid) {
|
|
@@ -1033,7 +1033,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1033
1033
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1034
1034
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1035
1035
|
{
|
|
1036
|
-
return "2026-07-
|
|
1036
|
+
return "2026-07-29 15:14:53";
|
|
1037
1037
|
}
|
|
1038
1038
|
}
|
|
1039
1039
|
function test() {
|