@webitel/ui-sdk 24.10.70 → 24.10.71

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": "24.10.70",
3
+ "version": "24.10.71",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "dev": "vite",
@@ -150,7 +150,6 @@
150
150
  "postcss-prefix-selector": "^2.1.0",
151
151
  "prismjs": "^1.29.0",
152
152
  "sass": "^1.80.6",
153
- "tslib": "^2.8.1",
154
153
  "vite": "^5.4.11",
155
154
  "vite-plugin-node-polyfills": "^0.22.0",
156
155
  "vite-plugin-static-copy": "^2.1.0",
@@ -8,6 +8,7 @@ import WtButtonSelect from './wt-button-select/wt-button-select.vue';
8
8
  import WtButton from './wt-button/wt-button.vue';
9
9
  import WtCheckbox from './wt-checkbox/wt-checkbox.vue';
10
10
  import WtChip from './wt-chip/wt-chip.vue';
11
+ import WtConfirmDialog from './wt-confirm-dialog/wt-confirm-dialog.vue';
11
12
  import WtContextMenu from './wt-context-menu/wt-context-menu.vue';
12
13
  import WtCopyAction from './wt-copy-action/wt-copy-action.vue';
13
14
  import WtDatepicker from './wt-datepicker/wt-datepicker.vue';
