@v-c/textarea 0.0.1

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 antdv-community
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,137 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
3
+ const require_calculateNodeHeight = require("./calculateNodeHeight.cjs");
4
+ let vue = require("vue");
5
+ let __v_c_resize_observer = require("@v-c/resize-observer");
6
+ __v_c_resize_observer = require_rolldown_runtime.__toESM(__v_c_resize_observer);
7
+ let __v_c_util = require("@v-c/util");
8
+ let __v_c_util_dist_raf = require("@v-c/util/dist/raf");
9
+ __v_c_util_dist_raf = require_rolldown_runtime.__toESM(__v_c_util_dist_raf);
10
+ var RESIZE_START = 0;
11
+ var RESIZE_MEASURING = 1;
12
+ var RESIZE_STABLE = 2;
13
+ var ResizableTextArea_default = /* @__PURE__ */ (0, vue.defineComponent)({
14
+ name: "ResizableTextArea",
15
+ props: {
16
+ prefixCls: String,
17
+ defaultValue: [String, Number],
18
+ value: [String, Number],
19
+ autoSize: [Boolean, Object],
20
+ onResize: Function,
21
+ disabled: Boolean,
22
+ onChange: Function,
23
+ onInternalAutoSize: Function,
24
+ onKeydown: Function,
25
+ onFocus: Function,
26
+ onBlur: Function,
27
+ onCompositionstart: Function,
28
+ onCompositionend: Function,
29
+ readOnly: Boolean,
30
+ maxLength: Number
31
+ },
32
+ emits: [
33
+ "change",
34
+ "internalAutoSize",
35
+ "resize"
36
+ ],
37
+ setup(props, { expose, attrs, emit }) {
38
+ const mergedValue = (0, vue.shallowRef)(props.value || props.defaultValue);
39
+ (0, vue.watch)(() => props.value, (val) => {
40
+ mergedValue.value = val;
41
+ });
42
+ const onInternalChange = (event) => {
43
+ mergedValue.value = event.target.value;
44
+ emit("change", event);
45
+ };
46
+ const textareaRef = (0, vue.ref)();
47
+ expose({
48
+ textArea: () => textareaRef.value,
49
+ setValue: (val) => {
50
+ mergedValue.value = val;
51
+ }
52
+ });
53
+ const minRows = (0, vue.ref)();
54
+ const maxRows = (0, vue.ref)();
55
+ (0, vue.watch)(() => props.autoSize, () => {
56
+ const { autoSize } = props;
57
+ if (autoSize && typeof autoSize === "object") {
58
+ minRows.value = autoSize.minRows;
59
+ maxRows.value = autoSize.maxRows;
60
+ } else {
61
+ minRows.value = void 0;
62
+ maxRows.value = void 0;
63
+ }
64
+ }, { immediate: true });
65
+ const needAutoSize = (0, vue.computed)(() => !!props.autoSize);
66
+ const fixFirefoxAutoScroll = () => {
67
+ try {
68
+ if (document.activeElement === textareaRef.value) {
69
+ const { selectionStart, selectionEnd, scrollTop } = textareaRef.value;
70
+ textareaRef.value.setSelectionRange(selectionStart, selectionEnd);
71
+ textareaRef.value.scrollTop = scrollTop;
72
+ }
73
+ } catch (e) {}
74
+ };
75
+ const resizeState = (0, vue.ref)(RESIZE_STABLE);
76
+ const autoSizeStyle = (0, vue.ref)();
77
+ const startResize = () => {
78
+ resizeState.value = RESIZE_START;
79
+ if (process.env.NODE_ENV === "test") emit("internalAutoSize");
80
+ };
81
+ (0, vue.watch)([
82
+ () => props.value,
83
+ minRows,
84
+ maxRows,
85
+ needAutoSize
86
+ ], () => {
87
+ if (needAutoSize.value) startResize();
88
+ });
89
+ (0, vue.watch)(resizeState, () => {
90
+ if (resizeState.value === RESIZE_START) resizeState.value = RESIZE_MEASURING;
91
+ else if (resizeState.value === RESIZE_MEASURING) {
92
+ const textareaStyles = require_calculateNodeHeight.default(textareaRef.value, false, minRows.value, maxRows.value);
93
+ resizeState.value = RESIZE_STABLE;
94
+ autoSizeStyle.value = textareaStyles;
95
+ } else fixFirefoxAutoScroll();
96
+ });
97
+ const resizeRafRef = (0, vue.ref)();
98
+ const cleanRaf = () => {
99
+ __v_c_util_dist_raf.default.cancel(resizeRafRef.value);
100
+ };
101
+ const onInternalResize = (size) => {
102
+ if (resizeState.value === RESIZE_STABLE) {
103
+ emit("resize", size);
104
+ if (props.autoSize) {
105
+ cleanRaf();
106
+ resizeRafRef.value = (0, __v_c_util_dist_raf.default)(() => {
107
+ startResize();
108
+ });
109
+ }
110
+ }
111
+ };
112
+ (0, vue.onBeforeUnmount)(() => cleanRaf());
113
+ return () => {
114
+ const { prefixCls, autoSize, onResize, disabled,...resetProps } = props;
115
+ const mergedAutoSizeStyle = needAutoSize.value ? autoSizeStyle.value : null;
116
+ const mergedStyle = {
117
+ ...attrs.style,
118
+ ...mergedAutoSizeStyle,
119
+ overflowY: resizeState.value === RESIZE_START || resizeState.value === RESIZE_MEASURING ? "hidden" : void 0,
120
+ overflowX: resizeState.value === RESIZE_START || resizeState.value === RESIZE_MEASURING ? "hidden" : void 0
121
+ };
122
+ return (0, vue.createVNode)(__v_c_resize_observer.default, {
123
+ "onResize": onInternalResize,
124
+ "disabled": !(autoSize || onResize)
125
+ }, { default: () => [(0, vue.createVNode)("textarea", (0, vue.mergeProps)(attrs, resetProps, {
126
+ "ref": textareaRef,
127
+ "style": mergedStyle,
128
+ "class": (0, __v_c_util.classNames)(prefixCls, [attrs.className], { [`${prefixCls}-disabled`]: disabled }),
129
+ "disabled": disabled,
130
+ "value": mergedValue.value,
131
+ "onChange": onInternalChange,
132
+ "onInput": onInternalChange
133
+ }), null)] });
134
+ };
135
+ }
136
+ });
137
+ exports.default = ResizableTextArea_default;
@@ -0,0 +1,41 @@
1
+ declare const _default: import('vue').DefineComponent<import('vue').ExtractPropTypes<{
2
+ prefixCls: StringConstructor;
3
+ defaultValue: (StringConstructor | NumberConstructor)[];
4
+ value: (StringConstructor | NumberConstructor)[];
5
+ autoSize: (BooleanConstructor | ObjectConstructor)[];
6
+ onResize: FunctionConstructor;
7
+ disabled: BooleanConstructor;
8
+ onChange: FunctionConstructor;
9
+ onInternalAutoSize: FunctionConstructor;
10
+ onKeydown: FunctionConstructor;
11
+ onFocus: FunctionConstructor;
12
+ onBlur: FunctionConstructor;
13
+ onCompositionstart: FunctionConstructor;
14
+ onCompositionend: FunctionConstructor;
15
+ readOnly: BooleanConstructor;
16
+ maxLength: NumberConstructor;
17
+ }>, () => import("vue/jsx-runtime").JSX.Element, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, ("resize" | "change" | "internalAutoSize")[], "resize" | "change" | "internalAutoSize", import('vue').PublicProps, Readonly<import('vue').ExtractPropTypes<{
18
+ prefixCls: StringConstructor;
19
+ defaultValue: (StringConstructor | NumberConstructor)[];
20
+ value: (StringConstructor | NumberConstructor)[];
21
+ autoSize: (BooleanConstructor | ObjectConstructor)[];
22
+ onResize: FunctionConstructor;
23
+ disabled: BooleanConstructor;
24
+ onChange: FunctionConstructor;
25
+ onInternalAutoSize: FunctionConstructor;
26
+ onKeydown: FunctionConstructor;
27
+ onFocus: FunctionConstructor;
28
+ onBlur: FunctionConstructor;
29
+ onCompositionstart: FunctionConstructor;
30
+ onCompositionend: FunctionConstructor;
31
+ readOnly: BooleanConstructor;
32
+ maxLength: NumberConstructor;
33
+ }>> & Readonly<{
34
+ onResize?: ((...args: any[]) => any) | undefined;
35
+ onChange?: ((...args: any[]) => any) | undefined;
36
+ onInternalAutoSize?: ((...args: any[]) => any) | undefined;
37
+ }>, {
38
+ disabled: boolean;
39
+ readOnly: boolean;
40
+ }, {}, {}, {}, string, import('vue').ComponentProvideOptions, true, {}, any>;
41
+ export default _default;
@@ -0,0 +1,133 @@
1
+ import calculateAutoSizeStyle from "./calculateNodeHeight.js";
2
+ import { computed, createVNode, defineComponent, mergeProps, onBeforeUnmount, ref, shallowRef, watch } from "vue";
3
+ import ResizeObserver from "@v-c/resize-observer";
4
+ import { classNames } from "@v-c/util";
5
+ import raf from "@v-c/util/dist/raf";
6
+ var RESIZE_START = 0;
7
+ var RESIZE_MEASURING = 1;
8
+ var RESIZE_STABLE = 2;
9
+ var ResizableTextArea_default = /* @__PURE__ */ defineComponent({
10
+ name: "ResizableTextArea",
11
+ props: {
12
+ prefixCls: String,
13
+ defaultValue: [String, Number],
14
+ value: [String, Number],
15
+ autoSize: [Boolean, Object],
16
+ onResize: Function,
17
+ disabled: Boolean,
18
+ onChange: Function,
19
+ onInternalAutoSize: Function,
20
+ onKeydown: Function,
21
+ onFocus: Function,
22
+ onBlur: Function,
23
+ onCompositionstart: Function,
24
+ onCompositionend: Function,
25
+ readOnly: Boolean,
26
+ maxLength: Number
27
+ },
28
+ emits: [
29
+ "change",
30
+ "internalAutoSize",
31
+ "resize"
32
+ ],
33
+ setup(props, { expose, attrs, emit }) {
34
+ const mergedValue = shallowRef(props.value || props.defaultValue);
35
+ watch(() => props.value, (val) => {
36
+ mergedValue.value = val;
37
+ });
38
+ const onInternalChange = (event) => {
39
+ mergedValue.value = event.target.value;
40
+ emit("change", event);
41
+ };
42
+ const textareaRef = ref();
43
+ expose({
44
+ textArea: () => textareaRef.value,
45
+ setValue: (val) => {
46
+ mergedValue.value = val;
47
+ }
48
+ });
49
+ const minRows = ref();
50
+ const maxRows = ref();
51
+ watch(() => props.autoSize, () => {
52
+ const { autoSize } = props;
53
+ if (autoSize && typeof autoSize === "object") {
54
+ minRows.value = autoSize.minRows;
55
+ maxRows.value = autoSize.maxRows;
56
+ } else {
57
+ minRows.value = void 0;
58
+ maxRows.value = void 0;
59
+ }
60
+ }, { immediate: true });
61
+ const needAutoSize = computed(() => !!props.autoSize);
62
+ const fixFirefoxAutoScroll = () => {
63
+ try {
64
+ if (document.activeElement === textareaRef.value) {
65
+ const { selectionStart, selectionEnd, scrollTop } = textareaRef.value;
66
+ textareaRef.value.setSelectionRange(selectionStart, selectionEnd);
67
+ textareaRef.value.scrollTop = scrollTop;
68
+ }
69
+ } catch (e) {}
70
+ };
71
+ const resizeState = ref(RESIZE_STABLE);
72
+ const autoSizeStyle = ref();
73
+ const startResize = () => {
74
+ resizeState.value = RESIZE_START;
75
+ if (process.env.NODE_ENV === "test") emit("internalAutoSize");
76
+ };
77
+ watch([
78
+ () => props.value,
79
+ minRows,
80
+ maxRows,
81
+ needAutoSize
82
+ ], () => {
83
+ if (needAutoSize.value) startResize();
84
+ });
85
+ watch(resizeState, () => {
86
+ if (resizeState.value === RESIZE_START) resizeState.value = RESIZE_MEASURING;
87
+ else if (resizeState.value === RESIZE_MEASURING) {
88
+ const textareaStyles = calculateAutoSizeStyle(textareaRef.value, false, minRows.value, maxRows.value);
89
+ resizeState.value = RESIZE_STABLE;
90
+ autoSizeStyle.value = textareaStyles;
91
+ } else fixFirefoxAutoScroll();
92
+ });
93
+ const resizeRafRef = ref();
94
+ const cleanRaf = () => {
95
+ raf.cancel(resizeRafRef.value);
96
+ };
97
+ const onInternalResize = (size) => {
98
+ if (resizeState.value === RESIZE_STABLE) {
99
+ emit("resize", size);
100
+ if (props.autoSize) {
101
+ cleanRaf();
102
+ resizeRafRef.value = raf(() => {
103
+ startResize();
104
+ });
105
+ }
106
+ }
107
+ };
108
+ onBeforeUnmount(() => cleanRaf());
109
+ return () => {
110
+ const { prefixCls, autoSize, onResize, disabled,...resetProps } = props;
111
+ const mergedAutoSizeStyle = needAutoSize.value ? autoSizeStyle.value : null;
112
+ const mergedStyle = {
113
+ ...attrs.style,
114
+ ...mergedAutoSizeStyle,
115
+ overflowY: resizeState.value === RESIZE_START || resizeState.value === RESIZE_MEASURING ? "hidden" : void 0,
116
+ overflowX: resizeState.value === RESIZE_START || resizeState.value === RESIZE_MEASURING ? "hidden" : void 0
117
+ };
118
+ return createVNode(ResizeObserver, {
119
+ "onResize": onInternalResize,
120
+ "disabled": !(autoSize || onResize)
121
+ }, { default: () => [createVNode("textarea", mergeProps(attrs, resetProps, {
122
+ "ref": textareaRef,
123
+ "style": mergedStyle,
124
+ "class": classNames(prefixCls, [attrs.className], { [`${prefixCls}-disabled`]: disabled }),
125
+ "disabled": disabled,
126
+ "value": mergedValue.value,
127
+ "onChange": onInternalChange,
128
+ "onInput": onInternalChange
129
+ }), null)] });
130
+ };
131
+ }
132
+ });
133
+ export { ResizableTextArea_default as default };
@@ -0,0 +1,363 @@
1
+ Object.defineProperty(exports, "__esModule", { value: true });
2
+ const require_rolldown_runtime = require("./_virtual/rolldown_runtime.cjs");
3
+ const require_ResizableTextArea = require("./ResizableTextArea.cjs");
4
+ let vue = require("vue");
5
+ let __v_c_util = require("@v-c/util");
6
+ let __v_c_input = require("@v-c/input");
7
+ let __v_c_util_dist_omit = require("@v-c/util/dist/omit");
8
+ __v_c_util_dist_omit = require_rolldown_runtime.__toESM(__v_c_util_dist_omit);
9
+ var defaults = { prefixCls: "vc-textarea" };
10
+ var TextArea_default = /* @__PURE__ */ (0, vue.defineComponent)((props, { attrs, expose, slots, emit }) => {
11
+ const stateValue = (0, vue.shallowRef)(props.value ?? props.defaultValue);
12
+ (0, vue.watch)(() => props.value, (newValue) => {
13
+ if ("value" in props || {}) stateValue.value = newValue;
14
+ });
15
+ const setValue = (val, callback) => {
16
+ if (stateValue.value === val) return;
17
+ if (props.value === void 0) stateValue.value = val;
18
+ (0, vue.nextTick)(() => {
19
+ callback?.();
20
+ });
21
+ };
22
+ const formatValue = (0, vue.computed)(() => stateValue.value === void 0 || stateValue.value === null ? "" : String(stateValue.value));
23
+ const focused = (0, vue.shallowRef)(false);
24
+ const compositionRef = (0, vue.shallowRef)(false);
25
+ const textareaResized = (0, vue.shallowRef)(false);
26
+ const holderRef = (0, vue.shallowRef)();
27
+ const resizableTextAreaRef = (0, vue.shallowRef)();
28
+ const getTextArea = () => resizableTextAreaRef.value?.textArea();
29
+ const focus = () => {
30
+ getTextArea()?.focus();
31
+ };
32
+ expose({
33
+ resizableTextArea: (0, vue.computed)(() => resizableTextAreaRef.value),
34
+ focus,
35
+ blur: () => {
36
+ getTextArea()?.blur();
37
+ },
38
+ nativeElement: (0, vue.computed)(() => holderRef.value?.nativeElement || getTextArea() || null)
39
+ });
40
+ (0, vue.watch)(() => props.disabled, (newDisabled) => {
41
+ focused.value = !newDisabled && focused.value;
42
+ });
43
+ const selection = (0, vue.shallowRef)(null);
44
+ (0, vue.watch)(selection, (newSelection) => {
45
+ if (newSelection) getTextArea()?.setSelectionRange(...newSelection);
46
+ });
47
+ const countConfig = (0, __v_c_input.useCount)((0, vue.computed)(() => props.count), (0, vue.computed)(() => props.showCount));
48
+ const mergedMax = (0, vue.computed)(() => countConfig.value.max ?? props.maxLength);
49
+ const hasMaxLength = (0, vue.computed)(() => Number(mergedMax.value) > 0);
50
+ const valueLength = (0, vue.computed)(() => countConfig.value.strategy(formatValue.value));
51
+ const isOutOfRange = (0, vue.computed)(() => !!mergedMax.value && valueLength.value > mergedMax.value);
52
+ const onChange = (e) => {
53
+ emit("change", e);
54
+ props.onChange?.(e);
55
+ };
56
+ const triggerChange = (e, currentValue) => {
57
+ let cutValue = currentValue;
58
+ const cfg = countConfig.value;
59
+ if (!compositionRef.value && cfg.exceedFormatter && cfg.max && cfg.strategy(currentValue) > cfg.max) {
60
+ cutValue = cfg.exceedFormatter(currentValue, { max: cfg.max });
61
+ if (currentValue !== cutValue) selection.value = [getTextArea()?.selectionStart || 0, getTextArea()?.selectionEnd || 0];
62
+ }
63
+ setValue(cutValue);
64
+ emit("update:value", cutValue);
65
+ (0, vue.nextTick)(() => {
66
+ resizableTextAreaRef.value?.setValue?.(cutValue);
67
+ });
68
+ (0, __v_c_input.resolveOnChange)(e.currentTarget, e, onChange, cutValue);
69
+ };
70
+ const onInternalCompositionStart = (e) => {
71
+ compositionRef.value = true;
72
+ emit("compositionStart", e);
73
+ props.onCompositionStart?.(e);
74
+ };
75
+ const onInternalCompositionEnd = (e) => {
76
+ compositionRef.value = false;
77
+ triggerChange(e, e.target.value);
78
+ emit("compositionEnd", e);
79
+ props.onCompositionEnd?.(e);
80
+ };
81
+ const onInternalChange = (e) => {
82
+ triggerChange(e, e.target.value);
83
+ };
84
+ const handleKeyDown = (e) => {
85
+ if (e.key === "Enter" && props.onPressEnter && !e.isComposing) {
86
+ emit("pressEnter", e);
87
+ props.onPressEnter?.(e);
88
+ }
89
+ emit("keydown", e);
90
+ props.onKeyDown?.(e);
91
+ };
92
+ const handleFocus = (e) => {
93
+ focused.value = true;
94
+ emit("focus", e);
95
+ props.onFocus?.(e);
96
+ };
97
+ const handleBlur = (e) => {
98
+ focused.value = false;
99
+ emit("blur", e);
100
+ props.onBlur?.(e);
101
+ };
102
+ const handleReset = (e) => {
103
+ (0, __v_c_input.resolveOnChange)(getTextArea(), e, onChange);
104
+ setValue("", () => focus());
105
+ emit("update:value", "");
106
+ };
107
+ const handleResize = (size) => {
108
+ emit("resize", size);
109
+ props.onResize?.(size);
110
+ if (getTextArea()?.style.height) textareaResized.value = true;
111
+ };
112
+ const mergedAllowClear = (0, vue.computed)(() => {
113
+ if (!props.allowClear) return props.allowClear;
114
+ const clearIcon = slots.clearIcon?.();
115
+ if (clearIcon) return {
116
+ ...typeof props.allowClear === "object" ? props.allowClear : {},
117
+ clearIcon
118
+ };
119
+ return props.allowClear;
120
+ });
121
+ return () => {
122
+ const { allowClear, maxLength, prefixCls = defaults.prefixCls, showCount, disabled, hidden, classNames, styles, onClear, readOnly, autoSize, suffix } = props;
123
+ const { class: attrClass, style: attrStyle,...restAttrs } = attrs;
124
+ const mergedClassName = props.className || attrClass;
125
+ const mergedStyle = {
126
+ ...props.style,
127
+ ...attrStyle
128
+ };
129
+ let suffixNode = slots.suffix?.() ?? suffix;
130
+ let dataCount;
131
+ if (countConfig.value.show) {
132
+ if (countConfig.value.showFormatter) dataCount = countConfig.value.showFormatter({
133
+ value: formatValue.value,
134
+ count: valueLength.value,
135
+ maxLength: mergedMax.value
136
+ });
137
+ else dataCount = `${valueLength.value}${hasMaxLength.value ? ` / ${mergedMax.value}` : ""}`;
138
+ suffixNode = (0, vue.createVNode)(vue.Fragment, null, [suffixNode, (0, vue.createVNode)("span", {
139
+ "class": (0, __v_c_util.classNames)(`${prefixCls}-data-count`, classNames?.count),
140
+ "style": styles?.count
141
+ }, [dataCount])]);
142
+ }
143
+ const isPureTextArea = !autoSize && !showCount && !allowClear;
144
+ const baseInputClassNames = {
145
+ ...classNames,
146
+ affixWrapper: (0, __v_c_util.classNames)(classNames?.affixWrapper, {
147
+ [`${prefixCls}-show-count`]: showCount,
148
+ [`${prefixCls}-textarea-allow-clear`]: allowClear
149
+ })
150
+ };
151
+ const inputAttrs = (0, __v_c_util_dist_omit.default)(restAttrs, [
152
+ "class",
153
+ "style",
154
+ "onFocus",
155
+ "onBlur",
156
+ "onChange",
157
+ "onCompositionstart",
158
+ "onCompositionend",
159
+ "onKeydown",
160
+ "onKeyup",
161
+ "onInput"
162
+ ]);
163
+ return (0, vue.createVNode)(__v_c_input.BaseInput, {
164
+ "ref": holderRef,
165
+ "value": formatValue.value,
166
+ "allowClear": mergedAllowClear.value,
167
+ "handleReset": handleReset,
168
+ "suffix": suffixNode,
169
+ "prefixCls": prefixCls,
170
+ "classNames": baseInputClassNames,
171
+ "disabled": disabled,
172
+ "focused": focused.value,
173
+ "class": (0, __v_c_util.classNames)([mergedClassName], isOutOfRange.value && `${prefixCls}-out-of-range`),
174
+ "style": {
175
+ ...mergedStyle,
176
+ ...textareaResized.value && !isPureTextArea ? { height: "auto" } : {}
177
+ },
178
+ "dataAttrs": { affixWrapper: { "data-count": typeof dataCount === "string" ? dataCount : void 0 } },
179
+ "hidden": hidden,
180
+ "readOnly": readOnly,
181
+ "onClear": onClear
182
+ }, { default: () => [(0, vue.createVNode)(require_ResizableTextArea.default, (0, vue.mergeProps)(inputAttrs, {
183
+ "value": stateValue.value,
184
+ "autoSize": autoSize,
185
+ "maxLength": maxLength,
186
+ "onKeydown": handleKeyDown,
187
+ "onChange": onInternalChange,
188
+ "onFocus": handleFocus,
189
+ "onBlur": handleBlur,
190
+ "onCompositionstart": onInternalCompositionStart,
191
+ "onCompositionend": onInternalCompositionEnd,
192
+ "class": (0, __v_c_util.classNames)(classNames?.textarea),
193
+ "style": {
194
+ ...styles?.textarea,
195
+ resize: attrStyle?.resize
196
+ },
197
+ "disabled": disabled,
198
+ "prefixCls": prefixCls,
199
+ "onResize": handleResize,
200
+ "ref": resizableTextAreaRef,
201
+ "readOnly": readOnly
202
+ }), null)] });
203
+ };
204
+ }, {
205
+ props: /* @__PURE__ */ (0, vue.mergeDefaults)({
206
+ value: {
207
+ type: [String, Number],
208
+ required: false,
209
+ default: void 0
210
+ },
211
+ defaultValue: {
212
+ type: [String, Number],
213
+ required: false,
214
+ default: void 0
215
+ },
216
+ prefixCls: {
217
+ type: String,
218
+ required: false,
219
+ default: void 0
220
+ },
221
+ autoSize: {
222
+ type: [Boolean, Object],
223
+ required: false,
224
+ default: void 0
225
+ },
226
+ onPressEnter: {
227
+ type: Function,
228
+ required: false,
229
+ default: void 0
230
+ },
231
+ onResize: {
232
+ type: Function,
233
+ required: false,
234
+ default: void 0
235
+ },
236
+ onClear: {
237
+ type: Function,
238
+ required: false,
239
+ default: void 0
240
+ },
241
+ readOnly: {
242
+ type: Boolean,
243
+ required: false,
244
+ default: void 0
245
+ },
246
+ classNames: {
247
+ type: Object,
248
+ required: false,
249
+ default: void 0
250
+ },
251
+ styles: {
252
+ type: Object,
253
+ required: false,
254
+ default: void 0
255
+ },
256
+ allowClear: {
257
+ type: [Boolean, Object],
258
+ required: false,
259
+ default: void 0
260
+ },
261
+ showCount: {
262
+ type: [Boolean, Object],
263
+ required: false,
264
+ default: void 0
265
+ },
266
+ count: {
267
+ type: Object,
268
+ required: false,
269
+ default: void 0
270
+ },
271
+ maxLength: {
272
+ type: Number,
273
+ required: false,
274
+ default: void 0
275
+ },
276
+ suffix: {
277
+ type: [
278
+ String,
279
+ Number,
280
+ null,
281
+ Boolean,
282
+ Array
283
+ ],
284
+ required: false,
285
+ skipCheck: true,
286
+ default: void 0
287
+ },
288
+ disabled: {
289
+ type: Boolean,
290
+ required: false,
291
+ default: void 0
292
+ },
293
+ hidden: {
294
+ type: Boolean,
295
+ required: false,
296
+ default: void 0
297
+ },
298
+ onChange: {
299
+ type: Function,
300
+ required: false,
301
+ default: void 0
302
+ },
303
+ onFocus: {
304
+ type: Function,
305
+ required: false,
306
+ default: void 0
307
+ },
308
+ onBlur: {
309
+ type: Function,
310
+ required: false,
311
+ default: void 0
312
+ },
313
+ onCompositionStart: {
314
+ type: Function,
315
+ required: false,
316
+ default: void 0
317
+ },
318
+ onCompositionEnd: {
319
+ type: Function,
320
+ required: false,
321
+ default: void 0
322
+ },
323
+ onKeyDown: {
324
+ type: Function,
325
+ required: false,
326
+ default: void 0
327
+ },
328
+ className: {
329
+ type: String,
330
+ required: false,
331
+ default: void 0
332
+ },
333
+ class: {
334
+ type: null,
335
+ required: false,
336
+ default: void 0
337
+ },
338
+ style: {
339
+ type: null,
340
+ required: false,
341
+ default: void 0
342
+ },
343
+ placeholder: {
344
+ type: String,
345
+ required: false,
346
+ default: void 0
347
+ }
348
+ }, defaults),
349
+ name: "TextArea",
350
+ inheritAttrs: false,
351
+ emits: [
352
+ "update:value",
353
+ "change",
354
+ "compositionStart",
355
+ "compositionEnd",
356
+ "pressEnter",
357
+ "keydown",
358
+ "focus",
359
+ "blur",
360
+ "resize"
361
+ ]
362
+ });
363
+ exports.default = TextArea_default;
@@ -0,0 +1,3 @@
1
+ import { TextAreaProps } from './interface';
2
+ declare const _default: import('vue').DefineSetupFnComponent<TextAreaProps, {}, {}, TextAreaProps & {}, import('vue').PublicProps>;
3
+ export default _default;