@wfrog/vc-ui 1.11.10 → 1.11.11

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