@webitel/ui-sdk 2.1.43 → 2.1.45
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 +37 -16
- package/dist/ui-sdk.common.js.map +1 -1
- package/dist/ui-sdk.css +1 -1
- package/dist/ui-sdk.umd.js +37 -16
- package/dist/ui-sdk.umd.js.map +1 -1
- package/dist/ui-sdk.umd.min.js +2 -2
- package/dist/ui-sdk.umd.min.js.map +1 -1
- package/package.json +2 -1
- package/src/components/atoms/wt-avatar/wt-avatar.vue +4 -0
- package/src/components/atoms/wt-badge/wt-badge.vue +14 -1
- package/src/css/styleguide/viewport-breakpoints/_viewport-breakpoints.scss +14 -9
- package/src/plugins/breakpoint/breakpoint.plugin.js +136 -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.45",
|
|
4
4
|
"private": false,
|
|
5
5
|
"scripts": {
|
|
6
6
|
"serve-lib": "vue-cli-service serve",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"src/mixins/*",
|
|
23
23
|
"src/scripts/*",
|
|
24
24
|
"src/modules/*",
|
|
25
|
+
"src/plugins/*",
|
|
25
26
|
"src/store/*",
|
|
26
27
|
"CHANGELOG.md"
|
|
27
28
|
],
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
<wt-badge
|
|
7
7
|
v-if="badge"
|
|
8
8
|
:color-variable="badgeColorVar"
|
|
9
|
+
:icon-badge="isDnd ? 'dnd' : null"
|
|
9
10
|
></wt-badge>
|
|
10
11
|
<img
|
|
11
12
|
class="wt-avatar__img"
|
|
@@ -44,6 +45,9 @@ export default {
|
|
|
44
45
|
imgSrc() {
|
|
45
46
|
return this.src || defaultAvatar;
|
|
46
47
|
},
|
|
48
|
+
isDnd() {
|
|
49
|
+
return this.status === AbstractUserStatus.DND;
|
|
50
|
+
},
|
|
47
51
|
badgeColorVar() {
|
|
48
52
|
switch (this.status) {
|
|
49
53
|
case AbstractUserStatus.ACTIVE: return 'online-color';
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
<aside
|
|
3
3
|
class="wt-badge"
|
|
4
4
|
:class="{ 'wt-badge--outside': outside }"
|
|
5
|
-
:style="{ background: `var(--${colorVariable})` }"
|
|
5
|
+
:style="{ background: iconBadge ? `url(${this.showIconBadge})` : `var(--${colorVariable})` }"
|
|
6
6
|
></aside>
|
|
7
7
|
</template>
|
|
8
8
|
|
|
9
9
|
<script>
|
|
10
|
+
import BadgeDnd from '../../../assets/icons/badge-dnd.svg';
|
|
11
|
+
|
|
10
12
|
export default {
|
|
11
13
|
name: 'wt-badge',
|
|
12
14
|
props: {
|
|
@@ -19,6 +21,17 @@ export default {
|
|
|
19
21
|
type: Boolean,
|
|
20
22
|
default: false,
|
|
21
23
|
},
|
|
24
|
+
iconBadge: {
|
|
25
|
+
type: String,
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
computed: {
|
|
29
|
+
showIconBadge() {
|
|
30
|
+
switch (this.iconBadge) {
|
|
31
|
+
case 'dnd': return BadgeDnd;
|
|
32
|
+
default: return null;
|
|
33
|
+
}
|
|
34
|
+
},
|
|
22
35
|
},
|
|
23
36
|
};
|
|
24
37
|
</script>
|
|
@@ -6,15 +6,20 @@ sm: @media only screen and (max-width: $viewport-md) {}
|
|
|
6
6
|
xs: @media only screen and (max-width: $viewport-sm) {}
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
// OLD, REMOVE ME
|
|
10
|
+
//$viewport-xl: 1440px;
|
|
11
|
+
//$viewport-lg: 1280px;
|
|
12
|
+
//$viewport-md: 992px;
|
|
13
|
+
//$viewport-sm: 600px;
|
|
14
|
+
|
|
15
|
+
$viewport-lg: 1904px; // and lower
|
|
16
|
+
$viewport-md: 1264px; // and lower
|
|
17
|
+
$viewport-sm: 960px; // and lower
|
|
18
|
+
$viewport-xs: 600px; // and lower
|
|
13
19
|
|
|
14
20
|
$media: #{'only screen'};
|
|
15
|
-
$media-width-
|
|
16
|
-
$media-width-
|
|
17
|
-
$media-width-
|
|
18
|
-
$media-width-
|
|
19
|
-
$media-width-xs: #{'max-width: '} $viewport-sm;
|
|
21
|
+
$media-width-lg: #{'min-width: '} $viewport-lg;
|
|
22
|
+
$media-width-md: #{'max-width: '} $viewport-md;
|
|
23
|
+
$media-width-sm: #{'max-width: '} $viewport-sm;
|
|
24
|
+
$media-width-xs: #{'max-width: '} $viewport-xs;
|
|
20
25
|
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import debounce from '../../scripts/debounce';
|
|
2
|
+
|
|
3
|
+
// https://stackoverflow.com/questions/41791193/vuejs-reactive-binding-for-a-plugin-how-to/41801107#41801107
|
|
4
|
+
// https://stackoverflow.com/questions/50111231/vue-prototype-not-reactive-when-data-changes
|
|
5
|
+
|
|
6
|
+
// https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/services/breakpoint/index.ts
|
|
7
|
+
|
|
8
|
+
const breakpoint = {
|
|
9
|
+
// Breakpoints
|
|
10
|
+
xs: false,
|
|
11
|
+
sm: false,
|
|
12
|
+
md: false,
|
|
13
|
+
lg: false,
|
|
14
|
+
xl: false,
|
|
15
|
+
|
|
16
|
+
// Conditionals
|
|
17
|
+
xsOnly: false,
|
|
18
|
+
smOnly: false,
|
|
19
|
+
smAndDown: false,
|
|
20
|
+
smAndUp: false,
|
|
21
|
+
mdOnly: false,
|
|
22
|
+
mdAndDown: false,
|
|
23
|
+
mdAndUp: false,
|
|
24
|
+
lgOnly: false,
|
|
25
|
+
lgAndDown: false,
|
|
26
|
+
lgAndUp: false,
|
|
27
|
+
xlOnly: false,
|
|
28
|
+
|
|
29
|
+
// true if screen width < mobileBreakpoint
|
|
30
|
+
mobile: true,
|
|
31
|
+
|
|
32
|
+
// Current breakpoint name (e.g. 'md')
|
|
33
|
+
name: 'xs',
|
|
34
|
+
// Dimensions
|
|
35
|
+
height: 0,
|
|
36
|
+
width: 0,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
const getClientWidth = () => Math.max(
|
|
40
|
+
document.documentElement.clientWidth,
|
|
41
|
+
window.innerWidth || 0,
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const getClientHeight = () => Math.max(
|
|
45
|
+
document.documentElement.clientHeight,
|
|
46
|
+
window.innerHeight || 0,
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
const thresholds = {
|
|
50
|
+
xs: 600,
|
|
51
|
+
sm: 960,
|
|
52
|
+
md: 1264,
|
|
53
|
+
lg: 1904,
|
|
54
|
+
};
|
|
55
|
+
const mobileBreakpoint = 'sm';
|
|
56
|
+
const scrollBarWidth = 16;
|
|
57
|
+
|
|
58
|
+
const onResize = () => {
|
|
59
|
+
const height = getClientHeight();
|
|
60
|
+
const width = getClientWidth();
|
|
61
|
+
|
|
62
|
+
const xs = width < thresholds.xs;
|
|
63
|
+
const sm = width < thresholds.sm && !xs;
|
|
64
|
+
const md = width < (thresholds.md - scrollBarWidth) && !(sm || xs);
|
|
65
|
+
const lg = width < (thresholds.lg - scrollBarWidth) && !(md || sm || xs);
|
|
66
|
+
const xl = width >= (thresholds.lg - scrollBarWidth);
|
|
67
|
+
|
|
68
|
+
breakpoint.height = height;
|
|
69
|
+
breakpoint.width = width;
|
|
70
|
+
|
|
71
|
+
breakpoint.xs = xs;
|
|
72
|
+
breakpoint.sm = sm;
|
|
73
|
+
breakpoint.md = md;
|
|
74
|
+
breakpoint.lg = lg;
|
|
75
|
+
breakpoint.xl = xl;
|
|
76
|
+
|
|
77
|
+
breakpoint.xsOnly = xs;
|
|
78
|
+
breakpoint.smOnly = sm;
|
|
79
|
+
breakpoint.smAndDown = (xs || sm) && !(md || lg || xl);
|
|
80
|
+
breakpoint.smAndUp = !xs && (sm || md || lg || xl);
|
|
81
|
+
breakpoint.mdOnly = md;
|
|
82
|
+
breakpoint.mdAndDown = (xs || sm || md) && !(lg || xl);
|
|
83
|
+
breakpoint.mdAndUp = !(xs || sm) && (md || lg || xl);
|
|
84
|
+
breakpoint.lgOnly = lg;
|
|
85
|
+
breakpoint.lgAndDown = (xs || sm || md || lg) && !xl;
|
|
86
|
+
breakpoint.lgAndUp = !(xs || sm || md) && (lg || xl);
|
|
87
|
+
breakpoint.xlOnly = xl;
|
|
88
|
+
|
|
89
|
+
switch (true) {
|
|
90
|
+
case (xs):
|
|
91
|
+
breakpoint.name = 'xs';
|
|
92
|
+
break;
|
|
93
|
+
case (sm):
|
|
94
|
+
breakpoint.name = 'sm';
|
|
95
|
+
break;
|
|
96
|
+
case (md):
|
|
97
|
+
breakpoint.name = 'md';
|
|
98
|
+
break;
|
|
99
|
+
case (lg):
|
|
100
|
+
breakpoint.name = 'lg';
|
|
101
|
+
break;
|
|
102
|
+
default:
|
|
103
|
+
breakpoint.name = 'xl';
|
|
104
|
+
break;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
if (typeof mobileBreakpoint === 'number') {
|
|
108
|
+
breakpoint.mobile = width < parseInt(mobileBreakpoint, 10);
|
|
109
|
+
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const breakpoints = {
|
|
114
|
+
xs: 0,
|
|
115
|
+
sm: 1,
|
|
116
|
+
md: 2,
|
|
117
|
+
lg: 3,
|
|
118
|
+
xl: 4,
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
const current = breakpoints[breakpoint.name];
|
|
122
|
+
const max = breakpoints[mobileBreakpoint];
|
|
123
|
+
|
|
124
|
+
breakpoint.mobile = current <= max;
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const install = (Vue) => {
|
|
128
|
+
window.addEventListener('resize', debounce(onResize), { passive: true });
|
|
129
|
+
|
|
130
|
+
onResize();
|
|
131
|
+
|
|
132
|
+
// eslint-disable-next-line no-param-reassign
|
|
133
|
+
Vue.prototype.$breakpoint = Vue.observable(breakpoint);
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
export default { install };
|