@webitel/ui-sdk 3.2.48 → 3.2.49
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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<wt-table-column-select
|
|
3
|
+
:headers="headers"
|
|
4
|
+
:static-headers="staticHeaders"
|
|
5
|
+
@change="handleChange"
|
|
6
|
+
></wt-table-column-select>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script setup>
|
|
10
|
+
import getNamespacedState from '@webitel/ui-sdk/src/store/helpers/getNamespacedState';
|
|
11
|
+
import { computed } from 'vue';
|
|
12
|
+
import { useStore } from 'vuex';
|
|
13
|
+
|
|
14
|
+
const props = defineProps({
|
|
15
|
+
namespace: {
|
|
16
|
+
type: String,
|
|
17
|
+
required: true,
|
|
18
|
+
},
|
|
19
|
+
headers: {
|
|
20
|
+
type: Array,
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
staticHeaders: {
|
|
24
|
+
type: Array,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const emit = defineEmits(
|
|
29
|
+
'change',
|
|
30
|
+
);
|
|
31
|
+
|
|
32
|
+
// const storedProp = 'value';
|
|
33
|
+
const filterQuery = 'fields';
|
|
34
|
+
|
|
35
|
+
const store = useStore();
|
|
36
|
+
|
|
37
|
+
const filterSchema = computed(() => getNamespacedState(store.state, props.namespace)[filterQuery]);
|
|
38
|
+
|
|
39
|
+
function setValue(payload) {
|
|
40
|
+
return store.dispatch(`${props.namespace}/SET_FILTER`, payload);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function setToLocalStorage({ value }) {
|
|
44
|
+
localStorage.setItem(filterSchema.value.localStorageKey, value);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function handleChange(headers) {
|
|
48
|
+
const value = headers.filter((item) => item.show).map(({ value }) => value);
|
|
49
|
+
const params = {
|
|
50
|
+
filter: filterQuery,
|
|
51
|
+
value,
|
|
52
|
+
};
|
|
53
|
+
setToLocalStorage(params);
|
|
54
|
+
setValue(params);
|
|
55
|
+
emit('change', headers);
|
|
56
|
+
}
|
|
57
|
+
</script>
|
|
58
|
+
|
|
59
|
+
<style scoped>
|
|
60
|
+
|
|
61
|
+
</style>
|