@@ -76,6 +77,7 @@ const Components = {
76
77
  WtInputInfo,
77
78
  WtButton,
78
79
  WtChip,
80
+ WtConfirmDialog,
79
81
  WtDivider,
80
82
  WtTooltip,
81
83
  WtLabel,
@@ -0,0 +1,97 @@
1
+ <template>
2
+ <wt-popup
3
+ class="wt-confirm-dialog"
4
+ size="sm"
5
+ v-bind="attrs"
6
+ @close="close"
7
+ >
8
+ <template #title>
9
+ {{ title }}
10
+ </template>
11
+ <template #main>
12
+ <slot name="main">
13
+ <div class="wt-confirm-dialog__content">
14
+ <p class="wt-confirm-dialog__message">
15
+ {{ deleteMessage ? deleteMessage : $t('webitelUI.deleteConfirmationPopup.askingAlert', { subject }) }}
16
+ </p>
17
+ </div>
18
+ </slot>
19
+ </template>
20
+ <template #actions>
21
+ <slot name="actions" :isDeleting="isDeleting" :confirm="confirm" :close="close">
22
+ <wt-button
23
+ :disabled="isDeleting"
24
+ color="secondary"
25
+ @click="close"
26
+ >
27
+ {{ $t('reusable.cancel') }}
28
+ </wt-button>
29
+ <wt-button
30
+ :loading="isDeleting"
31
+ color="error"
32
+ @click="confirm"
33
+ >
34
+ {{ $t('reusable.delete') }}
35
+ </wt-button>
36
+ </slot>
37
+ </template>
38
+ </wt-popup>
39
+ </template>
40
+
41
+ <script setup>
42
+ import { ref, useAttrs } from 'vue';
43
+
44
+ const props = defineProps({
45
+ title: {
46
+ type: String,
47
+ required: true
48
+ },
49
+ deleteMessage: {
50
+ type: String,
51
+ default: '',
52
+ },
53
+ subject: {
54
+ type: String,
55
+ default: '',
56
+ },
57
+ callback: {
58
+ type: Function,
59
+ required: true,
60
+ },
61
+ });
62
+
63
+ const emit = defineEmits(['close', 'confirm']);
64
+
65
+ const attrs = useAttrs();
66
+
67
+ const isDeleting = ref(false);
68
+
69
+ function close() {
70
+ emit('close');
71
+ }
72
+
73
+ async function confirm() {
74
+ try {
75
+ isDeleting.value = true;
76
+
77
+ await props.callback()
78
+ close();
79
+ } finally {
80
+ isDeleting.value = false;
81
+ }
82
+ }
83
+ </script>
84
+
85
+ <style scoped>
86
+ .wt-confirm-dialog__content {
87
+ display: flex;
88
+ align-items: center;
89
+ flex-direction: column;
90
+ gap: var(--spacing-sm);
91
+ }
92
+
93
+ .wt-confirm-dialog__message {
94
+ text-align: center;
95
+ }
96
+
97
+ </style>
@@ -385,6 +385,8 @@ export default {
385
385
  deleteConfirmationPopup: {
386
386
  title: 'Confirm deletion',
387
387
  askingAlert:
388
+ 'Are you sure you want to delete {subject}? This action cannot be undone.',
389
+ tableAskingAlert:
388
390
  'Are you sure you want\n to delete {count} record? | Are you sure you want\n to delete {count} records?',
389
391
  deleteAll: 'ALL',
390
392
  },
@@ -383,6 +383,8 @@ export default {
383
383
  deleteConfirmationPopup: {
384
384
  title: 'Подтвердите удаление',
385
385
  askingAlert:
386
+ 'Вы уверены, что хотите удалить {subject}? Это действие не может быть отменено.',
387
+ tableAskingAlert:
386
388
  'Вы уверенны, что хотите\n удалить {count} запись? | Вы уверенны, что хотите\n удалить {count} записей?',
387
389
  deleteAll: 'ВСЕ',
388
390
  },
@@ -383,6 +383,8 @@ export default {
383
383
  deleteConfirmationPopup: {
384
384
  title: 'Підтвердіть видалення',
385
385
  askingAlert:
386
+ 'Ви впевнені, що хочете видалити {subject}? Ця дія не може бути скасована.',
387
+ tableAskingAlert:
386
388
  'Ви впевнені, що хочете\n видалити {count} запис? | Ви впевнені, що хочете\n видалити {count} записів?',
387
389
  deleteAll: 'ВСІ',
388
390
  },
@@ -1,13 +1,10 @@
1
1
  <template>
2
- <wt-popup
3
- class="delete-confirmation-popup"
4
- size="sm"
2
+ <wt-confirm-dialog
5
3
  v-bind="attrs"
6
- @close="close"
4
+ class="delete-confirmation-popup"
5
+ :title="$t('webitelUI.deleteConfirmationPopup.title')"
6
+ :callback="callback"
7
7
  >
8
- <template #title>
9
- {{ $t('webitelUI.deleteConfirmationPopup.title') }}
10
- </template>
11
8
  <template #main>
12
9
  <div class="delete-confirmation-popup__content">
13
10
  <wt-icon
@@ -19,7 +16,7 @@
19
16
  </p>
20
17
  </div>
21
18
  </template>
22
- <template #actions>
19
+ <template #actions="{ isDeleting, close, confirm}">
23
20
  <wt-button
24
21
  :loading="isDeleting"
25
22
  @click="confirm"
@@ -34,11 +31,11 @@
34
31
  {{ $t('vocabulary.no') }}
35
32
  </wt-button>
36
33
  </template>
37
- </wt-popup>
34
+ </wt-confirm-dialog>
38
35
  </template>
39
36
 
40
37
  <script setup>
41
- import { computed, ref, useAttrs } from 'vue';
38
+ import { computed, useAttrs } from 'vue';
42
39
  import { useI18n } from 'vue-i18n';
43
40
 
44
41
  const props = defineProps({
@@ -58,30 +55,14 @@ const attrs = useAttrs();
58
55
 
59
56
  const { t } = useI18n();
60
57
 
61
- const isDeleting = ref(false);
62
-
63
58
  const deleteMessage = computed(() => {
64
59
  if (props.deleteCount === 0) {
65
- return t('webitelUI.deleteConfirmationPopup.askingAlert', 2, null, {
60
+ return t('webitelUI.deleteConfirmationPopup.tableAskingAlert', 2, null, {
66
61
  count: t('webitelUI.deleteConfirmationPopup.deleteAll'),
67
62
  });
68
63
  }
69
- return t('webitelUI.deleteConfirmationPopup.askingAlert', { count: props.deleteCount }, null);
64
+ return t('webitelUI.deleteConfirmationPopup.tableAskingAlert', { count: props.deleteCount }, null);
70
65
  });
71
-
72
- function close() {
73
- emit('close');
74
- }
75
-
76
- async function confirm() {
77
- try {
78
- isDeleting.value = true;
79
- await props.callback();
80
- close();
81
- } finally {
82
- isDeleting.value = false;
83
- }
84
- }
85
66
  </script>
86
67
 
87
68
  <style scoped>
@@ -2,7 +2,6 @@ import { saveAs } from 'file-saver-es';
2
2
  import JSZip from 'jszip';
3
3
  import jszipUtils from 'jszip-utils';
4
4
  import path from 'path-browserify';
5
- import { _wtUiLog } from '../../scripts/logger.js';
6
5
  import generateMediaURL from './scripts/generateMediaURL.js';
7
6
 
8
7
  export default class FilesExport {
@@ -12,19 +11,16 @@ export default class FilesExport {
12
11
 
13
12
  isLoading = false;
14
13
 
15
- skipFilesWithError = false;
16
-
17
14
  downloadProgress = { count: 0 };
18
15
 
19
16
  zippingProgress = { percent: 0 };
20
17
 
21
18
  filesURL = generateMediaURL;
22
19
 
23
- constructor({ fetchMethod, filename, filesURL, skipFilesWithError = false }) {
20
+ constructor({ fetchMethod, filename, filesURL }) {
24
21
  if (fetchMethod) this.fetchMethod = fetchMethod;
25
22
  if (filename) this.filename = filename;
26
23
  if (filesURL) this.filesURL = filesURL;
27
- this.skipFilesWithError = skipFilesWithError;
28
24
  }
29
25
 
30
26
  _fetchFileBinary(fileId) {
@@ -50,23 +46,12 @@ export default class FilesExport {
50
46
  if (item.files) {
51
47
  await this._addFilesToZip(item.files, zip);
52
48
  } else {
53
- try {
54
- const binary = await this._fetchFileBinary(item.id);
55
- const ext = item.mimeType.split('/').pop();
56
- // itemName needed to remove extension from item.name https://stackoverflow.com/a/31615711
57
- const itemName = path.parse(item.name).name;
58
- zip.file(`${itemName}.${ext}`, binary);
59
- this.downloadProgress.count += 1;
60
- } catch (err) {
61
- debugger;
62
- _wtUiLog.error({ entity: 'script', module: 'FilesExport' })(
63
- `An error occurred while downloading a file id=${item.id}`,
64
- err,
65
- );
66
- if (!this.skipFilesWithError) {
67
- throw err;
68
- }
69
- }
49
+ const binary = await this._fetchFileBinary(item.id);
50
+ const ext = item.mimeType.split('/').pop();
51
+ // itemName needed to remove extension from item.name https://stackoverflow.com/a/31615711
52
+ const itemName = path.parse(item.name).name;
53
+ zip.file(`${itemName}.${ext}`, binary);
54
+ this.downloadProgress.count += 1;
70
55
  }
71
56
  }
72
57
  }
@@ -37,7 +37,6 @@ export default {
37
37
  },
38
38
 
39
39
  async exportFiles(files, reqParams = {}) {
40
- debugger;
41
40
  if (!this.FilesExport) throw new Error('FilesExport is not initialized');
42
41
  const exportFiles = files || this.getSelectedFiles();
43
42
  try {