@webitel/ui-sdk 3.1.31 → 3.1.32

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.1.31",
3
+ "version": "3.1.32",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -22,6 +22,7 @@ export default {
22
22
  ok: 'Ok',
23
23
  save: 'Save',
24
24
  saveAs: 'SaveAs',
25
+ saved: 'Saved',
25
26
  close: 'Close',
26
27
  add: 'Add',
27
28
  cancel: 'Cancel',
@@ -22,6 +22,7 @@ export default {
22
22
  ok: 'Ок',
23
23
  save: 'Сохранить',
24
24
  saveAs: 'Сохранить как нового',
25
+ saved: 'Сохранено',
25
26
  close: 'Закрыть',
26
27
  add: 'Добавить',
27
28
  cancel: 'Отменить',
@@ -22,6 +22,7 @@ export default {
22
22
  ok: 'Ок',
23
23
  save: 'Зберегти',
24
24
  saveAs: 'Зберігти як нового',
25
+ saved: 'Збережено',
25
26
  close: 'Закрити',
26
27
  add: 'Додати',
27
28
  cancel: 'Відмінити',
@@ -10,16 +10,18 @@ export const useTableStore = (namespace) => {
10
10
 
11
11
  const dataList = computed(() => getNamespacedState(store.state, tableNamespace).dataList);
12
12
 
13
- const isLoaded = computed(() => getNamespacedState(store.state, tableNamespace).isLoading);
13
+ const isLoading = computed(() => getNamespacedState(store.state, tableNamespace).isLoading);
14
14
 
15
15
  const headers = computed(() => getNamespacedState(store.state, tableNamespace).headers);
16
16
 
17
- const isNext = computed(() => getNamespacedState(store.state, tableNamespace).isNext);
17
+ const isNext = computed(() => getNamespacedState(store.state, tableNamespace).isNextPage);
18
18
 
19
19
  const page = computed(() => getNamespacedState(store.state, tableNamespace).page);
20
20
 
21
21
  const size = computed(() => getNamespacedState(store.state, tableNamespace).size);
22
22
 
23
+ const search = computed(() => getNamespacedState(store.state, tableNamespace).search);
24
+
23
25
  async function loadData() {
24
26
  return store.dispatch(`${tableNamespace}/LOAD_DATA_LIST`);
25
27
  }
@@ -29,7 +31,7 @@ export const useTableStore = (namespace) => {
29
31
  }
30
32
 
31
33
  async function nextPage() {
32
- return store.dispatch(`${tableNamespace}/SET_NEXT_PAGE`);
34
+ return store.dispatch(`${tableNamespace}/NEXT_PAGE`);
33
35
  }
34
36
 
35
37
  async function prevPage() {
@@ -40,8 +42,8 @@ export const useTableStore = (namespace) => {
40
42
  return store.dispatch(`${tableNamespace}/PATCH_ITEM_PROPERTY`, payload);
41
43
  }
42
44
 
43
- async function deleteItem(payload) {
44
- return store.dispatch(`${tableNamespace}/DELETE_ITEM`, payload);
45
+ async function deleteData(payload) {
46
+ return store.dispatch(`${tableNamespace}/DELETE`, payload);
45
47
  }
46
48
 
47
49
  async function sort(...params) {
@@ -55,21 +57,27 @@ export const useTableStore = (namespace) => {
55
57
  return store.dispatch(`${tableNamespace}/SET_HEADERS`, payload);
56
58
  }
57
59
 
60
+ async function setSearch(payload) {
61
+ return store.dispatch(`${tableNamespace}/SET_SEARCH`, payload);
62
+ }
63
+
58
64
  return {
59
65
  dataList,
60
- isLoaded,
66
+ isLoading,
61
67
  headers,
62
68
  isNext,
63
69
  page,
64
70
  size,
71
+ search,
65
72
 
66
73
  loadData,
67
74
  setSize,
68
75
  nextPage,
69
76
  prevPage,
70
77
  patchProperty,
71
- deleteItem,
78
+ deleteData,
72
79
  sort,
73
80
  setHeaders,
81
+ setSearch,
74
82
  };
75
83
  };
@@ -12,6 +12,7 @@ export default class TableStoreModule extends BaseStoreModule {
12
12
  search: '',
13
13
  page: 1,
14
14
  sort: '',
15
+ isLoading: false,
15
16
  isNextPage: false,
16
17
  };
17
18
 
@@ -23,6 +24,7 @@ export default class TableStoreModule extends BaseStoreModule {
23
24
  LOAD_DATA_LIST: async (context, _query) => {
24
25
  const query = { ...context.getters['filters/GET_FILTERS'], ..._query };
25
26
  try {
27
+ context.commit('SET_LOADING', true);
26
28
  let {
27
29
  items = [],
28
30
  next = false,
@@ -41,6 +43,8 @@ export default class TableStoreModule extends BaseStoreModule {
41
43
  context.dispatch('AFTER_SET_DATA_LIST_HOOK', afterHook);
42
44
  } catch (err) {
43
45
  console.error(err);
46
+ } finally {
47
+ context.commit('SET_LOADING', false);
44
48
  }
45
49
  },
46
50
  SET_SIZE: async (context, size) => {
@@ -168,9 +172,9 @@ export default class TableStoreModule extends BaseStoreModule {
168
172
  PATCH_ITEM_PROPERTY: (state, { index, prop, value }) => {
169
173
  state.dataList[index][prop] = value;
170
174
  },
171
- // REMOVE_ITEM: (state, index) => {
172
- // state.dataList.splice(index, 1);
173
- // },
175
+ SET_LOADING: (state, value) => {
176
+ state.isLoading = value;
177
+ },
174
178
  };
175
179
 
176
180
  constructor({ headers = [] }) {