@nutui/nutui 3.1.19-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 (110) hide show
  1. package/dist/nutui.d.ts +38 -37
  2. package/dist/nutui.es.js +13439 -12616
  3. package/dist/nutui.umd.js +13431 -12695
  4. package/dist/packages/_es/ActionSheet.js +12 -18
  5. package/dist/packages/_es/Address.js +78 -69
  6. package/dist/packages/_es/Audio.js +12 -12
  7. package/dist/packages/_es/AudioOperate.js +1 -1
  8. package/dist/packages/_es/Avatar.js +3 -3
  9. package/dist/packages/_es/BackTop.js +68 -110
  10. package/dist/packages/_es/Badge.js +3 -3
  11. package/dist/packages/_es/Barrage.js +62 -55
  12. package/dist/packages/_es/Button.js +2 -2
  13. package/dist/packages/_es/Calendar.js +28 -23
  14. package/dist/packages/_es/CalendarItem.js +3 -3
  15. package/dist/packages/_es/Card.js +6 -5
  16. package/dist/packages/_es/Cascader.js +7 -7
  17. package/dist/packages/_es/Cell.js +4 -11
  18. package/dist/packages/_es/CellGroup.js +1 -1
  19. package/dist/packages/_es/Checkbox.js +1 -1
  20. package/dist/packages/_es/CheckboxGroup.js +1 -1
  21. package/dist/packages/_es/CircleProgress.js +149 -40
  22. package/dist/packages/_es/Col.js +1 -1
  23. package/dist/packages/_es/Collapse.js +34 -8
  24. package/dist/packages/_es/CollapseItem.js +90 -59
  25. package/dist/packages/_es/CountDown.js +5 -5
  26. package/dist/packages/_es/CountUp.js +43 -51
  27. package/dist/packages/_es/DatePicker.js +21 -20
  28. package/dist/packages/_es/Dialog.js +8 -86
  29. package/dist/packages/_es/Divider.js +4 -4
  30. package/dist/packages/_es/Drag.js +92 -54
  31. package/dist/packages/_es/Elevator.js +74 -49
  32. package/dist/packages/_es/Empty.js +3 -3
  33. package/dist/packages/_es/FixedNav.js +5 -5
  34. package/dist/packages/_es/Form.js +4 -4
  35. package/dist/packages/_es/FormItem.js +1 -1
  36. package/dist/packages/_es/Grid.js +1 -1
  37. package/dist/packages/_es/GridItem.js +8 -26
  38. package/dist/packages/_es/Icon.js +1 -1
  39. package/dist/packages/_es/ImagePreview.js +15 -84
  40. package/dist/packages/_es/Indicator.js +3 -3
  41. package/dist/packages/_es/InfiniteLoading.js +93 -107
  42. package/dist/packages/_es/Input.js +8 -8
  43. package/dist/packages/_es/InputNumber.js +23 -16
  44. package/dist/packages/_es/Layout.js +1 -1
  45. package/dist/packages/_es/List.js +41 -34
  46. package/dist/packages/_es/Menu.js +15 -12
  47. package/dist/packages/_es/MenuItem.js +9 -9
  48. package/dist/packages/_es/Navbar.js +3 -4
  49. package/dist/packages/_es/NoticeBar.js +47 -40
  50. package/dist/packages/_es/Notify.js +29 -168
  51. package/dist/packages/_es/NumberKeyboard.js +5 -10
  52. package/dist/packages/_es/OldPicker.js +122 -120
  53. package/dist/packages/_es/OverLay.js +5 -25
  54. package/dist/packages/_es/Pagination.js +7 -7
  55. package/dist/packages/_es/Picker.js +39 -16
  56. package/dist/packages/_es/Popover.js +155 -30
  57. package/dist/packages/_es/Popup.js +8 -71
  58. package/dist/packages/_es/Price.js +17 -5
  59. package/dist/packages/_es/Progress.js +18 -8
  60. package/dist/packages/_es/PullRefresh.js +1 -1
  61. package/dist/packages/_es/Radio.js +2 -2
  62. package/dist/packages/_es/RadioGroup.js +1 -1
  63. package/dist/packages/_es/Range.js +46 -33
  64. package/dist/packages/_es/Rate.js +16 -19
  65. package/dist/packages/_es/Row.js +1 -1
  66. package/dist/packages/_es/SearchBar.js +8 -6
  67. package/dist/packages/_es/ShortPassword.js +89 -67
  68. package/dist/packages/_es/SideNavBar.js +5 -16
  69. package/dist/packages/_es/SideNavBarItem.js +1 -1
  70. package/dist/packages/_es/Signature.js +69 -88
  71. package/dist/packages/_es/Skeleton.js +8 -11
  72. package/dist/packages/_es/Sku.js +47 -56
  73. package/dist/packages/_es/Step.js +1 -1
  74. package/dist/packages/_es/Steps.js +1 -1
  75. package/dist/packages/_es/Sticky.js +28 -23
  76. package/dist/packages/_es/SubSideNavBar.js +1 -1
  77. package/dist/packages/_es/Swipe.js +39 -26
  78. package/dist/packages/_es/Swiper.js +31 -13
  79. package/dist/packages/_es/SwiperItem.js +1 -1
  80. package/dist/packages/_es/Switch.js +3 -3
  81. package/dist/packages/_es/TabPane.js +1 -1
  82. package/dist/packages/_es/Tabbar.js +3 -3
  83. package/dist/packages/_es/TabbarItem.js +17 -23
  84. package/dist/packages/_es/Table.js +13 -13
  85. package/dist/packages/_es/Tabs.js +21 -20
  86. package/dist/packages/_es/Tag.js +4 -4
  87. package/dist/packages/_es/TextArea.js +44 -42
  88. package/dist/packages/_es/TimeDetail.js +4 -3
  89. package/dist/packages/_es/TimePannel.js +3 -3
  90. package/dist/packages/_es/TimeSelect.js +8 -7
  91. package/dist/packages/_es/Toast.js +41 -170
  92. package/dist/packages/_es/Uploader.js +109 -138
  93. package/dist/packages/_es/Video.js +3 -3
  94. package/dist/packages/_es/common.js +1 -1
  95. package/dist/packages/_es/component.js +1 -1
  96. package/dist/packages/_es/index.js +44 -6
  97. package/dist/packages/_es/{index5.js → index.taro.js} +127 -95
  98. package/dist/packages/_es/index2.js +1 -1
  99. package/dist/packages/_es/index3.js +56 -28
  100. package/dist/packages/_es/index4.js +413 -56
  101. package/dist/packages/_es/plugin-vue_export-helper.js +1 -1
  102. package/dist/packages/_es/pxCheck.js +1 -1
  103. package/dist/packages/_es/use-lock-scroll.js +23 -0
  104. package/dist/packages/_es/util.js +1 -1
  105. package/dist/packages/uploader/index.scss +2 -2
  106. package/dist/style.css +1 -1
  107. package/dist/styles/themes/default.scss +61 -61
  108. package/dist/styles/themes/jdt.scss +61 -61
  109. package/package.json +1 -1
  110. package/dist/packages/_es/raf.js +0 -19
