@dative-gpi/foundation-core-components 0.0.188 → 0.0.190
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.
|
@@ -53,8 +53,8 @@ import type { PropType } from "vue";
|
|
|
53
53
|
import { computed, defineComponent } from "vue";
|
|
54
54
|
|
|
55
55
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
56
|
-
import { useLocations } from "@dative-gpi/foundation-
|
|
57
|
-
import type { LocationFilters } from "@dative-gpi/foundation-
|
|
56
|
+
import { useLocations } from "@dative-gpi/foundation-shared-services/composables";
|
|
57
|
+
import type { LocationFilters } from "@dative-gpi/foundation-shared-domain/models";
|
|
58
58
|
|
|
59
59
|
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
60
60
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
@@ -25,12 +25,10 @@
|
|
|
25
25
|
</template>
|
|
26
26
|
|
|
27
27
|
<script lang="ts">
|
|
28
|
-
import type
|
|
29
|
-
import { computed, defineComponent, onUnmounted, ref, watch } from "vue";
|
|
28
|
+
import { computed, defineComponent, onUnmounted, type PropType, watch } from "vue";
|
|
30
29
|
|
|
31
|
-
import { useUserOrganisationTable, useUpdateUserOrganisationTable } from "@dative-gpi/foundation-core-services/composables";
|
|
30
|
+
import { useUserOrganisationTable, useUpdateUserOrganisationTable, useDataTables } from "@dative-gpi/foundation-core-services/composables";
|
|
32
31
|
import { useDebounce, useTables } from "@dative-gpi/foundation-shared-components/composables";
|
|
33
|
-
import type { FSDataTable } from "@dative-gpi/foundation-shared-components/models";
|
|
34
32
|
|
|
35
33
|
import FSLoadDataTable from "@dative-gpi/foundation-shared-components/components/lists/FSLoadDataTable.vue";
|
|
36
34
|
import FSDataTableUI from "@dative-gpi/foundation-shared-components/components/lists/FSDataTableUI.vue";
|
|
@@ -63,87 +61,38 @@ export default defineComponent({
|
|
|
63
61
|
}
|
|
64
62
|
},
|
|
65
63
|
setup(props) {
|
|
66
|
-
const { get: getUserOrganisationTable, getting: gettingUserOrganisationTable
|
|
64
|
+
const { get: getUserOrganisationTable, getting: gettingUserOrganisationTable } = useUserOrganisationTable();
|
|
65
|
+
const { initialized, table, updateTable, computeTable, onTableCodeChange } = useDataTables();
|
|
67
66
|
const { update: updateUserOrganisationTable } = useUpdateUserOrganisationTable();
|
|
68
67
|
const { getTable, setTable } = useTables();
|
|
69
68
|
const { debounce, cancel } = useDebounce();
|
|
70
69
|
|
|
71
|
-
const
|
|
72
|
-
|
|
73
|
-
const table = ref<FSDataTable>({
|
|
74
|
-
headers: [],
|
|
75
|
-
mode: "table",
|
|
76
|
-
sortBy: null,
|
|
77
|
-
rowsPerPage: 10,
|
|
78
|
-
filters: {},
|
|
79
|
-
page: 1
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
const computedTable = computed(() => ({
|
|
83
|
-
...table.value,
|
|
84
|
-
headers: table.value.headers.map(header => ({
|
|
85
|
-
...header,
|
|
86
|
-
sort: header.value && props.customSorts[header.value] || null,
|
|
87
|
-
sortRaw: header.value && props.customSortRaws[header.value] || null
|
|
88
|
-
}))
|
|
89
|
-
}));
|
|
90
|
-
|
|
91
|
-
const updateTable = (): void => {
|
|
92
|
-
if (table.value) {
|
|
93
|
-
setTable(props.tableCode, table.value);
|
|
94
|
-
updateUserOrganisationTable(props.tableCode, {
|
|
95
|
-
columns: table.value.headers.map(column => ({
|
|
96
|
-
columnId: column.columnId,
|
|
97
|
-
hidden: column.hidden,
|
|
98
|
-
index: column.index
|
|
99
|
-
})),
|
|
100
|
-
rowsPerPage: table.value.rowsPerPage,
|
|
101
|
-
sortByKey: table.value.sortBy?.key ?? null,
|
|
102
|
-
sortByOrder: table.value.sortBy?.order ?? null,
|
|
103
|
-
mode: table.value.mode
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
70
|
+
const computedTable = computed(() => computeTable(props.customSorts, props.customSortRaws));
|
|
107
71
|
|
|
108
72
|
onUnmounted(() => {
|
|
109
73
|
cancel();
|
|
110
|
-
|
|
74
|
+
update();
|
|
111
75
|
});
|
|
112
76
|
|
|
77
|
+
const update = () => {
|
|
78
|
+
updateTable(
|
|
79
|
+
updateUserOrganisationTable,
|
|
80
|
+
setTable,
|
|
81
|
+
props.tableCode
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
|
|
113
85
|
watch(() => props.tableCode, async (): Promise<void> => {
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
else {
|
|
120
|
-
try {
|
|
121
|
-
await getUserOrganisationTable(props.tableCode);
|
|
122
|
-
}
|
|
123
|
-
catch {
|
|
124
|
-
// Do nothing
|
|
125
|
-
}
|
|
126
|
-
if (userOrganisationTable.value) {
|
|
127
|
-
table.value = {
|
|
128
|
-
headers: userOrganisationTable.value.columns,
|
|
129
|
-
sortBy: {
|
|
130
|
-
key: userOrganisationTable.value.sortByKey,
|
|
131
|
-
order: userOrganisationTable.value.sortByOrder
|
|
132
|
-
},
|
|
133
|
-
mode: userOrganisationTable.value.mode,
|
|
134
|
-
rowsPerPage: userOrganisationTable.value.rowsPerPage,
|
|
135
|
-
filters: {},
|
|
136
|
-
page: 1
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
initialized.value = true;
|
|
86
|
+
onTableCodeChange(
|
|
87
|
+
getUserOrganisationTable,
|
|
88
|
+
getTable,
|
|
89
|
+
props.tableCode
|
|
90
|
+
);
|
|
142
91
|
}, { immediate: true });
|
|
143
92
|
|
|
144
93
|
watch(() => table.value, () => {
|
|
145
94
|
if (table.value && initialized.value) {
|
|
146
|
-
debounce(
|
|
95
|
+
debounce(update, props.debounceTime);
|
|
147
96
|
}
|
|
148
97
|
}, { deep: true });
|
|
149
98
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.190",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-core-domain": "0.0.
|
|
14
|
-
"@dative-gpi/foundation-core-services": "0.0.
|
|
15
|
-
"@dative-gpi/foundation-shared-components": "0.0.
|
|
16
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
17
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "0.0.190",
|
|
14
|
+
"@dative-gpi/foundation-core-services": "0.0.190",
|
|
15
|
+
"@dative-gpi/foundation-shared-components": "0.0.190",
|
|
16
|
+
"@dative-gpi/foundation-shared-domain": "0.0.190",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "0.0.190"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@dative-gpi/bones-ui": "^0.0.75",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"sass": "1.71.1",
|
|
27
27
|
"sass-loader": "13.3.2"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "226125292c2f5ed27334b3bdee88b1877a9d9d6a"
|
|
30
30
|
}
|