@webitel/ui-sdk 24.10.40 → 24.10.42
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 +5273 -5324
- package/dist/ui-sdk.umd.cjs +17 -17
- package/package.json +1 -1
- package/src/api/clients//321/201ontacts/contactChatMessagesHistory.js +1 -0
- package/src/components/wt-textarea/__tests__/WtTextarea.spec.js +3 -3
- package/src/components/wt-textarea/wt-textarea.vue +19 -14
package/package.json
CHANGED
|
@@ -29,6 +29,7 @@ const getChat = async ({ contactId, chatId }) => {
|
|
|
29
29
|
const { messages, peers } = applyTransform(response.data, [snakeToCamel()]);
|
|
30
30
|
return {
|
|
31
31
|
items: applyTransform({ messages, peers }, [mergeChatMessagesData]).reverse(),
|
|
32
|
+
peers,
|
|
32
33
|
};
|
|
33
34
|
} catch (err) {
|
|
34
35
|
throw applyTransform(err, [notify]);
|
|
@@ -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 autoresize prop is passed', () => {
|
|
27
27
|
const wrapper = shallowMount(WtTextarea, {
|
|
28
28
|
stubs: {
|
|
29
29
|
WtLabel,
|
|
30
30
|
},
|
|
31
|
-
props: {
|
|
31
|
+
props: { autoresize: 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 autoresize prop is not passed', () => {
|
|
38
38
|
const wrapper = shallowMount(WtTextarea, {
|
|
39
39
|
stubs: {
|
|
40
40
|
WtLabel,
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
rows="1"
|
|
32
32
|
class="wt-textarea__textarea"
|
|
33
33
|
v-on="listeners"
|
|
34
|
+
@input="autoGrow"
|
|
34
35
|
/>
|
|
35
36
|
<div
|
|
36
37
|
ref="after-wrapper"
|
|
@@ -43,7 +44,7 @@
|
|
|
43
44
|
class="wt-textarea__reset-icon-btn"
|
|
44
45
|
icon="close--filled"
|
|
45
46
|
size="sm"
|
|
46
|
-
@click="
|
|
47
|
+
@click="$emit('input', '')"
|
|
47
48
|
/>
|
|
48
49
|
</div>
|
|
49
50
|
</div>
|
|
@@ -57,7 +58,6 @@
|
|
|
57
58
|
</template>
|
|
58
59
|
|
|
59
60
|
<script>
|
|
60
|
-
import autosize from 'autosize';
|
|
61
61
|
import validationMixin from '../../mixins/validationMixin/validationMixin.js';
|
|
62
62
|
|
|
63
63
|
export default {
|
|
@@ -125,27 +125,35 @@ export default {
|
|
|
125
125
|
},
|
|
126
126
|
mounted() {
|
|
127
127
|
this.updateInputPaddings();
|
|
128
|
-
if (this.autoresize) this.setupAutosize();
|
|
129
128
|
},
|
|
130
|
-
|
|
131
|
-
if(!this.value) this
|
|
129
|
+
updated() {
|
|
130
|
+
if(this.autoresize && !this.value) this.resetGrow();
|
|
132
131
|
},
|
|
133
132
|
|
|
134
133
|
methods: {
|
|
135
|
-
cleanInput() {
|
|
136
|
-
this.$emit('input', '');
|
|
137
|
-
this.$nextTick(() => autosize.update(this.$refs['wt-textarea']));
|
|
138
|
-
},
|
|
139
|
-
|
|
140
134
|
handleKeypress(event) {
|
|
141
135
|
if (!this.autoresize) return;
|
|
142
136
|
|
|
143
137
|
if (event.key === 'Enter' && !event.shiftKey) {
|
|
144
138
|
this.$emit('enter');
|
|
145
139
|
event.preventDefault();
|
|
146
|
-
this.$nextTick(() => autosize.update(this.$refs['wt-textarea']));
|
|
147
140
|
}
|
|
148
141
|
},
|
|
142
|
+
|
|
143
|
+
autoGrow() {
|
|
144
|
+
if (!this.autoresize) return;
|
|
145
|
+
const inputEl = this.$refs['wt-textarea'];
|
|
146
|
+
const bordersSize = 2; // + 2px for height because of --rounded-action-border-size
|
|
147
|
+
|
|
148
|
+
inputEl.style.height = 'auto';
|
|
149
|
+
inputEl.style.height = (inputEl.scrollHeight + bordersSize) + "px";
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
resetGrow() {
|
|
153
|
+
const inputEl = this.$refs['wt-textarea'];
|
|
154
|
+
inputEl.style.height = 'auto'; // reset text-area height
|
|
155
|
+
},
|
|
156
|
+
|
|
149
157
|
updateInputPaddings() {
|
|
150
158
|
// cant test this thing cause vue test utils doesnt render elements width :/
|
|
151
159
|
const afterWrapperWidth = this.$refs['after-wrapper'].offsetWidth;
|
|
@@ -155,9 +163,6 @@ export default {
|
|
|
155
163
|
);
|
|
156
164
|
inputEl.style.paddingRight = `calc(${defaultInputPadding} * 2 + ${afterWrapperWidth}px)`;
|
|
157
165
|
},
|
|
158
|
-
setupAutosize() {
|
|
159
|
-
autosize(this.$refs['wt-textarea']);
|
|
160
|
-
},
|
|
161
166
|
},
|
|
162
167
|
};
|
|
163
168
|
</script>
|