@dative-gpi/foundation-core-components 1.1.4 → 1.1.5
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/components/entities/FSBaseEntitiesList.vue +4 -0
- package/components/entities/FSSelectEntitiesList.vue +24 -1
- package/components/entities/FSSimpleEntitiesList.vue +14 -0
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +66 -1
- package/components/lists/groupings/FSBaseGroupingsList.vue +2 -14
- package/components/lists/groupings/FSSimpleGroupingsList.vue +44 -0
- package/components/lists/groups/FSSimpleGroupsList.vue +1 -0
- package/components/lists/subgroupings/FSBaseSubgroupingsList.vue +195 -0
- package/components/lists/subgroupings/FSSimpleSubgroupingsList.vue +45 -0
- package/components/lists/subgroupings/FSSubgroupingsChipGroup.vue +54 -0
- package/components/lists/userOrganisations/{FSChipUserOrganisationsList.vue → FSUserOrganisationsChipGroup.vue} +2 -2
- package/package.json +7 -7
- package/utils/tables.ts +2 -0
|
@@ -47,6 +47,10 @@ export default defineComponent({
|
|
|
47
47
|
return defineAsyncComponent(() => import("../lists/locations/FSBaseLocationsList.vue"));
|
|
48
48
|
case EntityType.Model:
|
|
49
49
|
return defineAsyncComponent(() => import("../lists/models/FSBaseModelsList.vue"));
|
|
50
|
+
case EntityType.Grouping:
|
|
51
|
+
return defineAsyncComponent(() => import("../lists/groupings/FSBaseGroupingsList.vue"));
|
|
52
|
+
case EntityType.Subgrouping:
|
|
53
|
+
return defineAsyncComponent(() => import("../lists/subgroupings/FSBaseSubgroupingsList.vue"));
|
|
50
54
|
default:
|
|
51
55
|
return null;
|
|
52
56
|
};
|
|
@@ -42,6 +42,7 @@
|
|
|
42
42
|
:singleSelect="$props.singleSelect"
|
|
43
43
|
:entity-type="$props.entityType"
|
|
44
44
|
:tableCode="tableCode"
|
|
45
|
+
:selectable="true"
|
|
45
46
|
:modelValue="$props.modelValue"
|
|
46
47
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
47
48
|
v-bind="baseTableAttrs"
|
|
@@ -64,7 +65,7 @@
|
|
|
64
65
|
import { defineComponent, type PropType, computed } from "vue";
|
|
65
66
|
|
|
66
67
|
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
67
|
-
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DashboardShallowFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
68
|
+
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DashboardShallowFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, GroupingFilters, LocationFilters, ModelFilters, SubgroupingFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
68
69
|
|
|
69
70
|
import { TABLES as T } from "../../utils";
|
|
70
71
|
|
|
@@ -147,6 +148,14 @@ export default defineComponent({
|
|
|
147
148
|
return {
|
|
148
149
|
modelsIds: props.modelValue
|
|
149
150
|
} satisfies ModelFilters;
|
|
151
|
+
case EntityType.Grouping:
|
|
152
|
+
return {
|
|
153
|
+
groupingsIds: props.modelValue
|
|
154
|
+
} satisfies GroupingFilters;
|
|
155
|
+
case EntityType.Subgrouping:
|
|
156
|
+
return {
|
|
157
|
+
subgroupingsIds: props.modelValue
|
|
158
|
+
} satisfies SubgroupingFilters;
|
|
150
159
|
default:
|
|
151
160
|
return undefined;
|
|
152
161
|
};
|
|
@@ -164,6 +173,10 @@ export default defineComponent({
|
|
|
164
173
|
return T.LOCATIONS_SELECT;
|
|
165
174
|
case EntityType.Model:
|
|
166
175
|
return T.MODELS_SELECT;
|
|
176
|
+
case EntityType.Grouping:
|
|
177
|
+
return T.GROUPINGS_SELECT;
|
|
178
|
+
case EntityType.Subgrouping:
|
|
179
|
+
return T.SUBGROUPINGS_SELECT;
|
|
167
180
|
default:
|
|
168
181
|
return null;
|
|
169
182
|
};
|
|
@@ -208,6 +221,16 @@ export default defineComponent({
|
|
|
208
221
|
modelsFilters: props.filters,
|
|
209
222
|
...attrs
|
|
210
223
|
};
|
|
224
|
+
case EntityType.Grouping:
|
|
225
|
+
return {
|
|
226
|
+
groupingsFilters: props.filters,
|
|
227
|
+
...attrs
|
|
228
|
+
};
|
|
229
|
+
case EntityType.Subgrouping:
|
|
230
|
+
return {
|
|
231
|
+
subgroupingFilters: props.filters,
|
|
232
|
+
...attrs
|
|
233
|
+
};
|
|
211
234
|
default:
|
|
212
235
|
return null;
|
|
213
236
|
};
|
|
@@ -43,6 +43,10 @@ export default defineComponent({
|
|
|
43
43
|
return defineAsyncComponent(() => import("../lists/locations/FSSimpleLocationsList.vue"));
|
|
44
44
|
case EntityType.Model:
|
|
45
45
|
return defineAsyncComponent(() => import("../lists/models/FSSimpleModelsList.vue"));
|
|
46
|
+
case EntityType.Subgrouping:
|
|
47
|
+
return defineAsyncComponent(() => import("../lists/subgroupings/FSSimpleSubgroupingsList.vue"));
|
|
48
|
+
case EntityType.Grouping:
|
|
49
|
+
return defineAsyncComponent(() => import("../lists/groupings/FSSimpleGroupingsList.vue"));
|
|
46
50
|
default:
|
|
47
51
|
return null;
|
|
48
52
|
};
|
|
@@ -87,6 +91,16 @@ export default defineComponent({
|
|
|
87
91
|
...attrs,
|
|
88
92
|
modelFilters : props.filters
|
|
89
93
|
};
|
|
94
|
+
case EntityType.Grouping:
|
|
95
|
+
return {
|
|
96
|
+
...attrs,
|
|
97
|
+
groupingFilters : props.filters
|
|
98
|
+
};
|
|
99
|
+
case EntityType.Subgrouping:
|
|
100
|
+
return {
|
|
101
|
+
...attrs,
|
|
102
|
+
subgroupingFilters : props.filters
|
|
103
|
+
};
|
|
90
104
|
default:
|
|
91
105
|
return null;
|
|
92
106
|
}
|
|
@@ -115,6 +115,29 @@
|
|
|
115
115
|
{{ item.ownerAddress ? item.ownerAddress.formattedAddress : '' }}
|
|
116
116
|
</FSSpan>
|
|
117
117
|
</template>
|
|
118
|
+
<template
|
|
119
|
+
#item.subgroupings="{ item }"
|
|
120
|
+
>
|
|
121
|
+
<FSSubgroupingsChipGroup
|
|
122
|
+
:subgroupings="item.subgroupings"
|
|
123
|
+
/>
|
|
124
|
+
</template>
|
|
125
|
+
<template
|
|
126
|
+
#filter.subgroupings-custom="{ filter, toggle, variant }"
|
|
127
|
+
>
|
|
128
|
+
<FSSubgroupingChip
|
|
129
|
+
v-if="filter.value && subgroupingMap[filter.value]"
|
|
130
|
+
width="100%"
|
|
131
|
+
:groupingLabel="subgroupingMap[filter.value].groupingLabel"
|
|
132
|
+
:groupingIcon="subgroupingMap[filter.value].groupingIcon"
|
|
133
|
+
:groupingColor="subgroupingMap[filter.value].groupingColor"
|
|
134
|
+
:label="subgroupingMap[filter.value].label"
|
|
135
|
+
:icon="subgroupingMap[filter.value].icon"
|
|
136
|
+
:color="'primary'"
|
|
137
|
+
:variant="variant"
|
|
138
|
+
@click="toggle()"
|
|
139
|
+
/>
|
|
140
|
+
</template>
|
|
118
141
|
<template
|
|
119
142
|
#item.actions="{ item }"
|
|
120
143
|
>
|
|
@@ -188,15 +211,19 @@ import FSDeviceOrganisationTileUI from "@dative-gpi/foundation-shared-components
|
|
|
188
211
|
import FSStatusesCarousel from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSStatusesCarousel.vue";
|
|
189
212
|
import FSConnectivity from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSConnectivity.vue";
|
|
190
213
|
import FSWorstAlert from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSWorstAlert.vue";
|
|
214
|
+
import FSSubgroupingChip from "@dative-gpi/foundation-shared-components/components/FSSubgroupingChip.vue";
|
|
191
215
|
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
192
216
|
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
193
217
|
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
194
218
|
import FSSpan from '@dative-gpi/foundation-shared-components/components/FSSpan.vue';
|
|
219
|
+
import FSSubgroupingsChipGroup from "../subgroupings/FSSubgroupingsChipGroup.vue";
|
|
195
220
|
|
|
196
221
|
export default defineComponent({
|
|
197
222
|
name: "FSBaseDeviceOrganisationsList",
|
|
198
223
|
components: {
|
|
199
224
|
FSDeviceOrganisationTileUI,
|
|
225
|
+
FSSubgroupingsChipGroup,
|
|
226
|
+
FSSubgroupingChip,
|
|
200
227
|
FSStatusesCarousel,
|
|
201
228
|
FSConnectivity,
|
|
202
229
|
FSWorstAlert,
|
|
@@ -261,7 +288,33 @@ export default defineComponent({
|
|
|
261
288
|
return entities.value;
|
|
262
289
|
});
|
|
263
290
|
|
|
264
|
-
const
|
|
291
|
+
const subgroupingFilters = computed(() => {
|
|
292
|
+
const filters: { value: string | null, text: string }[] = [{
|
|
293
|
+
value: null,
|
|
294
|
+
text: "—"
|
|
295
|
+
}];
|
|
296
|
+
|
|
297
|
+
const uniqueSubgroupings = _.uniqBy(
|
|
298
|
+
entities.value.flatMap(device => device.subgroupings),
|
|
299
|
+
'id'
|
|
300
|
+
);
|
|
301
|
+
|
|
302
|
+
filters.push(...uniqueSubgroupings.map(subgrouping => ({
|
|
303
|
+
value: subgrouping.id,
|
|
304
|
+
text: `${subgrouping.groupingLabel} - ${subgrouping.label}`
|
|
305
|
+
})));
|
|
306
|
+
|
|
307
|
+
return filters.sort((a, b) => a.text.localeCompare(b.text));
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
const subgroupingMap = computed(() => {
|
|
311
|
+
return _.chain(entities.value)
|
|
312
|
+
.flatMap(device => device.subgroupings)
|
|
313
|
+
.keyBy('id')
|
|
314
|
+
.value();
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const headersOptions = computed((): Record<string, any> => ({
|
|
265
318
|
status: {
|
|
266
319
|
fixedFilters: [{
|
|
267
320
|
value: true,
|
|
@@ -339,6 +392,17 @@ export default defineComponent({
|
|
|
339
392
|
},
|
|
340
393
|
sort: (a: DeviceOrganisationAlert, b: DeviceOrganisationAlert) => alphanumericSort(a?.criticity, b?.criticity)
|
|
341
394
|
},
|
|
395
|
+
subgroupings: {
|
|
396
|
+
|
|
397
|
+
fixedFilters: subgroupingFilters.value,
|
|
398
|
+
methodFilterRaw: (value: string | null, item: DeviceOrganisationInfos) => {
|
|
399
|
+
if (!value) {
|
|
400
|
+
return item.subgroupings.length === 0;
|
|
401
|
+
}
|
|
402
|
+
return item.subgroupings.some(s => s.id === value);
|
|
403
|
+
},
|
|
404
|
+
sort: (a: any[], b: any[]) => a.length - b.length
|
|
405
|
+
},
|
|
342
406
|
...customProperties.value.reduce((acc, cp) => ({
|
|
343
407
|
...acc,
|
|
344
408
|
[`meta.${cp.code}`]: {
|
|
@@ -382,6 +446,7 @@ export default defineComponent({
|
|
|
382
446
|
deviceOrganisations,
|
|
383
447
|
ConnectivityStatus,
|
|
384
448
|
customProperties,
|
|
449
|
+
subgroupingMap,
|
|
385
450
|
headersOptions,
|
|
386
451
|
isSelected
|
|
387
452
|
};
|
|
@@ -2,12 +2,10 @@
|
|
|
2
2
|
<FSDataTable
|
|
3
3
|
defaultMode="iterator"
|
|
4
4
|
:loading="fetchingGroupings"
|
|
5
|
+
:singleSelect="$props.singleSelect"
|
|
6
|
+
:selectable="$props.selectable"
|
|
5
7
|
:items="groupings"
|
|
6
8
|
:itemTo="$props.itemTo"
|
|
7
|
-
:selectable="$props.selectable"
|
|
8
|
-
:showSearch="$props.showSearch"
|
|
9
|
-
:singleSelect="$props.singleSelect"
|
|
10
|
-
:disableTable="$props.disableTable"
|
|
11
9
|
:modelValue="$props.modelValue"
|
|
12
10
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
13
11
|
v-bind="$attrs"
|
|
@@ -94,16 +92,6 @@ export default defineComponent({
|
|
|
94
92
|
required: false,
|
|
95
93
|
default: () => []
|
|
96
94
|
},
|
|
97
|
-
showSearch: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
required: false,
|
|
100
|
-
default: false
|
|
101
|
-
},
|
|
102
|
-
disableTable: {
|
|
103
|
-
type: Boolean,
|
|
104
|
-
required: false,
|
|
105
|
-
default: true
|
|
106
|
-
}
|
|
107
95
|
},
|
|
108
96
|
emits: ["update:modelValue"],
|
|
109
97
|
setup(props) {
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSSimpleList
|
|
3
|
+
:items="groupings"
|
|
4
|
+
:loading="fetching"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent, type PropType, watch } from "vue";
|
|
11
|
+
|
|
12
|
+
import type { GroupingFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
13
|
+
import { useGroupings } from "@dative-gpi/foundation-core-services/composables";
|
|
14
|
+
|
|
15
|
+
import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSSimpleGroupingsList",
|
|
19
|
+
components: {
|
|
20
|
+
FSSimpleList,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
groupingFilters: {
|
|
24
|
+
type: Object as PropType<GroupingFilters>,
|
|
25
|
+
required: false,
|
|
26
|
+
default: () => ({})
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
setup(props) {
|
|
30
|
+
const { entities: groupings, getMany, fetching } = useGroupings();
|
|
31
|
+
|
|
32
|
+
const fetch = () => {
|
|
33
|
+
getMany(props.groupingFilters);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
watch(() => props.groupingFilters, fetch, { immediate: true });
|
|
37
|
+
|
|
38
|
+
return {
|
|
39
|
+
groupings,
|
|
40
|
+
fetching
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
</script>
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
:loading="fetchingSubgroupings"
|
|
4
|
+
:items="subgroupings"
|
|
5
|
+
:itemTo="$props.itemTo"
|
|
6
|
+
:tableCode="$props.tableCode"
|
|
7
|
+
:selectable="$props.selectable"
|
|
8
|
+
:showSearch="$props.showSearch"
|
|
9
|
+
:disableIterator="true"
|
|
10
|
+
:singleSelect="$props.singleSelect"
|
|
11
|
+
:groupBy="groupBy"
|
|
12
|
+
:modelValue="$props.modelValue"
|
|
13
|
+
@update:modelValue="$emit('update:modelValue', $event)"
|
|
14
|
+
v-bind="$attrs"
|
|
15
|
+
>
|
|
16
|
+
<template
|
|
17
|
+
v-for="(_, name) in $slots"
|
|
18
|
+
v-slot:[name]="slotData"
|
|
19
|
+
>
|
|
20
|
+
<slot
|
|
21
|
+
:name="name"
|
|
22
|
+
v-bind="slotData"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
<template
|
|
26
|
+
#group-header="{ item }"
|
|
27
|
+
>
|
|
28
|
+
<FSRow
|
|
29
|
+
height="54px"
|
|
30
|
+
align="center-left"
|
|
31
|
+
>
|
|
32
|
+
<FSCard
|
|
33
|
+
padding="16px 16px 16px 56px"
|
|
34
|
+
height="100%"
|
|
35
|
+
width="100%"
|
|
36
|
+
:borderRadius="0"
|
|
37
|
+
:variant="CardVariants.Full"
|
|
38
|
+
:color="getColors(ColorEnum.Light).base"
|
|
39
|
+
>
|
|
40
|
+
<FSGroupingChip
|
|
41
|
+
:label="getGroupingLabel(item.value)"
|
|
42
|
+
:iconColor="getGroupingColor(item.value)"
|
|
43
|
+
:icon="getGroupingIcon(item.value)"
|
|
44
|
+
/>
|
|
45
|
+
</FSCard>
|
|
46
|
+
</FSRow>
|
|
47
|
+
</template>
|
|
48
|
+
<template
|
|
49
|
+
#item.icon="{ item }"
|
|
50
|
+
>
|
|
51
|
+
<FSIcon>
|
|
52
|
+
{{ item.icon }}
|
|
53
|
+
</FSIcon>
|
|
54
|
+
</template>
|
|
55
|
+
<template
|
|
56
|
+
#item.tile="{ item, toggleSelect }"
|
|
57
|
+
>
|
|
58
|
+
<FSSubgroupingTileUI
|
|
59
|
+
:selectable="$props.selectable"
|
|
60
|
+
:modelValue="isSelected(item.id)"
|
|
61
|
+
:singleSelect="$props.singleSelect"
|
|
62
|
+
:deviceOrganisationsCount="item.deviceOrganisationsCount"
|
|
63
|
+
:label="item.label"
|
|
64
|
+
:icon="item.icon"
|
|
65
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
66
|
+
@update:modelValue="toggleSelect(item)"
|
|
67
|
+
/>
|
|
68
|
+
</template>
|
|
69
|
+
</FSDataTable>
|
|
70
|
+
</template>
|
|
71
|
+
|
|
72
|
+
<script lang="ts">
|
|
73
|
+
import { computed, defineComponent, type PropType, watch } from "vue";
|
|
74
|
+
import { type RouteLocation } from "vue-router";
|
|
75
|
+
import _ from "lodash";
|
|
76
|
+
|
|
77
|
+
import type { SubgroupingFilters, SubgroupingInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
78
|
+
import { useSubgroupings } from "@dative-gpi/foundation-core-services/composables";
|
|
79
|
+
|
|
80
|
+
import FSDataTable from "../FSDataTable.vue";
|
|
81
|
+
|
|
82
|
+
import FSSubgroupingTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSSubgroupingTileUI.vue";
|
|
83
|
+
import FSGroupingChip from "@dative-gpi/foundation-shared-components/components/FSGroupingChip.vue";
|
|
84
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
85
|
+
import FSCard from "@dative-gpi/foundation-shared-components/components/FSCard.vue";
|
|
86
|
+
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
87
|
+
|
|
88
|
+
import { ColorEnum, CardVariants } from "@dative-gpi/foundation-shared-components/models";
|
|
89
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
90
|
+
|
|
91
|
+
export default defineComponent({
|
|
92
|
+
name: "FSBaseSubgroupingsList",
|
|
93
|
+
components: {
|
|
94
|
+
FSSubgroupingTileUI,
|
|
95
|
+
FSGroupingChip,
|
|
96
|
+
FSDataTable,
|
|
97
|
+
FSIcon,
|
|
98
|
+
FSCard,
|
|
99
|
+
FSRow
|
|
100
|
+
},
|
|
101
|
+
props: {
|
|
102
|
+
tableCode: {
|
|
103
|
+
type: String as PropType<string | null>,
|
|
104
|
+
required: false,
|
|
105
|
+
default: null
|
|
106
|
+
},
|
|
107
|
+
itemTo: {
|
|
108
|
+
type: Function as PropType<(item: SubgroupingInfos) => Partial<RouteLocation>>,
|
|
109
|
+
required: false
|
|
110
|
+
},
|
|
111
|
+
subgroupingFilters: {
|
|
112
|
+
type: Object as PropType<SubgroupingFilters>,
|
|
113
|
+
required: false,
|
|
114
|
+
default: null
|
|
115
|
+
},
|
|
116
|
+
selectable: {
|
|
117
|
+
type: Boolean,
|
|
118
|
+
required: false,
|
|
119
|
+
default: true
|
|
120
|
+
},
|
|
121
|
+
singleSelect: {
|
|
122
|
+
type: Boolean,
|
|
123
|
+
required: false,
|
|
124
|
+
default: false
|
|
125
|
+
},
|
|
126
|
+
showSearch: {
|
|
127
|
+
type: Boolean,
|
|
128
|
+
required: false,
|
|
129
|
+
default: true
|
|
130
|
+
},
|
|
131
|
+
modelValue: {
|
|
132
|
+
type: Array as PropType<string[]>,
|
|
133
|
+
required: false,
|
|
134
|
+
default: () => []
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
inheritAttrs: false,
|
|
138
|
+
emits: ["update:modelValue"],
|
|
139
|
+
setup(props) {
|
|
140
|
+
const { getMany: fetchSubgroupings, fetching: fetchingSubgroupings, entities: subgroupings } = useSubgroupings();
|
|
141
|
+
const { getColors } = useColors();
|
|
142
|
+
|
|
143
|
+
const groupBy = computed(() => ({
|
|
144
|
+
key: "groupingId",
|
|
145
|
+
order: "asc" as const
|
|
146
|
+
}));
|
|
147
|
+
|
|
148
|
+
const groupingMap = computed(() => {
|
|
149
|
+
return _.chain(subgroupings.value)
|
|
150
|
+
.keyBy('groupingId')
|
|
151
|
+
.mapValues(s => ({
|
|
152
|
+
label: s.groupingLabel,
|
|
153
|
+
color: s.groupingColor,
|
|
154
|
+
icon: s.groupingIcon
|
|
155
|
+
}))
|
|
156
|
+
.value();
|
|
157
|
+
});
|
|
158
|
+
|
|
159
|
+
const getGroupingLabel = (groupingId: string): string => {
|
|
160
|
+
return groupingMap.value[groupingId].label;
|
|
161
|
+
};
|
|
162
|
+
|
|
163
|
+
const getGroupingColor = (groupingId: string): string => {
|
|
164
|
+
return groupingMap.value[groupingId].color;
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const getGroupingIcon = (groupingId: string): string => {
|
|
168
|
+
return groupingMap.value[groupingId].icon;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const isSelected = (id: string) => {
|
|
172
|
+
return props.modelValue.includes(id);
|
|
173
|
+
};
|
|
174
|
+
|
|
175
|
+
watch(() => props.subgroupingFilters, (next, previous) => {
|
|
176
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
177
|
+
fetchSubgroupings(props.subgroupingFilters);
|
|
178
|
+
}
|
|
179
|
+
}, { immediate: true });
|
|
180
|
+
|
|
181
|
+
return {
|
|
182
|
+
fetchingSubgroupings,
|
|
183
|
+
getGroupingLabel,
|
|
184
|
+
getGroupingColor,
|
|
185
|
+
getGroupingIcon,
|
|
186
|
+
subgroupings,
|
|
187
|
+
CardVariants,
|
|
188
|
+
isSelected,
|
|
189
|
+
getColors,
|
|
190
|
+
ColorEnum,
|
|
191
|
+
groupBy,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
</script>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSSimpleList
|
|
3
|
+
:items="subgroupings"
|
|
4
|
+
:loading="fetching"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent, type PropType, watch } from "vue";
|
|
11
|
+
|
|
12
|
+
import type { SubgroupingFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
13
|
+
import { useSubgroupings } from "@dative-gpi/foundation-core-services/composables";
|
|
14
|
+
|
|
15
|
+
import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSSimpleSubgroupingsList",
|
|
19
|
+
components: {
|
|
20
|
+
FSSimpleList,
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
subgroupingFilters: {
|
|
24
|
+
type: Object as PropType<SubgroupingFilters>,
|
|
25
|
+
required: false,
|
|
26
|
+
default: () => ({})
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
inheritAttrs: false,
|
|
30
|
+
setup(props) {
|
|
31
|
+
const { entities: subgroupings, getMany, fetching } = useSubgroupings();
|
|
32
|
+
|
|
33
|
+
const fetch = () => {
|
|
34
|
+
getMany(props.subgroupingFilters);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
watch(() => props.subgroupingFilters, fetch, { immediate: true });
|
|
38
|
+
|
|
39
|
+
return {
|
|
40
|
+
subgroupings,
|
|
41
|
+
fetching
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
</script>
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSChipGroup
|
|
3
|
+
v-if="$props.subgroupings && $props.subgroupings.length > 0"
|
|
4
|
+
:items="$props.subgroupings"
|
|
5
|
+
:maxItems="$props.maxItems"
|
|
6
|
+
>
|
|
7
|
+
<template
|
|
8
|
+
#item.chip="{ item }"
|
|
9
|
+
>
|
|
10
|
+
<FSSubgroupingChip
|
|
11
|
+
:groupingLabel="item.groupingLabel"
|
|
12
|
+
:groupingIcon="item.groupingIcon"
|
|
13
|
+
:groupingColor="item.groupingColor"
|
|
14
|
+
:label="item.label"
|
|
15
|
+
:icon="item.icon"
|
|
16
|
+
:to="$props.itemTo ? $props.itemTo(item) : null"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
</FSChipGroup>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import type { PropType} from "vue";
|
|
24
|
+
import { defineComponent } from "vue";
|
|
25
|
+
import { type RouteLocation } from "vue-router";
|
|
26
|
+
|
|
27
|
+
import type { SubgroupingInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
28
|
+
|
|
29
|
+
import FSSubgroupingChip from "@dative-gpi/foundation-shared-components/components/FSSubgroupingChip.vue";
|
|
30
|
+
import FSChipGroup from "@dative-gpi/foundation-shared-components/components/FSChipGroup.vue";
|
|
31
|
+
|
|
32
|
+
export default defineComponent({
|
|
33
|
+
name: "FSSubgroupingsChipGroup",
|
|
34
|
+
components: {
|
|
35
|
+
FSSubgroupingChip,
|
|
36
|
+
FSChipGroup
|
|
37
|
+
},
|
|
38
|
+
props: {
|
|
39
|
+
subgroupings: {
|
|
40
|
+
type: Array as PropType<SubgroupingInfos[]>,
|
|
41
|
+
required: true
|
|
42
|
+
},
|
|
43
|
+
itemTo: {
|
|
44
|
+
type: Function as PropType<(item: SubgroupingInfos) => Partial<RouteLocation>>,
|
|
45
|
+
required: false
|
|
46
|
+
},
|
|
47
|
+
maxItems: {
|
|
48
|
+
type: Number as PropType<number | null>,
|
|
49
|
+
required: false,
|
|
50
|
+
default: 1
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
</script>
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<FSChipGroup
|
|
13
13
|
v-else
|
|
14
14
|
:color="ColorEnum.Light"
|
|
15
|
-
:
|
|
15
|
+
:items="userOrganisations?.map(u => u.name)"
|
|
16
16
|
v-bind="$attrs"
|
|
17
17
|
/>
|
|
18
18
|
</template>
|
|
@@ -28,7 +28,7 @@ import FSLoader from "@dative-gpi/foundation-shared-components/components/FSLoad
|
|
|
28
28
|
import FSChipGroup from "@dative-gpi/foundation-shared-components/components/FSChipGroup.vue";
|
|
29
29
|
|
|
30
30
|
export default defineComponent({
|
|
31
|
-
name: "
|
|
31
|
+
name: "FSUserOrganisationsChipGroup",
|
|
32
32
|
components: {
|
|
33
33
|
FSChipGroup,
|
|
34
34
|
FSLoader,
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"url": "https://github.com/Dative-GPI/foundation-shared-ui.git"
|
|
5
5
|
},
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"version": "1.1.
|
|
7
|
+
"version": "1.1.5",
|
|
8
8
|
"description": "",
|
|
9
9
|
"publishConfig": {
|
|
10
10
|
"access": "public"
|
|
@@ -13,11 +13,11 @@
|
|
|
13
13
|
"author": "",
|
|
14
14
|
"license": "ISC",
|
|
15
15
|
"dependencies": {
|
|
16
|
-
"@dative-gpi/foundation-core-domain": "1.1.
|
|
17
|
-
"@dative-gpi/foundation-core-services": "1.1.
|
|
18
|
-
"@dative-gpi/foundation-shared-components": "1.1.
|
|
19
|
-
"@dative-gpi/foundation-shared-domain": "1.1.
|
|
20
|
-
"@dative-gpi/foundation-shared-services": "1.1.
|
|
16
|
+
"@dative-gpi/foundation-core-domain": "1.1.5",
|
|
17
|
+
"@dative-gpi/foundation-core-services": "1.1.5",
|
|
18
|
+
"@dative-gpi/foundation-shared-components": "1.1.5",
|
|
19
|
+
"@dative-gpi/foundation-shared-domain": "1.1.5",
|
|
20
|
+
"@dative-gpi/foundation-shared-services": "1.1.5"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"sass": "1.71.1",
|
|
30
30
|
"sass-loader": "13.3.2"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "6b5102bcda554056f4d0fa0fba7e5a5e8f24e91e"
|
|
33
33
|
}
|
package/utils/tables.ts
CHANGED
|
@@ -22,6 +22,8 @@ export const GROUPS_SELECT = "ui.tables.group.select";
|
|
|
22
22
|
export const LOCATIONS_SELECT = "ui.tables.location.select";
|
|
23
23
|
export const MODELS_SELECT = "ui.tables.model.select";
|
|
24
24
|
export const DASHBOARDS_SELECT = "ui.tables.dashboard-mock.select";
|
|
25
|
+
export const GROUPINGS_SELECT = "ui.tables.grouping.select";
|
|
26
|
+
export const SUBGROUPINGS_SELECT = "ui.tables.subgrouping.select";
|
|
25
27
|
|
|
26
28
|
export const WIDGET_DASHBOARDS_EXPLORER = "ui.tables.folder-mock.widget";
|
|
27
29
|
|