@@ -1,38 +1,20 @@
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.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
3
  * (c) 2022 @jdf2e.
23
4
  * Released under the MIT License.
24
5
  */
25
- import { reactive, onMounted, watch, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, vShow, createVNode, render } from "vue";
6
+ import { watch, openBlock, createBlock, Transition, withCtx, withDirectives, createElementVNode, normalizeClass, normalizeStyle, renderSlot, createElementBlock, Fragment, createTextVNode, toDisplayString, vShow } from "vue";
26
7
  import { c as createComponent } from "./component.js";
27
- import popup from "./Popup.js";
8
+ import Popup from "./Popup.js";
28
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
+ import "./use-lock-scroll.js";
29
11
  import "./OverLay.js";
30
12
  import "./Icon.js";
31
13
  import "./pxCheck.js";
32
14
  const { componentName, create } = createComponent("notify");
33
15
  const _sfc_main = create({
34
16
  components: {
35
- [popup.name]: popup
17
+ [Popup.name]: Popup
36
18
  },
37
19
  props: {
38
20
  id: String,
@@ -48,28 +30,16 @@ const _sfc_main = create({
48
30
  type: String,
49
31
  default: "danger"
50
32
  },
51
- showPopup: {
33
+ visible: {
52
34
  type: Boolean,
53
35
  default: false
54
- },
55
- position: {
56
- type: String,
57
- default: "top"
58
- },
59
- onClose: Function,
60
- onClick: Function,
61
- unmount: Function
36
+ }
62
37
  },
63
- setup(props, { slots }) {
38
+ emits: ["update:visible", "closed", "click"],
39
+ setup(props, { emit }) {
64
40
  let timer = null;
65
- const state = reactive({
66
- mounted: false
67
- });
68
- onMounted(() => {
69
- state.mounted = true;
70
- });
71
- const clickCover = () => {
72
- props.onClick && props.onClick();
41
+ const onClick = () => {
42
+ emit("click");
73
43
  };
74
44
  const clearTimer = () => {
75
45
  if (timer) {
@@ -78,8 +48,14 @@ const _sfc_main = create({
78
48
  }
79
49
  };
80
50
  const hide = () => {
81
- state.mounted = false;
51
+ emit("update:visible", false);
52
+ emit("closed");
82
53
  };
54
+ watch(() => props.visible, (value) => {
55
+ if (value) {
56
+ show();
57
+ }
58
+ });
83
59
  const show = () => {
84
60
  clearTimer();
85
61
  if (props.duration) {
@@ -88,150 +64,35 @@ const _sfc_main = create({
88
64
  }, props.duration);
89
65
  }
90
66
  };
91
- if (props.duration) {
92
- show();
93
- }
94
- watch(() => props.duration, (val) => {
95
- if (val) {
96
- show();
97
- }
98
- });
99
67
  const onAfterLeave = () => {
100
- clearTimer();
101
- props.unmount && props.unmount(props.id);
102
- props.onClose && props.onClose();
68
+ if (props.visible) {
69
+ clearTimer();
70
+ hide();
71
+ }
103
72
  };
104
- return { state, hide, onAfterLeave, clickCover };
73
+ return { hide, onAfterLeave, onClick };
105
74
  }
106
75
  });
107
76
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
108
77
  return openBlock(), createBlock(Transition, {
109
- name: "toast-fade",
78
+ name: "nut-fade",
110
79
  onAfterLeave: _ctx.onAfterLeave
111
80
  }, {
112
81
  default: withCtx(() => [
113
82
  withDirectives(createElementVNode("view", {
114
- class: normalizeClass([`popup-${_ctx.position}`, "nut-notify", `nut-notify--${_ctx.type}`, [_ctx.className]]),
83
+ class: normalizeClass(["popup-top", "nut-notify", `nut-notify--${_ctx.type}`, { className: _ctx.className }]),
115
84
  style: normalizeStyle({ color: _ctx.color, background: _ctx.background }),
116
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.clickCover && _ctx.clickCover(...args))
85
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClick && _ctx.onClick(...args))
117
86
  }, [
118
87
  _ctx.$slots.default ? renderSlot(_ctx.$slots, "default", { key: 0 }) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
119
88
  createTextVNode(toDisplayString(_ctx.msg), 1)
120
89
  ], 64))
121
90
  ], 6), [
122
- [vShow, _ctx.state.mounted]
91
+ [vShow, _ctx.visible]
123
92
  ])
124
93
  ]),
125
94
  _: 3
126
95
  }, 8, ["onAfterLeave"]);
