@nutui/nutui 4.0.11 → 4.0.12
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/dist/nutui.es.js +1 -1
- package/dist/nutui.js +2 -2
- package/dist/nutui.umd.js +1 -1
- package/dist/packages/_es/ActionSheet.js +111 -78
- package/dist/packages/_es/Address.js +375 -250
- package/dist/packages/_es/AddressList.js +354 -269
- package/dist/packages/_es/Animate.js +58 -41
- package/dist/packages/_es/Audio.js +197 -128
- package/dist/packages/_es/AudioOperate.js +71 -60
- package/dist/packages/_es/Avatar.js +89 -66
- package/dist/packages/_es/AvatarGroup.js +31 -23
- package/dist/packages/_es/Backtop.js +99 -59
- package/dist/packages/_es/Badge.js +47 -36
- package/dist/packages/_es/Barrage.js +147 -68
- package/dist/packages/_es/Button.js +66 -47
- package/dist/packages/_es/Calendar.js +157 -135
- package/dist/packages/_es/CalendarItem.js +6 -6
- package/dist/packages/_es/Card.js +56 -42
- package/dist/packages/_es/Cascader.js +474 -315
- package/dist/packages/_es/Category.js +39 -29
- package/dist/packages/_es/CategoryPane.js +83 -57
- package/dist/packages/_es/Cell.js +71 -56
- package/dist/packages/_es/CellGroup.js +27 -19
- package/dist/packages/_es/Checkbox.js +156 -109
- package/dist/packages/_es/CheckboxGroup.js +59 -38
- package/dist/packages/_es/CircleProgress.js +96 -67
- package/dist/packages/_es/Col.js +31 -23
- package/dist/packages/_es/Collapse.js +58 -33
- package/dist/packages/_es/CollapseItem.js +108 -78
- package/dist/packages/_es/Comment.js +279 -207
- package/dist/packages/_es/ConfigProvider.js +55 -37
- package/dist/packages/_es/Countdown.js +212 -100
- package/dist/packages/_es/Countup.js +445 -232
- package/dist/packages/_es/DatePicker.js +265 -162
- package/dist/packages/_es/Dialog.js +213 -161
- package/dist/packages/_es/Divider.js +57 -42
- package/dist/packages/_es/Drag.js +153 -70
- package/dist/packages/_es/Ecard.js +104 -64
- package/dist/packages/_es/Elevator.js +219 -143
- package/dist/packages/_es/Ellipsis.js +178 -95
- package/dist/packages/_es/Empty.js +39 -23
- package/dist/packages/_es/FixedNav.js +116 -93
- package/dist/packages/_es/Form.js +178 -107
- package/dist/packages/_es/FormItem.js +61 -48
- package/dist/packages/_es/Grid.js +6 -5
- package/dist/packages/_es/GridItem.js +84 -58
- package/dist/packages/_es/Image.js +130 -90
- package/dist/packages/_es/ImagePreview.js +412 -256
- package/dist/packages/_es/Indicator.js +34 -30
- package/dist/packages/_es/InfiniteLoading.js +136 -83
- package/dist/packages/_es/Input.js +264 -160
- package/dist/packages/_es/InputNumber.js +117 -81
- package/dist/packages/_es/Interceptor-956b24fc.js +29 -0
- package/dist/packages/_es/Invoice.js +130 -104
- package/dist/packages/_es/Layout.js +4 -3
- package/dist/packages/_es/List.js +215 -117
- package/dist/packages/_es/Menu.js +150 -95
- package/dist/packages/_es/MenuItem.js +154 -109
- package/dist/packages/_es/Navbar.js +119 -103
- package/dist/packages/_es/Noticebar.js +312 -197
- package/dist/packages/_es/Notify.js +166 -110
- package/dist/packages/_es/NumberKeyboard.js +202 -127
- package/dist/packages/_es/Overlay.js +80 -52
- package/dist/packages/_es/Pagination.js +100 -70
- package/dist/packages/_es/Picker.js +437 -275
- package/dist/packages/_es/Popover.js +225 -122
- package/dist/packages/_es/Popup.js +4 -4
- package/dist/packages/_es/Price.js +82 -44
- package/dist/packages/_es/Progress.js +79 -63
- package/dist/packages/_es/PullRefresh.js +173 -95
- package/dist/packages/_es/Radio.js +4 -4
- package/dist/packages/_es/RadioGroup.js +3 -3
- package/dist/packages/_es/Range.js +347 -204
- package/dist/packages/_es/Rate.js +141 -92
- package/dist/packages/_es/Row.js +27 -21
- package/dist/packages/_es/Searchbar.js +174 -123
- package/dist/packages/_es/ShortPassword.js +93 -69
- package/dist/packages/_es/SideNavbar.js +80 -49
- package/dist/packages/_es/SideNavbarItem.js +32 -22
- package/dist/packages/_es/Signature.js +146 -83
- package/dist/packages/_es/Skeleton.js +130 -110
- package/dist/packages/_es/Sku.js +343 -250
- package/dist/packages/_es/Step.js +86 -59
- package/dist/packages/_es/Steps.js +31 -26
- package/dist/packages/_es/Sticky.js +4 -4
- package/dist/packages/_es/SubSideNavbar.js +74 -52
- package/dist/packages/_es/Swipe.js +155 -83
- package/dist/packages/_es/Swiper.js +311 -174
- package/dist/packages/_es/SwiperItem.js +44 -28
- package/dist/packages/_es/Switch.js +68 -55
- package/dist/packages/_es/TabPane.js +41 -30
- package/dist/packages/_es/Tabbar.js +52 -41
- package/dist/packages/_es/TabbarItem.js +82 -61
- package/dist/packages/_es/Table.js +165 -109
- package/dist/packages/_es/Tabs.js +388 -240
- package/dist/packages/_es/Tag.js +61 -44
- package/dist/packages/_es/Textarea.js +124 -80
- package/dist/packages/_es/TimeDetail.js +76 -49
- package/dist/packages/_es/TimePannel.js +48 -34
- package/dist/packages/_es/TimeSelect.js +68 -47
- package/dist/packages/_es/Toast.js +218 -144
- package/dist/packages/_es/Tour.js +192 -138
- package/dist/packages/_es/TrendArrow.js +77 -57
- package/dist/packages/_es/Uploader.js +359 -234
- package/dist/packages/_es/Video.js +316 -191
- package/dist/packages/_es/Watermark.js +117 -84
- package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +10 -0
- package/dist/packages/_es/common-b9a5e726.js +145 -0
- package/dist/packages/_es/component-81a4c1d0.js +145 -0
- package/dist/packages/_es/index-29892cda.js +33 -0
- package/dist/packages/_es/index-43c34ac6.js +30 -0
- package/dist/packages/_es/index-54d03fc1.js +8 -0
- package/dist/packages/_es/index-79c5dc33.js +10 -0
- package/dist/packages/_es/index-7a7385e4.js +67 -0
- package/dist/packages/_es/index-87422be8.js +942 -0
- package/dist/packages/_es/index-da0a7662.js +259 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +46 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-a8856969.js +97 -0
- package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +151 -0
- package/dist/packages/_es/mountComponent-8b24c346.js +39 -0
- package/dist/packages/_es/pxCheck-c6b9f6b7.js +6 -0
- package/dist/packages/_es/raf-729dad54.js +25 -0
- package/dist/packages/_es/renderIcon-3d0fd47c.js +9 -0
- package/dist/packages/locale/lang/baseLang-3a8457ac.js +5 -0
- package/dist/packages/locale/lang/en-US.js +39 -36
- package/dist/packages/locale/lang/id-ID.js +39 -36
- package/dist/packages/locale/lang/index.js +44 -22
- package/dist/packages/locale/lang/zh-CN.js +38 -35
- package/dist/packages/locale/lang/zh-TW.js +38 -35
- package/dist/resolver/index.js +26 -1
- package/dist/resolver/index.mjs +17 -14
- package/dist/smartips/web-types.json +1 -1
- package/dist/style.css +1 -1
- package/dist/styles/themes/default.scss +48 -48
- package/dist/styles/themes/jdb.scss +48 -48
- package/dist/styles/themes/jddkh.scss +48 -48
- package/dist/styles/themes/jdt.scss +48 -48
- package/dist/types/index.d.ts +1 -1
- package/package.json +3 -4
- package/dist/packages/_es/Interceptor-6e26b757.js +0 -18
- package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +0 -9
- package/dist/packages/_es/common-d218746f.js +0 -116
- package/dist/packages/_es/component-234624bc.js +0 -89
- package/dist/packages/_es/index-14dfadc4.js +0 -561
- package/dist/packages/_es/index-192a3ef6.js +0 -29
- package/dist/packages/_es/index-360c5092.js +0 -210
- package/dist/packages/_es/index-496e6e05.js +0 -24
- package/dist/packages/_es/index-50eed3d9.js +0 -7
- package/dist/packages/_es/index-53ec2d4d.js +0 -34
- package/dist/packages/_es/index-fadb0974.js +0 -8
- package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +0 -43
- package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +0 -77
- package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +0 -110
- package/dist/packages/_es/mountComponent-6d4ff200.js +0 -23
- package/dist/packages/_es/pxCheck-38173291.js +0 -4
- package/dist/packages/_es/raf-a74f1a06.js +0 -16
- package/dist/packages/_es/renderIcon-47498b32.js +0 -5
- package/dist/packages/locale/lang/baseLang-0bdc6353.js +0 -5
|
@@ -1,26 +1,34 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
import { ref, computed, toRefs, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle, withModifiers, Fragment, renderList, createTextVNode, renderSlot } from "vue";
|
|
21
|
+
import { c as createComponent, i as isArray } from "./component-81a4c1d0.js";
|
|
22
|
+
import { u as useTouch } from "./index-7a7385e4.js";
|
|
23
|
+
import { u as useRect } from "./index-29892cda.js";
|
|
24
|
+
import { _ as _export_sfc } from "./_plugin-vue_export-helper-cc2b3d55.js";
|
|
18
25
|
import "../locale/lang";
|
|
19
|
-
const { componentName
|
|
26
|
+
const { componentName, create } = createComponent("range");
|
|
27
|
+
const _sfc_main = create({
|
|
20
28
|
props: {
|
|
21
29
|
range: {
|
|
22
30
|
type: Boolean,
|
|
23
|
-
default:
|
|
31
|
+
default: false
|
|
24
32
|
},
|
|
25
33
|
disabled: Boolean,
|
|
26
34
|
activeColor: String,
|
|
@@ -28,7 +36,7 @@ const { componentName: ge, create: be } = me("range"), ye = be({
|
|
|
28
36
|
buttonColor: String,
|
|
29
37
|
vertical: {
|
|
30
38
|
type: Boolean,
|
|
31
|
-
default:
|
|
39
|
+
default: false
|
|
32
40
|
},
|
|
33
41
|
marks: {
|
|
34
42
|
type: Object,
|
|
@@ -36,11 +44,11 @@ const { componentName: ge, create: be } = me("range"), ye = be({
|
|
|
36
44
|
},
|
|
37
45
|
hiddenRange: {
|
|
38
46
|
type: Boolean,
|
|
39
|
-
default:
|
|
47
|
+
default: false
|
|
40
48
|
},
|
|
41
49
|
hiddenTag: {
|
|
42
50
|
type: Boolean,
|
|
43
|
-
default:
|
|
51
|
+
default: false
|
|
44
52
|
},
|
|
45
53
|
min: {
|
|
46
54
|
type: [Number, String],
|
|
@@ -60,234 +68,369 @@ const { componentName: ge, create: be } = me("range"), ye = be({
|
|
|
60
68
|
}
|
|
61
69
|
},
|
|
62
70
|
emits: ["change", "drag-end", "drag-start", "update:modelValue"],
|
|
63
|
-
setup(
|
|
64
|
-
const
|
|
65
|
-
let
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
+
setup(props, { emit }) {
|
|
72
|
+
const buttonIndex = ref(0);
|
|
73
|
+
let startValue;
|
|
74
|
+
let currentValue;
|
|
75
|
+
const root = ref();
|
|
76
|
+
const dragStatus = ref();
|
|
77
|
+
const touch = useTouch();
|
|
78
|
+
const marksList = computed(() => {
|
|
79
|
+
const { marks, max, min } = props;
|
|
80
|
+
const marksKeys = Object.keys(marks);
|
|
81
|
+
const list = marksKeys.map(parseFloat).sort((a, b) => a - b).filter((point) => point >= min && point <= max);
|
|
82
|
+
return list;
|
|
83
|
+
});
|
|
84
|
+
const scope = computed(() => Number(props.max) - Number(props.min));
|
|
85
|
+
const classes = computed(() => {
|
|
86
|
+
const prefixCls = componentName;
|
|
71
87
|
return {
|
|
72
|
-
[
|
|
73
|
-
[`${
|
|
74
|
-
[`${
|
|
75
|
-
[`${
|
|
88
|
+
[prefixCls]: true,
|
|
89
|
+
[`${prefixCls}-disabled`]: props.disabled,
|
|
90
|
+
[`${prefixCls}-vertical`]: props.vertical,
|
|
91
|
+
[`${prefixCls}-show-number`]: !props.hiddenRange
|
|
76
92
|
};
|
|
77
|
-
})
|
|
78
|
-
|
|
93
|
+
});
|
|
94
|
+
const containerClasses = computed(() => {
|
|
95
|
+
const prefixCls = "nut-range-container";
|
|
79
96
|
return {
|
|
80
|
-
[
|
|
81
|
-
[`${
|
|
97
|
+
[prefixCls]: true,
|
|
98
|
+
[`${prefixCls}-vertical`]: props.vertical
|
|
82
99
|
};
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
})), H = h(() => ({
|
|
86
|
-
borderColor: e.buttonColor
|
|
87
|
-
})), k = (t) => !!e.range && Array.isArray(t), R = () => {
|
|
88
|
-
const { modelValue: t, min: o } = e;
|
|
89
|
-
return k(t) ? `${(t[1] - t[0]) * 100 / b.value}%` : `${(t - Number(o)) * 100 / b.value}%`;
|
|
90
|
-
}, O = () => {
|
|
91
|
-
const { modelValue: t, min: o } = e;
|
|
92
|
-
return k(t) ? `${(t[0] - Number(o)) * 100 / b.value}%` : "0%";
|
|
93
|
-
}, Q = h(() => e.vertical ? {
|
|
94
|
-
height: R(),
|
|
95
|
-
top: O(),
|
|
96
|
-
background: e.activeColor,
|
|
97
|
-
transition: a.value ? "none" : void 0
|
|
98
|
-
} : {
|
|
99
|
-
width: R(),
|
|
100
|
-
left: O(),
|
|
101
|
-
background: e.activeColor,
|
|
102
|
-
transition: a.value ? "none" : void 0
|
|
103
|
-
}), U = (t) => {
|
|
104
|
-
const o = "nut-range-mark", { modelValue: l, max: r, min: d } = e;
|
|
105
|
-
let s = Number(d), f = Number(r);
|
|
106
|
-
if (e.range) {
|
|
107
|
-
const [T, V] = l;
|
|
108
|
-
s = T, f = V;
|
|
109
|
-
} else
|
|
110
|
-
f = l;
|
|
111
|
-
let C = t <= f && t >= s;
|
|
100
|
+
});
|
|
101
|
+
const wrapperStyle = computed(() => {
|
|
112
102
|
return {
|
|
113
|
-
|
|
114
|
-
[`${o}-text-active`]: C
|
|
103
|
+
background: props.inactiveColor
|
|
115
104
|
};
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
105
|
+
});
|
|
106
|
+
const buttonStyle = computed(() => {
|
|
107
|
+
return {
|
|
108
|
+
borderColor: props.buttonColor
|
|
120
109
|
};
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
110
|
+
});
|
|
111
|
+
const isRange = (val) => !!props.range && Array.isArray(val);
|
|
112
|
+
const calcMainAxis = () => {
|
|
113
|
+
const { modelValue, min } = props;
|
|
114
|
+
if (isRange(modelValue)) {
|
|
115
|
+
return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
|
|
116
|
+
}
|
|
117
|
+
return `${(modelValue - Number(min)) * 100 / scope.value}%`;
|
|
118
|
+
};
|
|
119
|
+
const calcOffset = () => {
|
|
120
|
+
const { modelValue, min } = props;
|
|
121
|
+
if (isRange(modelValue)) {
|
|
122
|
+
return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
|
|
123
|
+
}
|
|
124
|
+
return `0%`;
|
|
125
|
+
};
|
|
126
|
+
const barStyle = computed(() => {
|
|
127
|
+
if (props.vertical) {
|
|
128
|
+
return {
|
|
129
|
+
height: calcMainAxis(),
|
|
130
|
+
top: calcOffset(),
|
|
131
|
+
background: props.activeColor,
|
|
132
|
+
transition: dragStatus.value ? "none" : void 0
|
|
133
|
+
};
|
|
134
|
+
} else {
|
|
135
|
+
return {
|
|
136
|
+
width: calcMainAxis(),
|
|
137
|
+
left: calcOffset(),
|
|
138
|
+
background: props.activeColor,
|
|
139
|
+
transition: dragStatus.value ? "none" : void 0
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
const markClassName = (mark) => {
|
|
144
|
+
const classPrefix = "nut-range-mark";
|
|
145
|
+
const { modelValue, max, min } = props;
|
|
146
|
+
let lowerBound = Number(min);
|
|
147
|
+
let upperBound = Number(max);
|
|
148
|
+
if (props.range) {
|
|
149
|
+
const [left, right] = modelValue;
|
|
150
|
+
lowerBound = left;
|
|
151
|
+
upperBound = right;
|
|
152
|
+
} else {
|
|
153
|
+
upperBound = modelValue;
|
|
130
154
|
}
|
|
155
|
+
let isActive = mark <= upperBound && mark >= lowerBound;
|
|
131
156
|
return {
|
|
132
|
-
|
|
157
|
+
[`${classPrefix}-text`]: true,
|
|
158
|
+
[`${classPrefix}-text-active`]: isActive
|
|
133
159
|
};
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
if (
|
|
160
|
+
};
|
|
161
|
+
const marksStyle = (mark) => {
|
|
162
|
+
const { min, vertical } = props;
|
|
163
|
+
let style = {
|
|
164
|
+
left: `${(mark - Number(min)) / scope.value * 100}%`
|
|
165
|
+
};
|
|
166
|
+
if (vertical) {
|
|
167
|
+
style = {
|
|
168
|
+
top: `${(mark - Number(min)) / scope.value * 100}%`
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
return style;
|
|
172
|
+
};
|
|
173
|
+
const tickStyle = (mark) => {
|
|
174
|
+
const { modelValue, max, min } = props;
|
|
175
|
+
let lowerBound = Number(min);
|
|
176
|
+
let upperBound = Number(max);
|
|
177
|
+
if (props.range) {
|
|
178
|
+
const [left, right] = modelValue;
|
|
179
|
+
lowerBound = left;
|
|
180
|
+
upperBound = right;
|
|
181
|
+
}
|
|
182
|
+
let isActive = mark <= upperBound && mark >= lowerBound;
|
|
183
|
+
let style = {
|
|
184
|
+
background: !isActive ? props.inactiveColor : props.activeColor
|
|
185
|
+
};
|
|
186
|
+
return style;
|
|
187
|
+
};
|
|
188
|
+
const format = (value) => {
|
|
189
|
+
const { min, max, step } = props;
|
|
190
|
+
value = Math.max(+min, Math.min(value, +max));
|
|
191
|
+
return Math.round(value / +step) * +step;
|
|
192
|
+
};
|
|
193
|
+
const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
|
|
194
|
+
const handleOverlap = (value) => {
|
|
195
|
+
if (value[0] > value[1]) {
|
|
196
|
+
return value.slice(0).reverse();
|
|
197
|
+
}
|
|
198
|
+
return value;
|
|
199
|
+
};
|
|
200
|
+
const updateValue = (value, end) => {
|
|
201
|
+
if (isRange(value)) {
|
|
202
|
+
value = handleOverlap(value).map(format);
|
|
203
|
+
} else {
|
|
204
|
+
value = format(value);
|
|
205
|
+
}
|
|
206
|
+
if (!isSameValue(value, props.modelValue)) {
|
|
207
|
+
emit("update:modelValue", value);
|
|
208
|
+
}
|
|
209
|
+
if (end && !isSameValue(value, startValue)) {
|
|
210
|
+
emit("change", value);
|
|
211
|
+
}
|
|
212
|
+
};
|
|
213
|
+
const onClick = (event) => {
|
|
214
|
+
if (props.disabled) {
|
|
141
215
|
return;
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
216
|
+
}
|
|
217
|
+
const { min, modelValue } = props;
|
|
218
|
+
const rect = useRect(root);
|
|
219
|
+
let delta = event.clientX - rect.left;
|
|
220
|
+
let total = rect.width;
|
|
221
|
+
if (props.vertical) {
|
|
222
|
+
delta = event.clientY - rect.top;
|
|
223
|
+
total = rect.height;
|
|
224
|
+
}
|
|
225
|
+
const value = Number(min) + delta / total * scope.value;
|
|
226
|
+
if (isRange(modelValue)) {
|
|
227
|
+
const [left, right] = modelValue;
|
|
228
|
+
const middle = (left + right) / 2;
|
|
229
|
+
if (value <= middle) {
|
|
230
|
+
updateValue([value, right], true);
|
|
231
|
+
} else {
|
|
232
|
+
updateValue([left, value], true);
|
|
233
|
+
}
|
|
234
|
+
} else {
|
|
235
|
+
updateValue(value, true);
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
const onTouchStart = (event) => {
|
|
239
|
+
if (props.disabled) {
|
|
155
240
|
return;
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
241
|
+
}
|
|
242
|
+
touch.start(event);
|
|
243
|
+
currentValue = props.modelValue;
|
|
244
|
+
if (isRange(currentValue)) {
|
|
245
|
+
startValue = currentValue.map(format);
|
|
246
|
+
} else {
|
|
247
|
+
startValue = format(currentValue);
|
|
248
|
+
}
|
|
249
|
+
dragStatus.value = "start";
|
|
250
|
+
};
|
|
251
|
+
const onTouchMove = (event) => {
|
|
252
|
+
if (props.disabled) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (dragStatus.value === "start") {
|
|
256
|
+
emit("drag-start");
|
|
257
|
+
}
|
|
258
|
+
touch.move(event);
|
|
259
|
+
dragStatus.value = "draging";
|
|
260
|
+
const rect = useRect(root);
|
|
261
|
+
let delta = touch.deltaX.value;
|
|
262
|
+
let total = rect.width;
|
|
263
|
+
let diff = delta / total * scope.value;
|
|
264
|
+
if (props.vertical) {
|
|
265
|
+
delta = touch.deltaY.value;
|
|
266
|
+
total = rect.height;
|
|
267
|
+
diff = delta / total * scope.value;
|
|
268
|
+
}
|
|
269
|
+
if (isRange(startValue)) {
|
|
270
|
+
currentValue[buttonIndex.value] = startValue[buttonIndex.value] + diff;
|
|
271
|
+
} else {
|
|
272
|
+
currentValue = startValue + diff;
|
|
273
|
+
}
|
|
274
|
+
updateValue(currentValue);
|
|
275
|
+
event.stopPropagation();
|
|
276
|
+
event.preventDefault();
|
|
277
|
+
};
|
|
278
|
+
const onTouchEnd = () => {
|
|
279
|
+
if (props.disabled) {
|
|
280
|
+
return;
|
|
281
|
+
}
|
|
282
|
+
if (dragStatus.value === "draging") {
|
|
283
|
+
updateValue(currentValue, true);
|
|
284
|
+
emit("drag-end");
|
|
285
|
+
}
|
|
286
|
+
dragStatus.value = "";
|
|
287
|
+
};
|
|
288
|
+
const curValue = (idx) => {
|
|
289
|
+
const value = isArray(props.modelValue) && typeof idx === "number" ? props.modelValue[idx] : Number(props.modelValue);
|
|
290
|
+
return value;
|
|
291
|
+
};
|
|
292
|
+
return __spreadProps(__spreadValues({
|
|
293
|
+
root,
|
|
294
|
+
classes,
|
|
295
|
+
wrapperStyle,
|
|
296
|
+
buttonStyle,
|
|
297
|
+
onClick,
|
|
298
|
+
onTouchStart,
|
|
299
|
+
onTouchMove,
|
|
300
|
+
onTouchEnd
|
|
301
|
+
}, toRefs(props)), {
|
|
302
|
+
barStyle,
|
|
303
|
+
curValue,
|
|
304
|
+
buttonIndex,
|
|
305
|
+
containerClasses,
|
|
306
|
+
markClassName,
|
|
307
|
+
marksStyle,
|
|
308
|
+
marksList,
|
|
309
|
+
tickStyle
|
|
181
310
|
});
|
|
182
311
|
}
|
|
183
|
-
})
|
|
312
|
+
});
|
|
313
|
+
const _hoisted_1 = {
|
|
184
314
|
key: 0,
|
|
185
315
|
class: "nut-range-min"
|
|
186
|
-
}
|
|
316
|
+
};
|
|
317
|
+
const _hoisted_2 = {
|
|
187
318
|
key: 0,
|
|
188
319
|
class: "nut-range-mark"
|
|
189
|
-
}
|
|
320
|
+
};
|
|
321
|
+
const _hoisted_3 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
|
|
322
|
+
const _hoisted_4 = {
|
|
190
323
|
key: 0,
|
|
191
324
|
class: "number"
|
|
192
|
-
}
|
|
325
|
+
};
|
|
326
|
+
const _hoisted_5 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
|
|
327
|
+
const _hoisted_6 = {
|
|
193
328
|
key: 0,
|
|
194
329
|
class: "number"
|
|
195
|
-
}
|
|
330
|
+
};
|
|
331
|
+
const _hoisted_7 = {
|
|
196
332
|
key: 1,
|
|
197
333
|
class: "nut-range-max"
|
|
198
334
|
};
|
|
199
|
-
function
|
|
200
|
-
return
|
|
201
|
-
class:
|
|
335
|
+
function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
|
|
336
|
+
return openBlock(), createElementBlock("view", {
|
|
337
|
+
class: normalizeClass(_ctx.containerClasses)
|
|
202
338
|
}, [
|
|
203
|
-
|
|
204
|
-
|
|
339
|
+
!_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(+_ctx.min), 1)) : createCommentVNode("", true),
|
|
340
|
+
createElementVNode("view", {
|
|
205
341
|
ref: "root",
|
|
206
|
-
style:
|
|
207
|
-
class:
|
|
208
|
-
onClick:
|
|
342
|
+
style: normalizeStyle(_ctx.wrapperStyle),
|
|
343
|
+
class: normalizeClass(_ctx.classes),
|
|
344
|
+
onClick: _cache[9] || (_cache[9] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
|
|
209
345
|
}, [
|
|
210
|
-
|
|
211
|
-
(
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
346
|
+
_ctx.marksList.length > 0 ? (openBlock(), createElementBlock("view", _hoisted_2, [
|
|
347
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.marksList, (marks) => {
|
|
348
|
+
return openBlock(), createElementBlock("span", {
|
|
349
|
+
key: marks,
|
|
350
|
+
class: normalizeClass(_ctx.markClassName(marks)),
|
|
351
|
+
style: normalizeStyle(_ctx.marksStyle(marks))
|
|
352
|
+
}, [
|
|
353
|
+
createTextVNode(toDisplayString(marks) + " ", 1),
|
|
354
|
+
createElementVNode("span", {
|
|
355
|
+
class: "nut-range-tick",
|
|
356
|
+
style: normalizeStyle(_ctx.tickStyle(marks))
|
|
357
|
+
}, null, 4)
|
|
358
|
+
], 6);
|
|
359
|
+
}), 128))
|
|
360
|
+
])) : createCommentVNode("", true),
|
|
361
|
+
createElementVNode("view", {
|
|
224
362
|
class: "nut-range-bar",
|
|
225
|
-
style:
|
|
363
|
+
style: normalizeStyle(_ctx.barStyle)
|
|
226
364
|
}, [
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
(
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
style: w(e.buttonStyle)
|
|
365
|
+
_ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index) => {
|
|
366
|
+
return createElementVNode("view", {
|
|
367
|
+
key: index,
|
|
368
|
+
role: "slider",
|
|
369
|
+
class: normalizeClass({
|
|
370
|
+
"nut-range-button-wrapper-left": index == 0,
|
|
371
|
+
"nut-range-button-wrapper-right": index == 1
|
|
372
|
+
}),
|
|
373
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
374
|
+
"aria-valuemin": +_ctx.min,
|
|
375
|
+
"aria-valuenow": _ctx.curValue(index),
|
|
376
|
+
"aria-valuemax": +_ctx.max,
|
|
377
|
+
"aria-orientation": "horizontal",
|
|
378
|
+
onTouchstart: withModifiers(
|
|
379
|
+
(e) => {
|
|
380
|
+
if (typeof index === "number") {
|
|
381
|
+
_ctx.buttonIndex = index;
|
|
382
|
+
}
|
|
383
|
+
_ctx.onTouchStart(e);
|
|
384
|
+
},
|
|
385
|
+
["stop", "prevent"]
|
|
386
|
+
),
|
|
387
|
+
onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args), ["stop", "prevent"])),
|
|
388
|
+
onTouchend: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
389
|
+
onTouchcancel: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
390
|
+
onClick: _cache[3] || (_cache[3] = (e) => e.stopPropagation())
|
|
254
391
|
}, [
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
392
|
+
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
|
|
393
|
+
key: 1,
|
|
394
|
+
class: "nut-range-button",
|
|
395
|
+
style: normalizeStyle(_ctx.buttonStyle)
|
|
396
|
+
}, [
|
|
397
|
+
!_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.curValue(index)), 1)) : createCommentVNode("", true)
|
|
398
|
+
], 4))
|
|
399
|
+
], 42, _hoisted_3);
|
|
400
|
+
}), 64)) : (openBlock(), createElementBlock("view", {
|
|
258
401
|
key: 1,
|
|
259
402
|
role: "slider",
|
|
260
403
|
class: "nut-range-button-wrapper",
|
|
261
|
-
tabindex:
|
|
262
|
-
"aria-valuemin": +
|
|
263
|
-
"aria-valuenow":
|
|
264
|
-
"aria-valuemax": +
|
|
404
|
+
tabindex: _ctx.disabled ? -1 : 0,
|
|
405
|
+
"aria-valuemin": +_ctx.min,
|
|
406
|
+
"aria-valuenow": _ctx.curValue(),
|
|
407
|
+
"aria-valuemax": +_ctx.max,
|
|
265
408
|
"aria-orientation": "horizontal",
|
|
266
|
-
onTouchstart:
|
|
267
|
-
(
|
|
268
|
-
|
|
409
|
+
onTouchstart: _cache[4] || (_cache[4] = withModifiers(
|
|
410
|
+
(e) => {
|
|
411
|
+
_ctx.onTouchStart(e);
|
|
269
412
|
},
|
|
270
413
|
["stop", "prevent"]
|
|
271
414
|
)),
|
|
272
|
-
onTouchmove:
|
|
273
|
-
onTouchend:
|
|
274
|
-
onTouchcancel:
|
|
275
|
-
onClick:
|
|
415
|
+
onTouchmove: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args), ["stop", "prevent"])),
|
|
416
|
+
onTouchend: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
417
|
+
onTouchcancel: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
|
|
418
|
+
onClick: _cache[8] || (_cache[8] = (e) => e.stopPropagation())
|
|
276
419
|
}, [
|
|
277
|
-
|
|
420
|
+
_ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
|
|
278
421
|
key: 1,
|
|
279
422
|
class: "nut-range-button",
|
|
280
|
-
style:
|
|
423
|
+
style: normalizeStyle(_ctx.buttonStyle)
|
|
281
424
|
}, [
|
|
282
|
-
|
|
425
|
+
!_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_6, toDisplayString(_ctx.curValue()), 1)) : createCommentVNode("", true)
|
|
283
426
|
], 4))
|
|
284
|
-
], 40,
|
|
427
|
+
], 40, _hoisted_5))
|
|
285
428
|
], 4)
|
|
286
429
|
], 6),
|
|
287
|
-
|
|
430
|
+
!_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(+_ctx.max), 1)) : createCommentVNode("", true)
|
|
288
431
|
], 2);
|
|
289
432
|
}
|
|
290
|
-
const
|
|
433
|
+
const Range = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
|
|
291
434
|
export {
|
|
292
|
-
|
|
435
|
+
Range as default
|
|
293
436
|
};
|