@nutui/nutui 3.1.18-beta.0 → 3.1.19-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/LICENSE +1 -1
  3. package/README.md +6 -0
  4. package/dist/nutui.d.ts +39 -36
  5. package/dist/nutui.es.js +13149 -11288
  6. package/dist/nutui.umd.js +13156 -11381
  7. package/dist/packages/_es/ActionSheet.js +13 -19
  8. package/dist/packages/_es/Address.js +70 -55
  9. package/dist/packages/_es/Audio.js +13 -13
  10. package/dist/packages/_es/AudioOperate.js +125 -0
  11. package/dist/packages/_es/Avatar.js +4 -4
  12. package/dist/packages/_es/BackTop.js +69 -108
  13. package/dist/packages/_es/Badge.js +4 -4
  14. package/dist/packages/_es/Barrage.js +63 -56
  15. package/dist/packages/_es/Button.js +3 -3
  16. package/dist/packages/_es/Calendar.js +30 -702
  17. package/dist/packages/_es/CalendarItem.js +10 -0
  18. package/dist/packages/_es/Card.js +7 -6
  19. package/dist/packages/_es/Cascader.js +8 -8
  20. package/dist/packages/_es/Cell.js +27 -27
  21. package/dist/packages/_es/CellGroup.js +2 -2
  22. package/dist/packages/_es/Checkbox.js +4 -4
  23. package/dist/packages/_es/CheckboxGroup.js +3 -3
  24. package/dist/packages/_es/CircleProgress.js +150 -41
  25. package/dist/packages/_es/Col.js +2 -2
  26. package/dist/packages/_es/Collapse.js +35 -9
  27. package/dist/packages/_es/CollapseItem.js +79 -38
  28. package/dist/packages/_es/CountDown.js +8 -6
  29. package/dist/packages/_es/CountUp.js +31 -30
  30. package/dist/packages/_es/DatePicker.js +81 -44
  31. package/dist/packages/_es/Dialog.js +7 -83
  32. package/dist/packages/_es/Divider.js +5 -5
  33. package/dist/packages/_es/Drag.js +93 -55
  34. package/dist/packages/_es/Elevator.js +75 -50
  35. package/dist/packages/_es/Empty.js +4 -4
  36. package/dist/packages/_es/FixedNav.js +6 -6
  37. package/dist/packages/_es/Form.js +11 -9
  38. package/dist/packages/_es/FormItem.js +9 -6
  39. package/dist/packages/_es/Grid.js +2 -2
  40. package/dist/packages/_es/GridItem.js +9 -27
  41. package/dist/packages/_es/Icon.js +2 -2
  42. package/dist/packages/_es/ImagePreview.js +14 -83
  43. package/dist/packages/_es/Indicator.js +4 -4
  44. package/dist/packages/_es/InfiniteLoading.js +94 -108
  45. package/dist/packages/_es/Input.js +297 -73
  46. package/dist/packages/_es/InputNumber.js +24 -17
  47. package/dist/packages/_es/Layout.js +2 -2
  48. package/dist/packages/_es/List.js +131 -0
  49. package/dist/packages/_es/Menu.js +16 -13
  50. package/dist/packages/_es/MenuItem.js +8 -8
  51. package/dist/packages/_es/Navbar.js +17 -12
  52. package/dist/packages/_es/NoticeBar.js +47 -39
  53. package/dist/packages/_es/Notify.js +28 -163
  54. package/dist/packages/_es/NumberKeyboard.js +4 -4
  55. package/dist/packages/_es/OldPicker.js +486 -0
  56. package/dist/packages/_es/OverLay.js +6 -26
  57. package/dist/packages/_es/Pagination.js +8 -8
  58. package/dist/packages/_es/Picker.js +192 -163
  59. package/dist/packages/_es/Popover.js +155 -30
  60. package/dist/packages/_es/Popup.js +7 -70
  61. package/dist/packages/_es/Price.js +18 -6
  62. package/dist/packages/_es/Progress.js +29 -27
  63. package/dist/packages/_es/PullRefresh.js +363 -0
  64. package/dist/packages/_es/Radio.js +4 -4
  65. package/dist/packages/_es/RadioGroup.js +2 -2
  66. package/dist/packages/_es/Range.js +169 -46
  67. package/dist/packages/_es/Rate.js +17 -20
  68. package/dist/packages/_es/Row.js +2 -2
  69. package/dist/packages/_es/SearchBar.js +9 -7
  70. package/dist/packages/_es/ShortPassword.js +90 -68
  71. package/dist/packages/_es/SideNavBar.js +6 -17
  72. package/dist/packages/_es/SideNavBarItem.js +2 -2
  73. package/dist/packages/_es/Signature.js +70 -70
  74. package/dist/packages/_es/Skeleton.js +9 -12
  75. package/dist/packages/_es/Sku.js +40 -31
  76. package/dist/packages/_es/Step.js +28 -12
  77. package/dist/packages/_es/Steps.js +8 -3
  78. package/dist/packages/_es/Sticky.js +29 -24
  79. package/dist/packages/_es/SubSideNavBar.js +2 -2
  80. package/dist/packages/_es/Swipe.js +40 -27
  81. package/dist/packages/_es/Swiper.js +32 -14
  82. package/dist/packages/_es/SwiperItem.js +2 -2
  83. package/dist/packages/_es/Switch.js +4 -4
  84. package/dist/packages/_es/TabPane.js +2 -2
  85. package/dist/packages/_es/Tabbar.js +4 -4
  86. package/dist/packages/_es/TabbarItem.js +28 -23
  87. package/dist/packages/_es/Table.js +14 -14
  88. package/dist/packages/_es/Tabs.js +19 -15
  89. package/dist/packages/_es/Tag.js +14 -8
  90. package/dist/packages/_es/TextArea.js +49 -15
  91. package/dist/packages/_es/TimeDetail.js +5 -4
  92. package/dist/packages/_es/TimePannel.js +4 -4
  93. package/dist/packages/_es/TimeSelect.js +9 -8
  94. package/dist/packages/_es/Toast.js +42 -171
  95. package/dist/packages/_es/Uploader.js +108 -139
  96. package/dist/packages/_es/Video.js +14 -10
  97. package/dist/packages/_es/common.js +2 -2
  98. package/dist/packages/_es/component.js +2 -2
  99. package/dist/packages/_es/index.js +45 -7
  100. package/dist/packages/_es/index.taro.js +719 -0
  101. package/dist/packages/_es/index2.js +2 -2
  102. package/dist/packages/_es/index3.js +57 -29
  103. package/dist/packages/_es/index4.js +414 -57
  104. package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
  105. package/dist/packages/_es/pxCheck.js +2 -2
  106. package/dist/packages/_es/use-lock-scroll.js +23 -0
  107. package/dist/packages/_es/util.js +2 -2
  108. package/dist/packages/badge/index.scss +11 -13
  109. package/dist/packages/button/index.scss +1 -0
  110. package/dist/packages/calendar/index.scss +9 -4
  111. package/dist/packages/calendaritem/index.scss +0 -207
  112. package/dist/packages/cell/index.scss +6 -6
  113. package/dist/packages/checkbox/index.scss +4 -3
  114. package/dist/packages/collapseitem/index.scss +21 -11
  115. package/dist/packages/countdown/index.scss +3 -1
  116. package/dist/packages/divider/index.scss +8 -8
  117. package/dist/packages/elevator/index.scss +36 -36
  118. package/dist/packages/formitem/index.scss +15 -8
  119. package/dist/packages/indicator/index.scss +1 -1
  120. package/dist/packages/input/index.scss +70 -24
  121. package/dist/packages/inputnumber/index.scss +4 -2
  122. package/dist/packages/list/index.scss +24 -0
  123. package/dist/packages/menu/index.scss +3 -3
  124. package/dist/packages/navbar/index.scss +28 -8
  125. package/dist/packages/noticebar/index.scss +7 -8
  126. package/dist/packages/notify/index.scss +9 -0
  127. package/dist/packages/numberkeyboard/index.scss +22 -21
  128. package/dist/packages/oldpicker/index.scss +131 -0
  129. package/dist/packages/picker/index.scss +38 -32
  130. package/dist/packages/progress/index.scss +6 -5
  131. package/dist/packages/radio/index.scss +7 -6
  132. package/dist/packages/range/index.scss +109 -2
  133. package/dist/packages/searchbar/index.scss +7 -7
  134. package/dist/packages/sidenavbaritem/index.scss +5 -5
  135. package/dist/packages/step/index.scss +29 -29
  136. package/dist/packages/subsidenavbar/index.scss +10 -8
  137. package/dist/packages/tabbaritem/index.scss +15 -0
  138. package/dist/packages/timedetail/index.scss +13 -13
  139. package/dist/packages/timepannel/index.scss +7 -7
  140. package/dist/packages/timeselect/index.scss +3 -3
  141. package/dist/packages/uploader/index.scss +6 -6
  142. package/dist/style.css +1 -1
  143. package/dist/styles/themes/default.scss +64 -62
  144. package/dist/styles/themes/jdt.scss +91 -0
  145. package/dist/styles/variables-jdt.scss +728 -0
  146. package/dist/styles/variables.scss +250 -44
  147. package/package.json +2 -1
  148. package/dist/packages/_es/raf.js +0 -19
  149. package/dist/styles/themes/jdd.scss +0 -2
