@nutui/nutui 3.1.10 → 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 (109) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/dist/nutui.d.ts +5 -1
  3. package/dist/nutui.es.js +4041 -3518
  4. package/dist/nutui.umd.js +4084 -3627
  5. package/dist/packages/_es/ActionSheet.js +13 -12
  6. package/dist/packages/_es/Address.js +63 -49
  7. package/dist/packages/_es/Avatar.js +4 -5
  8. package/dist/packages/_es/BackTop.js +72 -109
  9. package/dist/packages/_es/Badge.js +4 -5
  10. package/dist/packages/_es/Barrage.js +63 -57
  11. package/dist/packages/_es/Button.js +5 -6
  12. package/dist/packages/_es/Calendar.js +27 -18
  13. package/dist/packages/_es/Card.js +104 -0
  14. package/dist/packages/_es/Cell.js +5 -13
  15. package/dist/packages/_es/CellGroup.js +4 -5
  16. package/dist/packages/_es/Checkbox.js +3 -3
  17. package/dist/packages/_es/CheckboxGroup.js +9 -4
  18. package/dist/packages/_es/CircleProgress.js +142 -46
  19. package/dist/packages/_es/Col.js +4 -5
  20. package/dist/packages/_es/Collapse.js +35 -10
  21. package/dist/packages/_es/CollapseItem.js +80 -35
  22. package/dist/packages/_es/CountDown.js +7 -5
  23. package/dist/packages/_es/CountUp.js +34 -31
  24. package/dist/packages/_es/DatePicker.js +451 -219
  25. package/dist/packages/_es/Dialog.js +13 -87
  26. package/dist/packages/_es/Divider.js +5 -6
  27. package/dist/packages/_es/Drag.js +76 -50
  28. package/dist/packages/_es/Elevator.js +81 -52
  29. package/dist/packages/_es/FixedNav.js +8 -9
  30. package/dist/packages/_es/Form.js +137 -0
  31. package/dist/packages/_es/FormItem.js +109 -0
  32. package/dist/packages/_es/Icon.js +6 -40
  33. package/dist/packages/_es/ImagePreview.js +23 -21
  34. package/dist/packages/_es/InfiniteLoading.js +95 -109
  35. package/dist/packages/_es/Input.js +22 -21
  36. package/dist/packages/_es/InputNumber.js +24 -18
  37. package/dist/packages/_es/Layout.js +2 -2
  38. package/dist/packages/_es/Menu.js +89 -171
  39. package/dist/packages/_es/MenuItem.js +155 -18
  40. package/dist/packages/_es/Navbar.js +7 -7
  41. package/dist/packages/_es/NoticeBar.js +39 -26
  42. package/dist/packages/_es/Notify.js +30 -166
  43. package/dist/packages/_es/NumberKeyboard.js +10 -6
  44. package/dist/packages/_es/OverLay.js +22 -29
  45. package/dist/packages/_es/Pagination.js +8 -9
  46. package/dist/packages/_es/Picker.js +61 -447
  47. package/dist/packages/_es/Popover.js +146 -25
  48. package/dist/packages/_es/Popup.js +18 -39
  49. package/dist/packages/_es/Price.js +18 -7
  50. package/dist/packages/_es/Progress.js +23 -12
  51. package/dist/packages/_es/Radio.js +20 -7
  52. package/dist/packages/_es/RadioGroup.js +7 -3
  53. package/dist/packages/_es/Range.js +38 -59
  54. package/dist/packages/_es/Rate.js +16 -20
  55. package/dist/packages/_es/Row.js +4 -5
  56. package/dist/packages/_es/SearchBar.js +7 -5
  57. package/dist/packages/_es/ShortPassword.js +89 -59
  58. package/dist/packages/_es/Signature.js +70 -71
  59. package/dist/packages/_es/Sku.js +508 -0
  60. package/dist/packages/_es/Step.js +10 -8
  61. package/dist/packages/_es/Steps.js +2 -2
  62. package/dist/packages/_es/Swipe.js +42 -27
  63. package/dist/packages/_es/Swiper.js +17 -418
  64. package/dist/packages/_es/SwiperItem.js +14 -39
  65. package/dist/packages/_es/Switch.js +4 -5
  66. package/dist/packages/_es/TabPane.js +4 -5
  67. package/dist/packages/_es/Tabbar.js +4 -5
  68. package/dist/packages/_es/TabbarItem.js +8 -9
  69. package/dist/packages/_es/Tabs.js +23 -17
  70. package/dist/packages/_es/Tag.js +5 -6
  71. package/dist/packages/_es/TextArea.js +16 -12
  72. package/dist/packages/_es/TimeDetail.js +7 -5
  73. package/dist/packages/_es/TimePannel.js +7 -5
  74. package/dist/packages/_es/TimeSelect.js +12 -7
  75. package/dist/packages/_es/Toast.js +41 -163
  76. package/dist/packages/_es/Uploader.js +210 -164
  77. package/dist/packages/_es/commonProps.js +30 -0
  78. package/dist/packages/_es/component.js +1 -1
  79. package/dist/packages/_es/index.js +1 -1
  80. package/dist/packages/_es/index.taro.vue_vue&type=script&lang.js +44 -0
  81. package/dist/packages/_es/index2.js +44 -8
  82. package/dist/packages/_es/index3.js +419 -0
  83. package/dist/packages/_es/pxCheck.js +1 -1
  84. package/dist/packages/_es/raf.js +1 -1
  85. package/dist/packages/_es/use-lock-scroll.js +23 -0
  86. package/dist/packages/_es/util.js +47 -0
  87. package/dist/packages/button/index.scss +9 -0
  88. package/dist/packages/card/index.scss +97 -0
  89. package/dist/packages/checkbox/index.scss +1 -1
  90. package/dist/packages/form/index.scss +2 -0
  91. package/dist/packages/formitem/index.scss +60 -0
  92. package/dist/packages/menu/index.scss +32 -60
  93. package/dist/packages/menuitem/index.scss +36 -99
  94. package/dist/packages/numberkeyboard/index.scss +1 -1
  95. package/dist/packages/progress/index.scss +2 -0
  96. package/dist/packages/radio/index.scss +32 -4
  97. package/dist/packages/radiogroup/index.scss +20 -0
  98. package/dist/packages/sku/index.scss +147 -0
  99. package/dist/packages/switch/index.scss +1 -1
  100. package/dist/packages/uploader/index.scss +95 -8
  101. package/dist/style.css +1 -1
  102. package/dist/style.es.js +1 -2
  103. package/dist/styles/mixins/index.scss +0 -4
  104. package/dist/styles/themes/default.scss +34 -30
  105. package/dist/styles/variables.scss +45 -3
  106. package/package.json +3 -2
  107. package/dist/packages/_es/Video.js +0 -405
  108. package/dist/packages/_es/plugin-vue_export-helper.js +0 -12
  109. package/dist/packages/_es/style.css +0 -160
