@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,479 +1,139 @@
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, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, onBeforeUnmount, resolveComponent, createVNode, withCtx, renderSlot } from "vue";
26
- import { c as createComponent } from "./component.js";
27
- import Popup, { popupProps } from "./Popup.js";
28
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { ref as e, reactive as t, computed as l, watch as n, onMounted as a, toRefs as o, openBlock as r, createElementBlock as s, createElementVNode as c, normalizeStyle as i, Fragment as u, renderList as m, normalizeClass as p, toDisplayString as d, createCommentVNode as h, onBeforeUnmount as v, resolveComponent as f, createVNode as g, withCtx as y, renderSlot as k } from "vue";
7
+ import { c as S } from "./component.js";
8
+ import T, { popupProps as w } from "./Popup.js";
9
+ import { _ } from "./plugin-vue_export-helper.js";
29
10
  import "../locale/lang";
30
11
  import "./OverLay.js";
31
12
  import "./Icon.js";
32
13
  import "./pxCheck.js";
33
- const { create: create$1 } = createComponent("picker-column");
34
- const _sfc_main$1 = create$1({
35
- props: {
36
- value: [String, Number],
37
- columnsType: String,
38
- itemShow: {
39
- type: Boolean,
40
- default: false
41
- },
42
- column: {
43
- type: Array,
44
- default: () => []
45
- },
46
- readonly: {
47
- type: Boolean,
48
- default: false
14
+ const { create: b } = S("picker-column"), x = b({ props: { value: [String, Number], columnsType: String, itemShow: { type: Boolean, default: false }, column: { type: Array, default: () => [] }, readonly: { type: Boolean, default: false } }, emits: ["click", "change"], setup(r2, { emit: s2 }) {
15
+ const c2 = e(), i2 = t({ touchParams: { startY: 0, endY: 0, startTime: 0, endTime: 0, lastY: 0, lastTime: 0 }, currIndex: 1, transformY: 0, scrollDistance: 0, lineSpacing: 36, rotation: 20, timer: null }), u2 = e(null), m2 = e(null), p2 = e(null), d2 = e(0), h2 = e(0), v2 = e(0), f2 = l(() => ({ transition: `transform ${h2.value}ms cubic-bezier(0.19, 1, 0.22, 1)`, transform: `translate3d(0, ${i2.scrollDistance}px, 0)` })), g2 = l(() => ({ transition: `transform ${h2.value}ms cubic-bezier(0.19, 1, 0.22, 1)`, transform: `rotate3d(1, 0, 0, ${d2.value})` })), y2 = (e2 = 0, t2, l2 = 1e3, n2) => {
16
+ h2.value = t2 === "end" ? l2 : 0, d2.value = n2, v2.value = e2, i2.scrollDistance = e2;
17
+ }, k2 = (e2, t2, l2) => {
18
+ let n2 = e2 + i2.transformY;
19
+ if (t2 === "end") {
20
+ n2 > 0 && (n2 = 0), n2 < -(r2.column.length - 1) * i2.lineSpacing && (n2 = -(r2.column.length - 1) * i2.lineSpacing);
21
+ let e3 = Math.round(n2 / i2.lineSpacing) * i2.lineSpacing, a2 = (Math.abs(Math.round(e3 / i2.lineSpacing)) + 1) * i2.rotation + "deg";
22
+ y2(e3, t2, l2, a2);
23
+ let o2 = l2 ? l2 / 2 : 0;
24
+ i2.timer = setTimeout(() => {
25
+ S2();
26
+ }, o2), i2.currIndex = Math.abs(Math.round(e3 / i2.lineSpacing)) + 1;
27
+ } else {
28
+ let e3 = "0deg";
29
+ e3 = n2 < 0 ? (Math.abs(n2 / i2.lineSpacing) + 1) * i2.rotation + "deg" : (-n2 / i2.lineSpacing + 1) * i2.rotation + "deg", y2(n2, null, void 0, e3), i2.currIndex = Math.abs(Math.round(n2 / i2.lineSpacing)) + 1;
30
+ }
31
+ }, S2 = () => {
32
+ s2("change", r2.column[i2.currIndex - 1]);
33
+ }, T2 = (e2) => {
34
+ const { column: t2 } = r2;
35
+ let l2 = t2.findIndex((e3) => e3.value == r2.value);
36
+ i2.currIndex = l2 === -1 ? 1 : l2 + 1;
37
+ let n2 = l2 === -1 ? 0 : l2 * i2.lineSpacing;
38
+ e2 && S2(), k2(-n2);
39
+ };
40
+ return n(() => r2.column, (e2) => {
41
+ i2.transformY = 0, T2(false);
42
+ }, { deep: true }), n(() => r2.value, (e2) => {
43
+ T2(true);
44
+ }, { deep: true }), a(() => {
45
+ T2(true);
46
+ }), { ...o(i2), ...o(r2), wrapper: c2, setRollerStyle: (e2) => `transform: rotate3d(1, 0, 0, ${-i2.rotation * e2}deg) translate3d(0px, 0px, 104px)`, isHidden: (e2) => e2 >= i2.currIndex + 8 || e2 <= i2.currIndex - 8, roller: u2, list: m2, listItem: p2, onTouchStart: (e2) => {
47
+ e2.preventDefault();
48
+ let t2 = e2.changedTouches[0];
49
+ i2.touchParams.startY = t2.pageY, i2.touchParams.startTime = e2.timeStamp || Date.now(), i2.transformY = i2.scrollDistance;
50
+ }, onTouchMove: (e2) => {
51
+ e2.preventDefault();
52
+ let t2 = e2.changedTouches[0];
53
+ i2.touchParams.lastY = t2.pageY, i2.touchParams.lastTime = e2.timeStamp || Date.now();
54
+ let l2 = i2.touchParams.lastY - i2.touchParams.startY;
55
+ k2(l2);
56
+ }, onTouchEnd: (e2) => {
57
+ e2.preventDefault();
58
+ let t2 = e2.changedTouches[0];
59
+ i2.touchParams.lastY = t2.pageY, i2.touchParams.lastTime = e2.timeStamp || Date.now();
60
+ let l2 = i2.touchParams.lastY - i2.touchParams.startY, n2 = i2.touchParams.lastTime - i2.touchParams.startTime;
61
+ n2 <= 300 ? (l2 *= 2, n2 += 1e3, k2(l2, "end", n2)) : k2(l2, "end");
62
+ }, touchRollerStyle: g2, touchListStyle: f2, setMove: k2 };
63
+ } }), Y = { class: "nut-picker-content" }, P = { key: 0, class: "nut-picker-placeholder" };
64
+ var C = _(x, [["render", function(e2, t2, l2, n2, a2, o2) {
65
+ return r(), s("view", { class: "nut-picker__list", onTouchstart: t2[0] || (t2[0] = (...t3) => e2.onTouchStart && e2.onTouchStart(...t3)), onTouchmove: t2[1] || (t2[1] = (...t3) => e2.onTouchMove && e2.onTouchMove(...t3)), onTouchend: t2[2] || (t2[2] = (...t3) => e2.onTouchEnd && e2.onTouchEnd(...t3)) }, [c("view", { class: "nut-picker-roller", ref: "roller", style: i(e2.touchRollerStyle) }, [(r(true), s(u, null, m(e2.column, (t3, l3) => (r(), s("view", { class: p(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": e2.isHidden(l3 + 1) }]), style: i(e2.setRollerStyle(l3 + 1)), key: t3.value ? t3.value : l3 }, d(t3.text), 7))), 128))], 4), c("view", Y, [c("view", { class: "nut-picker-list-panel", ref: "list", style: i(e2.touchListStyle) }, [(r(true), s(u, null, m(e2.column, (e3, t3) => (r(), s("view", { class: p(["nut-picker-item", "nut-picker-item-ref", e3.className]), key: e3.value ? e3.value : t3 }, d(e3.text), 3))), 128)), e2.column && e2.column.length === 1 ? (r(), s("view", P)) : h("", true)], 4)])], 32);
66
+ }]]);
67
+ const { componentName: I, create: M, translate: O } = S("picker"), D = M({ components: { [C.name]: C, [T.name]: T }, props: { ...w, modelValue: { type: Array, default: () => [] }, title: { type: String, default: "" }, cancelText: { type: String, default: "" }, okText: { type: String, default: "" }, columns: { type: Array, default: () => [] }, readonly: { type: Boolean, default: false } }, emits: ["close", "change", "confirm", "update:visible", "update:modelValue"], setup(r2, { emit: s2 }) {
68
+ const c2 = t({ show: false, formattedColumns: r2.columns });
69
+ let i2 = e(r2.modelValue);
70
+ const u2 = l(() => ({ [I]: true })), m2 = l(() => {
71
+ let e2 = [];
72
+ return d2.value.map((t2, l2) => {
73
+ let n2 = [];
74
+ n2 = t2.filter((e3) => e3.value == i2.value[l2]), e2.push(n2[0]);
75
+ }), e2;
76
+ }), p2 = l(() => {
77
+ const e2 = c2.formattedColumns[0];
78
+ if (e2) {
79
+ if (Array.isArray(e2))
80
+ return "multiple";
81
+ if ("children" in e2)
82
+ return "cascade";
83
+ }
84
+ return "single";
85
+ }), d2 = l(() => {
86
+ switch (p2.value) {
87
+ case "multiple":
88
+ return c2.formattedColumns;
89
+ case "cascade":
90
+ return h2(c2.formattedColumns, i2.value);
91
+ default:
92
+ return [c2.formattedColumns];
93
+ }
94
+ }), h2 = (e2, t2) => {
95
+ const l2 = [];
96
+ let n2 = { text: "", value: "", children: e2 }, a2 = 0;
97
+ for (; n2 && n2.children; ) {
98
+ const e3 = n2.children, o2 = t2[a2];
99
+ let r3 = e3.findIndex((e4) => e4.value == o2);
100
+ r3 == -1 && (r3 = 0), n2 = n2.children[r3], a2++, l2.push(e3);
49
101
  }
50
- },
51
- emits: ["click", "change"],
52
- setup(props, { emit }) {
53
- const wrapper = ref();
54
- const state = reactive({
55
- touchParams: {
56
- startY: 0,
57
- endY: 0,
58
- startTime: 0,
59
- endTime: 0,
60
- lastY: 0,
61
- lastTime: 0
62
- },
63
- currIndex: 1,
64
- transformY: 0,
65
- scrollDistance: 0,
66
- lineSpacing: 36,
67
- rotation: 20,
68
- timer: null
69
- });
70
- const roller = ref(null);
71
- const list = ref(null);
72
- const listItem = ref(null);
73
- const touchDeg = ref(0);
74
- const touchTime = ref(0);
75
- const touchTranslateY = ref(0);
76
- const touchListStyle = computed(() => {
77
- return {
78
- transition: `transform ${touchTime.value}ms cubic-bezier(0.19, 1, 0.22, 1)`,
79
- transform: `translate3d(0, ${state.scrollDistance}px, 0)`
80
- };
81
- });
82
- const touchRollerStyle = computed(() => {
83
- return {
84
- transition: `transform ${touchTime.value}ms cubic-bezier(0.19, 1, 0.22, 1)`,
85
- transform: `rotate3d(1, 0, 0, ${touchDeg.value})`
86
- };
87
- });
88
- const onTouchStart = (event) => {
89
- event.preventDefault();
90
- let changedTouches = event.changedTouches[0];
91
- state.touchParams.startY = changedTouches.pageY;
92
- state.touchParams.startTime = event.timeStamp || Date.now();
93
- state.transformY = state.scrollDistance;
94
- };
95
- const onTouchMove = (event) => {
96
- event.preventDefault();
97
- let changedTouches = event.changedTouches[0];
98
- state.touchParams.lastY = changedTouches.pageY;
99
- state.touchParams.lastTime = event.timeStamp || Date.now();
100
- let move = state.touchParams.lastY - state.touchParams.startY;
101
- setMove(move);
102
- };
103
- const onTouchEnd = (event) => {
104
- event.preventDefault();
105
- let changedTouches = event.changedTouches[0];
106
- state.touchParams.lastY = changedTouches.pageY;
107
- state.touchParams.lastTime = event.timeStamp || Date.now();
108
- let move = state.touchParams.lastY - state.touchParams.startY;
109
- let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
110
- if (moveTime <= 300) {
111
- move = move * 2;
112
- moveTime = moveTime + 1e3;
113
- setMove(move, "end", moveTime);
114
- } else {
115
- setMove(move, "end");
116
- }
117
- };
118
- const setRollerStyle = (index) => {
119
- return `transform: rotate3d(1, 0, 0, ${-state.rotation * index}deg) translate3d(0px, 0px, 104px)`;
120
- };
121
- const isHidden = (index) => {
122
- if (index >= state.currIndex + 8 || index <= state.currIndex - 8) {
123
- return true;
124
- } else {
125
- return false;
126
- }
127
- };
128
- const setTransform = (translateY = 0, type, time = 1e3, deg) => {
129
- if (type === "end") {
130
- touchTime.value = time;
131
- } else {
132
- touchTime.value = 0;
133
- }
134
- touchDeg.value = deg;
135
- touchTranslateY.value = translateY;
136
- state.scrollDistance = translateY;
137
- };
138
- const setMove = (move, type, time) => {
139
- let updateMove = move + state.transformY;
140
- if (type === "end") {
141
- if (updateMove > 0) {
142
- updateMove = 0;
143
- }
144
- if (updateMove < -(props.column.length - 1) * state.lineSpacing) {
145
- updateMove = -(props.column.length - 1) * state.lineSpacing;
146
- }
147
- let endMove = Math.round(updateMove / state.lineSpacing) * state.lineSpacing;
148
- let deg = `${(Math.abs(Math.round(endMove / state.lineSpacing)) + 1) * state.rotation}deg`;
149
- setTransform(endMove, type, time, deg);
150
- let t = time ? time / 2 : 0;
151
- state.timer = setTimeout(() => {
152
- setChooseValue();
153
- }, t);
154
- state.currIndex = Math.abs(Math.round(endMove / state.lineSpacing)) + 1;
155
- } else {
156
- let deg = "0deg";
157
- if (updateMove < 0) {
158
- deg = `${(Math.abs(updateMove / state.lineSpacing) + 1) * state.rotation}deg`;
159
- } else {
160
- deg = `${(-updateMove / state.lineSpacing + 1) * state.rotation}deg`;
161
- }
162
- setTransform(updateMove, null, void 0, deg);
163
- state.currIndex = Math.abs(Math.round(updateMove / state.lineSpacing)) + 1;
164
- }
165
- };
166
- const setChooseValue = () => {
167
- emit("change", props.column[state.currIndex - 1]);
168
- };
169
- const modifyStatus = (type) => {
170
- const { column: column2 } = props;
171
- let index = column2.findIndex((columnItem) => columnItem.value == props.value);
172
- state.currIndex = index === -1 ? 1 : index + 1;
173
- let move = index === -1 ? 0 : index * state.lineSpacing;
174
- type && setChooseValue();
175
- setMove(-move);
176
- };
177
- watch(() => props.column, (val) => {
178
- state.transformY = 0;
179
- modifyStatus(false);
180
- }, {
181
- deep: true
182
- });
183
- onMounted(() => {
184
- modifyStatus(true);
185
- });
186
- return __spreadProps(__spreadValues(__spreadValues({}, toRefs(state)), toRefs(props)), {
187
- wrapper,
188
- setRollerStyle,
189
- isHidden,
190
- roller,
191
- list,
192
- listItem,
193
- onTouchStart,
194
- onTouchMove,
195
- onTouchEnd,
196
- touchRollerStyle,
197
- touchListStyle,
198
- setMove
199
- });
200
- }
201
- });
202
- const _hoisted_1$1 = { class: "nut-picker-content" };
203
- const _hoisted_2$1 = {
204
- key: 0,
205
- class: "nut-picker-placeholder"
206
- };
207
- function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
208
- return openBlock(), createElementBlock("view", {
209
- class: "nut-picker__list",
210
- onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
211
- onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
212
- onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
213
- }, [
214
- createElementVNode("view", {
215
- class: "nut-picker-roller",
216
- ref: "roller",
217
- style: normalizeStyle(_ctx.touchRollerStyle)
218
- }, [
219
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
220
- return openBlock(), createElementBlock("view", {
221
- class: normalizeClass(["nut-picker-roller-item", { "nut-picker-roller-item-hidden": _ctx.isHidden(index + 1) }]),
222
- style: normalizeStyle(_ctx.setRollerStyle(index + 1)),
223
- key: item.value ? item.value : index
224
- }, toDisplayString(item.text), 7);
225
- }), 128))
226
- ], 4),
227
- createElementVNode("view", _hoisted_1$1, [
228
- createElementVNode("view", {
229
- class: "nut-picker-list-panel",
230
- ref: "list",
231
- style: normalizeStyle(_ctx.touchListStyle)
232
- }, [
233
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.column, (item, index) => {
234
- return openBlock(), createElementBlock("view", {
235
- class: normalizeClass(["nut-picker-item", "nut-picker-item-ref", item.className]),
236
- key: item.value ? item.value : index
237
- }, toDisplayString(item.text), 3);
238
- }), 128)),
239
- _ctx.column && _ctx.column.length === 1 ? (openBlock(), createElementBlock("view", _hoisted_2$1)) : createCommentVNode("", true)
240
- ], 4)
241
- ])
242
- ], 32);
243
- }
244
- var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
245
- const { componentName, create, translate } = createComponent("picker");
246
- const _sfc_main = create({
247
- components: {
248
- [column.name]: column,
249
- [Popup.name]: Popup
250
- },
251
- props: __spreadProps(__spreadValues({}, popupProps), {
252
- modelValue: {
253
- type: Array,
254
- default: () => []
255
- },
256
- title: {
257
- type: String,
258
- default: ""
259
- },
260
- cancelText: {
261
- type: String,
262
- default: ""
263
- },
264
- okText: {
265
- type: String,
266
- default: ""
267
- },
268
- columns: {
269
- type: Array,
270
- default: () => {
271
- return [];
272
- }
273
- },
274
- readonly: {
275
- type: Boolean,
276
- default: false
102
+ return l2;
103
+ };
104
+ return a(() => {
105
+ r2.visible && (c2.show = r2.visible);
106
+ }), v(() => {
107
+ r2.visible && (c2.show = false);
108
+ }), n(() => r2.modelValue, (e2) => {
109
+ JSON.stringify(e2) === JSON.stringify(i2.value) || (i2.value = e2);
110
+ }, { deep: true }), n(i2, (e2) => {
111
+ JSON.stringify(e2) === JSON.stringify(r2.modelValue) || s2("update:modelValue", e2);
112
+ }, { immediate: true }), n(() => r2.visible, (e2) => {
113
+ c2.show = e2;
114
+ }), n(() => r2.columns, (e2) => {
115
+ e2.length && (c2.formattedColumns = e2);
116
+ }), { classes: u2, ...o(c2), column: C, columnsType: p2, columnsList: d2, close: () => {
117
+ s2("close"), s2("update:visible", false);
118
+ }, changeHandler: (e2, t2) => {
119
+ if (t2 && Object.keys(t2).length) {
120
+ if (p2.value === "cascade") {
121
+ i2.value[e2] = t2.value ? t2.value : "";
122
+ let l2 = e2, n2 = t2;
123
+ for (; n2 && n2.children; )
124
+ i2.value[l2 + 1] = n2.children[0].value, l2++, n2 = n2.children[0];
125
+ } else
126
+ i2.value[e2] = t2.hasOwnProperty("value") ? t2.value : "";
127
+ s2("change", { columnIndex: e2, selectedValue: i2.value, selectedOptions: m2.value });
277
128
  }
278
- }),
279
- emits: ["close", "change", "confirm", "update:visible", "update:modelValue"],
280
- setup(props, { emit }) {
281
- const state = reactive({
282
- show: false,
283
- formattedColumns: props.columns
284
- });
285
- let defaultValues = ref(props.modelValue);
286
- const classes = computed(() => {
287
- const prefixCls = componentName;
288
- return {
289
- [prefixCls]: true
290
- };
291
- });
292
- const selectedOptions = computed(() => {
293
- let optins = [];
294
- columnsList.value.map((column2, index) => {
295
- let currOptions = [];
296
- currOptions = column2.filter((item) => item.value == defaultValues.value[index]);
297
- optins.push(currOptions[0]);
298
- });
299
- return optins;
300
- });
301
- const columnsType = computed(() => {
302
- const firstColumn = state.formattedColumns[0];
303
- if (firstColumn) {
304
- if (Array.isArray(firstColumn)) {
305
- return "multiple";
306
- }
307
- if ("children" in firstColumn) {
308
- return "cascade";
309
- }
310
- }
311
- return "single";
312
- });
313
- const columnsList = computed(() => {
314
- switch (columnsType.value) {
315
- case "multiple":
316
- return state.formattedColumns;
317
- case "cascade":
318
- return formatCascade(state.formattedColumns, defaultValues.value);
319
- default:
320
- return [state.formattedColumns];
321
- }
322
- });
323
- const formatCascade = (columns, defaultValues2) => {
324
- const formatted = [];
325
- let cursor = {
326
- text: "",
327
- value: "",
328
- children: columns
329
- };
330
- let columnIndex = 0;
331
- while (cursor && cursor.children) {
332
- const options = cursor.children;
333
- const value = defaultValues2[columnIndex];
334
- let index = options.findIndex((columnItem) => columnItem.value == value);
335
- if (index == -1)
336
- index = 0;
337
- cursor = cursor.children[index];
338
- columnIndex++;
339
- formatted.push(options);
340
- }
341
- return formatted;
342
- };
343
- const close = () => {
344
- emit("close");
345
- emit("update:visible", false);
346
- };
347
- const changeHandler = (columnIndex, option) => {
348
- if (option && Object.keys(option).length) {
349
- if (columnsType.value === "cascade") {
350
- defaultValues.value[columnIndex] = option.value ? option.value : "";
351
- let index = columnIndex;
352
- let cursor = option;
353
- while (cursor && cursor.children) {
354
- defaultValues.value[index + 1] = cursor.children[0].value;
355
- index++;
356
- cursor = cursor.children[0];
357
- }
358
- } else {
359
- defaultValues.value[columnIndex] = option.hasOwnProperty("value") ? option.value : "";
360
- }
361
- emit("change", {
362
- columnIndex,
363
- selectedValue: defaultValues.value,
364
- selectedOptions: selectedOptions.value
365
- });
366
- }
367
- };
368
- const confirmHandler = () => {
369
- emit("confirm", {
370
- selectedValue: defaultValues.value,
371
- selectedOptions: selectedOptions.value
372
- });
373
- emit("update:visible", false);
374
- };
375
- onMounted(() => {
376
- console.log(11, props.columns);
377
- if (props.visible)
378
- state.show = props.visible;
379
- });
380
- onBeforeUnmount(() => {
381
- if (props.visible)
382
- state.show = false;
383
- });
384
- watch(() => props.modelValue, (newValues) => {
385
- const isSameValue = JSON.stringify(newValues) === JSON.stringify(defaultValues.value);
386
- if (!isSameValue) {
387
- defaultValues.value = newValues;
388
- }
389
- }, { deep: true });
390
- watch(defaultValues, (newValues) => {
391
- const isSameValue = JSON.stringify(newValues) === JSON.stringify(props.modelValue);
392
- if (!isSameValue) {
393
- emit("update:modelValue", newValues);
394
- }
395
- }, { immediate: true });
396
- watch(() => props.visible, (val) => {
397
- console.log("props\u66F4\u65B0", props.columns);
398
- state.show = val;
399
- });
400
- watch(() => props.columns, (val) => {
401
- if (val.length)
402
- state.formattedColumns = val;
403
- });
404
- return __spreadProps(__spreadValues({
405
- classes
406
- }, toRefs(state)), {
407
- column,
408
- columnsType,
409
- columnsList,
410
- close,
411
- changeHandler,
412
- confirmHandler,
413
- defaultValues,
414
- translate
415
- });
416
- }
417
- });
418
- const _hoisted_1 = { class: "nut-picker__bar" };
419
- const _hoisted_2 = { class: "nut-picker__title" };
420
- const _hoisted_3 = { class: "nut-picker__column" };
421
- const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "nut-picker__hairline" }, null, -1);
422
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
423
- const _component_nut_picker_column = resolveComponent("nut-picker-column");
424
- const _component_nut_popup = resolveComponent("nut-popup");
425
- return openBlock(), createElementBlock("view", {
426
- class: normalizeClass(_ctx.classes)
427
- }, [
428
- createVNode(_component_nut_popup, {
429
- position: "bottom",
430
- visible: _ctx.show,
431
- "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.show = $event),
432
- teleport: _ctx.teleport,
433
- "lock-scroll": _ctx.lockScroll,
434
- "close-on-click-overlay": _ctx.closeOnClickOverlay,
435
- onClose: _ctx.close,
436
- round: true,
437
- isWrapTeleport: _ctx.isWrapTeleport
438
- }, {
439
- default: withCtx(() => [
440
- createElementVNode("view", _hoisted_1, [
441
- createElementVNode("view", {
442
- class: "nut-picker__cancel nut-picker__left nut-picker__button",
443
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
444
- }, toDisplayString(_ctx.cancelText || _ctx.translate("cancel")), 1),
445
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
446
- createElementVNode("view", {
447
- class: "nut-picker__confirm nut-picker__right nut-picker__button",
448
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirmHandler())
449
- }, toDisplayString(_ctx.okText || _ctx.translate("confirm")), 1)
450
- ]),
451
- renderSlot(_ctx.$slots, "top"),
452
- createElementVNode("view", _hoisted_3, [
453
- _hoisted_4,
454
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnsList, (column2, columnIndex) => {
455
- return openBlock(), createElementBlock("view", {
456
- class: "nut-picker__columnitem",
457
- key: columnIndex
458
- }, [
459
- createVNode(_component_nut_picker_column, {
460
- itemShow: _ctx.show,
461
- column: column2,
462
- readonly: _ctx.readonly,
463
- columnsType: _ctx.columnsType,
464
- value: _ctx.defaultValues[columnIndex],
465
- onChange: (option) => {
466
- _ctx.changeHandler(columnIndex, option);
467
- }
468
- }, null, 8, ["itemShow", "column", "readonly", "columnsType", "value", "onChange"])
469
- ]);
470
- }), 128))
471
- ]),
472
- renderSlot(_ctx.$slots, "default")
473
- ]),
474
- _: 3
475
- }, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose", "isWrapTeleport"])
476
- ], 2);
477
- }
478
- var Picker = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
479
- export { Picker as default };
129
+ }, confirmHandler: () => {
130
+ s2("confirm", { selectedValue: i2.value, selectedOptions: m2.value }), s2("update:visible", false);
131
+ }, defaultValues: i2, translate: O };
132
+ } }), V = { class: "nut-picker__bar" }, j = { class: "nut-picker__title" }, N = { class: "nut-picker__column" }, $ = c("view", { class: "nut-picker__hairline" }, null, -1);
133
+ var H = _(D, [["render", function(e2, t2, l2, n2, a2, o2) {
134
+ const i2 = f("nut-picker-column"), h2 = f("nut-popup");
135
+ return r(), s("view", { class: p(e2.classes) }, [g(h2, { position: "bottom", visible: e2.show, "onUpdate:visible": t2[2] || (t2[2] = (t3) => e2.show = t3), teleport: e2.teleport, "lock-scroll": e2.lockScroll, "close-on-click-overlay": e2.closeOnClickOverlay, onClose: e2.close, round: true, isWrapTeleport: e2.isWrapTeleport }, { default: y(() => [c("view", V, [c("view", { class: "nut-picker__cancel nut-picker__left nut-picker__button", onClick: t2[0] || (t2[0] = (...t3) => e2.close && e2.close(...t3)) }, d(e2.cancelText || e2.translate("cancel")), 1), c("view", j, d(e2.title), 1), c("view", { class: "nut-picker__confirm nut-picker__right nut-picker__button", onClick: t2[1] || (t2[1] = (t3) => e2.confirmHandler()) }, d(e2.okText || e2.translate("confirm")), 1)]), k(e2.$slots, "top"), c("view", N, [$, (r(true), s(u, null, m(e2.columnsList, (t3, l3) => (r(), s("view", { class: "nut-picker__columnitem", key: l3 }, [g(i2, { itemShow: e2.show, column: t3, readonly: e2.readonly, columnsType: e2.columnsType, value: e2.defaultValues[l3], onChange: (t4) => {
136
+ e2.changeHandler(l3, t4);
137
+ } }, null, 8, ["itemShow", "column", "readonly", "columnsType", "value", "onChange"])]))), 128))]), k(e2.$slots, "default")]), _: 3 }, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose", "isWrapTeleport"])], 2);
138
+ }]]);
139
+ export { H as default };