@pixelium/web-vue 0.0.2 → 0.0.3-alpha
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/README.md +42 -0
- package/README.zh.md +6 -3
- package/dist/font.css +1 -1
- package/dist/index.d.ts +1602 -248
- package/dist/normalize.css +2 -0
- package/dist/pixelium-vue-icon-hn.cjs +1 -1
- package/dist/pixelium-vue-icon-hn.css +2 -1
- package/dist/pixelium-vue-icon-hn.js +8533 -8154
- package/dist/pixelium-vue-icon-hn.umd.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.cjs +1 -1
- package/dist/pixelium-vue-icon-pa.css +2 -1
- package/dist/pixelium-vue-icon-pa.js +10625 -10143
- package/dist/pixelium-vue-icon-pa.umd.cjs +1 -1
- package/dist/pixelium-vue.cjs +2 -2
- package/dist/pixelium-vue.css +2 -1
- package/dist/pixelium-vue.js +7407 -5852
- package/dist/pixelium-vue.umd.cjs +2 -2
- package/es/aside/index.css +1 -0
- package/es/aside/index.js +46 -151
- package/es/auto-complete/draw.d.ts +1 -1
- package/es/auto-complete/draw.js +26 -51
- package/es/auto-complete/index.css +92 -32
- package/es/auto-complete/index.d.ts +12 -15
- package/es/auto-complete/index.js +338 -400
- package/es/auto-complete/type.d.ts +25 -13
- package/es/avatar/css.js +2 -0
- package/es/avatar/draw.d.ts +2 -0
- package/es/avatar/draw.js +11 -0
- package/es/avatar/index.css +49 -0
- package/es/avatar/index.d.ts +15 -0
- package/es/avatar/index.js +110 -0
- package/es/avatar/type.d.ts +34 -0
- package/es/button/draw.d.ts +4 -4
- package/es/button/draw.js +213 -297
- package/es/button/index.css +40 -30
- package/es/button/index.d.ts +0 -4
- package/es/button/index.js +230 -256
- package/es/button/type.d.ts +3 -3
- package/es/button-group/index.css +0 -3
- package/es/button-group/index.d.ts +1 -2
- package/es/button-group/index.js +59 -31
- package/es/button-group/type.d.ts +21 -4
- package/es/checkbox/css.js +2 -0
- package/es/checkbox/draw.d.ts +4 -0
- package/es/checkbox/draw.js +46 -0
- package/es/checkbox/index.css +85 -0
- package/es/checkbox/index.d.ts +31 -0
- package/es/checkbox/index.js +206 -0
- package/es/checkbox/type.d.ts +88 -0
- package/es/checkbox-group/css.js +2 -0
- package/es/checkbox-group/index.css +20 -0
- package/es/checkbox-group/index.d.ts +23 -0
- package/es/checkbox-group/index.js +84 -0
- package/es/checkbox-group/type.d.ts +78 -0
- package/es/col/index.d.ts +2 -2
- package/es/col/index.js +43 -58
- package/es/container/index.css +1 -0
- package/es/container/index.js +18 -31
- package/es/divider/index.js +39 -53
- package/es/empty/index.css +4 -4
- package/es/empty/index.js +16 -71
- package/es/entry.js +102 -0
- package/es/footer/index.css +1 -0
- package/es/footer/index.js +31 -40
- package/es/form/css.js +1 -0
- package/es/form/index.d.ts +27 -0
- package/es/form/index.js +125 -0
- package/es/form/type.d.ts +238 -0
- package/es/form/use-form.d.ts +4 -0
- package/es/form/use-form.js +48 -0
- package/es/form-item/css.js +2 -0
- package/es/form-item/index.css +77 -0
- package/es/form-item/index.d.ts +37 -0
- package/es/form-item/index.js +318 -0
- package/es/form-item/type.d.ts +96 -0
- package/es/grid/index.js +56 -75
- package/es/grid-item/css.js +0 -1
- package/es/grid-item/index.d.ts +1 -1
- package/es/grid-item/index.js +85 -121
- package/es/header/index.css +1 -0
- package/es/header/index.js +31 -40
- package/es/icon/index.js +44 -55
- package/es/icons/css-hn.js +0 -1
- package/es/icons/css-pa.js +0 -1
- package/es/icons/icon-hn.js +10337 -15986
- package/es/icons/icon-pa.js +12573 -17447
- package/es/image/css.js +2 -0
- package/es/image/index.css +69 -0
- package/es/image/index.d.ts +35 -0
- package/es/image/index.js +199 -0
- package/es/image/type.d.ts +126 -0
- package/es/index.css +1 -515
- package/es/index.d.ts +22 -2
- package/es/index.js +144 -123
- package/es/input/draw.d.ts +1 -1
- package/es/input/draw.js +26 -51
- package/es/input/index.css +85 -33
- package/es/input/index.d.ts +9 -16
- package/es/input/index.js +319 -423
- package/es/input/type.d.ts +3 -3
- package/es/input-group/index.css +0 -1
- package/es/input-group/index.d.ts +2 -2
- package/es/input-group/index.js +66 -37
- package/es/input-group/type.d.ts +16 -4
- package/es/input-group-label/draw.d.ts +1 -1
- package/es/input-group-label/draw.js +26 -51
- package/es/input-group-label/index.css +33 -22
- package/es/input-group-label/index.d.ts +1 -4
- package/es/input-group-label/index.js +104 -127
- package/es/input-group-label/type.d.ts +3 -3
- package/es/input-number/draw.d.ts +1 -1
- package/es/input-number/draw.js +26 -51
- package/es/input-number/index.css +90 -35
- package/es/input-number/index.d.ts +9 -16
- package/es/input-number/index.js +428 -536
- package/es/input-number/type.d.ts +3 -3
- package/es/input-tag/draw.d.ts +1 -1
- package/es/input-tag/draw.js +26 -48
- package/es/input-tag/index.css +100 -33
- package/es/input-tag/index.d.ts +7 -13
- package/es/input-tag/index.js +442 -467
- package/es/input-tag/type.d.ts +24 -13
- package/es/link/index.js +75 -106
- package/es/main/index.css +4 -0
- package/es/main/index.d.ts +4 -1
- package/es/main/index.js +15 -15
- package/es/main/type.d.ts +7 -0
- package/es/mask/index.js +94 -115
- package/es/message/index.css +1 -1
- package/es/message/index.js +168 -346
- package/es/message-box/css.js +1 -1
- package/es/message-box/index.js +98 -114
- package/es/message-box/message-box-wrapped.js +33 -46
- package/es/message-box/message-box.js +79 -111
- package/es/option-list/index.css +13 -13
- package/es/option-list/index.d.ts +4 -31
- package/es/option-list/index.js +99 -167
- package/es/option-list/type.d.ts +5 -1
- package/es/pixelate/pixel.d.ts +5 -0
- package/es/pixelate/pixel.js +70 -0
- package/es/pixelate/pixelate.worker.d.ts +1 -0
- package/es/popover/index.d.ts +13 -99
- package/es/popover/index.js +75 -238
- package/es/popover/type.d.ts +7 -2
- package/es/popup/css.js +1 -0
- package/es/popup/index.d.ts +210 -0
- package/es/popup/index.js +203 -0
- package/es/popup/type.d.ts +105 -0
- package/es/popup-content/draw.d.ts +2 -2
- package/es/popup-content/draw.js +98 -143
- package/es/popup-content/index.css +11 -11
- package/es/popup-content/index.d.ts +1 -0
- package/es/popup-content/index.js +253 -1576
- package/es/popup-content/type.d.ts +1 -0
- package/es/popup-trigger/index.d.ts +8 -2
- package/es/popup-trigger/index.js +122 -95
- package/es/popup-trigger/type.d.ts +4 -1
- package/es/popup-wrapper/css.js +2 -0
- package/es/popup-wrapper/index.css +14 -0
- package/es/popup-wrapper/index.d.ts +18 -0
- package/es/popup-wrapper/index.js +67 -0
- package/es/popup-wrapper/type.d.ts +9 -0
- package/es/radio/css.js +1 -0
- package/es/radio/draw.d.ts +4 -0
- package/es/radio/draw.js +47 -0
- package/es/radio/index.d.ts +30 -0
- package/es/radio/index.js +190 -0
- package/es/radio/style.css +73 -0
- package/es/radio/type.d.ts +76 -0
- package/es/radio-group/css.js +2 -0
- package/es/radio-group/index.css +20 -0
- package/es/radio-group/index.d.ts +23 -0
- package/es/radio-group/index.js +77 -0
- package/es/radio-group/type.d.ts +77 -0
- package/es/row/index.js +56 -70
- package/es/select/draw.d.ts +1 -1
- package/es/select/draw.js +26 -51
- package/es/select/index.css +118 -36
- package/es/select/index.d.ts +14 -16
- package/es/select/index.js +625 -672
- package/es/select/type.d.ts +60 -25
- package/es/share/const/event-bus-key.js +1 -6
- package/es/share/const/index.d.ts +4 -0
- package/es/share/const/index.js +22 -24
- package/es/share/const/provide-key.d.ts +5 -0
- package/es/share/const/provide-key.js +6 -5
- package/es/share/const/style.d.ts +6 -0
- package/es/share/const/style.js +7 -0
- package/es/share/hook/use-cancelable-delay.d.ts +1 -0
- package/es/share/hook/use-cancelable-delay.js +42 -0
- package/es/share/hook/use-click-outside-listener.d.ts +1 -1
- package/es/share/hook/use-click-outside-listener.js +28 -41
- package/es/share/hook/use-composition.js +17 -15
- package/es/share/hook/use-controlled-mode.d.ts +3 -3
- package/es/share/hook/use-controlled-mode.js +20 -23
- package/es/share/hook/use-dark-mode.js +51 -65
- package/es/share/hook/use-index-of-children.d.ts +2 -1
- package/es/share/hook/use-index-of-children.js +47 -45
- package/es/share/hook/use-lazy-load.d.ts +10 -0
- package/es/share/hook/use-lazy-load.js +133 -0
- package/es/share/hook/use-props-detect.d.ts +2 -0
- package/es/share/hook/use-resize-observer.d.ts +1 -2
- package/es/share/hook/use-resize-observer.js +28 -20
- package/es/share/hook/use-screen-width.js +27 -36
- package/es/share/hook/use-smooth-transition.d.ts +2 -0
- package/es/share/hook/use-smooth-transition.js +65 -0
- package/es/share/hook/use-textarea-height.js +86 -92
- package/es/share/hook/use-theme-mode.js +41 -42
- package/es/share/hook/use-transition-end.d.ts +2 -0
- package/es/share/hook/use-transition-end.js +12 -0
- package/es/share/hook/use-watch-global-css-var.js +12 -16
- package/es/share/hook/use-window-resize-listener.d.ts +1 -0
- package/es/share/hook/use-window-resize-listener.js +15 -0
- package/es/share/hook/use-z-index.js +30 -27
- package/es/share/style/index.css +5 -0
- package/es/share/type/index.d.ts +18 -3
- package/es/share/util/color.d.ts +5 -3
- package/es/share/util/color.js +156 -149
- package/es/share/util/common.d.ts +7 -2
- package/es/share/util/common.js +127 -65
- package/es/share/util/console.d.ts +3 -3
- package/es/share/util/console.js +10 -7
- package/es/share/util/dom.d.ts +19 -0
- package/es/share/util/dom.js +88 -0
- package/es/share/util/env.d.ts +1 -0
- package/es/share/util/env.js +5 -4
- package/es/share/util/event-bus.js +3 -20
- package/es/share/util/lru-cache.js +29 -33
- package/es/share/util/pixel.d.ts +4 -0
- package/es/share/util/plot.d.ts +8 -3
- package/es/share/util/plot.js +457 -229
- package/es/share/util/reactivity.d.ts +8 -0
- package/es/share/util/reactivity.js +23 -0
- package/es/share/util/render.js +31 -41
- package/es/share/util/theme.d.ts +3 -0
- package/es/share/util/theme.js +77 -57
- package/es/slider/css.js +2 -0
- package/es/slider/draw.d.ts +25 -0
- package/es/slider/draw.js +113 -0
- package/es/slider/index.css +119 -0
- package/es/slider/index.d.ts +66 -0
- package/es/slider/index.js +503 -0
- package/es/slider/type.d.ts +162 -0
- package/es/slider/util.d.ts +37 -0
- package/es/slider/util.js +130 -0
- package/es/space/index.css +24 -29
- package/es/space/index.js +73 -97
- package/es/spin/index.css +18 -17
- package/es/spin/index.js +72 -102
- package/es/spin/type.d.ts +11 -5
- package/es/switch/css.js +2 -0
- package/es/switch/draw.d.ts +2 -0
- package/es/switch/draw.js +18 -0
- package/es/switch/index.css +121 -0
- package/es/switch/index.d.ts +42 -0
- package/es/switch/index.js +259 -0
- package/es/switch/type.d.ts +133 -0
- package/es/tag/draw.d.ts +2 -2
- package/es/tag/draw.js +80 -127
- package/es/tag/index.css +38 -22
- package/es/tag/index.d.ts +2 -2
- package/es/tag/index.js +121 -190
- package/es/tag/type.d.ts +3 -3
- package/es/text-outline/css.js +2 -0
- package/es/text-outline/index.css +4 -0
- package/es/text-outline/index.d.ts +17 -0
- package/es/text-outline/index.js +33 -0
- package/es/text-outline/type.d.ts +23 -0
- package/es/textarea/draw.js +9 -11
- package/es/textarea/index.css +37 -23
- package/es/textarea/index.d.ts +8 -14
- package/es/textarea/index.js +274 -262
- package/es/tooltip/index.d.ts +100 -4
- package/es/tooltip/index.js +70 -226
- package/es/tooltip/type.d.ts +7 -2
- package/es/vendor.js +504 -0
- package/es/virtual-list/css.js +2 -0
- package/es/virtual-list/index.css +25 -0
- package/es/virtual-list/index.d.ts +11 -0
- package/es/virtual-list/index.js +313 -0
- package/es/virtual-list/type.d.ts +26 -0
- package/package.json +10 -16
- package/es/grid-item/index.css +0 -0
- /package/es/message-box/{message-box.css → index.css} +0 -0
|
@@ -0,0 +1,503 @@
|
|
|
1
|
+
import './css.js'
|
|
2
|
+
import { D as S, E as Rn, L as qe, g as A, j as en } from "../vendor.js";
|
|
3
|
+
import { t as BORDER_CORNER_RAD_RANGE } from "../share/const/index.js";
|
|
4
|
+
import { n as fillArr } from "../share/util/common.js";
|
|
5
|
+
import { i as canvasPreprocess, n as calcPixelSize, t as calcBorderCornerCenter } from "../share/util/plot.js";
|
|
6
|
+
import { n as getGlobalThemeColor } from "../share/util/color.js";
|
|
7
|
+
import { t as useDarkMode } from "../share/hook/use-dark-mode.js";
|
|
8
|
+
import { t as useResizeObserver } from "../share/hook/use-resize-observer.js";
|
|
9
|
+
import { t as useWatchGlobalCssVal } from "../share/hook/use-watch-global-css-var.js";
|
|
10
|
+
import { i as FORM_ITEM_PROVIDE } from "../share/const/provide-key.js";
|
|
11
|
+
import { t as createProvideComputed } from "../share/util/reactivity.js";
|
|
12
|
+
import { t as useTransitionEnd } from "../share/hook/use-transition-end.js";
|
|
13
|
+
import { t as useControlledMode } from "../share/hook/use-controlled-mode.js";
|
|
14
|
+
import { t as tooltip_default } from "../tooltip/index.js";
|
|
15
|
+
import { a as getDotStyle, i as drawThumb, n as drawMark, o as getMarkStyle, r as drawRange, t as drawBorder } from "./draw.js";
|
|
16
|
+
import { a as getSingleValue, c as updateMarkPoints, i as getRangeValue, n as calcValueFromEvent, o as getTargetThumbEl, r as clampValue, s as transformModelValue, t as calcThumbLeft } from "./util.js";
|
|
17
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, defineComponent, inject, mergeProps, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, shallowRef, toDisplayString, unref, watch, withCtx, withModifiers } from "vue";
|
|
18
|
+
var _hoisted_1 = ["tabindex"];
|
|
19
|
+
var _hoisted_2 = ["tabindex", "onClick"];
|
|
20
|
+
var _hoisted_3 = ["tabindex", "onClick"];
|
|
21
|
+
var _hoisted_4 = ["tabindex"];
|
|
22
|
+
var _hoisted_5 = { class: "px-slider-tooltip-content" };
|
|
23
|
+
var _hoisted_6 = ["tabindex"];
|
|
24
|
+
var _hoisted_7 = ["tabindex"];
|
|
25
|
+
var _hoisted_8 = { class: "px-slider-tooltip-content" };
|
|
26
|
+
var _hoisted_9 = ["tabindex"];
|
|
27
|
+
var _hoisted_10 = ["tabindex"];
|
|
28
|
+
var _hoisted_11 = { class: "px-slider-tooltip-content" };
|
|
29
|
+
var _hoisted_12 = ["tabindex"];
|
|
30
|
+
var slider_default = /* @__PURE__ */ defineComponent({
|
|
31
|
+
name: "Slider",
|
|
32
|
+
__name: "index",
|
|
33
|
+
props: {
|
|
34
|
+
modelValue: null,
|
|
35
|
+
defaultValue: null,
|
|
36
|
+
min: { default: 0 },
|
|
37
|
+
max: { default: 100 },
|
|
38
|
+
range: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
default: false
|
|
41
|
+
},
|
|
42
|
+
disabled: {
|
|
43
|
+
type: Boolean,
|
|
44
|
+
default: false
|
|
45
|
+
},
|
|
46
|
+
readonly: { type: Boolean },
|
|
47
|
+
step: { default: 1 },
|
|
48
|
+
marks: null,
|
|
49
|
+
direction: { default: "horizontal" },
|
|
50
|
+
reverse: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
default: false
|
|
53
|
+
},
|
|
54
|
+
precision: { default: 8 },
|
|
55
|
+
tooltip: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: true
|
|
58
|
+
},
|
|
59
|
+
tooltipProps: null,
|
|
60
|
+
tooltipStartProps: null,
|
|
61
|
+
tooltipEndProps: null
|
|
62
|
+
},
|
|
63
|
+
emits: [
|
|
64
|
+
"update:modelValue",
|
|
65
|
+
"change",
|
|
66
|
+
"dragStart",
|
|
67
|
+
"dragEnd",
|
|
68
|
+
"markSelect",
|
|
69
|
+
"focus",
|
|
70
|
+
"blur"
|
|
71
|
+
],
|
|
72
|
+
setup(__props, { emit: __emit }) {
|
|
73
|
+
const props = __props;
|
|
74
|
+
const emits = __emit;
|
|
75
|
+
const formItemProvide = inject(FORM_ITEM_PROVIDE, void 0);
|
|
76
|
+
const disabledComputed = createProvideComputed("disabled", [formItemProvide, props], "or");
|
|
77
|
+
const readonlyComputed = createProvideComputed("readonly", [formItemProvide, props], "or");
|
|
78
|
+
const [modelValue, updateModelValue] = useControlledMode("modelValue", props, emits, {
|
|
79
|
+
defaultField: "defaultValue",
|
|
80
|
+
transform: (value) => {
|
|
81
|
+
return transformModelValue(value, props, emits);
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
const thumbRef = shallowRef(null);
|
|
85
|
+
const thumbStartRef = shallowRef(null);
|
|
86
|
+
const thumbEndRef = shallowRef(null);
|
|
87
|
+
const markWrapperRef = shallowRef(null);
|
|
88
|
+
const thumbCanvasRef = shallowRef(null);
|
|
89
|
+
const thumbStartCanvasRef = shallowRef(null);
|
|
90
|
+
const thumbEndCanvasRef = shallowRef(null);
|
|
91
|
+
const dotCanvasRef = shallowRef(null);
|
|
92
|
+
const valueRange = computed(() => Math.max(props.max - props.min, 0));
|
|
93
|
+
const sliderRect = ref({
|
|
94
|
+
width: 0,
|
|
95
|
+
height: 0
|
|
96
|
+
});
|
|
97
|
+
const thumbRect = ref({
|
|
98
|
+
width: 0,
|
|
99
|
+
height: 0
|
|
100
|
+
});
|
|
101
|
+
const updateSliderRect = () => {
|
|
102
|
+
const sliderEl = sliderRef.value;
|
|
103
|
+
if (!sliderEl) return;
|
|
104
|
+
const rect = sliderEl.getBoundingClientRect();
|
|
105
|
+
sliderRect.value = {
|
|
106
|
+
width: rect.width,
|
|
107
|
+
height: rect.height
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
const updateThumbRect = () => {
|
|
111
|
+
const thumbEl = thumbRef.value || thumbStartRef.value;
|
|
112
|
+
if (!thumbEl) return;
|
|
113
|
+
const rect = thumbEl.getBoundingClientRect();
|
|
114
|
+
thumbRect.value = {
|
|
115
|
+
width: rect.width,
|
|
116
|
+
height: rect.height
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
const fillStart = computed(() => {
|
|
120
|
+
if (props.range) if (A(modelValue.value)) return 0;
|
|
121
|
+
else return valueRange.value > 0 ? (modelValue.value[0] - props.min) / valueRange.value : 0;
|
|
122
|
+
else return 0;
|
|
123
|
+
});
|
|
124
|
+
const fillEnd = computed(() => {
|
|
125
|
+
if (valueRange.value === 0) return 0;
|
|
126
|
+
if (A(modelValue.value)) return (modelValue.value - props.min) / valueRange.value;
|
|
127
|
+
else return (modelValue.value[1] - props.min) / valueRange.value;
|
|
128
|
+
});
|
|
129
|
+
const thumbLeft = ref(0);
|
|
130
|
+
const thumbLeftStart = ref(0);
|
|
131
|
+
const thumbLeftEnd = ref(0);
|
|
132
|
+
const updateThumbLeft = async () => {
|
|
133
|
+
await nextTick();
|
|
134
|
+
if (!props.range) thumbLeft.value = calcThumbLeft(modelValue.value, sliderRect.value, thumbRect.value, valueRange.value, props);
|
|
135
|
+
else {
|
|
136
|
+
const value = modelValue.value;
|
|
137
|
+
thumbLeftStart.value = calcThumbLeft(value[0], sliderRect.value, thumbRect.value, valueRange.value, props);
|
|
138
|
+
thumbLeftEnd.value = calcThumbLeft(value[1], sliderRect.value, thumbRect.value, valueRange.value, props);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
watch([
|
|
142
|
+
modelValue,
|
|
143
|
+
() => props.direction,
|
|
144
|
+
() => props.min,
|
|
145
|
+
() => props.max,
|
|
146
|
+
() => props.reverse,
|
|
147
|
+
sliderRect,
|
|
148
|
+
thumbRect
|
|
149
|
+
], () => {
|
|
150
|
+
updateThumbLeft();
|
|
151
|
+
}, { deep: true });
|
|
152
|
+
watch(() => props.range, (val, old) => {
|
|
153
|
+
if (val && !old) updateModelValue([clampValue$1(props.min), clampValue$1(modelValue.value)]);
|
|
154
|
+
else updateModelValue(clampValue$1(modelValue.value[1]));
|
|
155
|
+
});
|
|
156
|
+
const trackLeft = computed(() => {
|
|
157
|
+
if (props.range && S(modelValue.value)) return Math.min(fillStart.value, fillEnd.value);
|
|
158
|
+
return 0;
|
|
159
|
+
});
|
|
160
|
+
const trackWidth = computed(() => {
|
|
161
|
+
return Math.abs(fillEnd.value - fillStart.value);
|
|
162
|
+
});
|
|
163
|
+
function clampValue$1(value) {
|
|
164
|
+
return clampValue(value, props);
|
|
165
|
+
}
|
|
166
|
+
const isDragging = ref(false);
|
|
167
|
+
const draggingTarget = ref(null);
|
|
168
|
+
function startDrag(e, target) {
|
|
169
|
+
if (disabledComputed.value || readonlyComputed.value) return;
|
|
170
|
+
e.preventDefault();
|
|
171
|
+
isDragging.value = true;
|
|
172
|
+
if (props.range && target) draggingTarget.value = target;
|
|
173
|
+
document.addEventListener("mousemove", handleDrag);
|
|
174
|
+
document.addEventListener("mouseup", stopDrag);
|
|
175
|
+
document.addEventListener("touchmove", handleDrag);
|
|
176
|
+
document.addEventListener("touchend", stopDrag);
|
|
177
|
+
doUpdate(e);
|
|
178
|
+
emits("dragStart", e);
|
|
179
|
+
}
|
|
180
|
+
const handleDrag = (e) => {
|
|
181
|
+
doUpdateThrottle(e);
|
|
182
|
+
};
|
|
183
|
+
const preprocessBeforeUpdate = (e, clickFlag) => {
|
|
184
|
+
let targetType = draggingTarget.value;
|
|
185
|
+
const sliderEl = sliderRef.value;
|
|
186
|
+
let thumbEl;
|
|
187
|
+
if (!clickFlag) thumbEl = !props.range ? thumbRef.value : draggingTarget.value === "start" ? thumbStartRef.value : draggingTarget.value === "end" ? thumbEndRef.value : null;
|
|
188
|
+
else if (!props.range) thumbEl = thumbRef.value;
|
|
189
|
+
else {
|
|
190
|
+
const { thumbEl: el, targetType: type } = getTargetThumbEl(e, props.direction, thumbStartRef, thumbEndRef);
|
|
191
|
+
thumbEl = el;
|
|
192
|
+
targetType = type;
|
|
193
|
+
}
|
|
194
|
+
return {
|
|
195
|
+
sliderEl,
|
|
196
|
+
thumbEl,
|
|
197
|
+
targetType
|
|
198
|
+
};
|
|
199
|
+
};
|
|
200
|
+
const doUpdate = async (e, clickFlag = false, preSetValue = void 0) => {
|
|
201
|
+
if (!isDragging.value && !clickFlag) return;
|
|
202
|
+
const { sliderEl, thumbEl, targetType } = preprocessBeforeUpdate(e, clickFlag);
|
|
203
|
+
if (!sliderEl || !thumbEl) return;
|
|
204
|
+
let value = preSetValue;
|
|
205
|
+
if (en(value)) value = calcValueFromEvent(e, sliderEl, thumbEl, valueRange.value, props);
|
|
206
|
+
if (props.range) {
|
|
207
|
+
let nextValue;
|
|
208
|
+
if (S(modelValue.value)) {
|
|
209
|
+
if (targetType === "start") nextValue = [value, modelValue.value[1]];
|
|
210
|
+
else if (targetType === "end") nextValue = [modelValue.value[0], value];
|
|
211
|
+
} else if (targetType === "start") nextValue = [value, clampValue$1(props.min)];
|
|
212
|
+
else if (targetType === "end") nextValue = [clampValue$1(props.min), value];
|
|
213
|
+
if (!nextValue) return;
|
|
214
|
+
await updateModelValue(nextValue);
|
|
215
|
+
} else await updateModelValue(value);
|
|
216
|
+
const left = calcThumbLeft(value, sliderRect.value, thumbRect.value, valueRange.value, props);
|
|
217
|
+
if (!props.range) thumbLeft.value = left;
|
|
218
|
+
else if (targetType === "start") thumbLeftStart.value = left;
|
|
219
|
+
else if (targetType === "end") thumbLeftEnd.value = left;
|
|
220
|
+
};
|
|
221
|
+
const doUpdateThrottle = qe(doUpdate, 20);
|
|
222
|
+
function stopDrag(e) {
|
|
223
|
+
if (isDragging.value) {
|
|
224
|
+
isDragging.value = false;
|
|
225
|
+
draggingTarget.value = null;
|
|
226
|
+
emits("change", Rn(modelValue.value));
|
|
227
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
228
|
+
}
|
|
229
|
+
document.removeEventListener("mousemove", handleDrag);
|
|
230
|
+
document.removeEventListener("mouseup", stopDrag);
|
|
231
|
+
document.removeEventListener("touchmove", handleDrag);
|
|
232
|
+
document.removeEventListener("touchend", stopDrag);
|
|
233
|
+
emits("dragEnd", e);
|
|
234
|
+
}
|
|
235
|
+
onUnmounted(() => {
|
|
236
|
+
document.removeEventListener("mousemove", handleDrag);
|
|
237
|
+
document.removeEventListener("mouseup", stopDrag);
|
|
238
|
+
document.removeEventListener("touchmove", handleDrag);
|
|
239
|
+
document.removeEventListener("touchend", stopDrag);
|
|
240
|
+
});
|
|
241
|
+
const markPoints = ref([]);
|
|
242
|
+
watch([
|
|
243
|
+
() => props.marks,
|
|
244
|
+
() => props.max,
|
|
245
|
+
() => props.min,
|
|
246
|
+
() => props.direction,
|
|
247
|
+
() => props.reverse,
|
|
248
|
+
valueRange,
|
|
249
|
+
sliderRect
|
|
250
|
+
], () => {
|
|
251
|
+
nextTick(() => {
|
|
252
|
+
markPoints.value = updateMarkPoints(sliderRect.value, valueRange.value, props);
|
|
253
|
+
});
|
|
254
|
+
}, { deep: true });
|
|
255
|
+
const selectSliderHandler = async (e, preSetValue) => {
|
|
256
|
+
if (disabledComputed.value || readonlyComputed.value) return;
|
|
257
|
+
await doUpdate(e, true, preSetValue);
|
|
258
|
+
if (A(preSetValue)) emits("markSelect", preSetValue, e);
|
|
259
|
+
emits("change", Rn(modelValue.value));
|
|
260
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.changeHandler();
|
|
261
|
+
};
|
|
262
|
+
const focusSliderHandler = (e) => {
|
|
263
|
+
if (disabledComputed.value || readonlyComputed.value) return;
|
|
264
|
+
const target = e.target;
|
|
265
|
+
if (markWrapperRef.value && markWrapperRef.value.contains(target) || thumbRef.value && thumbRef.value.contains(target) || thumbStartRef.value && thumbStartRef.value.contains(target) || thumbEndRef.value && thumbEndRef.value.contains(target)) return;
|
|
266
|
+
if (target === sliderRef.value) return;
|
|
267
|
+
if (sliderRef.value) sliderRef.value.focus();
|
|
268
|
+
};
|
|
269
|
+
const focusinHandler = (e) => {
|
|
270
|
+
if (e.target === sliderRef.value) return;
|
|
271
|
+
emits("focus", e);
|
|
272
|
+
};
|
|
273
|
+
const focusoutHandler = (e) => {
|
|
274
|
+
if (e.target === sliderRef.value) return;
|
|
275
|
+
emits("blur", e);
|
|
276
|
+
formItemProvide === null || formItemProvide === void 0 || formItemProvide.blurHandler();
|
|
277
|
+
};
|
|
278
|
+
const darkMode = useDarkMode();
|
|
279
|
+
const canvasRef = shallowRef(null);
|
|
280
|
+
const sliderRef = shallowRef(null);
|
|
281
|
+
onMounted(() => {
|
|
282
|
+
nextTick(() => {
|
|
283
|
+
drawPixel();
|
|
284
|
+
updateSliderRect();
|
|
285
|
+
updateThumbRect();
|
|
286
|
+
updateThumbLeft();
|
|
287
|
+
markPoints.value = updateMarkPoints(sliderRect.value, valueRange.value, props);
|
|
288
|
+
});
|
|
289
|
+
});
|
|
290
|
+
watch([
|
|
291
|
+
disabledComputed,
|
|
292
|
+
darkMode,
|
|
293
|
+
trackLeft,
|
|
294
|
+
trackWidth,
|
|
295
|
+
() => props.range,
|
|
296
|
+
thumbLeft,
|
|
297
|
+
thumbLeftStart,
|
|
298
|
+
thumbLeftEnd,
|
|
299
|
+
markPoints,
|
|
300
|
+
modelValue,
|
|
301
|
+
() => props.direction,
|
|
302
|
+
() => props.reverse
|
|
303
|
+
], () => {
|
|
304
|
+
nextTick(() => {
|
|
305
|
+
drawPixel();
|
|
306
|
+
});
|
|
307
|
+
}, { deep: true });
|
|
308
|
+
const drawPixel = () => {
|
|
309
|
+
const pixelSize = calcPixelSize();
|
|
310
|
+
const preprocessData = canvasPreprocess(sliderRef, canvasRef, props.direction === "vertical" ? pixelSize : 0, props.direction === "vertical" ? 0 : pixelSize);
|
|
311
|
+
if (!preprocessData) return;
|
|
312
|
+
const { ctx, width, height } = preprocessData;
|
|
313
|
+
const borderColor = getGlobalThemeColor("neutral", 10);
|
|
314
|
+
const center = calcBorderCornerCenter(fillArr(pixelSize, 4), width, height, pixelSize);
|
|
315
|
+
if (borderColor) drawBorder(ctx, width, height, center, borderColor, pixelSize);
|
|
316
|
+
const fillColor = disabledComputed.value ? getGlobalThemeColor("primary", 2) : getGlobalThemeColor("primary", 6);
|
|
317
|
+
const emptyColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
318
|
+
if (fillColor && emptyColor) drawRange(ctx, width, height, trackLeft.value, trackWidth.value, fillColor, emptyColor, pixelSize, props.direction, props.reverse);
|
|
319
|
+
const rad = BORDER_CORNER_RAD_RANGE;
|
|
320
|
+
const thumbColor = disabledComputed.value ? getGlobalThemeColor("neutral", 6) : getGlobalThemeColor("neutral", 1);
|
|
321
|
+
if (thumbColor && borderColor) drawThumb(thumbRef, thumbCanvasRef, thumbStartRef, thumbStartCanvasRef, thumbEndRef, thumbEndCanvasRef, props.range, rad, pixelSize, thumbColor, borderColor);
|
|
322
|
+
if (markPoints.value.length) drawMark(sliderRef, dotCanvasRef, rad, modelValue.value, props.direction, props.reverse, props.disabled, markPoints.value, pixelSize);
|
|
323
|
+
};
|
|
324
|
+
const refresh = () => {
|
|
325
|
+
drawPixel();
|
|
326
|
+
updateSliderRect();
|
|
327
|
+
updateThumbRect();
|
|
328
|
+
};
|
|
329
|
+
useResizeObserver(sliderRef, refresh);
|
|
330
|
+
useWatchGlobalCssVal(refresh);
|
|
331
|
+
useTransitionEnd(sliderRef, refresh);
|
|
332
|
+
return (_ctx, _cache) => {
|
|
333
|
+
var _props$marks;
|
|
334
|
+
return openBlock(), createElementBlock("div", {
|
|
335
|
+
class: normalizeClass(["pixelium px-slider", {
|
|
336
|
+
"px-slider__disabled": unref(disabledComputed),
|
|
337
|
+
"px-slider__readonly": unref(readonlyComputed),
|
|
338
|
+
"px-slider__marks": !!((_props$marks = props.marks) === null || _props$marks === void 0 ? void 0 : _props$marks.length),
|
|
339
|
+
[`px-slider__${props.direction}`]: props.direction,
|
|
340
|
+
"px-slider__reverse": !!props.reverse
|
|
341
|
+
}]),
|
|
342
|
+
ref_key: "sliderRef",
|
|
343
|
+
ref: sliderRef,
|
|
344
|
+
onClick: [withModifiers(selectSliderHandler, ["self"]), focusSliderHandler],
|
|
345
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
346
|
+
onFocusin: focusinHandler,
|
|
347
|
+
onFocusout: focusoutHandler
|
|
348
|
+
}, [
|
|
349
|
+
createElementVNode("div", {
|
|
350
|
+
class: "px-slider-mark-wrapper",
|
|
351
|
+
ref_key: "markWrapperRef",
|
|
352
|
+
ref: markWrapperRef
|
|
353
|
+
}, [markPoints.value.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(markPoints.value, (mark) => {
|
|
354
|
+
return openBlock(), createElementBlock(Fragment, { key: mark.value }, [createElementVNode("div", {
|
|
355
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
356
|
+
onClick: (e) => selectSliderHandler(e, mark.value),
|
|
357
|
+
class: "px-slider-mark",
|
|
358
|
+
style: normalizeStyle(unref(getMarkStyle)(mark.markLeft, props.direction, props.reverse))
|
|
359
|
+
}, [renderSlot(_ctx.$slots, "mark", {
|
|
360
|
+
value: mark.value,
|
|
361
|
+
label: mark.label
|
|
362
|
+
}, () => [createTextVNode(toDisplayString(mark.label), 1)])], 12, _hoisted_2), createElementVNode("div", {
|
|
363
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
364
|
+
onClick: (e) => selectSliderHandler(e, mark.value),
|
|
365
|
+
class: "px-slider-dot",
|
|
366
|
+
style: normalizeStyle(unref(getDotStyle)(mark.left, props.direction, props.reverse))
|
|
367
|
+
}, null, 12, _hoisted_3)], 64);
|
|
368
|
+
}), 128)) : createCommentVNode("v-if", true)], 512),
|
|
369
|
+
props.tooltip && !props.range ? (openBlock(), createBlock(tooltip_default, mergeProps({
|
|
370
|
+
key: 0,
|
|
371
|
+
arrow: false,
|
|
372
|
+
placement: props.direction === "horizontal" ? "top" : "right"
|
|
373
|
+
}, props.tooltipProps), {
|
|
374
|
+
content: withCtx(() => [createElementVNode("div", _hoisted_5, [renderSlot(_ctx.$slots, "tooltip-content", { value: unref(getSingleValue)(unref(modelValue)) }, () => [createTextVNode(toDisplayString(unref(getSingleValue)(unref(modelValue))), 1)])])]),
|
|
375
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
376
|
+
class: "px-slider-thumb",
|
|
377
|
+
style: normalizeStyle({
|
|
378
|
+
left: props.direction === "horizontal" ? thumbLeft.value + "px" : void 0,
|
|
379
|
+
bottom: props.direction === "horizontal" ? void 0 : thumbLeft.value + "px"
|
|
380
|
+
}),
|
|
381
|
+
onMousedown: startDrag,
|
|
382
|
+
onTouchstartPassive: startDrag,
|
|
383
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
384
|
+
ref_key: "thumbRef",
|
|
385
|
+
ref: thumbRef
|
|
386
|
+
}, [renderSlot(_ctx.$slots, "thumb"), createElementVNode("canvas", {
|
|
387
|
+
ref_key: "thumbCanvasRef",
|
|
388
|
+
ref: thumbCanvasRef,
|
|
389
|
+
class: "px-slider-canvas"
|
|
390
|
+
}, null, 512)], 44, _hoisted_4)]),
|
|
391
|
+
_: 3
|
|
392
|
+
}, 16, ["placement"])) : createCommentVNode("v-if", true),
|
|
393
|
+
!props.range && !props.tooltip ? (openBlock(), createElementBlock("div", {
|
|
394
|
+
key: 1,
|
|
395
|
+
class: "px-slider-thumb",
|
|
396
|
+
style: normalizeStyle({
|
|
397
|
+
left: props.direction === "horizontal" ? thumbLeft.value + "px" : void 0,
|
|
398
|
+
bottom: props.direction === "horizontal" ? void 0 : thumbLeft.value + "px"
|
|
399
|
+
}),
|
|
400
|
+
onMousedown: startDrag,
|
|
401
|
+
onTouchstartPassive: startDrag,
|
|
402
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
403
|
+
ref_key: "thumbRef",
|
|
404
|
+
ref: thumbRef
|
|
405
|
+
}, [renderSlot(_ctx.$slots, "thumb"), createElementVNode("canvas", {
|
|
406
|
+
ref_key: "thumbCanvasRef",
|
|
407
|
+
ref: thumbCanvasRef,
|
|
408
|
+
class: "px-slider-canvas"
|
|
409
|
+
}, null, 512)], 44, _hoisted_6)) : createCommentVNode("v-if", true),
|
|
410
|
+
props.range ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [props.tooltip ? (openBlock(), createBlock(tooltip_default, mergeProps({
|
|
411
|
+
key: 0,
|
|
412
|
+
arrow: false,
|
|
413
|
+
placement: props.direction === "horizontal" ? "top" : "right"
|
|
414
|
+
}, props.tooltipStartProps), {
|
|
415
|
+
content: withCtx(() => [createElementVNode("div", _hoisted_8, [renderSlot(_ctx.$slots, "tooltip-content", { value: unref(getRangeValue)(unref(modelValue), 0, props) }, () => [createTextVNode(toDisplayString(unref(getRangeValue)(unref(modelValue), 0, props)), 1)])])]),
|
|
416
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
417
|
+
class: "px-slider-thumb px-slider-thumb-start",
|
|
418
|
+
style: normalizeStyle({
|
|
419
|
+
left: props.direction === "horizontal" ? thumbLeftStart.value + "px" : void 0,
|
|
420
|
+
bottom: props.direction === "horizontal" ? void 0 : thumbLeftStart.value + "px"
|
|
421
|
+
}),
|
|
422
|
+
onMousedown: _cache[0] || (_cache[0] = (e) => startDrag(e, "start")),
|
|
423
|
+
onTouchstartPassive: _cache[1] || (_cache[1] = (e) => startDrag(e, "start")),
|
|
424
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
425
|
+
ref_key: "thumbStartRef",
|
|
426
|
+
ref: thumbStartRef
|
|
427
|
+
}, [renderSlot(_ctx.$slots, "thumb-start"), createElementVNode("canvas", {
|
|
428
|
+
ref_key: "thumbStartCanvasRef",
|
|
429
|
+
ref: thumbStartCanvasRef,
|
|
430
|
+
class: "px-slider-canvas"
|
|
431
|
+
}, null, 512)], 44, _hoisted_7)]),
|
|
432
|
+
_: 3
|
|
433
|
+
}, 16, ["placement"])) : (openBlock(), createElementBlock("div", {
|
|
434
|
+
key: 1,
|
|
435
|
+
class: "px-slider-thumb px-slider-thumb-start",
|
|
436
|
+
style: normalizeStyle({
|
|
437
|
+
left: props.direction === "horizontal" ? thumbLeftStart.value + "px" : void 0,
|
|
438
|
+
bottom: props.direction === "horizontal" ? void 0 : thumbLeftStart.value + "px"
|
|
439
|
+
}),
|
|
440
|
+
onMousedown: _cache[2] || (_cache[2] = (e) => startDrag(e, "start")),
|
|
441
|
+
onTouchstartPassive: _cache[3] || (_cache[3] = (e) => startDrag(e, "start")),
|
|
442
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
443
|
+
ref_key: "thumbStartRef",
|
|
444
|
+
ref: thumbStartRef
|
|
445
|
+
}, [renderSlot(_ctx.$slots, "thumb-start"), createElementVNode("canvas", {
|
|
446
|
+
ref_key: "thumbStartCanvasRef",
|
|
447
|
+
ref: thumbStartCanvasRef,
|
|
448
|
+
class: "px-slider-canvas"
|
|
449
|
+
}, null, 512)], 44, _hoisted_9)), props.tooltip ? (openBlock(), createBlock(tooltip_default, mergeProps({
|
|
450
|
+
key: 2,
|
|
451
|
+
arrow: false,
|
|
452
|
+
placement: props.direction === "horizontal" ? "top" : "right"
|
|
453
|
+
}, props.tooltipEndProps), {
|
|
454
|
+
content: withCtx(() => [createElementVNode("div", _hoisted_11, [renderSlot(_ctx.$slots, "tooltip-content", { value: unref(getRangeValue)(unref(modelValue), 1, props) }, () => [createTextVNode(toDisplayString(unref(getRangeValue)(unref(modelValue), 1, props)), 1)])])]),
|
|
455
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
456
|
+
class: "px-slider-thumb px-slider-thumb-end",
|
|
457
|
+
style: normalizeStyle({
|
|
458
|
+
left: props.direction === "horizontal" ? thumbLeftEnd.value + "px" : void 0,
|
|
459
|
+
bottom: props.direction === "horizontal" ? void 0 : thumbLeftEnd.value + "px"
|
|
460
|
+
}),
|
|
461
|
+
onMousedown: _cache[4] || (_cache[4] = (e) => startDrag(e, "end")),
|
|
462
|
+
onTouchstartPassive: _cache[5] || (_cache[5] = (e) => startDrag(e, "end")),
|
|
463
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
464
|
+
ref_key: "thumbEndRef",
|
|
465
|
+
ref: thumbEndRef
|
|
466
|
+
}, [renderSlot(_ctx.$slots, "thumb-end"), createElementVNode("canvas", {
|
|
467
|
+
ref_key: "thumbEndCanvasRef",
|
|
468
|
+
ref: thumbEndCanvasRef,
|
|
469
|
+
class: "px-slider-canvas"
|
|
470
|
+
}, null, 512)], 44, _hoisted_10)]),
|
|
471
|
+
_: 3
|
|
472
|
+
}, 16, ["placement"])) : (openBlock(), createElementBlock("div", {
|
|
473
|
+
key: 3,
|
|
474
|
+
class: "px-slider-thumb px-slider-thumb-end",
|
|
475
|
+
style: normalizeStyle({
|
|
476
|
+
left: props.direction === "horizontal" ? thumbLeftEnd.value + "px" : void 0,
|
|
477
|
+
bottom: props.direction === "horizontal" ? void 0 : thumbLeftEnd.value + "px"
|
|
478
|
+
}),
|
|
479
|
+
onMousedown: _cache[6] || (_cache[6] = (e) => startDrag(e, "end")),
|
|
480
|
+
onTouchstartPassive: _cache[7] || (_cache[7] = (e) => startDrag(e, "end")),
|
|
481
|
+
tabindex: unref(disabledComputed) || unref(readonlyComputed) ? -1 : 0,
|
|
482
|
+
ref_key: "thumbEndRef",
|
|
483
|
+
ref: thumbEndRef
|
|
484
|
+
}, [renderSlot(_ctx.$slots, "thumb-end"), createElementVNode("canvas", {
|
|
485
|
+
ref_key: "thumbEndCanvasRef",
|
|
486
|
+
ref: thumbEndCanvasRef,
|
|
487
|
+
class: "px-slider-canvas"
|
|
488
|
+
}, null, 512)], 44, _hoisted_12))], 64)) : createCommentVNode("v-if", true),
|
|
489
|
+
createElementVNode("canvas", {
|
|
490
|
+
ref_key: "canvasRef",
|
|
491
|
+
ref: canvasRef,
|
|
492
|
+
class: "px-slider-canvas"
|
|
493
|
+
}, null, 512),
|
|
494
|
+
createElementVNode("canvas", {
|
|
495
|
+
ref_key: "dotCanvasRef",
|
|
496
|
+
ref: dotCanvasRef,
|
|
497
|
+
class: "px-slider-canvas"
|
|
498
|
+
}, null, 512)
|
|
499
|
+
], 42, _hoisted_1);
|
|
500
|
+
};
|
|
501
|
+
}
|
|
502
|
+
});
|
|
503
|
+
export { slider_default as t };
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import type { EmitEvent } from '../share/type';
|
|
2
|
+
import type { TooltipEvents, TooltipProps } from '../tooltip/type';
|
|
3
|
+
export type SliderProps = {
|
|
4
|
+
/**
|
|
5
|
+
* @property {number | [number, number] | null} [modelValue]
|
|
6
|
+
* @version 0.0.3
|
|
7
|
+
*/
|
|
8
|
+
modelValue?: number | [number, number] | null;
|
|
9
|
+
/**
|
|
10
|
+
* @property {number | [number, number] | null} [defaultValue]
|
|
11
|
+
* @version 0.0.3
|
|
12
|
+
*/
|
|
13
|
+
defaultValue?: number | [number, number] | null;
|
|
14
|
+
/**
|
|
15
|
+
* @property {number} [min=0]
|
|
16
|
+
* @version 0.0.3
|
|
17
|
+
*/
|
|
18
|
+
min?: number;
|
|
19
|
+
/**
|
|
20
|
+
* @property {number} [max=100]
|
|
21
|
+
* @version 0.0.3
|
|
22
|
+
*/
|
|
23
|
+
max?: number;
|
|
24
|
+
/**
|
|
25
|
+
* @property {boolean} [range=false]
|
|
26
|
+
* @version 0.0.3
|
|
27
|
+
*/
|
|
28
|
+
range?: boolean;
|
|
29
|
+
/**
|
|
30
|
+
* @property {boolean} [disabled=false]
|
|
31
|
+
* @version 0.0.3
|
|
32
|
+
*/
|
|
33
|
+
disabled?: boolean;
|
|
34
|
+
/**
|
|
35
|
+
* @property {boolean} [readonly=false]
|
|
36
|
+
* @version 0.0.3
|
|
37
|
+
*/
|
|
38
|
+
readonly?: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* @property {number | 'mark'} [step=1]
|
|
41
|
+
* @version 0.0.3
|
|
42
|
+
*/
|
|
43
|
+
step?: number | 'mark';
|
|
44
|
+
/**
|
|
45
|
+
* @property {(number | { value: number; label?: string })[]} [marks]
|
|
46
|
+
* @version 0.0.3
|
|
47
|
+
*/
|
|
48
|
+
marks?: (number | {
|
|
49
|
+
value: number;
|
|
50
|
+
label?: string;
|
|
51
|
+
})[];
|
|
52
|
+
/**
|
|
53
|
+
* @property {'horizontal' | 'vertical'} [direction='horizontal']
|
|
54
|
+
* @version 0.0.3
|
|
55
|
+
*/
|
|
56
|
+
direction?: 'horizontal' | 'vertical';
|
|
57
|
+
/**
|
|
58
|
+
* @property {boolean} [reverse=false]
|
|
59
|
+
* @version 0.0.3
|
|
60
|
+
*/
|
|
61
|
+
reverse?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* @property {number | null} [precision=8]
|
|
64
|
+
* @version 0.0.3
|
|
65
|
+
*/
|
|
66
|
+
precision?: number | null;
|
|
67
|
+
/**
|
|
68
|
+
* @property {boolean} [tooltip=true]
|
|
69
|
+
* @version 0.0.3
|
|
70
|
+
*/
|
|
71
|
+
tooltip?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* @property {Omit<TooltipProps, 'visible' | 'content'> & EmitEvent<TooltipEvents>} [tooltipProps]
|
|
74
|
+
* @version 0.0.3
|
|
75
|
+
*/
|
|
76
|
+
tooltipProps?: Omit<TooltipProps, 'visible' | 'content'> & EmitEvent<TooltipEvents>;
|
|
77
|
+
/**
|
|
78
|
+
* @property {Omit<TooltipProps, 'visible' | 'content'> & EmitEvent<TooltipEvents>} [tooltipStartProps]
|
|
79
|
+
* @version 0.0.3
|
|
80
|
+
*/
|
|
81
|
+
tooltipStartProps?: Omit<TooltipProps, 'visible' | 'content'> & EmitEvent<TooltipEvents>;
|
|
82
|
+
/**
|
|
83
|
+
* @property {Omit<TooltipProps, 'visible' | 'content'> & EmitEvent<TooltipEvents>} [tooltipEndProps]
|
|
84
|
+
* @version 0.0.3
|
|
85
|
+
*/
|
|
86
|
+
tooltipEndProps?: Omit<TooltipProps, 'visible' | 'content'> & EmitEvent<TooltipEvents>;
|
|
87
|
+
};
|
|
88
|
+
export type SliderEvent = {
|
|
89
|
+
/**
|
|
90
|
+
* @event update:modelValue
|
|
91
|
+
* @version 0.0.3
|
|
92
|
+
* @param {number | [number, number]} value
|
|
93
|
+
*/
|
|
94
|
+
'update:modelValue': [value: number | [number, number]];
|
|
95
|
+
/**
|
|
96
|
+
* @event change
|
|
97
|
+
* @version 0.0.3
|
|
98
|
+
* @param {number | [number, number]} value
|
|
99
|
+
*/
|
|
100
|
+
change: [value: number | [number, number]];
|
|
101
|
+
/**
|
|
102
|
+
* @event dragStart
|
|
103
|
+
* @version 0.0.3
|
|
104
|
+
* @param {MouseEvent | TouchEvent} event
|
|
105
|
+
*/
|
|
106
|
+
dragStart: [event: MouseEvent | TouchEvent];
|
|
107
|
+
/**
|
|
108
|
+
* @event dragEnd
|
|
109
|
+
* @version 0.0.3
|
|
110
|
+
* @param {MouseEvent | TouchEvent} event
|
|
111
|
+
*/
|
|
112
|
+
dragEnd: [event: MouseEvent | TouchEvent];
|
|
113
|
+
/**
|
|
114
|
+
* @event markSelect
|
|
115
|
+
* @version 0.0.3
|
|
116
|
+
* @param {number} value
|
|
117
|
+
* @param {MouseEvent} event
|
|
118
|
+
*/
|
|
119
|
+
markSelect: [value: number, event: MouseEvent];
|
|
120
|
+
/**
|
|
121
|
+
* @event focus
|
|
122
|
+
* @version 0.0.3
|
|
123
|
+
* @param {FocusEvent} event
|
|
124
|
+
*/
|
|
125
|
+
focus: [event: FocusEvent];
|
|
126
|
+
/**
|
|
127
|
+
* @event focus
|
|
128
|
+
* @version 0.0.3
|
|
129
|
+
* @param {FocusEvent} event
|
|
130
|
+
*/
|
|
131
|
+
blur: [event: FocusEvent];
|
|
132
|
+
};
|
|
133
|
+
export type SliderSlots = {
|
|
134
|
+
/**
|
|
135
|
+
* @slot mark
|
|
136
|
+
* @param {number} value
|
|
137
|
+
* @param {string | undefined} label
|
|
138
|
+
* @version 0.0.3
|
|
139
|
+
*/
|
|
140
|
+
mark: {};
|
|
141
|
+
/**
|
|
142
|
+
* @slot thumb
|
|
143
|
+
* @version 0.0.3
|
|
144
|
+
*/
|
|
145
|
+
thumb: {};
|
|
146
|
+
/**
|
|
147
|
+
* @slot thumb-start
|
|
148
|
+
* @version 0.0.3
|
|
149
|
+
*/
|
|
150
|
+
'thumb-start': {};
|
|
151
|
+
/**
|
|
152
|
+
* @slot thumb-end
|
|
153
|
+
* @version 0.0.3
|
|
154
|
+
*/
|
|
155
|
+
'thumb-end': {};
|
|
156
|
+
/**
|
|
157
|
+
* @slot tooltip-content
|
|
158
|
+
* @param {number} value
|
|
159
|
+
* @version 0.0.3
|
|
160
|
+
*/
|
|
161
|
+
'tooltip-content': {};
|
|
162
|
+
};
|