@nutui/nutui 4.0.0 → 4.0.1-2.beta-1

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