@nutui/nutui 3.1.17-beta.0 → 3.1.18

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 (150) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/LICENSE +1 -1
  3. package/README.md +7 -1
  4. package/dist/nutui.d.ts +3 -1
  5. package/dist/nutui.es.js +2335 -1280
  6. package/dist/nutui.umd.js +2350 -1293
  7. package/dist/packages/_es/ActionSheet.js +8 -3
  8. package/dist/packages/_es/Address.js +17 -11
  9. package/dist/packages/_es/Audio.js +2 -2
  10. package/dist/packages/_es/Avatar.js +2 -2
  11. package/dist/packages/_es/BackTop.js +7 -4
  12. package/dist/packages/_es/Badge.js +2 -2
  13. package/dist/packages/_es/Barrage.js +2 -2
  14. package/dist/packages/_es/Button.js +2 -2
  15. package/dist/packages/_es/Calendar.js +15 -16
  16. package/dist/packages/_es/Card.js +2 -2
  17. package/dist/packages/_es/Cascader.js +2 -2
  18. package/dist/packages/_es/Cell.js +25 -18
  19. package/dist/packages/_es/CellGroup.js +2 -2
  20. package/dist/packages/_es/Checkbox.js +4 -4
  21. package/dist/packages/_es/CheckboxGroup.js +4 -4
  22. package/dist/packages/_es/CircleProgress.js +2 -2
  23. package/dist/packages/_es/Col.js +2 -2
  24. package/dist/packages/_es/Collapse.js +2 -2
  25. package/dist/packages/_es/CollapseItem.js +31 -19
  26. package/dist/packages/_es/CountDown.js +4 -2
  27. package/dist/packages/_es/CountUp.js +25 -16
  28. package/dist/packages/_es/DatePicker.js +83 -47
  29. package/dist/packages/_es/Dialog.js +5 -3
  30. package/dist/packages/_es/Divider.js +2 -2
  31. package/dist/packages/_es/Drag.js +4 -4
  32. package/dist/packages/_es/Elevator.js +3 -3
  33. package/dist/packages/_es/Empty.js +2 -2
  34. package/dist/packages/_es/FixedNav.js +2 -2
  35. package/dist/packages/_es/Form.js +8 -6
  36. package/dist/packages/_es/FormItem.js +9 -6
  37. package/dist/packages/_es/Grid.js +2 -2
  38. package/dist/packages/_es/GridItem.js +3 -3
  39. package/dist/packages/_es/Icon.js +2 -2
  40. package/dist/packages/_es/ImagePreview.js +9 -4
  41. package/dist/packages/_es/Indicator.js +2 -2
  42. package/dist/packages/_es/InfiniteLoading.js +2 -2
  43. package/dist/packages/_es/Input.js +290 -66
  44. package/dist/packages/_es/InputNumber.js +2 -2
  45. package/dist/packages/_es/Layout.js +2 -2
  46. package/dist/packages/_es/List.js +124 -0
  47. package/dist/packages/_es/Menu.js +3 -3
  48. package/dist/packages/_es/MenuItem.js +2 -2
  49. package/dist/packages/_es/Navbar.js +31 -66
  50. package/dist/packages/_es/NoticeBar.js +41 -22
  51. package/dist/packages/_es/Notify.js +7 -3
  52. package/dist/packages/_es/NumberKeyboard.js +9 -4
  53. package/dist/packages/_es/OverLay.js +2 -2
  54. package/dist/packages/_es/Pagination.js +2 -2
  55. package/dist/packages/_es/Picker.js +163 -156
  56. package/dist/packages/_es/Popover.js +5 -2
  57. package/dist/packages/_es/Popup.js +2 -2
  58. package/dist/packages/_es/Price.js +2 -2
  59. package/dist/packages/_es/Progress.js +14 -22
  60. package/dist/packages/_es/Radio.js +3 -3
  61. package/dist/packages/_es/RadioGroup.js +2 -2
  62. package/dist/packages/_es/Range.js +131 -21
  63. package/dist/packages/_es/Rate.js +2 -2
  64. package/dist/packages/_es/Row.js +2 -2
  65. package/dist/packages/_es/SearchBar.js +2 -2
  66. package/dist/packages/_es/ShortPassword.js +9 -4
  67. package/dist/packages/_es/SideNavBar.js +2 -2
  68. package/dist/packages/_es/SideNavBarItem.js +2 -2
  69. package/dist/packages/_es/Signature.js +25 -6
  70. package/dist/packages/_es/Skeleton.js +2 -2
  71. package/dist/packages/_es/Sku.js +31 -13
  72. package/dist/packages/_es/Step.js +28 -12
  73. package/dist/packages/_es/Steps.js +8 -3
  74. package/dist/packages/_es/Sticky.js +3 -3
  75. package/dist/packages/_es/SubSideNavBar.js +2 -2
  76. package/dist/packages/_es/Swipe.js +3 -3
  77. package/dist/packages/_es/Swiper.js +3 -3
  78. package/dist/packages/_es/SwiperItem.js +3 -3
  79. package/dist/packages/_es/Switch.js +2 -2
  80. package/dist/packages/_es/TabPane.js +2 -2
  81. package/dist/packages/_es/Tabbar.js +2 -2
  82. package/dist/packages/_es/TabbarItem.js +23 -8
  83. package/dist/packages/_es/Table.js +2 -2
  84. package/dist/packages/_es/Tabs.js +8 -5
  85. package/dist/packages/_es/Tag.js +11 -5
  86. package/dist/packages/_es/TextArea.js +38 -6
  87. package/dist/packages/_es/TimeDetail.js +2 -2
  88. package/dist/packages/_es/TimePannel.js +2 -2
  89. package/dist/packages/_es/TimeSelect.js +8 -3
  90. package/dist/packages/_es/Toast.js +16 -9
  91. package/dist/packages/_es/Uploader.js +2 -4
  92. package/dist/packages/_es/Video.js +12 -8
  93. package/dist/packages/_es/common.js +2 -2
  94. package/dist/packages/_es/component.js +2 -2
  95. package/dist/packages/_es/index.js +6 -8
  96. package/dist/packages/_es/index2.js +9 -32
  97. package/dist/packages/_es/index3.js +29 -57
  98. package/dist/packages/_es/index4.js +64 -0
  99. package/dist/packages/_es/plugin-vue_export-helper.js +2 -2
  100. package/dist/packages/_es/pxCheck.js +2 -2
  101. package/dist/packages/_es/raf.js +2 -2
  102. package/dist/packages/_es/util.js +2 -2
  103. package/dist/packages/actionsheet/index.scss +7 -6
  104. package/dist/packages/badge/index.scss +11 -13
  105. package/dist/packages/button/index.scss +6 -5
  106. package/dist/packages/calendar/index.scss +9 -4
  107. package/dist/packages/calendaritem/index.scss +0 -207
  108. package/dist/packages/cell/index.scss +9 -9
  109. package/dist/packages/cellgroup/index.scss +1 -1
  110. package/dist/packages/checkbox/index.scss +4 -3
  111. package/dist/packages/collapseitem/index.scss +21 -11
  112. package/dist/packages/countdown/index.scss +3 -1
  113. package/dist/packages/divider/index.scss +8 -8
  114. package/dist/packages/elevator/index.scss +36 -36
  115. package/dist/packages/formitem/index.scss +15 -8
  116. package/dist/packages/indicator/index.scss +1 -1
  117. package/dist/packages/input/index.scss +70 -24
  118. package/dist/packages/inputnumber/index.scss +4 -2
  119. package/dist/packages/list/index.scss +24 -0
  120. package/dist/packages/menu/index.scss +3 -3
  121. package/dist/packages/navbar/index.scss +30 -8
  122. package/dist/packages/noticebar/index.scss +10 -5
  123. package/dist/packages/notify/index.scss +10 -0
  124. package/dist/packages/numberkeyboard/index.scss +22 -21
  125. package/dist/packages/oldpicker/index.scss +131 -0
  126. package/dist/packages/picker/index.scss +38 -32
  127. package/dist/packages/progress/index.scss +24 -19
  128. package/dist/packages/radio/index.scss +7 -6
  129. package/dist/packages/range/index.scss +113 -6
  130. package/dist/packages/searchbar/index.scss +7 -7
  131. package/dist/packages/sidenavbaritem/index.scss +5 -5
  132. package/dist/packages/step/index.scss +29 -29
  133. package/dist/packages/subsidenavbar/index.scss +10 -8
  134. package/dist/packages/swiper/index.scss +4 -4
  135. package/dist/packages/switch/index.scss +8 -8
  136. package/dist/packages/tabbar/index.scss +3 -2
  137. package/dist/packages/tabbaritem/index.scss +19 -3
  138. package/dist/packages/tabs/index.scss +1 -0
  139. package/dist/packages/timedetail/index.scss +13 -13
  140. package/dist/packages/timepannel/index.scss +7 -7
  141. package/dist/packages/timeselect/index.scss +3 -3
  142. package/dist/packages/toast/index.scss +8 -7
  143. package/dist/packages/uploader/index.scss +4 -4
  144. package/dist/style.css +1 -1
  145. package/dist/styles/themes/default.scss +43 -41
  146. package/dist/styles/themes/jdt.scss +91 -0
  147. package/dist/styles/variables-jdt.scss +727 -0
  148. package/dist/styles/variables.scss +322 -38
  149. package/package.json +3 -2
  150. package/dist/styles/themes/jdd.scss +0 -2
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { toRefs, computed, openBlock, createElementBlock, normalizeClass, Fragment, renderList, toDisplayString } from "vue";
@@ -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.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
22
- * (c) 2021 @jdf2e.
21
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
23
  * Released under the MIT License.
