@webitel/ui-sdk 3.2.76 → 3.2.78
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
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<wt-button
|
|
16
16
|
color="secondary"
|
|
17
17
|
:disabled="isDeleting"
|
|
18
|
-
@click="
|
|
18
|
+
@click="close"
|
|
19
19
|
>{{ $t('reusable.cancel') }}
|
|
20
20
|
</wt-button>
|
|
21
21
|
<wt-button
|
|
@@ -44,8 +44,6 @@ const props = defineProps({
|
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
const emit = defineEmits([
|
|
47
|
-
'confirm',
|
|
48
|
-
'cancel',
|
|
49
47
|
'close',
|
|
50
48
|
]);
|
|
51
49
|
|
|
@@ -76,18 +74,12 @@ function close() {
|
|
|
76
74
|
async function confirm() {
|
|
77
75
|
try {
|
|
78
76
|
isDeleting.value = true;
|
|
79
|
-
emit('confirm');
|
|
80
77
|
await props.callback();
|
|
78
|
+
close();
|
|
81
79
|
} finally {
|
|
82
80
|
isDeleting.value = false;
|
|
83
|
-
close();
|
|
84
81
|
}
|
|
85
82
|
}
|
|
86
|
-
|
|
87
|
-
function cancel() {
|
|
88
|
-
emit('cancel');
|
|
89
|
-
close();
|
|
90
|
-
}
|
|
91
83
|
</script>
|
|
92
84
|
|
|
93
85
|
<style scoped>
|
|
@@ -5,18 +5,18 @@ export const useDeleteConfirmationPopup = () => {
|
|
|
5
5
|
const isVisible = ref(false);
|
|
6
6
|
const deleteCount = ref(null);
|
|
7
7
|
const deleteCallback = ref(null);
|
|
8
|
-
const
|
|
8
|
+
const deletedItems = ref(null);
|
|
9
9
|
|
|
10
10
|
function askDeleteConfirmation({ deleted, callback }) {
|
|
11
11
|
if (Array.isArray(deleted)) deleteCount.value = deleted.length;
|
|
12
12
|
else deleteCount.value = 1;
|
|
13
13
|
isVisible.value = true;
|
|
14
14
|
deleteCallback.value = callback;
|
|
15
|
-
|
|
15
|
+
deletedItems.value = deleted;
|
|
16
16
|
}
|
|
17
17
|
|
|
18
18
|
function confirmDelete() {
|
|
19
|
-
return deleteCallback.value(
|
|
19
|
+
return deleteCallback.value(deletedItems.value);
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
function closeDelete() {
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import BaseStoreModule from './BaseStoreModule';
|
|
2
2
|
|
|
3
|
+
const getParentIdFromContext = ({ state, getters }) => (
|
|
4
|
+
getters.PARENT_ID || state.parentId
|
|
5
|
+
);
|
|
6
|
+
|
|
3
7
|
export default class ApiStoreModule extends BaseStoreModule {
|
|
4
8
|
generateAPIActions(api) {
|
|
5
9
|
if (!api) throw new ReferenceError('pass API module!');
|
|
@@ -7,34 +11,61 @@ export default class ApiStoreModule extends BaseStoreModule {
|
|
|
7
11
|
.GET_LIST = (
|
|
8
12
|
_,
|
|
9
13
|
{ context: callerContext = {}, params = {} },
|
|
10
|
-
) => api.getList({
|
|
14
|
+
) => api.getList({
|
|
15
|
+
...callerContext.state,
|
|
16
|
+
parentId: getParentIdFromContext(callerContext),
|
|
17
|
+
...params,
|
|
18
|
+
});
|
|
11
19
|
this.actions
|
|
12
20
|
.GET_ITEM = (
|
|
13
21
|
_,
|
|
14
22
|
{ context: callerContext = {}, params = {} } = {},
|
|
15
|
-
) => api.get({
|
|
23
|
+
) => api.get({
|
|
24
|
+
...callerContext.state,
|
|
25
|
+
parentId: getParentIdFromContext(callerContext),
|
|
26
|
+
...params,
|
|
27
|
+
});
|
|
16
28
|
this.actions
|
|
17
29
|
.POST_ITEM = (
|
|
18
30
|
_,
|
|
19
31
|
{ context: callerContext = {}, ...rest } = {},
|
|
20
|
-
) => api.add({
|
|
32
|
+
) => api.add({
|
|
33
|
+
...callerContext.state,
|
|
34
|
+
parentId: getParentIdFromContext(callerContext),
|
|
35
|
+
...rest,
|
|
36
|
+
});
|
|
21
37
|
this.actions
|
|
22
38
|
.PATCH_ITEM = (
|
|
23
39
|
_,
|
|
24
40
|
{ context: callerContext = {}, id, changes, ...rest },
|
|
25
41
|
) => (
|
|
26
|
-
api.patch({
|
|
42
|
+
api.patch({
|
|
43
|
+
...callerContext.state,
|
|
44
|
+
...rest,
|
|
45
|
+
parentId: getParentIdFromContext(callerContext),
|
|
46
|
+
id,
|
|
47
|
+
changes,
|
|
48
|
+
})
|
|
27
49
|
);
|
|
28
50
|
this.actions
|
|
29
51
|
.UPD_ITEM = (
|
|
30
52
|
_,
|
|
31
53
|
{ context: callerContext = {}, ...rest } = {},
|
|
32
|
-
) => api.update({
|
|
54
|
+
) => api.update({
|
|
55
|
+
...callerContext.state,
|
|
56
|
+
parentId: getParentIdFromContext(callerContext),
|
|
57
|
+
...rest,
|
|
58
|
+
});
|
|
33
59
|
this.actions
|
|
34
60
|
.DELETE_ITEM = (
|
|
35
61
|
_,
|
|
36
62
|
{ context: callerContext = {}, id, ...rest },
|
|
37
|
-
) => api.delete({
|
|
63
|
+
) => api.delete({
|
|
64
|
+
...callerContext.state,
|
|
65
|
+
parentId: getParentIdFromContext(callerContext),
|
|
66
|
+
...rest,
|
|
67
|
+
id,
|
|
68
|
+
});
|
|
38
69
|
return this;
|
|
39
70
|
}
|
|
40
71
|
}
|