127
96
  }
128
- var Notify = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
129
- const defaultOptions = {
130
- type: "base",
131
- showPopup: false,
132
- msg: "",
133
- color: void 0,
134
- background: void 0,
135
- duration: 3e3,
136
- className: "",
137
- onClosed: null,
138
- onClick: null,
139
- onOpened: null,
140
- textTimer: null,
141
- unmount: null
142
- };
143
- let idsMap = [];
144
- let optsMap = [];
145
- const clearNotify = (id) => {
146
- if (id) {
147
- const container = document.getElementById(id);
148
- optsMap = optsMap.filter((item) => item.id !== id);
149
- idsMap = idsMap.filter((item) => item !== id);
150
- if (container) {
151
- document.body.removeChild(container);
152
- }
153
- } else {
154
- idsMap.forEach((item) => {
155
- const container = document.getElementById(item);
156
- if (container) {
157
- document.body.removeChild(container);
158
- }
159
- });
160
- optsMap = [];
161
- idsMap = [];
162
- }
163
- };
164
- const updateNotify = (opts) => {
165
- const container = document.getElementById(opts.id);
166
- if (container) {
167
- const currentOpt = optsMap.find((item) => item.id === opts.id);
168
- if (currentOpt) {
169
- opts = __spreadValues(__spreadValues(__spreadValues({}, defaultOptions), currentOpt), opts);
170
- } else {
171
- opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
172
- }
173
- const instance = createVNode(Notify, opts);
174
- render(instance, container);
175
- return instance.component.ctx;
176
- }
177
- };
178
- const mountNotify = (opts) => {
179
- opts.unmount = clearNotify;
180
- let _id;
181
- if (opts.id) {
182
- _id = opts.id;
183
- if (idsMap.find((item) => item === opts.id)) {
184
- return updateNotify(opts);
185
- }
186
- } else {
187
- _id = new Date().getTime() + "";
188
- }
189
- opts = __spreadValues(__spreadValues({}, defaultOptions), opts);
190
- opts.id = _id;
191
- idsMap.push(opts.id);
192
- optsMap.push(opts);
193
- const container = document.createElement("view");
194
- container.id = opts.id;
195
- const instance = createVNode(Notify, opts);
196
- render(instance, container);
197
- document.body.appendChild(container);
198
- setTimeout(() => {
199
- instance.showPopup = true;
200
- }, 0);
201
- return instance.component.ctx;
202
- };
203
- const errorMsg = (msg) => {
204
- if (!msg) {
205
- console.warn("[NutUI Notify]: msg\u4E0D\u80FD\u4E3A\u7A7A");
206
- return;
207
- }
208
- };
209
- const NotifyFunction = {
210
- text(msg, obj = {}) {
211
- errorMsg(msg);
212
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg }));
213
- },
214
- primary(msg, obj = {}) {
215
- errorMsg(msg);
216
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "primary" }));
217
- },
218
- success(msg, obj = {}) {
219
- errorMsg(msg);
220
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "success" }));
221
- },
222
- danger(msg, obj = {}) {
223
- errorMsg(msg);
224
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "danger" }));
225
- },
226
- warn(msg, obj = {}) {
227
- errorMsg(msg);
228
- return mountNotify(__spreadProps(__spreadValues({}, obj), { msg, type: "warning" }));
229
- },
230
- hide() {
231
- clearNotify();
232
- },
233
- install(app) {
234
- app.config.globalProperties.$notify = NotifyFunction;
235
- }
236
- };
237
- export { Notify, NotifyFunction, NotifyFunction as default };
97
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
98
+ export { index_taro as default };
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
@@ -40,10 +40,6 @@ const _sfc_main = create({
40
40
  overlay: {
41
41
  type: Boolean,
42
42
  default: true
43
- },
44
- isWrapTeleport: {
45
- type: Boolean,
46
- default: true
47
43
  }
48
44
  },
49
45
  emits: ["input", "delete", "close", "update:value"],
@@ -181,7 +177,6 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
181
177
  position: "bottom",
182
178
  overlay: _ctx.overlay,
183
179
  onClickOverlay: _cache[7] || (_cache[7] = ($event) => _ctx.closeBoard()),
184
- isWrapTeleport: _ctx.isWrapTeleport,
185
180
  "overlay-class": "nut-numberkeyboard-overlay"
186
181
  }, {
187
182
  default: withCtx(() => [
@@ -236,7 +231,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
236
231
  ]),
237
232
  _ctx.title == "" ? (openBlock(), createElementBlock("div", {
238
233
  key: 0,
239
- class: "key-board-wrapper key-board-finish",
234
+ class: "key-board-wrapper",
240
235
  onClick: _cache[5] || (_cache[5] = ($event) => _ctx.closeBoard())
241
236
  }, [
242
237
  createElementVNode("div", {
@@ -248,7 +243,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
248
243
  ], 512)
249
244
  ]),
250
245
  _: 1
251
- }, 8, ["visible", "overlay", "isWrapTeleport"]);
246
+ }, 8, ["visible", "overlay"]);
252
247
  }
