@webitel/ui-sdk 3.1.23 → 3.1.25

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.23",
3
+ "version": "3.1.25",
4
4
  "private": false,
5
5
  "scripts": {
6
6
  "serve-lib": "vue-cli-service serve",
@@ -25,7 +25,10 @@
25
25
  class="wt-table-column-select__popup__item"
26
26
  @click.capture.prevent="col.show = !col.show"
27
27
  >
28
- <wt-checkbox v-model="col.show" :label="col.text" />
28
+ <wt-checkbox
29
+ v-model="col.show"
30
+ :label="shownColLabel(col)"
31
+ ></wt-checkbox>
29
32
  </li>
30
33
  </ul>
31
34
  </template>
@@ -81,19 +84,16 @@ export default {
81
84
  },
82
85
  computed: {
83
86
  changeableDraft() {
84
- return this.draft
85
- .filter((header) => !this.staticHeaders.includes(header.value))
86
- // we should modify original objects to that this.draft would change
87
- .forEach((header) => {
88
- if (!header.text && header.locale) {
89
- // eslint-disable-next-line no-param-reassign
90
- header.text = typeof header.locale === 'string' ? this.$t(header.locale) : this.$t(...header.locale);
91
- }
92
- return header;
93
- });
87
+ return this.draft.filter((header) => !this.staticHeaders.includes(header.value));
94
88
  },
95
89
  },
96
90
  methods: {
91
+ shownColLabel({ text, locale }) {
92
+ if (!text && locale) {
93
+ return typeof locale === 'string' ? this.$t(locale) : this.$t(...locale);
94
+ }
95
+ return text;
96
+ },
97
97
  openPopup() {
98
98
  this.isColumnSelectPopup = true;
99
99
  },
@@ -1,7 +1,6 @@
1
1
  import { computed } from 'vue';
2
2
  import { useStore } from 'vuex';
3
- import getNamespacedState
4
- from '@webitel/ui-sdk/src/store/helpers/getNamespacedState';
3
+ import getNamespacedState from '../../../store/helpers/getNamespacedState';
5
4
 
6
5
  // eslint-disable-next-line import/prefer-default-export
7
6
  export const useTableStore = (namespace) => {
@@ -22,31 +21,38 @@ export const useTableStore = (namespace) => {
22
21
  const size = computed(() => getNamespacedState(store.state, tableNamespace).size);
23
22
 
24
23
  async function loadData() {
25
- await store.dispatch(`${tableNamespace}/LOAD_DATA_LIST`);
24
+ return store.dispatch(`${tableNamespace}/LOAD_DATA_LIST`);
26
25
  }
27
26
 
28
27
  async function setSize(payload) {
29
- await store.dispatch(`${tableNamespace}/SET_SIZE`, payload);
28
+ return store.dispatch(`${tableNamespace}/SET_SIZE`, payload);
30
29
  }
31
30
 
32
31
  async function nextPage() {
33
- await store.dispatch(`${tableNamespace}/SET_NEXT_PAGE`);
32
+ return store.dispatch(`${tableNamespace}/SET_NEXT_PAGE`);
34
33
  }
35
34
 
36
35
  async function prevPage() {
37
- await store.dispatch(`${tableNamespace}/PREV_PAGE`);
36
+ return store.dispatch(`${tableNamespace}/PREV_PAGE`);
38
37
  }
39
38
 
40
39
  async function patchProperty(payload) {
41
- await store.dispatch(`${tableNamespace}/PATCH_ITEM_PROPERTY`, payload);
40
+ return store.dispatch(`${tableNamespace}/PATCH_ITEM_PROPERTY`, payload);
42
41
  }
43
42
 
44
43
  async function deleteItem(payload) {
45
- await store.dispatch(`${tableNamespace}/DELETE_ITEM`, payload);
44
+ return store.dispatch(`${tableNamespace}/DELETE_ITEM`, payload);
46
45
  }
47
46
 
48
47
  async function sort(...params) {
49
- await store.dispatch(`${tableNamespace}/SORT`, { header: params[0], nextSortOrder: params[1] });
48
+ return store.dispatch(`${tableNamespace}/SORT`, {
49
+ header: params[0],
50
+ nextSortOrder: params[1],
51
+ });
52
+ }
53
+
54
+ async function setHeaders(payload) {
55
+ return store.dispatch(`${tableNamespace}/SET_HEADERS`, payload);
50
56
  }
51
57
 
52
58
  return {
@@ -64,5 +70,6 @@ export const useTableStore = (namespace) => {
64
70
  patchProperty,
65
71
  deleteItem,
66
72
  sort,
73
+ setHeaders,
67
74
  };
68
75
  };