x-next 1.1.0 → 1.3.0
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/CHANGELOG.md +38 -0
- package/dist/_hooks/use-form-item.d.ts +5 -0
- package/dist/_hooks/use-picker-focus.d.ts +17 -0
- package/dist/components/_components/feedback-icon/index.vue.d.ts +4 -4
- package/dist/components/_components/picker/input-range.vue.d.ts +10 -6
- package/dist/components/_components/picker/input.vue.d.ts +9 -5
- package/dist/components/alert/Alert.vue.d.ts +5 -5
- package/dist/components/alert/index.d.ts +10 -10
- package/dist/components/date-picker/DatePanel.vue.d.ts +5 -0
- package/dist/components/date-picker/DatePicker.vue.d.ts +36 -16
- package/dist/components/date-picker/index.d.ts +77 -33
- package/dist/components/dialog/Dialog.d.ts +1 -1
- package/dist/components/dialog/index.d.ts +3 -3
- package/dist/components/drawer/index.d.ts +3 -3
- package/dist/components/drawer/src/Drawer.vue.d.ts +1 -1
- package/dist/components/dropdown/Dropdown.vue.d.ts +30 -4
- package/dist/components/dropdown/DropdownButton.vue.d.ts +31 -5
- package/dist/components/dropdown/DropdownOption.vue.d.ts +2 -0
- package/dist/components/dropdown/DropdownSubmenu.vue.d.ts +162 -5
- package/dist/components/dropdown/context.d.ts +14 -1
- package/dist/components/dropdown/dropdown-panel.vue.d.ts +7 -1
- package/dist/components/dropdown/index.d.ts +610 -28
- package/dist/components/dropdown/use-keyboard.d.ts +10 -0
- package/dist/components/form/FormItem.vue.d.ts +12 -4
- package/dist/components/form/context.d.ts +6 -0
- package/dist/components/form/form-item-label.vue.d.ts +4 -4
- package/dist/components/form/form-item-message.vue.d.ts +2 -0
- package/dist/components/form/index.d.ts +30 -8
- package/dist/components/form/interface.d.ts +2 -2
- package/dist/components/form-input/InputPassword.vue.d.ts +20 -2
- package/dist/components/form-input/index.d.ts +22 -4
- package/dist/components/form-select/Select.d.ts +3 -3
- package/dist/components/form-select/hooks/use-select.d.ts +2 -1
- package/dist/components/form-select/index.d.ts +6 -6
- package/dist/components/form-slider/Slider.vue.d.ts +10 -3
- package/dist/components/form-slider/index.d.ts +26 -6
- package/dist/components/form-slider/slider-button.vue.d.ts +4 -3
- package/dist/components/form-switch/Switch.vue.d.ts +2 -1
- package/dist/components/form-switch/index.d.ts +5 -2
- package/dist/components/form-textarea/Textarea.vue.d.ts +2 -2
- package/dist/components/form-textarea/index.d.ts +5 -5
- package/dist/components/image/Image.vue.d.ts +10 -9
- package/dist/components/image/ImagePreview.vue.d.ts +8 -7
- package/dist/components/image/ImagePreviewAction.d.ts +3 -3
- package/dist/components/image/ImagePreviewGroup.vue.d.ts +8 -7
- package/dist/components/image/index.d.ts +59 -52
- package/dist/components/image/preview-arrow.vue.d.ts +2 -2
- package/dist/components/image/preview-toolbar.vue.d.ts +3 -3
- package/dist/components/layout/LayoutSidebar.vue.d.ts +2 -2
- package/dist/components/layout/index.d.ts +4 -4
- package/dist/components/link/Link.vue.d.ts +2 -2
- package/dist/components/link/index.d.ts +4 -4
- package/dist/components/menu/Menu.d.ts +2 -2
- package/dist/components/menu/base-menu.vue.d.ts +2 -2
- package/dist/components/menu/index.d.ts +4 -4
- package/dist/components/menu/sub-menu-pop.vue.d.ts +5 -5
- package/dist/components/message/index.d.ts +17 -17
- package/dist/components/message/message.vue.d.ts +8 -8
- package/dist/components/notification/Notification.d.ts +1 -1
- package/dist/components/notification/index.d.ts +3 -3
- package/dist/components/pagination/page-item-ellipsis.vue.d.ts +1 -1
- package/dist/components/pagination/page-item-step.vue.d.ts +2 -2
- package/dist/components/pagination/page-options.vue.d.ts +6 -6
- package/dist/components/popconfirm/src/popup.vue.d.ts +1 -1
- package/dist/components/popover/Popover.d.ts +1 -1
- package/dist/components/popover/index.d.ts +3 -3
- package/dist/components/popup/Popup.d.ts +1 -1
- package/dist/components/popup/index.d.ts +3 -3
- package/dist/components/progress/Progress.vue.d.ts +4 -4
- package/dist/components/progress/circle.vue.d.ts +2 -2
- package/dist/components/progress/index.d.ts +8 -8
- package/dist/components/progress/line.vue.d.ts +1 -1
- package/dist/components/progress/steps.vue.d.ts +1 -1
- package/dist/components/steps/Step.vue.d.ts +2 -2
- package/dist/components/steps/index.d.ts +4 -4
- package/dist/components/tabs/Tabs.d.ts +1 -1
- package/dist/components/tabs/index.d.ts +3 -3
- package/dist/components/tabs/tabs-tab.vue.d.ts +1 -1
- package/dist/components/tag/Tag.vue.d.ts +2 -2
- package/dist/components/tag/index.d.ts +4 -4
- package/dist/components/time-picker/TimeColumn.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePanel.vue.d.ts +3 -0
- package/dist/components/time-picker/TimePicker.vue.d.ts +33 -17
- package/dist/components/time-picker/index.d.ts +73 -36
- package/dist/components/time-range-selector/TimeRangeSelector.vue.d.ts +8 -0
- package/dist/components/time-range-selector/index.d.ts +22 -0
- package/dist/components/tooltip/Tooltip.vue.d.ts +1 -1
- package/dist/components/tooltip/index.d.ts +3 -3
- package/dist/components/trigger/Trigger.d.ts +1 -1
- package/dist/components/trigger/index.d.ts +3 -3
- package/dist/es/_hooks/use-form-item.js +36 -10
- package/dist/es/_hooks/use-overflow.js +45 -40
- package/dist/es/_hooks/use-picker-focus.js +57 -0
- package/dist/es/_utils/constant.js +17 -5
- package/dist/es/components/_components/picker/input-range.vue.js +45 -55
- package/dist/es/components/_components/picker/input-range.vue2.js +105 -70
- package/dist/es/components/_components/picker/input.vue.js +22 -25
- package/dist/es/components/_components/picker/input.vue2.js +58 -43
- package/dist/es/components/_components/select-view/select-view.js +61 -66
- package/dist/es/components/date-picker/DatePanel.vue.js +102 -94
- package/dist/es/components/date-picker/DatePanel.vue2.js +97 -44
- package/dist/es/components/date-picker/DatePicker.vue.js +71 -58
- package/dist/es/components/date-picker/DatePicker.vue2.js +285 -231
- package/dist/es/components/dialog/Dialog.js +159 -128
- package/dist/es/components/dropdown/Dropdown.vue.js +18 -15
- package/dist/es/components/dropdown/Dropdown.vue2.js +52 -31
- package/dist/es/components/dropdown/DropdownOption.vue.js +22 -21
- package/dist/es/components/dropdown/DropdownOption.vue2.js +23 -19
- package/dist/es/components/dropdown/DropdownSubmenu.vue.js +49 -36
- package/dist/es/components/dropdown/DropdownSubmenu.vue2.js +45 -24
- package/dist/es/components/dropdown/context.js +3 -2
- package/dist/es/components/dropdown/dropdown-panel.vue.js +24 -21
- package/dist/es/components/dropdown/dropdown-panel.vue2.js +83 -31
- package/dist/es/components/dropdown/use-keyboard.js +45 -0
- package/dist/es/components/form/Form.vue2.js +113 -101
- package/dist/es/components/form/FormItem.vue.js +26 -22
- package/dist/es/components/form/FormItem.vue2.js +162 -125
- package/dist/es/components/form/form-item-message.vue.js +31 -24
- package/dist/es/components/form/form-item-message.vue2.js +4 -2
- package/dist/es/components/form-checkbox/Checkbox.js +80 -76
- package/dist/es/components/form-checkbox/CheckboxGroup.js +43 -38
- package/dist/es/components/form-input/Input.js +83 -79
- package/dist/es/components/form-input/InputPassword.vue.js +19 -16
- package/dist/es/components/form-input/InputPassword.vue2.js +39 -29
- package/dist/es/components/form-input/InputSearch.js +47 -37
- package/dist/es/components/form-input-number/InputNumber.js +134 -133
- package/dist/es/components/form-input-tag/InputTag.js +173 -162
- package/dist/es/components/form-radio/Radio.js +74 -71
- package/dist/es/components/form-radio/RadioGroup.js +55 -49
- package/dist/es/components/form-select/Select.js +116 -114
- package/dist/es/components/form-select/hooks/use-select.js +128 -128
- package/dist/es/components/form-slider/Slider.vue.js +28 -28
- package/dist/es/components/form-slider/Slider.vue2.js +139 -132
- package/dist/es/components/form-slider/slider-button.vue.js +6 -6
- package/dist/es/components/form-slider/slider-button.vue2.js +39 -34
- package/dist/es/components/form-switch/Switch.vue.js +9 -9
- package/dist/es/components/form-switch/Switch.vue2.js +81 -74
- package/dist/es/components/form-textarea/Textarea.vue2.js +123 -108
- package/dist/es/components/image/Image.vue2.js +77 -76
- package/dist/es/components/image/ImagePreview.vue.js +13 -12
- package/dist/es/components/image/ImagePreview.vue2.js +141 -136
- package/dist/es/components/image/ImagePreviewGroup.vue.js +1 -1
- package/dist/es/components/image/ImagePreviewGroup.vue2.js +82 -83
- package/dist/es/components/rate/Rate.js +106 -103
- package/dist/es/components/time-picker/TimeColumn.vue.js +34 -23
- package/dist/es/components/time-picker/TimeColumn.vue2.js +37 -28
- package/dist/es/components/time-picker/TimePicker.vue.js +83 -64
- package/dist/es/components/time-picker/TimePicker.vue2.js +192 -156
- package/dist/es/components/time-range-selector/TimeRangeSelector.vue.js +327 -193
- package/dist/es/locale/en-US.js +6 -0
- package/dist/es/locale/zh-CN.js +6 -0
- package/dist/es/style.css +1 -1
- package/dist/icons/_self/down.d.ts +1 -1
- package/dist/icons/_self/dropdown/more.d.ts +1 -1
- package/dist/icons/_self/empty-better.d.ts +1 -1
- package/dist/icons/_self/empty.d.ts +1 -1
- package/dist/icons/_self/eye-invisible.d.ts +1 -1
- package/dist/icons/_self/eye.d.ts +1 -1
- package/dist/icons/_self/full-screen.d.ts +1 -1
- package/dist/icons/_self/left.d.ts +1 -1
- package/dist/icons/_self/menu/down.d.ts +1 -1
- package/dist/icons/_self/minus.d.ts +1 -1
- package/dist/icons/_self/more-dot.d.ts +1 -1
- package/dist/icons/_self/next.d.ts +1 -1
- package/dist/icons/_self/original-size.d.ts +1 -1
- package/dist/icons/_self/plus.d.ts +1 -1
- package/dist/icons/_self/prev.d.ts +1 -1
- package/dist/icons/_self/question-message.d.ts +1 -1
- package/dist/icons/_self/right.d.ts +1 -1
- package/dist/icons/_self/rotate-left.d.ts +1 -1
- package/dist/icons/_self/rotate-right.d.ts +1 -1
- package/dist/icons/_self/search.d.ts +1 -1
- package/dist/icons/_self/up.d.ts +1 -1
- package/dist/icons/_self/zoom-in.d.ts +1 -1
- package/dist/icons/_self/zoom-out.d.ts +1 -1
- package/dist/icons/_ui/alone-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-left.d.ts +1 -1
- package/dist/icons/_ui/alone-margin-right.d.ts +1 -1
- package/dist/icons/_ui/alone-right.d.ts +1 -1
- package/dist/icons/_ui/calendar.d.ts +1 -1
- package/dist/icons/_ui/time.d.ts +1 -1
- package/dist/icons/animation/animation-loading.d.ts +1 -1
- package/dist/icons/default/check-circle-fill.d.ts +1 -1
- package/dist/icons/default/check.d.ts +1 -1
- package/dist/icons/default/close-circle-fill.d.ts +1 -1
- package/dist/icons/default/close.d.ts +1 -1
- package/dist/icons/default/exclamation-circle-fill.d.ts +1 -1
- package/dist/icons/default/exclamation.d.ts +1 -1
- package/dist/icons/default/filter.d.ts +1 -1
- package/dist/icons/default/info-circle-fill.d.ts +1 -1
- package/dist/icons/default/link.d.ts +1 -1
- package/dist/icons/default/logo-simple.d.ts +1 -1
- package/dist/icons/default/minus-circle-fill.d.ts +1 -1
- package/dist/icons/icon.d.ts +2 -2
- package/dist/icons/index.d.ts +3 -3
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.umd.js +4 -4
- package/dist/locale/interface.d.ts +6 -0
- package/dist/style/base.css +1 -1
- package/dist/style/date-picker.css +1 -1
- package/dist/style/form.css +1 -1
- package/dist/style/image.css +1 -1
- package/dist/style/time-range-selector.css +1 -1
- package/dist/style.css +1 -1
- package/package.json +2 -2
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { isUndefined as
|
|
9
|
-
import { TRIGGER_POSITIONS as
|
|
10
|
-
import { getLegalValue as
|
|
11
|
-
import { useFormItem as
|
|
12
|
-
import { useSize as
|
|
13
|
-
import { getClassNameMixin as
|
|
14
|
-
const
|
|
1
|
+
import { defineComponent as re, computed as c, toRefs as oe, toRef as me, ref as B, watch as ce } from "vue";
|
|
2
|
+
import C from "../../node_modules/.pnpm/number-precision@1.6.0/node_modules/number-precision/build/index.es.js";
|
|
3
|
+
import de from "./slider-button.vue.js";
|
|
4
|
+
import fe from "./slider-dots.vue.js";
|
|
5
|
+
import se from "./slider-marks.vue.js";
|
|
6
|
+
import ve from "./slider-ticks.vue.js";
|
|
7
|
+
import he from "./slider-input.vue.js";
|
|
8
|
+
import { isUndefined as z, isArray as h } from "../../_utils/is.js";
|
|
9
|
+
import { TRIGGER_POSITIONS as ge, SIZES as ye } from "../../_utils/constant.js";
|
|
10
|
+
import { getLegalValue as Ve, getOffsetPercent as g, getPositionStyle as Se } from "./utils.js";
|
|
11
|
+
import { useFormItem as be } from "../../_hooks/use-form-item.js";
|
|
12
|
+
import { useSize as ke } from "../../_hooks/use-size.js";
|
|
13
|
+
import { getClassNameMixin as xe } from "../../_utils/config.js";
|
|
14
|
+
const Te = re({
|
|
15
15
|
name: "Slider",
|
|
16
|
+
inheritAttrs: !1,
|
|
16
17
|
components: {
|
|
17
|
-
SliderButton:
|
|
18
|
-
SliderDots:
|
|
19
|
-
SliderMarks:
|
|
20
|
-
SliderTicks:
|
|
21
|
-
SliderInput:
|
|
18
|
+
SliderButton: de,
|
|
19
|
+
SliderDots: fe,
|
|
20
|
+
SliderMarks: se,
|
|
21
|
+
SliderTicks: ve,
|
|
22
|
+
SliderInput: he
|
|
22
23
|
},
|
|
23
24
|
props: {
|
|
24
25
|
/**
|
|
@@ -92,7 +93,7 @@ const Ie = ne({
|
|
|
92
93
|
*/
|
|
93
94
|
size: {
|
|
94
95
|
type: String,
|
|
95
|
-
validator: (e) =>
|
|
96
|
+
validator: (e) => ye.includes(e)
|
|
96
97
|
},
|
|
97
98
|
/**
|
|
98
99
|
* @zh 是否显示刻度线
|
|
@@ -136,7 +137,7 @@ const Ie = ne({
|
|
|
136
137
|
*/
|
|
137
138
|
tooltipPosition: {
|
|
138
139
|
type: String,
|
|
139
|
-
validator: (e) =>
|
|
140
|
+
validator: (e) => ge.includes(e)
|
|
140
141
|
}
|
|
141
142
|
},
|
|
142
143
|
emits: {
|
|
@@ -163,154 +164,160 @@ const Ie = ne({
|
|
|
163
164
|
*/
|
|
164
165
|
blur: (e) => !0
|
|
165
166
|
},
|
|
166
|
-
setup(e, { emit: d }) {
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
} =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
setup(e, { emit: d, attrs: A }) {
|
|
168
|
+
const R = (t) => t === "id" || t.startsWith("aria-"), D = c(
|
|
169
|
+
() => Object.fromEntries(Object.entries(A).filter(([t]) => !R(t)))
|
|
170
|
+
), T = c(
|
|
171
|
+
() => Object.fromEntries(Object.entries(A).filter(([t]) => R(t)))
|
|
172
|
+
), { modelValue: L, size: F } = oe(e), o = xe("slider"), {
|
|
173
|
+
mergedDisabled: y,
|
|
174
|
+
mergedSize: K,
|
|
175
|
+
eventHandlers: E
|
|
176
|
+
} = be({
|
|
177
|
+
disabled: me(e, "disabled"),
|
|
178
|
+
size: F
|
|
179
|
+
}), { mergedSize: N } = ke(K), f = B(null), V = B(), P = z(e.modelValue) ? e.defaultValue : e.modelValue, i = (t) => Ve(t, e.min, e.max, e.step), S = (t) => {
|
|
180
|
+
const n = h(t) ? i(t[0] ?? e.min) : e.min, a = h(t) ? i(t[1] ?? e.min) : i(t ?? e.min);
|
|
181
|
+
return n <= a ? [n, a] : [a, n];
|
|
182
|
+
}, [_, H] = S(P), u = B(_), l = B(H);
|
|
183
|
+
ce(L, (t) => {
|
|
184
|
+
h(t) ? [u.value, l.value] = S(t) : l.value = i(t ?? e.min);
|
|
180
185
|
});
|
|
181
|
-
const
|
|
182
|
-
var
|
|
183
|
-
d("focus", t), (
|
|
184
|
-
},
|
|
185
|
-
var
|
|
186
|
-
d("blur", t), (
|
|
187
|
-
},
|
|
188
|
-
var
|
|
189
|
-
const t =
|
|
190
|
-
d("update:modelValue", t), d("change", t), (
|
|
191
|
-
},
|
|
192
|
-
d("changeEnd",
|
|
193
|
-
},
|
|
194
|
-
u.value = Math.min(i(t ?? e.min), l.value),
|
|
195
|
-
},
|
|
196
|
-
l.value = Math.max(i(t ?? e.min), u.value),
|
|
197
|
-
},
|
|
186
|
+
const O = () => e.range ? u.value <= l.value ? [u.value, l.value] : [l.value, u.value] : l.value, $ = (t) => {
|
|
187
|
+
var n, a;
|
|
188
|
+
d("focus", t), (a = (n = E.value) == null ? void 0 : n.onFocus) == null || a.call(n, t);
|
|
189
|
+
}, G = (t) => {
|
|
190
|
+
var n, a;
|
|
191
|
+
d("blur", t), (a = (n = E.value) == null ? void 0 : n.onBlur) == null || a.call(n, t);
|
|
192
|
+
}, m = () => {
|
|
193
|
+
var n, a;
|
|
194
|
+
const t = O();
|
|
195
|
+
d("update:modelValue", t), d("change", t), (a = (n = E.value) == null ? void 0 : n.onChange) == null || a.call(n);
|
|
196
|
+
}, s = () => {
|
|
197
|
+
d("changeEnd", O());
|
|
198
|
+
}, U = (t) => {
|
|
199
|
+
u.value = Math.min(i(t ?? e.min), l.value), m(), s();
|
|
200
|
+
}, W = (t) => {
|
|
201
|
+
l.value = Math.max(i(t ?? e.min), u.value), m(), s();
|
|
202
|
+
}, b = c(() => e.range ? h(e.modelValue) ? S(e.modelValue) : S([u.value, e.modelValue ?? l.value]) : z(e.modelValue) ? [e.min, i(l.value)] : h(e.modelValue) ? [e.min, i(e.modelValue[1] ?? e.min)] : [e.min, i(e.modelValue)]), X = c(
|
|
198
203
|
() => Object.keys(e.marks || {}).map((t) => {
|
|
199
|
-
var
|
|
200
|
-
const
|
|
204
|
+
var a;
|
|
205
|
+
const n = Number(t);
|
|
201
206
|
return {
|
|
202
|
-
key:
|
|
203
|
-
content: (
|
|
204
|
-
isActive:
|
|
207
|
+
key: n,
|
|
208
|
+
content: (a = e.marks) == null ? void 0 : a[n],
|
|
209
|
+
isActive: n >= b.value[0] && n <= b.value[1]
|
|
205
210
|
};
|
|
206
211
|
})
|
|
207
|
-
),
|
|
208
|
-
|
|
212
|
+
), Y = (t) => Se(g(t, [e.min, e.max]), e.direction), Z = () => {
|
|
213
|
+
f.value && (V.value = f.value.getBoundingClientRect());
|
|
209
214
|
};
|
|
210
|
-
function k(t,
|
|
211
|
-
if (!
|
|
215
|
+
function k(t, n) {
|
|
216
|
+
if (!V.value)
|
|
212
217
|
return 0;
|
|
213
|
-
const { left:
|
|
214
|
-
if (
|
|
218
|
+
const { left: a, top: r, width: w, height: x } = V.value, M = e.direction === "horizontal" ? w : x;
|
|
219
|
+
if (M <= 0 || e.max <= e.min)
|
|
215
220
|
return e.min;
|
|
216
|
-
const
|
|
217
|
-
if (
|
|
221
|
+
const j = M * e.step / (e.max - e.min);
|
|
222
|
+
if (j <= 0)
|
|
218
223
|
return e.min;
|
|
219
|
-
let v = e.direction === "horizontal" ? t -
|
|
220
|
-
v < 0 && (v = 0), v >
|
|
221
|
-
const
|
|
222
|
-
return i(
|
|
224
|
+
let v = e.direction === "horizontal" ? t - a : r + x - n;
|
|
225
|
+
v < 0 && (v = 0), v > M && (v = M);
|
|
226
|
+
const ue = Math.round(v / j);
|
|
227
|
+
return i(C.plus(e.min, C.times(ue, e.step)));
|
|
223
228
|
}
|
|
224
|
-
const
|
|
225
|
-
l.value = e.range ? Math.max(k(t,
|
|
226
|
-
},
|
|
227
|
-
if (
|
|
229
|
+
const q = (t, n) => {
|
|
230
|
+
l.value = e.range ? Math.max(k(t, n), u.value) : k(t, n), m();
|
|
231
|
+
}, J = (t) => {
|
|
232
|
+
if (y.value)
|
|
228
233
|
return;
|
|
229
|
-
const { clientX:
|
|
230
|
-
|
|
231
|
-
const
|
|
234
|
+
const { clientX: n, clientY: a } = t;
|
|
235
|
+
f.value && (V.value = f.value.getBoundingClientRect());
|
|
236
|
+
const r = k(n, a);
|
|
232
237
|
if (e.range) {
|
|
233
|
-
const [
|
|
234
|
-
Math.abs(
|
|
238
|
+
const [w, x] = b.value;
|
|
239
|
+
Math.abs(r - w) <= Math.abs(r - x) ? u.value = Math.min(r, l.value) : l.value = Math.max(r, u.value);
|
|
235
240
|
} else
|
|
236
|
-
l.value =
|
|
237
|
-
|
|
241
|
+
l.value = r;
|
|
242
|
+
m(), s();
|
|
238
243
|
};
|
|
239
|
-
function
|
|
240
|
-
return t >
|
|
241
|
-
bottom:
|
|
242
|
-
top:
|
|
244
|
+
function Q([t, n]) {
|
|
245
|
+
return t > n && ([t, n] = [n, t]), e.direction === "vertical" ? {
|
|
246
|
+
bottom: g(t, [e.min, e.max]),
|
|
247
|
+
top: g(e.max + e.min - n, [e.min, e.max])
|
|
243
248
|
} : {
|
|
244
|
-
left:
|
|
245
|
-
right:
|
|
249
|
+
left: g(t, [e.min, e.max]),
|
|
250
|
+
right: g(e.max + e.min - n, [e.min, e.max])
|
|
246
251
|
};
|
|
247
252
|
}
|
|
248
|
-
const
|
|
249
|
-
u.value = Math.min(k(t,
|
|
250
|
-
},
|
|
251
|
-
|
|
252
|
-
},
|
|
253
|
-
const
|
|
254
|
-
if (
|
|
253
|
+
const p = (t, n) => {
|
|
254
|
+
u.value = Math.min(k(t, n), l.value), m();
|
|
255
|
+
}, ee = () => {
|
|
256
|
+
s();
|
|
257
|
+
}, te = (t) => {
|
|
258
|
+
const n = t.key;
|
|
259
|
+
if (n === "Home")
|
|
255
260
|
return e.min;
|
|
256
|
-
if (
|
|
261
|
+
if (n === "End")
|
|
257
262
|
return e.max;
|
|
258
|
-
if (
|
|
263
|
+
if (n === "ArrowRight" || n === "ArrowUp")
|
|
259
264
|
return e.step;
|
|
260
|
-
if (
|
|
265
|
+
if (n === "ArrowLeft" || n === "ArrowDown")
|
|
261
266
|
return -e.step;
|
|
262
|
-
},
|
|
263
|
-
if (
|
|
267
|
+
}, I = (t, n) => {
|
|
268
|
+
if (y.value)
|
|
264
269
|
return;
|
|
265
|
-
const
|
|
266
|
-
if (
|
|
270
|
+
const a = te(n);
|
|
271
|
+
if (z(a))
|
|
267
272
|
return;
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
t === "start" ? u.value = e.range ? Math.min(i(
|
|
271
|
-
},
|
|
272
|
-
|
|
273
|
-
},
|
|
274
|
-
|
|
275
|
-
},
|
|
273
|
+
n.preventDefault();
|
|
274
|
+
const r = n.key === "Home" || n.key === "End" ? a : C.plus(t === "start" ? u.value : l.value, a);
|
|
275
|
+
t === "start" ? u.value = e.range ? Math.min(i(r), l.value) : i(r) : l.value = e.range ? Math.max(i(r), u.value) : i(r), m(), s();
|
|
276
|
+
}, ne = (t) => {
|
|
277
|
+
I("start", t);
|
|
278
|
+
}, ae = (t) => {
|
|
279
|
+
I("end", t);
|
|
280
|
+
}, le = c(() => [
|
|
276
281
|
o.block,
|
|
277
|
-
o.modifier(`size-${
|
|
282
|
+
o.modifier(`size-${N.value}`),
|
|
278
283
|
{
|
|
279
284
|
[o.modifier("vertical")]: e.direction === "vertical",
|
|
280
285
|
[o.modifier("with-marks")]: !!e.marks
|
|
281
286
|
}
|
|
282
|
-
]),
|
|
287
|
+
]), ie = c(() => [
|
|
283
288
|
o.element("track"),
|
|
284
289
|
{
|
|
285
|
-
[`${o.element("track")}-disabled`]:
|
|
290
|
+
[`${o.element("track")}-disabled`]: y.value,
|
|
286
291
|
[`${o.element("track")}-vertical`]: e.direction === "vertical"
|
|
287
292
|
}
|
|
288
293
|
]);
|
|
289
294
|
return {
|
|
295
|
+
wrapperAttrs: D,
|
|
296
|
+
controlAttrs: T,
|
|
290
297
|
className: o,
|
|
291
|
-
cls:
|
|
292
|
-
trackCls:
|
|
293
|
-
trackRef:
|
|
294
|
-
computedValue:
|
|
295
|
-
mergedDisabled:
|
|
296
|
-
mergedSize:
|
|
297
|
-
markList:
|
|
298
|
-
getBtnStyle:
|
|
299
|
-
getBarStyle:
|
|
300
|
-
handleClick:
|
|
301
|
-
handleMoveStart:
|
|
302
|
-
handleEndMoving:
|
|
303
|
-
handleMoveEnd:
|
|
304
|
-
handleStartMoving:
|
|
305
|
-
handleStartChange:
|
|
306
|
-
handleEndChange:
|
|
307
|
-
handleStartKeyDown:
|
|
308
|
-
handleEndKeyDown:
|
|
309
|
-
handleFocus:
|
|
310
|
-
handleBlur:
|
|
298
|
+
cls: le,
|
|
299
|
+
trackCls: ie,
|
|
300
|
+
trackRef: f,
|
|
301
|
+
computedValue: b,
|
|
302
|
+
mergedDisabled: y,
|
|
303
|
+
mergedSize: N,
|
|
304
|
+
markList: X,
|
|
305
|
+
getBtnStyle: Y,
|
|
306
|
+
getBarStyle: Q,
|
|
307
|
+
handleClick: J,
|
|
308
|
+
handleMoveStart: Z,
|
|
309
|
+
handleEndMoving: q,
|
|
310
|
+
handleMoveEnd: ee,
|
|
311
|
+
handleStartMoving: p,
|
|
312
|
+
handleStartChange: U,
|
|
313
|
+
handleEndChange: W,
|
|
314
|
+
handleStartKeyDown: ne,
|
|
315
|
+
handleEndKeyDown: ae,
|
|
316
|
+
handleFocus: $,
|
|
317
|
+
handleBlur: G
|
|
311
318
|
};
|
|
312
319
|
}
|
|
313
320
|
});
|
|
314
321
|
export {
|
|
315
|
-
|
|
322
|
+
Te as default
|
|
316
323
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import a from "./slider-button.vue2.js";
|
|
2
|
-
import { resolveComponent as r, openBlock as t, createBlock as s, withCtx as
|
|
2
|
+
import { resolveComponent as r, openBlock as t, createBlock as s, withCtx as d, createElementVNode as u, mergeProps as p, withModifiers as i } from "vue";
|
|
3
3
|
import m from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const v = ["aria-disabled", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"];
|
|
5
|
-
function w(o, n, f, b,
|
|
4
|
+
const v = ["tabindex", "aria-disabled", "aria-valuemax", "aria-valuemin", "aria-valuenow", "aria-valuetext"];
|
|
5
|
+
function w(o, n, f, b, C, B) {
|
|
6
6
|
const l = r("tooltip");
|
|
7
7
|
return t(), s(l, {
|
|
8
8
|
"popup-visible": o.popupVisible,
|
|
9
9
|
position: o.mergedTooltipPosition,
|
|
10
10
|
content: o.tooltipContent
|
|
11
11
|
}, {
|
|
12
|
-
default:
|
|
13
|
-
|
|
14
|
-
tabindex:
|
|
12
|
+
default: d(() => [
|
|
13
|
+
u("div", p(o.formControlAttrs, {
|
|
14
|
+
tabindex: o.disabled ? -1 : 0,
|
|
15
15
|
role: "slider",
|
|
16
16
|
"aria-disabled": o.disabled,
|
|
17
17
|
"aria-valuemax": o.max,
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Tooltip as
|
|
1
|
+
import { defineComponent as M, ref as N, computed as s, onBeforeUnmount as D } from "vue";
|
|
2
|
+
import { Tooltip as F } from "../tooltip/index.js";
|
|
3
3
|
import { off as i, on as l } from "../../_utils/dom.js";
|
|
4
|
-
import { getClassNameMixin as
|
|
5
|
-
|
|
4
|
+
import { getClassNameMixin as S } from "../../_utils/config.js";
|
|
5
|
+
import { useFormItem as k, useFormItemControl as q } from "../../_hooks/use-form-item.js";
|
|
6
|
+
const U = M({
|
|
6
7
|
name: "SliderButton",
|
|
7
8
|
components: {
|
|
8
|
-
Tooltip:
|
|
9
|
+
Tooltip: F
|
|
9
10
|
},
|
|
10
11
|
inheritAttrs: !1,
|
|
11
12
|
props: {
|
|
@@ -38,50 +39,54 @@ const X = x({
|
|
|
38
39
|
}
|
|
39
40
|
},
|
|
40
41
|
emits: ["movestart", "moving", "moveend", "keydown", "focus", "blur"],
|
|
41
|
-
setup(e, { emit: n }) {
|
|
42
|
-
const
|
|
42
|
+
setup(e, { emit: n, attrs: w }) {
|
|
43
|
+
const d = S("slider--btn"), { formItemCtx: h } = k(), v = q(h, () => w, {
|
|
44
|
+
labelable: !1,
|
|
45
|
+
required: !1
|
|
46
|
+
}), r = N(!1), f = () => {
|
|
43
47
|
i(window, "mousemove", u), i(window, "touchmove", u), i(window, "mouseup", t), i(window, "contextmenu", t), i(window, "touchend", t), i(window, "touchcancel", t);
|
|
44
|
-
},
|
|
45
|
-
e.disabled || (o.preventDefault(),
|
|
48
|
+
}, p = (o) => {
|
|
49
|
+
e.disabled || (o.preventDefault(), r.value = !0, l(window, "mousemove", u), l(window, "touchmove", u), l(window, "mouseup", t), l(window, "contextmenu", t), l(window, "touchend", t), l(window, "touchcancel", t), n("movestart"));
|
|
46
50
|
}, u = (o) => {
|
|
47
|
-
let
|
|
51
|
+
let c, a;
|
|
48
52
|
if (o.type.startsWith("touch")) {
|
|
49
|
-
const
|
|
50
|
-
if (!
|
|
53
|
+
const m = o.touches[0];
|
|
54
|
+
if (!m)
|
|
51
55
|
return;
|
|
52
|
-
|
|
56
|
+
a = m.clientY, c = m.clientX;
|
|
53
57
|
} else
|
|
54
|
-
|
|
55
|
-
n("moving",
|
|
58
|
+
a = o.clientY, c = o.clientX;
|
|
59
|
+
n("moving", c, a);
|
|
56
60
|
}, t = () => {
|
|
57
|
-
|
|
58
|
-
},
|
|
61
|
+
r.value = !1, f(), n("moveend");
|
|
62
|
+
}, b = (o) => {
|
|
59
63
|
n("focus", o);
|
|
60
|
-
},
|
|
64
|
+
}, g = (o) => {
|
|
61
65
|
n("blur", o);
|
|
62
|
-
},
|
|
66
|
+
}, y = (o) => {
|
|
63
67
|
e.disabled || n("keydown", o);
|
|
64
|
-
},
|
|
68
|
+
}, x = s(() => [d.block]), C = s(
|
|
65
69
|
() => e.tooltipPosition ?? (e.direction === "vertical" ? "right" : "top")
|
|
66
|
-
),
|
|
70
|
+
), T = s(() => {
|
|
67
71
|
var o;
|
|
68
72
|
return ((o = e.formatTooltip) == null ? void 0 : o.call(e, e.value)) ?? `${e.value}`;
|
|
69
|
-
}),
|
|
70
|
-
() => e.showTooltip ?
|
|
73
|
+
}), B = s(
|
|
74
|
+
() => e.showTooltip ? r.value ? !0 : void 0 : !1
|
|
71
75
|
);
|
|
72
|
-
return
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
return D(f), {
|
|
77
|
+
formControlAttrs: v,
|
|
78
|
+
className: d,
|
|
79
|
+
cls: x,
|
|
80
|
+
tooltipContent: T,
|
|
81
|
+
mergedTooltipPosition: C,
|
|
82
|
+
popupVisible: B,
|
|
83
|
+
handleMouseDown: p,
|
|
84
|
+
handleKeyDown: y,
|
|
85
|
+
handleFocus: b,
|
|
86
|
+
handleBlur: g
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
89
|
});
|
|
85
90
|
export {
|
|
86
|
-
|
|
91
|
+
U as default
|
|
87
92
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import c from "./Switch.vue2.js";
|
|
2
|
-
import { resolveComponent as h, openBlock as l, createElementBlock as
|
|
3
|
-
import
|
|
4
|
-
const
|
|
5
|
-
function
|
|
2
|
+
import { resolveComponent as h, openBlock as l, createElementBlock as m, mergeProps as p, createElementVNode as d, normalizeClass as a, createBlock as u, Fragment as k, renderSlot as s, createTextVNode as r, toDisplayString as t, createCommentVNode as y } from "vue";
|
|
3
|
+
import f from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const C = ["aria-checked", "disabled"];
|
|
5
|
+
function $(e, o, g, w, N, b) {
|
|
6
6
|
const i = h("icon-loading");
|
|
7
|
-
return l(),
|
|
7
|
+
return l(), m("button", p(e.formControlAttrs, {
|
|
8
8
|
type: "button",
|
|
9
9
|
role: "switch",
|
|
10
10
|
"aria-checked": e.computedCheck,
|
|
@@ -23,12 +23,12 @@ function C(e, o, g, w, N, b) {
|
|
|
23
23
|
d("span", {
|
|
24
24
|
class: a(e.className.element("handle-icon"))
|
|
25
25
|
}, [
|
|
26
|
-
e.computedLoading ? (l(), u(i, { key: 0 })) : (l(), k
|
|
26
|
+
e.computedLoading ? (l(), u(i, { key: 0 })) : (l(), m(k, { key: 1 }, [
|
|
27
27
|
e.computedCheck ? s(e.$slots, "checked-icon", { key: 0 }) : s(e.$slots, "unchecked-icon", { key: 1 })
|
|
28
28
|
], 64))
|
|
29
29
|
], 2)
|
|
30
30
|
], 2),
|
|
31
|
-
e.showText ? (l(), k
|
|
31
|
+
e.showText ? (l(), m(k, { key: 0 }, [
|
|
32
32
|
d("span", {
|
|
33
33
|
class: a(e.className.element("text-holder"))
|
|
34
34
|
}, [
|
|
@@ -48,9 +48,9 @@ function C(e, o, g, w, N, b) {
|
|
|
48
48
|
])
|
|
49
49
|
], 2)
|
|
50
50
|
], 64)) : y("", !0)
|
|
51
|
-
], 16,
|
|
51
|
+
], 16, C);
|
|
52
52
|
}
|
|
53
|
-
const S = /* @__PURE__ */
|
|
53
|
+
const S = /* @__PURE__ */ f(c, [["render", $]]);
|
|
54
54
|
export {
|
|
55
55
|
S as default
|
|
56
56
|
};
|