253
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
254
- export { index as default };
248
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
249
+ export { index_taro as default };
@@ -18,40 +18,47 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.19-beta.0 Mon Mar 28 2022 17:50:21 GMT+0800 (中国标准时间)
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
22
  * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { ref, reactive, computed, watch, onMounted, toRefs, openBlock, createElementBlock, createElementVNode, normalizeStyle, Fragment, renderList, normalizeClass, toDisplayString, createCommentVNode, onBeforeUnmount, toRaw, resolveComponent, createVNode, withCtx } from "vue";
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
26
  import { c as createComponent } from "./component.js";
27
+ import { u as useTaroRect } from "./index.js";
28
+ import Taro from "@tarojs/taro";
27
29
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
- import popup, { popupProps } from "./Popup.js";
29
- import "./OverLay.js";
30
- import "./Icon.js";
30
+ import { p as popupProps } from "./index4.js";
31
+ import "./use-lock-scroll.js";
31
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
+ };
32
53
  const { create: create$1 } = createComponent("oldpicker-column");
33
54
  const _sfc_main$1 = create$1({
34
- props: {
55
+ props: __spreadValues({
35
56
  dataType: String,
36
57
  itemShow: {
37
58
  type: Boolean,
38
59
  default: false
39
- },
40
- listData: {
41
- type: Object,
42
- default: () => {
43
- return {};
44
- }
45
- },
46
- readonly: {
47
- type: Boolean,
48
- default: false
49
- },
50
- defaultIndex: {
51
- type: [Number, String],
52
- default: 0
53
60
  }
54
- },
61
+ }, commonProps),
55
62
  emits: ["click", "change"],
56
63
  setup(props, { emit }) {
57
64
  const wrapper = ref();
@@ -61,7 +68,8 @@ const _sfc_main$1 = create$1({
61
68
  endY: 0,
62
69
  startTime: 0,
63
70
  endTime: 0,
64
- lastY: 0
71
+ lastY: 0,
72
+ lastTime: 0
65
73
  },
66
74
  currIndex: 1,
67
75
  transformY: 0,
@@ -89,6 +97,7 @@ const _sfc_main$1 = create$1({
89
97
  };
90
98
  });
91
99
  const onTouchStart = (event) => {
100
+ console.log(event);
92
101
  event.preventDefault();
93
102
  let changedTouches = event.changedTouches[0];
94
103
  state.touchParams.startY = changedTouches.pageY;
@@ -107,7 +116,7 @@ const _sfc_main$1 = create$1({
107
116
  event.preventDefault();
108
117
  let changedTouches = event.changedTouches[0];
109
118
  state.touchParams.lastY = changedTouches.pageY;
110
- state.touchParams.lastTime = event.timestamp || Date.now();
119
+ state.touchParams.lastTime = event.timeStamp || Date.now();
111
120
  let move = state.touchParams.lastY - state.touchParams.startY;
112
121
  let moveTime = state.touchParams.lastTime - state.touchParams.startTime;
113
122
  if (moveTime <= 300) {
@@ -118,11 +127,11 @@ const _sfc_main$1 = create$1({
118
127
  setMove(move, "end");
119
128
  }
120
129
  };
121
- const setRollerStyle = (index2) => {
122
- return `transform: rotate3d(1, 0, 0, ${-state.rotation * index2}deg) translate3d(0px, 0px, 104px)`;
130
+ const setRollerStyle = (index) => {
131
+ return `transform: rotate3d(1, 0, 0, ${-state.rotation * index}deg) translate3d(0px, 0px, 104px)`;
123
132
  };
124
- const isHidden = (index2) => {
125
- if (index2 >= state.currIndex + 8 || index2 <= state.currIndex - 8) {
133
+ const isHidden = (index) => {
134
+ if (index >= state.currIndex + 8 || index <= state.currIndex - 8) {
126
135
  return true;
127
136
  } else {
128
137
  return false;
@@ -170,25 +179,42 @@ const _sfc_main$1 = create$1({
170
179
  emit("change", state.currIndex - 1);
171
180
  };
172
181
  const modifyStatus = (type) => {
173
- let index2 = props.defaultIndex;
174
- state.currIndex = index2 === -1 ? 1 : index2 + 1;
175
- let move = index2 === -1 ? 0 : index2 * state.lineSpacing;
182
+ let index = props.defaultIndex;
183
+ state.currIndex = index === -1 ? 1 : index + 1;
184
+ let move = index === -1 ? 0 : index * state.lineSpacing;
176
185
  type && setChooseValue();
177
186
  setMove(-move);
178
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
+ };
179
193
  watch(() => props.listData, (val) => {
180
194
  state.transformY = 0;
181
195
  modifyStatus(false);
182
196
  }, {
183
197
  deep: true
184
198
  });
199
+ watch(() => props.itemShow, (val) => {
200
+ if (val) {
201
+ setTimeout(() => {
202
+ getReference();
203
+ }, 200);
204
+ }
205
+ }, {
206
+ deep: true
207
+ });
185
208
  watch(() => props.defaultIndex, (val) => {
186
209
  state.transformY = 0;
187
210
  modifyStatus(false);
188
211
  });
189
212
  onMounted(() => {
190
- modifyStatus(true);
213
+ setTimeout(() => {
214
+ getReference();
215
+ }, 200);
191
216
  });
217
+ const refRandomId = Math.random().toString(36).slice(-8);
192
218
  return __spreadProps(__spreadValues(__spreadValues({}, toRefs(state)), toRefs(props)), {
193
219
  wrapper,
194
220
  setRollerStyle,
@@ -201,17 +227,19 @@ const _sfc_main$1 = create$1({
201
227
  onTouchEnd,
202
228
  touchRollerStyle,
203
229
  touchListStyle,
204
- setMove
230
+ refRandomId
205
231
  });
206
232
  }
207
233
  });
208
234
  const _hoisted_1$1 = { class: "nut-oldpicker-content" };
209
- const _hoisted_2$1 = {
235
+ const _hoisted_2$1 = ["id"];
236
+ const _hoisted_3$1 = {
210
237
  key: 0,
211
238
  class: "nut-oldpicker-placeholder"
212
239
  };
213
240
  function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
214
- return openBlock(), createElementBlock("view", {
241
+ return _ctx.itemShow ? (openBlock(), createElementBlock("view", {
242
+ key: 0,
215
243
  class: "nut-oldpicker__list",
216
244
  onTouchstart: _cache[0] || (_cache[0] = (...args) => _ctx.onTouchStart && _ctx.onTouchStart(...args)),
217
245
  onTouchmove: _cache[1] || (_cache[1] = (...args) => _ctx.onTouchMove && _ctx.onTouchMove(...args)),
@@ -222,11 +250,11 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
222
250
  ref: "roller",
223
251
  style: normalizeStyle(_ctx.touchRollerStyle)
224
252
  }, [
225
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index2) => {
253
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index) => {
226
254
  return openBlock(), createElementBlock("view", {
227
- class: normalizeClass(["nut-oldpicker-roller-item", { "nut-oldpicker-roller-item-hidden": _ctx.isHidden(index2 + 1) }]),
228
- style: normalizeStyle(_ctx.setRollerStyle(index2 + 1)),
229
- key: item.label ? item.label : index2
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
230
258
  }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 7);
231
259
  }), 128))
232
260
  ], 4),
@@ -234,27 +262,27 @@ function _sfc_render$1(_ctx, _cache, $props, $setup, $data, $options) {
234
262
  createElementVNode("view", {
235
263
  class: "nut-oldpicker-list-panel",
236
264
  ref: "list",
265
+ id: "list" + _ctx.refRandomId,
237
266
  style: normalizeStyle(_ctx.touchListStyle)
238
267
  }, [
239
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index2) => {
268
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.listData.values, (item, index) => {
240
269
  return openBlock(), createElementBlock("view", {
241
270
  class: "nut-oldpicker-item nut-oldpicker-item-ref",
242
- key: item.label ? item.label : index2
271
+ key: item.label ? item.label : index
243
272
  }, toDisplayString(_ctx.dataType === "cascade" ? item.text : item), 1);
244
273
  }), 128)),
245
- _ctx.listData && _ctx.listData.length === 1 ? (openBlock(), createElementBlock("view", _hoisted_2$1)) : createCommentVNode("", true)
246
- ], 4)
274
+ _ctx.listData && _ctx.listData.length === 1 ? (openBlock(), createElementBlock("view", _hoisted_3$1)) : createCommentVNode("", true)
275
+ ], 12, _hoisted_2$1)
247
276
  ])
248
- ], 32);
277
+ ], 32)) : createCommentVNode("", true);
249
278
  }