24
24
  */
25
25
  import { reactive, computed, onMounted, onUnmounted, ref, onActivated, onDeactivated, toRefs, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, createVNode, toDisplayString, renderSlot, createCommentVNode } from "vue";
@@ -1,9 +1,9 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 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) {
@@ -20,7 +20,7 @@ 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,132 +89,328 @@ 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
416
  var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { computed, resolveComponent, openBlock, createElementBlock, normalizeClass, normalizeStyle, createVNode, createElementVNode } from "vue";
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { c as createComponent } from "./component.js";
@@ -0,0 +1,124 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __defProps = Object.defineProperties;
3
+ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
+ var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
+ var __spreadValues = (a, b) => {
9
+ for (var prop in b || (b = {}))
10
+ if (__hasOwnProp.call(b, prop))
11
+ __defNormalProp(a, prop, b[prop]);
12
+ if (__getOwnPropSymbols)
13
+ for (var prop of __getOwnPropSymbols(b)) {
14
+ if (__propIsEnum.call(b, prop))
15
+ __defNormalProp(a, prop, b[prop]);
16
+ }
17
+ return a;
18
+ };
19
+ var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
20
+ /*!
21
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
22
+ * (c) 2022 @jdf2e.
23
+ * Released under the MIT License.
24
+ */
25
+ import { ref, reactive, computed, watch, toRefs, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, Fragment, renderList, renderSlot } from "vue";
26
+ import { c as createComponent } from "./component.js";
27
+ import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
28
+ const { componentName, create } = createComponent("list");
29
+ const _sfc_main = create({
30
+ props: {
31
+ height: {
32
+ type: [Number],
33
+ default: 50
34
+ },
35
+ listData: {
36
+ type: Array,
37
+ default: () => {
38
+ return [];
39
+ }
40
+ }
41
+ },
42
+ emits: ["scroll"],
43
+ setup(props, { emit }) {
44
+ const list = ref(null);
45
+ const state = reactive({
46
+ screenHeight: document.documentElement.clientHeight || document.body.clientHeight || 667,
47
+ startOffset: 0,
48
+ start: 0,
49
+ list: props.listData.slice()
50
+ });
51
+ const visibleCount = computed(() => {
52
+ return Math.ceil(state.screenHeight / props.height);
53
+ });
54
+ const end = computed(() => {
55
+ return state.start + visibleCount.value;
56
+ });
57
+ const getTransform = computed(() => {
58
+ return `translate3d(0, ${state.startOffset}px, 0)`;
59
+ });
60
+ const classes = computed(() => {
61
+ const prefixCls = componentName;
62
+ return {
63
+ [prefixCls]: true
64
+ };
65
+ });
66
+ const listHeight = computed(() => {
67
+ return state.list.length * props.height;
68
+ });
69
+ const visibleData = computed(() => {
70
+ return state.list.slice(state.start, Math.min(end.value, state.list.length));
71
+ });
72
+ const handleScrollEvent = () => {
73
+ var _a;
74
+ const scrollTop = (_a = list.value) == null ? void 0 : _a.scrollTop;
75
+ state.start = Math.floor(scrollTop / props.height);
76
+ if (end.value > state.list.length) {
77
+ emit("scroll");
78
+ }
79
+ state.startOffset = scrollTop - scrollTop % props.height;
80
+ };
81
+ watch(() => props.listData, () => {
82
+ state.list = props.listData.slice();
83
+ });
84
+ return __spreadProps(__spreadValues({}, toRefs(state)), {
85
+ list,
86
+ getTransform,
87
+ listHeight,
88
+ visibleData,
89
+ classes,
90
+ handleScrollEvent
91
+ });
92
+ }
93
+ });
94
+ function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
95
+ return openBlock(), createElementBlock("view", {
96
+ class: normalizeClass(_ctx.classes),
97
+ onScrollPassive: _cache[0] || (_cache[0] = (...args) => _ctx.handleScrollEvent && _ctx.handleScrollEvent(...args)),
98
+ ref: "list"
99
+ }, [
100
+ createElementVNode("div", {
101
+ class: "nut-list-phantom",
102
+ style: normalizeStyle({ height: _ctx.listHeight + "px" })
103
+ }, null, 4),
104
+ createElementVNode("div", {
105
+ class: "nut-list-container",
106
+ style: normalizeStyle({ transform: _ctx.getTransform })
107
+ }, [
108
+ (openBlock(true), createElementBlock(Fragment, null, renderList(_ctx.visibleData, (item, index2) => {
109
+ return openBlock(), createElementBlock("div", {
110
+ class: "nut-list-item",
111
+ style: normalizeStyle({ height: _ctx.height + "px" }),
112
+ key: item
113
+ }, [
114
+ renderSlot(_ctx.$slots, "default", {
115
+ item,
116
+ index: index2
117
+ })
118
+ ], 4);
119
+ }), 128))
120
+ ], 4)
121
+ ], 34);
122
+ }
123
+ var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
124
+ export { index as default };
@@ -1,11 +1,11 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { ref, computed, reactive, provide, resolveComponent, openBlock, createElementBlock, normalizeClass, createElementVNode, Fragment, renderList, normalizeStyle, toDisplayString, createVNode, renderSlot } from "vue";
7
7
  import { c as createComponent } from "./component.js";
8
- import { u as useRect } from "./index2.js";
8
+ import { u as useRect } from "./index3.js";
9
9
  import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
10
10
  const { componentName, create } = createComponent("menu");
11
11
  const _sfc_main = create({
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.16 Fri Feb 25 2022 17:05:36 GMT+0800 (GMT+08:00)
3
- * (c) 2021 @jdf2e.
2
+ * @nutui/nutui v3.1.18 Fri Mar 25 2022 15:02:08 GMT+0800 (中国标准时间)
3
+ * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
6
  import { reactive, computed, inject, getCurrentInstance, resolveComponent, withDirectives, openBlock, createElementBlock, normalizeClass, createElementVNode, normalizeStyle, vShow, createVNode, mergeProps, withCtx, Fragment, renderList, createBlock, createCommentVNode, toDisplayString, renderSlot } from "vue";