@webitel/ui-sdk 2.0.16 → 2.0.20

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.
Files changed (29) hide show
  1. package/dist/img/sprite/idle.svg +4 -0
  2. package/dist/img/sprite/index.js +1 -1
  3. package/dist/img/sprite/stt-download.svg +4 -0
  4. package/dist/img/sprite/stt-search.svg +3 -0
  5. package/dist/ui-sdk.common.js +78 -56
  6. package/dist/ui-sdk.common.js.map +1 -1
  7. package/dist/ui-sdk.css +1 -1
  8. package/dist/ui-sdk.umd.js +78 -56
  9. package/dist/ui-sdk.umd.js.map +1 -1
  10. package/dist/ui-sdk.umd.min.js +2 -2
  11. package/dist/ui-sdk.umd.min.js.map +1 -1
  12. package/package.json +1 -1
  13. package/src/components/atoms/wt-context-menu/wt-context-menu.vue +16 -3
  14. package/src/components/atoms/wt-icon/wt-icon.vue +5 -1
  15. package/src/components/atoms/wt-loader/_internals/wt-loader--sm.vue +4 -1
  16. package/src/components/atoms/wt-rounded-action/wt-rounded-action.vue +1 -0
  17. package/src/components/molecules/wt-search-bar/wt-search-bar.vue +8 -4
  18. package/src/components/molecules/wt-select/wt-select.vue +5 -3
  19. package/src/css/components/atoms/wt-context-menu/_variables.scss +0 -3
  20. package/src/enums/WebitelApplications/AdminSections.enum.js +1 -0
  21. package/src/locale/en/en.js +9 -0
  22. package/src/locale/ru/ru.js +9 -0
  23. package/src/locale/ua/ua.js +9 -0
  24. package/src/modules/CSVExport/mixins/exportCSVMixin.js +1 -1
  25. package/src/modules/QueryFilters/classes/ApiFilterSchema.js +1 -1
  26. package/src/modules/QueryFilters/classes/__tests__/ApiFilterSchema.spec.js +1 -1
  27. package/src/modules/Userinfo/classes/ApplicationsAccess.js +4 -0
  28. package/src/scripts/__tests__/caseConverters.spec.js +9 -0
  29. package/src/scripts/caseConverters.js +12 -0
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.20",
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 {
@@ -52,6 +52,7 @@ export default {
52
52
  iColor() {
53
53
  if (this.iconColor) return this.iconColor;
54
54
  if (this.disabled) return 'secondary-50';
55
+ if (this.color === 'secondary') return null; // dont change icon color
55
56
  return this.color;
56
57
  },
57
58
  },
@@ -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);
@@ -35,6 +35,7 @@ const AdminSections = Object.freeze({
35
35
  STORAGE: 'storage', // scope: storage_profile
36
36
  COGNITIVE_PROFILES: 'cognitive-profiles', // scope: cognitive_profile
37
37
  EMAIL_PROFILES: 'email-profiles', // scope: email_profile
38
+ IMPORT_CSV: 'import-csv',
38
39
 
39
40
  // PERMISSIONS
40
41
  OBJECTS: 'objects', // permissions: add
@@ -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: {
@@ -147,6 +155,7 @@ export default {
147
155
  [AdminSections.STORAGE]: 'Storage',
148
156
  [AdminSections.COGNITIVE_PROFILES]: 'Cognitive profiles',
149
157
  [AdminSections.EMAIL_PROFILES]: 'Email profiles',
158
+ [AdminSections.IMPORT_CSV]: 'Import data from CSV file',
150
159
  [AdminSections.MEDIA]: 'Media',
151
160
  [AdminSections.BLACKLIST]: 'Call lists',
152
161
  [AdminSections.ROLES]: 'Roles',
@@ -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: {
@@ -146,6 +154,7 @@ export default {
146
154
  [AdminSections.STORAGE]: 'Хранилища',
147
155
  [AdminSections.COGNITIVE_PROFILES]: 'Языковые профили',
148
156
  [AdminSections.EMAIL_PROFILES]: 'Email профили',
157
+ [AdminSections.IMPORT_CSV]: 'Импорт данных из CSV файла',
149
158
  [AdminSections.ROLES]: 'Роли',
150
159
  [AdminSections.OBJECTS]: 'Разделы',
151
160
  },
@@ -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: {
@@ -146,6 +154,7 @@ export default {
146
154
  [AdminSections.STORAGE]: 'Сховища',
147
155
  [AdminSections.COGNITIVE_PROFILES]: 'Мовні профілі',
148
156
  [AdminSections.EMAIL_PROFILES]: 'Email профілі',
157
+ [AdminSections.IMPORT_CSV]: 'Імпорт даних з CSV файлу',
149
158
  [AdminSections.ROLES]: 'Ролі',
150
159
  [AdminSections.OBJECTS]: 'Розділи',
151
160
  },
@@ -34,7 +34,7 @@ export default {
34
34
  ...exportParams || routeQuery,
35
35
  size: 5000,
36
36
  };
37
- if (this.isAnySelected) params.ids = this.selectedIds;
37
+ if (this.isAnySelected) params.id = this.selectedIds;
38
38
 
39
39
  try {
40
40
  await this.CSVExport.export(params);
@@ -26,7 +26,7 @@ export default class ApiFilterSchema extends BaseFilterSchema {
26
26
  }
27
27
 
28
28
  fetchSelected(idsList) {
29
- const params = { size: idsList.length, ids: idsList };
29
+ const params = { size: idsList.length, id: idsList };
30
30
  return this.API(params);
31
31
  }
32
32
  }
@@ -17,7 +17,7 @@ describe('Api Filter Schema', () => {
17
17
  });
18
18
  it('calls API getList() method at fetchSelected()', () => {
19
19
  const idsList = [1];
20
- const expectedParams = { size: 1, ids: [1] };
20
+ const expectedParams = { size: 1, id: [1] };
21
21
  const filter = new ApiFilterSchema({ API: APIMock });
22
22
  filter.fetchSelected(idsList);
23
23
  expect(APIMock).toHaveBeenCalledWith(expectedParams);
@@ -132,6 +132,10 @@ const applicationsAccess = (value = true) => ({
132
132
  _enabled: value,
133
133
  _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.EMAIL_PROFILES}`,
134
134
  },
135
+ [AdminSections.IMPORT_CSV]: {
136
+ _enabled: value,
137
+ _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.IMPORT_CSV}`,
138
+ },
135
139
  [AdminSections.ROLES]: {
136
140
  _enabled: value,
137
141
  _locale: `WebitelApplications.${WebitelApplications.ADMIN}.sections.${AdminSections.ROLES}`,
@@ -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 = {};