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