@nutui/nutui 3.1.21 → 3.1.22-beta.5

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 (233) hide show
  1. package/dist/nutui.es.js +4203 -19263
  2. package/dist/nutui.umd.js +4208 -19368
  3. package/dist/packages/_es/ActionSheet.js +17 -167
  4. package/dist/packages/_es/Address.js +110 -552
  5. package/dist/packages/_es/AddressList.js +113 -613
  6. package/dist/packages/_es/Animate.js +22 -0
  7. package/dist/packages/_es/Audio.js +53 -274
  8. package/dist/packages/_es/AudioOperate.js +13 -121
  9. package/dist/packages/_es/Avatar.js +38 -177
  10. package/dist/packages/_es/AvatarGroup.js +14 -73
  11. package/dist/packages/_es/BackTop.js +43 -156
  12. package/dist/packages/_es/Badge.js +14 -86
  13. package/dist/packages/_es/Barrage.js +41 -120
  14. package/dist/packages/_es/Button.js +23 -128
  15. package/dist/packages/_es/Calendar.js +30 -237
  16. package/dist/packages/_es/CalendarItem.js +2 -1
  17. package/dist/packages/_es/Card.js +10 -107
  18. package/dist/packages/_es/Cascader.js +147 -523
  19. package/dist/packages/_es/Category.js +15 -58
  20. package/dist/packages/_es/CategoryPane.js +11 -111
  21. package/dist/packages/_es/Cell.js +21 -100
  22. package/dist/packages/_es/CellGroup.js +9 -44
  23. package/dist/packages/_es/Checkbox.js +31 -113
  24. package/dist/packages/_es/CheckboxGroup.js +29 -58
  25. package/dist/packages/_es/CircleProgress.js +28 -151
  26. package/dist/packages/_es/Col.js +14 -56
  27. package/dist/packages/_es/Collapse.js +32 -84
  28. package/dist/packages/_es/CollapseItem.js +59 -272
  29. package/dist/packages/_es/Comment.js +64 -434
  30. package/dist/packages/_es/ConfigProvider.js +13 -0
  31. package/dist/packages/_es/CountDown.js +56 -256
  32. package/dist/packages/_es/CountUp.js +140 -556
  33. package/dist/packages/_es/DatePicker.js +98 -332
  34. package/dist/packages/_es/Dialog.js +60 -271
  35. package/dist/packages/_es/Divider.js +13 -82
  36. package/dist/packages/_es/Drag.js +56 -197
  37. package/dist/packages/_es/Ecard.js +24 -159
  38. package/dist/packages/_es/Elevator.js +58 -212
  39. package/dist/packages/_es/Ellipsis.js +64 -0
  40. package/dist/packages/_es/Empty.js +12 -71
  41. package/dist/packages/_es/FixedNav.js +15 -122
  42. package/dist/packages/_es/Form.js +64 -151
  43. package/dist/packages/_es/FormItem.js +15 -110
  44. package/dist/packages/_es/Grid.js +5 -6
  45. package/dist/packages/_es/GridItem.js +33 -144
  46. package/dist/packages/_es/Icon.js +15 -40
  47. package/dist/packages/_es/Image.js +31 -0
  48. package/dist/packages/_es/ImagePreview.js +77 -309
  49. package/dist/packages/_es/Indicator.js +15 -62
  50. package/dist/packages/_es/InfiniteLoading.js +57 -268
  51. package/dist/packages/_es/Input.js +51 -413
  52. package/dist/packages/_es/InputNumber.js +41 -160
  53. package/dist/packages/_es/Layout.js +4 -5
  54. package/dist/packages/_es/List.js +18 -124
  55. package/dist/packages/_es/Menu.js +45 -118
  56. package/dist/packages/_es/MenuItem.js +37 -162
  57. package/dist/packages/_es/Navbar.js +30 -192
  58. package/dist/packages/_es/NoticeBar.js +74 -397
  59. package/dist/packages/_es/Notify.js +72 -246
  60. package/dist/packages/_es/NumberKeyboard.js +41 -272
  61. package/dist/packages/_es/OldPicker.js +131 -474
  62. package/dist/packages/_es/OverLay.js +24 -113
  63. package/dist/packages/_es/Pagination.js +39 -157
  64. package/dist/packages/_es/Picker.js +129 -469
  65. package/dist/packages/_es/Popover.js +318 -975
  66. package/dist/packages/_es/Popup.js +55 -313
  67. package/dist/packages/_es/Price.js +16 -118
  68. package/dist/packages/_es/Progress.js +14 -146
  69. package/dist/packages/_es/PullRefresh.js +84 -354
  70. package/dist/packages/_es/Radio.js +22 -90
  71. package/dist/packages/_es/RadioGroup.js +8 -37
  72. package/dist/packages/_es/Range.js +83 -427
  73. package/dist/packages/_es/Rate.js +35 -137
  74. package/dist/packages/_es/Row.js +22 -64
  75. package/dist/packages/_es/SearchBar.js +37 -257
  76. package/dist/packages/_es/ShortPassword.js +35 -225
  77. package/dist/packages/_es/SideNavBar.js +24 -99
  78. package/dist/packages/_es/SideNavBarItem.js +11 -46
  79. package/dist/packages/_es/Signature.js +41 -179
  80. package/dist/packages/_es/Skeleton.js +20 -136
  81. package/dist/packages/_es/Sku.js +84 -509
  82. package/dist/packages/_es/Step.js +20 -133
  83. package/dist/packages/_es/Steps.js +18 -53
  84. package/dist/packages/_es/Sticky.js +53 -138
  85. package/dist/packages/_es/SubSideNavBar.js +17 -100
  86. package/dist/packages/_es/Swipe.js +41 -197
  87. package/dist/packages/_es/Swiper.js +121 -433
  88. package/dist/packages/_es/SwiperItem.js +22 -53
  89. package/dist/packages/_es/Switch.js +21 -116
  90. package/dist/packages/_es/TabPane.js +12 -39
  91. package/dist/packages/_es/Tabbar.js +17 -72
  92. package/dist/packages/_es/TabbarItem.js +29 -151
  93. package/dist/packages/_es/Table.js +18 -196
  94. package/dist/packages/_es/Tabs.js +43 -217
  95. package/dist/packages/_es/Tag.js +20 -97
  96. package/dist/packages/_es/TextArea.js +42 -160
  97. package/dist/packages/_es/TimeDetail.js +18 -98
  98. package/dist/packages/_es/TimePannel.js +14 -66
  99. package/dist/packages/_es/TimeSelect.js +15 -103
  100. package/dist/packages/_es/Toast.js +71 -329
  101. package/dist/packages/_es/Uploader.js +104 -468
  102. package/dist/packages/_es/Video.js +74 -350
  103. package/dist/packages/_es/common.js +38 -128
  104. package/dist/packages/_es/component.js +35 -76
  105. package/dist/packages/_es/index.js +5 -6
  106. package/dist/packages/_es/index2.js +9 -30
  107. package/dist/packages/_es/index3.js +6 -8
  108. package/dist/packages/_es/index4.js +13 -58
  109. package/dist/packages/_es/index5.js +164 -682
  110. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  111. package/dist/packages/_es/pxCheck.js +3 -5
  112. package/dist/packages/_es/raf.js +8 -15
  113. package/dist/packages/animate/index.scss +299 -0
  114. package/dist/packages/button/index.scss +2 -1
  115. package/dist/packages/cell/index.scss +18 -1
  116. package/dist/packages/checkbox/index.scss +16 -0
  117. package/dist/packages/configprovider/index.scss +2 -0
  118. package/dist/packages/dialog/index.scss +1 -0
  119. package/dist/packages/elevator/index.scss +21 -0
  120. package/dist/packages/ellipsis/index.scss +12 -0
  121. package/dist/packages/formitem/index.scss +12 -0
  122. package/dist/packages/griditem/index.scss +11 -0
  123. package/dist/packages/image/index.scss +39 -0
  124. package/dist/packages/imagepreview/index.scss +21 -2
  125. package/dist/packages/input/index.scss +26 -1
  126. package/dist/packages/inputnumber/index.scss +21 -0
  127. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  128. package/dist/packages/locale/lang/baseLang.js +3 -3
  129. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  130. package/dist/packages/locale/lang/en-US.js +5 -97
  131. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  132. package/dist/packages/locale/lang/id-ID.js +5 -97
  133. package/dist/packages/locale/lang/index.js +16 -38
  134. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  135. package/dist/packages/locale/lang/zh-CN.js +5 -97
  136. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  137. package/dist/packages/locale/lang/zh-TW.js +5 -97
  138. package/dist/packages/menu/index.scss +45 -36
  139. package/dist/packages/menuitem/index.scss +4 -0
  140. package/dist/packages/navbar/index.scss +9 -0
  141. package/dist/packages/pagination/index.scss +19 -0
  142. package/dist/packages/radio/index.scss +19 -0
  143. package/dist/packages/range/index.scss +19 -0
  144. package/dist/packages/rate/index.scss +1 -1
  145. package/dist/packages/searchbar/index.scss +21 -0
  146. package/dist/packages/switch/index.scss +4 -3
  147. package/dist/packages/tabbar/index.scss +5 -0
  148. package/dist/packages/tabbaritem/index.scss +7 -0
  149. package/dist/packages/tabpane/index.scss +6 -0
  150. package/dist/packages/tabs/index.scss +22 -0
  151. package/dist/packages/textarea/index.scss +8 -0
  152. package/dist/smartips/attributes.json +192 -12
  153. package/dist/smartips/tags.json +70 -10
  154. package/dist/smartips/web-types.json +6945 -0
  155. package/dist/style.css +1 -1
  156. package/dist/style.es.js +1 -1
  157. package/dist/styles/font/config.json +3 -1
  158. package/dist/styles/font/demo_index.html +49 -3
  159. package/dist/styles/font/iconfont.css +11 -3
  160. package/dist/styles/font/iconfont.js +15 -15
  161. package/dist/styles/font/iconfont.json +14 -0
  162. package/dist/styles/font/iconfont.ttf +0 -0
  163. package/dist/styles/font/iconfont.woff +0 -0
  164. package/dist/styles/font/iconfont.woff2 +0 -0
  165. package/dist/styles/themes/default.scss +54 -50
  166. package/dist/styles/themes/jdb.scss +54 -50
  167. package/dist/styles/themes/jdt.scss +54 -50
  168. package/dist/styles/variables-jdb.scss +19 -1
  169. package/dist/styles/variables-jdt.scss +19 -1
  170. package/dist/styles/variables.scss +22 -1
  171. package/dist/types/__VUE/address/index.vue.d.ts +2 -2
  172. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  173. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  174. package/dist/types/__VUE/animate/type.d.ts +6 -0
  175. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  176. package/dist/types/__VUE/avatar/index.vue.d.ts +7 -7
  177. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/button/index.vue.d.ts +2 -2
  180. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  181. package/dist/types/__VUE/cell/index.vue.d.ts +13 -6
  182. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  183. package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
  184. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  185. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  186. package/dist/types/__VUE/collapse/index.vue.d.ts +5 -3
  187. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  188. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  189. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  190. package/dist/types/__VUE/datepicker/index.vue.d.ts +5 -5
  191. package/dist/types/__VUE/datepicker/type.d.ts +6 -0
  192. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  193. package/dist/types/__VUE/dialog/index.vue.d.ts +26 -17
  194. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  195. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  196. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  197. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  198. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  199. package/dist/types/__VUE/grid/common.d.ts +3 -3
  200. package/dist/types/__VUE/grid/index.vue.d.ts +5 -5
  201. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  202. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  203. package/dist/types/__VUE/image/type.d.ts +6 -0
  204. package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
  205. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  206. package/dist/types/__VUE/input/index.vue.d.ts +4 -4
  207. package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
  208. package/dist/types/__VUE/menuitem/index.vue.d.ts +16 -7
  209. package/dist/types/__VUE/menuitem/type.d.ts +8 -0
  210. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  211. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  212. package/dist/types/__VUE/picker/index.vue.d.ts +1 -1
  213. package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
  214. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  215. package/dist/types/__VUE/rate/common.d.ts +149 -0
  216. package/dist/types/__VUE/rate/index.vue.d.ts +17 -7
  217. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  218. package/dist/types/__VUE/skeleton/common.d.ts +2 -4
  219. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  220. package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
  221. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  222. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  223. package/dist/types/__VUE/tabs/common.d.ts +2 -2
  224. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  225. package/dist/types/__VUE/timeselect/index.vue.d.ts +8 -0
  226. package/dist/types/__VUE/toast/index.vue.d.ts +2 -2
  227. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  228. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  229. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  230. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  231. package/dist/types/index.d.ts +1 -1
  232. package/dist/types/nutui.d.ts +5 -1
  233. package/package.json +7 -3
