@nutui/nutui 4.0.9 → 4.0.10

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.
Files changed (168) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.es.js +1 -1
  3. package/dist/nutui.js +15382 -0
  4. package/dist/nutui.umd.js +1 -7
  5. package/dist/packages/_es/ActionSheet.js +78 -111
  6. package/dist/packages/_es/Address.js +250 -375
  7. package/dist/packages/_es/AddressList.js +269 -354
  8. package/dist/packages/_es/Animate.js +41 -58
  9. package/dist/packages/_es/Audio.js +128 -197
  10. package/dist/packages/_es/AudioOperate.js +60 -71
  11. package/dist/packages/_es/Avatar.js +66 -89
  12. package/dist/packages/_es/AvatarGroup.js +23 -31
  13. package/dist/packages/_es/Backtop.js +59 -99
  14. package/dist/packages/_es/Badge.js +36 -47
  15. package/dist/packages/_es/Barrage.js +68 -147
  16. package/dist/packages/_es/Button.js +47 -66
  17. package/dist/packages/_es/Calendar.js +135 -157
  18. package/dist/packages/_es/CalendarItem.js +6 -6
  19. package/dist/packages/_es/Card.js +42 -56
  20. package/dist/packages/_es/Cascader.js +315 -474
  21. package/dist/packages/_es/Category.js +29 -39
  22. package/dist/packages/_es/CategoryPane.js +57 -83
  23. package/dist/packages/_es/Cell.js +56 -71
  24. package/dist/packages/_es/CellGroup.js +19 -27
  25. package/dist/packages/_es/Checkbox.js +109 -156
  26. package/dist/packages/_es/CheckboxGroup.js +38 -59
  27. package/dist/packages/_es/CircleProgress.js +67 -96
  28. package/dist/packages/_es/Col.js +23 -31
  29. package/dist/packages/_es/Collapse.js +33 -58
  30. package/dist/packages/_es/CollapseItem.js +78 -108
  31. package/dist/packages/_es/Comment.js +207 -279
  32. package/dist/packages/_es/ConfigProvider.js +37 -55
  33. package/dist/packages/_es/Countdown.js +100 -212
  34. package/dist/packages/_es/Countup.js +232 -445
  35. package/dist/packages/_es/DatePicker.js +162 -265
  36. package/dist/packages/_es/Dialog.js +161 -213
  37. package/dist/packages/_es/Divider.js +42 -57
  38. package/dist/packages/_es/Drag.js +70 -153
  39. package/dist/packages/_es/Ecard.js +64 -104
  40. package/dist/packages/_es/Elevator.js +143 -219
  41. package/dist/packages/_es/Ellipsis.js +95 -178
  42. package/dist/packages/_es/Empty.js +23 -39
  43. package/dist/packages/_es/FixedNav.js +93 -116
  44. package/dist/packages/_es/Form.js +107 -178
  45. package/dist/packages/_es/FormItem.js +48 -61
  46. package/dist/packages/_es/Grid.js +5 -6
  47. package/dist/packages/_es/GridItem.js +58 -84
  48. package/dist/packages/_es/Image.js +90 -129
  49. package/dist/packages/_es/ImagePreview.js +256 -412
  50. package/dist/packages/_es/Indicator.js +30 -34
  51. package/dist/packages/_es/InfiniteLoading.js +83 -136
  52. package/dist/packages/_es/Input.js +160 -264
  53. package/dist/packages/_es/InputNumber.js +81 -117
  54. package/dist/packages/_es/Interceptor-6e26b757.js +18 -0
  55. package/dist/packages/_es/Invoice.js +104 -130
  56. package/dist/packages/_es/Layout.js +3 -4
  57. package/dist/packages/_es/List.js +117 -215
  58. package/dist/packages/_es/Menu.js +96 -152
  59. package/dist/packages/_es/MenuItem.js +117 -172
  60. package/dist/packages/_es/Navbar.js +103 -119
  61. package/dist/packages/_es/Noticebar.js +197 -312
  62. package/dist/packages/_es/Notify.js +110 -166
  63. package/dist/packages/_es/NumberKeyboard.js +127 -202
  64. package/dist/packages/_es/Overlay.js +52 -80
  65. package/dist/packages/_es/Pagination.js +70 -100
  66. package/dist/packages/_es/Picker.js +275 -441
  67. package/dist/packages/_es/Popover.js +122 -225
  68. package/dist/packages/_es/Popup.js +4 -4
  69. package/dist/packages/_es/Price.js +44 -82
  70. package/dist/packages/_es/Progress.js +63 -79
  71. package/dist/packages/_es/PullRefresh.js +95 -173
  72. package/dist/packages/_es/Radio.js +4 -4
  73. package/dist/packages/_es/RadioGroup.js +3 -3
  74. package/dist/packages/_es/Range.js +204 -347
  75. package/dist/packages/_es/Rate.js +92 -141
  76. package/dist/packages/_es/Row.js +21 -27
  77. package/dist/packages/_es/Searchbar.js +130 -179
  78. package/dist/packages/_es/ShortPassword.js +69 -93
  79. package/dist/packages/_es/SideNavbar.js +49 -80
  80. package/dist/packages/_es/SideNavbarItem.js +22 -32
  81. package/dist/packages/_es/Signature.js +83 -146
  82. package/dist/packages/_es/Skeleton.js +110 -130
  83. package/dist/packages/_es/Sku.js +250 -343
  84. package/dist/packages/_es/Step.js +59 -86
  85. package/dist/packages/_es/Steps.js +26 -31
  86. package/dist/packages/_es/Sticky.js +4 -4
  87. package/dist/packages/_es/SubSideNavbar.js +52 -74
  88. package/dist/packages/_es/Swipe.js +83 -155
  89. package/dist/packages/_es/Swiper.js +174 -311
  90. package/dist/packages/_es/SwiperItem.js +28 -44
  91. package/dist/packages/_es/Switch.js +55 -68
  92. package/dist/packages/_es/TabPane.js +30 -41
  93. package/dist/packages/_es/Tabbar.js +41 -52
  94. package/dist/packages/_es/TabbarItem.js +61 -82
  95. package/dist/packages/_es/Table.js +109 -165
  96. package/dist/packages/_es/Tabs.js +240 -388
  97. package/dist/packages/_es/Tag.js +44 -61
  98. package/dist/packages/_es/Textarea.js +80 -124
  99. package/dist/packages/_es/TimeDetail.js +49 -76
  100. package/dist/packages/_es/TimePannel.js +34 -48
  101. package/dist/packages/_es/TimeSelect.js +47 -68
  102. package/dist/packages/_es/Toast.js +144 -218
  103. package/dist/packages/_es/Tour.js +138 -192
  104. package/dist/packages/_es/TrendArrow.js +57 -77
  105. package/dist/packages/_es/Uploader.js +234 -359
  106. package/dist/packages/_es/Video.js +191 -316
  107. package/dist/packages/_es/Watermark.js +84 -117
  108. package/dist/packages/_es/_plugin-vue_export-helper-dad06003.js +9 -0
  109. package/dist/packages/_es/common-d218746f.js +116 -0
  110. package/dist/packages/_es/component-234624bc.js +89 -0
  111. package/dist/packages/_es/index-14dfadc4.js +561 -0
  112. package/dist/packages/_es/index-192a3ef6.js +29 -0
  113. package/dist/packages/_es/index-360c5092.js +210 -0
  114. package/dist/packages/_es/index-496e6e05.js +24 -0
  115. package/dist/packages/_es/index-50eed3d9.js +7 -0
  116. package/dist/packages/_es/index-53ec2d4d.js +34 -0
  117. package/dist/packages/_es/index-fadb0974.js +8 -0
  118. package/dist/packages/_es/index.vue_vue_type_script_lang-1139b29a.js +43 -0
  119. package/dist/packages/_es/index.vue_vue_type_script_lang-43b774dd.js +77 -0
  120. package/dist/packages/_es/index.vue_vue_type_script_lang-f44c159d.js +110 -0
  121. package/dist/packages/_es/mountComponent-6d4ff200.js +23 -0
  122. package/dist/packages/_es/pxCheck-38173291.js +4 -0
  123. package/dist/packages/_es/raf-a74f1a06.js +16 -0
  124. package/dist/packages/_es/renderIcon-47498b32.js +5 -0
  125. package/dist/packages/col/index.scss +2 -2
  126. package/dist/packages/menuitem/index.scss +7 -10
  127. package/dist/packages/searchbar/index.scss +4 -0
  128. package/dist/smartips/web-types.json +2 -2
  129. package/dist/style.css +1 -1
  130. package/dist/styles/themes/default.scss +158 -55
  131. package/dist/styles/themes/jdb.scss +158 -55
  132. package/dist/styles/themes/jddkh.scss +158 -55
  133. package/dist/styles/themes/jdt.scss +158 -55
  134. package/dist/types/__VUE/address/index.vue.d.ts +1 -1
  135. package/dist/types/__VUE/collapseitem/index.vue.d.ts +110 -3
  136. package/dist/types/__VUE/image/index.vue.d.ts +2 -2
  137. package/dist/types/__VUE/menu/index.vue.d.ts +0 -2
  138. package/dist/types/__VUE/menuitem/index.vue.d.ts +9 -17
  139. package/dist/types/__VUE/navbar/index.vue.d.ts +1 -1
  140. package/dist/types/__VUE/picker/usePicker.d.ts +1 -1
  141. package/dist/types/__VUE/rate/index.vue.d.ts +110 -3
  142. package/dist/types/__VUE/row/index.vue.d.ts +1 -1
  143. package/dist/types/__VUE/searchbar/index.vue.d.ts +121 -5
  144. package/dist/types/__VUE/skeleton/index.vue.d.ts +2 -2
  145. package/dist/types/__VUE/swiper/index.vue.d.ts +1 -1
  146. package/dist/types/__VUE/table/common.d.ts +55 -2
  147. package/dist/types/__VUE/timeselect/index.vue.d.ts +1 -1
  148. package/dist/types/__VUE/watermark/index.vue.d.ts +1 -1
  149. package/dist/types/index.d.ts +1 -1
  150. package/package.json +2 -2
  151. package/dist/packages/_es/Interceptor-956b24fc.js +0 -29
  152. package/dist/packages/_es/_plugin-vue_export-helper-cc2b3d55.js +0 -10
  153. package/dist/packages/_es/common-b9a5e726.js +0 -145
  154. package/dist/packages/_es/component-81a4c1d0.js +0 -145
  155. package/dist/packages/_es/index-29892cda.js +0 -33
  156. package/dist/packages/_es/index-43c34ac6.js +0 -30
  157. package/dist/packages/_es/index-54d03fc1.js +0 -8
  158. package/dist/packages/_es/index-79c5dc33.js +0 -10
  159. package/dist/packages/_es/index-7a7385e4.js +0 -67
  160. package/dist/packages/_es/index-87422be8.js +0 -942
  161. package/dist/packages/_es/index-da0a7662.js +0 -259
  162. package/dist/packages/_es/index.vue_vue_type_script_lang-22dfc112.js +0 -46
  163. package/dist/packages/_es/index.vue_vue_type_script_lang-442e4704.js +0 -98
  164. package/dist/packages/_es/index.vue_vue_type_script_lang-cc5c4086.js +0 -151
  165. package/dist/packages/_es/mountComponent-8b24c346.js +0 -39
  166. package/dist/packages/_es/pxCheck-c6b9f6b7.js +0 -6
  167. package/dist/packages/_es/raf-729dad54.js +0 -25
  168. package/dist/packages/_es/renderIcon-3d0fd47c.js +0 -9