@@ -0,0 +1,486 @@
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
+ /*!
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
+ * Released under the MIT License.
24
+ */
25
+ import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, toRaw, resolveComponent, createBlock, withCtx, createVNode } from "vue";
26
+ import { c as createComponent } from "./component.js";
27
+ import { u as useTaroRect } from "./index.js";
28
+ import Taro from "@tarojs/taro";
29
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
30
+ import { p as popupProps } from "./index4.js";
31
+ import "./use-lock-scroll.js";
32
+ import "./pxCheck.js";
33
+ const commonProps = {
34
+ listData: {
35
+ type: Array,
36
+ default: () => {
37
+ return [];
38
+ }
39
+ },
40
+ readonly: {
41
+ type: Boolean,
42
+ default: false
43
+ },
44
+ defaultIndex: {
45
+ type: [Number, String],
46
+ default: 0
47
+ },
48
+ itemHeight: {
49
+ type: [Number, String],
50
+ default: 35
51
+ }
52
+ };
53
+ const { create: create$1 } = createComponent("oldpicker-column");
54
+ const _sfc_main$1 = create$1({
55
+ props: __spreadValues({
56
+ dataType: String,
57
+ itemShow: {
58
+ type: Boolean,
59
+ default: false
60
+ }
61
+ }, commonProps),
62
+ emits: ["click", "change"],
63
+ setup(props, { emit }) {
64
+ const wrapper = ref();
65
+ const state = reactive({
66
+ touchParams: {
67
+ startY: 0,
68
+ endY: 0,
69
+ startTime: 0,
70
+ endTime: 0,
71
+ lastY: 0,
72
+ lastTime: 0
73
+ },
74
+ currIndex: 1,
75
+ transformY: 0,
76
+ scrollDistance: 0,
77
+ lineSpacing: 36,
78
+ rotation: 20,
79
+ timer: null
80
+ });
81
+ const roller = ref(null);
82
+ const list = ref(null);
83
+ const listItem = ref(null);
84
+ const touchDeg = ref(0);
85
+ const touchTime = ref(0);
86
+ const touchTranslateY = ref(0);
87
+ const touchListStyle = computed(() => {
88
+ return {
89
+ transition: `transform ${touchTime.value}ms cubic-bezier(0.19, 1, 0.22, 1)`,
90
+ transform: `translate3d(0, ${state.scrollDistance}px, 0)`
91
+ };
92
+ });
93
+ const touchRollerStyle = computed(() => {
94
+ return {
95
+ transition: `transform ${touchTime.value}ms cubic-bezier(0.19, 1, 0.22, 1)`,
96
+ transform: `rotate3d(1, 0, 0, ${touchDeg.value})`
97
+ };
98
+ });
99
+ const onTouchStart = (event) => {
100
+ console.log(event);
101
+ event.preventDefault();
102
+ let changedTouches = event.changedTouches[0];
103
+ state.touchParams.startY = changedTouches.pageY;
104
+ state.touchParams.startTime = event.timeStamp || Date.now();
105
+ state.transformY = state.scrollDistance;
106
+ };
107
+ const onTouchMove = (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
+ setMove(move);
114
+ };
115
+ const onTouchEnd = (event) => {
116
+ event.preventDefault();
117
+ let changedTouches = event.changedTouches[0];
118
+ state.touchParams.lastY = changedTouches.pageY;
119
+ state.touchParams.lastTime = event.timeStamp || Date.now();
120
+ let move = state.touchParams.lastY - state.touchParams.startY;
121
+ let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
122
+ if (moveTime <= 300) {
123
+ move = move * 2;
124
+ moveTime = moveTime + 1e3;
125
+ setMove(move, "end", moveTime);
126
+ } else {
127
+ setMove(move, "end");
128
+ }
129
+ };
130
+ const setRollerStyle = (index) => {
131
+ return `transform: rotate3d(1, 0, 0, ${-state.rotation * index}deg) translate3d(0px, 0px, 104px)`;
132
+ };
133
+ const isHidden = (index) => {
134
+ if (index >= state.currIndex + 8 || index <= state.currIndex - 8) {
135
+ return true;
136
+ } else {
137
+ return false;
138
+ }
139
+ };
140
+ const setTransform = (translateY = 0, type, time = 1e3, deg) => {
141
+ if (type === "end") {
142
+ touchTime.value = time;
143
+ } else {
144
+ touchTime.value = 0;
145
+ }
146
+ touchDeg.value = deg;
147
+ touchTranslateY.value = translateY;
148
+ state.scrollDistance = translateY;
149
+ };
150
+ const setMove = (move, type, time) => {
151
+ let updateMove = move + state.transformY;
152
+ if (type === "end") {
153
+ if (updateMove > 0) {
154
+ updateMove = 0;
155
+ }
156
+ if (updateMove < -(props.listData.values.length - 1) * state.lineSpacing) {
157
+ updateMove = -(props.listData.values.length - 1) * state.lineSpacing;
158
+ }
159
+ let endMove = Math.round(updateMove / state.lineSpacing) * state.lineSpacing;
160
+ let deg = `${(Math.abs(Math.round(endMove / state.lineSpacing)) + 1) * state.rotation}deg`;
161
+ setTransform(endMove, type, time, deg);
162
+ let t = time ? time / 2 : 0;
163
+ state.timer = setTimeout(() => {
164
+ setChooseValue();
165
+ }, t);
166
+ state.currIndex = Math.abs(Math.round(endMove / state.lineSpacing)) + 1;
167
+ } else {
168
+ let deg = "0deg";
169
+ if (updateMove < 0) {
170
+ deg = `${(Math.abs(updateMove / state.lineSpacing) + 1) * state.rotation}deg`;
171
+ } else {
172
+ deg = `${(-updateMove / state.lineSpacing + 1) * state.rotation}deg`;
173
+ }
174
+ setTransform(updateMove, null, void 0, deg);
175
+ state.currIndex = Math.abs(Math.round(updateMove / state.lineSpacing)) + 1;
176
+ }
177
+ };
178
+ const setChooseValue = () => {
179
+ emit("change", state.currIndex - 1);
180
+ };
181
+ const modifyStatus = (type) => {
182
+ let index = props.defaultIndex;
183
+ state.currIndex = index === -1 ? 1 : index + 1;
184
+ let move = index === -1 ? 0 : index * state.lineSpacing;
185
+ type && setChooseValue();
186
+ setMove(-move);
187
+ };
188
+ const getReference = async () => {
189
+ const refe = await useTaroRect(list, Taro);
190
+ state.lineSpacing = refe.height / props.listData.values.length;
191
+ modifyStatus(true);
192
+ };
193
+ watch(() => props.listData, (val) => {
194
+ state.transformY = 0;
195
+ modifyStatus(false);
196
+ }, {
197
+ deep: true
198
+ });
199
+ watch(() => props.itemShow, (val) => {
200
+ if (val) {
201
+ setTimeout(() => {
202
+ getReference();
203
+ }, 200);
204
+ }
205
+ }, {
206
+ deep: true
207
+ });
208
+ watch(() => props.defaultIndex, (val) => {
209
+ state.transformY = 0;
210
+ modifyStatus(false);
211
+ });
212
+ onMounted(() => {
213
+ setTimeout(() => {
214
+ getReference();
215
+ }, 200);
216
+ });
217
+ const refRandomId = Math.random().toString(36).slice(-8);
218
+ return __spreadProps(__spreadValues(__spreadValues({}, toRefs(state)), toRefs(props)), {
219
+ wrapper,
220
+ setRollerStyle,
221
+ isHidden,
222
+ roller,
223
+ list,
224
+ listItem,
225
+ onTouchStart,
226
+ onTouchMove,
227
+ onTouchEnd,
228
+ touchRollerStyle,
229
+ touchListStyle,
230
+ refRandomId
231
+ });
232
+ }
233
+ });
234
+ const _hoisted_1$1 = { class: "nut-oldpicker-content" };
235
+ const _hoisted_2$1 = ["id"];
236
+ const _hoisted_3$1 = {
237
+ key: 0,
238
+ class: "nut-oldpicker-placeholder"
239
+ };
240
+ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
241
+ return _ctx.itemShow ? (openBlock(), createElementBlock("view", {
242
+ key: 0,
243
+ class: "nut-oldpicker__list",
244
+ onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
245
+ onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
246
+ onTouchend: _cache[2] || (_cache[2] = (...args) => _ctx.onTouchEnd && _ctx.onTouchEnd(...args))
247
+ }, [
248
+ createElementVNode("view", {
249
+ class: "nut-oldpicker-roller",
250
+ ref: "roller",
251
+ style: normalizeStyle(_ctx.touchRollerStyle)
252
+ }, [
253
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index) => {
254
+ return openBlock(), createElementBlock("view", {
255
+ class: normalizeClass(["nut-oldpicker-roller-item", { "nut-oldpicker-roller-item-hidden": _ctx.isHidden(index + 1) }]),
256
+ style: normalizeStyle(_ctx.setRollerStyle(index + 1)),
257
+ key: item.label ? item.label : index
258
+ }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 7);
259
+ }), 128))
260
+ ], 4),
261
+ createElementVNode("view", _hoisted_1$1, [
262
+ createElementVNode("view", {
263
+ class: "nut-oldpicker-list-panel",
264
+ ref: "list",
265
+ id: "list" + _ctx.refRandomId,
266
+ style: normalizeStyle(_ctx.touchListStyle)
267
+ }, [
268
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index) => {
269
+ return openBlock(), createElementBlock("view", {
270
+ class: "nut-oldpicker-item nut-oldpicker-item-ref",
271
+ key: item.label ? item.label : index
272
+ }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 1);
273
+ }), 128)),
274
+ _ctx.listData && _ctx.listData.length === 1 ? (openBlock(), createElementBlock("view", _hoisted_3$1)) : createCommentVNode("", true)
275
+ ], 12, _hoisted_2$1)
276
+ ])
277
+ ], 32)) : createCommentVNode("", true);
278
+ }
279
+ var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
280
+ const { create, componentName } = createComponent("oldpicker");
281
+ const _sfc_main = create({
282
+ components: {
283
+ [column.name]: column
284
+ },
285
+ props: __spreadValues(__spreadProps(__spreadValues({}, popupProps), {
286
+ title: {
287
+ type: String,
288
+ default: ""
289
+ },
290
+ cancelText: {
291
+ type: String,
292
+ default: "\u53D6\u6D88"
293
+ },
294
+ okText: {
295
+ type: String,
296
+ default: "\u786E\u5B9A"
297
+ }
298
+ }), commonProps),
299
+ emits: ["close", "change", "confirm", "update:visible"],
300
+ setup(props, { emit }) {
301
+ const childrenKey = "children";
302
+ const valuesKey = "values";
303
+ const state = reactive({
304
+ show: false,
305
+ formattedColumns: props.listData,
306
+ defaultIndex: props.defaultIndex
307
+ });
308
+ let _defaultIndex = props.defaultIndex;
309
+ let defaultIndexList = [];
310
+ const classes = computed(() => {
311
+ const prefixCls = componentName;
312
+ return {
313
+ [prefixCls]: true
314
+ };
315
+ });
316
+ const dataType = computed(() => {
317
+ const firstColumn = state.formattedColumns[0];
318
+ if (typeof firstColumn === "object") {
319
+ if (firstColumn[childrenKey]) {
320
+ return "cascade";
321
+ } else if (firstColumn == null ? void 0 : firstColumn[valuesKey]) {
322
+ addDefaultIndexList(props.listData);
323
+ return "multipleColumns";
324
+ }
325
+ }
326
+ return "text";
327
+ });
328
+ const columnList = computed(() => {
329
+ if (dataType.value === "text") {
330
+ return [{ values: state.formattedColumns, defaultIndex: state.defaultIndex }];
331
+ } else if (dataType.value === "multipleColumns") {
332
+ return state.formattedColumns;
333
+ } else if (dataType.value === "cascade") {
334
+ return formatCascade(state.formattedColumns, state.defaultIndex);
335
+ }
336
+ return state.formattedColumns;
337
+ });
338
+ const addDefaultIndexList = (listData) => {
339
+ defaultIndexList = [];
340
+ listData.forEach((res) => {
341
+ defaultIndexList.push(res.defaultIndex || 0);
342
+ });
343
+ };
344
+ const formatCascade = (listData, defaultIndex) => {
345
+ const formatted = [];
346
+ let children = listData;
347
+ children.defaultIndex = defaultIndex;
348
+ while (children) {
349
+ formatted.push({
350
+ values: children,
351
+ defaultIndex: children.defaultIndex || 0
352
+ });
353
+ children = children == null ? void 0 : children[children.defaultIndex || 0].children;
354
+ }
355
+ addDefaultIndexList(formatted);
356
+ return formatted;
357
+ };
358
+ const getCascadeData = (listData, defaultIndex) => {
359
+ var _a;
360
+ let arr = listData;
361
+ arr.defaultIndex = defaultIndex;
362
+ const dataList = [];
363
+ while (arr) {
364
+ const item = arr[(_a = arr.defaultIndex) != null ? _a : 0];
365
+ dataList.push(item.text);
366
+ arr = item.children;
367
+ }
368
+ return dataList;
369
+ };
370
+ const close = () => {
371
+ emit("close");
372
+ emit("update:visible", false);
373
+ };
374
+ const changeHandler = (columnIndex, dataIndex) => {
375
+ if (dataType.value === "cascade") {
376
+ let cursor = state.formattedColumns;
377
+ if (columnIndex === 0) {
378
+ state.defaultIndex = dataIndex;
379
+ }
380
+ let i = 0;
381
+ while (cursor) {
382
+ if (i === columnIndex) {
383
+ cursor.defaultIndex = dataIndex;
384
+ } else if (i > columnIndex) {
385
+ cursor.defaultIndex = 0;
386
+ }
387
+ cursor = cursor[cursor.defaultIndex || 0].children;
388
+ i++;
389
+ }
390
+ } else if (dataType.value === "text") {
391
+ _defaultIndex = dataIndex;
392
+ } else if (dataType.value === "multipleColumns") {
393
+ defaultIndexList[columnIndex] = dataIndex;
394
+ const val = defaultIndexList.map((res, i) => toRaw(state.formattedColumns)[i].values[res]);
395
+ emit("change", val, columnIndex, dataIndex);
396
+ }
397
+ };
398
+ const confirm = () => {
399
+ if (dataType.value === "text") {
400
+ state.defaultIndex = _defaultIndex;
401
+ emit("confirm", state.formattedColumns[_defaultIndex]);
402
+ } else if (dataType.value === "multipleColumns") {
403
+ for (let i = 0; i < defaultIndexList.length; i++) {
404
+ state.formattedColumns[i].defaultIndex = defaultIndexList[i];
405
+ }
406
+ const checkedArr = toRaw(state.formattedColumns).map((res) => res.values && res.values[res.defaultIndex]);
407
+ emit("confirm", checkedArr);
408
+ } else if (dataType.value === "cascade") {
409
+ emit("confirm", getCascadeData(toRaw(state.formattedColumns), state.defaultIndex));
410
+ }
411
+ emit("update:visible", false);
412
+ };
413
+ watch(() => props.visible, (val) => {
414
+ state.show = val;
415
+ });
416
+ watch(() => props.listData, (val) => {
417
+ state.formattedColumns = val;
418
+ });
419
+ return __spreadProps(__spreadValues({
420
+ classes
421
+ }, toRefs(state)), {
422
+ column,
423
+ dataType,
424
+ columnList,
425
+ close,
426
+ changeHandler,
427
+ confirm
428
+ });
429
+ }
430
+ });
431
+ const _hoisted_1 = { class: "nut-oldpicker__bar" };
432
+ const _hoisted_2 = { class: "nut-oldpicker__title" };
433
+ const _hoisted_3 = { class: "nut-oldpicker__column" };
434
+ const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "nut-oldpicker__hairline" }, null, -1);
435
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
436
+ const _component_nut_oldpicker_column = resolveComponent("nut-oldpicker-column");
437
+ const _component_nut_popup = resolveComponent("nut-popup");
438
+ return openBlock(), createBlock(_component_nut_popup, {
439
+ position: "bottom",
440
+ visible: _ctx.show,
441
+ "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.show = $event),
442
+ teleport: _ctx.teleport,
443
+ "lock-scroll": _ctx.lockScroll,
444
+ "close-on-click-overlay": _ctx.closeOnClickOverlay,
445
+ onClose: _ctx.close,
446
+ round: true
447
+ }, {
448
+ default: withCtx(() => [
449
+ createElementVNode("view", _hoisted_1, [
450
+ createElementVNode("view", {
451
+ class: "nut-oldpicker__button nut-oldpicker__left",
452
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
453
+ }, toDisplayString(_ctx.cancelText), 1),
454
+ createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
455
+ createElementVNode("view", {
456
+ class: "nut-oldpicker__button nut-oldpicker__right",
457
+ onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
458
+ }, toDisplayString(_ctx.okText), 1)
459
+ ]),
460
+ createElementVNode("view", _hoisted_3, [
461
+ _hoisted_4,
462
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnList, (item, columnIndex) => {
463
+ return openBlock(), createElementBlock("view", {
464
+ class: "nut-oldpicker__columnitem",
465
+ key: columnIndex
466
+ }, [
467
+ createVNode(_component_nut_oldpicker_column, {
468
+ itemShow: _ctx.show,
469
+ "list-data": item,
470
+ readonly: _ctx.readonly,
471
+ "default-index": item.defaultIndex,
472
+ "visible-item-count": _ctx.visibleItemCount,
473
+ "data-type": _ctx.dataType,
474
+ onChange: (dataIndex) => {
475
+ _ctx.changeHandler(columnIndex, dataIndex);
476
+ }
477
+ }, null, 8, ["itemShow", "list-data", "readonly", "default-index", "visible-item-count", "data-type", "onChange"])
478
+ ]);
479
+ }), 128))
480
+ ])
481
+ ]),
482
+ _: 1
483
+ }, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose"]);
484
+ }
485
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
486
+ export { index_taro as default };
@@ -15,11 +15,11 @@ var __spreadValues = (a, b) => {
15
15
  return a;
16
16
  };
