@vunk/form 2.19.20 → 2.19.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/components/ai-provider/index.cjs +1 -0
- package/components/ai-provider/index.d.ts +7 -0
- package/components/ai-provider/index.mjs +61 -0
- package/components/ai-provider/src/ctx.d.ts +8 -0
- package/components/ai-provider/src/index.vue.d.ts +23 -0
- package/components/ai-provider/src/types.d.ts +56 -0
- package/components/ai-provider/src/use.d.ts +3 -0
- package/components/api-tables-select/index.cjs +1 -1
- package/components/api-tables-select/index.mjs +1 -1
- package/components/api-tables-select/src/ctx.d.ts +57 -57
- package/components/api-tables-select/src/index.vue.d.ts +46 -419
- package/components/button/index.cjs +1 -1
- package/components/button/index.mjs +12 -12
- package/components/button/src/ctx.d.ts +7 -2
- package/components/button/src/index.vue.d.ts +36 -14
- package/components/card-input-collection/index.cjs +1 -1
- package/components/card-input-collection/index.mjs +136 -141
- package/components/card-input-collection/src/core.vue.d.ts +18 -7
- package/components/card-input-collection/src/ctx.d.ts +7 -2
- package/components/card-input-collection/src/index.vue.d.ts +18 -7
- package/components/cascader/index.cjs +1 -1
- package/components/cascader/index.mjs +38 -39
- package/components/cascader/src/ctx.d.ts +8 -3
- package/components/cascader/src/index.vue.d.ts +19 -8
- package/components/checkbox/src/ctx.d.ts +8 -3
- package/components/checkbox/src/index.vue.d.ts +43 -21
- package/components/{cloneDeep-DE0l40hv.mjs → cloneDeep-2YeQ7w2t.mjs} +10 -10
- package/components/cloneDeep-Btpy0oPF.js +1 -0
- package/components/collapse/index.cjs +1 -1
- package/components/collapse/index.mjs +19 -22
- package/components/collapse-item/index.cjs +1 -1
- package/components/collapse-item/index.mjs +21 -21
- package/components/collapse-item/src/index.vue.d.ts +2 -2
- package/components/color-picker/index.cjs +1 -1
- package/components/color-picker/index.mjs +26 -27
- package/components/color-picker/src/ctx.d.ts +7 -2
- package/components/color-picker/src/index.vue.d.ts +17 -6
- package/components/{style.css → components.css} +1 -1
- package/components/date-picker/index.cjs +1 -1
- package/components/date-picker/index.mjs +40 -41
- package/components/date-picker/src/ctx.d.ts +8 -3
- package/components/date-picker/src/index.vue.d.ts +17 -6
- package/components/date-picker-range/index.cjs +1 -1
- package/components/date-picker-range/index.mjs +17 -17
- package/components/date-picker-range/src/ctx.d.ts +14 -9
- package/components/date-picker-range/src/index.vue.d.ts +48 -26
- package/components/dialog/index.cjs +1 -1
- package/components/dialog/index.mjs +41 -52
- package/components/dialog/src/ctx.d.ts +1 -1
- package/components/dialog/src/index.vue.d.ts +1 -1
- package/components/dialog-input-collection/index.cjs +1 -1
- package/components/dialog-input-collection/index.mjs +124 -122
- package/components/dialog-input-collection/src/ctx.d.ts +7 -2
- package/components/dialog-input-collection/src/dialog-form.vue.d.ts +1 -1
- package/components/dialog-input-collection/src/index.vue.d.ts +17 -6
- package/components/download-plus/index.cjs +1 -1
- package/components/download-plus/index.mjs +193 -202
- package/components/download-plus/src/ctx.d.ts +7 -2
- package/components/download-plus/src/index.vue.d.ts +32 -10
- package/components/editable-text/index.cjs +1 -1
- package/components/editable-text/index.mjs +72 -75
- package/components/editable-text/src/ctx.d.ts +7 -2
- package/components/editable-text/src/index.vue.d.ts +18 -7
- package/components/el-slider/index.cjs +1 -1
- package/components/el-slider/index.mjs +230 -233
- package/components/el-slider/src/composables/index.cjs +1 -1
- package/components/el-slider/src/composables/index.mjs +1 -1
- package/components/el-slider/src/slider-core.vue.d.ts +3 -3
- package/components/esri-input-geojson/index.cjs +1 -5
- package/components/esri-input-geojson/index.mjs +59 -68
- package/components/esri-input-geojson/src/append.vue.d.ts +2 -2
- package/components/esri-input-geojson/src/ctx.d.ts +9 -4
- package/components/esri-input-geojson/src/index.vue.d.ts +65 -30
- package/components/fieldset/src/index.vue.d.ts +1 -1
- package/components/form/index.cjs +1 -1
- package/components/form/index.mjs +96 -101
- package/components/form/src/ctx.d.ts +2 -2
- package/components/form/src/index.vue.d.ts +4 -4
- package/components/form/src/use.d.ts +2 -2
- package/components/form-item/index.cjs +1 -1
- package/components/form-item/index.mjs +179 -107
- package/components/form-item/src/core.vue.d.ts +7 -3
- package/components/form-item/src/ctx.d.ts +7 -1
- package/components/form-item/src/index.vue.d.ts +13 -2
- package/components/form-item/src/use.d.ts +11 -0
- package/components/form-item-renderer/index.cjs +1 -1
- package/components/form-item-renderer/index.d.ts +1 -0
- package/components/form-item-renderer/index.mjs +85 -78
- package/components/form-item-renderer/src/use.d.ts +3 -0
- package/components/forms-provider/index.cjs +1 -1
- package/components/forms-provider/index.mjs +18 -21
- package/components/index-BIo_4rr_.mjs +18620 -0
- package/components/index-Bc7UifHG.js +1 -0
- package/components/index-D0D9ABpH.js +108 -0
- package/components/{index-CeHbpfCD.mjs → index-DCNYT7Wv.mjs} +0 -1
- package/components/information-collection/index.cjs +1 -1
- package/components/information-collection/index.mjs +32 -38
- package/components/information-collection/src/ctx.d.ts +7 -2
- package/components/information-collection/src/index.vue.d.ts +17 -6
- package/components/information-tag/index.cjs +1 -1
- package/components/information-tag/index.mjs +9 -12
- package/components/information-tag/src/index.vue.d.ts +1 -1
- package/components/input/index.cjs +1 -1
- package/components/input/index.mjs +27 -27
- package/components/input/src/ctx.d.ts +9 -4
- package/components/input/src/index.vue.d.ts +35 -13
- package/components/input-array/index.cjs +1 -1
- package/components/input-array/index.mjs +71 -74
- package/components/input-array/src/ctx.d.ts +7 -2
- package/components/input-array/src/index.vue.d.ts +18 -7
- package/components/input-collection/index.cjs +1 -1
- package/components/input-collection/index.mjs +121 -126
- package/components/input-collection/src/core.vue.d.ts +17 -6
- package/components/input-collection/src/ctx.d.ts +7 -2
- package/components/input-collection/src/index.vue.d.ts +17 -6
- package/components/input-file/src/index.vue.d.ts +19 -8
- package/components/input-link/index.cjs +1 -1
- package/components/input-link/index.mjs +1 -1
- package/components/input-link/src/ctx.d.ts +7 -2
- package/components/input-link/src/index.vue.d.ts +54 -21
- package/components/input-number/index.cjs +1 -1
- package/components/input-number/index.mjs +30 -33
- package/components/input-number/src/ctx.d.ts +8 -3
- package/components/input-number/src/index.vue.d.ts +33 -11
- package/components/input-tag/index.cjs +1 -1
- package/components/input-tag/index.mjs +24 -24
- package/components/input-tag/src/ctx.d.ts +9 -4
- package/components/input-tag/src/index.vue.d.ts +33 -11
- package/components/monaco-editor/src/ctx.d.ts +8 -3
- package/components/monaco-editor/src/index.vue.d.ts +38 -16
- package/components/radio/src/ctx.d.ts +7 -2
- package/components/radio/src/index.vue.d.ts +40 -18
- package/components/radio/src/wraper.vue.d.ts +22 -11
- package/components/renderer-data/index.cjs +1 -1
- package/components/renderer-data/index.mjs +14 -17
- package/components/select/index.cjs +1 -1
- package/components/select/index.mjs +167 -131
- package/components/select/src/core.vue.d.ts +96 -69
- package/components/select/src/ctx.d.ts +9 -4
- package/components/select/src/index.vue.d.ts +53 -42
- package/components/slider/index.cjs +1 -1
- package/components/slider/index.mjs +30 -31
- package/components/slider/src/ctx.d.ts +7 -2
- package/components/slider/src/index.vue.d.ts +18 -7
- package/components/switch/src/ctx.d.ts +7 -2
- package/components/switch/src/index.vue.d.ts +18 -7
- package/components/tables-select/index.cjs +1 -1
- package/components/tables-select/index.mjs +4 -4
- package/components/tables-select/src/ctx.d.ts +68 -68
- package/components/tables-select/src/index.vue.d.ts +52 -420
- package/components/template-instances-provider/index.cjs +1 -1
- package/components/template-instances-provider/index.mjs +11 -17
- package/components/templates-default/src/index.vue.d.ts +404 -185
- package/components/templates-esri/src/index.vue.d.ts +65 -30
- package/components/templates-variant/src/index.vue.d.ts +48 -26
- package/components/time-picker/index.cjs +1 -1
- package/components/time-picker/index.mjs +38 -39
- package/components/time-picker/src/ctx.d.ts +8 -3
- package/components/time-picker/src/index.vue.d.ts +17 -6
- package/components/upload/index.cjs +1 -1
- package/components/upload/index.mjs +244 -253
- package/components/upload/src/ctx.d.ts +8 -3
- package/components/upload/src/file.vue.d.ts +3 -3
- package/components/upload/src/index.vue.d.ts +37 -15
- package/components/upload/src/wraper.vue.d.ts +19 -8
- package/components/upload-plus/index.cjs +7 -15
- package/components/upload-plus/index.mjs +1879 -1897
- package/components/upload-plus/src/ctx.d.ts +7 -2
- package/components/upload-plus/src/index.vue.d.ts +18 -7
- package/components/use-watch-C3iIa2DX.js +1 -0
- package/components/use-watch-Dp64x0si.mjs +411 -0
- package/components/van-cascader/src/ctx.d.ts +7 -2
- package/components/van-cascader/src/index.vue.d.ts +19 -8
- package/components/var-datetime-picker/src/ctx.d.ts +7 -2
- package/components/var-datetime-picker/src/index.vue.d.ts +30 -8
- package/components/vditor/src/ctx.d.ts +7 -2
- package/components/vditor/src/index.vue.d.ts +41 -19
- package/composables/element-plus/index.cjs +1 -1
- package/composables/element-plus/index.mjs +10 -10
- package/composables/form-mitt/index.mjs +1 -1
- package/composables/index.cjs +1 -1
- package/composables/index.mjs +53 -53
- package/index.css +1 -1
- package/locale/index.cjs +1 -1
- package/locale/index.mjs +8 -5
- package/locale/lang/ar.d.ts +1 -0
- package/locale/lang/en.d.ts +1 -0
- package/locale/lang/zh-cn.d.ts +1 -0
- package/package.json +9 -1
- package/shared/element-plus/ctx.d.ts +16 -16
- package/shared/types/source/index.d.ts +5 -0
- package/shared/upload/index.cjs +1 -1
- package/shared/upload/index.mjs +166 -165
- package/components/cloneDeep-DaYwfXwD.js +0 -1
- package/components/index-BBriTmQP.js +0 -1
- package/components/use-watch-Bfrz9pv_.js +0 -1
- package/components/use-watch-t49wP7jy.mjs +0 -414
|
@@ -47,6 +47,8 @@ export declare const props: {
|
|
|
47
47
|
default: undefined;
|
|
48
48
|
};
|
|
49
49
|
required: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
50
|
+
error: StringConstructor;
|
|
51
|
+
prop: null;
|
|
50
52
|
labelPosition: {
|
|
51
53
|
type: PropType<"left" | "right" | "top" | "start" | "end">;
|
|
52
54
|
default: undefined;
|
|
@@ -84,12 +86,16 @@ export declare const props: {
|
|
|
84
86
|
type: BooleanConstructor;
|
|
85
87
|
default: boolean;
|
|
86
88
|
};
|
|
87
|
-
prop: null;
|
|
88
89
|
defaultModelValue: null;
|
|
89
90
|
labelTipProps: {
|
|
90
91
|
type: PropType<import("element-plus").UseTooltipProps>;
|
|
91
92
|
default: () => {};
|
|
92
93
|
};
|
|
94
|
+
ai: {
|
|
95
|
+
type: PropType<import("../../ai-provider").AiConfig>;
|
|
96
|
+
default: undefined;
|
|
97
|
+
};
|
|
98
|
+
aiOutput: null;
|
|
93
99
|
label: StringConstructor;
|
|
94
100
|
labelWidth: {
|
|
95
101
|
readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
@@ -103,7 +109,6 @@ export declare const props: {
|
|
|
103
109
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
104
110
|
__epPropKey: true;
|
|
105
111
|
};
|
|
106
|
-
error: StringConstructor;
|
|
107
112
|
validateStatus: {
|
|
108
113
|
readonly type: PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
|
|
109
114
|
readonly required: false;
|
|
@@ -30,6 +30,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
30
30
|
default: undefined;
|
|
31
31
|
};
|
|
32
32
|
required: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
33
|
+
error: StringConstructor;
|
|
34
|
+
prop: null;
|
|
33
35
|
labelPosition: {
|
|
34
36
|
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
35
37
|
default: undefined;
|
|
@@ -67,12 +69,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
67
69
|
type: BooleanConstructor;
|
|
68
70
|
default: boolean;
|
|
69
71
|
};
|
|
70
|
-
prop: null;
|
|
71
72
|
defaultModelValue: null;
|
|
72
73
|
labelTipProps: {
|
|
73
74
|
type: import("vue").PropType<import("element-plus").UseTooltipProps>;
|
|
74
75
|
default: () => {};
|
|
75
76
|
};
|
|
77
|
+
ai: {
|
|
78
|
+
type: import("vue").PropType<import("../../ai-provider").AiConfig>;
|
|
79
|
+
default: undefined;
|
|
80
|
+
};
|
|
81
|
+
aiOutput: null;
|
|
76
82
|
label: StringConstructor;
|
|
77
83
|
labelWidth: {
|
|
78
84
|
readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
@@ -86,7 +92,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
86
92
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
87
93
|
__epPropKey: true;
|
|
88
94
|
};
|
|
89
|
-
error: StringConstructor;
|
|
90
95
|
validateStatus: {
|
|
91
96
|
readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
|
|
92
97
|
readonly required: false;
|
|
@@ -174,6 +179,8 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
174
179
|
default: undefined;
|
|
175
180
|
};
|
|
176
181
|
required: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
182
|
+
error: StringConstructor;
|
|
183
|
+
prop: null;
|
|
177
184
|
labelPosition: {
|
|
178
185
|
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
179
186
|
default: undefined;
|
|
@@ -211,12 +218,16 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
211
218
|
type: BooleanConstructor;
|
|
212
219
|
default: boolean;
|
|
213
220
|
};
|
|
214
|
-
prop: null;
|
|
215
221
|
defaultModelValue: null;
|
|
216
222
|
labelTipProps: {
|
|
217
223
|
type: import("vue").PropType<import("element-plus").UseTooltipProps>;
|
|
218
224
|
default: () => {};
|
|
219
225
|
};
|
|
226
|
+
ai: {
|
|
227
|
+
type: import("vue").PropType<import("../../ai-provider").AiConfig>;
|
|
228
|
+
default: undefined;
|
|
229
|
+
};
|
|
230
|
+
aiOutput: null;
|
|
220
231
|
label: StringConstructor;
|
|
221
232
|
labelWidth: {
|
|
222
233
|
readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
@@ -230,7 +241,6 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
230
241
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
231
242
|
__epPropKey: true;
|
|
232
243
|
};
|
|
233
|
-
error: StringConstructor;
|
|
234
244
|
validateStatus: {
|
|
235
245
|
readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
|
|
236
246
|
readonly required: false;
|
|
@@ -246,8 +256,9 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
246
256
|
"onUpdate:fileStatus"?: ((...args: any[]) => any) | undefined;
|
|
247
257
|
}>, {
|
|
248
258
|
required: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
249
|
-
|
|
250
|
-
|
|
259
|
+
file: File;
|
|
260
|
+
labelPosition: "start" | "left" | "right" | "top" | "end";
|
|
261
|
+
formItemSize: "small" | "default" | "large";
|
|
251
262
|
formItemSlots: import("../../form-item/src/types").FormItemSlots;
|
|
252
263
|
inline: boolean;
|
|
253
264
|
readonly: boolean;
|
|
@@ -255,10 +266,10 @@ declare const __VLS_export: import("vue").DefineComponent<import("vue").ExtractP
|
|
|
255
266
|
labelTip: string;
|
|
256
267
|
information: boolean;
|
|
257
268
|
labelTipProps: import("element-plus").UseTooltipProps;
|
|
269
|
+
ai: import("../../ai-provider").AiConfig;
|
|
258
270
|
inlineMessage: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
259
271
|
showMessage: import("element-plus/es/utils/index.mjs").EpPropMergeType<BooleanConstructor, unknown, unknown>;
|
|
260
272
|
url: string;
|
|
261
|
-
file: File;
|
|
262
273
|
accept: string;
|
|
263
274
|
chunkSize: number;
|
|
264
275
|
fileServiceType: import("./types").FileServiceType;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const u=require("vue"),V=require("element-plus"),Y=require("./debounce-CliSPkvP.js"),H=require("@vunk/shared/function");function le(e,t,l){return e===e&&(l!==void 0&&(e=e<=l?e:l),t!==void 0&&(e=e>=t?e:t)),e}function ue(e,t,l){return l===void 0&&(l=t,t=void 0),l!==void 0&&(l=Y.toNumber(l),l=l===l?l:0),t!==void 0&&(t=Y.toNumber(t),t=t===t?t:0),le(Y.toNumber(e),t,l)}function oe(e){return u.getCurrentScope()?(u.onScopeDispose(e),!0):!1}const ae=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const re=Object.prototype.toString,se=e=>re.call(e)==="[object Object]";function $(e){return Array.isArray(e)?e:[e]}function ie(e,t,l){return u.watch(e,t,{...l,immediate:!0})}const ce=ae?window:void 0;function de(e){var t;const l=u.toValue(e);return(t=l?.$el)!=null?t:l}function j(...e){const t=[],l=()=>{t.forEach(i=>i()),t.length=0},c=(i,d,n,f)=>(i.addEventListener(d,n,f),()=>i.removeEventListener(d,n,f)),s=u.computed(()=>{const i=$(u.toValue(e[0])).filter(d=>d!=null);return i.every(d=>typeof d!="string")?i:void 0}),m=ie(()=>{var i,d;return[(d=(i=s.value)==null?void 0:i.map(n=>de(n)))!=null?d:[ce].filter(n=>n!=null),$(u.toValue(s.value?e[1]:e[0])),$(u.unref(s.value?e[2]:e[1])),u.toValue(s.value?e[3]:e[2])]},([i,d,n,f])=>{if(l(),!i?.length||!d?.length||!n?.length)return;const E=se(f)?{...f}:f;t.push(...i.flatMap(b=>d.flatMap(T=>n.map(B=>c(b,T,B,E)))))},{flush:"post"}),o=()=>{m(),l()};return oe(l),o}const J=Symbol("sliderContextKey"),fe=(e,t,l)=>{const c=u.ref();return u.onMounted(async()=>{e.range?(Array.isArray(e.modelValue)?(t.firstValue=Math.max(e.min,e.modelValue[0]),t.secondValue=Math.min(e.max,e.modelValue[1])):(t.firstValue=e.min,t.secondValue=e.max),t.oldValue=[t.firstValue,t.secondValue]):(typeof e.modelValue!="number"||Number.isNaN(e.modelValue)?t.firstValue=e.min:t.firstValue=Math.min(e.max,Math.max(e.min,e.modelValue)),t.oldValue=t.firstValue),j(window,"resize",l),await u.nextTick(),l()}),{sliderWrapper:c}},me=e=>{const t=u.computed(()=>e.marks?Object.keys(e.marks).map(Number.parseFloat).sort((c,s)=>c-s).filter(c=>c<=e.max&&c>=e.min).map(c=>({point:c,position:(c-e.min)*100/(e.max-e.min),mark:e.marks[c]})):[]);return u.watchEffect(()=>{if(e.step==="mark"&&!e.marks&&console.warn("[ElSlider] marks prop must be provided when step is mark"),e.marks){const l=Object.keys(e.marks),c=t.value.map(m=>m.point),s=l.filter(m=>{const o=Number.parseFloat(m);return Number.isNaN(o)||!c.includes(o)});s.length>0&&console.warn(`[ElSlider] Some marks keys are invalid (not a number or out of [min, max]): [${s.map(m=>`'${m}'`).join(", ")}] and will be ignored.`)}}),t},ve=(e,t,l,c)=>{const{formItem:s}=V.useFormItem(),m=u.shallowRef(),o=u.ref(),i=u.ref(),d={firstButton:o,secondButton:i},n=V.useFormDisabled(),f=u.computed(()=>Math.min(t.firstValue,t.secondValue)),E=u.computed(()=>Math.max(t.firstValue,t.secondValue)),b=u.computed(()=>e.range?`${100*(E.value-f.value)/(e.max-e.min)}%`:`${100*(t.firstValue-e.min)/(e.max-e.min)}%`),T=u.computed(()=>e.range?`${100*(f.value-e.min)/(e.max-e.min)}%`:"0%"),B=u.computed(()=>e.vertical?{height:e.height}:{}),k=u.computed(()=>e.vertical?{height:b.value,bottom:T.value}:c.value?{width:b.value,left:"auto",right:T.value}:{width:b.value,left:T.value}),O=()=>{if(m.value){const r=m.value.getBoundingClientRect();t.sliderSize=r[e.vertical?"height":"width"]}},F=r=>{const g=e.min+r*(e.max-e.min)/100;if(!e.range)return o;let y;return Math.abs(f.value-g)<Math.abs(E.value-g)?y=t.firstValue<t.secondValue?"firstButton":"secondButton":y=t.firstValue>t.secondValue?"firstButton":"secondButton",d[y]},A=r=>{const g=F(r);return g.value.setPosition(r),g},W=r=>{t.firstValue=r??e.min;const g=e.range?[f.value,E.value]:r??e.min;_(g)},R=r=>{t.secondValue=r,e.range&&_([f.value,E.value])},_=r=>{l(V.UPDATE_MODEL_EVENT,r),l(V.INPUT_EVENT,r)},C=async()=>{await u.nextTick(),l(V.CHANGE_EVENT,e.range?[f.value,E.value]:e.modelValue)},M=r=>{if(n.value||t.dragging)return;O();let g=0;if(e.vertical){const y=r.touches?.item(0)?.clientY??r.clientY;g=(m.value.getBoundingClientRect().bottom-y)/t.sliderSize*100}else{const y=r.touches?.item(0)?.clientX??r.clientX,X=m.value.getBoundingClientRect();c.value?g=(X.right-y)/t.sliderSize*100:g=(y-X.left)/t.sliderSize*100}if(!(g<0||g>100))return A(g)};return{elFormItem:s,slider:m,firstButton:o,secondButton:i,sliderDisabled:n,minValue:f,maxValue:E,runwayStyle:B,barStyle:k,resetSize:O,setPosition:A,emitChange:C,onSliderWrapperPrevent:r=>{(d.firstButton.value?.dragging||d.secondButton.value?.dragging)&&r.preventDefault()},onSliderClick:r=>{M(r)&&C()},onSliderDown:async r=>{const g=M(r);g&&(await u.nextTick(),g.value.onButtonDown(r))},onSliderMarkerDown:r=>{if(n.value||t.dragging)return;A(r)&&C()},setFirstValue:W,setSecondValue:R}},ge=e=>e.code||e.key,he=(e,t,l)=>{const c=u.ref(),s=u.ref(!1),m=u.computed(()=>t.value instanceof Function),o=u.computed(()=>m.value&&t.value(e.modelValue)||e.modelValue),i=Y.debounce(()=>{l.value&&(s.value=!0)},50),d=Y.debounce(()=>{l.value&&(s.value=!1)},50);return{tooltip:c,tooltipVisible:s,formatValue:o,displayTooltip:i,hideTooltip:d}},Ve=(e,t,l)=>{const{disabled:c,min:s,max:m,step:o,showTooltip:i,persistent:d,precision:n,sliderSize:f,formatTooltip:E,emitChange:b,resetSize:T,updateDragging:B,markList:k,isRtl:O}=u.inject(J),{tooltip:F,tooltipVisible:A,formatValue:W,displayTooltip:R,hideTooltip:_}=he(e,E,i),C=u.ref(),M=u.computed(()=>`${(e.modelValue-s.value)/(m.value-s.value)*100}%`),z=u.computed(()=>e.vertical?{bottom:M.value}:O.value?{right:M.value}:{left:M.value}),K=u.computed(()=>o.value==="mark"&&k.value.length>0),U=()=>{t.hovering=!0,R()},q=()=>{t.hovering=!1,t.dragging||_()},r=a=>{c.value||(a.preventDefault(),ne(a),window.addEventListener("mousemove",I),window.addEventListener("touchmove",I),window.addEventListener("mouseup",L),window.addEventListener("touchend",L),window.addEventListener("contextmenu",L),C.value.focus())},g=a=>{c.value||(t.newPosition=Number.parseFloat(M.value)+a/(m.value-s.value)*100,P(t.newPosition),b())},y=a=>{if(c.value||!k.value.length)return;const v=e.modelValue,h=Number.EPSILON,S=Math.abs(a);let w;if(a>0){const N=k.value.findIndex(x=>x.point>v+h);if(N!==-1){const x=Math.min(N+S-1,k.value.length-1);w=k.value[x].point}}else{let N=-1;for(let x=k.value.length-1;x>=0;x--)if(k.value[x].point<v-h){N=x;break}if(N!==-1){const x=Math.max(N-(S-1),0);w=k.value[x].point}}if(w!==void 0&&w!==v){const N=(w-s.value)/(m.value-s.value)*100;P(N),b()}},X=()=>{K.value?y(-1):typeof o.value=="number"&&g(-o.value)},Q=()=>{K.value?y(1):typeof o.value=="number"&&g(o.value)},Z=()=>{K.value?y(-4):typeof o.value=="number"&&g(-o.value*4)},D=()=>{K.value?y(4):typeof o.value=="number"&&g(o.value*4)},p=()=>{c.value||(P(0),b())},ee=()=>{c.value||(P(100),b())},te=a=>{const v=ge(a);let h=!0;switch(v){case V.EVENT_CODE.left:case V.EVENT_CODE.down:X();break;case V.EVENT_CODE.right:case V.EVENT_CODE.up:Q();break;case V.EVENT_CODE.home:p();break;case V.EVENT_CODE.end:ee();break;case V.EVENT_CODE.pageDown:Z();break;case V.EVENT_CODE.pageUp:D();break;default:h=!1;break}h&&a.preventDefault()},G=a=>{let v,h;return a.type.startsWith("touch")?(h=a.touches[0].clientY,v=a.touches[0].clientX):(h=a.clientY,v=a.clientX),{clientX:v,clientY:h}},ne=a=>{t.dragging=!0,t.isClick=!0;const{clientX:v,clientY:h}=G(a);e.vertical?t.startY=h:t.startX=v,t.startPosition=Number.parseFloat(M.value),t.newPosition=t.startPosition},I=a=>{if(t.dragging){t.isClick=!1,R(),T();let v;const{clientX:h,clientY:S}=G(a);if(e.vertical)t.currentY=S,v=(t.startY-t.currentY)/f.value*100;else{t.currentX=h;const w=(t.currentX-t.startX)/f.value*100;v=O.value?-w:w}t.newPosition=t.startPosition+v,P(t.newPosition)}},L=()=>{t.dragging&&(setTimeout(()=>{t.dragging=!1,t.hovering||_(),t.isClick||P(t.newPosition),b()},0),window.removeEventListener("mousemove",I),window.removeEventListener("touchmove",I),window.removeEventListener("mouseup",L),window.removeEventListener("touchend",L),window.removeEventListener("contextmenu",L))},P=async a=>{if(a===null||Number.isNaN(+a))return;a=ue(a,0,100);let v;if(o.value==="mark")k.value.length===0?v=a<=50?s.value:m.value:v=k.value.reduce((S,w)=>Math.abs(w.position-a)<Math.abs(S.position-a)?w:S).point;else{const h=Math.floor((m.value-s.value)/o.value),S=h*o.value/(m.value-s.value)*100,w=S+(100-S)/2;if(a<S){const N=S/h,x=Math.round(a/N);v=s.value+x*o.value}else a<w?v=s.value+h*o.value:v=m.value;v=Number.parseFloat(v.toFixed(n.value))}v!==e.modelValue&&l(V.UPDATE_MODEL_EVENT,v),!t.dragging&&e.modelValue!==t.oldValue&&(t.oldValue=e.modelValue),await u.nextTick(),t.dragging&&R(),F.value.updatePopper()};return u.watch(()=>t.dragging,a=>{B(a)}),j(C,"touchstart",r,{passive:!1}),{disabled:c,button:C,tooltip:F,tooltipVisible:A,showTooltip:i,persistent:d,wrapperStyle:z,formatValue:W,handleMouseEnter:U,handleMouseLeave:q,onButtonDown:r,onKeyDown:te,setPosition:P}},Ee=(e,t,l,c,s)=>({stops:u.computed(()=>{if(!e.showStops||e.min>e.max)return[];if(e.step==="mark"||e.step===0)return e.step===0&&console.warn("[ElSlider] step should not be 0."),[];const i=Math.ceil((e.max-e.min)/e.step),d=100*e.step/(e.max-e.min),n=Array.from({length:i-1}).map((f,E)=>(E+1)*d);return e.range?n.filter(f=>f<100*(l.value-e.min)/(e.max-e.min)||f>100*(c.value-e.min)/(e.max-e.min)):n.filter(f=>f>100*(t.firstValue-e.min)/(e.max-e.min))}),getStopStyle:i=>e.vertical?{bottom:`${i}%`}:s.value?{right:`${i}%`}:{left:`${i}%`}}),be=(e,t,l,c,s,m)=>{const o=n=>{s(V.UPDATE_MODEL_EVENT,n),s(V.INPUT_EVENT,n)},i=()=>e.range?![l.value,c.value].every((n,f)=>n===t.oldValue[f]):e.modelValue!==t.oldValue,d=()=>{if(e.min>e.max)throw new Error("[Element Plus Slider] props.min should not be greater than props.max.");const n=e.modelValue;e.range&&Array.isArray(n)?n[1]<e.min?o([e.min,e.min]):n[0]>e.max?o([e.max,e.max]):n[0]<e.min?o([e.min,n[1]]):n[1]>e.max?o([n[0],e.max]):(t.firstValue=n[0],t.secondValue=n[1],i()&&(e.validateEvent&&m?.validate?.("change").catch(H.noop),t.oldValue=n.slice())):!e.range&&typeof n=="number"&&!Number.isNaN(n)&&(n<e.min?o(e.min):n>e.max?o(e.max):(t.firstValue=n,i()&&(e.validateEvent&&m?.validate?.("change").catch(H.noop),t.oldValue=n)))};d(),u.watch(()=>t.dragging,n=>{n||d()}),u.watch(()=>e.modelValue,(n,f)=>{t.dragging||Array.isArray(n)&&Array.isArray(f)&&n.every((E,b)=>E===f[b])&&t.firstValue===n[0]&&t.secondValue===n[1]||d()},{deep:!0}),u.watch(()=>[e.min,e.max],()=>{d()})};exports.sliderContextKey=J;exports.useEventListener=j;exports.useLifecycle=fe;exports.useMarks=me;exports.useSlide=ve;exports.useSliderButton=Ve;exports.useStops=Ee;exports.useWatch=be;
|
|
@@ -0,0 +1,411 @@
|
|
|
1
|
+
import { watch as I, getCurrentScope as ie, onScopeDispose as ce, computed as V, toValue as j, unref as fe, ref as T, onMounted as de, nextTick as z, watchEffect as me, shallowRef as ve, inject as ge } from "vue";
|
|
2
|
+
import { useFormItem as he, useFormDisabled as Ve, CHANGE_EVENT as be, UPDATE_MODEL_EVENT as H, INPUT_EVENT as ee, EVENT_CODE as N } from "element-plus";
|
|
3
|
+
import { t as G, d as D } from "./debounce-DIph5ENi.mjs";
|
|
4
|
+
import { noop as p } from "@vunk/shared/function";
|
|
5
|
+
function ye(e, t, l) {
|
|
6
|
+
return e === e && (l !== void 0 && (e = e <= l ? e : l), t !== void 0 && (e = e >= t ? e : t)), e;
|
|
7
|
+
}
|
|
8
|
+
function we(e, t, l) {
|
|
9
|
+
return l === void 0 && (l = t, t = void 0), l !== void 0 && (l = G(l), l = l === l ? l : 0), t !== void 0 && (t = G(t), t = t === t ? t : 0), ye(G(e), t, l);
|
|
10
|
+
}
|
|
11
|
+
function ke(e) {
|
|
12
|
+
return ie() ? (ce(e), !0) : !1;
|
|
13
|
+
}
|
|
14
|
+
const Se = typeof window < "u" && typeof document < "u";
|
|
15
|
+
typeof WorkerGlobalScope < "u" && globalThis instanceof WorkerGlobalScope;
|
|
16
|
+
const xe = Object.prototype.toString, Ee = (e) => xe.call(e) === "[object Object]";
|
|
17
|
+
function _(e) {
|
|
18
|
+
return Array.isArray(e) ? e : [e];
|
|
19
|
+
}
|
|
20
|
+
function Me(e, t, l) {
|
|
21
|
+
return I(
|
|
22
|
+
e,
|
|
23
|
+
t,
|
|
24
|
+
{
|
|
25
|
+
...l,
|
|
26
|
+
immediate: !0
|
|
27
|
+
}
|
|
28
|
+
);
|
|
29
|
+
}
|
|
30
|
+
const Ne = Se ? window : void 0;
|
|
31
|
+
function Pe(e) {
|
|
32
|
+
var t;
|
|
33
|
+
const l = j(e);
|
|
34
|
+
return (t = l?.$el) != null ? t : l;
|
|
35
|
+
}
|
|
36
|
+
function te(...e) {
|
|
37
|
+
const t = [], l = () => {
|
|
38
|
+
t.forEach((s) => s()), t.length = 0;
|
|
39
|
+
}, i = (s, c, n, f) => (s.addEventListener(c, n, f), () => s.removeEventListener(c, n, f)), r = V(() => {
|
|
40
|
+
const s = _(j(e[0])).filter((c) => c != null);
|
|
41
|
+
return s.every((c) => typeof c != "string") ? s : void 0;
|
|
42
|
+
}), d = Me(
|
|
43
|
+
() => {
|
|
44
|
+
var s, c;
|
|
45
|
+
return [
|
|
46
|
+
(c = (s = r.value) == null ? void 0 : s.map((n) => Pe(n))) != null ? c : [Ne].filter((n) => n != null),
|
|
47
|
+
_(j(r.value ? e[1] : e[0])),
|
|
48
|
+
_(fe(r.value ? e[2] : e[1])),
|
|
49
|
+
// @ts-expect-error - TypeScript gets the correct types, but somehow still complains
|
|
50
|
+
j(r.value ? e[3] : e[2])
|
|
51
|
+
];
|
|
52
|
+
},
|
|
53
|
+
([s, c, n, f]) => {
|
|
54
|
+
if (l(), !s?.length || !c?.length || !n?.length)
|
|
55
|
+
return;
|
|
56
|
+
const h = Ee(f) ? { ...f } : f;
|
|
57
|
+
t.push(
|
|
58
|
+
...s.flatMap(
|
|
59
|
+
(b) => c.flatMap(
|
|
60
|
+
(P) => n.map((R) => i(b, P, R, h))
|
|
61
|
+
)
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
},
|
|
65
|
+
{ flush: "post" }
|
|
66
|
+
), u = () => {
|
|
67
|
+
d(), l();
|
|
68
|
+
};
|
|
69
|
+
return ke(l), u;
|
|
70
|
+
}
|
|
71
|
+
const Ce = /* @__PURE__ */ Symbol("sliderContextKey"), Ye = (e, t, l) => {
|
|
72
|
+
const i = T();
|
|
73
|
+
return de(async () => {
|
|
74
|
+
e.range ? (Array.isArray(e.modelValue) ? (t.firstValue = Math.max(e.min, e.modelValue[0]), t.secondValue = Math.min(e.max, e.modelValue[1])) : (t.firstValue = e.min, t.secondValue = e.max), t.oldValue = [t.firstValue, t.secondValue]) : (typeof e.modelValue != "number" || Number.isNaN(e.modelValue) ? t.firstValue = e.min : t.firstValue = Math.min(
|
|
75
|
+
e.max,
|
|
76
|
+
Math.max(e.min, e.modelValue)
|
|
77
|
+
), t.oldValue = t.firstValue), te(window, "resize", l), await z(), l();
|
|
78
|
+
}), {
|
|
79
|
+
sliderWrapper: i
|
|
80
|
+
};
|
|
81
|
+
}, Ke = (e) => {
|
|
82
|
+
const t = V(() => e.marks ? Object.keys(e.marks).map(Number.parseFloat).sort((i, r) => i - r).filter((i) => i <= e.max && i >= e.min).map(
|
|
83
|
+
(i) => ({
|
|
84
|
+
point: i,
|
|
85
|
+
position: (i - e.min) * 100 / (e.max - e.min),
|
|
86
|
+
mark: e.marks[i]
|
|
87
|
+
})
|
|
88
|
+
) : []);
|
|
89
|
+
return me(() => {
|
|
90
|
+
if (e.step === "mark" && !e.marks && console.warn("[ElSlider] marks prop must be provided when step is mark"), e.marks) {
|
|
91
|
+
const l = Object.keys(e.marks), i = t.value.map((d) => d.point), r = l.filter((d) => {
|
|
92
|
+
const u = Number.parseFloat(d);
|
|
93
|
+
return Number.isNaN(u) || !i.includes(u);
|
|
94
|
+
});
|
|
95
|
+
r.length > 0 && console.warn(
|
|
96
|
+
`[ElSlider] Some marks keys are invalid (not a number or out of [min, max]): [${r.map((d) => `'${d}'`).join(", ")}] and will be ignored.`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}), t;
|
|
100
|
+
}, Fe = (e, t, l, i) => {
|
|
101
|
+
const { formItem: r } = he(), d = ve(), u = T(), s = T(), c = {
|
|
102
|
+
firstButton: u,
|
|
103
|
+
secondButton: s
|
|
104
|
+
}, n = Ve(), f = V(() => Math.min(t.firstValue, t.secondValue)), h = V(() => Math.max(t.firstValue, t.secondValue)), b = V(() => e.range ? `${100 * (h.value - f.value) / (e.max - e.min)}%` : `${100 * (t.firstValue - e.min) / (e.max - e.min)}%`), P = V(() => e.range ? `${100 * (f.value - e.min) / (e.max - e.min)}%` : "0%"), R = V(() => e.vertical ? { height: e.height } : {}), k = V(() => e.vertical ? {
|
|
105
|
+
height: b.value,
|
|
106
|
+
bottom: P.value
|
|
107
|
+
} : i.value ? {
|
|
108
|
+
width: b.value,
|
|
109
|
+
left: "auto",
|
|
110
|
+
right: P.value
|
|
111
|
+
} : {
|
|
112
|
+
width: b.value,
|
|
113
|
+
left: P.value
|
|
114
|
+
}), A = () => {
|
|
115
|
+
if (d.value) {
|
|
116
|
+
const a = d.value.getBoundingClientRect();
|
|
117
|
+
t.sliderSize = a[e.vertical ? "height" : "width"];
|
|
118
|
+
}
|
|
119
|
+
}, W = (a) => {
|
|
120
|
+
const v = e.min + a * (e.max - e.min) / 100;
|
|
121
|
+
if (!e.range)
|
|
122
|
+
return u;
|
|
123
|
+
let y;
|
|
124
|
+
return Math.abs(f.value - v) < Math.abs(h.value - v) ? y = t.firstValue < t.secondValue ? "firstButton" : "secondButton" : y = t.firstValue > t.secondValue ? "firstButton" : "secondButton", c[y];
|
|
125
|
+
}, X = (a) => {
|
|
126
|
+
const v = W(a);
|
|
127
|
+
return v.value.setPosition(a), v;
|
|
128
|
+
}, U = (a) => {
|
|
129
|
+
t.firstValue = a ?? e.min;
|
|
130
|
+
const v = e.range ? [f.value, h.value] : a ?? e.min;
|
|
131
|
+
K(v);
|
|
132
|
+
}, Y = (a) => {
|
|
133
|
+
t.secondValue = a, e.range && K([f.value, h.value]);
|
|
134
|
+
}, K = (a) => {
|
|
135
|
+
l(H, a), l(ee, a);
|
|
136
|
+
}, C = async () => {
|
|
137
|
+
await z(), l(
|
|
138
|
+
be,
|
|
139
|
+
e.range ? [f.value, h.value] : e.modelValue
|
|
140
|
+
);
|
|
141
|
+
}, M = (a) => {
|
|
142
|
+
if (n.value || t.dragging) return;
|
|
143
|
+
A();
|
|
144
|
+
let v = 0;
|
|
145
|
+
if (e.vertical) {
|
|
146
|
+
const y = a.touches?.item(0)?.clientY ?? a.clientY;
|
|
147
|
+
v = (d.value.getBoundingClientRect().bottom - y) / t.sliderSize * 100;
|
|
148
|
+
} else {
|
|
149
|
+
const y = a.touches?.item(0)?.clientX ?? a.clientX, O = d.value.getBoundingClientRect();
|
|
150
|
+
i.value ? v = (O.right - y) / t.sliderSize * 100 : v = (y - O.left) / t.sliderSize * 100;
|
|
151
|
+
}
|
|
152
|
+
if (!(v < 0 || v > 100))
|
|
153
|
+
return X(v);
|
|
154
|
+
};
|
|
155
|
+
return {
|
|
156
|
+
elFormItem: r,
|
|
157
|
+
slider: d,
|
|
158
|
+
firstButton: u,
|
|
159
|
+
secondButton: s,
|
|
160
|
+
sliderDisabled: n,
|
|
161
|
+
minValue: f,
|
|
162
|
+
maxValue: h,
|
|
163
|
+
runwayStyle: R,
|
|
164
|
+
barStyle: k,
|
|
165
|
+
resetSize: A,
|
|
166
|
+
setPosition: X,
|
|
167
|
+
emitChange: C,
|
|
168
|
+
onSliderWrapperPrevent: (a) => {
|
|
169
|
+
(c.firstButton.value?.dragging || c.secondButton.value?.dragging) && a.preventDefault();
|
|
170
|
+
},
|
|
171
|
+
onSliderClick: (a) => {
|
|
172
|
+
M(a) && C();
|
|
173
|
+
},
|
|
174
|
+
onSliderDown: async (a) => {
|
|
175
|
+
const v = M(a);
|
|
176
|
+
v && (await z(), v.value.onButtonDown(a));
|
|
177
|
+
},
|
|
178
|
+
onSliderMarkerDown: (a) => {
|
|
179
|
+
if (n.value || t.dragging) return;
|
|
180
|
+
X(a) && C();
|
|
181
|
+
},
|
|
182
|
+
setFirstValue: U,
|
|
183
|
+
setSecondValue: Y
|
|
184
|
+
};
|
|
185
|
+
}, Le = (e) => e.code || e.key, Be = (e, t, l) => {
|
|
186
|
+
const i = T(), r = T(!1), d = V(() => t.value instanceof Function), u = V(() => d.value && t.value(e.modelValue) || e.modelValue), s = D(() => {
|
|
187
|
+
l.value && (r.value = !0);
|
|
188
|
+
}, 50), c = D(() => {
|
|
189
|
+
l.value && (r.value = !1);
|
|
190
|
+
}, 50);
|
|
191
|
+
return {
|
|
192
|
+
tooltip: i,
|
|
193
|
+
tooltipVisible: r,
|
|
194
|
+
formatValue: u,
|
|
195
|
+
displayTooltip: s,
|
|
196
|
+
hideTooltip: c
|
|
197
|
+
};
|
|
198
|
+
}, Oe = (e, t, l) => {
|
|
199
|
+
const {
|
|
200
|
+
disabled: i,
|
|
201
|
+
min: r,
|
|
202
|
+
max: d,
|
|
203
|
+
step: u,
|
|
204
|
+
showTooltip: s,
|
|
205
|
+
persistent: c,
|
|
206
|
+
precision: n,
|
|
207
|
+
sliderSize: f,
|
|
208
|
+
formatTooltip: h,
|
|
209
|
+
emitChange: b,
|
|
210
|
+
resetSize: P,
|
|
211
|
+
updateDragging: R,
|
|
212
|
+
markList: k,
|
|
213
|
+
isRtl: A
|
|
214
|
+
} = ge(Ce), { tooltip: W, tooltipVisible: X, formatValue: U, displayTooltip: Y, hideTooltip: K } = Be(e, h, s), C = T(), M = V(() => `${(e.modelValue - r.value) / (d.value - r.value) * 100}%`), q = V(() => e.vertical ? { bottom: M.value } : A.value ? { right: M.value } : { left: M.value }), F = V(() => u.value === "mark" && k.value.length > 0), J = () => {
|
|
215
|
+
t.hovering = !0, Y();
|
|
216
|
+
}, Q = () => {
|
|
217
|
+
t.hovering = !1, t.dragging || K();
|
|
218
|
+
}, a = (o) => {
|
|
219
|
+
i.value || (o.preventDefault(), se(o), window.addEventListener("mousemove", $), window.addEventListener("touchmove", $), window.addEventListener("mouseup", B), window.addEventListener("touchend", B), window.addEventListener("contextmenu", B), C.value.focus());
|
|
220
|
+
}, v = (o) => {
|
|
221
|
+
i.value || (t.newPosition = Number.parseFloat(M.value) + o / (d.value - r.value) * 100, L(t.newPosition), b());
|
|
222
|
+
}, y = (o) => {
|
|
223
|
+
if (i.value || !k.value.length) return;
|
|
224
|
+
const m = e.modelValue, g = Number.EPSILON, S = Math.abs(o);
|
|
225
|
+
let w;
|
|
226
|
+
if (o > 0) {
|
|
227
|
+
const E = k.value.findIndex(
|
|
228
|
+
(x) => x.point > m + g
|
|
229
|
+
);
|
|
230
|
+
if (E !== -1) {
|
|
231
|
+
const x = Math.min(
|
|
232
|
+
E + S - 1,
|
|
233
|
+
k.value.length - 1
|
|
234
|
+
);
|
|
235
|
+
w = k.value[x].point;
|
|
236
|
+
}
|
|
237
|
+
} else {
|
|
238
|
+
let E = -1;
|
|
239
|
+
for (let x = k.value.length - 1; x >= 0; x--)
|
|
240
|
+
if (k.value[x].point < m - g) {
|
|
241
|
+
E = x;
|
|
242
|
+
break;
|
|
243
|
+
}
|
|
244
|
+
if (E !== -1) {
|
|
245
|
+
const x = Math.max(E - (S - 1), 0);
|
|
246
|
+
w = k.value[x].point;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
if (w !== void 0 && w !== m) {
|
|
250
|
+
const E = (w - r.value) / (d.value - r.value) * 100;
|
|
251
|
+
L(E), b();
|
|
252
|
+
}
|
|
253
|
+
}, O = () => {
|
|
254
|
+
F.value ? y(-1) : typeof u.value == "number" && v(-u.value);
|
|
255
|
+
}, ne = () => {
|
|
256
|
+
F.value ? y(1) : typeof u.value == "number" && v(u.value);
|
|
257
|
+
}, le = () => {
|
|
258
|
+
F.value ? y(-4) : typeof u.value == "number" && v(-u.value * 4);
|
|
259
|
+
}, ue = () => {
|
|
260
|
+
F.value ? y(4) : typeof u.value == "number" && v(u.value * 4);
|
|
261
|
+
}, oe = () => {
|
|
262
|
+
i.value || (L(0), b());
|
|
263
|
+
}, ae = () => {
|
|
264
|
+
i.value || (L(100), b());
|
|
265
|
+
}, re = (o) => {
|
|
266
|
+
const m = Le(o);
|
|
267
|
+
let g = !0;
|
|
268
|
+
switch (m) {
|
|
269
|
+
case N.left:
|
|
270
|
+
case N.down:
|
|
271
|
+
O();
|
|
272
|
+
break;
|
|
273
|
+
case N.right:
|
|
274
|
+
case N.up:
|
|
275
|
+
ne();
|
|
276
|
+
break;
|
|
277
|
+
case N.home:
|
|
278
|
+
oe();
|
|
279
|
+
break;
|
|
280
|
+
case N.end:
|
|
281
|
+
ae();
|
|
282
|
+
break;
|
|
283
|
+
case N.pageDown:
|
|
284
|
+
le();
|
|
285
|
+
break;
|
|
286
|
+
case N.pageUp:
|
|
287
|
+
ue();
|
|
288
|
+
break;
|
|
289
|
+
default:
|
|
290
|
+
g = !1;
|
|
291
|
+
break;
|
|
292
|
+
}
|
|
293
|
+
g && o.preventDefault();
|
|
294
|
+
}, Z = (o) => {
|
|
295
|
+
let m, g;
|
|
296
|
+
return o.type.startsWith("touch") ? (g = o.touches[0].clientY, m = o.touches[0].clientX) : (g = o.clientY, m = o.clientX), {
|
|
297
|
+
clientX: m,
|
|
298
|
+
clientY: g
|
|
299
|
+
};
|
|
300
|
+
}, se = (o) => {
|
|
301
|
+
t.dragging = !0, t.isClick = !0;
|
|
302
|
+
const { clientX: m, clientY: g } = Z(o);
|
|
303
|
+
e.vertical ? t.startY = g : t.startX = m, t.startPosition = Number.parseFloat(M.value), t.newPosition = t.startPosition;
|
|
304
|
+
}, $ = (o) => {
|
|
305
|
+
if (t.dragging) {
|
|
306
|
+
t.isClick = !1, Y(), P();
|
|
307
|
+
let m;
|
|
308
|
+
const { clientX: g, clientY: S } = Z(o);
|
|
309
|
+
if (e.vertical)
|
|
310
|
+
t.currentY = S, m = (t.startY - t.currentY) / f.value * 100;
|
|
311
|
+
else {
|
|
312
|
+
t.currentX = g;
|
|
313
|
+
const w = (t.currentX - t.startX) / f.value * 100;
|
|
314
|
+
m = A.value ? -w : w;
|
|
315
|
+
}
|
|
316
|
+
t.newPosition = t.startPosition + m, L(t.newPosition);
|
|
317
|
+
}
|
|
318
|
+
}, B = () => {
|
|
319
|
+
t.dragging && (setTimeout(() => {
|
|
320
|
+
t.dragging = !1, t.hovering || K(), t.isClick || L(t.newPosition), b();
|
|
321
|
+
}, 0), window.removeEventListener("mousemove", $), window.removeEventListener("touchmove", $), window.removeEventListener("mouseup", B), window.removeEventListener("touchend", B), window.removeEventListener("contextmenu", B));
|
|
322
|
+
}, L = async (o) => {
|
|
323
|
+
if (o === null || Number.isNaN(+o)) return;
|
|
324
|
+
o = we(o, 0, 100);
|
|
325
|
+
let m;
|
|
326
|
+
if (u.value === "mark")
|
|
327
|
+
k.value.length === 0 ? m = o <= 50 ? r.value : d.value : m = k.value.reduce((S, w) => Math.abs(w.position - o) < Math.abs(S.position - o) ? w : S).point;
|
|
328
|
+
else {
|
|
329
|
+
const g = Math.floor((d.value - r.value) / u.value), S = g * u.value / (d.value - r.value) * 100, w = S + (100 - S) / 2;
|
|
330
|
+
if (o < S) {
|
|
331
|
+
const E = S / g, x = Math.round(o / E);
|
|
332
|
+
m = r.value + x * u.value;
|
|
333
|
+
} else o < w ? m = r.value + g * u.value : m = d.value;
|
|
334
|
+
m = Number.parseFloat(m.toFixed(n.value));
|
|
335
|
+
}
|
|
336
|
+
m !== e.modelValue && l(H, m), !t.dragging && e.modelValue !== t.oldValue && (t.oldValue = e.modelValue), await z(), t.dragging && Y(), W.value.updatePopper();
|
|
337
|
+
};
|
|
338
|
+
return I(
|
|
339
|
+
() => t.dragging,
|
|
340
|
+
(o) => {
|
|
341
|
+
R(o);
|
|
342
|
+
}
|
|
343
|
+
), te(C, "touchstart", a, { passive: !1 }), {
|
|
344
|
+
disabled: i,
|
|
345
|
+
button: C,
|
|
346
|
+
tooltip: W,
|
|
347
|
+
tooltipVisible: X,
|
|
348
|
+
showTooltip: s,
|
|
349
|
+
persistent: c,
|
|
350
|
+
wrapperStyle: q,
|
|
351
|
+
formatValue: U,
|
|
352
|
+
handleMouseEnter: J,
|
|
353
|
+
handleMouseLeave: Q,
|
|
354
|
+
onButtonDown: a,
|
|
355
|
+
onKeyDown: re,
|
|
356
|
+
setPosition: L
|
|
357
|
+
};
|
|
358
|
+
}, Ie = (e, t, l, i, r) => ({
|
|
359
|
+
stops: V(() => {
|
|
360
|
+
if (!e.showStops || e.min > e.max) return [];
|
|
361
|
+
if (e.step === "mark" || e.step === 0)
|
|
362
|
+
return e.step === 0 && console.warn("[ElSlider] step should not be 0."), [];
|
|
363
|
+
const s = Math.ceil((e.max - e.min) / e.step), c = 100 * e.step / (e.max - e.min), n = Array.from({ length: s - 1 }).map(
|
|
364
|
+
(f, h) => (h + 1) * c
|
|
365
|
+
);
|
|
366
|
+
return e.range ? n.filter((f) => f < 100 * (l.value - e.min) / (e.max - e.min) || f > 100 * (i.value - e.min) / (e.max - e.min)) : n.filter(
|
|
367
|
+
(f) => f > 100 * (t.firstValue - e.min) / (e.max - e.min)
|
|
368
|
+
);
|
|
369
|
+
}),
|
|
370
|
+
getStopStyle: (s) => e.vertical ? { bottom: `${s}%` } : r.value ? { right: `${s}%` } : { left: `${s}%` }
|
|
371
|
+
}), We = (e, t, l, i, r, d) => {
|
|
372
|
+
const u = (n) => {
|
|
373
|
+
r(H, n), r(ee, n);
|
|
374
|
+
}, s = () => e.range ? ![l.value, i.value].every(
|
|
375
|
+
(n, f) => n === t.oldValue[f]
|
|
376
|
+
) : e.modelValue !== t.oldValue, c = () => {
|
|
377
|
+
if (e.min > e.max)
|
|
378
|
+
throw new Error("[Element Plus Slider] props.min should not be greater than props.max.");
|
|
379
|
+
const n = e.modelValue;
|
|
380
|
+
e.range && Array.isArray(n) ? n[1] < e.min ? u([e.min, e.min]) : n[0] > e.max ? u([e.max, e.max]) : n[0] < e.min ? u([e.min, n[1]]) : n[1] > e.max ? u([n[0], e.max]) : (t.firstValue = n[0], t.secondValue = n[1], s() && (e.validateEvent && d?.validate?.("change").catch(p), t.oldValue = n.slice())) : !e.range && typeof n == "number" && !Number.isNaN(n) && (n < e.min ? u(e.min) : n > e.max ? u(e.max) : (t.firstValue = n, s() && (e.validateEvent && d?.validate?.("change").catch(p), t.oldValue = n)));
|
|
381
|
+
};
|
|
382
|
+
c(), I(
|
|
383
|
+
() => t.dragging,
|
|
384
|
+
(n) => {
|
|
385
|
+
n || c();
|
|
386
|
+
}
|
|
387
|
+
), I(
|
|
388
|
+
() => e.modelValue,
|
|
389
|
+
(n, f) => {
|
|
390
|
+
t.dragging || Array.isArray(n) && Array.isArray(f) && n.every((h, b) => h === f[b]) && t.firstValue === n[0] && t.secondValue === n[1] || c();
|
|
391
|
+
},
|
|
392
|
+
{
|
|
393
|
+
deep: !0
|
|
394
|
+
}
|
|
395
|
+
), I(
|
|
396
|
+
() => [e.min, e.max],
|
|
397
|
+
() => {
|
|
398
|
+
c();
|
|
399
|
+
}
|
|
400
|
+
);
|
|
401
|
+
};
|
|
402
|
+
export {
|
|
403
|
+
Ke as a,
|
|
404
|
+
Fe as b,
|
|
405
|
+
Oe as c,
|
|
406
|
+
Ie as d,
|
|
407
|
+
We as e,
|
|
408
|
+
te as f,
|
|
409
|
+
Ce as s,
|
|
410
|
+
Ye as u
|
|
411
|
+
};
|
|
@@ -23,6 +23,8 @@ export declare const props: {
|
|
|
23
23
|
required: boolean;
|
|
24
24
|
};
|
|
25
25
|
required: import("element-plus/es/utils/index.mjs").EpPropFinalized<BooleanConstructor, unknown, unknown, undefined, boolean>;
|
|
26
|
+
error: StringConstructor;
|
|
27
|
+
prop: null;
|
|
26
28
|
labelPosition: {
|
|
27
29
|
type: import("vue").PropType<"left" | "right" | "top" | "start" | "end">;
|
|
28
30
|
default: undefined;
|
|
@@ -56,12 +58,16 @@ export declare const props: {
|
|
|
56
58
|
type: BooleanConstructor;
|
|
57
59
|
default: boolean;
|
|
58
60
|
};
|
|
59
|
-
prop: null;
|
|
60
61
|
defaultModelValue: null;
|
|
61
62
|
labelTipProps: {
|
|
62
63
|
type: import("vue").PropType<import("element-plus").UseTooltipProps>;
|
|
63
64
|
default: () => {};
|
|
64
65
|
};
|
|
66
|
+
ai: {
|
|
67
|
+
type: import("vue").PropType<import("../../ai-provider").AiConfig>;
|
|
68
|
+
default: undefined;
|
|
69
|
+
};
|
|
70
|
+
aiOutput: null;
|
|
65
71
|
label: StringConstructor;
|
|
66
72
|
labelWidth: {
|
|
67
73
|
readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<readonly [StringConstructor, NumberConstructor], unknown, unknown>>;
|
|
@@ -75,7 +81,6 @@ export declare const props: {
|
|
|
75
81
|
readonly validator: ((val: unknown) => boolean) | undefined;
|
|
76
82
|
__epPropKey: true;
|
|
77
83
|
};
|
|
78
|
-
error: StringConstructor;
|
|
79
84
|
validateStatus: {
|
|
80
85
|
readonly type: import("vue").PropType<import("element-plus/es/utils/index.mjs").EpPropMergeType<StringConstructor, "" | "success" | "error" | "validating", unknown>>;
|
|
81
86
|
readonly required: false;
|