@@ -1,34 +1,26 @@
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";
1
+ var oe = Object.defineProperty, re = Object.defineProperties;
2
+ var le = Object.getOwnPropertyDescriptors;
3
+ var L = Object.getOwnPropertySymbols;
4
+ var ue = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
+ var P = (e, n, u) => n in e ? oe(e, n, { enumerable: !0, configurable: !0, writable: !0, value: u }) : e[n] = u, j = (e, n) => {
6
+ for (var u in n || (n = {}))
7
+ ue.call(n, u) && P(e, u, n[u]);
8
+ if (L)
9
+ for (var u of L(n))
10
+ ie.call(n, u) && P(e, u, n[u]);
11
+ return e;
12
+ }, D = (e, n) => re(e, le(n));
13
+ import { ref as A, computed as h, toRefs as se, openBlock as m, createElementBlock as c, normalizeClass as E, toDisplayString as N, createCommentVNode as $, createElementVNode as M, normalizeStyle as w, withModifiers as g, Fragment as F, renderList as I, createTextVNode as de, renderSlot as J } from "vue";
14
+ import { c as me, i as ce } from "./component-234624bc.js";
15
+ import { u as fe } from "./index-53ec2d4d.js";
16
+ import { u as K } from "./index-192a3ef6.js";
17
+ import { _ as ve } from "./_plugin-vue_export-helper-dad06003.js";
25
18
  import "../locale/lang";
