@varlet/ui 2.16.7 → 2.16.8-alpha.1695118057982
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/es/action-sheet/ActionSheet.mjs +97 -67
- package/es/action-sheet/index.mjs +43 -28
- package/es/action-sheet/props.mjs +39 -8
- package/es/app-bar/AppBar.mjs +129 -56
- package/es/app-bar/index.mjs +10 -5
- package/es/app-bar/props.mjs +6 -3
- package/es/avatar/Avatar.mjs +97 -87
- package/es/avatar/index.mjs +10 -5
- package/es/avatar/props.mjs +8 -5
- package/es/avatar-group/AvatarGroup.mjs +26 -20
- package/es/avatar-group/index.mjs +10 -5
- package/es/avatar-group/props.mjs +5 -2
- package/es/back-top/BackTop.mjs +71 -53
- package/es/back-top/index.mjs +10 -5
- package/es/back-top/props.mjs +6 -3
- package/es/badge/Badge.mjs +74 -46
- package/es/badge/index.mjs +10 -5
- package/es/badge/props.mjs +7 -4
- package/es/bottom-navigation/BottomNavigation.mjs +100 -97
- package/es/bottom-navigation/index.mjs +10 -5
- package/es/bottom-navigation/props.mjs +7 -4
- package/es/bottom-navigation/provide.mjs +13 -9
- package/es/bottom-navigation-item/BottomNavigationItem.mjs +93 -74
- package/es/bottom-navigation-item/index.mjs +10 -5
- package/es/bottom-navigation-item/props.mjs +7 -4
- package/es/bottom-navigation-item/provide.mjs +14 -11
- package/es/breadcrumb/Breadcrumb.mjs +51 -36
- package/es/breadcrumb/index.mjs +10 -5
- package/es/breadcrumb/props.mjs +6 -3
- package/es/breadcrumb/provide.mjs +12 -11
- package/es/breadcrumbs/Breadcrumbs.mjs +26 -24
- package/es/breadcrumbs/index.mjs +10 -5
- package/es/breadcrumbs/props.mjs +6 -3
- package/es/breadcrumbs/provide.mjs +11 -9
- package/es/button/Button.mjs +88 -90
- package/es/button/index.mjs +10 -5
- package/es/button/props.mjs +31 -10
- package/es/button/provide.mjs +8 -9
- package/es/button-group/ButtonGroup.mjs +38 -26
- package/es/button-group/index.mjs +8 -4
- package/es/button-group/props.mjs +8 -5
- package/es/button-group/provide.mjs +9 -9
- package/es/card/Card.mjs +292 -189
- package/es/card/index.mjs +10 -5
- package/es/card/props.mjs +9 -6
- package/es/cell/Cell.mjs +96 -52
- package/es/cell/index.mjs +10 -5
- package/es/cell/props.mjs +6 -3
- package/es/checkbox/Checkbox.mjs +136 -130
- package/es/checkbox/index.mjs +10 -5
- package/es/checkbox/props.mjs +9 -6
- package/es/checkbox/provide.mjs +10 -9
- package/es/checkbox-group/CheckboxGroup.mjs +63 -96
- package/es/checkbox-group/index.mjs +10 -5
- package/es/checkbox-group/props.mjs +9 -6
- package/es/checkbox-group/provide.mjs +11 -9
- package/es/chip/Chip.mjs +66 -50
- package/es/chip/index.mjs +10 -5
- package/es/chip/props.mjs +10 -7
- package/es/col/Col.mjs +60 -55
- package/es/col/index.mjs +10 -5
- package/es/col/props.mjs +7 -4
- package/es/col/provide.mjs +8 -9
- package/es/collapse/Collapse.mjs +70 -73
- package/es/collapse/index.mjs +10 -5
- package/es/collapse/props.mjs +7 -4
- package/es/collapse/provide.mjs +11 -9
- package/es/collapse-item/CollapseItem.mjs +156 -93
- package/es/collapse-item/index.mjs +10 -5
- package/es/collapse-item/props.mjs +6 -3
- package/es/collapse-item/provide.mjs +12 -11
- package/es/context/index.mjs +9 -5
- package/es/context/lock.mjs +18 -22
- package/es/context/zIndex.mjs +19 -16
- package/es/countdown/Countdown.mjs +73 -70
- package/es/countdown/index.mjs +10 -5
- package/es/countdown/props.mjs +7 -4
- package/es/counter/Counter.mjs +169 -173
- package/es/counter/index.mjs +10 -5
- package/es/counter/props.mjs +8 -5
- package/es/counter/provide.ts +3 -0
- package/es/date-picker/DatePicker.mjs +411 -304
- package/es/date-picker/index.mjs +10 -5
- package/es/date-picker/props.mjs +71 -45
- package/es/date-picker/src/day-picker-panel.mjs +270 -208
- package/es/date-picker/src/month-picker-panel.mjs +205 -175
- package/es/date-picker/src/panel-header.mjs +101 -83
- package/es/date-picker/src/year-picker-panel.mjs +64 -54
- package/es/dialog/Dialog.mjs +171 -106
- package/es/dialog/index.mjs +49 -33
- package/es/dialog/props.mjs +39 -9
- package/es/divider/Divider.mjs +56 -51
- package/es/divider/index.mjs +10 -5
- package/es/divider/props.mjs +5 -2
- package/es/drag/Drag.mjs +126 -144
- package/es/drag/index.mjs +10 -5
- package/es/drag/props.mjs +8 -5
- package/es/ellipsis/Ellipsis.mjs +81 -50
- package/es/ellipsis/index.mjs +8 -4
- package/es/ellipsis/props.mjs +5 -2
- package/es/fab/Fab.mjs +73 -75
- package/es/fab/index.mjs +8 -4
- package/es/fab/props.mjs +14 -11
- package/es/field-decorator/FieldDecorator.mjs +215 -110
- package/es/field-decorator/props.mjs +9 -6
- package/es/form/Form.mjs +69 -79
- package/es/form/index.mjs +11 -6
- package/es/form/props.mjs +6 -3
- package/es/form/provide.mjs +35 -22
- package/es/form-details/FormDetails.mjs +81 -39
- package/es/form-details/index.mjs +10 -5
- package/es/form-details/props.mjs +7 -4
- package/es/hover/index.mjs +37 -40
- package/es/hover-overlay/HoverOverlay.mjs +18 -14
- package/es/hover-overlay/index.mjs +13 -8
- package/es/hover-overlay/props.mjs +5 -2
- package/es/icon/Icon.mjs +50 -33
- package/es/icon/index.mjs +10 -5
- package/es/icon/props.mjs +7 -4
- package/es/image/Image.mjs +76 -82
- package/es/image/index.mjs +10 -5
- package/es/image/props.mjs +7 -4
- package/es/image-preview/ImagePreview.mjs +176 -193
- package/es/image-preview/index.mjs +44 -30
- package/es/image-preview/props.mjs +34 -9
- package/es/index-anchor/IndexAnchor.mjs +45 -42
- package/es/index-anchor/index.mjs +10 -5
- package/es/index-anchor/props.mjs +5 -2
- package/es/index-anchor/provide.mjs +12 -11
- package/es/index-bar/IndexBar.mjs +130 -131
- package/es/index-bar/index.mjs +10 -5
- package/es/index-bar/props.mjs +6 -3
- package/es/index-bar/provide.mjs +11 -9
- package/es/index.bundle.mjs +1 -1
- package/es/index.mjs +1 -1
- package/es/input/Input.mjs +231 -247
- package/es/input/index.mjs +10 -5
- package/es/input/props.mjs +38 -8
- package/es/input/provide.ts +3 -0
- package/es/lazy/index.mjs +94 -87
- package/es/link/Link.mjs +39 -45
- package/es/link/index.mjs +10 -5
- package/es/link/props.mjs +8 -5
- package/es/list/List.mjs +144 -97
- package/es/list/index.mjs +10 -5
- package/es/list/props.mjs +8 -5
- package/es/list/provide.mjs +8 -9
- package/es/loading/Loading.mjs +165 -72
- package/es/loading/index.mjs +10 -5
- package/es/loading/props.mjs +7 -4
- package/es/loading-bar/LoadingBar.mjs +19 -16
- package/es/loading-bar/index.mjs +37 -30
- package/es/loading-bar/props.mjs +5 -2
- package/es/locale/en-US.mjs +76 -73
- package/es/locale/index.mjs +52 -41
- package/es/locale/zh-CN.mjs +76 -73
- package/es/menu/Menu.mjs +76 -57
- package/es/menu/index.mjs +10 -5
- package/es/menu/props.mjs +11 -8
- package/es/menu/usePopover.mjs +214 -207
- package/es/option/Option.mjs +86 -70
- package/es/option/index.mjs +10 -5
- package/es/option/props.mjs +5 -2
- package/es/option/provide.mjs +10 -11
- package/es/overlay/Overlay.mjs +29 -31
- package/es/overlay/index.mjs +10 -5
- package/es/overlay/props.mjs +7 -4
- package/es/pagination/Pagination.mjs +334 -202
- package/es/pagination/index.mjs +10 -5
- package/es/pagination/props.mjs +8 -5
- package/es/paper/Paper.mjs +43 -31
- package/es/paper/index.mjs +10 -5
- package/es/paper/props.mjs +6 -3
- package/es/picker/Picker.mjs +288 -224
- package/es/picker/index.mjs +24 -23
- package/es/picker/props.mjs +37 -7
- package/es/popup/Popup.mjs +68 -58
- package/es/popup/index.mjs +10 -5
- package/es/popup/props.mjs +9 -6
- package/es/popup/provide.mjs +12 -15
- package/es/progress/Progress.mjs +186 -114
- package/es/progress/index.mjs +10 -5
- package/es/progress/props.mjs +7 -4
- package/es/pull-refresh/PullRefresh.mjs +136 -116
- package/es/pull-refresh/index.mjs +10 -5
- package/es/pull-refresh/props.mjs +8 -5
- package/es/radio/Radio.mjs +122 -118
- package/es/radio/index.mjs +10 -5
- package/es/radio/props.mjs +8 -5
- package/es/radio/provide.mjs +8 -9
- package/es/radio-group/RadioGroup.mjs +50 -58
- package/es/radio-group/index.mjs +10 -5
- package/es/radio-group/props.mjs +10 -7
- package/es/radio-group/provide.mjs +11 -9
- package/es/rate/Rate.mjs +103 -132
- package/es/rate/index.mjs +10 -5
- package/es/rate/props.mjs +10 -7
- package/es/rate/provide.ts +3 -0
- package/es/result/Empty.mjs +21 -12
- package/es/result/Error.mjs +18 -9
- package/es/result/Info.mjs +18 -9
- package/es/result/Question.mjs +18 -9
- package/es/result/Result.mjs +102 -55
- package/es/result/Success.mjs +84 -40
- package/es/result/Warning.mjs +18 -9
- package/es/result/index.mjs +10 -5
- package/es/result/props.mjs +6 -3
- package/es/ripple/index.mjs +89 -101
- package/es/row/Row.mjs +40 -45
- package/es/row/index.mjs +10 -5
- package/es/row/props.mjs +8 -5
- package/es/row/provide.mjs +9 -9
- package/es/select/Select.mjs +308 -298
- package/es/select/index.mjs +10 -5
- package/es/select/props.mjs +40 -10
- package/es/select/provide.mjs +9 -9
- package/es/skeleton/Skeleton.mjs +182 -71
- package/es/skeleton/index.mjs +10 -5
- package/es/skeleton/props.mjs +5 -2
- package/es/slider/Slider.mjs +310 -260
- package/es/slider/index.mjs +10 -5
- package/es/slider/props.mjs +15 -11
- package/es/slider/provide.ts +3 -0
- package/es/snackbar/Snackbar.mjs +47 -34
- package/es/snackbar/core.mjs +140 -77
- package/es/snackbar/index.mjs +111 -97
- package/es/snackbar/props.mjs +35 -14
- package/es/space/Space.mjs +30 -28
- package/es/space/index.mjs +10 -5
- package/es/space/margin.mjs +22 -23
- package/es/space/props.mjs +8 -5
- package/es/step/Step.mjs +96 -74
- package/es/step/index.mjs +10 -5
- package/es/step/props.mjs +6 -3
- package/es/step/provide.mjs +10 -11
- package/es/steps/Steps.mjs +31 -30
- package/es/steps/index.mjs +10 -5
- package/es/steps/props.mjs +7 -4
- package/es/steps/provide.mjs +9 -8
- package/es/sticky/Sticky.mjs +104 -92
- package/es/sticky/index.mjs +10 -5
- package/es/sticky/props.mjs +6 -3
- package/es/style-provider/StyleProvider.mjs +19 -18
- package/es/style-provider/index.mjs +15 -11
- package/es/style-provider/props.mjs +6 -3
- package/es/swipe/Swipe.mjs +281 -268
- package/es/swipe/index.mjs +10 -5
- package/es/swipe/props.mjs +6 -3
- package/es/swipe/provide.mjs +11 -9
- package/es/swipe-item/SwipeItem.mjs +29 -29
- package/es/swipe-item/index.mjs +8 -4
- package/es/swipe-item/provide.mjs +10 -11
- package/es/switch/Switch.mjs +143 -103
- package/es/switch/index.mjs +10 -5
- package/es/switch/props.mjs +7 -4
- package/es/switch/provide.ts +3 -0
- package/es/tab/Tab.mjs +48 -61
- package/es/tab/index.mjs +10 -5
- package/es/tab/props.mjs +6 -3
- package/es/tab/provide.mjs +10 -11
- package/es/tab-item/TabItem.mjs +27 -32
- package/es/tab-item/index.mjs +10 -5
- package/es/tab-item/props.mjs +5 -2
- package/es/tab-item/provide.mjs +17 -18
- package/es/table/Table.mjs +54 -25
- package/es/table/index.mjs +10 -5
- package/es/table/props.mjs +6 -3
- package/es/tabs/Tabs.mjs +162 -134
- package/es/tabs/index.mjs +10 -5
- package/es/tabs/props.mjs +15 -12
- package/es/tabs/provide.mjs +9 -9
- package/es/tabs-items/TabsItems.mjs +61 -65
- package/es/tabs-items/index.mjs +10 -5
- package/es/tabs-items/props.mjs +7 -4
- package/es/tabs-items/provide.mjs +11 -9
- package/es/themes/dark/actionSheet.mjs +8 -5
- package/es/themes/dark/appBar.mjs +6 -3
- package/es/themes/dark/avatar.mjs +7 -4
- package/es/themes/dark/badge.mjs +6 -3
- package/es/themes/dark/bottomNavigation.mjs +7 -4
- package/es/themes/dark/bottomNavigationItem.mjs +6 -3
- package/es/themes/dark/breadcrumb.mjs +6 -3
- package/es/themes/dark/button.mjs +7 -4
- package/es/themes/dark/card.mjs +10 -7
- package/es/themes/dark/cell.mjs +7 -4
- package/es/themes/dark/checkbox.mjs +7 -4
- package/es/themes/dark/chip.mjs +7 -4
- package/es/themes/dark/collapse.mjs +8 -5
- package/es/themes/dark/countdown.mjs +6 -3
- package/es/themes/dark/datePicker.mjs +10 -7
- package/es/themes/dark/dialog.mjs +8 -5
- package/es/themes/dark/divider.mjs +7 -4
- package/es/themes/dark/fieldDecorator.mjs +7 -4
- package/es/themes/dark/index.mjs +69 -51
- package/es/themes/dark/link.mjs +6 -3
- package/es/themes/dark/menu.mjs +6 -3
- package/es/themes/dark/option.mjs +6 -3
- package/es/themes/dark/pagination.mjs +11 -8
- package/es/themes/dark/paper.mjs +6 -3
- package/es/themes/dark/picker.mjs +11 -8
- package/es/themes/dark/popup.mjs +6 -3
- package/es/themes/dark/progress.mjs +6 -3
- package/es/themes/dark/pullRefresh.mjs +6 -3
- package/es/themes/dark/radio.mjs +7 -4
- package/es/themes/dark/result.mjs +12 -9
- package/es/themes/dark/select.mjs +6 -3
- package/es/themes/dark/skeleton.mjs +11 -6
- package/es/themes/dark/steps.mjs +8 -5
- package/es/themes/dark/switch.mjs +7 -4
- package/es/themes/dark/tab.mjs +6 -3
- package/es/themes/dark/table.mjs +12 -9
- package/es/themes/dark/tabs.mjs +6 -3
- package/es/themes/dark/timePicker.mjs +9 -6
- package/es/themes/dark/uploader.mjs +10 -7
- package/es/themes/dark/watermark.mjs +6 -3
- package/es/themes/index.mjs +7 -5
- package/es/time-picker/TimePicker.mjs +297 -232
- package/es/time-picker/clock.mjs +222 -172
- package/es/time-picker/index.mjs +10 -5
- package/es/time-picker/props.mjs +14 -8
- package/es/time-picker/utils.mjs +46 -86
- package/es/tooltip/Tooltip.mjs +82 -62
- package/es/tooltip/index.mjs +10 -5
- package/es/tooltip/props.mjs +12 -9
- package/es/uploader/Uploader.mjs +315 -308
- package/es/uploader/index.mjs +10 -5
- package/es/uploader/props.mjs +10 -7
- package/es/uploader/provide.ts +3 -0
- package/es/utils/components.mjs +158 -127
- package/es/utils/elements.mjs +106 -123
- package/es/utils/logger.mjs +9 -5
- package/es/utils/shared.mjs +25 -23
- package/es/utils/test.mjs +105 -93
- package/es/varlet.esm.js +12464 -13425
- package/es/watermark/Watermark.mjs +191 -109
- package/es/watermark/index.mjs +8 -4
- package/es/watermark/props.mjs +8 -5
- package/highlight/web-types.en-US.json +3 -3
- package/highlight/web-types.zh-CN.json +2 -2
- package/lib/varlet.cjs.js +9187 -10199
- package/package.json +7 -7
- package/umd/varlet.js +4 -4
- package/es/counter/provide.mjs +0 -1
- package/es/input/provide.mjs +0 -1
- package/es/rate/provide.mjs +0 -1
- package/es/slider/provide.mjs +0 -1
- package/es/switch/provide.mjs +0 -1
- package/es/uploader/provide.mjs +0 -1
package/es/slider/Slider.mjs
CHANGED
|
@@ -1,196 +1,260 @@
|
|
|
1
|
-
import VarFormDetails from
|
|
2
|
-
import VarHoverOverlay, { useHoverOverlay } from
|
|
3
|
-
import Hover from
|
|
4
|
-
import { defineComponent, ref, onBeforeUnmount, computed, reactive, nextTick, watch, unref } from
|
|
5
|
-
import { useValidation, createNamespace, call } from
|
|
6
|
-
import { useForm } from
|
|
7
|
-
import { getLeft, multiplySizeUnit } from
|
|
8
|
-
import { warn } from
|
|
9
|
-
import { isArray, isNumber, toNumber, getRect } from
|
|
10
|
-
import { props, Thumbs } from
|
|
11
|
-
import { onSmartMounted } from
|
|
12
|
-
|
|
13
|
-
name,
|
|
14
|
-
n,
|
|
15
|
-
classes
|
|
16
|
-
} = createNamespace('slider');
|
|
1
|
+
import VarFormDetails from "../form-details/index.mjs";
|
|
2
|
+
import VarHoverOverlay, { useHoverOverlay } from "../hover-overlay/index.mjs";
|
|
3
|
+
import Hover from "../hover/index.mjs";
|
|
4
|
+
import { defineComponent, ref, onBeforeUnmount, computed, reactive, nextTick, watch, unref } from "vue";
|
|
5
|
+
import { useValidation, createNamespace, call } from "../utils/components.mjs";
|
|
6
|
+
import { useForm } from "../form/provide.mjs";
|
|
7
|
+
import { getLeft, multiplySizeUnit } from "../utils/elements.mjs";
|
|
8
|
+
import { warn } from "../utils/logger.mjs";
|
|
9
|
+
import { isArray, isNumber, toNumber, getRect } from "@varlet/shared";
|
|
10
|
+
import { props, Thumbs } from "./props.mjs";
|
|
11
|
+
import { onSmartMounted } from "@varlet/use";
|
|
12
|
+
const { name, n, classes } = createNamespace("slider");
|
|
17
13
|
import { normalizeClass as _normalizeClass, normalizeStyle as _normalizeStyle, createElementVNode as _createElementVNode, renderList as _renderList, Fragment as _Fragment, openBlock as _openBlock, createElementBlock as _createElementBlock, renderSlot as _renderSlot, resolveDirective as _resolveDirective, withDirectives as _withDirectives, resolveComponent as _resolveComponent, createVNode as _createVNode, toDisplayString as _toDisplayString, withModifiers as _withModifiers, pushScopeId as _pushScopeId, popScopeId as _popScopeId } from "vue";
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
const _withScopeId = (n2) => (_pushScopeId(""), n2 = n2(), _popScopeId(), n2);
|
|
15
|
+
const _hoisted_1 = ["onTouchstart"];
|
|
20
16
|
function __render__(_ctx, _cache) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return _openBlock(), _createElementBlock(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
17
|
+
const _component_var_hover_overlay = _resolveComponent("var-hover-overlay");
|
|
18
|
+
const _component_var_form_details = _resolveComponent("var-form-details");
|
|
19
|
+
const _directive_hover = _resolveDirective("hover");
|
|
20
|
+
return _openBlock(), _createElementBlock(
|
|
21
|
+
"div",
|
|
22
|
+
{
|
|
23
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(_ctx.direction), _ctx.n("$--box")))
|
|
24
|
+
},
|
|
25
|
+
[
|
|
26
|
+
_createElementVNode(
|
|
27
|
+
"div",
|
|
28
|
+
{
|
|
29
|
+
class: _normalizeClass(_ctx.classes(_ctx.n(`${_ctx.direction}-block`), [_ctx.isDisabled, _ctx.n("--disabled")], [_ctx.errorMessage, _ctx.n(`${_ctx.direction}--error`)])),
|
|
30
|
+
ref: "sliderEl",
|
|
31
|
+
onClick: _cache[0] || (_cache[0] = (...args) => _ctx.click && _ctx.click(...args))
|
|
32
|
+
},
|
|
33
|
+
[
|
|
34
|
+
_createElementVNode(
|
|
35
|
+
"div",
|
|
36
|
+
{
|
|
37
|
+
class: _normalizeClass(_ctx.n(`${_ctx.direction}-track`))
|
|
38
|
+
},
|
|
39
|
+
[
|
|
40
|
+
_createElementVNode(
|
|
41
|
+
"div",
|
|
42
|
+
{
|
|
43
|
+
class: _normalizeClass(_ctx.n(`${_ctx.direction}-track-background`)),
|
|
44
|
+
style: _normalizeStyle({
|
|
45
|
+
background: _ctx.trackColor,
|
|
46
|
+
height: _ctx.isVertical ? "100%" : _ctx.multiplySizeUnit(_ctx.trackHeight),
|
|
47
|
+
width: _ctx.isVertical ? _ctx.multiplySizeUnit(_ctx.trackHeight) : "100%"
|
|
48
|
+
})
|
|
49
|
+
},
|
|
50
|
+
null,
|
|
51
|
+
6
|
|
52
|
+
/* CLASS, STYLE */
|
|
53
|
+
),
|
|
54
|
+
_createElementVNode(
|
|
55
|
+
"div",
|
|
56
|
+
{
|
|
57
|
+
class: _normalizeClass(_ctx.n(`${_ctx.direction}-track-fill`)),
|
|
58
|
+
style: _normalizeStyle(_ctx.getFillStyle)
|
|
59
|
+
},
|
|
60
|
+
null,
|
|
61
|
+
6
|
|
62
|
+
/* CLASS, STYLE */
|
|
63
|
+
)
|
|
64
|
+
],
|
|
65
|
+
2
|
|
66
|
+
/* CLASS */
|
|
67
|
+
),
|
|
68
|
+
(_openBlock(true), _createElementBlock(
|
|
69
|
+
_Fragment,
|
|
70
|
+
null,
|
|
71
|
+
_renderList(_ctx.thumbList, (item) => {
|
|
72
|
+
return _openBlock(), _createElementBlock("div", {
|
|
73
|
+
class: _normalizeClass(_ctx.n(`${_ctx.direction}-thumb`)),
|
|
74
|
+
key: item.enumValue,
|
|
75
|
+
style: _normalizeStyle(_ctx.thumbStyle(item)),
|
|
76
|
+
onTouchstart: _withModifiers(($event) => _ctx.start($event, item.enumValue), ["stop"])
|
|
77
|
+
}, [
|
|
78
|
+
_renderSlot(_ctx.$slots, "button", {
|
|
79
|
+
currentValue: item.text
|
|
80
|
+
}, () => [
|
|
81
|
+
_withDirectives(_createElementVNode(
|
|
82
|
+
"div",
|
|
83
|
+
{
|
|
84
|
+
class: _normalizeClass(_ctx.n(`${_ctx.direction}-thumb-block`)),
|
|
85
|
+
style: _normalizeStyle({
|
|
86
|
+
background: _ctx.thumbColor
|
|
87
|
+
})
|
|
88
|
+
},
|
|
89
|
+
null,
|
|
90
|
+
6
|
|
91
|
+
/* CLASS, STYLE */
|
|
92
|
+
), [
|
|
93
|
+
[_directive_hover, (value) => _ctx.hover(value, item), "desktop"]
|
|
94
|
+
]),
|
|
95
|
+
_createElementVNode(
|
|
96
|
+
"div",
|
|
97
|
+
{
|
|
98
|
+
class: _normalizeClass(
|
|
99
|
+
_ctx.classes(_ctx.n(`${_ctx.direction}-thumb-ripple`), [
|
|
100
|
+
_ctx.thumbsProps[item.enumValue].active,
|
|
101
|
+
_ctx.n(`${_ctx.direction}-thumb-ripple--active`)
|
|
102
|
+
])
|
|
103
|
+
),
|
|
104
|
+
style: _normalizeStyle({
|
|
105
|
+
background: _ctx.thumbsProps[item.enumValue].active ? _ctx.thumbColor : void 0
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
[
|
|
109
|
+
_createVNode(_component_var_hover_overlay, {
|
|
110
|
+
hovering: item.hovering
|
|
111
|
+
}, null, 8, ["hovering"])
|
|
112
|
+
],
|
|
113
|
+
6
|
|
114
|
+
/* CLASS, STYLE */
|
|
115
|
+
),
|
|
116
|
+
_createElementVNode(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
class: _normalizeClass(
|
|
120
|
+
_ctx.classes(_ctx.n(`${_ctx.direction}-thumb-label`), [_ctx.showLabel(item.enumValue), _ctx.n(`${_ctx.direction}-thumb-label--active`)])
|
|
121
|
+
),
|
|
122
|
+
style: _normalizeStyle({
|
|
123
|
+
background: _ctx.labelColor,
|
|
124
|
+
color: _ctx.labelTextColor,
|
|
125
|
+
height: _ctx.thumbSize === void 0 ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2),
|
|
126
|
+
width: _ctx.thumbSize === void 0 ? _ctx.thumbSize : _ctx.multiplySizeUnit(_ctx.thumbSize, 2)
|
|
127
|
+
})
|
|
128
|
+
},
|
|
129
|
+
[
|
|
130
|
+
_createElementVNode(
|
|
131
|
+
"span",
|
|
132
|
+
null,
|
|
133
|
+
_toDisplayString(item.text),
|
|
134
|
+
1
|
|
135
|
+
/* TEXT */
|
|
136
|
+
)
|
|
137
|
+
],
|
|
138
|
+
6
|
|
139
|
+
/* CLASS, STYLE */
|
|
140
|
+
)
|
|
141
|
+
])
|
|
142
|
+
], 46, _hoisted_1);
|
|
143
|
+
}),
|
|
144
|
+
128
|
|
145
|
+
/* KEYED_FRAGMENT */
|
|
146
|
+
))
|
|
147
|
+
],
|
|
148
|
+
2
|
|
149
|
+
/* CLASS */
|
|
150
|
+
),
|
|
151
|
+
_createVNode(_component_var_form_details, {
|
|
152
|
+
"error-message": _ctx.errorMessage,
|
|
153
|
+
class: _normalizeClass(_ctx.n("form")),
|
|
154
|
+
"var-slider-cover": ""
|
|
155
|
+
}, null, 8, ["error-message", "class"])
|
|
156
|
+
],
|
|
157
|
+
2
|
|
158
|
+
/* CLASS */
|
|
159
|
+
);
|
|
78
160
|
}
|
|
79
|
-
|
|
80
|
-
var __sfc__ = defineComponent({
|
|
161
|
+
const __sfc__ = defineComponent({
|
|
81
162
|
name,
|
|
82
163
|
components: {
|
|
83
164
|
VarFormDetails,
|
|
84
165
|
VarHoverOverlay
|
|
85
166
|
},
|
|
86
|
-
directives: {
|
|
87
|
-
Hover
|
|
88
|
-
},
|
|
167
|
+
directives: { Hover },
|
|
89
168
|
props,
|
|
90
|
-
setup(
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
} =
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
validate: v,
|
|
107
|
-
resetValidation
|
|
108
|
-
} = useValidation();
|
|
109
|
-
var {
|
|
110
|
-
hovering: hoveringFirst,
|
|
111
|
-
handleHovering: handleHoveringFirst
|
|
112
|
-
} = useHoverOverlay();
|
|
113
|
-
var {
|
|
114
|
-
hovering: hoveringSecond,
|
|
115
|
-
handleHovering: handleHoveringSecond
|
|
116
|
-
} = useHoverOverlay();
|
|
117
|
-
var thumbList = computed(() => {
|
|
118
|
-
var {
|
|
119
|
-
modelValue,
|
|
120
|
-
range
|
|
121
|
-
} = props;
|
|
122
|
-
var list = [];
|
|
169
|
+
setup(props2) {
|
|
170
|
+
const maxDistance = ref(0);
|
|
171
|
+
const sliderEl = ref(null);
|
|
172
|
+
const isScroll = ref(false);
|
|
173
|
+
const scope = computed(() => toNumber(props2.max) - toNumber(props2.min));
|
|
174
|
+
const unitWidth = computed(() => maxDistance.value / scope.value * toNumber(props2.step));
|
|
175
|
+
const isDisabled = computed(() => props2.disabled || (form == null ? void 0 : form.disabled.value));
|
|
176
|
+
const isReadonly = computed(() => props2.readonly || (form == null ? void 0 : form.readonly.value));
|
|
177
|
+
const isVertical = computed(() => props2.direction === "vertical");
|
|
178
|
+
const { bindForm, form } = useForm();
|
|
179
|
+
const { errorMessage, validateWithTrigger: vt, validate: v, resetValidation } = useValidation();
|
|
180
|
+
const { hovering: hoveringFirst, handleHovering: handleHoveringFirst } = useHoverOverlay();
|
|
181
|
+
const { hovering: hoveringSecond, handleHovering: handleHoveringSecond } = useHoverOverlay();
|
|
182
|
+
const thumbList = computed(() => {
|
|
183
|
+
const { modelValue, range } = props2;
|
|
184
|
+
let list = [];
|
|
123
185
|
if (range && isArray(modelValue)) {
|
|
124
|
-
list = [
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
186
|
+
list = [
|
|
187
|
+
{
|
|
188
|
+
value: getValue(modelValue[0]),
|
|
189
|
+
enumValue: Thumbs.First,
|
|
190
|
+
text: toPrecision(modelValue[0]),
|
|
191
|
+
hovering: unref(hoveringFirst),
|
|
192
|
+
handleHovering: handleHoveringFirst
|
|
193
|
+
},
|
|
194
|
+
{
|
|
195
|
+
value: getValue(modelValue[1]),
|
|
196
|
+
enumValue: Thumbs.Second,
|
|
197
|
+
text: toPrecision(modelValue[1]),
|
|
198
|
+
hovering: unref(hoveringSecond),
|
|
199
|
+
handleHovering: handleHoveringSecond
|
|
200
|
+
}
|
|
201
|
+
];
|
|
137
202
|
} else if (isNumber(modelValue)) {
|
|
138
|
-
list = [
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
203
|
+
list = [
|
|
204
|
+
{
|
|
205
|
+
value: getValue(modelValue),
|
|
206
|
+
enumValue: Thumbs.First,
|
|
207
|
+
text: toPrecision(modelValue),
|
|
208
|
+
hovering: unref(hoveringFirst),
|
|
209
|
+
handleHovering: handleHoveringFirst
|
|
210
|
+
}
|
|
211
|
+
];
|
|
145
212
|
}
|
|
146
213
|
return list;
|
|
147
214
|
});
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
modelValue
|
|
153
|
-
} = props;
|
|
154
|
-
var gap = range && isArray(modelValue) ? getValue(Math.min(modelValue[0], modelValue[1])) : 0;
|
|
155
|
-
var fillLength = range && isArray(modelValue) ? getValue(Math.max(modelValue[0], modelValue[1])) - gap : getValue(modelValue);
|
|
215
|
+
const getFillStyle = computed(() => {
|
|
216
|
+
const { activeColor, range, modelValue } = props2;
|
|
217
|
+
const gap = range && isArray(modelValue) ? getValue(Math.min(modelValue[0], modelValue[1])) : 0;
|
|
218
|
+
const fillLength = range && isArray(modelValue) ? getValue(Math.max(modelValue[0], modelValue[1])) - gap : getValue(modelValue);
|
|
156
219
|
return isVertical.value ? {
|
|
157
|
-
left:
|
|
158
|
-
height: fillLength
|
|
159
|
-
bottom: gap
|
|
220
|
+
left: "0px",
|
|
221
|
+
height: `${fillLength}%`,
|
|
222
|
+
bottom: `${gap}%`,
|
|
160
223
|
background: activeColor
|
|
161
224
|
} : {
|
|
162
|
-
top:
|
|
163
|
-
width: fillLength
|
|
164
|
-
left: gap
|
|
225
|
+
top: "0px",
|
|
226
|
+
width: `${fillLength}%`,
|
|
227
|
+
left: `${gap}%`,
|
|
165
228
|
background: activeColor
|
|
166
229
|
};
|
|
167
230
|
});
|
|
168
|
-
|
|
231
|
+
const thumbsProps = reactive({
|
|
169
232
|
[Thumbs.First]: getThumbProps(),
|
|
170
233
|
[Thumbs.Second]: getThumbProps()
|
|
171
234
|
});
|
|
172
|
-
|
|
173
|
-
|
|
235
|
+
let activeThumb;
|
|
236
|
+
const sliderProvider = {
|
|
174
237
|
reset,
|
|
175
238
|
validate,
|
|
176
239
|
resetValidation
|
|
177
240
|
};
|
|
178
241
|
call(bindForm, sliderProvider);
|
|
179
|
-
watch([() =>
|
|
180
|
-
|
|
181
|
-
|
|
242
|
+
watch([() => props2.modelValue, () => props2.step], ([modelValue, step]) => {
|
|
243
|
+
if (!stepValidator() || !valueValidator() || isScroll.value)
|
|
244
|
+
return;
|
|
182
245
|
setProps(modelValue, toNumber(step));
|
|
183
246
|
});
|
|
184
247
|
watch(maxDistance, () => setProps());
|
|
185
248
|
onSmartMounted(() => {
|
|
186
|
-
if (!stepValidator() || !valueValidator())
|
|
187
|
-
|
|
249
|
+
if (!stepValidator() || !valueValidator())
|
|
250
|
+
return;
|
|
251
|
+
maxDistance.value = sliderEl.value[isVertical.value ? "offsetHeight" : "offsetWidth"];
|
|
188
252
|
});
|
|
189
253
|
onBeforeUnmount(() => {
|
|
190
254
|
removeDocumentEvents();
|
|
191
255
|
});
|
|
192
256
|
function validate() {
|
|
193
|
-
return v(
|
|
257
|
+
return v(props2.rules, props2.modelValue);
|
|
194
258
|
}
|
|
195
259
|
function getThumbProps() {
|
|
196
260
|
return {
|
|
@@ -201,140 +265,131 @@ var __sfc__ = defineComponent({
|
|
|
201
265
|
};
|
|
202
266
|
}
|
|
203
267
|
function validateWithTrigger() {
|
|
204
|
-
return nextTick(() => vt([
|
|
268
|
+
return nextTick(() => vt(["onChange"], "onChange", props2.rules, props2.modelValue));
|
|
205
269
|
}
|
|
206
270
|
function getOffset(e) {
|
|
207
|
-
|
|
208
|
-
if (!currentTarget)
|
|
271
|
+
const currentTarget = e.currentTarget;
|
|
272
|
+
if (!currentTarget)
|
|
273
|
+
return 0;
|
|
209
274
|
if (!isVertical.value) {
|
|
210
275
|
return e.clientX - getLeft(currentTarget);
|
|
211
276
|
}
|
|
212
277
|
return maxDistance.value - (e.clientY - getRect(currentTarget).top);
|
|
213
278
|
}
|
|
214
279
|
function thumbStyle(thumb) {
|
|
215
|
-
|
|
280
|
+
const key = isVertical.value ? "bottom" : "left";
|
|
216
281
|
return {
|
|
217
|
-
[key]: thumb.value
|
|
218
|
-
zIndex: thumbsProps[thumb.enumValue].active ? 1 :
|
|
282
|
+
[key]: `${thumb.value}%`,
|
|
283
|
+
zIndex: thumbsProps[thumb.enumValue].active ? 1 : void 0
|
|
219
284
|
};
|
|
220
285
|
}
|
|
221
286
|
function showLabel(type) {
|
|
222
|
-
if (
|
|
223
|
-
|
|
287
|
+
if (props2.labelVisible === "always")
|
|
288
|
+
return true;
|
|
289
|
+
if (props2.labelVisible === "never")
|
|
290
|
+
return false;
|
|
224
291
|
return thumbsProps[type].active;
|
|
225
292
|
}
|
|
226
293
|
function getValue(value) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
if (value > toNumber(max)) return 100;
|
|
294
|
+
const { min, max } = props2;
|
|
295
|
+
if (value < toNumber(min))
|
|
296
|
+
return 0;
|
|
297
|
+
if (value > toNumber(max))
|
|
298
|
+
return 100;
|
|
233
299
|
return (value - toNumber(min)) / scope.value * 100;
|
|
234
300
|
}
|
|
235
301
|
function toPrecision(value) {
|
|
236
|
-
if (!isNumber(value))
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (num
|
|
240
|
-
|
|
302
|
+
if (!isNumber(value))
|
|
303
|
+
return 0;
|
|
304
|
+
let num = value;
|
|
305
|
+
if (num < Number(props2.min))
|
|
306
|
+
num = Number(props2.min);
|
|
307
|
+
if (num > Number(props2.max))
|
|
308
|
+
num = Number(props2.max);
|
|
309
|
+
const isInteger = parseInt(`${num}`, 10) === num;
|
|
241
310
|
return isInteger ? num : toNumber(num.toPrecision(5));
|
|
242
311
|
}
|
|
243
312
|
function hover(value, item) {
|
|
244
|
-
if (isDisabled.value)
|
|
313
|
+
if (isDisabled.value)
|
|
314
|
+
return;
|
|
245
315
|
item.handleHovering(value);
|
|
246
316
|
}
|
|
247
317
|
function setPercent(moveDistance, type) {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
min
|
|
255
|
-
} = props;
|
|
256
|
-
var stepNumber = toNumber(step);
|
|
257
|
-
var roundDistance = Math.round(moveDistance / unitWidth.value);
|
|
258
|
-
var curValue = roundDistance * stepNumber + toNumber(min);
|
|
259
|
-
var prevValue = thumbsProps[type].percentValue * stepNumber + toNumber(min);
|
|
318
|
+
let rangeValue = [];
|
|
319
|
+
const { step, range, modelValue, onChange, min } = props2;
|
|
320
|
+
const stepNumber = toNumber(step);
|
|
321
|
+
const roundDistance = Math.round(moveDistance / unitWidth.value);
|
|
322
|
+
const curValue = roundDistance * stepNumber + toNumber(min);
|
|
323
|
+
const prevValue = thumbsProps[type].percentValue * stepNumber + toNumber(min);
|
|
260
324
|
thumbsProps[type].percentValue = roundDistance;
|
|
261
325
|
if (range && isArray(modelValue)) {
|
|
262
326
|
rangeValue = type === Thumbs.First ? [curValue, modelValue[1]] : [modelValue[0], curValue];
|
|
263
327
|
}
|
|
264
328
|
if (prevValue !== curValue) {
|
|
265
|
-
|
|
329
|
+
const value = range ? rangeValue.map((value2) => toPrecision(value2)) : toPrecision(curValue);
|
|
266
330
|
call(onChange, value);
|
|
267
|
-
call(
|
|
331
|
+
call(props2["onUpdate:modelValue"], value);
|
|
268
332
|
validateWithTrigger();
|
|
269
333
|
}
|
|
270
334
|
}
|
|
271
335
|
function getType(offset) {
|
|
272
|
-
if (!
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
336
|
+
if (!props2.range)
|
|
337
|
+
return Thumbs.First;
|
|
338
|
+
const thumb1Distance = thumbsProps[Thumbs.First].percentValue * unitWidth.value;
|
|
339
|
+
const thumb2Distance = thumbsProps[Thumbs.Second].percentValue * unitWidth.value;
|
|
340
|
+
const offsetToThumb1 = Math.abs(offset - thumb1Distance);
|
|
341
|
+
const offsetToThumb2 = Math.abs(offset - thumb2Distance);
|
|
277
342
|
return offsetToThumb1 <= offsetToThumb2 ? Thumbs.First : Thumbs.Second;
|
|
278
343
|
}
|
|
279
344
|
function addDocumentEvents() {
|
|
280
|
-
document.addEventListener(
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
document.addEventListener('touchend', end);
|
|
284
|
-
document.addEventListener('touchcancel', end);
|
|
345
|
+
document.addEventListener("touchmove", move, { passive: false });
|
|
346
|
+
document.addEventListener("touchend", end);
|
|
347
|
+
document.addEventListener("touchcancel", end);
|
|
285
348
|
}
|
|
286
349
|
function removeDocumentEvents() {
|
|
287
|
-
document.removeEventListener(
|
|
288
|
-
document.removeEventListener(
|
|
289
|
-
document.removeEventListener(
|
|
350
|
+
document.removeEventListener("touchmove", move);
|
|
351
|
+
document.removeEventListener("touchend", end);
|
|
352
|
+
document.removeEventListener("touchcancel", end);
|
|
290
353
|
}
|
|
291
354
|
function start(event, type) {
|
|
292
|
-
if (!maxDistance.value)
|
|
355
|
+
if (!maxDistance.value)
|
|
356
|
+
maxDistance.value = sliderEl.value.offsetWidth;
|
|
293
357
|
if (!isDisabled.value) {
|
|
294
358
|
thumbsProps[type].active = true;
|
|
295
359
|
}
|
|
296
360
|
activeThumb = type;
|
|
297
361
|
addDocumentEvents();
|
|
298
|
-
if (isDisabled.value || isReadonly.value)
|
|
299
|
-
|
|
362
|
+
if (isDisabled.value || isReadonly.value)
|
|
363
|
+
return;
|
|
364
|
+
call(props2.onStart);
|
|
300
365
|
isScroll.value = true;
|
|
301
|
-
|
|
302
|
-
clientX,
|
|
303
|
-
clientY
|
|
304
|
-
} = event.touches[0];
|
|
366
|
+
const { clientX, clientY } = event.touches[0];
|
|
305
367
|
thumbsProps[type].startPosition = isVertical.value ? clientY : clientX;
|
|
306
368
|
}
|
|
307
369
|
function move(event) {
|
|
308
370
|
event.preventDefault();
|
|
309
|
-
if (isDisabled.value || isReadonly.value || !isScroll.value)
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
var moveDistance = (isVertical.value ? startPosition - clientY : clientX - startPosition) + currentOffset;
|
|
319
|
-
if (moveDistance <= 0) moveDistance = 0;else if (moveDistance >= maxDistance.value) moveDistance = maxDistance.value;
|
|
371
|
+
if (isDisabled.value || isReadonly.value || !isScroll.value)
|
|
372
|
+
return;
|
|
373
|
+
const { startPosition, currentOffset } = thumbsProps[activeThumb];
|
|
374
|
+
const { clientX, clientY } = event.touches[0];
|
|
375
|
+
let moveDistance = (isVertical.value ? startPosition - clientY : clientX - startPosition) + currentOffset;
|
|
376
|
+
if (moveDistance <= 0)
|
|
377
|
+
moveDistance = 0;
|
|
378
|
+
else if (moveDistance >= maxDistance.value)
|
|
379
|
+
moveDistance = maxDistance.value;
|
|
320
380
|
setPercent(moveDistance, activeThumb);
|
|
321
381
|
}
|
|
322
382
|
function end() {
|
|
323
383
|
removeDocumentEvents();
|
|
324
|
-
|
|
325
|
-
range,
|
|
326
|
-
modelValue,
|
|
327
|
-
onEnd,
|
|
328
|
-
step,
|
|
329
|
-
min
|
|
330
|
-
} = props;
|
|
384
|
+
const { range, modelValue, onEnd, step, min } = props2;
|
|
331
385
|
if (!isDisabled.value) {
|
|
332
386
|
thumbsProps[activeThumb].active = false;
|
|
333
387
|
}
|
|
334
|
-
if (isDisabled.value || isReadonly.value)
|
|
335
|
-
|
|
388
|
+
if (isDisabled.value || isReadonly.value)
|
|
389
|
+
return;
|
|
390
|
+
let rangeValue = [];
|
|
336
391
|
thumbsProps[activeThumb].currentOffset = thumbsProps[activeThumb].percentValue * unitWidth.value;
|
|
337
|
-
|
|
392
|
+
const curValue = thumbsProps[activeThumb].percentValue * toNumber(step) + toNumber(min);
|
|
338
393
|
if (range && isArray(modelValue)) {
|
|
339
394
|
rangeValue = activeThumb === Thumbs.First ? [curValue, modelValue[1]] : [modelValue[0], curValue];
|
|
340
395
|
}
|
|
@@ -342,31 +397,30 @@ var __sfc__ = defineComponent({
|
|
|
342
397
|
isScroll.value = false;
|
|
343
398
|
}
|
|
344
399
|
function click(event) {
|
|
345
|
-
if (isDisabled.value || isReadonly.value)
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
400
|
+
if (isDisabled.value || isReadonly.value)
|
|
401
|
+
return;
|
|
402
|
+
if (event.target.closest(`.${n("thumb")}`))
|
|
403
|
+
return;
|
|
404
|
+
const offset = getOffset(event);
|
|
405
|
+
const type = getType(offset);
|
|
349
406
|
activeThumb = type;
|
|
350
407
|
setPercent(offset, type);
|
|
351
408
|
end();
|
|
352
409
|
}
|
|
353
410
|
function stepValidator() {
|
|
354
|
-
|
|
411
|
+
const stepNumber = toNumber(props2.step);
|
|
355
412
|
if (isNaN(stepNumber)) {
|
|
356
|
-
warn(
|
|
413
|
+
warn("Slider", 'type of prop "step" should be Number');
|
|
357
414
|
return false;
|
|
358
415
|
}
|
|
359
416
|
if (stepNumber < 0) {
|
|
360
|
-
warn(
|
|
417
|
+
warn("Slider", '"step" should be > 0');
|
|
361
418
|
return false;
|
|
362
419
|
}
|
|
363
420
|
return true;
|
|
364
421
|
}
|
|
365
422
|
function valueValidator() {
|
|
366
|
-
|
|
367
|
-
range,
|
|
368
|
-
modelValue
|
|
369
|
-
} = props;
|
|
423
|
+
const { range, modelValue } = props2;
|
|
370
424
|
if (range && !isArray(modelValue)) {
|
|
371
425
|
console.error('[Varlet] Slider: "modelValue" should be an Array');
|
|
372
426
|
return false;
|
|
@@ -381,23 +435,16 @@ var __sfc__ = defineComponent({
|
|
|
381
435
|
}
|
|
382
436
|
return true;
|
|
383
437
|
}
|
|
384
|
-
function setProps(modelValue, step) {
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
var getPercent = value => {
|
|
392
|
-
var {
|
|
393
|
-
min,
|
|
394
|
-
max
|
|
395
|
-
} = props;
|
|
396
|
-
if (value < toNumber(min)) return 0;
|
|
397
|
-
if (value > toNumber(max)) return scope.value / step;
|
|
438
|
+
function setProps(modelValue = props2.modelValue, step = toNumber(props2.step)) {
|
|
439
|
+
const getPercent = (value) => {
|
|
440
|
+
const { min, max } = props2;
|
|
441
|
+
if (value < toNumber(min))
|
|
442
|
+
return 0;
|
|
443
|
+
if (value > toNumber(max))
|
|
444
|
+
return scope.value / step;
|
|
398
445
|
return (value - toNumber(min)) / step;
|
|
399
446
|
};
|
|
400
|
-
if (
|
|
447
|
+
if (props2.range && isArray(modelValue)) {
|
|
401
448
|
thumbsProps[Thumbs.First].percentValue = getPercent(modelValue[0]);
|
|
402
449
|
thumbsProps[Thumbs.First].currentOffset = thumbsProps[Thumbs.First].percentValue * unitWidth.value;
|
|
403
450
|
thumbsProps[Thumbs.Second].percentValue = getPercent(modelValue[1]);
|
|
@@ -407,8 +454,8 @@ var __sfc__ = defineComponent({
|
|
|
407
454
|
}
|
|
408
455
|
}
|
|
409
456
|
function reset() {
|
|
410
|
-
|
|
411
|
-
call(
|
|
457
|
+
const resetValue = props2.range ? [0, 0] : 0;
|
|
458
|
+
call(props2["onUpdate:modelValue"], resetValue);
|
|
412
459
|
resetValidation();
|
|
413
460
|
}
|
|
414
461
|
return {
|
|
@@ -435,4 +482,7 @@ var __sfc__ = defineComponent({
|
|
|
435
482
|
}
|
|
436
483
|
});
|
|
437
484
|
__sfc__.render = __render__;
|
|
438
|
-
|
|
485
|
+
var stdin_default = __sfc__;
|
|
486
|
+
export {
|
|
487
|
+
stdin_default as default
|
|
488
|
+
};
|