@nutui/nutui 3.1.12-beta.0 → 3.1.12-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 (99) hide show
  1. package/dist/nutui.d.ts +4 -1
  2. package/dist/nutui.es.js +3943 -4130
  3. package/dist/nutui.umd.js +3947 -4201
  4. package/dist/packages/_es/ActionSheet.js +13 -12
  5. package/dist/packages/_es/Address.js +63 -49
  6. package/dist/packages/_es/Avatar.js +4 -5
  7. package/dist/packages/_es/BackTop.js +72 -109
  8. package/dist/packages/_es/Badge.js +4 -5
  9. package/dist/packages/_es/Barrage.js +63 -57
  10. package/dist/packages/_es/Button.js +5 -6
  11. package/dist/packages/_es/Calendar.js +27 -18
  12. package/dist/packages/_es/Card.js +104 -0
  13. package/dist/packages/_es/Cell.js +5 -13
  14. package/dist/packages/_es/CellGroup.js +4 -5
  15. package/dist/packages/_es/Checkbox.js +3 -3
  16. package/dist/packages/_es/CheckboxGroup.js +9 -4
  17. package/dist/packages/_es/CircleProgress.js +142 -46
  18. package/dist/packages/_es/Col.js +4 -5
  19. package/dist/packages/_es/Collapse.js +35 -10
  20. package/dist/packages/_es/CollapseItem.js +80 -35
  21. package/dist/packages/_es/CountDown.js +7 -5
  22. package/dist/packages/_es/CountUp.js +34 -31
  23. package/dist/packages/_es/DatePicker.js +451 -219
  24. package/dist/packages/_es/Dialog.js +24 -89
  25. package/dist/packages/_es/Divider.js +5 -6
  26. package/dist/packages/_es/Drag.js +76 -50
  27. package/dist/packages/_es/Elevator.js +81 -52
  28. package/dist/packages/_es/FixedNav.js +8 -9
  29. package/dist/packages/_es/Form.js +137 -0
  30. package/dist/packages/_es/FormItem.js +109 -0
  31. package/dist/packages/_es/Icon.js +6 -40
  32. package/dist/packages/_es/ImagePreview.js +23 -21
  33. package/dist/packages/_es/InfiniteLoading.js +95 -109
  34. package/dist/packages/_es/Input.js +22 -21
  35. package/dist/packages/_es/InputNumber.js +24 -18
  36. package/dist/packages/_es/Layout.js +2 -2
  37. package/dist/packages/_es/Menu.js +16 -14
  38. package/dist/packages/_es/MenuItem.js +9 -11
  39. package/dist/packages/_es/Navbar.js +7 -7
  40. package/dist/packages/_es/NoticeBar.js +39 -26
  41. package/dist/packages/_es/Notify.js +30 -166
  42. package/dist/packages/_es/NumberKeyboard.js +10 -6
  43. package/dist/packages/_es/OverLay.js +22 -29
  44. package/dist/packages/_es/Pagination.js +8 -9
  45. package/dist/packages/_es/Picker.js +61 -447
  46. package/dist/packages/_es/Popover.js +146 -25
  47. package/dist/packages/_es/Popup.js +17 -77
  48. package/dist/packages/_es/Price.js +18 -7
  49. package/dist/packages/_es/Progress.js +23 -12
  50. package/dist/packages/_es/Radio.js +3 -3
  51. package/dist/packages/_es/RadioGroup.js +2 -2
  52. package/dist/packages/_es/Range.js +37 -30
  53. package/dist/packages/_es/Rate.js +16 -20
  54. package/dist/packages/_es/Row.js +4 -5
  55. package/dist/packages/_es/SearchBar.js +7 -5
  56. package/dist/packages/_es/ShortPassword.js +89 -59
  57. package/dist/packages/_es/Signature.js +70 -71
  58. package/dist/packages/_es/Sku.js +54 -79
  59. package/dist/packages/_es/Step.js +10 -8
  60. package/dist/packages/_es/Steps.js +2 -2
  61. package/dist/packages/_es/Swipe.js +42 -27
  62. package/dist/packages/_es/Swiper.js +17 -418
  63. package/dist/packages/_es/SwiperItem.js +14 -39
  64. package/dist/packages/_es/Switch.js +4 -5
  65. package/dist/packages/_es/TabPane.js +4 -5
  66. package/dist/packages/_es/Tabbar.js +4 -5
  67. package/dist/packages/_es/TabbarItem.js +8 -9
  68. package/dist/packages/_es/Tabs.js +22 -16
  69. package/dist/packages/_es/Tag.js +5 -6
  70. package/dist/packages/_es/TextArea.js +16 -12
  71. package/dist/packages/_es/TimeDetail.js +7 -5
  72. package/dist/packages/_es/TimePannel.js +7 -5
  73. package/dist/packages/_es/TimeSelect.js +12 -7
  74. package/dist/packages/_es/Toast.js +41 -163
  75. package/dist/packages/_es/Uploader.js +109 -149
  76. package/dist/packages/_es/commonProps.js +30 -0
  77. package/dist/packages/_es/component.js +1 -1
  78. package/dist/packages/_es/index.js +1 -1
  79. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
  80. package/dist/packages/_es/index2.js +40 -27
  81. package/dist/packages/_es/index3.js +413 -7
  82. package/dist/packages/_es/pxCheck.js +1 -1
  83. package/dist/packages/_es/raf.js +1 -1
  84. package/dist/packages/_es/use-lock-scroll.js +23 -0
  85. package/dist/packages/_es/util.js +47 -0
  86. package/dist/packages/button/index.scss +6 -0
  87. package/dist/packages/card/index.scss +97 -0
  88. package/dist/packages/checkbox/index.scss +1 -1
  89. package/dist/packages/form/index.scss +2 -0
  90. package/dist/packages/formitem/index.scss +60 -0
  91. package/dist/packages/numberkeyboard/index.scss +1 -1
  92. package/dist/packages/switch/index.scss +1 -1
  93. package/dist/style.css +1 -1
  94. package/dist/style.es.js +1 -2
  95. package/dist/styles/themes/default.scss +35 -32
  96. package/dist/styles/variables.scss +11 -1
  97. package/package.json +2 -2
  98. package/dist/packages/_es/Video.js +0 -405
  99. package/dist/packages/_es/plugin-vue_export-helper.js +0 -13
