@webitel/ui-sdk 3.2.86 → 3.2.88

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": "3.2.86",
3
+ "version": "3.2.88",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -40,6 +40,7 @@
40
40
  "deep-copy": "^1.4.2",
41
41
  "deep-equal": "^2.0.3",
42
42
  "file-saver": "^2.0.2",
43
+ "is-valid-domain": "^0.1.6",
43
44
  "jszip": "^3.5.0",
44
45
  "jszip-utils": "^0.1.0",
45
46
  "node-polyfill-webpack-plugin": "^1.1.4",
@@ -245,6 +245,7 @@ export default {
245
245
  minLength: 'Quantity of characters should not be less than',
246
246
  url: 'Should look like url',
247
247
  regExpValidator: 'This regular expression is not valid',
248
+ domainValidator: 'Incorrect domain',
248
249
  },
249
250
  webitelUI: {
250
251
  searchBar: {
@@ -242,6 +242,7 @@ export default {
242
242
  minLength: 'Количество символов не должно быть меньше, чем',
243
243
  url: 'Необходимо ввести корректный url-адрес',
244
244
  regExpValidator: 'Не правильное регулярное выражение',
245
+ domainValidator: 'Неправильный домен',
245
246
  },
246
247
  webitelUI: {
247
248
  searchBar: {
@@ -242,6 +242,7 @@ export default {
242
242
  minLength: 'Кількість символів повинна бути не меншою, ніж',
243
243
  url: 'Необхідно ввести правильну url-адресу',
244
244
  regExpValidator: 'Не правильний регулярний вираз',
245
+ domainValidator: 'Невірний домен',
245
246
  },
246
247
  webitelUI: {
247
248
  searchBar: {
@@ -32,6 +32,7 @@ export default {
32
32
  else if (this.v.url?.$invalid) validationText = `${this.$t('validation.url')}`;
33
33
  else if (this.v.regExpValidator?.$invalid) validationText = `${this.$t('validation.regExpValidator')}`;
34
34
  else if (this.v.sameAs?.$invalid) validationText = `${this.$t('validation.sameAs')}`;
35
+ else if (this.v.domainValidator?.$invalid) validationText = `${this.$t('validation.domainValidator')}`;
35
36
  }
36
37
  // eslint-disable-next-line no-restricted-syntax
37
38
  for (const { name, text } of this.customValidators) {
@@ -2,12 +2,11 @@ import { mount } from '@vue/test-utils';
2
2
  import { ref } from 'vue';
3
3
  import AuditForm from '../audit-form.vue';
4
4
  import { generateQuestionSchema } from '../../schemas/AuditFormQuestionSchema';
5
-
6
5
  import {
7
6
  useDestroyableSortable,
8
- } from '../../composables/useDestroyableSortable';
7
+ } from '../../../../composables/useDestroyableSortable/useDestroyableSortable';
9
8
 
10
- jest.mock('../../composables/useDestroyableSortable');
9
+ jest.mock('../../../../composables/useDestroyableSortable/useDestroyableSortable');
11
10
 
12
11
  useDestroyableSortable.mockImplementation(() => ({ reloadSortable: ref(false) }));
13
12
 
@@ -37,7 +37,7 @@ import {
37
37
  reactive, nextTick,
38
38
  } from 'vue';
39
39
  import { useVuelidate } from '@vuelidate/core';
40
- import { useDestroyableSortable } from '../composables/useDestroyableSortable';
40
+ import { useDestroyableSortable } from '../../../composables/useDestroyableSortable/useDestroyableSortable';
41
41
  import AuditFormQuestion from './audit-form-question.vue';
42
42
  import WtButton from '../../../components/atoms/wt-button/wt-button.vue';
43
43
  import { generateQuestionSchema } from '../schemas/AuditFormQuestionSchema';
@@ -0,0 +1,5 @@
1
+ import isValidDomain from 'is-valid-domain';
2
+
3
+ const domainValidator = (value) => isValidDomain(value);
4
+
5
+ export default domainValidator;
@@ -1,66 +0,0 @@
1
- import Sortable from 'sortablejs';
2
- import {
3
- ref,
4
- nextTick,
5
- onMounted,
6
- onUnmounted,
7
- } from 'vue';
8
-
9
- /**
10
- * @param elRef
11
- * @param options
12
- * @returns {{reloadSortable: Ref<UnwrapRef<boolean>>}}
13
- *
14
- * @description initializes Sortable on passed element ref and reinitializes it after each reorder
15
- *
16
- * WHY TO REINITIALIZE SORTABLE AFTER EACH ARRAY REORDER?
17
- * Sortable and Vue both changing DOM so that there are collisions
18
- * because both Vue and Sortable try to put element to the position. So element is put incorrectly.
19
- *
20
- * There are 2 vue packages for sortable (vue 2 and vue 3), but I had encountered issues when tried to use them.
21
- * Also, it seems to me that they aren't supported now :(
22
- *
23
- * So that I decided to reinitialize Sortable each time order changes to represent it correctly.
24
- * Bad decision, but I haven't come up with a better one
25
- */
26
-
27
- // eslint-disable-next-line import/prefer-default-export
28
- export function useDestroyableSortable(elRef, options) {
29
- let sortable = null;
30
-
31
- const reloadSortable = ref(false);
32
-
33
- function destroySortable() {
34
- return sortable.destroy();
35
- }
36
-
37
- function initSortable() {
38
- const replaceSortable = async () => {
39
- if (!sortable) return;
40
- destroySortable();
41
- reloadSortable.value = true;
42
- await nextTick();
43
- reloadSortable.value = false;
44
- await nextTick();
45
- initSortable();
46
- };
47
-
48
- sortable = Sortable.create(elRef.value, {
49
- ...options,
50
- onEnd: async (e) => {
51
- if (options.onEnd) options.onEnd(e);
52
- await replaceSortable();
53
- },
54
- });
55
- }
56
-
57
- onMounted(() => {
58
- initSortable();
59
- });
60
-
61
- onUnmounted(() => {
62
- destroySortable();
63
- });
64
-
65
- return { reloadSortable };
66
- }