17
17
  /*!
18
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
19
- * (c) 2021 @jdf2e.
18
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
19
+ * (c) 2022 @jdf2e.
20
20
  * Released under the MIT License.
21
21
  */
22
- import { computed, watch, onDeactivated, onBeforeUnmount, onMounted, onActivated, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, withModifiers, normalizeStyle, renderSlot, vShow } from "vue";
22
+ import { computed, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, vShow } from "vue";
23
23
  import { c as createComponent } from "./component.js";
24
24
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
25
25
  const { componentName, create } = createComponent("overlay");
@@ -63,38 +63,19 @@ const _sfc_main = create({
63
63
  [props.overlayClass]: true
64
64
  };
65
65
  });
66
- watch(() => props.visible, (value) => {
67
- value ? lock() : unlock();
68
- });
69
- const lock = () => {
70
- if (props.lockScroll && props.visible) {
71
- document.body.classList.add("nut-overflow-hidden");
72
- }
73
- };
74
- const unlock = () => {
75
- document.body.classList.remove("nut-overflow-hidden");
76
- };
77
- onDeactivated(unlock);
78
- onBeforeUnmount(unlock);
79
- onMounted(lock);
80
- onActivated(lock);
81
66
  const style = computed(() => {
82
67
  return __spreadValues({
83
68
  animationDuration: `${props.duration}s`,
84
69
  zIndex: props.zIndex
85
70
  }, props.overlayStyle);
86
71
  });