@@ -17,18 +17,21 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __require = typeof require !== "undefined" ? require : (x) => {
21
+ throw new Error('Dynamic require of "' + x + '" is not supported');
22
+ };
20
23
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
24
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
22
25
  * (c) 2021 @jdf2e.
23
26
  * Released under the MIT License.
24
27
  */
28
+ import Taro from "@tarojs/taro";
25
29
  import { ref, computed, toRefs, openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle, normalizeClass, withModifiers, Fragment, renderList, renderSlot } from "vue";
26
30
  import { c as createComponent } from "./component.js";
27
31
  import { u as useTouch } from "./index.js";
28
- import { u as useRect } from "./index2.js";
29
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
32
+ import { u as useTaroRect } from "./index2.js";
30
33
  const { componentName, create } = createComponent("range");
31
- const _sfc_main = create({
34
+ var _sfc_main = create({
32
35
  props: {
33
36
  range: {
34
37
  type: Boolean,
@@ -138,13 +141,13 @@ const _sfc_main = create({
138
141
  emit("change", value);
139
142
  }
140
143
  };
141
- const onClick = (event) => {
144
+ const onClick = async (event) => {
142
145
  if (props.disabled) {
143
146
  return;
144
147
  }
145
148
  const { min, modelValue } = props;
146
- const rect = useRect(root);
147
- const delta = event.clientX - rect.left;
149
+ const rect = await useTaroRect(root, Taro);
150
+ const delta = event.touches[0].clientX - rect.left;
148
151
  const total = rect.width;
149
152
  const value = Number(min) + delta / total * scope.value;
150
153
  if (isRange(modelValue)) {
@@ -172,7 +175,7 @@ const _sfc_main = create({
172
175
  }
173
176
  dragStatus.value = "start";
174
177
  };
175
- const onTouchMove = (event) => {
178
+ const onTouchMove = async (event) => {
176
179
  if (props.disabled) {
177
180
  return;
178
181
  }
@@ -181,7 +184,7 @@ const _sfc_main = create({
181
184
  }
182
185
  touch.move(event);
183
186
  dragStatus.value = "draging";
184
- const rect = useRect(root);
187
+ const rect = await useTaroRect(root, Taro);
185
188
  const delta = touch.deltaX.value;
186
189
  const total = rect.width;
187
190
  const diff = delta / total * scope.value;
@@ -208,6 +211,7 @@ const _sfc_main = create({
208
211
  const value = typeof idx === "number" ? props.modelValue[idx] : props.modelValue;
209
212
  return value;
210
213
  };
214
+ const refRandomId = Math.random().toString(36).slice(-8);
211
215
  return __spreadProps(__spreadValues({
212
216
  root,
213
217
  classes,
@@ -220,7 +224,8 @@ const _sfc_main = create({
220
224
  }, toRefs(props)), {
221
225
  barStyle,
222
226
  curValue,
223
- buttonIndex
227
+ buttonIndex,
228
+ refRandomId
224
229
  });
225
230
  }
226
231
  });
@@ -229,17 +234,18 @@ const _hoisted_2 = {
229
234
  key: 0,
230
235
  class: "min"
231
236
  };
232
- const _hoisted_3 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
233
- const _hoisted_4 = {
237
+ const _hoisted_3 = ["id"];
238
+ const _hoisted_4 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
239
+ const _hoisted_5 = {
234
240
  key: 0,
235
241
  class: "number"
236
242
  };
237
- const _hoisted_5 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
238
- const _hoisted_6 = {
243
+ const _hoisted_6 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
244
+ const _hoisted_7 = {
239
245
  key: 0,
240
246
  class: "number"
241
247
  };
242
- const _hoisted_7 = {
248
+ const _hoisted_8 = {
243
249
  key: 1,
244
250
  class: "max"
245
251
  };
@@ -248,6 +254,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
248
254
  !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(+_ctx.min), 1)) : createCommentVNode("", true),
249
255
  createElementVNode("view", {
250
256
  ref: "root",
257
+ id: "root-" + _ctx.refRandomId,
251
258
  style: normalizeStyle(_ctx.wrapperStyle),
252
259
  class: normalizeClass(_ctx.classes),
253
260
  onClick: _cache[9] || (_cache[9] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
@@ -256,22 +263,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
256
263
  class: "nut-range-bar",
257
264
  style: normalizeStyle(_ctx.barStyle)
258
265
  }, [
259
- _ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index2) => {
266
+ _ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index) => {
260
267
  return createElementVNode("view", {
261
- key: index2,
268
+ key: index,
262
269
  role: "slider",
263
270
  class: normalizeClass({
264
- "nut-range-button-wrapper-left": index2 == 0,
265
- "nut-range-button-wrapper-right": index2 == 1
271
+ "nut-range-button-wrapper-left": index == 0,
272
+ "nut-range-button-wrapper-right": index == 1
266
273
  }),
267
274
  tabindex: _ctx.disabled ? -1 : 0,
268
275
  "aria-valuemin": +_ctx.min,
269
- "aria-valuenow": _ctx.curValue(index2),
276
+ "aria-valuenow": _ctx.curValue(index),
270
277
  "aria-valuemax": +_ctx.max,
271
278
  "aria-orientation": "horizontal",
272
279
  onTouchstart: withModifiers((e) => {
273
- if (typeof index2 === "number") {
274
- _ctx.buttonIndex = index2;
280
+ if (typeof index === "number") {
281
+ _ctx.buttonIndex = index;
275
282
  }
276
283
  _ctx.onTouchStart(e);
277
284
  }, ["stop", "prevent"]),
@@ -285,9 +292,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
285
292
  class: "nut-range-button",
286
293
  style: normalizeStyle(_ctx.buttonStyle)
287
294
  }, [
288
- !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_4, toDisplayString(_ctx.curValue(index2)), 1)) : createCommentVNode("", true)
295
+ !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_5, toDisplayString(_ctx.curValue(index)), 1)) : createCommentVNode("", true)
289
296
  ], 4))
290
- ], 42, _hoisted_3);
297
+ ], 42, _hoisted_4);
291
298
  }), 64)) : (openBlock(), createElementBlock("view", {
292
299
  key: 1,
293
300
  role: "slider",
@@ -310,13 +317,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
310
317
  class: "nut-range-button",
311
318
  style: normalizeStyle(_ctx.buttonStyle)
312
319
  }, [
313
- !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_6, toDisplayString(_ctx.curValue(_ctx.index)), 1)) : createCommentVNode("", true)
320
+ !_ctx.hiddenTag ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(_ctx.curValue(_ctx.index)), 1)) : createCommentVNode("", true)
314
321
  ], 4))
