@wfrog/vc-ui 1.1.0 → 1.2.0

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 (132) hide show
  1. package/README.md +3 -3
  2. package/dist/es/chunk/{OEa4tYPF.mjs → -ga82G_B.mjs} +1 -1
  3. package/dist/es/chunk/B1BnPYNG.mjs +163 -0
  4. package/dist/es/chunk/{DFOLES4O.mjs → BA2yoAwy.mjs} +403 -502
  5. package/dist/es/chunk/{BpqBBo4z.mjs → BDyXj_90.mjs} +2 -2
  6. package/dist/es/chunk/{BI0vrXwX.mjs → BI-fNJhk.mjs} +6 -3
  7. package/dist/es/chunk/{BsGCX4td.mjs → BK4T_2ha.mjs} +1 -1
  8. package/dist/es/chunk/{73YgKz3H.mjs → BLLKi_0v.mjs} +1 -1
  9. package/dist/es/chunk/{DTLPXrjb.mjs → BTsEMnf_.mjs} +1 -1
  10. package/dist/es/chunk/{B5UQmWXg.mjs → BUf50Y7Y.mjs} +41 -21
  11. package/dist/es/chunk/{BzedaLtg.mjs → BYVaz5Or.mjs} +2 -2
  12. package/dist/es/chunk/BaJ7k5Lg.mjs +209 -0
  13. package/dist/es/chunk/{Bp9jXKX0.mjs → BambM7zX.mjs} +2 -2
  14. package/dist/es/chunk/{CizMbf5K.mjs → Bl0WQiki.mjs} +1 -1
  15. package/dist/es/chunk/{CLbj8G-F.mjs → Bnot0Gwc.mjs} +12 -4
  16. package/dist/es/chunk/{4eyJqDa9.mjs → BoGGHTrJ.mjs} +4 -2
  17. package/dist/es/chunk/C7Dgjpd1.mjs +242 -0
  18. package/dist/es/chunk/{D0LB3gF-.mjs → CKbkzlkO.mjs} +104 -72
  19. package/dist/es/chunk/{DrgvuOYH.mjs → CL5WTCB3.mjs} +4 -2
  20. package/dist/es/chunk/{XwSiBVsA.mjs → CM_I1FoA.mjs} +2 -2
  21. package/dist/es/chunk/{DouIsSPi.mjs → CNILa-hz.mjs} +1 -1
  22. package/dist/es/chunk/{DRoyW749.mjs → CcKUdl3e.mjs} +12 -6
  23. package/dist/es/chunk/CidLkmft.mjs +188 -0
  24. package/dist/es/chunk/{HAog8AWU.mjs → CitH0taR.mjs} +816 -539
  25. package/dist/es/chunk/{Cu6erWl4.mjs → CzqeSQn4.mjs} +73 -38
  26. package/dist/es/chunk/{CLCfXfvv.mjs → D7JQbDFE.mjs} +154 -118
  27. package/dist/es/chunk/{DaCDeO95.mjs → D9iEroQw.mjs} +1 -207
  28. package/dist/es/chunk/{cPBw23yt.mjs → DEPZhJ0Z.mjs} +21 -16
  29. package/dist/es/chunk/{CPERtDRX.mjs → DHpbQMGk.mjs} +32 -22
  30. package/dist/es/chunk/{BHsNc7jl.mjs → DKpRXDRE.mjs} +82 -55
  31. package/dist/es/chunk/{CLMc8GzD.mjs → DMYHOxhk.mjs} +462 -311
  32. package/dist/es/chunk/{CBSopeeE.mjs → DQHGjqG5.mjs} +9 -4
  33. package/dist/es/chunk/DTEM_vYZ.mjs +23 -0
  34. package/dist/es/chunk/{NQBKROII.mjs → DWcIzeMM.mjs} +1 -1
  35. package/dist/es/chunk/{FHvLvzEB.mjs → DX38FfmL.mjs} +1088 -697
  36. package/dist/es/chunk/{DZD-YnCt.mjs → Dcm-lOj8.mjs} +4 -4
  37. package/dist/es/chunk/{09Ec85_u.mjs → DdmNdV7I.mjs} +398 -278
  38. package/dist/es/chunk/{f0-vIQGp.mjs → DfHTA5LW.mjs} +3 -3
  39. package/dist/es/chunk/DgFT6snA.mjs +835 -0
  40. package/dist/es/chunk/{DwKWIlzw.mjs → DgSzI6Fw.mjs} +106 -71
  41. package/dist/es/chunk/{BcTuAX8r.mjs → Dsye5ZEp.mjs} +5 -3
  42. package/dist/es/chunk/{BsLJxiSC.mjs → Dw-yyl2m.mjs} +1 -1
  43. package/dist/es/chunk/{DXPWe_a5.mjs → U13Qpiki.mjs} +19 -13
  44. package/dist/es/chunk/{axpwSky6.mjs → _8u_XVHh.mjs} +168 -120
  45. package/dist/es/chunk/egk9EEzo.mjs +66 -0
  46. package/dist/es/chunk/{BUEEWLrd.mjs → ezK_XQQd.mjs} +15 -6
  47. package/dist/es/chunk/{Bl2KlMdP.mjs → oW98L-44.mjs} +8 -3
  48. package/dist/es/chunk/{Dk6Bx0KT.mjs → plK2vnjp.mjs} +8 -5
  49. package/dist/es/components/awesome-icon/awesome-icon.mjs +2 -1
  50. package/dist/es/components/backbottom/backbottom.mjs +2 -2
  51. package/dist/es/components/button/button.mjs +105 -76
  52. package/dist/es/components/choice/choice.mjs +2 -2
  53. package/dist/es/components/config-provider/config-provider.d.ts +1 -0
  54. package/dist/es/components/config-provider/config-provider.mjs +13 -5
  55. package/dist/es/components/cropper/cropper.mjs +44 -33
  56. package/dist/es/components/currency/currency.mjs +5 -5
  57. package/dist/es/components/daterange-picker/daterange-picker.mjs +2267 -1522
  58. package/dist/es/components/dialog/dialog.mjs +213 -172
  59. package/dist/es/components/dialog/index.css +1 -1
  60. package/dist/es/components/dialog-camera-upload/dialog-camera-upload.mjs +11 -11
  61. package/dist/es/components/dialog-map-point/dialog-map-point.mjs +5 -4
  62. package/dist/es/components/dialog-upload-images/dialog-upload-images.mjs +495 -314
  63. package/dist/es/components/dialog-upload-images/index.css +1 -1
  64. package/dist/es/components/drag-verify/drag-verify.mjs +3 -3
  65. package/dist/es/components/drawer/drawer.mjs +136 -94
  66. package/dist/es/components/drawer/index.css +1 -1
  67. package/dist/es/components/easy-pagination/easy-pagination.mjs +2 -2
  68. package/dist/es/components/el-icon/el-icon.mjs +1 -1
  69. package/dist/es/components/el-icon/index.css +3 -2
  70. package/dist/es/components/flag/flag.mjs +2 -1
  71. package/dist/es/components/icon/icon.mjs +10 -31
  72. package/dist/es/components/icon/icon.vue.d.ts +1 -1
  73. package/dist/es/components/icon/icon2.mjs +1 -1
  74. package/dist/es/components/icon/index.mjs +2 -2
  75. package/dist/es/components/icon-picker/components/collections.vue.d.ts +625 -0
  76. package/dist/es/components/icon-picker/components/panel.vue.d.ts +9 -0
  77. package/dist/es/components/icon-picker/icon-picker.d.ts +40 -0
  78. package/dist/es/components/icon-picker/icon-picker.mjs +1375 -0
  79. package/dist/es/components/icon-picker/icon-picker.vue.d.ts +9 -0
  80. package/dist/es/components/icon-picker/index.css +121 -0
  81. package/dist/es/components/icon-picker/index.d.ts +4 -0
  82. package/dist/es/components/icon-picker/index.mjs +6 -0
  83. package/dist/es/components/iconify-icon/iconify-icon.d.ts +5 -0
  84. package/dist/es/components/iconify-icon/iconify-icon.mjs +1860 -0
  85. package/dist/es/components/iconify-icon/iconify-icon.vue.d.ts +6 -0
  86. package/dist/es/components/iconify-icon/index.css +11 -0
  87. package/dist/es/components/iconify-icon/index.d.ts +4 -0
  88. package/dist/es/components/iconify-icon/index.mjs +6 -0
  89. package/dist/es/components/image/image.mjs +5 -5
  90. package/dist/es/components/input/input.mjs +4 -4
  91. package/dist/es/components/input/input.vue.d.ts +63 -54
  92. package/dist/es/components/input-number/input-number.mjs +5 -5
  93. package/dist/es/components/pca-picker/components/c.vue.d.ts +4 -4
  94. package/dist/es/components/pca-picker/index.css +1 -1
  95. package/dist/es/components/pca-picker/pca-picker.mjs +154 -160
  96. package/dist/es/components/pca-picker/pca-picker.vue.d.ts +12 -11
  97. package/dist/es/components/qr-code/qr-code.mjs +2 -1
  98. package/dist/es/components/screenfull/screenfull.mjs +6 -5
  99. package/dist/es/components/scrollbar/index.css +18 -0
  100. package/dist/es/components/scrollbar/index.d.ts +4 -0
  101. package/dist/es/components/scrollbar/index.mjs +6 -0
  102. package/dist/es/components/scrollbar/scrollbar.d.ts +4 -0
  103. package/dist/es/components/scrollbar/scrollbar.mjs +65 -0
  104. package/dist/es/components/scrollbar/scrollbar.vue.d.ts +588 -0
  105. package/dist/es/components/select/select.mjs +7 -7
  106. package/dist/es/components/single-player/index.css +1 -1
  107. package/dist/es/components/single-player/single-player.mjs +265 -166
  108. package/dist/es/components/svg-icon/index.css +3 -2
  109. package/dist/es/components/svg-icon/svg-icon.mjs +3 -3
  110. package/dist/es/components/switch/switch.mjs +2 -2
  111. package/dist/es/components/sync-scroll-container/sync-scroll-container.mjs +2 -2
  112. package/dist/es/components/tags/tags.mjs +9 -9
  113. package/dist/es/components/text-ellipsis/text-ellipsis.mjs +4 -4
  114. package/dist/es/components/thousand-input/thousand-input.mjs +5 -4
  115. package/dist/es/components/thousand-input/thousand-input.vue.d.ts +126 -108
  116. package/dist/es/components/tinymce/index.css +1 -1
  117. package/dist/es/components/tinymce/tinymce.mjs +9 -8
  118. package/dist/es/components/tree-picker/components/popover-cascader.vue.d.ts +179 -141
  119. package/dist/es/components/tree-picker/popover-cascader.css +1 -1
  120. package/dist/es/components/tree-picker/tree-picker.mjs +10 -10
  121. package/dist/es/components/tree-picker/tree-picker.vue.d.ts +12 -11
  122. package/dist/es/components/upload-file/upload-file.mjs +3 -3
  123. package/dist/es/index.d.ts +3 -0
  124. package/dist/es/index.mjs +41 -31
  125. package/dist/global.d.ts +3 -0
  126. package/dist/index.css +166 -22
  127. package/package.json +8 -2
  128. package/dist/es/chunk/BtTIs3tG.mjs +0 -138
  129. package/dist/es/chunk/C7wQNvSS.mjs +0 -728
  130. package/dist/es/chunk/Cbhe4I9Z.mjs +0 -16
  131. package/dist/es/chunk/DihosKp1.mjs +0 -140
  132. package/dist/es/components/icon/index.css +0 -9
