@webitel/ui-sdk 2.1.25 → 2.1.27

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webitel/ui-sdk",
3
- "version": "2.1.25",
3
+ "version": "2.1.27",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -1,13 +1,13 @@
1
1
  <template>
2
2
  <nav class="wt-tabs">
3
3
  <button
4
- class="wt-tab"
4
+ v-for="(tab) in tabs"
5
+ :key="tab.value"
5
6
  :class="{
6
7
  'wt-tab--highlight': tab.value === current.value
7
8
  }"
8
- v-for="(tab) in tabs"
9
9
  :value="tab.text"
10
- :key="tab.value"
10
+ class="wt-tab"
11
11
  type="button"
12
12
  @click="open(tab)"
13
13
  >
@@ -18,98 +18,99 @@
18
18
 
19
19
  <div class="wt-tabs__underline">
20
20
  <div
21
- class="wt-tab__underline--highlight"
22
21
  :style="{
23
22
  width: `${activeLineWidth}px`,
24
23
  transform: `translateX(${activeLineOffset}px)`
25
24
  }"
25
+ class="wt-tab__underline--highlight"
26
26
  ></div>
27
27
  </div>
28
28
  </nav>
29
29
  </template>
30
30
 
31
31
  <script>
32
- export default {
33
- name: 'wt-tabs',
34
- props: {
35
- current: {
36
- type: Object,
37
- default: () => ({}),
38
- },
39
- tabs: {
40
- type: Array,
41
- default: () => [],
42
- },
32
+ export default {
33
+ name: 'wt-tabs',
34
+ props: {
35
+ current: {
36
+ type: Object,
37
+ default: () => ({}),
43
38
  },
44
-
45
- model: {
46
- prop: 'current',
47
- event: 'change',
39
+ tabs: {
40
+ type: Array,
41
+ default: () => [],
48
42
  },
43
+ },
49
44
 
50
- data: () => ({
51
- activeLineWidth: 0,
52
- activeLineOffset: 0,
53
- }),
45
+ model: {
46
+ prop: 'current',
47
+ event: 'change',
48
+ },
54
49
 
55
- methods: {
56
- open(value) {
57
- this.$emit('change', value);
58
- this.moveActiveLine(value);
59
- },
50
+ data: () => ({
51
+ activeLineWidth: 0,
52
+ activeLineOffset: 0,
53
+ }),
54
+
55
+ methods: {
56
+ open(value) {
57
+ this.$emit('change', value);
58
+ this.moveActiveLine(value);
59
+ },
60
60
 
61
- moveActiveLine(newValue) {
62
- if (!this.current) return;
63
- if (!this.$refs || !this.$refs[newValue] || !this.$refs[newValue][0]) return;
64
- const element = this.$refs[newValue][0];
65
- this.activeLineWidth = element.clientWidth;
66
- this.activeLineOffset = element.offsetLeft;
67
- },
61
+ moveActiveLine(newValue) {
62
+ if (!this.current) return;
63
+ if (!this.$refs || !this.$refs[newValue] || !this.$refs[newValue][0]) return;
64
+ const element = this.$refs[newValue][0];
65
+ this.activeLineWidth = element.clientWidth;
66
+ this.activeLineOffset = element.offsetLeft;
68
67
  },
69
- };
68
+ },
69
+ };
70
70
  </script>
71
71
 
72
72
  <style lang="scss" scoped>
73
- .wt-tabs {
74
- position: relative;
75
- }
73
+ .wt-tabs {
74
+ position: relative;
75
+ }
76
76
 
77
- .wt-tab {
78
- @extend %typo-body-1;
79
- position: relative;
80
- display: inline-block;
81
- padding-bottom: var(--tab-padding);
82
- margin: var(--tab-margin);
83
- color: var(--tab-color);
84
- background: transparent;
85
- border: none;
86
- border-bottom: var(--tab-border);
87
- border-bottom-color: transparent;
88
- transition: var(--transition);
89
- cursor: pointer;
90
- z-index: var(--tab-z-index);
91
- outline: none;
77
+ .wt-tab {
78
+ @extend %typo-body-1;
79
+ position: relative;
80
+ z-index: var(--tab-z-index);
81
+ display: flex;
82
+ flex-wrap: nowrap;
83
+ padding-bottom: var(--tab-padding);
84
+ cursor: pointer;
85
+ transition: var(--transition);
86
+ color: var(--tab-color);
87
+ border: none;
88
+ border-bottom: var(--tab-border);
89
+ border-bottom-color: transparent;
90
+ outline: none;
91
+ background: transparent;
92
+ gap: var(--tab-gap);
92
93
 
93
- &:hover,
94
- &:focus, {
95
- color: var(--tab--hover-color);
96
- border-bottom-color: var(--tab--active-border-color);
97
- }
94
+ &:hover,
95
+ &:focus, {
96
+ color: var(--tab--hover-color);
97
+ border-bottom-color: var(--tab--active-border-color);
98
+ }
98
99
 
99
- &.wt-tab--highlight {
100
- color: var(--tab--active-color);
101
- border-bottom-color: var(--tab--active-border-color);
102
- }
100
+ &.wt-tab--highlight {
101
+ color: var(--tab--active-color);
102
+ border-bottom-color: var(--tab--active-border-color);
103
+ }
103
104
 
104
- //// disables bold font resize on hover
105
- &:after {
106
- display: block;
107
- content: attr(value);
108
- font-weight: bold;
109
- height: 0;
110
- overflow: hidden;
111
- visibility: hidden;
112
- }
105
+ //// disables bold font resize on hover
106
+ &:after {
107
+ display: block;
108
+ visibility: hidden;
109
+ overflow: hidden;
110
+ height: 0;
111
+ content: attr(value);
112
+ font-weight: bold;
113
113
  }
114
+ }
114
115
 
115
116
  </style>
@@ -6,6 +6,7 @@ const headers = [
6
6
  {
7
7
  text: 'heading 1',
8
8
  value: 'h1',
9
+ sort: null,
9
10
  },
10
11
  {
11
12
  text: 'heading2',
@@ -13,7 +13,7 @@
13
13
  v-for="(col, key) of dataHeaders"
14
14
  :key="key"
15
15
  :class="[
16
- {'wt-table__th--sortable': sortable},
16
+ {'wt-table__th--sortable': isColSortable(col)},
17
17
  `wt-table__th--sort-${col.sort}`,
18
18
  ]"
19
19
  class="wt-table__th"
@@ -146,10 +146,17 @@ export default {
146
146
 
147
147
  methods: {
148
148
  sort(col) {
149
+ if (!this.isColSortable(col)) return;
149
150
  const nextSort = getNextSortOrder(col.sort);
150
- if (this.sortable) this.$emit('sort', col, nextSort);
151
+ this.$emit('sort', col, nextSort);
152
+ },
153
+ isColSortable({ sort }) {
154
+ /* --sortable = sortable && col.sort === undefined cause there may be some columns we don't want to sort
155
+ strict check for === undefined is used because col.sort = null is sort order too (actualu, without sort)
156
+ so we need to check if this property is present
157
+ */
158
+ return this.sortable && sort !== undefined;
151
159
  },
152
-
153
160
  selectAll() {
154
161
  const { isAllSelected } = this;
155
162
  // eslint-disable-next-line no-param-reassign,no-return-assign
@@ -4,11 +4,11 @@
4
4
  --tabs-underiline-color: transparent;
5
5
 
6
6
  --tab-padding: var(--spacing-2xs);
7
- --tab-margin: 0 5px;
7
+ --tab-gap: var(--spacing-2xs);
8
8
  --tab-color: var(--text-outline-color);
9
9
  --tab--hover-color: var(--text-primary-color);
10
10
  --tab--active-color: var(--text-primary-color);
11
11
  --tab-border: 4px solid;
12
12
  --tab--active-border-color: var(--accent-color);
13
13
  --tab-z-index: 1;
14
- }
14
+ }