315
- ], 40, _hoisted_5))
322
+ ], 40, _hoisted_6))
316
323
  ], 4)
317
- ], 6),
318
- !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_7, toDisplayString(+_ctx.max), 1)) : createCommentVNode("", true)
324
+ ], 14, _hoisted_3),
325
+ !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_8, toDisplayString(+_ctx.max), 1)) : createCommentVNode("", true)
319
326
  ]);
320
327
  }
321
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
322
- export { index as default };
328
+ _sfc_main.render = _sfc_render;
329
+ export { _sfc_main as default };
@@ -1,14 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, Fragment, renderList, normalizeStyle, createVNode, createBlock, createCommentVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
8
  import { p as pxCheck } from "./pxCheck.js";
9
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
9
  const { componentName, create } = createComponent("rate");
11
- const _sfc_main = create({
10
+ var _sfc_main = create({
12
11
  props: {
13
12
  count: {
14
13
  type: [String, Number],
@@ -63,20 +62,16 @@ const _sfc_main = create({
63
62
  [prefixCls]: true
64
63
  };
65
64
  });
66
- const onClick = (e, index2) => {
67
- e.preventDefault();
68
- e.stopPropagation();
65
+ const onClick = (e, index) => {
69
66
  if (props.disabled || props.readonly)
70
67
  return;
71
68
  let value = 0;
72
- if (index2 === 1 && props.modelValue === index2)
69
+ if (index === 1 && props.modelValue === index)
73
70
  ;
74
71
  else {
75
- value = index2;
76
- if (props.allowHalf) {
77
- if ((e == null ? void 0 : e.target).className.includes("__icon--half")) {
78
- value -= 0.5;
79
- }
72
+ value = index;
73
+ if (props.allowHalf && e == 2) {
74
+ value -= 0.5;
80
75
  }
81
76
  }
82
77
  emit("update:modelValue", value);
@@ -89,7 +84,6 @@ const _sfc_main = create({
89
84
  };
90
85
  }
91
86
  });
92
- const _hoisted_1 = ["onClick"];
93
87
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
94
88
  const _component_nut_icon = resolveComponent("nut-icon");
95
89
  return openBlock(), createElementBlock("view", {
@@ -99,31 +93,33 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
99
93
  return openBlock(), createElementBlock("view", {
100
94
  class: "nut-rate-item",
101
95
  key: n,
102
- onClick: ($event) => _ctx.onClick($event, n),
103
96
  style: normalizeStyle({ marginRight: _ctx.pxCheck(_ctx.spacing) })
104
97
  }, [
105
98
  createVNode(_component_nut_icon, {
106
99
  size: _ctx.iconSize,
107
100
  class: normalizeClass(["nut-rate-item__icon", { "nut-rate-item__icon--disabled": _ctx.disabled || n > _ctx.modelValue }]),
101
+ onClick: ($event) => _ctx.onClick(1, n),
108
102
  color: n <= _ctx.modelValue ? _ctx.activeColor : _ctx.voidColor,
109
103
  name: n <= _ctx.modelValue ? _ctx.checkedIcon : _ctx.uncheckedIcon
110
- }, null, 8, ["size", "class", "color", "name"]),
104
+ }, null, 8, ["size", "onClick", "class", "color", "name"]),
111
105
  _ctx.allowHalf && _ctx.modelValue + 1 > n ? (openBlock(), createBlock(_component_nut_icon, {
112
106
  key: 0,
113
107
  class: "nut-rate-item__icon nut-rate-item__icon--half",
108
+ onClick: ($event) => _ctx.onClick(2, n),
114
109
  color: n <= _ctx.modelValue ? _ctx.activeColor : _ctx.voidColor,
115
110
  size: _ctx.iconSize,
116
111
  name: _ctx.checkedIcon
117
- }, null, 8, ["color", "size", "name"])) : _ctx.allowHalf && _ctx.modelValue + 1 < n ? (openBlock(), createBlock(_component_nut_icon, {
112
+ }, null, 8, ["onClick", "color", "size", "name"])) : _ctx.allowHalf && _ctx.modelValue + 1 < n ? (openBlock(), createBlock(_component_nut_icon, {
118
113
  key: 1,
119
114
  class: "nut-rate-item__icon nut-rate-item__icon--disabled nut-rate-item__icon--half",
115
+ onClick: ($event) => _ctx.onClick(2, n),
120
116
  color: _ctx.voidColor,
121
117
  size: _ctx.iconSize,
122
118
  name: _ctx.uncheckedIcon
123
- }, null, 8, ["color", "size", "name"])) : createCommentVNode("", true)
124
- ], 12, _hoisted_1);
119
+ }, null, 8, ["onClick", "color", "size", "name"])) : createCommentVNode("", true)
120
+ ], 4);
125
121
  }), 128))
