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