@@ -1,433 +1,89 @@
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
1
  /*!
21
- * @nutui/nutui v3.1.21 Mon May 30 2022 20:20:01 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
22
3
  * (c) 2022 @jdf2e.
23
4
  * Released under the MIT License.
24
5
  */
25
- import { ref, computed, toRefs, openBlock, createElementBlock, normalizeClass, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle, withModifiers, Fragment, renderList, createTextVNode, renderSlot } from "vue";
26
- import { c as createComponent } from "./component.js";
27
- import { u as useTouch } from "./index4.js";
28
- import { u as useRect } from "./index2.js";
29
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { ref as e, computed as a, toRefs as t, openBlock as n, createElementBlock as o, normalizeClass as r, toDisplayString as l, createCommentVNode as u, createElementVNode as i, normalizeStyle as s, withModifiers as c, Fragment as m, renderList as d, createTextVNode as v, renderSlot as p } from "vue";
7
+ import { c as b } from "./component.js";
8
+ import { u as g } from "./index4.js";
9
+ import { u as h } from "./index2.js";
10
+ import { _ as y } from "./plugin-vue_export-helper.js";
30
11
  import "../locale/lang";
31
- const { componentName, create } = createComponent("range");
32
- const _sfc_main = create({
33
- props: {
34
- range: {
35
- type: Boolean,
36
- default: false
37
- },
38
- disabled: Boolean,
39
- activeColor: String,
40
- inactiveColor: String,
41
- buttonColor: String,
42
- vertical: {
43
- type: Boolean,
44
- default: false
45
- },
46
- marks: {
47
- type: Object,
48
- default: {}
49
- },
50
- hiddenRange: {
51
- type: Boolean,
52
- default: false
53
- },
54
- hiddenTag: {
55
- type: Boolean,
56
- default: false
57
- },
58
- min: {
59
- type: [Number, String],
60
- default: 0
61
- },
62
- max: {
63
- type: [Number, String],
64
- default: 100
65
- },
66
- step: {
67
- type: [Number, String],
68
- default: 1
69
- },
70
- modelValue: {
71
- type: [Number, Array],
72
- default: 0
12
+ const { componentName: k, create: f } = b("range"), T = f({ props: { range: { type: Boolean, default: false }, disabled: Boolean, activeColor: String, inactiveColor: String, buttonColor: String, vertical: { type: Boolean, default: false }, marks: { type: Object, default: {} }, hiddenRange: { type: Boolean, default: false }, hiddenTag: { type: Boolean, default: false }, min: { type: [Number, String], default: 0 }, max: { type: [Number, String], default: 100 }, step: { type: [Number, String], default: 1 }, modelValue: { type: [Number, Array], default: 0 } }, emits: ["change", "drag-end", "drag-start", "update:modelValue"], setup(n2, { emit: o2, slots: r2 }) {
13
+ const l2 = e(0);
14
+ let u2, i2;
15
+ const s2 = e(), c2 = e(), m2 = g(), d2 = a(() => {
16
+ const { marks: e2, max: a2, min: t2 } = n2;
17
+ return Object.keys(e2).map(parseFloat).sort((e3, a3) => e3 - a3).filter((e3) => e3 >= t2 && e3 <= a2);
18
+ }), v2 = a(() => Number(n2.max) - Number(n2.min)), p2 = a(() => {
19
+ const e2 = k;
20
+ return { [e2]: true, [`${e2}-disabled`]: n2.disabled, [`${e2}-vertical`]: n2.vertical, [`${e2}-show-number`]: !n2.hiddenRange };
21
+ }), b2 = a(() => {
22
+ const e2 = "nut-range-container";
23
+ return { [e2]: true, [`${e2}-vertical`]: n2.vertical };
24
+ }), y2 = a(() => ({ background: n2.inactiveColor })), f2 = a(() => ({ borderColor: n2.buttonColor })), T2 = (e2) => !!n2.range && Array.isArray(e2), x2 = () => {
25
+ const { modelValue: e2, min: a2 } = n2;
26
+ return T2(e2) ? 100 * (e2[1] - e2[0]) / v2.value + "%" : 100 * (e2 - Number(a2)) / v2.value + "%";
27
+ }, w2 = () => {
28
+ const { modelValue: e2, min: a2 } = n2;
29
+ return T2(e2) ? 100 * (e2[0] - Number(a2)) / v2.value + "%" : "0%";
30
+ }, S2 = a(() => n2.vertical ? { height: x2(), top: w2(), background: n2.activeColor, transition: c2.value ? "none" : void 0 } : { width: x2(), left: w2(), background: n2.activeColor, transition: c2.value ? "none" : void 0 }), C2 = (e2) => {
31
+ const { min: a2, max: t2, step: o3 } = n2;
32
+ return e2 = Math.max(+a2, Math.min(e2, +t2)), Math.round(e2 / +o3) * +o3;
33
+ }, N2 = (e2, a2) => JSON.stringify(e2) === JSON.stringify(a2), V2 = (e2, a2) => {
34
+ e2 = T2(e2) ? ((e3) => e3[0] > e3[1] ? e3.slice(0).reverse() : e3)(e2).map(C2) : C2(e2), N2(e2, n2.modelValue) || o2("update:modelValue", e2), a2 && !N2(e2, u2) && o2("change", e2);
35
+ };
36
+ return { root: s2, classes: p2, wrapperStyle: y2, buttonStyle: f2, onClick: (e2) => {
37
+ if (n2.disabled)
38
+ return;
39
+ const { min: a2, modelValue: t2 } = n2, o3 = h(s2);
40
+ let r3 = e2.clientX - o3.left, l3 = o3.width;
41
+ n2.vertical && (r3 = e2.clientY - o3.top, l3 = o3.height);
42
+ const u3 = Number(a2) + r3 / l3 * v2.value;
43
+ if (T2(t2)) {
44
+ const [e3, a3] = t2;
45
+ V2(u3 <= (e3 + a3) / 2 ? [u3, a3] : [e3, u3], true);
46
+ } else
47
+ V2(u3, true);
48
+ }, onTouchStart: (e2) => {
49
+ n2.disabled || (m2.start(e2), i2 = n2.modelValue, u2 = T2(i2) ? i2.map(C2) : C2(i2), c2.value = "start");
50
+ }, onTouchMove: (e2) => {
51
+ if (n2.disabled)
52
+ return;
53
+ c2.value === "start" && o2("drag-start"), m2.move(e2), c2.value = "draging";
54
+ const a2 = h(s2);
55
+ let t2 = m2.deltaX.value, r3 = a2.width, d3 = t2 / r3 * v2.value;
56
+ n2.vertical && (t2 = m2.deltaY.value, r3 = a2.height, d3 = t2 / r3 * v2.value), T2(u2) ? i2[l2.value] = u2[l2.value] + d3 : i2 = u2 + d3, V2(i2), e2.stopPropagation(), e2.preventDefault();
57
+ }, onTouchEnd: () => {
58
+ n2.disabled || (c2.value === "draging" && (V2(i2, true), o2("drag-end")), c2.value = "");
59
+ }, ...t(n2), barStyle: S2, curValue: (e2) => typeof e2 == "number" ? n2.modelValue[e2] : n2.modelValue, buttonIndex: l2, containerClasses: b2, markClassName: (e2) => {
60
+ const { modelValue: a2, max: t2, min: o3 } = n2;
61
+ let r3 = Number(o3), l3 = Number(t2);
62
+ if (n2.range) {
63
+ const [e3, t3] = a2;
64
+ r3 = e3, l3 = t3;
65
+ } else
66
+ l3 = a2;
67
+ return { "nut-range-mark-text": true, "nut-range-mark-text-active": e2 <= l3 && e2 >= r3 };
68
+ }, marksStyle: (e2) => {
69
+ const { max: a2, min: t2, vertical: o3 } = n2;
70
+ let r3 = { left: (e2 - Number(t2)) / v2.value * 100 + "%" };
71
+ return o3 && (r3 = { top: (e2 - Number(t2)) / v2.value * 100 + "%" }), r3;
72
+ }, marksList: d2, tickStyle: (e2) => {
73
+ const { modelValue: a2, max: t2, min: o3 } = n2;
74
+ let r3 = Number(o3), l3 = Number(t2);
75
+ if (n2.range) {
76
+ const [e3, t3] = a2;
77
+ r3 = e3, l3 = t3;
73
78
  }
74
- },
75
- emits: ["change", "drag-end", "drag-start", "update:modelValue"],
76
- setup(props, { emit, slots }) {
77
- const buttonIndex = ref(0);
78
- let startValue;
79
- let currentValue;
80
- const root = ref();
81
- const dragStatus = ref();
82
- const touch = useTouch();
83
- const marksList = computed(() => {
84
- const { marks, max, min } = props;
85
- const marksKeys = Object.keys(marks);
86
- const list = marksKeys.map(parseFloat).sort((a, b) => a - b).filter((point) => point >= min && point <= max);
87
- return list;
88
- });
89
- const scope = computed(() => Number(props.max) - Number(props.min));
90
- const classes = computed(() => {
91
- const prefixCls = componentName;
92
- return {
93
- [prefixCls]: true,
94
- [`${prefixCls}-disabled`]: props.disabled,
95
- [`${prefixCls}-vertical`]: props.vertical,
96
- [`${prefixCls}-show-number`]: !props.hiddenRange
97
- };
98
- });
99
- const containerClasses = computed(() => {
100
- const prefixCls = "nut-range-container";
101
- return {
102
- [prefixCls]: true,
103
- [`${prefixCls}-vertical`]: props.vertical
104
- };
105
- });
106
- const wrapperStyle = computed(() => {
107
- return {
108
- background: props.inactiveColor
109
- };
110
- });
111
- const buttonStyle = computed(() => {
112
- return {
113
- borderColor: props.buttonColor
114
- };
115
- });
116
- const isRange = (val) => !!props.range && Array.isArray(val);
117
- const calcMainAxis = () => {
118
- const { modelValue, min } = props;
119
- if (isRange(modelValue)) {
120
- return `${(modelValue[1] - modelValue[0]) * 100 / scope.value}%`;
121
- }
122
- return `${(modelValue - Number(min)) * 100 / scope.value}%`;
123
- };
124
- const calcOffset = () => {
125
- const { modelValue, min } = props;
126
- if (isRange(modelValue)) {
127
- return `${(modelValue[0] - Number(min)) * 100 / scope.value}%`;
128
- }
129
- return `0%`;
130
- };
131
- const barStyle = computed(() => {
132
- if (props.vertical) {
133
- return {
134
- height: calcMainAxis(),
135
- top: calcOffset(),
136
- background: props.activeColor,
137
- transition: dragStatus.value ? "none" : void 0
138
- };
139
- } else {
140
- return {
141
- width: calcMainAxis(),
142
- left: calcOffset(),
143
- background: props.activeColor,
144
- transition: dragStatus.value ? "none" : void 0
145
- };
146
- }
147
- });
148
- const markClassName = (mark) => {
149
- const classPrefix = "nut-range-mark";
150
- const { modelValue, max, min } = props;
151
- let lowerBound = Number(min);
152
- let upperBound = Number(max);
153
- if (props.range) {
154
- const [left, right] = modelValue;
155
- lowerBound = left;
156
- upperBound = right;
157
- } else {
158
- upperBound = modelValue;
159
- }
160
- let isActive = mark <= upperBound && mark >= lowerBound;
161
- return {
162
- [`${classPrefix}-text`]: true,
163
- [`${classPrefix}-text-active`]: isActive
164
- };
165
- };
166
- const marksStyle = (mark) => {
167
- const { max, min, vertical } = props;
168
- let style = {
169
- left: `${(mark - Number(min)) / scope.value * 100}%`
170
- };
171
- if (vertical) {
172
- style = {
173
- top: `${(mark - Number(min)) / scope.value * 100}%`
174
- };
175
- }
176
- return style;
177
- };
178
- const tickStyle = (mark) => {
179
- const { modelValue, max, min } = props;
180
- let lowerBound = Number(min);
181
- let upperBound = Number(max);
182
- if (props.range) {
183
- const [left, right] = modelValue;
184
- lowerBound = left;
185
- upperBound = right;
186
- }
187
- let isActive = mark <= upperBound && mark >= lowerBound;
188
- let style = {
189
- background: !isActive ? props.inactiveColor : props.activeColor
190
- };
191
- return style;
192
- };
193
- const format = (value) => {
194
- const { min, max, step } = props;
195
- value = Math.max(+min, Math.min(value, +max));
196
- return Math.round(value / +step) * +step;
197
- };
198
- const isSameValue = (newValue, oldValue) => JSON.stringify(newValue) === JSON.stringify(oldValue);
199
- const handleOverlap = (value) => {
200
- if (value[0] > value[1]) {
201
- return value.slice(0).reverse();
202
- }
203
- return value;
204
- };
205
- const updateValue = (value, end) => {
206
- if (isRange(value)) {
207
- value = handleOverlap(value).map(format);
208
- } else {
209
- value = format(value);
210
- }
211
- if (!isSameValue(value, props.modelValue)) {
212
- emit("update:modelValue", value);
213
- }
214
- if (end && !isSameValue(value, startValue)) {
215
- emit("change", value);
216
- }
217
- };
218
- const onClick = (event) => {
219
- if (props.disabled) {
220
- return;
221
- }
222
- const { min, modelValue } = props;
223
- const rect = useRect(root);
224
- let delta = event.clientX - rect.left;
225
- let total = rect.width;
226
- if (props.vertical) {
227
- delta = event.clientY - rect.top;
228
- total = rect.height;
229
- }
230
- const value = Number(min) + delta / total * scope.value;
231
- if (isRange(modelValue)) {
232
- const [left, right] = modelValue;
233
- const middle = (left + right) / 2;
234
- if (value <= middle) {
235
- updateValue([value, right], true);
236
- } else {
237
- updateValue([left, value], true);
238
- }
239
- } else {
240
- updateValue(value, true);
241
- }
242
- };
243
- const onTouchStart = (event) => {
244
- if (props.disabled) {
245
- return;
246
- }
247
- touch.start(event);
248
- currentValue = props.modelValue;
249
- if (isRange(currentValue)) {
250
- startValue = currentValue.map(format);
251
- } else {
252
- startValue = format(currentValue);
253
- }
254
- dragStatus.value = "start";
255
- };
256
- const onTouchMove = (event) => {
257
- if (props.disabled) {
258
- return;
259
- }
260
- if (dragStatus.value === "start") {
261
- emit("drag-start");
262
- }
263
- touch.move(event);
264
- dragStatus.value = "draging";
265
- const rect = useRect(root);
266
- let delta = touch.deltaX.value;
267
- let total = rect.width;
268
- let diff = delta / total * scope.value;
269
- if (props.vertical) {
270
- delta = touch.deltaY.value;
271
- total = rect.height;
272
- diff = delta / total * scope.value;
273
- }
274
- if (isRange(startValue)) {
275
- currentValue[buttonIndex.value] = startValue[buttonIndex.value] + diff;
276
- } else {
277
- currentValue = startValue + diff;
278
- }
279
- updateValue(currentValue);
280
- event.stopPropagation();
281
- event.preventDefault();
282
- };
283
- const onTouchEnd = () => {
284
- if (props.disabled) {
285
- return;
286
- }
287
- if (dragStatus.value === "draging") {
288
- updateValue(currentValue, true);
289
- emit("drag-end");
290
- }
291
- dragStatus.value = "";
292
- };
293
- const curValue = (idx) => {
294
- const value = typeof idx === "number" ? props.modelValue[idx] : props.modelValue;
295
- return value;
296
- };
297
- return __spreadProps(__spreadValues({
298
- root,
299
- classes,
300
- wrapperStyle,
301
- buttonStyle,
302
- onClick,
303
- onTouchStart,
304
- onTouchMove,
305
- onTouchEnd
306
- }, toRefs(props)), {
307
- barStyle,
308
- curValue,
309
- buttonIndex,
310
- containerClasses,
311
- markClassName,
312
- marksStyle,
313
- marksList,
314
- tickStyle
315
- });
316
- }
317
- });
318
- const _hoisted_1 = {
319
- key: 0,
320
- class: "min"
321
- };
322
- const _hoisted_2 = {
323
- key: 0,
324
- class: "nut-range-mark"
325
- };
326
- const _hoisted_3 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
327
- const _hoisted_4 = {
328
- key: 0,
329
- class: "number"
330
- };
331
- const _hoisted_5 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
332
- const _hoisted_6 = {
333
- key: 0,
334
- class: "number"
335
- };
336
- const _hoisted_7 = {
337
- key: 1,
338
- class: "max"
339
- };
340
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
341
- return openBlock(), createElementBlock("view", {
342
- class: normalizeClass(_ctx.containerClasses)
343
- }, [
344
- !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(+_ctx.min), 1)) : createCommentVNode("", true),
345
- createElementVNode("view", {
346
- ref: "root",
347
- style: normalizeStyle(_ctx.wrapperStyle),
348
- class: normalizeClass(_ctx.classes),
349
- onClick: _cache[9] || (_cache[9] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
350
- }, [
351
- _ctx.marksList.length > 0 ? (openBlock(), createElementBlock("view", _hoisted_2, [
352
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.marksList, (marks) => {
353
- return openBlock(), createElementBlock("span", {
354
- key: marks,
355
- class: normalizeClass(_ctx.markClassName(marks)),
356
- style: normalizeStyle(_ctx.marksStyle(marks))
357
- }, [
358
- createTextVNode(toDisplayString(marks) + " ", 1),
359
- createElementVNode("span", {
360
- class: "nut-range-tick",
361
- style: normalizeStyle(_ctx.tickStyle(marks))
362
- }, null, 4)
363
- ], 6);
364
- }), 128))
365
- ])) : createCommentVNode("", true),
366
- createElementVNode("view", {
367
- class: "nut-range-bar",
368
- style: normalizeStyle(_ctx.barStyle)
369
- }, [
370
- _ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index2) => {
371
- return createElementVNode("view", {
372
- key: index2,
373
- role: "slider",
374
- class: normalizeClass({
375
- "nut-range-button-wrapper-left": index2 == 0,
376
- "nut-range-button-wrapper-right": index2 == 1
377
- }),
378
- tabindex: _ctx.disabled ? -1 : 0,
379
- "aria-valuemin": +_ctx.min,
380
- "aria-valuenow": _ctx.curValue(index2),
381
- "aria-valuemax": +_ctx.max,
382
- "aria-orientation": "horizontal",
383
- onTouchstart: withModifiers((e) => {
384
- if (typeof index2 === "number") {
385
- _ctx.buttonIndex = index2;
386
- }
387
- _ctx.onTouchStart(e);
388
- }, ["stop", "prevent"]),
389
- onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args), ["stop", "prevent"])),
390
- onTouchend: _cache[1] || (_cache[1] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
391
- onTouchcancel: _cache[2] || (_cache[2] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
392
- onClick: _cache[3] || (_cache[3] = (e) => e.stopPropagation())
393
- }, [
394
- _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
395
- key: 1,
396
- class: "nut-range-button",
397
- style: normalizeStyle(_ctx.buttonStyle)
398
- }, [
399
- !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.curValue(index2)), 1)) : createCommentVNode("", true)
400
- ], 4))
401
- ], 42, _hoisted_3);
402
- }), 64)) : (openBlock(), createElementBlock("view", {
403
- key: 1,
404
- role: "slider",
405
- class: "nut-range-button-wrapper",
406
- tabindex: _ctx.disabled ? -1 : 0,
407
- "aria-valuemin": +_ctx.min,
408
- "aria-valuenow": _ctx.curValue(),
409
- "aria-valuemax": +_ctx.max,
410
- "aria-orientation": "horizontal",
411
- onTouchstart: _cache[4] || (_cache[4] = withModifiers((e) => {
412
- _ctx.onTouchStart(e);
413
- }, ["stop", "prevent"])),
414
- onTouchmove: _cache[5] || (_cache[5] = withModifiers((...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args), ["stop", "prevent"])),
415
- onTouchend: _cache[6] || (_cache[6] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
416
- onTouchcancel: _cache[7] || (_cache[7] = withModifiers((...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args), ["stop", "prevent"])),
417
- onClick: _cache[8] || (_cache[8] = (e) => e.stopPropagation())
418
- }, [
419
- _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", { key: 0 }) : (openBlock(), createElementBlock("view", {
420
- key: 1,
421
- class: "nut-range-button",
422
- style: normalizeStyle(_ctx.buttonStyle)
423
- }, [
424
- !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_6, toDisplayString(_ctx.curValue()), 1)) : createCommentVNode("", true)
425
- ], 4))
426
- ], 40, _hoisted_5))
427
- ], 4)
428
- ], 6),
429
- !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(+_ctx.max), 1)) : createCommentVNode("", true)
430
- ], 2);
431
- }
432
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
433
- export { index as default };
79
+ return { background: e2 <= l3 && e2 >= r3 ? n2.activeColor : n2.inactiveColor };
80
+ } };
81
+ } }), x = { key: 0, class: "min" }, w = { key: 0, class: "nut-range-mark" }, S = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"], C = { key: 0, class: "number" }, N = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"], V = { key: 0, class: "number" }, E = { key: 1, class: "max" };
82
+ var M = y(T, [["render", function(e2, a2, t2, b2, g2, h2) {
83
+ return n(), o("view", { class: r(e2.containerClasses) }, [e2.hiddenRange ? u("", true) : (n(), o("view", x, l(+e2.min), 1)), i("view", { ref: "root", style: s(e2.wrapperStyle), class: r(e2.classes), onClick: a2[9] || (a2[9] = c((...a3) => e2.onClick && e2.onClick(...a3), ["stop"])) }, [e2.marksList.length > 0 ? (n(), o("view", w, [(n(true), o(m, null, d(e2.marksList, (a3) => (n(), o("span", { key: a3, class: r(e2.markClassName(a3)), style: s(e2.marksStyle(a3)) }, [v(l(a3) + " ", 1), i("span", { class: "nut-range-tick", style: s(e2.tickStyle(a3)) }, null, 4)], 6))), 128))])) : u("", true), i("view", { class: "nut-range-bar", style: s(e2.barStyle) }, [e2.range ? (n(), o(m, { key: 0 }, d([0, 1], (t3) => i("view", { key: t3, role: "slider", class: r({ "nut-range-button-wrapper-left": t3 == 0, "nut-range-button-wrapper-right": t3 == 1 }), tabindex: e2.disabled ? -1 : 0, "aria-valuemin": +e2.min, "aria-valuenow": e2.curValue(t3), "aria-valuemax": +e2.max, "aria-orientation": "horizontal", onTouchstart: c((a3) => {
84
+ typeof t3 == "number" && (e2.buttonIndex = t3), e2.onTouchStart(a3);
85
+ }, ["stop", "prevent"]), onTouchmove: a2[0] || (a2[0] = c((...a3) => e2.onTouchMove && e2.onTouchMove(...a3), ["stop", "prevent"])), onTouchend: a2[1] || (a2[1] = c((...a3) => e2.onTouchEnd && e2.onTouchEnd(...a3), ["stop", "prevent"])), onTouchcancel: a2[2] || (a2[2] = c((...a3) => e2.onTouchEnd && e2.onTouchEnd(...a3), ["stop", "prevent"])), onClick: a2[3] || (a2[3] = (e3) => e3.stopPropagation()) }, [e2.$slots.button ? p(e2.$slots, "button", { key: 0 }) : (n(), o("view", { key: 1, class: "nut-range-button", style: s(e2.buttonStyle) }, [e2.hiddenTag ? u("", true) : (n(), o("view", C, l(e2.curValue(t3)), 1))], 4))], 42, S)), 64)) : (n(), o("view", { key: 1, role: "slider", class: "nut-range-button-wrapper", tabindex: e2.disabled ? -1 : 0, "aria-valuemin": +e2.min, "aria-valuenow": e2.curValue(), "aria-valuemax": +e2.max, "aria-orientation": "horizontal", onTouchstart: a2[4] || (a2[4] = c((a3) => {
86
+ e2.onTouchStart(a3);
87
+ }, ["stop", "prevent"])), onTouchmove: a2[5] || (a2[5] = c((...a3) => e2.onTouchMove && e2.onTouchMove(...a3), ["stop", "prevent"])), onTouchend: a2[6] || (a2[6] = c((...a3) => e2.onTouchEnd && e2.onTouchEnd(...a3), ["stop", "prevent"])), onTouchcancel: a2[7] || (a2[7] = c((...a3) => e2.onTouchEnd && e2.onTouchEnd(...a3), ["stop", "prevent"])), onClick: a2[8] || (a2[8] = (e3) => e3.stopPropagation()) }, [e2.$slots.button ? p(e2.$slots, "button", { key: 0 }) : (n(), o("view", { key: 1, class: "nut-range-button", style: s(e2.buttonStyle) }, [e2.hiddenTag ? u("", true) : (n(), o("view", V, l(e2.curValue()), 1))], 4))], 40, N))], 4)], 6), e2.hiddenRange ? u("", true) : (n(), o("view", E, l(+e2.max), 1))], 2);
88
+ }]]);
89
+ export { M as default };