@dative-gpi/foundation-core-components 1.0.63 → 1.0.64

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.
@@ -29,6 +29,7 @@ import { computed, defineComponent, onUnmounted, type PropType, watch } from "vu
29
29
 
30
30
  import { useUserOrganisationTable, useUpdateUserOrganisationTable, useDataTables } from "@dative-gpi/foundation-core-services/composables";
31
31
  import { useDebounce, useTables } from "@dative-gpi/foundation-shared-components/composables";
32
+ import { type FSDataTableColumn } from "@dative-gpi/foundation-shared-components/models";
32
33
 
33
34
  import FSLoadDataTable from "@dative-gpi/foundation-shared-components/components/lists/FSLoadDataTable.vue";
34
35
  import FSDataTableUI from "@dative-gpi/foundation-shared-components/components/lists/FSDataTableUI.vue";
@@ -49,13 +50,8 @@ export default defineComponent({
49
50
  required: false,
50
51
  default: 1000
51
52
  },
52
- customSorts: {
53
- type: Object as PropType<{ [key: string]: any }>,
54
- required: false,
55
- default: () => ({})
56
- },
57
- customSortRaws: {
58
- type: Object as PropType<{ [key: string]: any }>,
53
+ headersOptions: {
54
+ type: Object as PropType<{ [key: string]: Partial<FSDataTableColumn> }>,
59
55
  required: false,
60
56
  default: () => ({})
61
57
  }
@@ -67,7 +63,7 @@ export default defineComponent({
67
63
  const { getTable, setTable } = useTables();
68
64
  const { debounce, cancel } = useDebounce();
69
65
 
70
- const computedTable = computed(() => computeTable(props.customSorts, props.customSortRaws));
66
+ const computedTable = computed(() => computeTable(props.headersOptions));
71
67
 
72
68
  onUnmounted(() => {
73
69
  cancel();
@@ -1,10 +1,10 @@
1
1
  <template>
2
2
  <FSDataTable
3
- :items="deviceOrganisations"
4
- :customSorts="customSorts"
5
- :itemTo="$props.itemTo"
6
3
  :loading="fetchingDeviceOrganisations"
4
+ :headersOptions="headersOptions"
7
5
  :tableCode="$props.tableCode"
6
+ :items="deviceOrganisations"
7
+ :itemTo="$props.itemTo"
8
8
  :modelValue="$props.modelValue"
9
9
  @update:modelValue="$emit('update:modelValue', $event)"
10
10
  v-bind="$attrs"
@@ -87,6 +87,9 @@
87
87
  :deviceAlerts="item.alerts"
88
88
  :alertTo="$props.alertTo"
89
89
  />
90
+ <div
91
+ v-else
92
+ />
90
93
  </template>
91
94
  <template
92
95
  #item.alerts="{ item }"
@@ -97,6 +100,9 @@
97
100
  :deviceAlerts="item.alerts"
98
101
  :alertTo="$props.alertTo"
99
102
  />
103
+ <div
104
+ v-else
105
+ />
100
106
  </template>
101
107
  <template
102
108
  #item.status="{ item }"
@@ -146,16 +152,15 @@
146
152
  </template>
147
153
 
148
154
  <script lang="ts">
149
- import type { PropType} from "vue";
150
- import type { RouteLocation } from "vue-router";
151
- import { computed, defineComponent, onMounted, watch } from "vue";
155
+ import { computed, defineComponent, onMounted, type PropType, watch } from "vue";
156
+ import { type RouteLocation } from "vue-router";
152
157
  import _ from "lodash";
153
158
 
154
- import { alphanumericSort } from "@dative-gpi/foundation-shared-components/utils";
159
+ import { alphanumericSort, connectivityLabel } from "@dative-gpi/foundation-shared-components/utils";
155
160
  import { ConnectivityStatus, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
156
161
 
157
162
  import { useCustomProperties, useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
158
- import type { DeviceConnectivityDetails, DeviceOrganisationFilters, DeviceOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
163
+ import type { DeviceConnectivityDetails, DeviceOrganisationAlert, DeviceOrganisationFilters, DeviceOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
159
164
 
160
165
  import FSDataTable from "../FSDataTable.vue";
161
166
  import FSMetaValue from "../../customProperties/FSMetaValue.vue";
@@ -228,17 +233,61 @@ export default defineComponent({
228
233
  }
229
234
  return entities.value;
230
235
  });
231
-
232
- const customSorts = computed(() => {
233
- return {
234
- connectable: (a:DeviceConnectivityDetails, b:DeviceConnectivityDetails) => {
235
- return alphanumericSort(a?.status, b?.status);
236
- },
237
- connectivity: (a:DeviceConnectivityDetails, b:DeviceConnectivityDetails) => {
238
- return alphanumericSort(a?.status, b?.status);
239
- }
240
- }
241
- });
236
+
237
+ const headersOptions = computed(() => ({
238
+ connectable: {
239
+ fixedFilters: [{
240
+ value: ConnectivityStatus.None,
241
+ text: "—"
242
+ }, {
243
+ value: ConnectivityStatus.Offline,
244
+ text: connectivityLabel(ConnectivityStatus.Offline)
245
+ }, {
246
+ value: ConnectivityStatus.AlmostOffline,
247
+ text: connectivityLabel(ConnectivityStatus.AlmostOffline)
248
+ }, {
249
+ value: ConnectivityStatus.PartiallyConnected,
250
+ text: connectivityLabel(ConnectivityStatus.PartiallyConnected)
251
+ }, {
252
+ value: ConnectivityStatus.Connected,
253
+ text: connectivityLabel(ConnectivityStatus.Connected)
254
+ }],
255
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => !item.status && !value || item.status == value,
256
+ sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
257
+ },
258
+ connectivity: {
259
+ fixedFilters: [{
260
+ value: ConnectivityStatus.None,
261
+ text: "—"
262
+ }, {
263
+ value: ConnectivityStatus.Offline,
264
+ text: connectivityLabel(ConnectivityStatus.Offline)
265
+ }, {
266
+ value: ConnectivityStatus.AlmostOffline,
267
+ text: connectivityLabel(ConnectivityStatus.AlmostOffline)
268
+ }, {
269
+ value: ConnectivityStatus.PartiallyConnected,
270
+ text: connectivityLabel(ConnectivityStatus.PartiallyConnected)
271
+ }, {
272
+ value: ConnectivityStatus.Connected,
273
+ text: connectivityLabel(ConnectivityStatus.Connected)
274
+ }],
275
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => !item.status && !value || item.status == value,
276
+ sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
277
+ },
278
+ worstAlert: {
279
+ sort: (a: DeviceOrganisationAlert, b: DeviceOrganisationAlert) => alphanumericSort(a?.criticity, b?.criticity)
280
+ },
281
+ // ...customProperties.value.reduce((acc, cp) => ({
282
+ // ...acc,
283
+ // [`meta.${cp.code}`]: {
284
+ // innerValue: (item: DeviceOrganisationInfos) => {
285
+ // return item
286
+ // },
287
+ // sort: (a: string, b: string) => alphanumericSort(a, b)
288
+ // }
289
+ // }), {})
290
+ }));
242
291
 
243
292
  const isSelected = (id: string): boolean => {
244
293
  return props.modelValue.includes(id);
@@ -262,7 +311,7 @@ export default defineComponent({
262
311
  deviceOrganisations,
263
312
  ConnectivityStatus,
264
313
  customProperties,
265
- customSorts,
314
+ headersOptions,
266
315
  isSelected
267
316
  };
268
317
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@dative-gpi/foundation-core-components",
3
3
  "sideEffects": false,
4
- "version": "1.0.63",
4
+ "version": "1.0.64",
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": "1.0.63",
14
- "@dative-gpi/foundation-core-services": "1.0.63",
15
- "@dative-gpi/foundation-shared-components": "1.0.63",
16
- "@dative-gpi/foundation-shared-domain": "1.0.63",
17
- "@dative-gpi/foundation-shared-services": "1.0.63"
13
+ "@dative-gpi/foundation-core-domain": "1.0.64",
14
+ "@dative-gpi/foundation-core-services": "1.0.64",
15
+ "@dative-gpi/foundation-shared-components": "1.0.64",
16
+ "@dative-gpi/foundation-shared-domain": "1.0.64",
17
+ "@dative-gpi/foundation-shared-services": "1.0.64"
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": "b2fbfec30ab5c2f3edeaddbc7eed0d3c98fe71c4"
29
+ "gitHead": "2774a6e01e85f2b27b543f3fdd91a9370b95fbee"
30
30
  }