@@ -17,46 +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.10 Fri Nov 05 2021 19:52:49 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
- import { unref, ref, computed, toRefs, openBlock, createElementBlock, toDisplayString, createCommentVNode, createElementVNode, normalizeStyle, normalizeClass, withModifiers, Fragment, renderList, renderSlot } from "vue";
28
+ import Taro from "@tarojs/taro";
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 { _ as _export_sfc } from "./plugin-vue_export-helper.js";
29
- function isWindow(val) {
30
- return val === window;
31
- }
32
- const useRect = (elementRef) => {
33
- const element = unref(elementRef);
34
- if (isWindow(element)) {
35
- const width = element.innerWidth;
36
- const height = element.innerHeight;
37
- return {
38
- top: 0,
39
- left: 0,
40
- right: width,
41
- bottom: height,
42
- width,
43
- height
44
- };
45
- }
46
- if (element && element.getBoundingClientRect) {
47
- return element.getBoundingClientRect();
48
- }
49
- return {
50
- top: 0,
51
- left: 0,
52
- right: 0,
53
- bottom: 0,
54
- width: 0,
55
- height: 0
56
- };
57
- };
32
+ import { u as useTaroRect } from "./index2.js";
58
33
  const { componentName, create } = createComponent("range");
59
- const _sfc_main = create({
34
+ var _sfc_main = create({
60
35
  props: {
61
36
  range: {
62
37
  type: Boolean,
@@ -166,13 +141,13 @@ const _sfc_main = create({
166
141
  emit("change", value);
167
142
  }
168
143
  };
169
- const onClick = (event) => {
144
+ const onClick = async (event) => {
170
145
  if (props.disabled) {
171
146
  return;
172
147
  }
173
148
  const { min, modelValue } = props;
174
- const rect = useRect(root);
175
- const delta = event.clientX - rect.left;
149
+ const rect = await useTaroRect(root, Taro);
150
+ const delta = event.touches[0].clientX - rect.left;
176
151
  const total = rect.width;
177
152
  const value = Number(min) + delta / total * scope.value;
178
153
  if (isRange(modelValue)) {
@@ -200,7 +175,7 @@ const _sfc_main = create({
200
175
  }
201
176
  dragStatus.value = "start";
202
177
  };
203
- const onTouchMove = (event) => {
178
+ const onTouchMove = async (event) => {
204
179
  if (props.disabled) {
205
180
  return;
206
181
  }
@@ -209,7 +184,7 @@ const _sfc_main = create({
209
184
  }
210
185
  touch.move(event);
211
186
  dragStatus.value = "draging";
212
- const rect = useRect(root);
187
+ const rect = await useTaroRect(root, Taro);
213
188
  const delta = touch.deltaX.value;
214
189
  const total = rect.width;
215
190
  const diff = delta / total * scope.value;
@@ -236,6 +211,7 @@ const _sfc_main = create({
236
211
  const value = typeof idx === "number" ? props.modelValue[idx] : props.modelValue;
237
212
  return value;
238
213
  };
214
+ const refRandomId = Math.random().toString(36).slice(-8);
239
215
  return __spreadProps(__spreadValues({
240
216
  root,
241
217
  classes,
@@ -248,7 +224,8 @@ const _sfc_main = create({
248
224
  }, toRefs(props)), {
249
225
  barStyle,
250
226
  curValue,
251
- buttonIndex
227
+ buttonIndex,
228
+ refRandomId
252
229
  });
253
230
  }
254
231
  });
@@ -257,17 +234,18 @@ const _hoisted_2 = {
257
234
  key: 0,
258
235
  class: "min"
259
236
  };
260
- const _hoisted_3 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
261
- const _hoisted_4 = {
237
+ const _hoisted_3 = ["id"];
238
+ const _hoisted_4 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax", "onTouchstart"];
239
+ const _hoisted_5 = {
262
240
  key: 0,
263
241
  class: "number"
264
242
  };
265
- const _hoisted_5 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
266
- const _hoisted_6 = {
243
+ const _hoisted_6 = ["tabindex", "aria-valuemin", "aria-valuenow", "aria-valuemax"];
244
+ const _hoisted_7 = {
267
245
  key: 0,
268
246
  class: "number"
269
247
  };
270
- const _hoisted_7 = {
248
+ const _hoisted_8 = {
271
249
  key: 1,
272
250
  class: "max"
273
251
  };
@@ -276,6 +254,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
276
254
  !_ctx.hiddenRange ? (openBlock(), createElementBlock("view", _hoisted_2, toDisplayString(+_ctx.min), 1)) : createCommentVNode("", true),
277
255
  createElementVNode("view", {
278
256
  ref: "root",
257
+ id: "root-" + _ctx.refRandomId,
279
258
  style: normalizeStyle(_ctx.wrapperStyle),
280
259
  class: normalizeClass(_ctx.classes),
281
260
  onClick: _cache[9] || (_cache[9] = withModifiers((...args) => _ctx.onClick && _ctx.onClick(...args), ["stop"]))
@@ -284,22 +263,22 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
284
263
  class: "nut-range-bar",
285
264
  style: normalizeStyle(_ctx.barStyle)
286
265
  }, [
287
- _ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index2) => {
266
+ _ctx.range ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList([0, 1], (index) => {
288
267
  return createElementVNode("view", {
289
- key: index2,
268
+ key: index,
290
269
  role: "slider",
291
270
  class: normalizeClass({
292
- "nut-range-button-wrapper-left": index2 == 0,
293
- "nut-range-button-wrapper-right": index2 == 1
271
+ "nut-range-button-wrapper-left": index == 0,
272
+ "nut-range-button-wrapper-right": index == 1
294
273
  }),
295
274
  tabindex: _ctx.disabled ? -1 : 0,
296
275
  "aria-valuemin": +_ctx.min,
297
- "aria-valuenow": _ctx.curValue(index2),
276
+ "aria-valuenow": _ctx.curValue(index),
298
277
  "aria-valuemax": +_ctx.max,
299
278
  "aria-orientation": "horizontal",
300
279
  onTouchstart: withModifiers((e) => {
301
- if (typeof index2 === "number") {
302
- _ctx.buttonIndex = index2;
280
+ if (typeof index === "number") {
281
+ _ctx.buttonIndex = index;
303
282
  }
304
283
  _ctx.onTouchStart(e);
305
284
  }, ["stop", "prevent"]),
@@ -313,9 +292,9 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
313
292
  class: "nut-range-button",
314
293
  style: normalizeStyle(_ctx.buttonStyle)
315
294
  }, [
316
- !_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)
317
296
  ], 4))
318
- ], 42, _hoisted_3);
297
+ ], 42, _hoisted_4);
319
298
  }), 64)) : (openBlock(), createElementBlock("view", {
320
299
  key: 1,
321
300
  role: "slider",
@@ -338,13 +317,13 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
338
317
  class: "nut-range-button",
339
318
  style: normalizeStyle(_ctx.buttonStyle)
340
319
  }, [
341
- !_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)
342
321
  ], 4))
343
- ], 40, _hoisted_5))
322
+ ], 40, _hoisted_6))
344
323
  ], 4)
345
- ], 6),
346
- !_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)
347
326
  ]);
348
327
  }
349
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
350
- 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.10 Fri Nov 05 2021 19:52:49 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.10 Fri Nov 05 2021 19:52:49 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.10 Fri Nov 05 2021 19:52:49 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.10 Fri Nov 05 2021 19:52:49 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 };