@sybz-components/utils 1.0.3 → 1.0.5

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 CHANGED
@@ -3,7 +3,7 @@
3
3
  require('vue');
4
4
  require('consola');
5
5
  require('es-toolkit');
6
- const format = require('./shared/utils.BdgV5p_d.cjs');
6
+ const format = require('./shared/utils.3tjAW8jl.cjs');
7
7
  require('element-plus');
8
8
  require('./is.cjs');
9
9
 
package/dist/base.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { AppContext, VNode, Ref } from 'vue';
2
+ import { VNode, AppContext, Ref } from 'vue';
3
3
  import { ElMessageBoxOptions, MessageOptions, ElMessageBox } from 'element-plus';
4
4
 
5
5
  type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
@@ -116,7 +116,9 @@ interface CopyOptions extends ToastOptions {
116
116
  type WidthInput = string | number | Ref<string | number>;
117
117
  type ConfirmMessage = string | VNode | (() => VNode);
118
118
  type ConfirmVariant = 'default' | 'delete' | 'warning';
119
- interface ConfirmOptions extends ElMessageBoxOptions {
119
+ type ConfirmTheme = 'default' | 'chenghua' | 'shijingshan';
120
+ type ConfirmTarget = string | number;
121
+ interface ConfirmCustomOptions {
120
122
  /**
121
123
  * 确认框语义样式。
122
124
  */
@@ -124,16 +126,17 @@ interface ConfirmOptions extends ElMessageBoxOptions {
124
126
  /**
125
127
  * 删除场景中要操作的目标名称。
126
128
  */
127
- target?: string;
129
+ target?: ConfirmTarget;
128
130
  /**
129
131
  * 确认框主题。
130
132
  */
131
- theme?: 'default' | 'chenghua' | 'shijingshan';
133
+ theme?: ConfirmTheme;
132
134
  /**
133
135
  * 手动传入 appContext,处理多应用或嵌套弹窗场景。
134
136
  */
135
137
  appContext?: AppContext | null;
136
138
  }
139
+ type ConfirmOptions = ElMessageBoxOptions & ConfirmCustomOptions;
137
140
  interface TryCatchResult<T> {
138
141
  /**
139
142
  * 执行成功时返回的数据;失败时为 `null`。
@@ -391,8 +394,10 @@ declare function delay(delay?: number, fn?: () => void): Promise<void>;
391
394
  * @example
392
395
  * const rule = validateOnSubmit('required', { message: '请输入名称' })
393
396
  */
394
- declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
395
- declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
397
+ declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | false, pureValid?: false): ValidateRuleResult;
398
+ declare function validateOnSubmit(type: ValidateTypeInput | undefined, rules: ValidateInput | boolean | undefined, pureValid: true): boolean;
399
+ declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | false, pureValid?: false): ValidateRuleResult;
400
+ declare function validate(type: ValidateTypeInput | undefined, rules: ValidateInput | boolean | undefined, pureValid: true): boolean;
396
401
  /**
397
402
  * 复制文本到剪贴板。
398
403
  *
@@ -619,4 +624,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
619
624
  declare function test(): string;
620
625
 
621
626
  export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
622
- export type { ConfirmOptions };
627
+ export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant };
package/dist/base.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { AppContext, VNode, Ref } from 'vue';
2
+ import { VNode, AppContext, Ref } from 'vue';
3
3
  import { ElMessageBoxOptions, MessageOptions, ElMessageBox } from 'element-plus';
4
4
 
5
5
  type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
@@ -116,7 +116,9 @@ interface CopyOptions extends ToastOptions {
116
116
  type WidthInput = string | number | Ref<string | number>;
117
117
  type ConfirmMessage = string | VNode | (() => VNode);
118
118
  type ConfirmVariant = 'default' | 'delete' | 'warning';
119
- interface ConfirmOptions extends ElMessageBoxOptions {
119
+ type ConfirmTheme = 'default' | 'chenghua' | 'shijingshan';
120
+ type ConfirmTarget = string | number;
121
+ interface ConfirmCustomOptions {
120
122
  /**
121
123
  * 确认框语义样式。
122
124
  */
@@ -124,16 +126,17 @@ interface ConfirmOptions extends ElMessageBoxOptions {
124
126
  /**
125
127
  * 删除场景中要操作的目标名称。
126
128
  */
127
- target?: string;
129
+ target?: ConfirmTarget;
128
130
  /**
129
131
  * 确认框主题。
130
132
  */
131
- theme?: 'default' | 'chenghua' | 'shijingshan';
133
+ theme?: ConfirmTheme;
132
134
  /**
133
135
  * 手动传入 appContext,处理多应用或嵌套弹窗场景。
134
136
  */
135
137
  appContext?: AppContext | null;
136
138
  }
139
+ type ConfirmOptions = ElMessageBoxOptions & ConfirmCustomOptions;
137
140
  interface TryCatchResult<T> {
138
141
  /**
139
142
  * 执行成功时返回的数据;失败时为 `null`。
@@ -391,8 +394,10 @@ declare function delay(delay?: number, fn?: () => void): Promise<void>;
391
394
  * @example
392
395
  * const rule = validateOnSubmit('required', { message: '请输入名称' })
393
396
  */
394
- declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
395
- declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
397
+ declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | false, pureValid?: false): ValidateRuleResult;
398
+ declare function validateOnSubmit(type: ValidateTypeInput | undefined, rules: ValidateInput | boolean | undefined, pureValid: true): boolean;
399
+ declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | false, pureValid?: false): ValidateRuleResult;
400
+ declare function validate(type: ValidateTypeInput | undefined, rules: ValidateInput | boolean | undefined, pureValid: true): boolean;
396
401
  /**
397
402
  * 复制文本到剪贴板。
398
403
  *
@@ -619,4 +624,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
619
624
  declare function test(): string;
620
625
 
621
626
  export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
622
- export type { ConfirmOptions };
627
+ export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant };
package/dist/base.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as vue from 'vue';
2
- import { AppContext, VNode, Ref } from 'vue';
2
+ import { VNode, AppContext, Ref } from 'vue';
3
3
  import { ElMessageBoxOptions, MessageOptions, ElMessageBox } from 'element-plus';
4
4
 
5
5
  type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
@@ -116,7 +116,9 @@ interface CopyOptions extends ToastOptions {
116
116
  type WidthInput = string | number | Ref<string | number>;
117
117
  type ConfirmMessage = string | VNode | (() => VNode);
118
118
  type ConfirmVariant = 'default' | 'delete' | 'warning';
119
- interface ConfirmOptions extends ElMessageBoxOptions {
119
+ type ConfirmTheme = 'default' | 'chenghua' | 'shijingshan';
120
+ type ConfirmTarget = string | number;
121
+ interface ConfirmCustomOptions {
120
122
  /**
121
123
  * 确认框语义样式。
122
124
  */
@@ -124,16 +126,17 @@ interface ConfirmOptions extends ElMessageBoxOptions {
124
126
  /**
125
127
  * 删除场景中要操作的目标名称。
126
128
  */
127
- target?: string;
129
+ target?: ConfirmTarget;
128
130
  /**
129
131
  * 确认框主题。
130
132
  */
131
- theme?: 'default' | 'chenghua' | 'shijingshan';
133
+ theme?: ConfirmTheme;
132
134
  /**
133
135
  * 手动传入 appContext,处理多应用或嵌套弹窗场景。
134
136
  */
135
137
  appContext?: AppContext | null;
136
138
  }
139
+ type ConfirmOptions = ElMessageBoxOptions & ConfirmCustomOptions;
137
140
  interface TryCatchResult<T> {
138
141
  /**
139
142
  * 执行成功时返回的数据;失败时为 `null`。
@@ -391,8 +394,10 @@ declare function delay(delay?: number, fn?: () => void): Promise<void>;
391
394
  * @example
392
395
  * const rule = validateOnSubmit('required', { message: '请输入名称' })
393
396
  */
394
- declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
395
- declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | boolean, pureValid?: boolean): ValidateRuleResult | boolean;
397
+ declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput | false, pureValid?: false): ValidateRuleResult;
398
+ declare function validateOnSubmit(type: ValidateTypeInput | undefined, rules: ValidateInput | boolean | undefined, pureValid: true): boolean;
399
+ declare function validate(type?: ValidateTypeInput, rules?: ValidateInput | false, pureValid?: false): ValidateRuleResult;
400
+ declare function validate(type: ValidateTypeInput | undefined, rules: ValidateInput | boolean | undefined, pureValid: true): boolean;
396
401
  /**
397
402
  * 复制文本到剪贴板。
398
403
  *
@@ -619,4 +624,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
619
624
  declare function test(): string;
620
625
 
621
626
  export { $toast, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit };
622
- export type { ConfirmOptions };
627
+ export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant };
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.D_q5VNCx.mjs';
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.DaaLd-vj.mjs';
5
5
  import 'element-plus';
6
6
  import './is.mjs';
package/dist/format.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.BdgV5p_d.cjs');
3
+ const format = require('./shared/utils.3tjAW8jl.cjs');
4
4
  require('./is.cjs');
5
5
  require('consola');
6
6
  require('vue');
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.D_q5VNCx.mjs';
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.DaaLd-vj.mjs';
2
2
  import './is.mjs';
3
3
  import 'consola';
4
4
  import 'vue';
package/dist/index.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const format = require('./shared/utils.BdgV5p_d.cjs');
3
+ const format = require('./shared/utils.3tjAW8jl.cjs');
4
4
  const is = require('./is.cjs');
5
5
  require('vue');
6
6
  require('consola');
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- export { $toast, ConfirmOptions, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.cjs';
1
+ export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.cjs';
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.cjs';
3
3
  export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.cjs';
4
4
  import 'vue';
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- export { $toast, ConfirmOptions, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.mjs';
1
+ export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.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
  export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.mjs';
4
4
  import 'vue';
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { $toast, ConfirmOptions, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.js';
1
+ export { $toast, ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant, clearStorage, clone, confirm, copy, debounce, delay, getStorage, getType, getUtilsBuildTime, getVariable, isEmpty, log, merge, mockValue, processWidth, random, setStorage, test, throttle, toLine, tryCatch, validate, validateForm, validateOnSubmit } from './base.js';
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.js';
3
3
  export { FormatBytesConvertOptions, FormatBytesOptions, FormatTimeFallback, FormatTimeInput, FormatToFixedOptions, formatBytes, formatBytesConvert, formatDurationTime, formatTextToHtml, formatThousands, formatTime, formatToFixed } from './format.js';
4
4
  import 'vue';
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.D_q5VNCx.mjs';
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.DaaLd-vj.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';
@@ -994,7 +994,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
994
994
  return elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions);
995
995
  }
996
996
  function _escapeHtml(value) {
997
- return value.replace(/[&<>'"]/g, (character) => {
997
+ return String(value).replace(/[&<>'"]/g, (character) => {
998
998
  const entities = {
999
999
  "&": "&amp;",
1000
1000
  "<": "&lt;",
@@ -1058,7 +1058,7 @@ function getVariable(propertyName, fallback = "") {
1058
1058
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
1059
1059
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
1060
1060
  {
1061
- return "2026-08-05 15:34:14";
1061
+ return "2026-08-07 13:49:43";
1062
1062
  }
1063
1063
  }
1064
1064
  function test() {
@@ -992,7 +992,7 @@ function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null
992
992
  return ElMessageBox.confirm(resolvedMessage, mergeOptions);
993
993
  }
994
994
  function _escapeHtml(value) {
995
- return value.replace(/[&<>'"]/g, (character) => {
995
+ return String(value).replace(/[&<>'"]/g, (character) => {
996
996
  const entities = {
997
997
  "&": "&amp;",
998
998
  "<": "&lt;",
@@ -1056,7 +1056,7 @@ function getVariable(propertyName, fallback = "") {
1056
1056
  const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
1057
1057
  function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
1058
1058
  {
1059
- return "2026-08-05 15:34:14";
1059
+ return "2026-08-07 13:49:43";
1060
1060
  }
1061
1061
  }
1062
1062
  function test() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sybz-components/utils",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "utils of sybz-components",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",