@webitel/ui-sdk 3.2.75 → 3.2.77

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.75",
3
+ "version": "3.2.77",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -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 deleted = ref(null);
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
- deleted.value = deleted;
15
+ deletedItems.value = deleted;
16
16
  }
17
17
 
18
18
  function confirmDelete() {
19
- return deleteCallback.value(deleted.value);
19
+ return deleteCallback.value(deletedItems.value);
20
20
  }
21
21
 
22
22
  function closeDelete() {
@@ -148,9 +148,9 @@ export default class TableStoreModule extends BaseStoreModule {
148
148
  await context.dispatch('LOAD_DATA_LIST');
149
149
  }
150
150
  },
151
- DELETE_SINGLE: async (context, { id }) => {
151
+ DELETE_SINGLE: async (context, { id, etag }) => {
152
152
  try {
153
- await context.dispatch('api/DELETE_ITEM', { context, id });
153
+ await context.dispatch('api/DELETE_ITEM', { context, id, etag });
154
154
  } catch (err) {
155
155
  throw err;
156
156
  }
@@ -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({ ...callerContext.state, ...params });
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({ ...callerContext.state, ...params });
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({ ...callerContext.state, ...rest });
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({ ...callerContext.state, ...rest, id, changes })
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({ ...callerContext.state, ...rest });
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({ ...callerContext.state, ...rest, id });
63
+ ) => api.delete({
64
+ ...callerContext.state,
65
+ parentId: getParentIdFromContext(callerContext),
66
+ ...rest,
67
+ id,
68
+ });
38
69
  return this;
39
70
  }
40
71
  }