26
- const { componentName, create } = createComponent("range");
27
- const _sfc_main = create({
19
+ const { componentName: ge, create: be } = me("range"), ye = be({
28
20
  props: {
29
21
  range: {
30
22
  type: Boolean,
31
- default: false
23
+ default: !1
32
24
  },
33
25
  disabled: Boolean,
34
26
  activeColor: String,
@@ -36,7 +28,7 @@ const _sfc_main = create({
36
28
  buttonColor: String,
37
29
  vertical: {
38
30
  type: Boolean,
39
- default: false
31
+ default: !1
40
32
  },
41
33
  marks: {
42
34
  type: Object,
@@ -44,11 +36,11 @@ const _sfc_main = create({
44
36
  },
45
37
  hiddenRange: {
46
38
  type: Boolean,
47
- default: false
39
+ default: !1
48
40
  },
49
41
  hiddenTag: {
50
42
  type: Boolean,
51
- default: false
43
+ default: !1
52
44
  },
53
45
  min: {
54
46
  type: [Number, String],
@@ -68,369 +60,234 @@ const _sfc_main = create({
68
60
  }
69
61
  },
70
62
  emits: ["change", "drag-end", "drag-start", "update:modelValue"],
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;
63
+ setup(e, { emit: n }) {
64
+ const u = A(0);
65
+ let y, v;
66
+ const p = A(), a = A(), i = fe(), X = h(() => {
67
+ const { marks: t, max: o, min: l } = e;
68
+ return Object.keys(t).map(parseFloat).sort((s, f) => s - f).filter((s) => s >= l && s <= o);
69
+ }), b = h(() => Number(e.max) - Number(e.min)), Y = h(() => {
70
+ const t = ge;
87
71
  return {
88
- [prefixCls]: true,
89
- [`${prefixCls}-disabled`]: props.disabled,
90
- [`${prefixCls}-vertical`]: props.vertical,
91
- [`${prefixCls}-show-number`]: !props.hiddenRange
72
+ [t]: !0,
73
+ [`${t}-disabled`]: e.disabled,
74
+ [`${t}-vertical`]: e.vertical,
75
+ [`${t}-show-number`]: !e.hiddenRange
92
76
  };
93
- });
94
- const containerClasses = computed(() => {
95
- const prefixCls = "nut-range-container";
77
+ }), q = h(() => {
78
+ const t = "nut-range-container";
96
79
  return {
97
- [prefixCls]: true,
98
- [`${prefixCls}-vertical`]: props.vertical
80
+ [t]: !0,
81
+ [`${t}-vertical`]: e.vertical
99
82
  };
100
- });
101
- const wrapperStyle = computed(() => {
83
+ }), G = h(() => ({
84
+ background: e.inactiveColor
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;
102
112
  return {
103
- background: props.inactiveColor
113
+ [`${o}-text`]: !0,
114
+ [`${o}-text-active`]: C
104
115
  };
105
- });
106
- const buttonStyle = computed(() => {
107
- return {
108
- borderColor: props.buttonColor
116
+ }, W = (t) => {
117
+ const { min: o, vertical: l } = e;
118
+ let r = {
119
+ left: `${(t - Number(o)) / b.value * 100}%`
109
120
  };
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;
121
+ return l && (r = {
122
+ top: `${(t - Number(o)) / b.value * 100}%`
123
+ }), r;
124
+ }, Z = (t) => {
125
+ const { modelValue: o, max: l, min: r } = e;
126
+ let d = Number(r), s = Number(l);
127
+ if (e.range) {
128
+ const [T, V] = o;
129
+ d = T, s = V;
154
130
  }
155
- let isActive = mark <= upperBound && mark >= lowerBound;
156
131
  return {
157
- [`${classPrefix}-text`]: true,
158
- [`${classPrefix}-text-active`]: isActive
132
+ background: t <= s && t >= d ? e.activeColor : e.inactiveColor
159
133
  };
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) {
134
+ }, B = (t) => {
135
+ const { min: o, max: l, step: r } = e;
136
+ return t = Math.max(+o, Math.min(t, +l)), Math.round(t / +r) * +r;
137
+ }, z = (t, o) => JSON.stringify(t) === JSON.stringify(o), x = (t) => t[0] > t[1] ? t.slice(0).reverse() : t, S = (t, o) => {
138
+ k(t) ? t = x(t).map(B) : t = B(t), z(t, e.modelValue) || n("update:modelValue", t), o && !z(t, y) && n("change", t);
139
+ }, _ = (t) => {
140
+ if (e.disabled)
215
141
  return;
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) {
142
+ const { min: o, modelValue: l } = e, r = K(p);
143
+ let d = t.clientX - r.left, s = r.width;
144
+ e.vertical && (d = t.clientY - r.top, s = r.height);
145
+ const f = Number(o) + d / s * b.value;
146
+ if (k(l)) {
147
+ const [C, T] = l, V = (C + T) / 2;
148
+ f <= V ? S([f, T], !0) : S([C, f], !0);
149
+ } else
150
+ S(f, !0);
151
+ }, ee = (t) => {
152
+ e.disabled || (i.start(t), v = e.modelValue, k(v) ? y = v.map(B) : y = B(v), a.value = "start");
153
+ }, te = (t) => {
154
+ if (e.disabled)
240
155
  return;
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
156
+ a.value === "start" && n("drag-start"), i.move(t), a.value = "draging";
157
+ const o = K(p);
158
+ let l = i.deltaX.value, r = o.width, d = l / r * b.value;
159
+ e.vertical && (l = i.deltaY.value, r = o.height, d = l / r * b.value), k(y) ? v[u.value] = y[u.value] + d : v = y + d, S(v), t.stopPropagation(), t.preventDefault();
160
+ }, ne = () => {
161
+ e.disabled || (a.value === "draging" && (S(v, !0), n("drag-end")), a.value = "");
162
+ }, ae = (t) => ce(e.modelValue) && typeof t == "number" ? e.modelValue[t] : Number(e.modelValue);
163
+ return D(j({
164
+ root: p,
165
+ classes: Y,
166
+ wrapperStyle: G,
167
+ buttonStyle: H,
168
+ onClick: _,
169
+ onTouchStart: ee,
170
+ onTouchMove: te,
171
+ onTouchEnd: ne
172
+ }, se(e)), {
173
+ barStyle: Q,
174
+ curValue: ae,
175
+ buttonIndex: u,
176
+ containerClasses: q,
177
+ markClassName: U,
178
+ marksStyle: W,
179
+ marksList: X,
180
+ tickStyle: Z
310
181
  });
311
182
  }
312
- });
313
- const _hoisted_1 = {
183
+ }), he = {
314
184
  key: 0,
315
185
  class: "nut-range-min"
316
- };
317
- const _hoisted_2 = {
186
+ }, ke = {
318
187
  key: 0,
319
188
  class: "nut-range-mark"
320
- };
321
- const _hoisted_3 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
322
- const _hoisted_4 = {
189
+ }, Te = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"], we = {
323
190
  key: 0,
324
191
  class: "number"
325
- };
326
- const _hoisted_5 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
327
- const _hoisted_6 = {
192
+ }, Se = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"], Ce = {
328
193
  key: 0,
329
194
  class: "number"
330
- };
331
- const _hoisted_7 = {
195
+ }, Ve = {
332
196
  key: 1,
333
197
  class: "nut-range-max"
334
198
  };
335
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
336
- return openBlock(), createElementBlock("view", {
337
- class: normalizeClass(_ctx.containerClasses)
199
+ function Ne(e, n, u, y, v, p) {
200
+ return m(), c("view", {
201
+ class: E(e.containerClasses)
338
202
  }, [
339
- !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(+_ctx.min), 1)) : createCommentVNode("", true),
340
- createElementVNode("view", {
203
+ e.hiddenRange ? $("", !0) : (m(), c("view", he, N(+e.min), 1)),
204
+ M("view", {
341
205
  ref: "root",
342
- style: normalizeStyle(_ctx.wrapperStyle),
343
- class: normalizeClass(_ctx.classes),
344
- onClick: _cache[9] || (_cache[9] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
206
+ style: w(e.wrapperStyle),
207
+ class: E(e.classes),
208
+ onClick: n[9] || (n[9] = g((...a) => e.onClick && e.onClick(...a), ["stop"]))
345
209
  }, [
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", {
210
+ e.marksList.length > 0 ? (m(), c("view", ke, [
211
+ (m(!0), c(F, null, I(e.marksList, (a) => (m(), c("span", {
212
+ key: a,
213
+ class: E(e.markClassName(a)),
214
+ style: w(e.marksStyle(a))
215
+ }, [
216
+ de(N(a) + " ", 1),
217
+ M("span", {
218
+ class: "nut-range-tick",
219
+ style: w(e.tickStyle(a))
220
+ }, null, 4)
221
+ ], 6))), 128))
222
+ ])) : $("", !0),
223
+ M("view", {
362
224
  class: "nut-range-bar",
363
- style: normalizeStyle(_ctx.barStyle)
225
+ style: w(e.barStyle)
364
226
  }, [
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())
227
+ e.range ? (m(), c(F, { key: 0 }, I([0, 1], (a) => M("view", {
228
+ key: a,
229
+ role: "slider",
230
+ class: E({
231
+ "nut-range-button-wrapper-left": a == 0,
232
+ "nut-range-button-wrapper-right": a == 1
233
+ }),
234
+ tabindex: e.disabled ? -1 : 0,
235
+ "aria-valuemin": +e.min,
236
+ "aria-valuenow": e.curValue(a),
237
+ "aria-valuemax": +e.max,
238
+ "aria-orientation": "horizontal",
239
+ onTouchstart: g(
240
+ (i) => {
241
+ typeof a == "number" && (e.buttonIndex = a), e.onTouchStart(i);
242
+ },
243
+ ["stop", "prevent"]
244
+ ),
245
+ onTouchmove: n[0] || (n[0] = g((...i) => e.onTouchMove && e.onTouchMove(...i), ["stop", "prevent"])),
246
+ onTouchend: n[1] || (n[1] = g((...i) => e.onTouchEnd && e.onTouchEnd(...i), ["stop", "prevent"])),
247
+ onTouchcancel: n[2] || (n[2] = g((...i) => e.onTouchEnd && e.onTouchEnd(...i), ["stop", "prevent"])),
248
+ onClick: n[3] || (n[3] = (i) => i.stopPropagation())
249
+ }, [
250
+ e.$slots.button ? J(e.$slots, "button", { key: 0 }) : (m(), c("view", {
251
+ key: 1,
252
+ class: "nut-range-button",
253
+ style: w(e.buttonStyle)
391
254
  }, [
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", {
255
+ e.hiddenTag ? $("", !0) : (m(), c("view", we, N(e.curValue(a)), 1))
256
+ ], 4))
257
+ ], 42, Te)), 64)) : (m(), c("view", {
401
258
  key: 1,
402
259
  role: "slider",
403
260
  class: "nut-range-button-wrapper",
404
- tabindex: _ctx.disabled ? -1 : 0,
405
- "aria-valuemin": +_ctx.min,
406
- "aria-valuenow": _ctx.curValue(),
407
- "aria-valuemax": +_ctx.max,
261
+ tabindex: e.disabled ? -1 : 0,
262
+ "aria-valuemin": +e.min,
263
+ "aria-valuenow": e.curValue(),
264
+ "aria-valuemax": +e.max,
408
265
  "aria-orientation": "horizontal",
409
- onTouchstart: _cache[4] || (_cache[4] = withModifiers(
410
- (e) => {
411
- _ctx.onTouchStart(e);
266
+ onTouchstart: n[4] || (n[4] = g(
267
+ (a) => {
268
+ e.onTouchStart(a);
412
269
  },
413
270
  ["stop", "prevent"]
414
271
  )),
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())
272
+ onTouchmove: n[5] || (n[5] = g((...a) => e.onTouchMove && e.onTouchMove(...a), ["stop", "prevent"])),
273
+ onTouchend: n[6] || (n[6] = g((...a) => e.onTouchEnd && e.onTouchEnd(...a), ["stop", "prevent"])),
274
+ onTouchcancel: n[7] || (n[7] = g((...a) => e.onTouchEnd && e.onTouchEnd(...a), ["stop", "prevent"])),
275
+ onClick: n[8] || (n[8] = (a) => a.stopPropagation())
419
276
  }, [
420
- _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
277
+ e.$slots.button ? J(e.$slots, "button", { key: 0 }) : (m(), c("view", {
421
278
  key: 1,
422
279
  class: "nut-range-button",
423
- style: normalizeStyle(_ctx.buttonStyle)
280
+ style: w(e.buttonStyle)
424
281
  }, [
425
- !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_6, toDisplayString(_ctx.curValue()), 1)) : createCommentVNode("", true)
282
+ e.hiddenTag ? $("", !0) : (m(), c("view", Ce, N(e.curValue()), 1))
426
283
  ], 4))
427
- ], 40, _hoisted_5))
284
+ ], 40, Se))
428
285
  ], 4)
429
286
  ], 6),
430
- !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(+_ctx.max), 1)) : createCommentVNode("", true)
287
+ e.hiddenRange ? $("", !0) : (m(), c("view", Ve, N(+e.max), 1))
431
288
  ], 2);
432
289
  }
433
- const Range = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
290
+ const Oe = /* @__PURE__ */ ve(ye, [["render", Ne]]);
434
291
  export {
435
- Range as default
292
+ Oe as default
436
293
  };