@dative-gpi/foundation-core-services 1.0.80 → 1.0.82

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.
@@ -8,15 +8,19 @@ export const useDataTables = () => {
8
8
 
9
9
  const table = ref<FSDataTable>({
10
10
  headers: [],
11
- mode: "iterator",
11
+ mode: null,
12
12
  sortBy: null,
13
13
  rowsPerPage: 10,
14
14
  filters: {},
15
15
  page: 1
16
16
  });
17
17
 
18
- const computeTable = ((headersOptions: { [key: string]: Partial<FSDataTableColumn> }) => ({
18
+ const computeTable = (
19
+ headersOptions: { [key: string]: Partial<FSDataTableColumn> },
20
+ defaultMode: "table" | "iterator" = "table"
21
+ ) => ({
19
22
  ...table.value,
23
+ mode: table.value.mode ?? defaultMode,
20
24
  headers: table.value.headers.map(header => ({
21
25
  ...header,
22
26
  fixedFilters: (header.value && headersOptions[header.value] && headersOptions[header.value].fixedFilters) || null,
@@ -26,14 +30,15 @@ export const useDataTables = () => {
26
30
  sortRaw: (header.value && headersOptions[header.value] && headersOptions[header.value].sortRaw) || null ,
27
31
  innerValue: (header.value && headersOptions[header.value] && headersOptions[header.value].innerValue) || null
28
32
  }))
29
- }));
33
+ });
30
34
 
31
35
  const updateTable = (
32
36
  updateUserOrganisationTable: (id: string, payload: UpdateUserOrganisationTableDTO) => Promise<Ref<UserOrganisationTableDetails>>,
33
37
  setTable: (tableCode: string, value: FSDataTable) => void,
34
- tableCode: string
38
+ tableCode: string,
39
+ defaultMode: "table" | "iterator" = "table"
35
40
  ): void => {
36
- if (table.value) {
41
+ if (tableCode && table.value) {
37
42
  setTable(tableCode, table.value);
38
43
  updateUserOrganisationTable(tableCode, {
39
44
  columns: table.value.headers.map(column => ({
@@ -44,7 +49,7 @@ export const useDataTables = () => {
44
49
  rowsPerPage: table.value.rowsPerPage,
45
50
  sortByKey: table.value.sortBy?.key ?? null,
46
51
  sortByOrder: table.value.sortBy?.order ?? null,
47
- mode: table.value.mode
52
+ mode: table.value.mode ?? defaultMode
48
53
  });
49
54
  }
50
55
  };
@@ -70,18 +75,15 @@ export const useDataTables = () => {
70
75
  key: userOrganisationTable.value.sortByKey,
71
76
  order: userOrganisationTable.value.sortByOrder
72
77
  },
73
- mode: userOrganisationTable.value.mode,
78
+ mode: userOrganisationTable.value.mode ?? defaultMode,
74
79
  rowsPerPage: userOrganisationTable.value.rowsPerPage,
75
80
  filters: {},
76
81
  page: 1
77
82
  }
78
83
  }
79
- else {
80
- table.value.mode = defaultMode;
81
- }
82
84
  }
83
85
  catch {
84
- table.value.mode = defaultMode;
86
+ // Do nothing
85
87
  }
86
88
  }
87
89
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-services",
3
3
  "sideEffects": false,
4
- "version": "1.0.80",
4
+ "version": "1.0.82",
5
5
  "description": "",
6
6
  "publishConfig": {
7
7
  "access": "public"
@@ -10,7 +10,7 @@
10
10
  "author": "",
11
11
  "license": "ISC",
12
12
  "dependencies": {
13
- "@dative-gpi/foundation-core-domain": "1.0.80"
13
+ "@dative-gpi/foundation-core-domain": "1.0.82"
14
14
  },
15
15
  "peerDependencies": {
16
16
  "@dative-gpi/bones-ui": "^1.0.0",
@@ -18,5 +18,5 @@
18
18
  "vue": "^3.4.29",
19
19
  "vue-router": "^4.3.0"
20
20
  },
21
- "gitHead": "4a15362451742764c98999b9eace312e162cd193"
21
+ "gitHead": "f210728193cfa965fd7827c935319f80af51d9a0"
22
22
  }