@webitel/ui-sdk 2.0.16 → 2.0.17

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.0.16",
3
+ "version": "2.0.17",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -7,7 +7,10 @@
7
7
  >
8
8
  <slot name="activator"></slot>
9
9
  <template #popper="{ hide }">
10
- <ul class="wt-context-menu__menu">
10
+ <ul
11
+ class="wt-context-menu__menu"
12
+ :style="`width: ${width}; min-width: ${minWidth}; max-width: ${maxWidth};`"
13
+ >
11
14
  <li
12
15
  class="wt-context-menu__option-wrapper"
13
16
  v-for="(option, index) in options"
@@ -42,6 +45,18 @@ export default {
42
45
  type: Boolean,
43
46
  default: false,
44
47
  },
48
+ width: {
49
+ type: [String],
50
+ default: 'auto',
51
+ },
52
+ minWidth: {
53
+ type: [String],
54
+ default: '160px',
55
+ },
56
+ maxWidth: {
57
+ type: [String],
58
+ default: '300px',
59
+ },
45
60
  },
46
61
  methods: {
47
62
  handleOptionClick({ option, index, hide }) {
@@ -59,8 +74,6 @@ export default {
59
74
 
60
75
  .wt-context-menu__menu {
61
76
  @extend %typo-body-2;
62
- min-width: var(--context-menu-min-width);
63
- max-width: var(--context-menu-max-width);
64
77
  background-color: var(--context-menu-background-color);
65
78
  border-radius: var(--border-radius);
66
79
  box-shadow: var(--box-shadow);
@@ -29,7 +29,7 @@ export default {
29
29
  color: {
30
30
  type: String,
31
31
  default: 'default',
32
- options: ['default', 'contrast', 'active', 'accent', 'disabled', 'success', 'danger', 'transfer', 'job', 'hold', 'secondary-50'],
32
+ options: ['default', 'contrast', 'active', 'accent', 'secondary', 'disabled', 'success', 'danger', 'transfer', 'job', 'hold', 'secondary-50'],
33
33
  },
34
34
  iconPrefix: {
35
35
  type: String,
@@ -85,6 +85,10 @@ svg {
85
85
  fill: var(--icon-color-active);
86
86
  }
87
87
 
88
+ &-secondary .wt-icon__icon {
89
+ fill: var(--secondary-color);
90
+ }
91
+
88
92
  &-success .wt-icon__icon {
89
93
  fill: var(--icon-color-success);
90
94
  }
@@ -14,7 +14,7 @@ export default {
14
14
  color: {
15
15
  type: String,
16
16
  default: 'contrast',
17
- description: '["main", "contrast"]',
17
+ description: '["main", "contrast", "icon"]',
18
18
  },
19
19
  },
20
20
  };
@@ -44,6 +44,9 @@ export default {
44
44
  &--main circle {
45
45
  stroke: var(--main-color);
46
46
  }
47
+ &--icon circle {
48
+ stroke: var(--icon-color);
49
+ }
47
50
  }
48
51
 
49
52
  @keyframes rotate {
@@ -13,10 +13,13 @@
13
13
  type="search"
14
14
  v-on="listeners"
15
15
  >
16
- <wt-icon
17
- class="wt-search-bar__search-icon"
18
- icon="search"
19
- ></wt-icon>
16
+ <div class="wt-search-bar__search-icon">
17
+ <slot name="search-icon">
18
+ <wt-icon
19
+ icon="search"
20
+ ></wt-icon>
21
+ </slot>
22
+ </div>
20
23
  <wt-icon-btn
21
24
  class="wt-search-bar__reset-icon-btn"
22
25
  :class="{ 'hidden': !value }"
@@ -112,6 +115,7 @@
112
115
  }
113
116
 
114
117
  .wt-search-bar__search-icon {
118
+ line-height: 0;
115
119
  position: absolute;
116
120
  top: 50%;
117
121
  left: var(--input-icon-margin);
@@ -39,7 +39,7 @@
39
39
  <!-- Slot that is used for all selected options (tags)-->
40
40
  <template slot="tag" slot-scope="{ option }">
41
41
  <span class="multiselect__custom-tag">
42
- {{ option[optionLabel] || option }}
42
+ {{ getOptionLabel({ option, optionLabel }) }}
43
43
  </span>
44
44
  </template>
45
45
 
@@ -141,7 +141,6 @@ export default {
141
141
 
142
142
  optionLabel: {
143
143
  type: String,
144
- default: 'name',
145
144
  },
146
145
 
147
146
  searchMethod: {
@@ -226,11 +225,14 @@ export default {
226
225
 
227
226
  methods: {
228
227
  getOptionLabel({ option, optionLabel }) {
228
+ const defaultOptionLabel = 'name';
229
+
230
+ if (optionLabel) return option[optionLabel];
229
231
  if (option.locale) {
230
232
  if (Array.isArray(option.locale)) return this.$tc(...option.locale);
231
233
  return this.$t(option.locale);
232
234
  }
233
- return option[optionLabel] || option;
235
+ return option[defaultOptionLabel] || option;
234
236
  },
235
237
  handleSearchChange(search) {
236
238
  if (!this.isApiMode) return;
@@ -1,7 +1,4 @@
1
1
  :root {
2
- --context-menu-min-width : 160px;
3
- --context-menu-max-width : 300px;
4
-
5
2
  --context-menu-option-color--hover: var(--secondary-color);
6
3
 
7
4
  --context-menu-background-color: var(--main-color);
@@ -38,6 +38,8 @@ export default {
38
38
  to: 'To',
39
39
  tts: 'Text-to-Speech',
40
40
  state: 'State',
41
+ refresh: 'Refresh',
42
+ retry: 'Retry',
41
43
  },
42
44
  // yak zhe ya zaebalsya povtoriaty odni i ti sami slova!!!!
43
45
  vocabulary: {
@@ -47,6 +49,12 @@ export default {
47
49
  text: 'Text',
48
50
  yes: 'Yes',
49
51
  no: 'No',
52
+ description: 'Description',
53
+ login: 'Login',
54
+ host: 'Host',
55
+ time: 'Time',
56
+ channel: 'Channel',
57
+ file: 'File',
50
58
  },
51
59
  // date-related texts
52
60
  date: {
@@ -38,6 +38,8 @@ export default {
38
38
  to: 'До',
39
39
  tts: 'Text-to-Speech',
40
40
  state: 'Состояние',
41
+ refresh: 'Обновить',
42
+ retry: 'Повторить',
41
43
  },
42
44
  vocabulary: {
43
45
  language: 'Язык',
@@ -46,6 +48,12 @@ export default {
46
48
  text: 'Текст',
47
49
  yes: 'Да',
48
50
  no: 'Нет',
51
+ description: 'Описание',
52
+ login: 'Логин',
53
+ host: 'Хост',
54
+ time: 'Время',
55
+ channel: 'Канал',
56
+ file: 'Файл',
49
57
  },
50
58
  // date-related texts
51
59
  date: {
@@ -38,6 +38,8 @@ export default {
38
38
  to: 'До',
39
39
  tts: 'Text-to-Speech',
40
40
  state: 'Стан',
41
+ refresh: 'Оновити',
42
+ retry: 'Повторити',
41
43
  },
42
44
  vocabulary: {
43
45
  language: 'Мова',
@@ -46,6 +48,12 @@ export default {
46
48
  text: 'Текст',
47
49
  yes: 'Так',
48
50
  no: 'Ні',
51
+ description: 'Опис',
52
+ login: 'Логін',
53
+ host: 'Хост',
54
+ time: 'Час',
55
+ channel: 'Канал',
56
+ file: 'Файл',
49
57
  },
50
58
  // date-related texts
51
59
  date: {
@@ -2,6 +2,8 @@ import {
2
2
  camelToKebab,
3
3
  camelToSnake,
4
4
  kebabToCamel,
5
+ snakeToKebab,
6
+ kebabToSnake,
5
7
  objCamelToSnake,
6
8
  objSnakeToCamel,
7
9
  snakeToCamel,
@@ -15,6 +17,13 @@ describe('Case converters', () => {
15
17
  expect(kebabToCamel(kebabStr)).toBe(camelStr);
16
18
  });
17
19
 
20
+ it('Snake-Kebab', () => {
21
+ const snakeStr = 'snake_to_kebab';
22
+ const kebabStr = 'snake-to-kebab';
23
+ expect(snakeToKebab(snakeStr)).toBe(kebabStr);
24
+ expect(kebabToSnake(kebabStr)).toBe(snakeStr);
25
+ });
26
+
18
27
  it('Camel-Snake', () => {
19
28
  const camelStr = 'camelToSnake';
20
29
  const snakeStr = 'camel_to_snake';
@@ -20,6 +20,18 @@ export const camelToKebab = (str) => str.replace(
20
20
  .replace('', '-'),
21
21
  );
22
22
 
23
+ export const kebabToSnake = (str) => str.replace(
24
+ /([-_][a-z])/g,
25
+ (group) => group
26
+ .replace('-', '_'),
27
+ );
28
+
29
+ export const snakeToKebab = (str) => str.replace(
30
+ /([-_][a-z])/g,
31
+ (group) => group
32
+ .replace('_', '-'),
33
+ );
34
+
23
35
  export const objSnakeToCamel = (obj, skipKeys = []) => {
24
36
  if (!obj) return obj;
25
37
  const newObj = {};