250
279
  var column = /* @__PURE__ */ _export_sfc(_sfc_main$1, [["render", _sfc_render$1]]);
251
280
  const { create, componentName } = createComponent("oldpicker");
252
281
  const _sfc_main = create({
253
282
  components: {
254
- [column.name]: column,
255
- [popup.name]: popup
283
+ [column.name]: column
256
284
  },
257
- props: __spreadProps(__spreadValues({}, popupProps), {
285
+ props: __spreadValues(__spreadProps(__spreadValues({}, popupProps), {
258
286
  title: {
259
287
  type: String,
260
288
  default: ""
@@ -266,22 +294,8 @@ const _sfc_main = create({
266
294
  okText: {
267
295
  type: String,
268
296
  default: "\u786E\u5B9A"
269
- },
270
- listData: {
271
- type: Array,
272
- default: () => {
273
- return [];
274
- }
275
- },
276
- readonly: {
277
- type: Boolean,
278
- default: false
279
- },
280
- defaultIndex: {
281
- type: [Number, String],
282
- default: 0
283
297
  }
284
- }),
298
+ }), commonProps),
285
299
  emits: ["close", "change", "confirm", "update:visible"],
286
300
  setup(props, { emit }) {
287
301
  const childrenKey = "children";
@@ -396,14 +410,6 @@ const _sfc_main = create({
396
410
  }
397
411
  emit("update:visible", false);
398
412
  };
399
- onMounted(() => {
400
- if (props.visible)
401
- state.show = props.visible;
402
- });
403
- onBeforeUnmount(() => {
404
- if (props.visible)
405
- state.show = false;
406
- });
407
413
  watch(() => props.visible, (val) => {
408
414
  state.show = val;
409
415
  });
@@ -429,56 +435,52 @@ const _hoisted_4 = /* @__PURE__ */ createElementVNode("view", { class: "nut-oldp
429
435
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
430
436
  const _component_nut_oldpicker_column = resolveComponent("nut-oldpicker-column");
431
437
  const _component_nut_popup = resolveComponent("nut-popup");
432
- return openBlock(), createElementBlock("view", {
433
- class: normalizeClass(_ctx.classes)
434
- }, [
435
- createVNode(_component_nut_popup, {
436
- position: "bottom",
437
- visible: _ctx.show,
438
- "onUpdate:visible": _cache[2] || (_cache[2] = ($event) => _ctx.show = $event),
439
- teleport: _ctx.teleport,
440
- "lock-scroll": _ctx.lockScroll,
441
- "close-on-click-overlay": _ctx.closeOnClickOverlay,
442
- onClose: _ctx.close,
443
- round: true,
444
- isWrapTeleport: _ctx.isWrapTeleport
445
- }, {
446
- default: withCtx(() => [
447
- createElementVNode("view", _hoisted_1, [
448
- createElementVNode("view", {
449
- class: "nut-oldpicker__cancel nut-oldpicker__left nut-oldpicker__button",
450
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.close && _ctx.close(...args))
451
- }, toDisplayString(_ctx.cancelText), 1),
452
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.title), 1),
453
- createElementVNode("view", {
454
- class: "nut-oldpicker__confirm nut-oldpicker__button nut-oldpicker__right",
455
- onClick: _cache[1] || (_cache[1] = ($event) => _ctx.confirm())
456
- }, toDisplayString(_ctx.okText), 1)
457
- ]),
458
- createElementVNode("view", _hoisted_3, [
459
- _hoisted_4,
460
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.columnList, (item, columnIndex) => {
461
- return openBlock(), createElementBlock("view", {
462
- class: "nut-oldpicker__columnitem",
463
- key: columnIndex
464
- }, [
465
- createVNode(_component_nut_oldpicker_column, {
466
- itemShow: _ctx.show,
467
- "list-data": item,
468
- readonly: _ctx.readonly,
469
- "default-index": item.defaultIndex,
470
- "data-type": _ctx.dataType,
471
- onChange: (dataIndex) => {
472
- _ctx.changeHandler(columnIndex, dataIndex);
473
- }
474
- }, null, 8, ["itemShow", "list-data", "readonly", "default-index", "data-type", "onChange"])
475
- ]);
476
- }), 128))
477
- ])
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)
478
459
  ]),
479
- _: 1
480
- }, 8, ["visible", "teleport", "lock-scroll", "close-on-click-overlay", "onClose", "isWrapTeleport"])
481
- ], 2);
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"]);
482
484
  }
483
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
484
- export { index as default };
485
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
486
+ export { index_taro as default };