@nutui/nutui 3.1.21 → 3.1.22-beta.5

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 (233) hide show
  1. package/dist/nutui.es.js +4203 -19263
  2. package/dist/nutui.umd.js +4208 -19368
  3. package/dist/packages/_es/ActionSheet.js +17 -167
  4. package/dist/packages/_es/Address.js +110 -552
  5. package/dist/packages/_es/AddressList.js +113 -613
  6. package/dist/packages/_es/Animate.js +22 -0
  7. package/dist/packages/_es/Audio.js +53 -274
  8. package/dist/packages/_es/AudioOperate.js +13 -121
  9. package/dist/packages/_es/Avatar.js +38 -177
  10. package/dist/packages/_es/AvatarGroup.js +14 -73
  11. package/dist/packages/_es/BackTop.js +43 -156
  12. package/dist/packages/_es/Badge.js +14 -86
  13. package/dist/packages/_es/Barrage.js +41 -120
  14. package/dist/packages/_es/Button.js +23 -128
  15. package/dist/packages/_es/Calendar.js +30 -237
  16. package/dist/packages/_es/CalendarItem.js +2 -1
  17. package/dist/packages/_es/Card.js +10 -107
  18. package/dist/packages/_es/Cascader.js +147 -523
  19. package/dist/packages/_es/Category.js +15 -58
  20. package/dist/packages/_es/CategoryPane.js +11 -111
  21. package/dist/packages/_es/Cell.js +21 -100
  22. package/dist/packages/_es/CellGroup.js +9 -44
  23. package/dist/packages/_es/Checkbox.js +31 -113
  24. package/dist/packages/_es/CheckboxGroup.js +29 -58
  25. package/dist/packages/_es/CircleProgress.js +28 -151
  26. package/dist/packages/_es/Col.js +14 -56
  27. package/dist/packages/_es/Collapse.js +32 -84
  28. package/dist/packages/_es/CollapseItem.js +59 -272
  29. package/dist/packages/_es/Comment.js +64 -434
  30. package/dist/packages/_es/ConfigProvider.js +13 -0
  31. package/dist/packages/_es/CountDown.js +56 -256
  32. package/dist/packages/_es/CountUp.js +140 -556
  33. package/dist/packages/_es/DatePicker.js +98 -332
  34. package/dist/packages/_es/Dialog.js +60 -271
  35. package/dist/packages/_es/Divider.js +13 -82
  36. package/dist/packages/_es/Drag.js +56 -197
  37. package/dist/packages/_es/Ecard.js +24 -159
  38. package/dist/packages/_es/Elevator.js +58 -212
  39. package/dist/packages/_es/Ellipsis.js +64 -0
  40. package/dist/packages/_es/Empty.js +12 -71
  41. package/dist/packages/_es/FixedNav.js +15 -122
  42. package/dist/packages/_es/Form.js +64 -151
  43. package/dist/packages/_es/FormItem.js +15 -110
  44. package/dist/packages/_es/Grid.js +5 -6
  45. package/dist/packages/_es/GridItem.js +33 -144
  46. package/dist/packages/_es/Icon.js +15 -40
  47. package/dist/packages/_es/Image.js +31 -0
  48. package/dist/packages/_es/ImagePreview.js +77 -309
  49. package/dist/packages/_es/Indicator.js +15 -62
  50. package/dist/packages/_es/InfiniteLoading.js +57 -268
  51. package/dist/packages/_es/Input.js +51 -413
  52. package/dist/packages/_es/InputNumber.js +41 -160
  53. package/dist/packages/_es/Layout.js +4 -5
  54. package/dist/packages/_es/List.js +18 -124
  55. package/dist/packages/_es/Menu.js +45 -118
  56. package/dist/packages/_es/MenuItem.js +37 -162
  57. package/dist/packages/_es/Navbar.js +30 -192
  58. package/dist/packages/_es/NoticeBar.js +74 -397
  59. package/dist/packages/_es/Notify.js +72 -246
  60. package/dist/packages/_es/NumberKeyboard.js +41 -272
  61. package/dist/packages/_es/OldPicker.js +131 -474
  62. package/dist/packages/_es/OverLay.js +24 -113
  63. package/dist/packages/_es/Pagination.js +39 -157
  64. package/dist/packages/_es/Picker.js +129 -469
  65. package/dist/packages/_es/Popover.js +318 -975
  66. package/dist/packages/_es/Popup.js +55 -313
  67. package/dist/packages/_es/Price.js +16 -118
  68. package/dist/packages/_es/Progress.js +14 -146
  69. package/dist/packages/_es/PullRefresh.js +84 -354
  70. package/dist/packages/_es/Radio.js +22 -90
  71. package/dist/packages/_es/RadioGroup.js +8 -37
  72. package/dist/packages/_es/Range.js +83 -427
  73. package/dist/packages/_es/Rate.js +35 -137
  74. package/dist/packages/_es/Row.js +22 -64
  75. package/dist/packages/_es/SearchBar.js +37 -257
  76. package/dist/packages/_es/ShortPassword.js +35 -225
  77. package/dist/packages/_es/SideNavBar.js +24 -99
  78. package/dist/packages/_es/SideNavBarItem.js +11 -46
  79. package/dist/packages/_es/Signature.js +41 -179
  80. package/dist/packages/_es/Skeleton.js +20 -136
  81. package/dist/packages/_es/Sku.js +84 -509
  82. package/dist/packages/_es/Step.js +20 -133
  83. package/dist/packages/_es/Steps.js +18 -53
  84. package/dist/packages/_es/Sticky.js +53 -138
  85. package/dist/packages/_es/SubSideNavBar.js +17 -100
  86. package/dist/packages/_es/Swipe.js +41 -197
  87. package/dist/packages/_es/Swiper.js +121 -433
  88. package/dist/packages/_es/SwiperItem.js +22 -53
  89. package/dist/packages/_es/Switch.js +21 -116
  90. package/dist/packages/_es/TabPane.js +12 -39
  91. package/dist/packages/_es/Tabbar.js +17 -72
  92. package/dist/packages/_es/TabbarItem.js +29 -151
  93. package/dist/packages/_es/Table.js +18 -196
  94. package/dist/packages/_es/Tabs.js +43 -217
  95. package/dist/packages/_es/Tag.js +20 -97
  96. package/dist/packages/_es/TextArea.js +42 -160
  97. package/dist/packages/_es/TimeDetail.js +18 -98
  98. package/dist/packages/_es/TimePannel.js +14 -66
  99. package/dist/packages/_es/TimeSelect.js +15 -103
  100. package/dist/packages/_es/Toast.js +71 -329
  101. package/dist/packages/_es/Uploader.js +104 -468
  102. package/dist/packages/_es/Video.js +74 -350
  103. package/dist/packages/_es/common.js +38 -128
  104. package/dist/packages/_es/component.js +35 -76
  105. package/dist/packages/_es/index.js +5 -6
  106. package/dist/packages/_es/index2.js +9 -30
  107. package/dist/packages/_es/index3.js +6 -8
  108. package/dist/packages/_es/index4.js +13 -58
  109. package/dist/packages/_es/index5.js +164 -682
  110. package/dist/packages/_es/plugin-vue_export-helper.js +7 -8
  111. package/dist/packages/_es/pxCheck.js +3 -5
  112. package/dist/packages/_es/raf.js +8 -15
  113. package/dist/packages/animate/index.scss +299 -0
  114. package/dist/packages/button/index.scss +2 -1
  115. package/dist/packages/cell/index.scss +18 -1
  116. package/dist/packages/checkbox/index.scss +16 -0
  117. package/dist/packages/configprovider/index.scss +2 -0
  118. package/dist/packages/dialog/index.scss +1 -0
  119. package/dist/packages/elevator/index.scss +21 -0
  120. package/dist/packages/ellipsis/index.scss +12 -0
  121. package/dist/packages/formitem/index.scss +12 -0
  122. package/dist/packages/griditem/index.scss +11 -0
  123. package/dist/packages/image/index.scss +39 -0
  124. package/dist/packages/imagepreview/index.scss +21 -2
  125. package/dist/packages/input/index.scss +26 -1
  126. package/dist/packages/inputnumber/index.scss +21 -0
  127. package/dist/packages/locale/lang/baseLang.d.ts +1 -0
  128. package/dist/packages/locale/lang/baseLang.js +3 -3
  129. package/dist/packages/locale/lang/en-US.d.ts +8 -0
  130. package/dist/packages/locale/lang/en-US.js +5 -97
  131. package/dist/packages/locale/lang/id-ID.d.ts +8 -0
  132. package/dist/packages/locale/lang/id-ID.js +5 -97
  133. package/dist/packages/locale/lang/index.js +16 -38
  134. package/dist/packages/locale/lang/zh-CN.d.ts +8 -0
  135. package/dist/packages/locale/lang/zh-CN.js +5 -97
  136. package/dist/packages/locale/lang/zh-TW.d.ts +8 -0
  137. package/dist/packages/locale/lang/zh-TW.js +5 -97
  138. package/dist/packages/menu/index.scss +45 -36
  139. package/dist/packages/menuitem/index.scss +4 -0
  140. package/dist/packages/navbar/index.scss +9 -0
  141. package/dist/packages/pagination/index.scss +19 -0
  142. package/dist/packages/radio/index.scss +19 -0
  143. package/dist/packages/range/index.scss +19 -0
  144. package/dist/packages/rate/index.scss +1 -1
  145. package/dist/packages/searchbar/index.scss +21 -0
  146. package/dist/packages/switch/index.scss +4 -3
  147. package/dist/packages/tabbar/index.scss +5 -0
  148. package/dist/packages/tabbaritem/index.scss +7 -0
  149. package/dist/packages/tabpane/index.scss +6 -0
  150. package/dist/packages/tabs/index.scss +22 -0
  151. package/dist/packages/textarea/index.scss +8 -0
  152. package/dist/smartips/attributes.json +192 -12
  153. package/dist/smartips/tags.json +70 -10
  154. package/dist/smartips/web-types.json +6945 -0
  155. package/dist/style.css +1 -1
  156. package/dist/style.es.js +1 -1
  157. package/dist/styles/font/config.json +3 -1
  158. package/dist/styles/font/demo_index.html +49 -3
  159. package/dist/styles/font/iconfont.css +11 -3
  160. package/dist/styles/font/iconfont.js +15 -15
  161. package/dist/styles/font/iconfont.json +14 -0
  162. package/dist/styles/font/iconfont.ttf +0 -0
  163. package/dist/styles/font/iconfont.woff +0 -0
  164. package/dist/styles/font/iconfont.woff2 +0 -0
  165. package/dist/styles/themes/default.scss +54 -50
  166. package/dist/styles/themes/jdb.scss +54 -50
  167. package/dist/styles/themes/jdt.scss +54 -50
  168. package/dist/styles/variables-jdb.scss +19 -1
  169. package/dist/styles/variables-jdt.scss +19 -1
  170. package/dist/styles/variables.scss +22 -1
  171. package/dist/types/__VUE/address/index.vue.d.ts +2 -2
  172. package/dist/types/__VUE/addresslist/components/ItemContents.vue.d.ts +1 -0
  173. package/dist/types/__VUE/animate/index.vue.d.ts +48 -0
  174. package/dist/types/__VUE/animate/type.d.ts +6 -0
  175. package/dist/types/__VUE/audiooperate/index.vue.d.ts +1 -0
  176. package/dist/types/__VUE/avatar/index.vue.d.ts +7 -7
  177. package/dist/types/__VUE/backtop/index.vue.d.ts +2 -2
  178. package/dist/types/__VUE/badge/index.vue.d.ts +2 -2
  179. package/dist/types/__VUE/button/index.vue.d.ts +2 -2
  180. package/dist/types/__VUE/calendaritem/index.vue.d.ts +10 -2
  181. package/dist/types/__VUE/cell/index.vue.d.ts +13 -6
  182. package/dist/types/__VUE/checkbox/common.d.ts +59 -0
  183. package/dist/types/__VUE/checkbox/index.vue.d.ts +20 -7
  184. package/dist/types/__VUE/checkboxgroup/index.vue.d.ts +7 -0
  185. package/dist/types/__VUE/circleprogress/index.vue.d.ts +2 -2
  186. package/dist/types/__VUE/collapse/index.vue.d.ts +5 -3
  187. package/dist/types/__VUE/collapseitem/index.vue.d.ts +2 -2
  188. package/dist/types/__VUE/configprovider/common.d.ts +20 -0
  189. package/dist/types/__VUE/configprovider/index.vue.d.ts +33 -0
  190. package/dist/types/__VUE/datepicker/index.vue.d.ts +5 -5
  191. package/dist/types/__VUE/datepicker/type.d.ts +6 -0
  192. package/dist/types/__VUE/dialog/index.d.ts +9 -2
  193. package/dist/types/__VUE/dialog/index.vue.d.ts +26 -17
  194. package/dist/types/__VUE/ecard/index.vue.d.ts +3 -3
  195. package/dist/types/__VUE/elevator/index.vue.d.ts +29 -0
  196. package/dist/types/__VUE/ellipsis/index.vue.d.ts +72 -0
  197. package/dist/types/__VUE/empty/index.vue.d.ts +2 -2
  198. package/dist/types/__VUE/formitem/index.vue.d.ts +3 -10
  199. package/dist/types/__VUE/grid/common.d.ts +3 -3
  200. package/dist/types/__VUE/grid/index.vue.d.ts +5 -5
  201. package/dist/types/__VUE/griditem/index.vue.d.ts +1 -1
  202. package/dist/types/__VUE/image/index.vue.d.ts +105 -0
  203. package/dist/types/__VUE/image/type.d.ts +6 -0
  204. package/dist/types/__VUE/imagepreview/index.vue.d.ts +36 -2
  205. package/dist/types/__VUE/infiniteloading/index.vue.d.ts +6 -6
  206. package/dist/types/__VUE/input/index.vue.d.ts +4 -4
  207. package/dist/types/__VUE/menu/index.vue.d.ts +29 -2
  208. package/dist/types/__VUE/menuitem/index.vue.d.ts +16 -7
  209. package/dist/types/__VUE/menuitem/type.d.ts +8 -0
  210. package/dist/types/__VUE/noticebar/index.vue.d.ts +3 -3
  211. package/dist/types/__VUE/picker/Column.vue.d.ts +1 -1
  212. package/dist/types/__VUE/picker/index.vue.d.ts +1 -1
  213. package/dist/types/__VUE/popover/index.vue.d.ts +2 -2
  214. package/dist/types/__VUE/range/index.vue.d.ts +1 -1
  215. package/dist/types/__VUE/rate/common.d.ts +149 -0
  216. package/dist/types/__VUE/rate/index.vue.d.ts +17 -7
  217. package/dist/types/__VUE/searchbar/index.vue.d.ts +2 -2
  218. package/dist/types/__VUE/skeleton/common.d.ts +2 -4
  219. package/dist/types/__VUE/step/index.vue.d.ts +2 -2
  220. package/dist/types/__VUE/swiper/index.vue.d.ts +4 -4
  221. package/dist/types/__VUE/switch/index.vue.d.ts +2 -2
  222. package/dist/types/__VUE/tabbaritem/index.vue.d.ts +2 -2
  223. package/dist/types/__VUE/tabs/common.d.ts +2 -2
  224. package/dist/types/__VUE/textarea/index.vue.d.ts +2 -2
  225. package/dist/types/__VUE/timeselect/index.vue.d.ts +8 -0
  226. package/dist/types/__VUE/toast/index.vue.d.ts +2 -2
  227. package/dist/types/__VUE/uploader/index.vue.d.ts +4 -4
  228. package/dist/types/__VUE/uploader/type.d.ts +2 -1
  229. package/dist/types/__VUE/uploader/uploader.d.ts +1 -0
  230. package/dist/types/__VUE/video/index.vue.d.ts +1 -1
  231. package/dist/types/index.d.ts +1 -1
  232. package/dist/types/nutui.d.ts +5 -1
  233. package/package.json +7 -3
