@webitel/ui-sdk 2.1.14 → 2.1.16
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.common.js +197 -10
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +197 -10
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +6 -4
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +2 -1
- package/src/components/index.js +2 -0
- package/src/components/molecules/wt-copy-action/__tests__/WtCopyAction.spec.js +14 -0
- package/src/components/molecules/wt-copy-action/wt-copy-action.vue +63 -0
- package/src/components/molecules/wt-tags-input/wt-tags-input.vue +1 -1
- package/src/locale/en/en.js +4 -0
- package/src/locale/ru/ru.js +4 -0
- package/src/locale/ua/ua.js +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webitel/ui-sdk",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.16",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve-lib": "vue-cli-service serve",
|
|
@@ -26,6 +26,7 @@
|
|
|
26
26
|
"CHANGELOG.md"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
+
"clipboard-copy": "^4.0.1",
|
|
29
30
|
"core-js": "^3.6.5",
|
|
30
31
|
"csv-stringify": "^5.5.3",
|
|
31
32
|
"deep-copy": "^1.4.2",
|
package/src/components/index.js
CHANGED
|
@@ -33,6 +33,7 @@ import WtTimepicker from './molecules/wt-timepicker/wt-timepicker.vue';
|
|
|
33
33
|
import WtLabel from './molecules/wt-label/wt-label.vue';
|
|
34
34
|
import WtButtonSelect from './molecules/wt-button-select/wt-button-select.vue';
|
|
35
35
|
import WtHint from './molecules/wt-hint/wt-hint.vue';
|
|
36
|
+
import WtCopyAction from './molecules/wt-copy-action/wt-copy-action.vue';
|
|
36
37
|
|
|
37
38
|
import WtAppHeader from './organisms/wt-app-header/wt-app-header.vue';
|
|
38
39
|
import WtAppNavigator from './organisms/wt-app-header/wt-app-navigator.vue';
|
|
@@ -101,6 +102,7 @@ const Components = {
|
|
|
101
102
|
WtTableColumnSelect,
|
|
102
103
|
WtButtonSelect,
|
|
103
104
|
WtContextMenu,
|
|
105
|
+
WtCopyAction,
|
|
104
106
|
};
|
|
105
107
|
|
|
106
108
|
Object.keys(Components).forEach((name) => {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { shallowMount } from '@vue/test-utils';
|
|
2
|
+
import WtIconBtn from '../../wt-icon-btn/wt-icon-btn.vue';
|
|
3
|
+
import WtCopyAction from '../wt-copy-action.vue';
|
|
4
|
+
|
|
5
|
+
describe('WtCopyAction', () => {
|
|
6
|
+
it('renders a component', () => {
|
|
7
|
+
const wrapper = shallowMount(WtCopyAction, {
|
|
8
|
+
stubs: {
|
|
9
|
+
WtIconBtn,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
expect(wrapper.classes('wt-copy-action')).toBe(true);
|
|
13
|
+
});
|
|
14
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-tooltip class="wt-copy-action">
|
|
3
|
+
<template v-slot:activator>
|
|
4
|
+
<wt-icon-btn
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
:icon="copied ? 'done' : 'copy'"
|
|
7
|
+
class="copy-action"
|
|
8
|
+
@click="copy"
|
|
9
|
+
></wt-icon-btn>
|
|
10
|
+
</template>
|
|
11
|
+
{{ copied ? copiedTooltip : copyTooltip }}
|
|
12
|
+
</wt-tooltip>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
import copy from 'clipboard-copy';
|
|
17
|
+
|
|
18
|
+
let copiedIdTimeout = null;
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
name: 'wt-copy-action',
|
|
22
|
+
data: () => ({
|
|
23
|
+
copied: false,
|
|
24
|
+
}),
|
|
25
|
+
props: {
|
|
26
|
+
value: {
|
|
27
|
+
type: String,
|
|
28
|
+
},
|
|
29
|
+
tooltips: {
|
|
30
|
+
type: Object,
|
|
31
|
+
default: () => ({
|
|
32
|
+
copy: '',
|
|
33
|
+
copied: '',
|
|
34
|
+
}),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
computed: {
|
|
38
|
+
copyTooltip() {
|
|
39
|
+
return this.tooltips.copy || this.$t('webitelUI.copyAction.copy');
|
|
40
|
+
},
|
|
41
|
+
copiedTooltip() {
|
|
42
|
+
return this.tooltips.copied || this.$t('webitelUI.copyAction.copied');
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
methods: {
|
|
46
|
+
async copy() {
|
|
47
|
+
try {
|
|
48
|
+
await copy(this.value);
|
|
49
|
+
this.copied = this.value;
|
|
50
|
+
if (copiedIdTimeout) window.clearTimeout(copiedIdTimeout);
|
|
51
|
+
copiedIdTimeout = setTimeout(() => {
|
|
52
|
+
this.copied = null;
|
|
53
|
+
}, 1500);
|
|
54
|
+
} catch (err) {
|
|
55
|
+
throw err;
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
</script>
|
|
61
|
+
|
|
62
|
+
<style lang="scss" scoped>
|
|
63
|
+
</style>
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
:close-on-select="false"
|
|
24
24
|
:disabled="disabled"
|
|
25
25
|
:internal-search="!searchMethod"
|
|
26
|
-
:label="trackBy ? optionLabel : null"
|
|
26
|
+
:label="trackBy ? (optionLabel || trackBy) : null"
|
|
27
27
|
:loading="false"
|
|
28
28
|
:options="selectOptions"
|
|
29
29
|
:placeholder="placeholder || label"
|
package/src/locale/en/en.js
CHANGED
package/src/locale/ru/ru.js
CHANGED