@@ -0,0 +1,835 @@
1
+ import { defineComponent, useAttrs, useSlots, computed, shallowRef, ref, watch, nextTick, onMounted, toRef, createElementBlock, openBlock, normalizeStyle, normalizeClass, unref, createCommentVNode, Fragment, createElementVNode, renderSlot, createBlock, withCtx, resolveDynamicComponent, mergeProps, withModifiers, toDisplayString } from 'vue';
2
+ import { useResizeObserver, isClient } from '@vueuse/core';
3
+ import { E as ElIcon } from './DEPZhJ0Z.mjs';
4
+ import { CircleClose, View, Hide } from '@element-plus/icons-vue';
5
+ import { i as isFirefox } from './CsLIbnzG.mjs';
6
+ import { f as isNumber, h as isString, c as buildProps, d as definePropType, u as useNamespace, k as isNil, e as debugWarn, N as NOOP, p as isObject } from './CcKUdl3e.mjs';
7
+ import { u as useSizeProp } from './BK4T_2ha.mjs';
8
+ import { i as iconPropType, V as ValidateComponentsMap } from '../components/icon/icon2.mjs';
9
+ import { m as mutable } from './B-rxnVJv.mjs';
10
+ import { u as useAriaProps } from './BDyXj_90.mjs';
11
+ import { U as UPDATE_MODEL_EVENT, C as CHANGE_EVENT, I as INPUT_EVENT } from './Ct6q2FXg.mjs';
12
+ import { _ as _export_sfc, w as withInstall } from './BTsEMnf_.mjs';
13
+ import { u as useAttrs$1 } from './ezK_XQQd.mjs';
14
+ import { c as useFormSize, b as useFormDisabled, u as useFormItem, a as useFormItemInputId } from './U13Qpiki.mjs';
15
+ import { u as useFocusController, a as useComposition } from './CM_I1FoA.mjs';
16
+
17
+ let hiddenTextarea = void 0;
18
+ const HIDDEN_STYLE = {
19
+ height: "0",
20
+ visibility: "hidden",
21
+ overflow: isFirefox() ? "" : "hidden",
22
+ position: "absolute",
23
+ "z-index": "-1000",
24
+ top: "0",
25
+ right: "0"
26
+ };
27
+ const CONTEXT_STYLE = [
28
+ "letter-spacing",
29
+ "line-height",
30
+ "padding-top",
31
+ "padding-bottom",
32
+ "font-family",
33
+ "font-weight",
34
+ "font-size",
35
+ "text-rendering",
36
+ "text-transform",
37
+ "width",
38
+ "text-indent",
39
+ "padding-left",
40
+ "padding-right",
41
+ "border-width",
42
+ "box-sizing",
43
+ "word-break"
44
+ ];
45
+ const looseToNumber = (val) => {
46
+ const n = Number.parseFloat(val);
47
+ return Number.isNaN(n) ? val : n;
48
+ };
49
+ function calculateNodeStyling(targetElement) {
50
+ const style = window.getComputedStyle(targetElement);
51
+ const boxSizing = style.getPropertyValue("box-sizing");
52
+ const paddingSize = Number.parseFloat(style.getPropertyValue("padding-bottom")) + Number.parseFloat(style.getPropertyValue("padding-top"));
53
+ const borderSize = Number.parseFloat(style.getPropertyValue("border-bottom-width")) + Number.parseFloat(style.getPropertyValue("border-top-width"));
54
+ const contextStyle = CONTEXT_STYLE.map((name) => [
55
+ name,
56
+ style.getPropertyValue(name)
57
+ ]);
58
+ return { contextStyle, paddingSize, borderSize, boxSizing };
59
+ }
60
+ function calcTextareaHeight(targetElement, minRows = 1, maxRows) {
61
+ var _a, _b;
62
+ if (!hiddenTextarea) {
63
+ hiddenTextarea = document.createElement("textarea");
64
+ ((_a = targetElement.parentNode) != null ? _a : document.body).appendChild(hiddenTextarea);
65
+ }
66
+ const { paddingSize, borderSize, boxSizing, contextStyle } = calculateNodeStyling(targetElement);
67
+ contextStyle.forEach(
68
+ ([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value)
69
+ );
70
+ Object.entries(HIDDEN_STYLE).forEach(
71
+ ([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value, "important")
72
+ );
73
+ hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
74
+ let height = hiddenTextarea.scrollHeight;
75
+ const result = {};
76
+ if (boxSizing === "border-box") {
77
+ height = height + borderSize;
78
+ } else if (boxSizing === "content-box") {
79
+ height = height - paddingSize;
80
+ }
81
+ hiddenTextarea.value = "";
82
+ const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
83
+ if (isNumber(minRows)) {
84
+ let minHeight = singleRowHeight * minRows;
85
+ if (boxSizing === "border-box") {
86
+ minHeight = minHeight + paddingSize + borderSize;
87
+ }
88
+ height = Math.max(minHeight, height);
89
+ result.minHeight = `${minHeight}px`;
90
+ }
91
+ if (isNumber(maxRows)) {
92
+ let maxHeight = singleRowHeight * maxRows;
93
+ if (boxSizing === "border-box") {
94
+ maxHeight = maxHeight + paddingSize + borderSize;
95
+ }
96
+ height = Math.min(maxHeight, height);
97
+ }
98
+ result.height = `${height}px`;
99
+ (_b = hiddenTextarea.parentNode) == null ? void 0 : _b.removeChild(hiddenTextarea);
100
+ hiddenTextarea = void 0;
101
+ return result;
102
+ }
103
+
104
+ const inputProps = buildProps({
105
+ id: {
106
+ type: String,
107
+ default: void 0
108
+ },
109
+ size: useSizeProp,
110
+ disabled: {
111
+ type: Boolean,
112
+ default: void 0
113
+ },
114
+ modelValue: {
115
+ type: definePropType([
116
+ String,
117
+ Number,
118
+ Object
119
+ ]),
120
+ default: ""
121
+ },
122
+ modelModifiers: {
123
+ type: definePropType(Object),
124
+ default: () => ({})
125
+ },
126
+ maxlength: {
127
+ type: [String, Number]
128
+ },
129
+ minlength: {
130
+ type: [String, Number]
131
+ },
132
+ type: {
133
+ type: definePropType(String),
134
+ default: "text"
135
+ },
136
+ resize: {
137
+ type: String,
138
+ values: ["none", "both", "horizontal", "vertical"]
139
+ },
140
+ autosize: {
141
+ type: definePropType([Boolean, Object]),
142
+ default: false
143
+ },
144
+ autocomplete: {
145
+ type: definePropType(String),
146
+ default: "off"
147
+ },
148
+ formatter: {
149
+ type: Function
150
+ },
151
+ parser: {
152
+ type: Function
153
+ },
154
+ placeholder: {
155
+ type: String
156
+ },
157
+ form: {
158
+ type: String
159
+ },
160
+ readonly: Boolean,
161
+ clearable: Boolean,
162
+ clearIcon: {
163
+ type: iconPropType,
164
+ default: CircleClose
165
+ },
166
+ showPassword: Boolean,
167
+ showWordLimit: Boolean,
168
+ wordLimitPosition: {
169
+ type: String,
170
+ values: ["inside", "outside"],
171
+ default: "inside"
172
+ },
173
+ suffixIcon: {
174
+ type: iconPropType
175
+ },
176
+ prefixIcon: {
177
+ type: iconPropType
178
+ },
179
+ containerRole: {
180
+ type: String,
181
+ default: void 0
182
+ },
183
+ tabindex: {
184
+ type: [String, Number],
185
+ default: 0
186
+ },
187
+ validateEvent: {
188
+ type: Boolean,
189
+ default: true
190
+ },
191
+ inputStyle: {
192
+ type: definePropType([Object, Array, String]),
193
+ default: () => mutable({})
194
+ },
195
+ autofocus: Boolean,
196
+ rows: {
197
+ type: Number,
198
+ default: 2
199
+ },
200
+ ...useAriaProps(["ariaLabel"]),
201
+ inputmode: {
202
+ type: definePropType(String),
203
+ default: void 0
204
+ },
205
+ name: String
206
+ });
207
+ const inputEmits = {
208
+ [UPDATE_MODEL_EVENT]: (value) => isString(value),
209
+ input: (value) => isString(value),
210
+ change: (value, evt) => isString(value) && (evt instanceof Event || evt === void 0),
211
+ focus: (evt) => evt instanceof FocusEvent,
212
+ blur: (evt) => evt instanceof FocusEvent,
213
+ clear: () => true,
214
+ mouseleave: (evt) => evt instanceof MouseEvent,
215
+ mouseenter: (evt) => evt instanceof MouseEvent,
216
+ keydown: (evt) => evt instanceof Event,
217
+ compositionstart: (evt) => evt instanceof CompositionEvent,
218
+ compositionupdate: (evt) => evt instanceof CompositionEvent,
219
+ compositionend: (evt) => evt instanceof CompositionEvent
220
+ };
221
+
222
+ function useCursor(input) {
223
+ let selectionInfo;
224
+ function recordCursor() {
225
+ if (input.value == void 0)
226
+ return;
227
+ const { selectionStart, selectionEnd, value } = input.value;
228
+ if (selectionStart == null || selectionEnd == null)
229
+ return;
230
+ const beforeTxt = value.slice(0, Math.max(0, selectionStart));
231
+ const afterTxt = value.slice(Math.max(0, selectionEnd));
232
+ selectionInfo = {
233
+ selectionStart,
234
+ selectionEnd,
235
+ value,
236
+ beforeTxt,
237
+ afterTxt
238
+ };
239
+ }
240
+ function setCursor() {
241
+ if (input.value == void 0 || selectionInfo == void 0)
242
+ return;
243
+ const { value } = input.value;
244
+ const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
245
+ if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
246
+ return;
247
+ let startPos = value.length;
248
+ if (value.endsWith(afterTxt)) {
249
+ startPos = value.length - afterTxt.length;
250
+ } else if (value.startsWith(beforeTxt)) {
251
+ startPos = beforeTxt.length;
252
+ } else {
253
+ const beforeLastChar = beforeTxt[selectionStart - 1];
254
+ const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
255
+ if (newIndex !== -1) {
256
+ startPos = newIndex + 1;
257
+ }
258
+ }
259
+ input.value.setSelectionRange(startPos, startPos);
260
+ }
261
+ return [recordCursor, setCursor];
262
+ }
263
+
264
+ const _hoisted_1 = ["id", "name", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "inputmode"];
265
+ const _hoisted_2 = ["id", "name", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role"];
266
+ const COMPONENT_NAME = "ElInput";
267
+ const _sfc_main = defineComponent({
268
+ ...{
269
+ name: COMPONENT_NAME,
270
+ inheritAttrs: false
271
+ },
272
+ __name: "input",
273
+ props: inputProps,
274
+ emits: inputEmits,
275
+ setup(__props, { expose: __expose, emit: __emit }) {
276
+ const props = __props;
277
+ const emit = __emit;
278
+ const rawAttrs = useAttrs();
279
+ const attrs = useAttrs$1();
280
+ const slots = useSlots();
281
+ const containerKls = computed(() => [
282
+ props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
283
+ nsInput.m(inputSize.value),
284
+ nsInput.is("disabled", inputDisabled.value),
285
+ nsInput.is("exceed", inputExceed.value),
286
+ {
287
+ [nsInput.b("group")]: slots.prepend || slots.append,
288
+ [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
289
+ [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
290
+ [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
291
+ [nsInput.b("hidden")]: props.type === "hidden"
292
+ },
293
+ rawAttrs.class
294
+ ]);
295
+ const wrapperKls = computed(() => [
296
+ nsInput.e("wrapper"),
297
+ nsInput.is("focus", isFocused.value)
298
+ ]);
299
+ const { form: elForm, formItem: elFormItem } = useFormItem();
300
+ const { inputId } = useFormItemInputId(props, {
301
+ formItemContext: elFormItem
302
+ });
303
+ const inputSize = useFormSize();
304
+ const inputDisabled = useFormDisabled();
305
+ const nsInput = useNamespace("input");
306
+ const nsTextarea = useNamespace("textarea");
307
+ const input = shallowRef();
308
+ const textarea = shallowRef();
309
+ const hovering = ref(false);
310
+ const passwordVisible = ref(false);
311
+ const countStyle = ref();
312
+ const textareaCalcStyle = shallowRef(props.inputStyle);
313
+ const _ref = computed(() => input.value || textarea.value);
314
+ const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(
315
+ _ref,
316
+ {
317
+ disabled: inputDisabled,
318
+ afterBlur() {
319
+ var _a;
320
+ if (props.validateEvent) {
321
+ (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn(err));
322
+ }
323
+ }
324
+ }
325
+ );
326
+ const needStatusIcon = computed(() => {
327
+ var _a;
328
+ return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
329
+ });
330
+ const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
331
+ const validateIcon = computed(
332
+ () => validateState.value && ValidateComponentsMap[validateState.value]
333
+ );
334
+ const passwordIcon = computed(
335
+ () => passwordVisible.value ? View : Hide
336
+ );
337
+ const containerStyle = computed(() => [
338
+ rawAttrs.style
339
+ ]);
340
+ const textareaStyle = computed(() => [
341
+ props.inputStyle,
342
+ textareaCalcStyle.value,
343
+ { resize: props.resize }
344
+ ]);
345
+ const nativeInputValue = computed(
346
+ () => isNil(props.modelValue) ? "" : String(props.modelValue)
347
+ );
348
+ const showClear = computed(
349
+ () => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value)
350
+ );
351
+ const showPwdVisible = computed(
352
+ () => props.showPassword && !inputDisabled.value && !!nativeInputValue.value
353
+ );
354
+ const isWordLimitVisible = computed(
355
+ () => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword
356
+ );
357
+ const textLength = computed(() => nativeInputValue.value.length);
358
+ const inputExceed = computed(
359
+ () => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength)
360
+ );
361
+ const suffixVisible = computed(
362
+ () => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value
363
+ );
364
+ const hasModelModifiers = computed(
365
+ () => !!Object.keys(props.modelModifiers).length
366
+ );
367
+ const [recordCursor, setCursor] = useCursor(input);
368
+ useResizeObserver(textarea, (entries) => {
369
+ onceInitSizeTextarea();
370
+ if (!isWordLimitVisible.value || props.resize !== "both" && props.resize !== "horizontal")
371
+ return;
372
+ const entry = entries[0];
373
+ const { width } = entry.contentRect;
374
+ countStyle.value = {
375
+ right: `calc(100% - ${width + 22 - 10}px)`
376
+ };
377
+ });
378
+ const resizeTextarea = () => {
379
+ const { type, autosize } = props;
380
+ if (!isClient || type !== "textarea" || !textarea.value)
381
+ return;
382
+ if (autosize) {
383
+ const minRows = isObject(autosize) ? autosize.minRows : void 0;
384
+ const maxRows = isObject(autosize) ? autosize.maxRows : void 0;
385
+ const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
386
+ textareaCalcStyle.value = {
387
+ overflowY: "hidden",
388
+ ...textareaStyle2
389
+ };
390
+ nextTick(() => {
391
+ textarea.value.offsetHeight;
392
+ textareaCalcStyle.value = textareaStyle2;
393
+ });
394
+ } else {
395
+ textareaCalcStyle.value = {
396
+ minHeight: calcTextareaHeight(textarea.value).minHeight
397
+ };
398
+ }
399
+ };
400
+ const createOnceInitResize = (resizeTextarea2) => {
401
+ let isInit = false;
402
+ return () => {
403
+ var _a;
404
+ if (isInit || !props.autosize)
405
+ return;
406
+ const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
407
+ if (!isElHidden) {
408
+ setTimeout(resizeTextarea2);
409
+ isInit = true;
410
+ }
411
+ };
412
+ };
413
+ const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
414
+ const setNativeInputValue = () => {
415
+ const input2 = _ref.value;
416
+ const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
417
+ if (!input2 || input2.value === formatterValue || props.type === "file")
418
+ return;
419
+ input2.value = formatterValue;
420
+ };
421
+ const formatValue = (value) => {
422
+ const { trim, number } = props.modelModifiers;
423
+ if (trim) {
424
+ value = value.trim();
425
+ }
426
+ if (number) {
427
+ value = `${looseToNumber(value)}`;
428
+ }
429
+ if (props.formatter && props.parser) {
430
+ value = props.parser(value);
431
+ }
432
+ return value;
433
+ };
434
+ const handleInput = async (event) => {
435
+ if (isComposing.value)
436
+ return;
437
+ const { lazy } = props.modelModifiers;
438
+ let { value } = event.target;
439
+ if (lazy) {
440
+ emit(INPUT_EVENT, value);
441
+ return;
442
+ }
443
+ value = formatValue(value);
444
+ if (String(value) === nativeInputValue.value) {
445
+ if (props.formatter) {
446
+ setNativeInputValue();
447
+ }
448
+ return;
449
+ }
450
+ recordCursor();
451
+ emit(UPDATE_MODEL_EVENT, value);
452
+ emit(INPUT_EVENT, value);
453
+ await nextTick();
454
+ if (props.formatter && props.parser || !hasModelModifiers.value) {
455
+ setNativeInputValue();
456
+ }
457
+ setCursor();
458
+ };
459
+ const handleChange = async (event) => {
460
+ let { value } = event.target;
461
+ value = formatValue(value);
462
+ if (props.modelModifiers.lazy) {
463
+ emit(UPDATE_MODEL_EVENT, value);
464
+ }
465
+ emit(CHANGE_EVENT, value, event);
466
+ await nextTick();
467
+ setNativeInputValue();
468
+ };
469
+ const {
470
+ isComposing,
471
+ handleCompositionStart,
472
+ handleCompositionUpdate,
473
+ handleCompositionEnd
474
+ } = useComposition({ emit, afterComposition: handleInput });
475
+ const handlePasswordVisible = () => {
476
+ passwordVisible.value = !passwordVisible.value;
477
+ };
478
+ const focus = () => {
479
+ var _a;
480
+ return (_a = _ref.value) == null ? void 0 : _a.focus();
481
+ };
482
+ const blur = () => {
483
+ var _a;
484
+ return (_a = _ref.value) == null ? void 0 : _a.blur();
485
+ };
486
+ const handleMouseLeave = (evt) => {
487
+ hovering.value = false;
488
+ emit("mouseleave", evt);
489
+ };
490
+ const handleMouseEnter = (evt) => {
491
+ hovering.value = true;
492
+ emit("mouseenter", evt);
493
+ };
494
+ const handleKeydown = (evt) => {
495
+ emit("keydown", evt);
496
+ };
497
+ const select = () => {
498
+ var _a;
499
+ (_a = _ref.value) == null ? void 0 : _a.select();
500
+ };
501
+ const clear = () => {
502
+ emit(UPDATE_MODEL_EVENT, "");
503
+ emit(CHANGE_EVENT, "");
504
+ emit("clear");
505
+ emit(INPUT_EVENT, "");
506
+ };
507
+ watch(
508
+ () => props.modelValue,
509
+ () => {
510
+ var _a;
511
+ nextTick(() => resizeTextarea());
512
+ if (props.validateEvent) {
513
+ (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
514
+ }
515
+ }
516
+ );
517
+ watch(nativeInputValue, (newValue) => {
518
+ if (!_ref.value) {
519
+ return;
520
+ }
521
+ const { trim, number } = props.modelModifiers;
522
+ const elValue = _ref.value.value;
523
+ const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
524
+ if (displayValue === newValue) {
525
+ return;
526
+ }
527
+ if (document.activeElement === _ref.value && _ref.value.type !== "range") {
528
+ if (trim && displayValue.trim() === newValue) {
529
+ return;
530
+ }
531
+ }
532
+ setNativeInputValue();
533
+ });
534
+ watch(
535
+ () => props.type,
536
+ async () => {
537
+ await nextTick();
538
+ setNativeInputValue();
539
+ resizeTextarea();
540
+ }
541
+ );
542
+ onMounted(() => {
543
+ if (!props.formatter && props.parser) {
544
+ debugWarn(
545
+ COMPONENT_NAME,
546
+ "If you set the parser, you also need to set the formatter."
547
+ );
548
+ }
549
+ setNativeInputValue();
550
+ nextTick(resizeTextarea);
551
+ });
552
+ __expose({
553
+ input,
554
+ textarea,
555
+ ref: _ref,
556
+ textareaStyle,
557
+ autosize: toRef(props, "autosize"),
558
+ isComposing,
559
+ focus,
560
+ blur,
561
+ select,
562
+ clear,
563
+ resizeTextarea
564
+ });
565
+ return (_ctx, _cache) => {
566
+ return openBlock(), createElementBlock(
567
+ "div",
568
+ {
569
+ class: normalizeClass([
570
+ containerKls.value,
571
+ {
572
+ [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
573
+ [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
574
+ }
575
+ ]),
576
+ style: normalizeStyle(containerStyle.value),
577
+ onMouseenter: handleMouseEnter,
578
+ onMouseleave: handleMouseLeave
579
+ },
580
+ [
581
+ createCommentVNode(" input "),
582
+ _ctx.type !== "textarea" ? (openBlock(), createElementBlock(
583
+ Fragment,
584
+ { key: 0 },
585
+ [
586
+ createCommentVNode(" prepend slot "),
587
+ _ctx.$slots.prepend ? (openBlock(), createElementBlock(
588
+ "div",
589
+ {
590
+ key: 0,
591
+ class: normalizeClass(unref(nsInput).be("group", "prepend"))
592
+ },
593
+ [
594
+ renderSlot(_ctx.$slots, "prepend")
595
+ ],
596
+ 2
597
+ )) : createCommentVNode("v-if", true),
598
+ createElementVNode(
599
+ "div",
600
+ {
601
+ ref_key: "wrapperRef",
602
+ ref: wrapperRef,
603
+ class: normalizeClass(wrapperKls.value)
604
+ },
605
+ [
606
+ createCommentVNode(" prefix slot "),
607
+ _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock(
608
+ "span",
609
+ {
610
+ key: 0,
611
+ class: normalizeClass(unref(nsInput).e("prefix"))
612
+ },
613
+ [
614
+ createElementVNode(
615
+ "span",
616
+ {
617
+ class: normalizeClass(unref(nsInput).e("prefix-inner"))
618
+ },
619
+ [
620
+ renderSlot(_ctx.$slots, "prefix"),
621
+ _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
622
+ key: 0,
623
+ class: normalizeClass(unref(nsInput).e("icon"))
624
+ }, {
625
+ default: withCtx(() => [
626
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
627
+ ]),
628
+ _: 1
629
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
630
+ ],
631
+ 2
632
+ )
633
+ ],
634
+ 2
635
+ )) : createCommentVNode("v-if", true),
636
+ createElementVNode("input", mergeProps({
637
+ id: unref(inputId),
638
+ ref_key: "input",
639
+ ref: input,
640
+ class: unref(nsInput).e("inner")
641
+ }, unref(attrs), {
642
+ name: _ctx.name,
643
+ minlength: _ctx.minlength,
644
+ maxlength: _ctx.maxlength,
645
+ type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
646
+ disabled: unref(inputDisabled),
647
+ readonly: _ctx.readonly,
648
+ autocomplete: _ctx.autocomplete,
649
+ tabindex: _ctx.tabindex,
650
+ "aria-label": _ctx.ariaLabel,
651
+ placeholder: _ctx.placeholder,
652
+ style: _ctx.inputStyle,
653
+ form: _ctx.form,
654
+ autofocus: _ctx.autofocus,
655
+ role: _ctx.containerRole,
656
+ inputmode: _ctx.inputmode,
657
+ onCompositionstart: _cache[0] || (_cache[0] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
658
+ onCompositionupdate: _cache[1] || (_cache[1] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
659
+ onCompositionend: _cache[2] || (_cache[2] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
660
+ onInput: handleInput,
661
+ onChange: handleChange,
662
+ onKeydown: handleKeydown
663
+ }), null, 16, _hoisted_1),
664
+ createCommentVNode(" suffix slot "),
665
+ suffixVisible.value ? (openBlock(), createElementBlock(
666
+ "span",
667
+ {
668
+ key: 1,
669
+ class: normalizeClass(unref(nsInput).e("suffix"))
670
+ },
671
+ [
672
+ createElementVNode(
673
+ "span",
674
+ {
675
+ class: normalizeClass(unref(nsInput).e("suffix-inner"))
676
+ },
677
+ [
678
+ !showClear.value || !showPwdVisible.value || !isWordLimitVisible.value ? (openBlock(), createElementBlock(
679
+ Fragment,
680
+ { key: 0 },
681
+ [
682
+ renderSlot(_ctx.$slots, "suffix"),
683
+ _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
684
+ key: 0,
685
+ class: normalizeClass(unref(nsInput).e("icon"))
686
+ }, {
687
+ default: withCtx(() => [
688
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
689
+ ]),
690
+ _: 1
691
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
692
+ ],
693
+ 64
694
+ )) : createCommentVNode("v-if", true),
695
+ showClear.value ? (openBlock(), createBlock(unref(ElIcon), {
696
+ key: 1,
697
+ class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
698
+ onMousedown: withModifiers(unref(NOOP), ["prevent"]),
699
+ onClick: clear
700
+ }, {
701
+ default: withCtx(() => [
702
+ (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
703
+ ]),
704
+ _: 1
705
+ }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
706
+ showPwdVisible.value ? (openBlock(), createBlock(unref(ElIcon), {
707
+ key: 2,
708
+ class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
709
+ onClick: handlePasswordVisible,
710
+ onMousedown: withModifiers(unref(NOOP), ["prevent"]),
711
+ onMouseup: withModifiers(unref(NOOP), ["prevent"])
712
+ }, {
713
+ default: withCtx(() => [
714
+ (openBlock(), createBlock(resolveDynamicComponent(passwordIcon.value)))
715
+ ]),
716
+ _: 1
717
+ }, 8, ["class", "onMousedown", "onMouseup"])) : createCommentVNode("v-if", true),
718
+ isWordLimitVisible.value ? (openBlock(), createElementBlock(
719
+ "span",
720
+ {
721
+ key: 3,
722
+ class: normalizeClass([
723
+ unref(nsInput).e("count"),
724
+ unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
725
+ ])
726
+ },
727
+ [
728
+ createElementVNode(
729
+ "span",
730
+ {
731
+ class: normalizeClass(unref(nsInput).e("count-inner"))
732
+ },
733
+ toDisplayString(textLength.value) + " / " + toDisplayString(_ctx.maxlength),
734
+ 3
735
+ )
736
+ ],
737
+ 2
738
+ )) : createCommentVNode("v-if", true),
739
+ validateState.value && validateIcon.value && needStatusIcon.value ? (openBlock(), createBlock(unref(ElIcon), {
740
+ key: 4,
741
+ class: normalizeClass([
742
+ unref(nsInput).e("icon"),
743
+ unref(nsInput).e("validateIcon"),
744
+ unref(nsInput).is("loading", validateState.value === "validating")
745
+ ])
746
+ }, {
747
+ default: withCtx(() => [
748
+ (openBlock(), createBlock(resolveDynamicComponent(validateIcon.value)))
749
+ ]),
750
+ _: 1
751
+ }, 8, ["class"])) : createCommentVNode("v-if", true)
752
+ ],
753
+ 2
754
+ )
755
+ ],
756
+ 2
757
+ )) : createCommentVNode("v-if", true)
758
+ ],
759
+ 2
760
+ ),
761
+ createCommentVNode(" append slot "),
762
+ _ctx.$slots.append ? (openBlock(), createElementBlock(
763
+ "div",
764
+ {
765
+ key: 1,
766
+ class: normalizeClass(unref(nsInput).be("group", "append"))
767
+ },
768
+ [
769
+ renderSlot(_ctx.$slots, "append")
770
+ ],
771
+ 2
772
+ )) : createCommentVNode("v-if", true)
773
+ ],
774
+ 64
775
+ )) : (openBlock(), createElementBlock(
776
+ Fragment,
777
+ { key: 1 },
778
+ [
779
+ createCommentVNode(" textarea "),
780
+ createElementVNode("textarea", mergeProps({
781
+ id: unref(inputId),
782
+ ref_key: "textarea",
783
+ ref: textarea,
784
+ class: [unref(nsTextarea).e("inner"), unref(nsInput).is("focus", unref(isFocused))]
785
+ }, unref(attrs), {
786
+ name: _ctx.name,
787
+ minlength: _ctx.minlength,
788
+ maxlength: _ctx.maxlength,
789
+ tabindex: _ctx.tabindex,
790
+ disabled: unref(inputDisabled),
791
+ readonly: _ctx.readonly,
792
+ autocomplete: _ctx.autocomplete,
793
+ style: textareaStyle.value,
794
+ "aria-label": _ctx.ariaLabel,
795
+ placeholder: _ctx.placeholder,
796
+ form: _ctx.form,
797
+ autofocus: _ctx.autofocus,
798
+ rows: _ctx.rows,
799
+ role: _ctx.containerRole,
800
+ onCompositionstart: _cache[3] || (_cache[3] = (...args) => unref(handleCompositionStart) && unref(handleCompositionStart)(...args)),
801
+ onCompositionupdate: _cache[4] || (_cache[4] = (...args) => unref(handleCompositionUpdate) && unref(handleCompositionUpdate)(...args)),
802
+ onCompositionend: _cache[5] || (_cache[5] = (...args) => unref(handleCompositionEnd) && unref(handleCompositionEnd)(...args)),
803
+ onInput: handleInput,
804
+ onFocus: _cache[6] || (_cache[6] = (...args) => unref(handleFocus) && unref(handleFocus)(...args)),
805
+ onBlur: _cache[7] || (_cache[7] = (...args) => unref(handleBlur) && unref(handleBlur)(...args)),
806
+ onChange: handleChange,
807
+ onKeydown: handleKeydown
808
+ }), null, 16, _hoisted_2),
809
+ isWordLimitVisible.value ? (openBlock(), createElementBlock(
810
+ "span",
811
+ {
812
+ key: 0,
813
+ style: normalizeStyle(countStyle.value),
814
+ class: normalizeClass([
815
+ unref(nsInput).e("count"),
816
+ unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
817
+ ])
818
+ },
819
+ toDisplayString(textLength.value) + " / " + toDisplayString(_ctx.maxlength),
820
+ 7
821
+ )) : createCommentVNode("v-if", true)
822
+ ],
823
+ 64
824
+ ))
825
+ ],
826
+ 38
827
+ );
828
+ };
829
+ }
830
+ });
831
+ var Input = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "/home/runner/work/element-plus/element-plus/packages/components/input/src/input.vue"]]);
832
+
833
+ const ElInput = withInstall(Input);
834
+
835
+ export { ElInput as E };