@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
@@ -1,26 +1,26 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, computed, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, toDisplayString, createCommentVNode, normalizeStyle, withDirectives, createVNode, vShow } from "vue";
6
+ import { ref, reactive, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, createCommentVNode, normalizeStyle, createElementVNode, toDisplayString, withDirectives, createBlock, vShow, renderSlot, createTextVNode } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
8
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
9
9
  function trimExtraChar(value, char, regExp) {
10
- const index2 = value.indexOf(char);
11
- if (index2 === -1) {
10
+ const index = value.indexOf(char);
11
+ if (index === -1) {
12
12
  return value;
13
13
  }
14
- if (char === "-" && index2 !== 0) {
15
- return value.slice(0, index2);
14
+ if (char === "-" && index !== 0) {
15
+ return value.slice(0, index);
16
16
  }
17
- return value.slice(0, index2 + 1) + value.slice(index2).replace(regExp, "");
17
+ return value.slice(0, index + 1) + value.slice(index).replace(regExp, "");
18
18
  }
19
19
  function formatNumber(value, allowDot = true, allowMinus = true) {
20
20
  if (allowDot) {
21
21
  value = trimExtraChar(value, ".", /\./g);
22
22
  } else {
23
- value = value.replace(/\./g, "");
23
+ value = value.split(".")[0];
24
24
  }
25
25
  if (allowMinus) {
26
26
  value = trimExtraChar(value, "-", /-/g);
@@ -33,6 +33,10 @@ function formatNumber(value, allowDot = true, allowMinus = true) {
33
33
  const { componentName, create } = createComponent("input");
34
34
  const _sfc_main = create({
35
35
  props: {
36
+ ref: {
37
+ type: String,
38
+ default: ""
39
+ },
36
40
  type: {
37
41
  type: String,
38
42
  default: "text"
@@ -49,7 +53,31 @@ const _sfc_main = create({
49
53
  type: String,
50
54
  default: ""
51
55
  },
52
- requireShow: {
56
+ labelClass: {
57
+ type: String,
58
+ default: ""
59
+ },
60
+ labelWidth: {
61
+ type: [String, Number],
62
+ default: "80"
63
+ },
64
+ labelAlign: {
65
+ type: String,
66
+ default: "left"
67
+ },
68
+ colon: {
69
+ type: Boolean,
70
+ default: false
71
+ },
72
+ inputAlign: {
73
+ type: String,
74
+ default: "left"
75
+ },
76
+ center: {
77
+ type: Boolean,
78
+ default: false
79
+ },
80
+ required: {
53
81
  type: Boolean,
54
82
  default: false
55
83
  },
@@ -61,133 +89,329 @@ const _sfc_main = create({
61
89
  type: Boolean,
62
90
  default: false
63
91
  },
64
- textAlign: {
92
+ error: {
93
+ type: Boolean,
94
+ default: false
95
+ },
96
+ maxNum: {
97
+ type: [String, Number],
98
+ default: ""
99
+ },
100
+ leftIcon: {
65
101
  type: String,
66
- default: "left"
102
+ default: ""
103
+ },
104
+ leftIconSize: {
105
+ type: [String, Number],
106
+ default: ""
67
107
  },
68
- maxLength: {
108
+ rightIcon: {
109
+ type: String,
110
+ default: ""
111
+ },
112
+ rightIconSize: {
69
113
  type: [String, Number],
70
114
  default: ""
71
115
  },
72
116
  clearable: {
117
+ type: Boolean,
118
+ default: false
119
+ },
120
+ clearIcon: {
121
+ type: String,
122
+ default: "mask-close"
123
+ },
124
+ clearSize: {
125
+ type: [String, Number],
126
+ default: "14"
127
+ },
128
+ border: {
73
129
  type: Boolean,
74
130
  default: true
75
131
  },
76
- hasBorder: {
132
+ formatTrigger: {
133
+ type: String,
134
+ default: "onChange"
135
+ },
136
+ formatter: {
137
+ type: Function,
138
+ default: null
139
+ },
140
+ rules: {
141
+ type: Array,
142
+ default: []
143
+ },
144
+ errorMessage: {
145
+ type: String,
146
+ default: ""
147
+ },
148
+ errorMessageAlign: {
149
+ type: String,
150
+ default: ""
151
+ },
152
+ rows: {
153
+ type: [String, Number],
154
+ default: null
155
+ },
156
+ showWordLimit: {
77
157
  type: Boolean,
78
158
  default: true
159
+ },
160
+ autofocus: {
161
+ type: Boolean,
162
+ default: false
79
163
  }
80
164
  },
81
- emits: ["change", "update:modelValue", "blur", "focus", "clear"],
82
- setup(props, { emit }) {
165
+ emits: [
166
+ "update:modelValue",
167
+ "change",
168
+ "blur",
169
+ "focus",
170
+ "clear",
171
+ "keypress",
172
+ "click-input",
173
+ "click-left-icon",
174
+ "click-right-icon"
175
+ ],
176
+ setup(props, { emit, slots }) {
83
177
  const active = ref(false);
178
+ const inputRef = ref();
179
+ const customValue = ref();
180
+ const getModelValue = () => {
181
+ var _a;
182
+ return String((_a = props.modelValue) != null ? _a : "");
183
+ };
184
+ const state = reactive({
185
+ focused: false,
186
+ validateFailed: false,
187
+ validateMessage: ""
188
+ });
84
189
  const classes = computed(() => {
85
190
  const prefixCls = componentName;
86
191
  return {
87
192
  [prefixCls]: true,
193
+ center: props.center,
88
194
  [`${prefixCls}-disabled`]: props.disabled,
89
- [`${prefixCls}-require`]: props.requireShow,
90
- [`${prefixCls}-border`]: props.hasBorder
195
+ [`${prefixCls}-required`]: props.required,
196
+ [`${prefixCls}-error`]: props.error,
197
+ [`${prefixCls}-border`]: props.border
91
198
  };
92
199
  });
93
- const inputmode = computed(() => {
94
- return props.type === "digit" ? "decimal" : props.type === "number" ? "numeric" : "text";
95
- });
96
200
  const styles = computed(() => {
97
201
  return {
98
- textAlign: props.textAlign
202
+ textAlign: props.inputAlign
203
+ };
204
+ });
205
+ const stylesTextarea = computed(() => {
206
+ return {
207
+ textAlign: props.inputAlign,
208
+ height: Number(props.rows) * 24 + "px"
99
209
  };
100
210
  });
101
- const valueChange = (event) => {
211
+ const inputType = (type) => {
212
+ if (type === "number") {
213
+ return "text";
214
+ } else if (type === "digit") {
215
+ return "tel";
216
+ } else {
217
+ return type;
218
+ }
219
+ };
220
+ computed(() => {
221
+ if (customValue.value && slots.input) {
222
+ return customValue.value();
223
+ }
224
+ return props.modelValue;
225
+ });
226
+ const onInput = (event) => {
102
227
  const input = event.target;
103
- let val = input.value;
228
+ let value = input.value;
229
+ updateValue(value);
230
+ };
231
+ const updateValue = (value, trigger = "onChange") => {
104
232
  if (props.type === "digit") {
105
- val = formatNumber(val, true);
233
+ value = formatNumber(value, false, false);
106
234
  }
107
235
  if (props.type === "number") {
108
- val = formatNumber(val, false);
236
+ value = formatNumber(value, true, true);
237
+ }
238
+ if (props.formatter && trigger === props.formatTrigger) {
239
+ value = props.formatter(value);
240
+ }
241
+ if (inputRef.value && inputRef.value.value !== value) {
242
+ inputRef.value.value = value;
109
243
  }
110
- if (props.maxLength && val.length > Number(props.maxLength)) {
111
- val = val.slice(0, Number(props.maxLength));
244
+ if (value !== props.modelValue) {
245
+ emit("update:modelValue", value);
246
+ emit("change", value);
112
247
  }
113
- emit("update:modelValue", val, event);
114
- emit("change", val, event);
115
248
  };
116
- const valueFocus = (event) => {
249
+ const onFocus = (event) => {
117
250
  const input = event.target;
118
251
  let value = input.value;
119
252
  active.value = true;
120
253
  emit("focus", value, event);
121
254
  };
122
- const valueBlur = (event) => {
255
+ const onBlur = (event) => {
123
256
  setTimeout(() => {
124
257
  active.value = false;
125
258
  }, 200);
126
259
  const input = event.target;
127
260
  let value = input.value;
128
- if (props.maxLength && value.length > Number(props.maxLength)) {
129
- value = value.slice(0, Number(props.maxLength));
261
+ if (props.maxNum && value.length > Number(props.maxNum)) {
262
+ value = value.slice(0, Number(props.maxNum));
130
263
  }
264
+ updateValue(getModelValue(), "onBlur");
131
265
  emit("blur", value, event);
132
266
  };
133
- const handleClear = (event) => {
267
+ const clear = (event) => {
134
268
  emit("update:modelValue", "", event);
135
269
  emit("change", "", event);
136
- emit("clear", "");
270
+ emit("clear", "", event);
137
271
  };
272
+ const resetValidation = () => {
273
+ if (state.validateFailed) {
274
+ state.validateFailed = false;
275
+ state.validateMessage = "";
276
+ }
277
+ };
278
+ const onClickInput = (event) => {
279
+ emit("click-input", event);
280
+ };
281
+ const onClickLeftIcon = (event) => emit("click-left-icon", event);
282
+ const onClickRightIcon = (event) => emit("click-right-icon", event);
283
+ watch(() => props.modelValue, () => {
284
+ updateValue(getModelValue());
285
+ resetValidation();
286
+ });
287
+ onMounted(() => {
288
+ updateValue(getModelValue(), props.formatTrigger);
289
+ });
138
290
  return {
291
+ inputRef,
139
292
  active,
140
293
  classes,
141
294
  styles,
142
- inputmode,
143
- valueChange,
144
- valueFocus,
145
- valueBlur,
146
- handleClear
295
+ stylesTextarea,
296
+ inputType,
297
+ onInput,
298
+ onFocus,
299
+ onBlur,
300
+ clear,
301
+ onClickInput,
302
+ onClickLeftIcon,
303
+ onClickRightIcon
147
304
  };
148
305
  }
149
306
  });
150
- const _hoisted_1 = {
307
+ const _hoisted_1 = { class: "label-string" };
308
+ const _hoisted_2 = { class: "nut-input-value" };
309
+ const _hoisted_3 = ["maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"];
310
+ const _hoisted_4 = ["type", "maxNum", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"];
311
+ const _hoisted_5 = {
151
312
  key: 0,
152
- class: "nut-input-label"
313
+ class: "nut-input-word-limit"
153
314
  };
154
- const _hoisted_2 = { class: "label-string" };
155
- const _hoisted_3 = ["type", "maxlength", "placeholder", "disabled", "readonly", "value", "inputmode"];
315
+ const _hoisted_6 = { class: "nut-input-word-num" };
156
316
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
157
317
  const _component_nut_icon = resolveComponent("nut-icon");
158
318
  return openBlock(), createElementBlock("view", {
159
319
  class: normalizeClass(_ctx.classes)
160
320
  }, [
161
- _ctx.label ? (openBlock(), createElementBlock("view", _hoisted_1, [
162
- createElementVNode("view", _hoisted_2, toDisplayString(_ctx.label), 1)
163
- ])) : createCommentVNode("", true),
164
- createElementVNode("input", {
165
- class: "input-text",
166
- style: normalizeStyle(_ctx.styles),
167
- type: _ctx.type,
168
- maxlength: _ctx.maxLength,
169
- placeholder: _ctx.placeholder,
170
- disabled: _ctx.disabled,
171
- readonly: _ctx.readonly,
172
- value: _ctx.modelValue,
173
- inputmode: _ctx.inputmode,
174
- onInput: _cache[0] || (_cache[0] = (...args) => _ctx.valueChange && _ctx.valueChange(...args)),
175
- onFocus: _cache[1] || (_cache[1] = (...args) => _ctx.valueFocus && _ctx.valueFocus(...args)),
176
- onBlur: _cache[2] || (_cache[2] = (...args) => _ctx.valueBlur && _ctx.valueBlur(...args))
177
- }, null, 44, _hoisted_3),
178
- _ctx.clearable && !_ctx.readonly ? withDirectives((openBlock(), createElementBlock("view", {
179
- key: 1,
180
- onClick: _cache[3] || (_cache[3] = (...args) => _ctx.handleClear && _ctx.handleClear(...args)),
181
- class: "nut-textinput-clear"
321
+ _ctx.leftIcon && _ctx.leftIcon.length > 0 ? (openBlock(), createElementBlock("view", {
322
+ key: 0,
323
+ class: "nut-input-left-icon",
324
+ onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickLeftIcon && _ctx.onClickLeftIcon(...args))
182
325
  }, [
183
326
  createVNode(_component_nut_icon, {
184
- name: "close-little",
185
- size: "12px"
327
+ name: _ctx.leftIcon,
328
+ size: _ctx.leftIconSize
329
+ }, null, 8, ["name", "size"])
330
+ ])) : createCommentVNode("", true),
331
+ _ctx.label ? (openBlock(), createElementBlock("view", {
332
+ key: 1,
333
+ class: normalizeClass(["nut-input-label", _ctx.labelClass]),
334
+ style: normalizeStyle({
335
+ width: `${_ctx.labelWidth}px`,
336
+ textAlign: _ctx.labelAlign
186
337
  })
187
- ], 512)), [
188
- [vShow, _ctx.active && _ctx.modelValue.length > 0]
189
- ]) : createCommentVNode("", true)
338
+ }, [
339
+ createElementVNode("view", _hoisted_1, toDisplayString(_ctx.label) + " " + toDisplayString(_ctx.colon ? ":" : ""), 1)
340
+ ], 6)) : createCommentVNode("", true),
341
+ createElementVNode("view", _hoisted_2, [
342
+ createElementVNode("view", {
343
+ class: "nut-input-inner",
344
+ onClick: _cache[8] || (_cache[8] = (...args) => _ctx.onClickInput && _ctx.onClickInput(...args))
345
+ }, [
346
+ _ctx.type == "textarea" ? (openBlock(), createElementBlock("textarea", {
347
+ key: 0,
348
+ class: "input-text",
349
+ ref: "inputRef",
350
+ style: normalizeStyle(_ctx.stylesTextarea),
351
+ maxlength: _ctx.maxLength,
352
+ placeholder: _ctx.placeholder,
353
+ disabled: _ctx.disabled,
354
+ readonly: _ctx.readonly,
355
+ value: _ctx.modelValue,
356
+ formatTrigger: _ctx.formatTrigger,
357
+ autofocus: _ctx.autofocus,
358
+ onInput: _cache[1] || (_cache[1] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
359
+ onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
360
+ onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
361
+ }, null, 44, _hoisted_3)) : (openBlock(), createElementBlock("input", {
362
+ key: 1,
363
+ class: "input-text",
364
+ ref: "inputRef",
365
+ style: normalizeStyle(_ctx.styles),
366
+ type: _ctx.inputType(_ctx.type),
367
+ maxNum: _ctx.maxNum,
368
+ placeholder: _ctx.placeholder,
369
+ disabled: _ctx.disabled,
370
+ readonly: _ctx.readonly,
371
+ value: _ctx.modelValue,
372
+ formatTrigger: _ctx.formatTrigger,
373
+ autofocus: _ctx.autofocus,
374
+ onInput: _cache[4] || (_cache[4] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
375
+ onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
376
+ onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
377
+ }, null, 44, _hoisted_4)),
378
+ _ctx.clearable && !_ctx.readonly ? withDirectives((openBlock(), createBlock(_component_nut_icon, {
379
+ key: 2,
380
+ class: "nut-input-clear",
381
+ name: _ctx.clearIcon,
382
+ size: _ctx.clearSize,
383
+ onClick: _ctx.clear
384
+ }, null, 8, ["name", "size", "onClick"])), [
385
+ [vShow, _ctx.active && _ctx.modelValue.length > 0]
386
+ ]) : createCommentVNode("", true),
387
+ _ctx.rightIcon && _ctx.rightIcon.length > 0 ? (openBlock(), createElementBlock("view", {
388
+ key: 3,
389
+ class: "nut-input-right-icon",
390
+ onClick: _cache[7] || (_cache[7] = (...args) => _ctx.onClickRightIcon && _ctx.onClickRightIcon(...args))
391
+ }, [
392
+ createVNode(_component_nut_icon, {
393
+ name: _ctx.rightIcon,
394
+ size: _ctx.rightIconSize
395
+ }, null, 8, ["name", "size"])
396
+ ])) : createCommentVNode("", true),
397
+ _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {
398
+ key: 4,
399
+ class: "nut-input-button"
400
+ }) : createCommentVNode("", true)
401
+ ]),
402
+ _ctx.showWordLimit && _ctx.maxNum ? (openBlock(), createElementBlock("view", _hoisted_5, [
403
+ createElementVNode("span", _hoisted_6, toDisplayString(_ctx.modelValue ? _ctx.modelValue.length : 0), 1),
404
+ createTextVNode("/" + toDisplayString(_ctx.maxNum), 1)
405
+ ])) : createCommentVNode("", true),
406
+ _ctx.errorMessage ? (openBlock(), createElementBlock("view", {
407
+ key: 1,
408
+ class: "nut-input-error-message",
409
+ style: normalizeStyle({
410
+ textAlign: _ctx.errorMessageAlign
411
+ })
412
+ }, toDisplayString(_ctx.errorMessage), 5)) : createCommentVNode("", true)
413
+ ])
190
414
  ], 2);
191
415
  }
192
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
193
- export { index as default };
416
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
417
+ export { index_taro as default };
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createElementVNode } from "vue";
6
+ import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, toDisplayString } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
8
  import { p as pxCheck } from "./pxCheck.js";
9
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
@@ -61,7 +61,7 @@ const _sfc_main = create({
61
61
  };
62
62
  const change = (event) => {
63
63
  const input = event.target;
64
- emit("update:modelValue", input.valueAsNumber, event);
64
+ emit("update:modelValue", input.value, event);
65
65
  };
66
66
  const emitChange = (value, event) => {
67
67
  let output_value = fixedDecimalPlaces(value);
@@ -92,20 +92,13 @@ const _sfc_main = create({
92
92
  emit("overlimit", event, "add");
93
93
  }
94
94
  };
95
- const focus = (event) => {
96
- if (props.disabled)
97
- return;
98
- if (props.readonly)
99
- return;
100
- emit("focus", event);
101
- };
102
95
  const blur = (event) => {
103
96
  if (props.disabled)
104
97
  return;
105
98
  if (props.readonly)
106
99
  return;
107
100
  const input = event.target;
108
- let value = input.valueAsNumber;
101
+ let value = +input.value;
109
102
  if (value < Number(props.min)) {
110
103
  value = Number(props.min);
111
104
  } else if (value > Number(props.max)) {
@@ -114,6 +107,15 @@ const _sfc_main = create({
114
107
  emitChange(value, event);
115
108
  emit("blur", event);
116
109
  };
110
+ const focus = (event) => {
111
+ if (props.disabled)
112
+ return;
113
+ if (props.readonly) {
114
+ blur(event);
115
+ return;
116
+ }
117
+ emit("focus", event);
118
+ };
117
119
  return {
118
120
  classes,
119
121
  change,
@@ -127,7 +129,11 @@ const _sfc_main = create({
127
129
  };
128
130
  }
129
131
  });
130
- const _hoisted_1 = ["min", "max", "disabled", "readonly", "value"];
132
+ const _hoisted_1 = {
133
+ key: 0,
134
+ class: "nut-inputnumber__text--readonly"
135
+ };
136
+ const _hoisted_2 = ["min", "max", "disabled", "readonly", "value"];
131
137
  function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
132
138
  const _component_nut_icon = resolveComponent("nut-icon");
133
139
  return openBlock(), createElementBlock("view", {
@@ -140,7 +146,8 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
140
146
  size: _ctx.buttonSize,
141
147
  onClick: _ctx.reduce
142
148
  }, null, 8, ["class", "size", "onClick"]),
143
- createElementVNode("input", {
149
+ _ctx.readonly ? (openBlock(), createElementBlock("view", _hoisted_1, toDisplayString(_ctx.modelValue), 1)) : (openBlock(), createElementBlock("input", {
150
+ key: 1,
144
151
  type: "number",
145
152
  min: _ctx.min,
146
153
  max: _ctx.max,
@@ -151,7 +158,7 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
151
158
  onInput: _cache[0] || (_cache[0] = (...args) => _ctx.change && _ctx.change(...args)),
152
159
  onBlur: _cache[1] || (_cache[1] = (...args) => _ctx.blur && _ctx.blur(...args)),
153
160
  onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.focus && _ctx.focus(...args))
154
- }, null, 44, _hoisted_1),
161
+ }, null, 44, _hoisted_2)),
155
162
  createVNode(_component_nut_icon, {
156
163
  name: "plus",
157
164
  class: normalizeClass(["nut-inputnumber__icon", { "nut-inputnumber__icon--disabled": !_ctx.addAllow() }]),
@@ -160,5 +167,5 @@ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
160
167
  }, null, 8, ["class", "size", "onClick"])
161
168
  ], 6);
162
169
  }
163
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
164
- export { index as default };
170
+ var index_taro = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
171
+ export { index_taro as default };
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.18-beta.0 Tue Mar 08 2022 10:41:31 GMT+0800 (中国标准时间)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.19-beta.1 Sat Apr 02 2022 16:26:37 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { c as createComponent } from "./component.js";