@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
@@ -18,11 +18,12 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { inject, reactive, computed, getCurrentInstance, ref, watch, onMounted, toRefs, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, renderSlot, normalizeStyle } from "vue";
25
+ import { inject, ref, reactive, computed, getCurrentInstance, watch, onMounted, toRefs, nextTick, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, createBlock, createCommentVNode, renderSlot, normalizeStyle } from "vue";
26
+ import Taro, { eventCenter, getCurrentInstance as getCurrentInstance$1 } from "@tarojs/taro";
26
27
  import { c as createComponent } from "./component.js";
27
28
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
29
  const { create, componentName } = createComponent("collapse-item");
@@ -51,6 +52,7 @@ const _sfc_main = create({
51
52
  },
52
53
  setup(props, ctx) {
53
54
  const collapse = inject("collapseParent");
55
+ const conHeight = ref("auto");
54
56
  const parent = reactive(collapse);
55
57
  const classes = computed(() => {
56
58
  const prefixCls = componentName;
@@ -69,7 +71,7 @@ const _sfc_main = create({
69
71
  icon: parent.props.icon,
70
72
  iconSize: parent.props.iconSize,
71
73
  iconColor: parent.props.iconColor,
72
- openExpanded: false,
74
+ openExpanded: null,
73
75
  iconStyle: {
74
76
  transform: "rotate(0deg)",
75
77
  marginTop: parent.props.iconHeght ? "-" + parent.props.iconHeght / 2 + "px" : "-10px"
@@ -84,31 +86,33 @@ const _sfc_main = create({
84
86
  const wrapperRef = ref(null);
85
87
  const contentRef = ref(null);
86
88
  const onTransitionEnd = () => {
87
- const wrapperRefEle = document.getElementsByClassName("collapse-wrapper")[0];
88
- if (wrapperRefEle) {
89
- wrapperRefEle.style.willChange = "auto";
90
- }
89
+ nextTick(() => {
90
+ parent.children.forEach((item1, index) => {
91
+ let ary = Array.from(item1.$el.children);
92
+ ary.forEach((item2, index2) => {
93
+ if (item2.className.includes("collapse-wrapper")) {
94
+ item2.style.willChange = "auto";
95
+ }
96
+ });
97
+ });
98
+ });
91
99
  };
92
100
  const animation = () => {
93
- const wrapperRefEle = wrapperRef.value;
94
- const contentRefEle = contentRef.value;
95
- if (!wrapperRefEle || !contentRefEle) {
96
- return;
101
+ if (parent.props.icon && !proxyData.openExpanded) {
102
+ proxyData.iconStyle["transform"] = "rotate(0deg)";
103
+ } else {
104
+ proxyData.iconStyle["transform"] = "rotate(" + parent.props.rotate + "deg)";
97
105
  }
98
- const offsetHeight = contentRefEle.offsetHeight || "auto";
99
- if (offsetHeight) {
100
- const contentHeight = `${offsetHeight}px`;
101
- wrapperRefEle.style.willChange = "height";
102
- wrapperRefEle.style.height = !proxyData.openExpanded ? 0 : contentHeight;
103
- if (parent.props.icon && !proxyData.openExpanded) {
104
- proxyData.iconStyle["transform"] = "rotate(0deg)";
105
- } else {
106
- proxyData.iconStyle["transform"] = "rotate(" + parent.props.rotate + "deg)";
106
+ nextTick(() => {
107
+ const query = Taro.getEnv() === "ALIPAY" ? my.createSelectorQuery() : Taro.createSelectorQuery();
108
+ query.selectAll(".collapse-content").boundingClientRect();
109
+ query.exec((res) => {
110
+ getH(res[0]);
111
+ });
112
+ if (!proxyData.openExpanded) {
113
+ onTransitionEnd();
107
114
  }
108
- }
109
- if (!proxyData.openExpanded) {
110
- onTransitionEnd();
111
- }
115
+ });
112
116
  };
113
117
  const open = () => {
114
118
  proxyData.openExpanded = !proxyData.openExpanded;
@@ -123,7 +127,7 @@ const _sfc_main = create({
123
127
  const currentName = computed(() => props.name);
124
128
  const toggleOpen = () => {
125
129
  if (parent.props.accordion) {
126
- parent.children.forEach((item, index2) => {
130
+ parent.children.forEach((item, index) => {
127
131
  if (currentName.value == item.name) {
128
132
  item.changeOpen(!item.openExpanded);
129
133
  } else {
@@ -157,11 +161,40 @@ const _sfc_main = create({
157
161
  watch(() => {
158
162
  var _a, _b;
159
163
  return (_b = (_a = ctx == null ? void 0 : ctx.slots) == null ? void 0 : _a.default) == null ? void 0 : _b.call(_a);
160
- }, () => {
164
+ }, (vnodes) => {
161
165
  setTimeout(() => {
162
- animation();
166
+ getRefHeight();
163
167
  }, 300);
164
168
  });
169
+ const getH = (list) => {
170
+ parent.children.forEach((item1, index1) => {
171
+ let ary = Array.from(item1.$el.children);
172
+ let _uid = ary[1].children[0]["uid"];
173
+ let tm = list.filter((item2) => item2.id == _uid);
174
+ if (tm && tm.length > 0) {
175
+ let h = tm[0]["height"];
176
+ item1.conHeight = h;
177
+ }
178
+ });
179
+ };
180
+ const getH5 = () => {
181
+ parent.children.forEach((item1, index1) => {
182
+ let ary = Array.from(item1.$el.children);
183
+ let h = ary[1].children[0]["offsetHeight"];
184
+ item1.conHeight = h;
185
+ });
186
+ };
187
+ const getRefHeight = () => {
188
+ const query = Taro.getEnv() === "ALIPAY" ? my.createSelectorQuery() : Taro.createSelectorQuery();
189
+ query.selectAll(".collapse-content").boundingClientRect();
190
+ query.exec((res) => {
191
+ if (Taro.getEnv() === "WEB") {
192
+ getH5();
193
+ } else {
194
+ getH(res[0]);
195
+ }
196
+ });
197
+ };
165
198
  onMounted(() => {
166
199
  const { name } = props;
167
200
  const active = parent && parent.props.active;
@@ -175,10 +208,18 @@ const _sfc_main = create({
175
208
  defaultOpen();
176
209
  }
177
210
  }
211
+ if (Taro.getEnv() === "WEB") {
212
+ getRefHeight();
213
+ } else {
214
+ eventCenter.once(getCurrentInstance$1().router.onReady, () => {
215
+ getRefHeight();
216
+ });
217
+ }
178
218
  });
179
219
  return __spreadProps(__spreadValues(__spreadValues(__spreadValues({
180
220
  classes
181
221
  }, toRefs(proxyData)), toRefs(parent.props)), toRefs(titleIconStyle)), {
222
+ conHeight,
182
223
  wrapperRef,
183
224
  contentRef,
184
225
  open,
@@ -197,10 +238,6 @@ const _hoisted_4 = {
197
238
  };
198
239
  const _hoisted_5 = ["innerHTML"];
199
240
  const _hoisted_6 = {
200
- class: "collapse-wrapper",
201
- ref: "wrapperRef"
202
- };
203
- const _hoisted_7 = {
204
241
  class: "collapse-content",
205
242
  ref: "contentRef"
206
243
  };
@@ -221,7 +258,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
221
258
  name: _ctx.titleIcon,
222
259
  size: _ctx.titleIconSize,
223
260
  color: _ctx.titleIconColor,
224
- class: normalizeClass([_ctx.titleIconPosition == "left" ? "titleIconLeft" : "titleIconRight"])
261
+ class: normalizeClass(["collapse-title-icon", _ctx.titleIconPosition == "left" ? "titleIconLeft" : "titleIconRight"])
225
262
  }, null, 8, ["name", "size", "color", "class"])) : createCommentVNode("", true),
226
263
  _ctx.$slots.mTitle ? renderSlot(_ctx.$slots, "mTitle", { key: 1 }) : (openBlock(), createElementBlock("view", {
227
264
  key: 2,
@@ -247,12 +284,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
247
284
  style: normalizeStyle(_ctx.iconStyle)
248
285
  }, null, 8, ["name", "size", "color", "class", "style"])) : createCommentVNode("", true)
249
286
  ], 2),
250
- createElementVNode("view", _hoisted_6, [
251
- createElementVNode("view", _hoisted_7, [
287
+ createElementVNode("view", {
288
+ class: normalizeClass(["collapse-wrapper", _ctx.openExpanded ? "open-style" : "close-style"]),
289
+ ref: "wrapperRef",
290
+ style: normalizeStyle({ height: _ctx.openExpanded ? _ctx.conHeight == "auto" ? "auto" : _ctx.conHeight + "px" : 0 })
291
+ }, [
292
+ createElementVNode("view", _hoisted_6, [
252
293
  renderSlot(_ctx.$slots, "default")
253
294
  ], 512)
254
- ], 512)
295
+ ], 6)
255
296
  ], 2);
256
297
  }
257
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
258
- export { index as default };
298
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
299
+ export { index_taro as default };
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
25
  import { reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, renderSlot, toDisplayString, Fragment, createElementVNode, createCommentVNode } from "vue";
@@ -62,7 +62,7 @@ const _sfc_main = create({
62
62
  }
63
63
  },
64
64
  components: {},
65
- emits: ["input", "on-end", "on-restart", "on-paused", "update:modelValue"],
65
+ emits: ["input", "on-end", "on-restart", "on-paused"],
66
66
  setup(props, { emit, slots }) {
67
67
  const state = reactive({
68
68
  restTime: 0,
@@ -125,11 +125,13 @@ const _sfc_main = create({
125
125
  const end = getTimeStamp(props.endTime || curr);
126
126
  const diffTime = curr - start;
127
127
  state.restTime = end - (start + diffTime);
128
+ clearInterval(state.timer);
129
+ state.timer = null;
128
130
  state.timer = setInterval(() => {
129
131
  if (!props.paused) {
130
132
  let restTime2 = end - (Date.now() - state.p + diffTime);
131
133
  state.restTime = restTime2;
132
- if (restTime2 < 0) {
134
+ if (restTime2 < delay) {
133
135
  state.restTime = 0;
134
136
  emit("on-end");
135
137
  clearInterval(state.timer);
@@ -219,5 +221,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
219
221
  ], 64))
220
222
  ], 2);
221
223
  }
222
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
223
- export { index as default };
224
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
225
+ export { index_taro as default };
@@ -18,8 +18,8 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
25
  import { getCurrentInstance, reactive, watch, nextTick, onMounted, onUnmounted, toRefs, openBlock, createElementBlock, Fragment, normalizeStyle, renderList, createCommentVNode, toDisplayString, createTextVNode } from "vue";
@@ -179,20 +179,20 @@ const _sfc_main = create({
179
179
  return m / baseNum;
180
180
  }
181
181
  };
182
- const topNumber = (index2) => {
182
+ const topNumber = (index) => {
183
183
  let { num_total_len, pointNum, initDigit1, initDigit2, sortFlag } = data;
184
- let idx1 = sortFlag == "add" || sortFlag == "equal" ? String(initDigit2)[index2 - (num_total_len - pointNum)] : 10 - Number(String(initDigit2)[index2 - (num_total_len - pointNum)]);
185
- let idx2 = sortFlag == "add" || sortFlag == "equal" ? String(initDigit1)[index2] : 10 - Number(String(initDigit1)[index2]);
186
- let num = index2 > num_total_len - pointNum - 1 ? -idx1 * 100 + "%" : index2 <= String(initDigit1).length - 1 ? -idx2 * 100 + "%" : 0;
184
+ let idx1 = sortFlag == "add" || sortFlag == "equal" ? String(initDigit2)[index - (num_total_len - pointNum)] : 10 - Number(String(initDigit2)[index - (num_total_len - pointNum)]);
185
+ let idx2 = sortFlag == "add" || sortFlag == "equal" ? String(initDigit1)[index] : 10 - Number(String(initDigit1)[index]);
186
+ let num = index > num_total_len - pointNum - 1 ? -idx1 * 100 + "%" : index <= String(initDigit1).length - 1 ? -idx2 * 100 + "%" : 0;
187
187
  if (num == "-1000%") {
188
188
  num = 0;
189
189
  }
190
190
  return num;
191
191
  };
192
- const turnNumber = (index2) => {
192
+ const turnNumber = (index) => {
193
193
  let { num_total_len, pointNum, initDigit1, initDigit2, sortFlag } = data;
194
- let idx1 = String(initDigit2)[index2 - (num_total_len - pointNum)];
195
- let num = index2 > num_total_len - pointNum - 1 ? idx1 ? idx1 : 0 : index2 <= String(initDigit1).length - 1 ? String(initDigit1)[index2] : 0;
194
+ let idx1 = String(initDigit2)[index - (num_total_len - pointNum)];
195
+ let num = index > num_total_len - pointNum - 1 ? idx1 ? idx1 : 0 : index <= String(initDigit1).length - 1 ? String(initDigit1)[index] : 0;
196
196
  return num;
197
197
  };
198
198
  const countChange = () => {
@@ -322,21 +322,21 @@ const _sfc_main = create({
322
322
  }, props.during);
323
323
  };
324
324
  const runStep = (el) => {
325
- let currentTurn = el.getAttribute("turn-number");
325
+ let currentTurn = el.style.all;
326
326
  let turningNum;
327
327
  if (data.sortFlag == "add") {
328
328
  turningNum = parseInt(String(currentTurn)) + 1;
329
329
  } else {
330
330
  turningNum = parseInt(String(currentTurn)) - 1 >= 0 ? parseInt(String(currentTurn)) - 1 : 9;
331
331
  }
332
- el.setAttribute("turn-number", String(turningNum));
333
- if (el.style.transition == "none 0s ease 0s" || turningNum == 1 || !el.style.transition) {
332
+ el.style.all = String(turningNum);
333
+ if (el.style.transition == "none" || turningNum == 1 || !el.style.transition) {
334
334
  el.style.transition = `all linear ${props.during}ms`;
335
335
  }
336
336
  if (turningNum == 10 || data.sortFlag == "reduce" && turningNum == 0) {
337
337
  var timeOut = null;
338
338
  el.style.top = `-${data.sortFlag == "add" ? turningNum * 100 : (10 - turningNum) * 100}%`;
339
- el.setAttribute("turn-number", "0");
339
+ el.style.all = "0";
340
340
  timeOut = setTimeout(() => {
341
341
  timeOut && clearTimeout(timeOut);
342
342
  el.style.transition = "none";
@@ -397,16 +397,16 @@ const _sfc_main = create({
397
397
  }
398
398
  };
399
399
  useExtend({ machineLuck });
400
- const scrollTime = (index2, total, num) => {
400
+ const scrollTime = (index, total, num) => {
401
401
  let t = setInterval(() => {
402
402
  if (num <= total) {
403
403
  num += 10;
404
- data.prizeY[index2] = parseFloat(String(num));
404
+ data.prizeY[index] = parseFloat(String(num));
405
405
  } else {
406
406
  clearInterval(t);
407
407
  t = null;
408
408
  data.finshMachine += 1;
409
- data.prizeY[index2] = total;
409
+ data.prizeY[index] = total;
410
410
  if (data.finshMachine == props.machineNum) {
411
411
  let distance = props.numHeight * props.machinePrizeNum;
412
412
  data.prizeYPrev = [];
@@ -458,17 +458,17 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
458
458
  class: "run-number-machine-img",
459
459
  style: normalizeStyle({ height: _ctx.numHeight + "px" })
460
460
  }, [
461
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.machineNum, (val, index2) => {
461
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.machineNum, (val, index) => {
462
462
  return openBlock(), createElementBlock("view", {
463
463
  class: "run-number-machine-img-li",
464
464
  ref_for: true,
465
465
  ref: "run-number-machine-img-li",
466
- key: "mImg" + index2,
466
+ key: "mImg" + index,
467
467
  style: normalizeStyle({
468
468
  width: _ctx.numWidth + "px",
469
469
  height: _ctx.numHeight + "px",
470
- backgroundImage: "url(" + _ctx.customBgImg + ")",
471
- backgroundPositionY: _ctx.prizeY[index2] + "px"
470
+ background: "url(" + _ctx.customBgImg + ") ",
471
+ backgroundPosition: "0 " + _ctx.prizeY[index] + "px"
472
472
  })
473
473
  }, null, 4);
474
474
  }), 128))
@@ -477,16 +477,16 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
477
477
  class: "run-number-img",
478
478
  style: normalizeStyle({ height: _ctx.numHeight + "px" })
479
479
  }, [
480
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.num_total_len, (val, index2) => {
480
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.num_total_len, (val, index) => {
481
481
  return openBlock(), createElementBlock("view", {
482
482
  class: "run-number-img-li",
483
- key: "cImg" + index2,
483
+ key: "cImg" + index,
484
484
  style: normalizeStyle({
485
485
  width: _ctx.numWidth + "px",
486
486
  height: _ctx.numHeight + "px",
487
- left: _ctx.numWidth * (index2 > _ctx.num_total_len - _ctx.pointNum - 1 ? index2 == _ctx.num_total_len - _ctx.pointNum ? index2 * 1.5 : index2 * 1.3 : index2) + "px",
487
+ left: _ctx.numWidth * (index > _ctx.num_total_len - _ctx.pointNum - 1 ? index == _ctx.num_total_len - _ctx.pointNum ? index * 1.5 : index * 1.3 : index) + "px",
488
488
  backgroundImage: "url(" + _ctx.customBgImg + ")",
489
- backgroundPosition: "0 " + -(String(_ctx.relNum)[index2] * _ctx.numHeight + _ctx.customSpacNum * String(_ctx.relNum)[index2]) + "px",
489
+ backgroundPosition: "0 " + -(String(_ctx.relNum)[index] * _ctx.numHeight + _ctx.customSpacNum * String(_ctx.relNum)[index]) + "px",
490
490
  transition: "all linear " + _ctx.during / 10 + "ms"
491
491
  })
492
492
  }, null, 4);
@@ -512,17 +512,18 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
512
512
  lineHeight: _ctx.numHeight + "px"
513
513
  })
514
514
  }, [
515
- (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.num_total_len, (val, index2) => {
515
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.num_total_len, (val, index) => {
516
516
  return openBlock(), createElementBlock("view", {
517
517
  ref_for: true,
518
518
  ref: "numberItem",
519
519
  class: "numberItem",
520
520
  key: val,
521
521
  style: normalizeStyle({
522
- top: _ctx.topNumber(index2),
523
- left: _ctx.numWidth * (index2 > _ctx.num_total_len - _ctx.pointNum - 1 ? index2 * 1.1 : index2) + "px"
522
+ all: _ctx.turnNumber(index),
523
+ top: _ctx.topNumber(index),
524
+ left: _ctx.numWidth * (index > _ctx.num_total_len - _ctx.pointNum - 1 ? index * 1.1 : index) + "px"
524
525
  }),
525
- "turn-number": _ctx.turnNumber(index2)
526
+ "turn-number": _ctx.turnNumber(index)
526
527
  }, [
527
528
  (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.to0_10, (item, idx) => {
528
529
  return openBlock(), createElementBlock("view", {
@@ -554,5 +555,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
554
555
  ], 64))
555
556
  ]);
556
557
  }
557
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
558
- export { index as default };
558
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
559
+ export { index_taro as default };
@@ -18,18 +18,29 @@ var __spreadValues = (a, b) => {
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
20
  /*!
21
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
- import { reactive, computed, onMounted, watch, toRefs, resolveComponent, openBlock, createBlock } from "vue";
26
- import picker from "./Picker.js";
25
+ import { reactive, computed, onBeforeMount, watch, toRefs, resolveComponent, openBlock, createBlock } from "vue";
26
+ import nutPicker from "./Picker.js";
27
+ import { p as popupProps } from "./index4.js";
27
28
  import { c as createComponent } from "./component.js";
28
29
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
30
  import "./Popup.js";
31
+ import "./use-lock-scroll.js";
30
32
  import "./OverLay.js";
31
33
  import "./Icon.js";
32
34
  import "./pxCheck.js";
35
+ import "./index.js";
36
+ import "@tarojs/taro";
37
+ function padZero(num, targetLength = 2) {
38
+ let str = num + "";
39
+ while (str.length < targetLength) {
40
+ str = "0" + str;
41
+ }
42
+ return str;
43
+ }
33
44
  const { componentName, create } = createComponent("datepicker");
34
45
  const currentYear = new Date().getFullYear();
35
46
  function isDate(val) {
@@ -45,25 +56,29 @@ const zhCNType = {
45
56
  };
46
57
  const _sfc_main = create({
47
58
  components: {
48
- [picker.name]: picker
59
+ nutPicker
49
60
  },
50
- props: {
61
+ props: __spreadProps(__spreadValues({}, popupProps), {
51
62
  modelValue: null,
52
- visible: {
53
- type: Boolean,
54
- default: false
55
- },
56
63
  title: {
57
64
  type: String,
58
65
  default: ""
59
66
  },
67
+ okText: {
68
+ type: String,
69
+ default: "\u786E\u5B9A"
70
+ },
71
+ cancelText: {
72
+ type: String,
73
+ default: "\u53D6\u6D88"
74
+ },
60
75
  type: {
61
76
  type: String,
62
77
  default: "date"
63
78
  },
64
79
  isShowChinese: {
65
80
  type: Boolean,
66
- default: true
81
+ default: false
67
82
  },
68
83
  minuteStep: {
69
84
  type: Number,
@@ -78,14 +93,20 @@ const _sfc_main = create({
78
93
  type: Date,
79
94
  default: () => new Date(currentYear + 10, 11, 31),
80
95
  validator: isDate
81
- }
82
- },
83
- emits: ["click", "update:visible", "confirm"],
96
+ },
97
+ formatter: {
98
+ type: Function,
99
+ default: null
100
+ },
101
+ filter: Function
102
+ }),
103
+ emits: ["click", "update:visible", "change", "confirm", "update:moduleValue"],
84
104
  setup(props, { emit }) {
85
105
  const state = reactive({
86
106
  show: false,
87
107
  currentDate: new Date(),
88
- title: props.title
108
+ title: props.title,
109
+ selectedValue: []
89
110
  });
90
111
  const formatValue = (value) => {
91
112
  if (!isDate(value)) {
@@ -181,42 +202,56 @@ const _sfc_main = create({
181
202
  }
182
203
  return result;
183
204
  });
184
- const changeHandler = (val) => {
205
+ const columns = computed(() => {
206
+ const val = ranges.value.map((res, columnIndex) => {
207
+ return generateValue(res.range[0], res.range[1], getDateIndex(res.type), res.type, columnIndex);
208
+ });
209
+ return val;
210
+ });
211
+ const changeHandler = ({
212
+ columnIndex,
213
+ selectedValue,
214
+ selectedOptions
215
+ }) => {
185
216
  if (["date", "datetime"].includes(props.type)) {
186
217
  let formatDate = [];
187
- if (props.isShowChinese) {
188
- formatDate = val.map((res) => {
189
- return Number(res.slice(0, res.length - 1));
190
- });
191
- } else {
192
- formatDate = val;
193
- }
218
+ formatDate = selectedValue;
194
219
  if (props.type === "date") {
195
220
  state.currentDate = formatValue(new Date(formatDate[0], formatDate[1] - 1, Math.min(formatDate[2], getMonthEndDay(formatDate[0], formatDate[1]))));
196
221
  } else if (props.type === "datetime") {
197
222
  state.currentDate = formatValue(new Date(formatDate[0], formatDate[1] - 1, Math.min(formatDate[2], getMonthEndDay(formatDate[0], formatDate[1])), formatDate[3], formatDate[4]));
198
223
  }
199
224
  }
225
+ emit("change", { columnIndex, selectedValue, selectedOptions });
226
+ };
227
+ const formatterOption = (type, value) => {
228
+ const { filter, formatter, isShowChinese } = props;
229
+ let fOption = null;
230
+ if (formatter) {
231
+ fOption = formatter(type, { text: padZero(value, 2), value: padZero(value, 2) });
232
+ } else {
233
+ const padMin = padZero(value, 2);
234
+ const fatter = isShowChinese ? zhCNType[type] : "";
235
+ fOption = { text: padMin + fatter, value: padMin };
236
+ }
237
+ return fOption;
200
238
  };
201
- const generateValue = (min, max, val, type) => {
239
+ const generateValue = (min, max, val, type, columnIndex) => {
202
240
  const arr = [];
203
- let index2 = 0;
241
+ let index = 0;
204
242
  while (min <= max) {
205
- if (props.isShowChinese) {
206
- arr.push(min + zhCNType[type]);
207
- } else {
208
- arr.push(min);
209
- }
243
+ arr.push(formatterOption(type, min));
210
244
  if (type === "minute") {
211
245
  min += props.minuteStep;
212
246
  } else {
213
247
  min++;
214
248
  }
215
249
  if (min <= val) {
216
- index2++;
250
+ index++;
217
251
  }
218
252
  }
219
- return { values: arr, defaultIndex: index2 };
253
+ state.selectedValue[columnIndex] = arr[index].value;
254
+ return props.filter ? props.filter(type, arr) : arr;
220
255
  };
221
256
  const getDateIndex = (type) => {
222
257
  if (type === "year") {
@@ -234,12 +269,6 @@ const _sfc_main = create({
234
269
  }
235
270
  return 0;
236
271
  };
237
- const columns = computed(() => {
238
- const val = ranges.value.map((res) => {
239
- return generateValue(res.range[0], res.range[1], getDateIndex(res.type), res.type);
240
- });
241
- return val;
242
- });
243
272
  const closeHandler = () => {
244
273
  emit("update:visible", false);
245
274
  };
@@ -247,9 +276,12 @@ const _sfc_main = create({
247
276
  emit("update:visible", false);
248
277
  emit("confirm", val);
249
278
  };
250
- onMounted(() => {
279
+ onBeforeMount(() => {
251
280
  state.currentDate = formatValue(props.modelValue);
252
281
  });
282
+ watch(() => props.modelValue, (value) => {
283
+ state.currentDate = formatValue(value);
284
+ });
253
285
  watch(() => props.title, (val) => {
254
286
  state.title = val;
255
287
  });
@@ -267,13 +299,18 @@ const _sfc_main = create({
267
299
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
268
300
  const _component_nut_picker = resolveComponent("nut-picker");
269
301
  return openBlock(), createBlock(_component_nut_picker, {
302
+ modelValue: _ctx.selectedValue,
303
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.selectedValue = $event),
270
304
  visible: _ctx.show,
305
+ okText: _ctx.okText,
306
+ cancelText: _ctx.cancelText,
271
307
  onClose: _ctx.closeHandler,
272
- "list-data": _ctx.columns,
308
+ columns: _ctx.columns,
273
309
  onChange: _ctx.changeHandler,
274
310
  title: _ctx.title,
275
- onConfirm: _ctx.confirm
276
- }, null, 8, ["visible", "onClose", "list-data", "onChange", "title", "onConfirm"]);
311
+ onConfirm: _ctx.confirm,
312
+ isWrapTeleport: _ctx.isWrapTeleport
313
+ }, null, 8, ["modelValue", "visible", "okText", "cancelText", "onClose", "columns", "onChange", "title", "onConfirm", "isWrapTeleport"]);
277
314
  }
278
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
279
- export { index as default };
315
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
316
+ export { index_taro as default };