@sybz-components/utils 1.0.2 → 1.0.4
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 +30 -8
- package/dist/base.d.mts +30 -8
- package/dist/base.d.ts +30 -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.d.cts +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.mjs +1 -1
- package/dist/shared/{utils.D2T1ouSy.mjs → utils.C2MJOkBA.mjs} +28 -5
- package/dist/shared/{utils.CJVcMXo1.cjs → utils.D-aYhNvS.cjs} +27 -4
- package/package.json +1 -1
package/dist/base.cjs
CHANGED
package/dist/base.d.cts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as element_plus from 'element-plus';
|
|
2
|
-
import { MessageOptions, ElMessageBoxOptions } from 'element-plus';
|
|
3
1
|
import * as vue from 'vue';
|
|
4
|
-
import { VNode,
|
|
2
|
+
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { ElMessageBoxOptions, MessageOptions, ElMessageBox } from 'element-plus';
|
|
5
4
|
|
|
6
5
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
7
6
|
type StorageValue = unknown;
|
|
@@ -116,16 +115,28 @@ interface CopyOptions extends ToastOptions {
|
|
|
116
115
|
}
|
|
117
116
|
type WidthInput = string | number | Ref<string | number>;
|
|
118
117
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
119
|
-
|
|
118
|
+
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
119
|
+
type ConfirmTheme = 'default' | 'chenghua' | 'shijingshan';
|
|
120
|
+
type ConfirmTarget = string | number;
|
|
121
|
+
interface ConfirmCustomOptions {
|
|
122
|
+
/**
|
|
123
|
+
* 确认框语义样式。
|
|
124
|
+
*/
|
|
125
|
+
variant?: ConfirmVariant;
|
|
126
|
+
/**
|
|
127
|
+
* 删除场景中要操作的目标名称。
|
|
128
|
+
*/
|
|
129
|
+
target?: ConfirmTarget;
|
|
120
130
|
/**
|
|
121
131
|
* 确认框主题。
|
|
122
132
|
*/
|
|
123
|
-
theme?:
|
|
133
|
+
theme?: ConfirmTheme;
|
|
124
134
|
/**
|
|
125
135
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
126
136
|
*/
|
|
127
137
|
appContext?: AppContext | null;
|
|
128
138
|
}
|
|
139
|
+
type ConfirmOptions = ElMessageBoxOptions & ConfirmCustomOptions;
|
|
129
140
|
interface TryCatchResult<T> {
|
|
130
141
|
/**
|
|
131
142
|
* 执行成功时返回的数据;失败时为 `null`。
|
|
@@ -383,8 +394,10 @@ declare function delay(delay?: number, fn?: () => void): Promise<void>;
|
|
|
383
394
|
* @example
|
|
384
395
|
* const rule = validateOnSubmit('required', { message: '请输入名称' })
|
|
385
396
|
*/
|
|
386
|
-
declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput |
|
|
387
|
-
declare function
|
|
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;
|
|
388
401
|
/**
|
|
389
402
|
* 复制文本到剪贴板。
|
|
390
403
|
*
|
|
@@ -571,8 +584,16 @@ declare function debounce<T extends Func>(func: T, delay?: number, immediate?: b
|
|
|
571
584
|
* showCancelButton: true,
|
|
572
585
|
* appendTo: '#dialogRoot',
|
|
573
586
|
* })
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* await confirm({
|
|
590
|
+
* variant: 'delete',
|
|
591
|
+
* target: '机器之心公众号',
|
|
592
|
+
* theme: 'shijingshan',
|
|
593
|
+
* })
|
|
574
594
|
*/
|
|
575
|
-
declare function confirm(
|
|
595
|
+
declare function confirm(options: ConfirmOptions, appContext?: AppContext | null): ReturnType<typeof ElMessageBox.confirm>;
|
|
596
|
+
declare function confirm(message: ConfirmMessage, options?: ConfirmOptions, appContext?: AppContext | null): ReturnType<typeof ElMessageBox.confirm>;
|
|
576
597
|
/**
|
|
577
598
|
* 读取根节点上的 CSS 自定义变量。
|
|
578
599
|
*
|
|
@@ -603,3 +624,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
603
624
|
declare function test(): string;
|
|
604
625
|
|
|
605
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 };
|
|
627
|
+
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant };
|
package/dist/base.d.mts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as element_plus from 'element-plus';
|
|
2
|
-
import { MessageOptions, ElMessageBoxOptions } from 'element-plus';
|
|
3
1
|
import * as vue from 'vue';
|
|
4
|
-
import { VNode,
|
|
2
|
+
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { ElMessageBoxOptions, MessageOptions, ElMessageBox } from 'element-plus';
|
|
5
4
|
|
|
6
5
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
7
6
|
type StorageValue = unknown;
|
|
@@ -116,16 +115,28 @@ interface CopyOptions extends ToastOptions {
|
|
|
116
115
|
}
|
|
117
116
|
type WidthInput = string | number | Ref<string | number>;
|
|
118
117
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
119
|
-
|
|
118
|
+
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
119
|
+
type ConfirmTheme = 'default' | 'chenghua' | 'shijingshan';
|
|
120
|
+
type ConfirmTarget = string | number;
|
|
121
|
+
interface ConfirmCustomOptions {
|
|
122
|
+
/**
|
|
123
|
+
* 确认框语义样式。
|
|
124
|
+
*/
|
|
125
|
+
variant?: ConfirmVariant;
|
|
126
|
+
/**
|
|
127
|
+
* 删除场景中要操作的目标名称。
|
|
128
|
+
*/
|
|
129
|
+
target?: ConfirmTarget;
|
|
120
130
|
/**
|
|
121
131
|
* 确认框主题。
|
|
122
132
|
*/
|
|
123
|
-
theme?:
|
|
133
|
+
theme?: ConfirmTheme;
|
|
124
134
|
/**
|
|
125
135
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
126
136
|
*/
|
|
127
137
|
appContext?: AppContext | null;
|
|
128
138
|
}
|
|
139
|
+
type ConfirmOptions = ElMessageBoxOptions & ConfirmCustomOptions;
|
|
129
140
|
interface TryCatchResult<T> {
|
|
130
141
|
/**
|
|
131
142
|
* 执行成功时返回的数据;失败时为 `null`。
|
|
@@ -383,8 +394,10 @@ declare function delay(delay?: number, fn?: () => void): Promise<void>;
|
|
|
383
394
|
* @example
|
|
384
395
|
* const rule = validateOnSubmit('required', { message: '请输入名称' })
|
|
385
396
|
*/
|
|
386
|
-
declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput |
|
|
387
|
-
declare function
|
|
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;
|
|
388
401
|
/**
|
|
389
402
|
* 复制文本到剪贴板。
|
|
390
403
|
*
|
|
@@ -571,8 +584,16 @@ declare function debounce<T extends Func>(func: T, delay?: number, immediate?: b
|
|
|
571
584
|
* showCancelButton: true,
|
|
572
585
|
* appendTo: '#dialogRoot',
|
|
573
586
|
* })
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* await confirm({
|
|
590
|
+
* variant: 'delete',
|
|
591
|
+
* target: '机器之心公众号',
|
|
592
|
+
* theme: 'shijingshan',
|
|
593
|
+
* })
|
|
574
594
|
*/
|
|
575
|
-
declare function confirm(
|
|
595
|
+
declare function confirm(options: ConfirmOptions, appContext?: AppContext | null): ReturnType<typeof ElMessageBox.confirm>;
|
|
596
|
+
declare function confirm(message: ConfirmMessage, options?: ConfirmOptions, appContext?: AppContext | null): ReturnType<typeof ElMessageBox.confirm>;
|
|
576
597
|
/**
|
|
577
598
|
* 读取根节点上的 CSS 自定义变量。
|
|
578
599
|
*
|
|
@@ -603,3 +624,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
603
624
|
declare function test(): string;
|
|
604
625
|
|
|
605
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 };
|
|
627
|
+
export type { ConfirmCustomOptions, ConfirmMessage, ConfirmOptions, ConfirmTarget, ConfirmTheme, ConfirmVariant };
|
package/dist/base.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import * as element_plus from 'element-plus';
|
|
2
|
-
import { MessageOptions, ElMessageBoxOptions } from 'element-plus';
|
|
3
1
|
import * as vue from 'vue';
|
|
4
|
-
import { VNode,
|
|
2
|
+
import { VNode, AppContext, Ref } from 'vue';
|
|
3
|
+
import { ElMessageBoxOptions, MessageOptions, ElMessageBox } from 'element-plus';
|
|
5
4
|
|
|
6
5
|
type Func<Args extends any[] = any[], Return = any> = (...args: Args) => Return;
|
|
7
6
|
type StorageValue = unknown;
|
|
@@ -116,16 +115,28 @@ interface CopyOptions extends ToastOptions {
|
|
|
116
115
|
}
|
|
117
116
|
type WidthInput = string | number | Ref<string | number>;
|
|
118
117
|
type ConfirmMessage = string | VNode | (() => VNode);
|
|
119
|
-
|
|
118
|
+
type ConfirmVariant = 'default' | 'delete' | 'warning';
|
|
119
|
+
type ConfirmTheme = 'default' | 'chenghua' | 'shijingshan';
|
|
120
|
+
type ConfirmTarget = string | number;
|
|
121
|
+
interface ConfirmCustomOptions {
|
|
122
|
+
/**
|
|
123
|
+
* 确认框语义样式。
|
|
124
|
+
*/
|
|
125
|
+
variant?: ConfirmVariant;
|
|
126
|
+
/**
|
|
127
|
+
* 删除场景中要操作的目标名称。
|
|
128
|
+
*/
|
|
129
|
+
target?: ConfirmTarget;
|
|
120
130
|
/**
|
|
121
131
|
* 确认框主题。
|
|
122
132
|
*/
|
|
123
|
-
theme?:
|
|
133
|
+
theme?: ConfirmTheme;
|
|
124
134
|
/**
|
|
125
135
|
* 手动传入 appContext,处理多应用或嵌套弹窗场景。
|
|
126
136
|
*/
|
|
127
137
|
appContext?: AppContext | null;
|
|
128
138
|
}
|
|
139
|
+
type ConfirmOptions = ElMessageBoxOptions & ConfirmCustomOptions;
|
|
129
140
|
interface TryCatchResult<T> {
|
|
130
141
|
/**
|
|
131
142
|
* 执行成功时返回的数据;失败时为 `null`。
|
|
@@ -383,8 +394,10 @@ declare function delay(delay?: number, fn?: () => void): Promise<void>;
|
|
|
383
394
|
* @example
|
|
384
395
|
* const rule = validateOnSubmit('required', { message: '请输入名称' })
|
|
385
396
|
*/
|
|
386
|
-
declare function validateOnSubmit(type?: ValidateTypeInput, rules?: ValidateInput |
|
|
387
|
-
declare function
|
|
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;
|
|
388
401
|
/**
|
|
389
402
|
* 复制文本到剪贴板。
|
|
390
403
|
*
|
|
@@ -571,8 +584,16 @@ declare function debounce<T extends Func>(func: T, delay?: number, immediate?: b
|
|
|
571
584
|
* showCancelButton: true,
|
|
572
585
|
* appendTo: '#dialogRoot',
|
|
573
586
|
* })
|
|
587
|
+
*
|
|
588
|
+
* @example
|
|
589
|
+
* await confirm({
|
|
590
|
+
* variant: 'delete',
|
|
591
|
+
* target: '机器之心公众号',
|
|
592
|
+
* theme: 'shijingshan',
|
|
593
|
+
* })
|
|
574
594
|
*/
|
|
575
|
-
declare function confirm(
|
|
595
|
+
declare function confirm(options: ConfirmOptions, appContext?: AppContext | null): ReturnType<typeof ElMessageBox.confirm>;
|
|
596
|
+
declare function confirm(message: ConfirmMessage, options?: ConfirmOptions, appContext?: AppContext | null): ReturnType<typeof ElMessageBox.confirm>;
|
|
576
597
|
/**
|
|
577
598
|
* 读取根节点上的 CSS 自定义变量。
|
|
578
599
|
*
|
|
@@ -603,3 +624,4 @@ declare function getUtilsBuildTime(fallback?: string): string;
|
|
|
603
624
|
declare function test(): string;
|
|
604
625
|
|
|
605
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 };
|
|
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.
|
|
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.C2MJOkBA.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.C2MJOkBA.mjs';
|
|
2
2
|
import './is.mjs';
|
|
3
3
|
import 'consola';
|
|
4
4
|
import 'vue';
|
package/dist/index.cjs
CHANGED
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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 } 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
|
-
import 'element-plus';
|
|
5
4
|
import 'vue';
|
|
5
|
+
import 'element-plus';
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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 } 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
|
-
import 'element-plus';
|
|
5
4
|
import 'vue';
|
|
5
|
+
import 'element-plus';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
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 } 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
|
-
import 'element-plus';
|
|
5
4
|
import 'vue';
|
|
5
|
+
import 'element-plus';
|
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.C2MJOkBA.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';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isRef, unref, toRaw } from 'vue';
|
|
1
|
+
import { isRef, unref, isVNode, toRaw } from 'vue';
|
|
2
2
|
import { consola } from 'consola';
|
|
3
3
|
import { cloneDeep } from 'es-toolkit';
|
|
4
4
|
import { ElMessage, ElMessageBox } from 'element-plus';
|
|
@@ -935,9 +935,16 @@ function debounce(func, delay2 = 500, immediate, resultCallback) {
|
|
|
935
935
|
};
|
|
936
936
|
return _debounce;
|
|
937
937
|
}
|
|
938
|
-
function confirm(
|
|
938
|
+
function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null) {
|
|
939
|
+
const isOptionsCall = typeof messageOrOptions === "object" && messageOrOptions !== null && !isVNode(messageOrOptions);
|
|
940
|
+
const options = isOptionsCall ? messageOrOptions : optionsOrAppContext ?? {};
|
|
941
|
+
const message = isOptionsCall ? options.message ?? "" : messageOrOptions;
|
|
942
|
+
const argumentAppContext = isOptionsCall ? optionsOrAppContext : appContext;
|
|
939
943
|
const {
|
|
944
|
+
message: _message,
|
|
940
945
|
theme,
|
|
946
|
+
variant = "default",
|
|
947
|
+
target,
|
|
941
948
|
customClass,
|
|
942
949
|
confirmButtonClass,
|
|
943
950
|
cancelButtonClass,
|
|
@@ -945,11 +952,13 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
945
952
|
appContext: optionAppContext,
|
|
946
953
|
...messageBoxOptions
|
|
947
954
|
} = options;
|
|
948
|
-
const
|
|
955
|
+
const inputMessage = typeof message === "function" ? message() : message;
|
|
956
|
+
const resolvedMessage = variant === "delete" && target !== void 0 && !inputMessage ? `\u786E\u8BA4\u8981\u5220\u9664<code type="danger">${_escapeHtml(target)}</code>\u5417? \u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002` : inputMessage;
|
|
949
957
|
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
950
|
-
const resolvedAppContext = _resolveAppContext(optionAppContext ||
|
|
958
|
+
const resolvedAppContext = _resolveAppContext(optionAppContext || argumentAppContext);
|
|
951
959
|
const isChenghuaTheme = theme === "chenghua";
|
|
952
960
|
const isShijingshanTheme = theme === "shijingshan";
|
|
961
|
+
const variantOptions = variant === "delete" ? { title: "\u5220\u9664\u786E\u8BA4", confirmButtonText: "\u5220\u9664" } : variant === "warning" ? { title: "\u8B66\u544A" } : {};
|
|
953
962
|
const mergeOptions = {
|
|
954
963
|
title: "\u63D0\u793A",
|
|
955
964
|
draggable: true,
|
|
@@ -957,12 +966,14 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
957
966
|
cancelButtonText: "\u53D6\u6D88",
|
|
958
967
|
confirmButtonText: "\u786E\u5B9A",
|
|
959
968
|
dangerouslyUseHTMLString: true,
|
|
969
|
+
...variantOptions,
|
|
960
970
|
...messageBoxOptions,
|
|
961
971
|
appendTo: resolvedAppendTo,
|
|
962
972
|
appContext: resolvedAppContext,
|
|
963
973
|
customClass: _mergeClassNames(
|
|
964
974
|
isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
|
|
965
975
|
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
|
|
976
|
+
variant !== "default" && `s-message-box--${variant}`,
|
|
966
977
|
customClass
|
|
967
978
|
),
|
|
968
979
|
confirmButtonClass: _mergeClassNames(
|
|
@@ -980,6 +991,18 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
980
991
|
};
|
|
981
992
|
return ElMessageBox.confirm(resolvedMessage, mergeOptions);
|
|
982
993
|
}
|
|
994
|
+
function _escapeHtml(value) {
|
|
995
|
+
return String(value).replace(/[&<>'"]/g, (character) => {
|
|
996
|
+
const entities = {
|
|
997
|
+
"&": "&",
|
|
998
|
+
"<": "<",
|
|
999
|
+
">": ">",
|
|
1000
|
+
"'": "'",
|
|
1001
|
+
'"': """
|
|
1002
|
+
};
|
|
1003
|
+
return entities[character];
|
|
1004
|
+
});
|
|
1005
|
+
}
|
|
983
1006
|
function _mergeClassNames(...classNames) {
|
|
984
1007
|
return classNames.filter(Boolean).join(" ");
|
|
985
1008
|
}
|
|
@@ -1033,7 +1056,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1033
1056
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1034
1057
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1035
1058
|
{
|
|
1036
|
-
return "2026-07
|
|
1059
|
+
return "2026-08-07 13:36:52";
|
|
1037
1060
|
}
|
|
1038
1061
|
}
|
|
1039
1062
|
function test() {
|
|
@@ -937,9 +937,16 @@ function debounce(func, delay2 = 500, immediate, resultCallback) {
|
|
|
937
937
|
};
|
|
938
938
|
return _debounce;
|
|
939
939
|
}
|
|
940
|
-
function confirm(
|
|
940
|
+
function confirm(messageOrOptions, optionsOrAppContext = null, appContext = null) {
|
|
941
|
+
const isOptionsCall = typeof messageOrOptions === "object" && messageOrOptions !== null && !vue.isVNode(messageOrOptions);
|
|
942
|
+
const options = isOptionsCall ? messageOrOptions : optionsOrAppContext ?? {};
|
|
943
|
+
const message = isOptionsCall ? options.message ?? "" : messageOrOptions;
|
|
944
|
+
const argumentAppContext = isOptionsCall ? optionsOrAppContext : appContext;
|
|
941
945
|
const {
|
|
946
|
+
message: _message,
|
|
942
947
|
theme,
|
|
948
|
+
variant = "default",
|
|
949
|
+
target,
|
|
943
950
|
customClass,
|
|
944
951
|
confirmButtonClass,
|
|
945
952
|
cancelButtonClass,
|
|
@@ -947,11 +954,13 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
947
954
|
appContext: optionAppContext,
|
|
948
955
|
...messageBoxOptions
|
|
949
956
|
} = options;
|
|
950
|
-
const
|
|
957
|
+
const inputMessage = typeof message === "function" ? message() : message;
|
|
958
|
+
const resolvedMessage = variant === "delete" && target !== void 0 && !inputMessage ? `\u786E\u8BA4\u8981\u5220\u9664<code type="danger">${_escapeHtml(target)}</code>\u5417? \u5220\u9664\u540E\u4E0D\u53EF\u6062\u590D\u3002` : inputMessage;
|
|
951
959
|
const resolvedAppendTo = _resolveAppendTarget(appendTo);
|
|
952
|
-
const resolvedAppContext = _resolveAppContext(optionAppContext ||
|
|
960
|
+
const resolvedAppContext = _resolveAppContext(optionAppContext || argumentAppContext);
|
|
953
961
|
const isChenghuaTheme = theme === "chenghua";
|
|
954
962
|
const isShijingshanTheme = theme === "shijingshan";
|
|
963
|
+
const variantOptions = variant === "delete" ? { title: "\u5220\u9664\u786E\u8BA4", confirmButtonText: "\u5220\u9664" } : variant === "warning" ? { title: "\u8B66\u544A" } : {};
|
|
955
964
|
const mergeOptions = {
|
|
956
965
|
title: "\u63D0\u793A",
|
|
957
966
|
draggable: true,
|
|
@@ -959,12 +968,14 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
959
968
|
cancelButtonText: "\u53D6\u6D88",
|
|
960
969
|
confirmButtonText: "\u786E\u5B9A",
|
|
961
970
|
dangerouslyUseHTMLString: true,
|
|
971
|
+
...variantOptions,
|
|
962
972
|
...messageBoxOptions,
|
|
963
973
|
appendTo: resolvedAppendTo,
|
|
964
974
|
appContext: resolvedAppContext,
|
|
965
975
|
customClass: _mergeClassNames(
|
|
966
976
|
isChenghuaTheme && CHENGHUA_CONFIRM_BOX_CLASS,
|
|
967
977
|
isShijingshanTheme && SHIJINGSHAN_CONFIRM_BOX_CLASS,
|
|
978
|
+
variant !== "default" && `s-message-box--${variant}`,
|
|
968
979
|
customClass
|
|
969
980
|
),
|
|
970
981
|
confirmButtonClass: _mergeClassNames(
|
|
@@ -982,6 +993,18 @@ function confirm(message, options = {}, appContext = null) {
|
|
|
982
993
|
};
|
|
983
994
|
return elementPlus.ElMessageBox.confirm(resolvedMessage, mergeOptions);
|
|
984
995
|
}
|
|
996
|
+
function _escapeHtml(value) {
|
|
997
|
+
return String(value).replace(/[&<>'"]/g, (character) => {
|
|
998
|
+
const entities = {
|
|
999
|
+
"&": "&",
|
|
1000
|
+
"<": "<",
|
|
1001
|
+
">": ">",
|
|
1002
|
+
"'": "'",
|
|
1003
|
+
'"': """
|
|
1004
|
+
};
|
|
1005
|
+
return entities[character];
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
985
1008
|
function _mergeClassNames(...classNames) {
|
|
986
1009
|
return classNames.filter(Boolean).join(" ");
|
|
987
1010
|
}
|
|
@@ -1035,7 +1058,7 @@ function getVariable(propertyName, fallback = "") {
|
|
|
1035
1058
|
const DEFAULT_BUILD_TIME_FALLBACK = "\u672A\u6CE8\u5165";
|
|
1036
1059
|
function getUtilsBuildTime(fallback = DEFAULT_BUILD_TIME_FALLBACK) {
|
|
1037
1060
|
{
|
|
1038
|
-
return "2026-07
|
|
1061
|
+
return "2026-08-07 13:36:52";
|
|
1039
1062
|
}
|
|
1040
1063
|
}
|
|
1041
1064
|
function test() {
|