@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
@@ -1,728 +0,0 @@
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 './cPBw23yt.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 './DRoyW749.mjs';
7
- import { u as useSizeProp } from './BsGCX4td.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 './BpqBBo4z.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 './DTLPXrjb.mjs';
13
- import { u as useAttrs$1 } from './BUEEWLrd.mjs';
14
- import { c as useFormSize, b as useFormDisabled, u as useFormItem, a as useFormItemInputId } from './DXPWe_a5.mjs';
15
- import { u as useFocusController, a as useComposition } from './XwSiBVsA.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(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value));
68
- Object.entries(HIDDEN_STYLE).forEach(([key, value]) => hiddenTextarea == null ? void 0 : hiddenTextarea.style.setProperty(key, value, "important"));
69
- hiddenTextarea.value = targetElement.value || targetElement.placeholder || "";
70
- let height = hiddenTextarea.scrollHeight;
71
- const result = {};
72
- if (boxSizing === "border-box") {
73
- height = height + borderSize;
74
- } else if (boxSizing === "content-box") {
75
- height = height - paddingSize;
76
- }
77
- hiddenTextarea.value = "";
78
- const singleRowHeight = hiddenTextarea.scrollHeight - paddingSize;
79
- if (isNumber(minRows)) {
80
- let minHeight = singleRowHeight * minRows;
81
- if (boxSizing === "border-box") {
82
- minHeight = minHeight + paddingSize + borderSize;
83
- }
84
- height = Math.max(minHeight, height);
85
- result.minHeight = `${minHeight}px`;
86
- }
87
- if (isNumber(maxRows)) {
88
- let maxHeight = singleRowHeight * maxRows;
89
- if (boxSizing === "border-box") {
90
- maxHeight = maxHeight + paddingSize + borderSize;
91
- }
92
- height = Math.min(maxHeight, height);
93
- }
94
- result.height = `${height}px`;
95
- (_b = hiddenTextarea.parentNode) == null ? void 0 : _b.removeChild(hiddenTextarea);
96
- hiddenTextarea = void 0;
97
- return result;
98
- }
99
-
100
- const inputProps = buildProps({
101
- id: {
102
- type: String,
103
- default: void 0
104
- },
105
- size: useSizeProp,
106
- disabled: {
107
- type: Boolean,
108
- default: void 0
109
- },
110
- modelValue: {
111
- type: definePropType([
112
- String,
113
- Number,
114
- Object
115
- ]),
116
- default: ""
117
- },
118
- modelModifiers: {
119
- type: definePropType(Object),
120
- default: () => ({})
121
- },
122
- maxlength: {
123
- type: [String, Number]
124
- },
125
- minlength: {
126
- type: [String, Number]
127
- },
128
- type: {
129
- type: definePropType(String),
130
- default: "text"
131
- },
132
- resize: {
133
- type: String,
134
- values: ["none", "both", "horizontal", "vertical"]
135
- },
136
- autosize: {
137
- type: definePropType([Boolean, Object]),
138
- default: false
139
- },
140
- autocomplete: {
141
- type: definePropType(String),
142
- default: "off"
143
- },
144
- formatter: {
145
- type: Function
146
- },
147
- parser: {
148
- type: Function
149
- },
150
- placeholder: {
151
- type: String
152
- },
153
- form: {
154
- type: String
155
- },
156
- readonly: Boolean,
157
- clearable: Boolean,
158
- clearIcon: {
159
- type: iconPropType,
160
- default: CircleClose
161
- },
162
- showPassword: Boolean,
163
- showWordLimit: Boolean,
164
- wordLimitPosition: {
165
- type: String,
166
- values: ["inside", "outside"],
167
- default: "inside"
168
- },
169
- suffixIcon: {
170
- type: iconPropType
171
- },
172
- prefixIcon: {
173
- type: iconPropType
174
- },
175
- containerRole: {
176
- type: String,
177
- default: void 0
178
- },
179
- tabindex: {
180
- type: [String, Number],
181
- default: 0
182
- },
183
- validateEvent: {
184
- type: Boolean,
185
- default: true
186
- },
187
- inputStyle: {
188
- type: definePropType([Object, Array, String]),
189
- default: () => mutable({})
190
- },
191
- autofocus: Boolean,
192
- rows: {
193
- type: Number,
194
- default: 2
195
- },
196
- ...useAriaProps(["ariaLabel"]),
197
- inputmode: {
198
- type: definePropType(String),
199
- default: void 0
200
- },
201
- name: String
202
- });
203
- const inputEmits = {
204
- [UPDATE_MODEL_EVENT]: (value) => isString(value),
205
- input: (value) => isString(value),
206
- change: (value, evt) => isString(value) && (evt instanceof Event || evt === void 0),
207
- focus: (evt) => evt instanceof FocusEvent,
208
- blur: (evt) => evt instanceof FocusEvent,
209
- clear: () => true,
210
- mouseleave: (evt) => evt instanceof MouseEvent,
211
- mouseenter: (evt) => evt instanceof MouseEvent,
212
- keydown: (evt) => evt instanceof Event,
213
- compositionstart: (evt) => evt instanceof CompositionEvent,
214
- compositionupdate: (evt) => evt instanceof CompositionEvent,
215
- compositionend: (evt) => evt instanceof CompositionEvent
216
- };
217
-
218
- function useCursor(input) {
219
- let selectionInfo;
220
- function recordCursor() {
221
- if (input.value == void 0)
222
- return;
223
- const { selectionStart, selectionEnd, value } = input.value;
224
- if (selectionStart == null || selectionEnd == null)
225
- return;
226
- const beforeTxt = value.slice(0, Math.max(0, selectionStart));
227
- const afterTxt = value.slice(Math.max(0, selectionEnd));
228
- selectionInfo = {
229
- selectionStart,
230
- selectionEnd,
231
- value,
232
- beforeTxt,
233
- afterTxt
234
- };
235
- }
236
- function setCursor() {
237
- if (input.value == void 0 || selectionInfo == void 0)
238
- return;
239
- const { value } = input.value;
240
- const { beforeTxt, afterTxt, selectionStart } = selectionInfo;
241
- if (beforeTxt == void 0 || afterTxt == void 0 || selectionStart == void 0)
242
- return;
243
- let startPos = value.length;
244
- if (value.endsWith(afterTxt)) {
245
- startPos = value.length - afterTxt.length;
246
- } else if (value.startsWith(beforeTxt)) {
247
- startPos = beforeTxt.length;
248
- } else {
249
- const beforeLastChar = beforeTxt[selectionStart - 1];
250
- const newIndex = value.indexOf(beforeLastChar, selectionStart - 1);
251
- if (newIndex !== -1) {
252
- startPos = newIndex + 1;
253
- }
254
- }
255
- input.value.setSelectionRange(startPos, startPos);
256
- }
257
- return [recordCursor, setCursor];
258
- }
259
-
260
- const COMPONENT_NAME = "ElInput";
261
- const __default__ = defineComponent({
262
- name: COMPONENT_NAME,
263
- inheritAttrs: false
264
- });
265
- const _sfc_main = /* @__PURE__ */ defineComponent({
266
- ...__default__,
267
- props: inputProps,
268
- emits: inputEmits,
269
- setup(__props, { expose, emit }) {
270
- const props = __props;
271
- const rawAttrs = useAttrs();
272
- const attrs = useAttrs$1();
273
- const slots = useSlots();
274
- const containerKls = computed(() => [
275
- props.type === "textarea" ? nsTextarea.b() : nsInput.b(),
276
- nsInput.m(inputSize.value),
277
- nsInput.is("disabled", inputDisabled.value),
278
- nsInput.is("exceed", inputExceed.value),
279
- {
280
- [nsInput.b("group")]: slots.prepend || slots.append,
281
- [nsInput.m("prefix")]: slots.prefix || props.prefixIcon,
282
- [nsInput.m("suffix")]: slots.suffix || props.suffixIcon || props.clearable || props.showPassword,
283
- [nsInput.bm("suffix", "password-clear")]: showClear.value && showPwdVisible.value,
284
- [nsInput.b("hidden")]: props.type === "hidden"
285
- },
286
- rawAttrs.class
287
- ]);
288
- const wrapperKls = computed(() => [
289
- nsInput.e("wrapper"),
290
- nsInput.is("focus", isFocused.value)
291
- ]);
292
- const { form: elForm, formItem: elFormItem } = useFormItem();
293
- const { inputId } = useFormItemInputId(props, {
294
- formItemContext: elFormItem
295
- });
296
- const inputSize = useFormSize();
297
- const inputDisabled = useFormDisabled();
298
- const nsInput = useNamespace("input");
299
- const nsTextarea = useNamespace("textarea");
300
- const input = shallowRef();
301
- const textarea = shallowRef();
302
- const hovering = ref(false);
303
- const passwordVisible = ref(false);
304
- const countStyle = ref();
305
- const textareaCalcStyle = shallowRef(props.inputStyle);
306
- const _ref = computed(() => input.value || textarea.value);
307
- const { wrapperRef, isFocused, handleFocus, handleBlur } = useFocusController(_ref, {
308
- disabled: inputDisabled,
309
- afterBlur() {
310
- var _a;
311
- if (props.validateEvent) {
312
- (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "blur").catch((err) => debugWarn(err));
313
- }
314
- }
315
- });
316
- const needStatusIcon = computed(() => {
317
- var _a;
318
- return (_a = elForm == null ? void 0 : elForm.statusIcon) != null ? _a : false;
319
- });
320
- const validateState = computed(() => (elFormItem == null ? void 0 : elFormItem.validateState) || "");
321
- const validateIcon = computed(() => validateState.value && ValidateComponentsMap[validateState.value]);
322
- const passwordIcon = computed(() => passwordVisible.value ? View : Hide);
323
- const containerStyle = computed(() => [
324
- rawAttrs.style
325
- ]);
326
- const textareaStyle = computed(() => [
327
- props.inputStyle,
328
- textareaCalcStyle.value,
329
- { resize: props.resize }
330
- ]);
331
- const nativeInputValue = computed(() => isNil(props.modelValue) ? "" : String(props.modelValue));
332
- const showClear = computed(() => props.clearable && !inputDisabled.value && !props.readonly && !!nativeInputValue.value && (isFocused.value || hovering.value));
333
- const showPwdVisible = computed(() => props.showPassword && !inputDisabled.value && !!nativeInputValue.value);
334
- const isWordLimitVisible = computed(() => props.showWordLimit && !!props.maxlength && (props.type === "text" || props.type === "textarea") && !inputDisabled.value && !props.readonly && !props.showPassword);
335
- const textLength = computed(() => nativeInputValue.value.length);
336
- const inputExceed = computed(() => !!isWordLimitVisible.value && textLength.value > Number(props.maxlength));
337
- const suffixVisible = computed(() => !!slots.suffix || !!props.suffixIcon || showClear.value || props.showPassword || isWordLimitVisible.value || !!validateState.value && needStatusIcon.value);
338
- const hasModelModifiers = computed(() => !!Object.keys(props.modelModifiers).length);
339
- const [recordCursor, setCursor] = useCursor(input);
340
- useResizeObserver(textarea, (entries) => {
341
- onceInitSizeTextarea();
342
- if (!isWordLimitVisible.value || props.resize !== "both" && props.resize !== "horizontal")
343
- return;
344
- const entry = entries[0];
345
- const { width } = entry.contentRect;
346
- countStyle.value = {
347
- right: `calc(100% - ${width + 22 - 10}px)`
348
- };
349
- });
350
- const resizeTextarea = () => {
351
- const { type, autosize } = props;
352
- if (!isClient || type !== "textarea" || !textarea.value)
353
- return;
354
- if (autosize) {
355
- const minRows = isObject(autosize) ? autosize.minRows : void 0;
356
- const maxRows = isObject(autosize) ? autosize.maxRows : void 0;
357
- const textareaStyle2 = calcTextareaHeight(textarea.value, minRows, maxRows);
358
- textareaCalcStyle.value = {
359
- overflowY: "hidden",
360
- ...textareaStyle2
361
- };
362
- nextTick(() => {
363
- textarea.value.offsetHeight;
364
- textareaCalcStyle.value = textareaStyle2;
365
- });
366
- } else {
367
- textareaCalcStyle.value = {
368
- minHeight: calcTextareaHeight(textarea.value).minHeight
369
- };
370
- }
371
- };
372
- const createOnceInitResize = (resizeTextarea2) => {
373
- let isInit = false;
374
- return () => {
375
- var _a;
376
- if (isInit || !props.autosize)
377
- return;
378
- const isElHidden = ((_a = textarea.value) == null ? void 0 : _a.offsetParent) === null;
379
- if (!isElHidden) {
380
- setTimeout(resizeTextarea2);
381
- isInit = true;
382
- }
383
- };
384
- };
385
- const onceInitSizeTextarea = createOnceInitResize(resizeTextarea);
386
- const setNativeInputValue = () => {
387
- const input2 = _ref.value;
388
- const formatterValue = props.formatter ? props.formatter(nativeInputValue.value) : nativeInputValue.value;
389
- if (!input2 || input2.value === formatterValue || props.type === "file")
390
- return;
391
- input2.value = formatterValue;
392
- };
393
- const formatValue = (value) => {
394
- const { trim, number } = props.modelModifiers;
395
- if (trim) {
396
- value = value.trim();
397
- }
398
- if (number) {
399
- value = `${looseToNumber(value)}`;
400
- }
401
- if (props.formatter && props.parser) {
402
- value = props.parser(value);
403
- }
404
- return value;
405
- };
406
- const handleInput = async (event) => {
407
- if (isComposing.value)
408
- return;
409
- const { lazy } = props.modelModifiers;
410
- let { value } = event.target;
411
- if (lazy) {
412
- emit(INPUT_EVENT, value);
413
- return;
414
- }
415
- value = formatValue(value);
416
- if (String(value) === nativeInputValue.value) {
417
- if (props.formatter) {
418
- setNativeInputValue();
419
- }
420
- return;
421
- }
422
- recordCursor();
423
- emit(UPDATE_MODEL_EVENT, value);
424
- emit(INPUT_EVENT, value);
425
- await nextTick();
426
- if (props.formatter && props.parser || !hasModelModifiers.value) {
427
- setNativeInputValue();
428
- }
429
- setCursor();
430
- };
431
- const handleChange = async (event) => {
432
- let { value } = event.target;
433
- value = formatValue(value);
434
- if (props.modelModifiers.lazy) {
435
- emit(UPDATE_MODEL_EVENT, value);
436
- }
437
- emit(CHANGE_EVENT, value, event);
438
- await nextTick();
439
- setNativeInputValue();
440
- };
441
- const {
442
- isComposing,
443
- handleCompositionStart,
444
- handleCompositionUpdate,
445
- handleCompositionEnd
446
- } = useComposition({ emit, afterComposition: handleInput });
447
- const handlePasswordVisible = () => {
448
- passwordVisible.value = !passwordVisible.value;
449
- };
450
- const focus = () => {
451
- var _a;
452
- return (_a = _ref.value) == null ? void 0 : _a.focus();
453
- };
454
- const blur = () => {
455
- var _a;
456
- return (_a = _ref.value) == null ? void 0 : _a.blur();
457
- };
458
- const handleMouseLeave = (evt) => {
459
- hovering.value = false;
460
- emit("mouseleave", evt);
461
- };
462
- const handleMouseEnter = (evt) => {
463
- hovering.value = true;
464
- emit("mouseenter", evt);
465
- };
466
- const handleKeydown = (evt) => {
467
- emit("keydown", evt);
468
- };
469
- const select = () => {
470
- var _a;
471
- (_a = _ref.value) == null ? void 0 : _a.select();
472
- };
473
- const clear = () => {
474
- emit(UPDATE_MODEL_EVENT, "");
475
- emit(CHANGE_EVENT, "");
476
- emit("clear");
477
- emit(INPUT_EVENT, "");
478
- };
479
- watch(() => props.modelValue, () => {
480
- var _a;
481
- nextTick(() => resizeTextarea());
482
- if (props.validateEvent) {
483
- (_a = elFormItem == null ? void 0 : elFormItem.validate) == null ? void 0 : _a.call(elFormItem, "change").catch((err) => debugWarn(err));
484
- }
485
- });
486
- watch(nativeInputValue, (newValue) => {
487
- if (!_ref.value) {
488
- return;
489
- }
490
- const { trim, number } = props.modelModifiers;
491
- const elValue = _ref.value.value;
492
- const displayValue = (number || props.type === "number") && !/^0\d/.test(elValue) ? `${looseToNumber(elValue)}` : elValue;
493
- if (displayValue === newValue) {
494
- return;
495
- }
496
- if (document.activeElement === _ref.value && _ref.value.type !== "range") {
497
- if (trim && displayValue.trim() === newValue) {
498
- return;
499
- }
500
- }
501
- setNativeInputValue();
502
- });
503
- watch(() => props.type, async () => {
504
- await nextTick();
505
- setNativeInputValue();
506
- resizeTextarea();
507
- });
508
- onMounted(() => {
509
- if (!props.formatter && props.parser) {
510
- debugWarn(COMPONENT_NAME, "If you set the parser, you also need to set the formatter.");
511
- }
512
- setNativeInputValue();
513
- nextTick(resizeTextarea);
514
- });
515
- expose({
516
- input,
517
- textarea,
518
- ref: _ref,
519
- textareaStyle,
520
- autosize: toRef(props, "autosize"),
521
- isComposing,
522
- focus,
523
- blur,
524
- select,
525
- clear,
526
- resizeTextarea
527
- });
528
- return (_ctx, _cache) => {
529
- return openBlock(), createElementBlock("div", {
530
- class: normalizeClass([
531
- unref(containerKls),
532
- {
533
- [unref(nsInput).bm("group", "append")]: _ctx.$slots.append,
534
- [unref(nsInput).bm("group", "prepend")]: _ctx.$slots.prepend
535
- }
536
- ]),
537
- style: normalizeStyle(unref(containerStyle)),
538
- onMouseenter: handleMouseEnter,
539
- onMouseleave: handleMouseLeave
540
- }, [
541
- createCommentVNode(" input "),
542
- _ctx.type !== "textarea" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
543
- createCommentVNode(" prepend slot "),
544
- _ctx.$slots.prepend ? (openBlock(), createElementBlock("div", {
545
- key: 0,
546
- class: normalizeClass(unref(nsInput).be("group", "prepend"))
547
- }, [
548
- renderSlot(_ctx.$slots, "prepend")
549
- ], 2)) : createCommentVNode("v-if", true),
550
- createElementVNode("div", {
551
- ref_key: "wrapperRef",
552
- ref: wrapperRef,
553
- class: normalizeClass(unref(wrapperKls))
554
- }, [
555
- createCommentVNode(" prefix slot "),
556
- _ctx.$slots.prefix || _ctx.prefixIcon ? (openBlock(), createElementBlock("span", {
557
- key: 0,
558
- class: normalizeClass(unref(nsInput).e("prefix"))
559
- }, [
560
- createElementVNode("span", {
561
- class: normalizeClass(unref(nsInput).e("prefix-inner"))
562
- }, [
563
- renderSlot(_ctx.$slots, "prefix"),
564
- _ctx.prefixIcon ? (openBlock(), createBlock(unref(ElIcon), {
565
- key: 0,
566
- class: normalizeClass(unref(nsInput).e("icon"))
567
- }, {
568
- default: withCtx(() => [
569
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.prefixIcon)))
570
- ]),
571
- _: 1
572
- }, 8, ["class"])) : createCommentVNode("v-if", true)
573
- ], 2)
574
- ], 2)) : createCommentVNode("v-if", true),
575
- createElementVNode("input", mergeProps({
576
- id: unref(inputId),
577
- ref_key: "input",
578
- ref: input,
579
- class: unref(nsInput).e("inner")
580
- }, unref(attrs), {
581
- name: _ctx.name,
582
- minlength: _ctx.minlength,
583
- maxlength: _ctx.maxlength,
584
- type: _ctx.showPassword ? passwordVisible.value ? "text" : "password" : _ctx.type,
585
- disabled: unref(inputDisabled),
586
- readonly: _ctx.readonly,
587
- autocomplete: _ctx.autocomplete,
588
- tabindex: _ctx.tabindex,
589
- "aria-label": _ctx.ariaLabel,
590
- placeholder: _ctx.placeholder,
591
- style: _ctx.inputStyle,
592
- form: _ctx.form,
593
- autofocus: _ctx.autofocus,
594
- role: _ctx.containerRole,
595
- inputmode: _ctx.inputmode,
596
- onCompositionstart: unref(handleCompositionStart),
597
- onCompositionupdate: unref(handleCompositionUpdate),
598
- onCompositionend: unref(handleCompositionEnd),
599
- onInput: handleInput,
600
- onChange: handleChange,
601
- onKeydown: handleKeydown
602
- }), null, 16, ["id", "name", "minlength", "maxlength", "type", "disabled", "readonly", "autocomplete", "tabindex", "aria-label", "placeholder", "form", "autofocus", "role", "inputmode", "onCompositionstart", "onCompositionupdate", "onCompositionend"]),
603
- createCommentVNode(" suffix slot "),
604
- unref(suffixVisible) ? (openBlock(), createElementBlock("span", {
605
- key: 1,
606
- class: normalizeClass(unref(nsInput).e("suffix"))
607
- }, [
608
- createElementVNode("span", {
609
- class: normalizeClass(unref(nsInput).e("suffix-inner"))
610
- }, [
611
- !unref(showClear) || !unref(showPwdVisible) || !unref(isWordLimitVisible) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
612
- renderSlot(_ctx.$slots, "suffix"),
613
- _ctx.suffixIcon ? (openBlock(), createBlock(unref(ElIcon), {
614
- key: 0,
615
- class: normalizeClass(unref(nsInput).e("icon"))
616
- }, {
617
- default: withCtx(() => [
618
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.suffixIcon)))
619
- ]),
620
- _: 1
621
- }, 8, ["class"])) : createCommentVNode("v-if", true)
622
- ], 64)) : createCommentVNode("v-if", true),
623
- unref(showClear) ? (openBlock(), createBlock(unref(ElIcon), {
624
- key: 1,
625
- class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("clear")]),
626
- onMousedown: withModifiers(unref(NOOP), ["prevent"]),
627
- onClick: clear
628
- }, {
629
- default: withCtx(() => [
630
- (openBlock(), createBlock(resolveDynamicComponent(_ctx.clearIcon)))
631
- ]),
632
- _: 1
633
- }, 8, ["class", "onMousedown"])) : createCommentVNode("v-if", true),
634
- unref(showPwdVisible) ? (openBlock(), createBlock(unref(ElIcon), {
635
- key: 2,
636
- class: normalizeClass([unref(nsInput).e("icon"), unref(nsInput).e("password")]),
637
- onClick: handlePasswordVisible,
638
- onMousedown: withModifiers(unref(NOOP), ["prevent"]),
639
- onMouseup: withModifiers(unref(NOOP), ["prevent"])
640
- }, {
641
- default: withCtx(() => [
642
- (openBlock(), createBlock(resolveDynamicComponent(unref(passwordIcon))))
643
- ]),
644
- _: 1
645
- }, 8, ["class", "onMousedown", "onMouseup"])) : createCommentVNode("v-if", true),
646
- unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
647
- key: 3,
648
- class: normalizeClass([
649
- unref(nsInput).e("count"),
650
- unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
651
- ])
652
- }, [
653
- createElementVNode("span", {
654
- class: normalizeClass(unref(nsInput).e("count-inner"))
655
- }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 3)
656
- ], 2)) : createCommentVNode("v-if", true),
657
- unref(validateState) && unref(validateIcon) && unref(needStatusIcon) ? (openBlock(), createBlock(unref(ElIcon), {
658
- key: 4,
659
- class: normalizeClass([
660
- unref(nsInput).e("icon"),
661
- unref(nsInput).e("validateIcon"),
662
- unref(nsInput).is("loading", unref(validateState) === "validating")
663
- ])
664
- }, {
665
- default: withCtx(() => [
666
- (openBlock(), createBlock(resolveDynamicComponent(unref(validateIcon))))
667
- ]),
668
- _: 1
669
- }, 8, ["class"])) : createCommentVNode("v-if", true)
670
- ], 2)
671
- ], 2)) : createCommentVNode("v-if", true)
672
- ], 2),
673
- createCommentVNode(" append slot "),
674
- _ctx.$slots.append ? (openBlock(), createElementBlock("div", {
675
- key: 1,
676
- class: normalizeClass(unref(nsInput).be("group", "append"))
677
- }, [
678
- renderSlot(_ctx.$slots, "append")
679
- ], 2)) : createCommentVNode("v-if", true)
680
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
681
- createCommentVNode(" textarea "),
682
- createElementVNode("textarea", mergeProps({
683
- id: unref(inputId),
684
- ref_key: "textarea",
685
- ref: textarea,
686
- class: [unref(nsTextarea).e("inner"), unref(nsInput).is("focus", unref(isFocused))]
687
- }, unref(attrs), {
688
- name: _ctx.name,
689
- minlength: _ctx.minlength,
690
- maxlength: _ctx.maxlength,
691
- tabindex: _ctx.tabindex,
692
- disabled: unref(inputDisabled),
693
- readonly: _ctx.readonly,
694
- autocomplete: _ctx.autocomplete,
695
- style: unref(textareaStyle),
696
- "aria-label": _ctx.ariaLabel,
697
- placeholder: _ctx.placeholder,
698
- form: _ctx.form,
699
- autofocus: _ctx.autofocus,
700
- rows: _ctx.rows,
701
- role: _ctx.containerRole,
702
- onCompositionstart: unref(handleCompositionStart),
703
- onCompositionupdate: unref(handleCompositionUpdate),
704
- onCompositionend: unref(handleCompositionEnd),
705
- onInput: handleInput,
706
- onFocus: unref(handleFocus),
707
- onBlur: unref(handleBlur),
708
- onChange: handleChange,
709
- onKeydown: handleKeydown
710
- }), null, 16, ["id", "name", "minlength", "maxlength", "tabindex", "disabled", "readonly", "autocomplete", "aria-label", "placeholder", "form", "autofocus", "rows", "role", "onCompositionstart", "onCompositionupdate", "onCompositionend", "onFocus", "onBlur"]),
711
- unref(isWordLimitVisible) ? (openBlock(), createElementBlock("span", {
712
- key: 0,
713
- style: normalizeStyle(countStyle.value),
714
- class: normalizeClass([
715
- unref(nsInput).e("count"),
716
- unref(nsInput).is("outside", _ctx.wordLimitPosition === "outside")
717
- ])
718
- }, toDisplayString(unref(textLength)) + " / " + toDisplayString(_ctx.maxlength), 7)) : createCommentVNode("v-if", true)
719
- ], 64))
720
- ], 38);
721
- };
722
- }
723
- });
724
- var Input = /* @__PURE__ */ _export_sfc(_sfc_main, [["__file", "input.vue"]]);
725
-
726
- const ElInput = withInstall(Input);
727
-
728
- export { ElInput as E };