@webitel/ui-sdk 24.10.28 → 24.10.30
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/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.js +6087 -6018
- package/dist/ui-sdk.umd.cjs +17 -17
- package/package.json +2 -1
- package/src/components/wt-expansion-panel/wt-expansion-panel.vue +1 -0
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +3 -3
- package/src/components/wt-textarea/wt-textarea.vue +39 -8
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "24.10.
|
|
3
|
+
"version": "24.10.30",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"dev": "vite",
|
|
@@ -99,6 +99,7 @@
|
|
|
99
99
|
"@vuelidate/validators": "^2.0.4",
|
|
100
100
|
"@vuepic/vue-datepicker": "^4.4.0",
|
|
101
101
|
"@vueuse/components": "^10.7.2",
|
|
102
|
+
"autosize": "^6.0.1",
|
|
102
103
|
"axios": "^1.7.1",
|
|
103
104
|
"clipboard-copy": "^4.0.1",
|
|
104
105
|
"csv-stringify": "^5.5.3",
|
|
@@ -23,18 +23,18 @@ describe('WtTextarea', () => {
|
|
|
23
23
|
expect(wrapper.find('.wt-label').text()).toBe(label);
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
it('emits "Enter" event if
|
|
26
|
+
it('emits "Enter" event if expanded prop is passed', () => {
|
|
27
27
|
const wrapper = shallowMount(WtTextarea, {
|
|
28
28
|
stubs: {
|
|
29
29
|
WtLabel,
|
|
30
30
|
},
|
|
31
|
-
props: {
|
|
31
|
+
props: { expanded: true },
|
|
32
32
|
});
|
|
33
33
|
wrapper.find('.wt-textarea__textarea').trigger('keypress', { key: 'Enter' });
|
|
34
34
|
expect(wrapper.emitted().enter).toBeTruthy();
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
it('do not emit "Enter" event if
|
|
37
|
+
it('do not emit "Enter" event if expanded prop is not passed', () => {
|
|
38
38
|
const wrapper = shallowMount(WtTextarea, {
|
|
39
39
|
stubs: {
|
|
40
40
|
WtLabel,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
:class="{
|
|
4
4
|
'wt-textarea--disabled': disabled,
|
|
5
5
|
'wt-textarea--invalid': invalid,
|
|
6
|
+
'wt-textarea--autoresize': autoresize,
|
|
6
7
|
}"
|
|
7
8
|
class="wt-textarea"
|
|
8
9
|
>
|
|
@@ -22,11 +23,12 @@
|
|
|
22
23
|
</wt-label>
|
|
23
24
|
<div class="wt-textarea__wrapper">
|
|
24
25
|
<textarea
|
|
25
|
-
:id="name"
|
|
26
26
|
ref="wt-textarea"
|
|
27
|
+
:id="name"
|
|
27
28
|
:disabled="disabled"
|
|
28
29
|
:placeholder="placeholder || label"
|
|
29
30
|
:value="value"
|
|
31
|
+
rows="1"
|
|
30
32
|
class="wt-textarea__textarea"
|
|
31
33
|
v-on="listeners"
|
|
32
34
|
/>
|
|
@@ -41,7 +43,7 @@
|
|
|
41
43
|
class="wt-textarea__reset-icon-btn"
|
|
42
44
|
icon="close--filled"
|
|
43
45
|
size="sm"
|
|
44
|
-
@click="
|
|
46
|
+
@click="cleanInput"
|
|
45
47
|
/>
|
|
46
48
|
</div>
|
|
47
49
|
</div>
|
|
@@ -55,6 +57,7 @@
|
|
|
55
57
|
</template>
|
|
56
58
|
|
|
57
59
|
<script>
|
|
60
|
+
import autosize from 'autosize';
|
|
58
61
|
import validationMixin from '../../mixins/validationMixin/validationMixin.js';
|
|
59
62
|
|
|
60
63
|
export default {
|
|
@@ -96,14 +99,15 @@ export default {
|
|
|
96
99
|
type: String,
|
|
97
100
|
default: '',
|
|
98
101
|
},
|
|
99
|
-
chatMode: {
|
|
100
|
-
type: Boolean,
|
|
101
|
-
default: false,
|
|
102
|
-
},
|
|
103
102
|
labelProps: {
|
|
104
103
|
type: Object,
|
|
105
104
|
description: 'Object with props, passed down to wt-label as props',
|
|
106
105
|
},
|
|
106
|
+
autoresize: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
default: false,
|
|
109
|
+
description: 'enables auto-grow for text-area',
|
|
110
|
+
},
|
|
107
111
|
},
|
|
108
112
|
emits: ['input', 'enter'],
|
|
109
113
|
computed: {
|
|
@@ -121,17 +125,27 @@ export default {
|
|
|
121
125
|
},
|
|
122
126
|
mounted() {
|
|
123
127
|
this.updateInputPaddings();
|
|
128
|
+
if (this.autoresize) this.setupAutosize();
|
|
129
|
+
},
|
|
130
|
+
beforeUpdate() {
|
|
131
|
+
if(!this.value) this.$nextTick(() => autosize.update(this.$refs['wt-textarea']));
|
|
124
132
|
},
|
|
125
133
|
|
|
126
134
|
methods: {
|
|
135
|
+
cleanInput() {
|
|
136
|
+
this.$emit('input', '');
|
|
137
|
+
this.$nextTick(() => autosize.update(this.$refs['wt-textarea']));
|
|
138
|
+
},
|
|
139
|
+
|
|
127
140
|
handleKeypress(event) {
|
|
128
|
-
if (!this.
|
|
141
|
+
if (!this.autoresize) return;
|
|
142
|
+
|
|
129
143
|
if (event.key === 'Enter' && !event.shiftKey) {
|
|
130
144
|
this.$emit('enter');
|
|
131
145
|
event.preventDefault();
|
|
146
|
+
this.$nextTick(() => autosize.update(this.$refs['wt-textarea']));
|
|
132
147
|
}
|
|
133
148
|
},
|
|
134
|
-
|
|
135
149
|
updateInputPaddings() {
|
|
136
150
|
// cant test this thing cause vue test utils doesnt render elements width :/
|
|
137
151
|
const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
|
|
@@ -141,6 +155,9 @@ export default {
|
|
|
141
155
|
);
|
|
142
156
|
inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
|
|
143
157
|
},
|
|
158
|
+
setupAutosize() {
|
|
159
|
+
autosize(this.$refs['wt-textarea']);
|
|
160
|
+
},
|
|
144
161
|
},
|
|
145
162
|
};
|
|
146
163
|
</script>
|
|
@@ -154,10 +171,24 @@ export default {
|
|
|
154
171
|
|
|
155
172
|
.wt-textarea {
|
|
156
173
|
cursor: text;
|
|
174
|
+
max-height: 100%;
|
|
157
175
|
|
|
158
176
|
&--disabled {
|
|
159
177
|
pointer-events: none;
|
|
160
178
|
}
|
|
179
|
+
|
|
180
|
+
&--autoresize {
|
|
181
|
+
.wt-textarea__textarea {
|
|
182
|
+
min-height: auto;
|
|
183
|
+
max-height: 100%;
|
|
184
|
+
transition: none;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
.wt-textarea__wrapper {
|
|
188
|
+
height: 100%;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
}
|
|
161
192
|
}
|
|
162
193
|
|
|
163
194
|
.wt-textarea__wrapper {
|