@@ -1,420 +1,58 @@
1
1
  /*!
2
- * @nutui/nutui v3.1.21 Mon May 30 2022 20:20:01 GMT+0800 (中国标准时间)
2
+ * @nutui/nutui v3.1.22-beta.5 Fri Jun 24 2022 15:10:09 GMT+0800 (中国标准时间)
3
3
  * (c) 2022 @jdf2e.
4
4
  * Released under the MIT License.
5
5
  */
6
- import { ref, reactive, computed, watch, onMounted, resolveComponent, openBlock, createElementBlock, normalizeClass, createVNode, createCommentVNode, normalizeStyle, createElementVNode, toDisplayString, withDirectives, createBlock, vShow, renderSlot, createTextVNode } from "vue";
7
- import { c as createComponent } from "./component.js";
8
- import { _ as _export_sfc } from "./plugin-vue_export-helper.js";
6
+ import { ref as e, reactive as t, computed as l, watch as n, onMounted as a, resolveComponent as r, openBlock as o, createElementBlock as u, normalizeClass as i, createVNode as c, createCommentVNode as s, normalizeStyle as d, createElementVNode as g, toDisplayString as p, withDirectives as f, createBlock as m, vShow as y, renderSlot as h, createTextVNode as b } from "vue";
7
+ import { c as v } from "./component.js";
8
+ import { _ as x } from "./plugin-vue_export-helper.js";
9
9
  import "../locale/lang";