126
122
  ], 2);
127
123
  }
128
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
129
- export { index as default };
124
+ _sfc_main.render = _sfc_render;
125
+ export { _sfc_main as default };
@@ -1,13 +1,12 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { provide, openBlock, createElementBlock, normalizeClass, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
8
  const { componentName, create } = createComponent("row");
10
- const _sfc_main = create({
9
+ var _sfc_main = create({
11
10
  props: {
12
11
  type: {
13
12
  type: String,
@@ -57,5 +56,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
57
56
  renderSlot(_ctx.$slots, "default")
58
57
  ], 2);
59
58
  }
60
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
61
- export { index as default };
59
+ _sfc_main.render = _sfc_render;
60
+ export { _sfc_main as default };
@@ -17,16 +17,18 @@ var __spreadValues = (a, b) => {
17
17
  return a;
18
18
  };
19
19
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ var __require = typeof require !== "undefined" ? require : (x) => {
21
+ throw new Error('Dynamic require of "' + x + '" is not supported');
22
+ };
20
23
  /*!
21
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
24
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
22
25
  * (c) 2021 @jdf2e.
23
26
  * Released under the MIT License.
24
27
  */
25
28
  import { reactive, computed, toRefs, resolveComponent, openBlock, createElementBlock, normalizeStyle, renderSlot, createCommentVNode, createElementVNode, withModifiers, withDirectives, createVNode, vShow } from "vue";
26
29
  import { c as createComponent } from "./component.js";
27
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
30
  const { create } = createComponent("searchbar");
29
- const _sfc_main = create({
31
+ var _sfc_main = create({
30
32
  props: {
31
33
  modelValue: {
32
34
  type: [String, Number],
@@ -190,5 +192,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
190
192
  ])) : createCommentVNode("", true)
191
193
  ], 4);
192
194
  }
193
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
194
- export { index as default };
195
+ _sfc_main.render = _sfc_render;
196
+ export { _sfc_main as default };
@@ -1,13 +1,13 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.12-beta.0 Mon Nov 22 2021 20:58:07 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.11 Wed Nov 24 2021 14:54:38 GMT+0800 (中国标准时间)
3
3
  * (c) 2021 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, computed, watch, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withDirectives, normalizeStyle, vModelText, Fragment, renderList, createCommentVNode } from "vue";
6
+ import { ref, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, createVNode, withCtx, createElementVNode, toDisplayString, withDirectives, vModelText, createCommentVNode, Fragment, renderList } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
8
+ import Taro, { eventCenter, getCurrentInstance } from "@tarojs/taro";
9
9
  const { create } = createComponent("shortpassword");
10
- const _sfc_main = create({
10
+ var _sfc_main = create({
11
11
  props: {
12
12
  title: {
13
13
  type: String,
@@ -52,18 +52,43 @@ const _sfc_main = create({
52
52
  const realpwd = ref();
53
53
  const comLen = computed(() => range(Number(props.length)));
54
54
  const show = ref(props.visible);
55
+ const refRandomId = Math.random().toString(36).slice(-8);
56
+ const randRef = ref(refRandomId);
57
+ const isWx = ref(false);
55
58
  function sureClick() {
56
59
  emit("ok", realInput.value);
57
60
  }
58
61
  function focus() {
59
- realpwd.value.focus();
62
+ let dom = "";
63
+ console.log(123);
64
+ if (isWx.value) {
65
+ setTimeout(() => {
66
+ if (!document.getElementById("nut-input-real-taro-" + randRef.value))
67
+ return;
68
+ dom = document.getElementById("nut-input-real-taro-" + randRef.value);
69
+ if (!dom)
70
+ return;
71
+ dom.focus();
72
+ }, 150);
73
+ } else {
74
+ dom = document.getElementsByClassName("nut-input-real")[0];
75
+ let h = dom.children[0];
76
+ h.focus();
77
+ }
60
78
  }
61
79
  watch(() => props.visible, (value) => {
62
80
  show.value = value;
81
+ if (value) {
82
+ randRef.value = Math.random().toString(36).slice(-8);
83
+ if (Taro.getEnv() === "WEB") {
84
+ isWx.value = false;
85
+ } else {
86
+ isWx.value = true;
87
+ }
88
+ }
63
89
  });
64
90
  watch(() => props.modelValue, (value) => {
65
91
  realInput.value = value;
66
- console.log("watch", value);
67
92
  });
68
93
  function changeValue(e) {
69
94
  const input = e.target;
@@ -92,54 +117,46 @@ const _sfc_main = create({
92
117
  function onTips() {
93
118
  emit("tips");
94
119
  }
95
- function systemStyle() {
96
- let u = navigator.userAgent;
97
- let isAndroid = u.indexOf("Android") > -1 || u.indexOf("Linux") > -1;
98
- let isIOS = !!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
99
- if (isIOS) {
100
- return {
101
- paddingRight: "1200px"
102
- };
103
- }
104
- if (isAndroid) {
105
- return {
106
- opacity: 0,
107
- zindex: 10
108
- };
120
+ onMounted(() => {
121
+ eventCenter.once(getCurrentInstance().router.onReady, () => {
122
+ });
123
+ if (Taro.getEnv() === "WEB") {
124
+ isWx.value = false;
125
+ } else {
126
+ isWx.value = true;
109
127
  }
110
- }
128
+ });
111
129
  return {
112
130
  comLen,
113
131
  sureClick,
114
132
  realInput,
115
133
  realpwd,
116
- focus,
117
134
  range,
118
135
  changeValue,
119
136
  close,
120
137
  onTips,
138
+ focus,
121
139
  show,
122
- systemStyle,
123
- closeIcon
140
+ closeIcon,
141
+ isWx,
142
+ refRandomId,
143
+ randRef
124
144
  };
125
145
  }
126
146
  });
127
147
  const _hoisted_1 = { class: "nut-shortpsd-title" };
128
- const _hoisted_2 = { class: "nut-shortpsd-subtitle" };
129
- const _hoisted_3 = { class: "nut-input-normalw" };
130
- const _hoisted_4 = /* @__PURE__ */ createElementVNode("div", { class: "nut-input-site" }, null, -1);
131
- const _hoisted_5 = {
148
+ const _hoisted_2 = { class: "nut-shortpsdWx-subtitle" };
149
+ const _hoisted_3 = ["id", "maxlength"];
150
+ const _hoisted_4 = { class: "nut-input-w" };
151
+ const _hoisted_5 = /* @__PURE__ */ createElementVNode("view", { class: "nut-input-site" }, null, -1);
152
+ const _hoisted_6 = {
132
153
  key: 0,
133
154
  class: "nut-shortpsd-icon"
134
155
  };
135
- const _hoisted_6 = { class: "nut-shortpsd-message" };
136
- const _hoisted_7 = { class: "nut-shortpsd-error" };
137
- const _hoisted_8 = {
138
- key: 0,
139
- class: "nut-shortpsd-forget"
140
- };
156
+ const _hoisted_7 = { class: "nut-shortpsd-message" };
157
+ const _hoisted_8 = { class: "nut-shortpsd-error" };
141
158
  const _hoisted_9 = {
142
- key: 0,
159
+ key: 1,
143
160
  class: "nut-shortpsd-footer"
144
161
  };
145
162
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
@@ -153,7 +170,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
153
170
  textAlign: "center"
154
171
  },
155
172
  visible: _ctx.show,
156
- "onUpdate:visible": _cache[6] || (_cache[6] = ($event) => _ctx.show = $event),
173
+ "onUpdate:visible": _cache[8] || (_cache[8] = ($event) => _ctx.show = $event),
157
174
  closeable: true,
158
175
  onClickCloseIcon: _ctx.closeIcon,
159
176
  "close-on-click-overlay": _ctx.closeOnClickOverlay,
@@ -162,54 +179,67 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
162
179
  default: withCtx(() => [
163
180
  createElementVNode("view", _hoisted_1, toDisplayString(_ctx.title), 1),
164
181
  createElementVNode("view", _hoisted_2, toDisplayString(_ctx.desc), 1),
165
- createElementVNode("div", _hoisted_3, [
166
- withDirectives(createElementVNode("input", {
182
+ _ctx.isWx && _ctx.visible ? withDirectives((openBlock(), createElementBlock("input", {
183
+ key: 0,
184
+ class: "nut-input-real-taro",
185
+ id: "nut-input-real-taro-" + _ctx.randRef,
186
+ type: "number",
187
+ maxlength: _ctx.length,
188
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.realInput = $event),
189
+ onInput: _cache[1] || (_cache[1] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
190
+ }, null, 40, _hoisted_3)), [
191
+ [vModelText, _ctx.realInput]
192
+ ]) : createCommentVNode("", true),
193
+ createElementVNode("view", _hoisted_4, [
194
+ !_ctx.isWx ? withDirectives((openBlock(), createElementBlock("input", {
195
+ key: 0,
167
196
  ref: "realpwd",
168
197
  class: "nut-input-real",
169
198
  type: "number",
170
199
  maxlength: "6",
171
- style: normalizeStyle(_ctx.systemStyle()),
172
- "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => _ctx.realInput = $event),
173
- onInput: _cache[1] || (_cache[1] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
174
- }, null, 36), [
200
+ "onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => _ctx.realInput = $event),
201
+ onInput: _cache[3] || (_cache[3] = (...args) => _ctx.changeValue && _ctx.changeValue(...args))
202
+ }, null, 544)), [
175
203
  [vModelText, _ctx.realInput]
176
- ]),
177
- _hoisted_4,
204
+ ]) : createCommentVNode("", true),
205
+ _hoisted_5,
178
206
  createElementVNode("view", {
179
- class: "nut-shortpsd-fake",
180
- onClick: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
207
+ class: "nut-shortpsd-fake-taro",
208
+ onClick: _cache[4] || (_cache[4] = (...args) => _ctx.focus && _ctx.focus(...args))
181
209
  }, [
182
- (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(_ctx.comLen), (sublen, index2) => {
210
+ (openBlock(true), createElementBlock(Fragment, null, renderList(new Array(_ctx.comLen), (sublen, index) => {
183
211
  return openBlock(), createElementBlock("view", {
184
212
  class: "nut-shortpsd-li",
185
- key: index2
213
+ key: index
186
214
  }, [
187
- String(_ctx.realInput).length > index2 ? (openBlock(), createElementBlock("view", _hoisted_5)) : createCommentVNode("", true)
215
+ String(_ctx.realInput).length > index ? (openBlock(), createElementBlock("view", _hoisted_6)) : createCommentVNode("", true)
188
216
  ]);
189
217
  }), 128))
190
218
  ])
191
219
  ]),
192
- createElementVNode("view", _hoisted_6, [
193
- createElementVNode("view", _hoisted_7, toDisplayString(_ctx.errorMsg), 1),
194
- _ctx.tips ? (openBlock(), createElementBlock("view", _hoisted_8, [
220
+ createElementVNode("view", _hoisted_7, [
221
+ createElementVNode("view", _hoisted_8, toDisplayString(_ctx.errorMsg), 1),
222
+ _ctx.tips ? (openBlock(), createElementBlock("view", {
223
+ key: 0,
224
+ class: "nut-shortpsd-forget",
225
+ onClick: _cache[5] || (_cache[5] = (...args) => _ctx.onTips && _ctx.onTips(...args))
226
+ }, [
195
227
  createVNode(_component_nut_icon, {
196
228
  class: "icon",
197
229
  size: "11px",
198
230
  name: "tips"
199
231
  }),
200
- createElementVNode("view", {
201
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.onTips && _ctx.onTips(...args))
202
- }, toDisplayString(_ctx.tips), 1)
232
+ createElementVNode("view", null, toDisplayString(_ctx.tips), 1)
203
233
  ])) : createCommentVNode("", true)
204
234
  ]),
205
235
  !_ctx.noButton ? (openBlock(), createElementBlock("view", _hoisted_9, [
206
236
  createElementVNode("view", {
207
237
  class: "nut-shortpsd-cancle",
208
- onClick: _cache[4] || (_cache[4] = (...args) => _ctx.close && _ctx.close(...args))
238
+ onClick: _cache[6] || (_cache[6] = (...args) => _ctx.close && _ctx.close(...args))
209
239
  }, "\u53D6\u6D88"),
210
240
  createElementVNode("view", {
211
241
  class: "nut-shortpsd-sure",
212
- onClick: _cache[5] || (_cache[5] = (...args) => _ctx.sureClick && _ctx.sureClick(...args))
242
+ onClick: _cache[7] || (_cache[7] = (...args) => _ctx.sureClick && _ctx.sureClick(...args))
213
243
  }, "\u786E\u8BA4")
214
244
  ])) : createCommentVNode("", true)
215
245
  ]),
@@ -217,5 +247,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
217
247
  }, 8, ["visible", "onClickCloseIcon", "close-on-click-overlay", "onClickOverlay"])
218
248
  ]);
219
249
  }
220
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
221
- export { index as default };
250
+ _sfc_main.render = _sfc_render;
251
+ export { _sfc_main as default };