87
- const touchmove = (e) => {
88
- if (props.lockScroll)
89
- e.preventDefault();
90
- };
91
72
  const onClick = (e) => {
92
73
  emit("click", e);
93
74
  if (props.closeOnClickOverlay) {
94
75
  emit("update:visible", false);
95
76
  }
96
77
  };
97
- return { classes, style, touchmove, onClick };
78
+ return { classes, style, onClick };
98
79
  }
99
80
  });
100
81
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -102,12 +83,11 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
102
83
  default: withCtx(() => [
103
84
  withDirectives(createElementVNode("view", {
104
85
  class: normalizeClass(_ctx.classes),
105
- onTouchmove: _cache[0] || (_cache[0] = withModifiers((...args) => _ctx.touchmove && _ctx.touchmove(...args), ["stop"])),
106
- onClick: _cache[1] || (_cache[1] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
86
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args)),
107
87
  style: normalizeStyle(_ctx.style)
108
88
  }, [
109
89
  renderSlot(_ctx.$slots, "default")
110
- ], 38), [
90
+ ], 6), [
111
91
  [vShow, _ctx.visible]
112
92
  ])
113
93
  ]),
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { toRefs, computed, watchEffect, openBlock, createElementBlock, createElementVNode, normalizeClass, renderSlot, createTextVNode, toDisplayString, Fragment, renderList, createCommentVNode } from "vue";
@@ -67,13 +67,13 @@ const _sfc_main = create({
67
67
  return { number, text, active };
68
68
  };
69
69
  const pages = computed(() => {
70
- if (mode.value == "simple")
71
- return;
72
70
  let items = [];
73
71
  const pageCount = countRef.value;
74
72
  const pageSize = showPageSize.value;
75
73
  let startPage = 1;
76
74
  let endPage = pageCount;
75
+ if (mode.value == "simple")
76
+ return;
77
77
  const partialShow = pageCount > pageSize;
78
78
  if (partialShow) {
79
79
  startPage = Math.max(modelValue.value - Math.floor(pageSize / 2), 1);
@@ -134,9 +134,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
134
134
  ])
135
135
  ], 2),
136
136
  _ctx.mode == "multi" ? (openBlock(), createElementBlock("view", _hoisted_2, [
137
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.pages, (item, index2) => {
137
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.pages, (item, index) => {
138
138
  return openBlock(), createElementBlock("view", {
139
- key: index2 + "pagination",
139
+ key: index + "pagination",
140
140
  class: normalizeClass(["nut-pagination-item", item.active ? "active" : ""]),
141
141
  onClick: ($event) => _ctx.select(item.number, true)
142
142
  }, [
@@ -159,5 +159,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
159
159
  ], 2)
160
160
  ]);
161
161
  }
162
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
163
- export { index as default };
162
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
163
+ export { index_taro as default };