10
- function trimExtraChar(value, char, regExp) {
11
- const index2 = value.indexOf(char);
12
- if (index2 === -1) {
13
- return value;
14
- }
15
- if (char === "-" && index2 !== 0) {
16
- return value.slice(0, index2);
17
- }
18
- return value.slice(0, index2 + 1) + value.slice(index2).replace(regExp, "");
10
+ function k(e2, t2, l2) {
11
+ const n2 = e2.indexOf(t2);
12
+ return n2 === -1 ? e2 : t2 === "-" && n2 !== 0 ? e2.slice(0, n2) : e2.slice(0, n2 + 1) + e2.slice(n2).replace(l2, "");
19
13
  }
20
- function formatNumber(value, allowDot = true, allowMinus = true) {
21
- if (allowDot) {
22
- value = trimExtraChar(value, ".", /\./g);
23
- } else {
24
- value = value.split(".")[0];
25
- }
26
- if (allowMinus) {
27
- value = trimExtraChar(value, "-", /-/g);
28
- } else {
29
- value = value.replace(/-/, "");
30
- }
31
- const regExp = allowDot ? /[^-0-9.]/g : /[^-0-9]/g;
32
- return value.replace(regExp, "");
14
+ function I(e2, t2 = true, l2 = true) {
15
+ e2 = t2 ? k(e2, ".", /\./g) : e2.split(".")[0];
16
+ const n2 = t2 ? /[^-0-9.]/g : /[^-0-9]/g;
17
+ return (e2 = l2 ? k(e2, "-", /-/g) : e2.replace(/-/, "")).replace(n2, "");
33
18
  }
34
- const { componentName, create, translate } = createComponent("input");
35
- const _sfc_main = create({
36
- props: {
37
- ref: {
38
- type: String,
39
- default: ""
40
- },
41
- type: {
42
- type: String,
43
- default: "text"
44
- },
45
- modelValue: {
46
- type: [String, Number],
47
- default: ""
48
- },
49
- placeholder: {
50
- type: String,
51
- default: ""
52
- },
53
- label: {
54
- type: String,
55
- default: ""
56
- },
57
- labelClass: {
58
- type: String,
59
- default: ""
60
- },
61
- labelWidth: {
62
- type: [String, Number],
63
- default: "80"
64
- },
65
- labelAlign: {
66
- type: String,
67
- default: "left"
68
- },
69
- colon: {
70
- type: Boolean,
71
- default: false
72
- },
73
- inputAlign: {
74
- type: String,
75
- default: "left"
76
- },
77
- center: {
78
- type: Boolean,
79
- default: false
80
- },
81
- required: {
82
- type: Boolean,
83
- default: false
84
- },
85
- disabled: {
86
- type: Boolean,
87
- default: false
88
- },
89
- readonly: {
90
- type: Boolean,
91
- default: false
92
- },
93
- error: {
94
- type: Boolean,
95
- default: false
96
- },
97
- maxLength: {
98
- type: [String, Number],
99
- default: ""
100
- },
101
- leftIcon: {
102
- type: String,
103
- default: ""
104
- },
105
- leftIconSize: {
106
- type: [String, Number],
107
- default: ""
108
- },
109
- rightIcon: {
110
- type: String,
111
- default: ""
112
- },
113
- rightIconSize: {
114
- type: [String, Number],
115
- default: ""
116
- },
117
- clearable: {
118
- type: Boolean,
119
- default: false
120
- },
121
- clearIcon: {
122
- type: String,
123
- default: "mask-close"
124
- },
125
- clearSize: {
126
- type: [String, Number],
127
- default: "14"
128
- },
129
- border: {
130
- type: Boolean,
131
- default: true
132
- },
133
- formatTrigger: {
134
- type: String,
135
- default: "onChange"
136
- },
137
- formatter: {
138
- type: Function,
139
- default: null
140
- },
141
- rules: {
142
- type: Array,
143
- default: []
144
- },
145
- errorMessage: {
146
- type: String,
147
- default: ""
148
- },
149
- errorMessageAlign: {
150
- type: String,
151
- default: ""
152
- },
153
- rows: {
154
- type: [String, Number],
155
- default: null
156
- },
157
- showWordLimit: {
158
- type: Boolean,
159
- default: false
160
- },
161
- autofocus: {
162
- type: Boolean,
163
- default: false
164
- }
165
- },
166
- emits: [
167
- "update:modelValue",
168
- "change",
169
- "blur",
170
- "focus",
171
- "clear",
172
- "keypress",
173
- "click-input",
174
- "click-left-icon",
175
- "click-right-icon"
176
- ],
177
- setup(props, { emit, slots }) {
178
- const active = ref(false);
179
- const inputRef = ref();
180
- const customValue = ref();
181
- const getModelValue = () => {
182
- var _a;
183
- return String((_a = props.modelValue) != null ? _a : "");
184
- };
185
- const state = reactive({
186
- focused: false,
187
- validateFailed: false,
188
- validateMessage: ""
189
- });
190
- const classes = computed(() => {
191
- const prefixCls = componentName;
192
- return {
193
- [prefixCls]: true,
194
- center: props.center,
195
- [`${prefixCls}-disabled`]: props.disabled,
196
- [`${prefixCls}-required`]: props.required,
197
- [`${prefixCls}-error`]: props.error,
198
- [`${prefixCls}-border`]: props.border
199
- };
200
- });
201
- const styles = computed(() => {
202
- return {
203
- textAlign: props.inputAlign
204
- };
205
- });
206
- const stylesTextarea = computed(() => {
207
- return {
208
- textAlign: props.inputAlign,
209
- height: Number(props.rows) * 24 + "px"
210
- };
211
- });
212
- const inputType = (type) => {
213
- if (type === "number") {
214
- return "text";
215
- } else if (type === "digit") {
216
- return "tel";
217
- } else {
218
- return type;
219
- }
220
- };
221
- computed(() => {
222
- if (customValue.value && slots.input) {
223
- return customValue.value();
224
- }
225
- return props.modelValue;
226
- });
227
- const onInput = (event) => {
228
- const input = event.target;
229
- let value = input.value;
230
- updateValue(value);
231
- };
232
- const updateValue = (value, trigger = "onChange") => {
233
- var _a;
234
- if (props.type === "digit") {
235
- value = formatNumber(value, false, false);
236
- }
237
- if (props.type === "number") {
238
- value = formatNumber(value, true, true);
239
- }
240
- if (props.formatter && trigger === props.formatTrigger) {
241
- value = props.formatter(value);
242
- }
243
- if (((_a = inputRef == null ? void 0 : inputRef.value) == null ? void 0 : _a.value) !== value) {
244
- inputRef.value.value = value;
245
- }
246
- if (value !== props.modelValue) {
247
- emit("update:modelValue", value);
248
- emit("change", value);
249
- }
250
- };
251
- const onFocus = (event) => {
252
- const input = event.target;
253
- let value = input.value;
254
- active.value = true;
255
- emit("focus", value, event);
256
- };
257
- const onBlur = (event) => {
258
- setTimeout(() => {
259
- active.value = false;
260
- }, 200);
261
- const input = event.target;
262
- let value = input.value;
263
- if (props.maxLength && value.length > Number(props.maxLength)) {
264
- value = value.slice(0, Number(props.maxLength));
265
- }
266
- updateValue(getModelValue(), "onBlur");
267
- emit("blur", value, event);
268
- };
269
- const clear = (event) => {
270
- emit("update:modelValue", "", event);
271
- emit("change", "", event);
272
- emit("clear", "", event);
273
- };
274
- const resetValidation = () => {
275
- if (state.validateFailed) {
276
- state.validateFailed = false;
277
- state.validateMessage = "";
278
- }
279
- };
280
- const onClickInput = (event) => {
281
- emit("click-input", event);
282
- };
283
- const onClickLeftIcon = (event) => emit("click-left-icon", event);
284
- const onClickRightIcon = (event) => emit("click-right-icon", event);
285
- watch(() => props.modelValue, () => {
286
- updateValue(getModelValue());
287
- resetValidation();
288
- });
289
- onMounted(() => {
290
- updateValue(getModelValue(), props.formatTrigger);
291
- });
292
- return {
293
- inputRef,
294
- active,
295
- classes,
296
- styles,
297
- stylesTextarea,
298
- inputType,
299
- onInput,
300
- onFocus,
301
- onBlur,
302
- clear,
303
- onClickInput,
304
- onClickLeftIcon,
305
- onClickRightIcon,
306
- translate
307
- };
308
- }
309
- });
310
- const _hoisted_1 = { class: "label-string" };
311
- const _hoisted_2 = { class: "nut-input-value" };
312
- const _hoisted_3 = ["maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"];
313
- const _hoisted_4 = ["type", "maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"];
314
- const _hoisted_5 = {
315
- key: 0,
316
- class: "nut-input-word-limit"
317
- };
318
- const _hoisted_6 = { class: "nut-input-word-num" };
319
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
320
- const _component_nut_icon = resolveComponent("nut-icon");
321
- return openBlock(), createElementBlock("view", {
322
- class: normalizeClass(_ctx.classes)
323
- }, [
324
- _ctx.leftIcon && _ctx.leftIcon.length > 0 ? (openBlock(), createElementBlock("view", {
325
- key: 0,
326
- class: "nut-input-left-icon",
327
- onClick: _cache[0] || (_cache[0] = (...args) => _ctx.onClickLeftIcon && _ctx.onClickLeftIcon(...args))
328
- }, [
329
- createVNode(_component_nut_icon, {
330
- name: _ctx.leftIcon,
331
- size: _ctx.leftIconSize
332
- }, null, 8, ["name", "size"])
333
- ])) : createCommentVNode("", true),
334
- _ctx.label ? (openBlock(), createElementBlock("view", {
335
- key: 1,
336
- class: normalizeClass(["nut-input-label", _ctx.labelClass]),
337
- style: normalizeStyle({
338
- width: `${_ctx.labelWidth}px`,
339
- textAlign: _ctx.labelAlign
340
- })
341
- }, [
342
- createElementVNode("view", _hoisted_1, toDisplayString(_ctx.label) + " " + toDisplayString(_ctx.colon ? ":" : ""), 1)
343
- ], 6)) : createCommentVNode("", true),
344
- createElementVNode("view", _hoisted_2, [
345
- createElementVNode("view", {
346
- class: "nut-input-inner",
347
- onClick: _cache[8] || (_cache[8] = (...args) => _ctx.onClickInput && _ctx.onClickInput(...args))
348
- }, [
349
- _ctx.type == "textarea" ? (openBlock(), createElementBlock("textarea", {
350
- key: 0,
351
- class: "input-text",
352
- ref: "inputRef",
353
- style: normalizeStyle(_ctx.stylesTextarea),
354
- maxlength: _ctx.maxLength,
355
- placeholder: _ctx.placeholder || _ctx.translate("placeholder"),
356
- disabled: _ctx.disabled,
357
- readonly: _ctx.readonly,
358
- value: _ctx.modelValue,
359
- formatTrigger: _ctx.formatTrigger,
360
- autofocus: _ctx.autofocus,
361
- onInput: _cache[1] || (_cache[1] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
362
- onFocus: _cache[2] || (_cache[2] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
363
- onBlur: _cache[3] || (_cache[3] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
364
- }, null, 44, _hoisted_3)) : (openBlock(), createElementBlock("input", {
365
- key: 1,
366
- class: "input-text",
367
- ref: "inputRef",
368
- style: normalizeStyle(_ctx.styles),
369
- type: _ctx.inputType(_ctx.type),
370
- maxlength: _ctx.maxLength,
371
- placeholder: _ctx.placeholder || _ctx.translate("placeholder"),
372
- disabled: _ctx.disabled,
373
- readonly: _ctx.readonly,
374
- value: _ctx.modelValue,
375
- formatTrigger: _ctx.formatTrigger,
376
- autofocus: _ctx.autofocus,
377
- onInput: _cache[4] || (_cache[4] = (...args) => _ctx.onInput && _ctx.onInput(...args)),
378
- onFocus: _cache[5] || (_cache[5] = (...args) => _ctx.onFocus && _ctx.onFocus(...args)),
379
- onBlur: _cache[6] || (_cache[6] = (...args) => _ctx.onBlur && _ctx.onBlur(...args))
380
- }, null, 44, _hoisted_4)),
381
- _ctx.clearable && !_ctx.readonly ? withDirectives((openBlock(), createBlock(_component_nut_icon, {
382
- key: 2,
383
- class: "nut-input-clear",
384
- name: _ctx.clearIcon,
385
- size: _ctx.clearSize,
386
- onClick: _ctx.clear
387
- }, null, 8, ["name", "size", "onClick"])), [
388
- [vShow, _ctx.active && _ctx.modelValue.length > 0]
389
- ]) : createCommentVNode("", true),
390
- _ctx.rightIcon && _ctx.rightIcon.length > 0 ? (openBlock(), createElementBlock("view", {
391
- key: 3,
392
- class: "nut-input-right-icon",
393
- onClick: _cache[7] || (_cache[7] = (...args) => _ctx.onClickRightIcon && _ctx.onClickRightIcon(...args))
394
- }, [
395
- createVNode(_component_nut_icon, {
396
- name: _ctx.rightIcon,
397
- size: _ctx.rightIconSize
398
- }, null, 8, ["name", "size"])
399
- ])) : createCommentVNode("", true),
400
- _ctx.$slots.button ? renderSlot(_ctx.$slots, "button", {
401
- key: 4,
402
- class: "nut-input-button"
403
- }) : createCommentVNode("", true)
404
- ]),
405
- _ctx.showWordLimit && _ctx.maxLength ? (openBlock(), createElementBlock("view", _hoisted_5, [
406
- createElementVNode("span", _hoisted_6, toDisplayString(_ctx.modelValue ? _ctx.modelValue.length : 0), 1),
407
- createTextVNode("/" + toDisplayString(_ctx.maxLength), 1)
408
- ])) : createCommentVNode("", true),
409
- _ctx.errorMessage ? (openBlock(), createElementBlock("view", {
410
- key: 1,
411
- class: "nut-input-error-message",
412
- style: normalizeStyle({
413
- textAlign: _ctx.errorMessageAlign
414
- })
415
- }, toDisplayString(_ctx.errorMessage), 5)) : createCommentVNode("", true)
416
- ])
417
- ], 2);
418
- }
419
- var index = /* @__PURE__ */ _export_sfc(_sfc_main, [["render", _sfc_render]]);
420
- export { index as default };
19
+ const { componentName: S, create: B, translate: C } = v("input"), w = B({ props: { ref: { type: String, default: "" }, type: { type: String, default: "text" }, modelValue: { type: [String, Number], default: "" }, placeholder: { type: String, default: "" }, label: { type: String, default: "" }, labelClass: { type: String, default: "" }, labelWidth: { type: [String, Number], default: "80" }, labelAlign: { type: String, default: "left" }, colon: { type: Boolean, default: false }, inputAlign: { type: String, default: "left" }, center: { type: Boolean, default: false }, required: { type: Boolean, default: false }, disabled: { type: Boolean, default: false }, readonly: { type: Boolean, default: false }, error: { type: Boolean, default: false }, maxLength: { type: [String, Number], default: "" }, leftIcon: { type: String, default: "" }, leftIconSize: { type: [String, Number], default: "" }, rightIcon: { type: String, default: "" }, rightIconSize: { type: [String, Number], default: "" }, clearable: { type: Boolean, default: false }, clearIcon: { type: String, default: "mask-close" }, clearSize: { type: [String, Number], default: "14" }, border: { type: Boolean, default: true }, formatTrigger: { type: String, default: "onChange" }, formatter: { type: Function, default: null }, rules: { type: Array, default: [] }, errorMessage: { type: String, default: "" }, errorMessageAlign: { type: String, default: "" }, rows: { type: [String, Number], default: null }, showWordLimit: { type: Boolean, default: false }, autofocus: { type: Boolean, default: false } }, emits: ["update:modelValue", "change", "blur", "focus", "clear", "keypress", "click-input", "click-left-icon", "click-right-icon"], setup(r2, { emit: o2, slots: u2 }) {
20
+ const i2 = e(false), c2 = e(), s2 = e(), d2 = () => {
21
+ var _a;
22
+ return String((_a = r2.modelValue) != null ? _a : "");
23
+ }, g2 = t({ focused: false, validateFailed: false, validateMessage: "" }), p2 = l(() => {
24
+ const e2 = S;
25
+ return { [e2]: true, center: r2.center, [`${e2}-disabled`]: r2.disabled, [`${e2}-required`]: r2.required, [`${e2}-error`]: r2.error, [`${e2}-border`]: r2.border };
26
+ }), f2 = l(() => ({ textAlign: r2.inputAlign })), m2 = l(() => ({ textAlign: r2.inputAlign, height: 24 * Number(r2.rows) + "px" }));
27
+ l(() => s2.value && u2.input ? s2.value() : r2.modelValue);
28
+ const y2 = (e2, t2 = "onChange") => {
29
+ var _a;
30
+ r2.type === "digit" && (e2 = I(e2, false, false)), r2.type === "number" && (e2 = I(e2, true, true)), r2.formatter && t2 === r2.formatTrigger && (e2 = r2.formatter(e2)), ((_a = c2 == null ? void 0 : c2.value) == null ? void 0 : _a.value) !== e2 && (c2.value.value = e2), e2 !== r2.modelValue && (o2("update:modelValue", e2), o2("change", e2));
31
+ };
32
+ return n(() => r2.modelValue, () => {
33
+ y2(d2()), g2.validateFailed && (g2.validateFailed = false, g2.validateMessage = "");
34
+ }), a(() => {
35
+ y2(d2(), r2.formatTrigger);
36
+ }), { inputRef: c2, active: i2, classes: p2, styles: f2, stylesTextarea: m2, inputType: (e2) => e2 === "number" ? "text" : e2 === "digit" ? "tel" : e2, onInput: (e2) => {
37
+ let t2 = e2.target.value;
38
+ r2.maxLength && t2.length > Number(r2.maxLength) && (t2 = t2.slice(0, Number(r2.maxLength))), y2(t2);
39
+ }, onFocus: (e2) => {
40
+ let t2 = e2.target.value;
41
+ i2.value = true, o2("focus", t2, e2);
42
+ }, onBlur: (e2) => {
43
+ setTimeout(() => {
44
+ i2.value = false;
45
+ }, 200);
46
+ let t2 = e2.target.value;
47
+ r2.maxLength && t2.length > Number(r2.maxLength) && (t2 = t2.slice(0, Number(r2.maxLength))), y2(d2(), "onBlur"), o2("blur", t2, e2);
48
+ }, clear: (e2) => {
49
+ o2("update:modelValue", "", e2), o2("change", "", e2), o2("clear", "", e2);
50
+ }, onClickInput: (e2) => {
51
+ o2("click-input", e2);
52
+ }, onClickLeftIcon: (e2) => o2("click-left-icon", e2), onClickRightIcon: (e2) => o2("click-right-icon", e2), translate: C };
53
+ } }), L = { class: "label-string" }, T = { class: "nut-input-value" }, N = ["maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"], V = ["type", "maxlength", "placeholder", "disabled", "readonly", "value", "formatTrigger", "autofocus"], z = { key: 0, class: "nut-input-word-limit" }, A = { class: "nut-input-word-num" };
54
+ var F = x(w, [["render", function(e2, t2, l2, n2, a2, v2) {
55
+ const x2 = r("nut-icon");
56
+ return o(), u("view", { class: i(e2.classes) }, [e2.leftIcon && e2.leftIcon.length > 0 ? (o(), u("view", { key: 0, class: "nut-input-left-icon", onClick: t2[0] || (t2[0] = (...t3) => e2.onClickLeftIcon && e2.onClickLeftIcon(...t3)) }, [c(x2, { name: e2.leftIcon, size: e2.leftIconSize }, null, 8, ["name", "size"])])) : s("", true), e2.label ? (o(), u("view", { key: 1, class: i(["nut-input-label", e2.labelClass]), style: d({ width: `${e2.labelWidth}px`, textAlign: e2.labelAlign }) }, [g("view", L, p(e2.label) + " " + p(e2.colon ? ":" : ""), 1)], 6)) : s("", true), g("view", T, [g("view", { class: "nut-input-inner", onClick: t2[8] || (t2[8] = (...t3) => e2.onClickInput && e2.onClickInput(...t3)) }, [e2.type == "textarea" ? (o(), u("textarea", { key: 0, class: "input-text", ref: "inputRef", style: d(e2.stylesTextarea), maxlength: e2.maxLength, placeholder: e2.placeholder || e2.translate("placeholder"), disabled: e2.disabled, readonly: e2.readonly, value: e2.modelValue, formatTrigger: e2.formatTrigger, autofocus: e2.autofocus, onInput: t2[1] || (t2[1] = (...t3) => e2.onInput && e2.onInput(...t3)), onFocus: t2[2] || (t2[2] = (...t3) => e2.onFocus && e2.onFocus(...t3)), onBlur: t2[3] || (t2[3] = (...t3) => e2.onBlur && e2.onBlur(...t3)) }, null, 44, N)) : (o(), u("input", { key: 1, class: "input-text", ref: "inputRef", style: d(e2.styles), type: e2.inputType(e2.type), maxlength: e2.maxLength, placeholder: e2.placeholder || e2.translate("placeholder"), disabled: e2.disabled, readonly: e2.readonly, value: e2.modelValue, formatTrigger: e2.formatTrigger, autofocus: e2.autofocus, onInput: t2[4] || (t2[4] = (...t3) => e2.onInput && e2.onInput(...t3)), onFocus: t2[5] || (t2[5] = (...t3) => e2.onFocus && e2.onFocus(...t3)), onBlur: t2[6] || (t2[6] = (...t3) => e2.onBlur && e2.onBlur(...t3)) }, null, 44, V)), e2.clearable && !e2.readonly ? f((o(), m(x2, { key: 2, class: "nut-input-clear", name: e2.clearIcon, size: e2.clearSize, onClick: e2.clear }, null, 8, ["name", "size", "onClick"])), [[y, e2.active && e2.modelValue.length > 0]]) : s("", true), e2.rightIcon && e2.rightIcon.length > 0 ? (o(), u("view", { key: 3, class: "nut-input-right-icon", onClick: t2[7] || (t2[7] = (...t3) => e2.onClickRightIcon && e2.onClickRightIcon(...t3)) }, [c(x2, { name: e2.rightIcon, size: e2.rightIconSize }, null, 8, ["name", "size"])])) : s("", true), e2.$slots.button ? h(e2.$slots, "button", { key: 4, class: "nut-input-button" }) : s("", true)]), e2.showWordLimit && e2.maxLength ? (o(), u("view", z, [g("span", A, p(e2.modelValue ? e2.modelValue.length : 0), 1), b("/" + p(e2.maxLength), 1)])) : s("", true), e2.errorMessage ? (o(), u("view", { key: 1, class: "nut-input-error-message", style: d({ textAlign: e2.errorMessageAlign }) }, p(e2.errorMessage), 5)) : s("", true)])], 2);
57
+ }]]);
58
+ export { F as default };