@dative-gpi/foundation-core-components 1.1.24-unit-formatter → 1.1.24-unit-formatter-1
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/autocompletes/FSAutocompleteDataCategory.vue +11 -2
- package/components/entities/FSBaseEntitiesList.vue +4 -0
- package/components/entities/FSEntityField.vue +11 -5
- package/components/entities/FSSelectEntitiesList.vue +35 -8
- package/components/entities/FSSimpleEntitiesList.vue +15 -2
- package/components/entities/FSTileEntitiesList.vue +1 -3
- package/components/explorers/FSBaseDashboardsExplorer.vue +312 -0
- package/components/explorers/FSDashboardExplorerElementTypeChip.vue +37 -0
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +7 -6
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +7 -6
- package/components/lists/charts/FSBaseChartsList.vue +7 -14
- package/components/lists/dashboards/FSBaseDashboardsList.vue +40 -224
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +27 -53
- package/components/lists/dashboards/FSTileDashboardsList.vue +30 -62
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +10 -8
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +10 -7
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +66 -1
- package/components/lists/folders/FSBaseFoldersList.vue +1 -5
- package/components/lists/groupings/FSBaseGroupingsList.vue +5 -17
- package/components/lists/groupings/FSSimpleGroupingsList.vue +44 -0
- package/components/lists/groupings/FSTileGroupingsList.vue +79 -0
- package/components/lists/groups/FSSimpleGroupsList.vue +1 -0
- package/components/lists/locations/FSBaseLocationsList.vue +3 -3
- package/components/lists/playlists/FSTilePlaylistsList.vue +93 -0
- package/components/lists/subgroupings/FSBaseSubgroupingsList.vue +197 -0
- package/components/lists/subgroupings/FSSimpleSubgroupingsList.vue +45 -0
- package/components/lists/subgroupings/FSSubgroupingsChipGroup.vue +61 -0
- package/components/lists/subgroupings/FSTileSubgroupingsList.vue +81 -0
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +21 -1
- package/components/lists/userOrganisations/{FSChipUserOrganisationsList.vue → FSUserOrganisationsChipGroup.vue} +2 -2
- package/components/tiles/FSGroupingTile.vue +67 -0
- package/components/tiles/FSLocationTile.vue +2 -1
- package/components/tiles/FSPlaylistTile.vue +78 -0
- package/components/tiles/FSSubgroupingTile.vue +69 -0
- package/package.json +8 -8
- package/utils/dashboards.ts +12 -30
- package/utils/tables.ts +13 -7
- package/utils/users.ts +1 -1
- package/components/explorers/FSBaseFoldersExplorer.vue +0 -337
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
5
5
|
:multiple="$props.multiple"
|
|
6
6
|
:placeholder="placeholder"
|
|
7
|
-
:items="
|
|
7
|
+
:items="items"
|
|
8
8
|
:loading="loading"
|
|
9
9
|
:modelValue="$props.modelValue"
|
|
10
10
|
@update:modelValue="onUpdate"
|
|
@@ -124,6 +124,15 @@ export default defineComponent({
|
|
|
124
124
|
return getManyDataCategories({ ...props.dataCategoriesFilters, search: search ?? undefined });
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
const items = computed(() => dataCategories.value.map((dataCategory) => {
|
|
128
|
+
const modelsLabel = dataCategory.models.map((m) => m.label).join(", ");
|
|
129
|
+
return {
|
|
130
|
+
id: dataCategory.id,
|
|
131
|
+
label: modelsLabel ? `${dataCategory.label} (${modelsLabel})` : dataCategory.label,
|
|
132
|
+
correlated: dataCategory.correlated
|
|
133
|
+
};
|
|
134
|
+
}));
|
|
135
|
+
|
|
127
136
|
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
128
137
|
dataCategories,
|
|
129
138
|
[() => props.dataCategoriesFilters],
|
|
@@ -132,7 +141,7 @@ export default defineComponent({
|
|
|
132
141
|
);
|
|
133
142
|
|
|
134
143
|
return {
|
|
135
|
-
|
|
144
|
+
items,
|
|
136
145
|
placeholder,
|
|
137
146
|
ColorEnum,
|
|
138
147
|
toggleSet,
|
|
@@ -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
|
};
|
|
@@ -41,7 +41,7 @@ import { defineComponent, ref, type PropType, computed } from "vue";
|
|
|
41
41
|
|
|
42
42
|
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
43
43
|
|
|
44
|
-
import type {
|
|
44
|
+
import type { DashboardExplorerElementFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, GroupingFilters, LocationFilters, ModelFilters, SubgroupingFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
45
45
|
|
|
46
46
|
import FSEntityFieldUI from "@dative-gpi/foundation-shared-components/components/fields/FSEntityFieldUI.vue";
|
|
47
47
|
|
|
@@ -138,10 +138,8 @@ export default defineComponent({
|
|
|
138
138
|
} satisfies DeviceOrganisationFilters;
|
|
139
139
|
case EntityType.Dashboard:
|
|
140
140
|
return {
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
dashboardShallowsIds: props.modelValue
|
|
144
|
-
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
|
|
141
|
+
dashboardExplorerElementsIds: props.modelValue,
|
|
142
|
+
} satisfies DashboardExplorerElementFilters;
|
|
145
143
|
case EntityType.Group:
|
|
146
144
|
return {
|
|
147
145
|
groupsIds: props.modelValue
|
|
@@ -162,6 +160,14 @@ export default defineComponent({
|
|
|
162
160
|
return {
|
|
163
161
|
modelsIds: props.modelValue
|
|
164
162
|
} satisfies ModelFilters;
|
|
163
|
+
case EntityType.Grouping:
|
|
164
|
+
return {
|
|
165
|
+
groupingsIds: props.modelValue
|
|
166
|
+
} satisfies GroupingFilters;
|
|
167
|
+
case EntityType.Subgrouping:
|
|
168
|
+
return {
|
|
169
|
+
subgroupingsIds: props.modelValue
|
|
170
|
+
} satisfies SubgroupingFilters;
|
|
165
171
|
default:
|
|
166
172
|
return undefined;
|
|
167
173
|
};
|
|
@@ -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 {
|
|
68
|
+
import type { DashboardExplorerElementFilters, 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
|
|
|
@@ -123,10 +124,8 @@ export default defineComponent({
|
|
|
123
124
|
} satisfies DeviceOrganisationFilters;
|
|
124
125
|
case EntityType.Dashboard:
|
|
125
126
|
return {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
dashboardShallowsIds: props.modelValue
|
|
129
|
-
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters & DashboardShallowFilters;
|
|
127
|
+
dashboardExplorerElementsIds: props.modelValue,
|
|
128
|
+
} satisfies DashboardExplorerElementFilters;
|
|
130
129
|
case EntityType.Group:
|
|
131
130
|
return {
|
|
132
131
|
groupsIds: props.modelValue
|
|
@@ -147,6 +146,14 @@ export default defineComponent({
|
|
|
147
146
|
return {
|
|
148
147
|
modelsIds: props.modelValue
|
|
149
148
|
} satisfies ModelFilters;
|
|
149
|
+
case EntityType.Grouping:
|
|
150
|
+
return {
|
|
151
|
+
groupingsIds: props.modelValue
|
|
152
|
+
} satisfies GroupingFilters;
|
|
153
|
+
case EntityType.Subgrouping:
|
|
154
|
+
return {
|
|
155
|
+
subgroupingsIds: props.modelValue
|
|
156
|
+
} satisfies SubgroupingFilters;
|
|
150
157
|
default:
|
|
151
158
|
return undefined;
|
|
152
159
|
};
|
|
@@ -156,6 +163,18 @@ export default defineComponent({
|
|
|
156
163
|
switch(props.entityType) {
|
|
157
164
|
case EntityType.Device:
|
|
158
165
|
return T.DEVICES_SELECT;
|
|
166
|
+
case EntityType.Dashboard:
|
|
167
|
+
return T.DASHBOARDS_SELECT;
|
|
168
|
+
case EntityType.Group:
|
|
169
|
+
return T.GROUPS_SELECT;
|
|
170
|
+
case EntityType.Location:
|
|
171
|
+
return T.LOCATIONS_SELECT;
|
|
172
|
+
case EntityType.Model:
|
|
173
|
+
return T.MODELS_SELECT;
|
|
174
|
+
case EntityType.Grouping:
|
|
175
|
+
return T.GROUPINGS_SELECT;
|
|
176
|
+
case EntityType.Subgrouping:
|
|
177
|
+
return T.SUBGROUPINGS_SELECT;
|
|
159
178
|
default:
|
|
160
179
|
return null;
|
|
161
180
|
};
|
|
@@ -170,9 +189,7 @@ export default defineComponent({
|
|
|
170
189
|
};
|
|
171
190
|
case EntityType.Dashboard:
|
|
172
191
|
return {
|
|
173
|
-
|
|
174
|
-
dashboardOrganisationsFilters: props.filters,
|
|
175
|
-
dashboardOrganisationTypeFetchFilter: props.filters,
|
|
192
|
+
dashboardExplorerElementsFilters: props.filters,
|
|
176
193
|
...attrs
|
|
177
194
|
};
|
|
178
195
|
case EntityType.Group:
|
|
@@ -200,6 +217,16 @@ export default defineComponent({
|
|
|
200
217
|
modelsFilters: props.filters,
|
|
201
218
|
...attrs
|
|
202
219
|
};
|
|
220
|
+
case EntityType.Grouping:
|
|
221
|
+
return {
|
|
222
|
+
groupingFilters: props.filters,
|
|
223
|
+
...attrs
|
|
224
|
+
};
|
|
225
|
+
case EntityType.Subgrouping:
|
|
226
|
+
return {
|
|
227
|
+
subgroupingFilters: props.filters,
|
|
228
|
+
...attrs
|
|
229
|
+
};
|
|
203
230
|
default:
|
|
204
231
|
return null;
|
|
205
232
|
};
|
|
@@ -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.Grouping:
|
|
47
|
+
return defineAsyncComponent(() => import("../lists/groupings/FSSimpleGroupingsList.vue"));
|
|
48
|
+
case EntityType.Subgrouping:
|
|
49
|
+
return defineAsyncComponent(() => import("../lists/subgroupings/FSSimpleSubgroupingsList.vue"));
|
|
46
50
|
default:
|
|
47
51
|
return null;
|
|
48
52
|
};
|
|
@@ -58,8 +62,7 @@ export default defineComponent({
|
|
|
58
62
|
case EntityType.Dashboard:
|
|
59
63
|
return {
|
|
60
64
|
...attrs,
|
|
61
|
-
|
|
62
|
-
dashboardOrganisationTypeFilters : props.filters
|
|
65
|
+
dashboardExplorerElementsFilters: props.filters
|
|
63
66
|
};
|
|
64
67
|
case EntityType.Folder:
|
|
65
68
|
return {
|
|
@@ -86,6 +89,16 @@ export default defineComponent({
|
|
|
86
89
|
...attrs,
|
|
87
90
|
modelFilters : props.filters
|
|
88
91
|
};
|
|
92
|
+
case EntityType.Grouping:
|
|
93
|
+
return {
|
|
94
|
+
...attrs,
|
|
95
|
+
groupingFilters : props.filters
|
|
96
|
+
};
|
|
97
|
+
case EntityType.Subgrouping:
|
|
98
|
+
return {
|
|
99
|
+
...attrs,
|
|
100
|
+
subgroupingFilters : props.filters
|
|
101
|
+
};
|
|
89
102
|
default:
|
|
90
103
|
return null;
|
|
91
104
|
}
|
|
@@ -55,9 +55,7 @@ export default defineComponent({
|
|
|
55
55
|
case EntityType.Dashboard:
|
|
56
56
|
return {
|
|
57
57
|
...attrs,
|
|
58
|
-
|
|
59
|
-
dashboardOrganisationTypeFilters : props.filters,
|
|
60
|
-
dashboardShallowFilters : props.filters
|
|
58
|
+
dashboardExplorerElementsFilters: props.filters
|
|
61
59
|
};
|
|
62
60
|
case EntityType.Folder:
|
|
63
61
|
return {
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
defaultMode="iterator"
|
|
4
|
+
:loading="fetchingDashboardExplorerElements"
|
|
5
|
+
:singleSelect="$props.singleSelect"
|
|
6
|
+
:items="dashboardExplorerElements"
|
|
7
|
+
:selectable="$props.selectable"
|
|
8
|
+
:tableCode="$props.tableCode"
|
|
9
|
+
:itemTo="$props.itemTo"
|
|
10
|
+
:noSearch="$props.recursiveSearch"
|
|
11
|
+
:headersOptions="headersOptions"
|
|
12
|
+
:modelValue="$props.modelValue"
|
|
13
|
+
@update:modelValue="onUpdate"
|
|
14
|
+
v-model:search="search"
|
|
15
|
+
v-bind="$attrs"
|
|
16
|
+
>
|
|
17
|
+
<template
|
|
18
|
+
v-for="(_, name) in $slots"
|
|
19
|
+
v-slot:[name]="slotData"
|
|
20
|
+
>
|
|
21
|
+
<slot
|
|
22
|
+
:name="name"
|
|
23
|
+
v-bind="slotData"
|
|
24
|
+
/>
|
|
25
|
+
</template>
|
|
26
|
+
<template
|
|
27
|
+
#header.imageId-title
|
|
28
|
+
>
|
|
29
|
+
<FSIcon>
|
|
30
|
+
mdi-panorama-variant-outline
|
|
31
|
+
</FSIcon>
|
|
32
|
+
</template>
|
|
33
|
+
<template
|
|
34
|
+
#item.imageId="{ item }"
|
|
35
|
+
>
|
|
36
|
+
<FSImage
|
|
37
|
+
v-if="item.imageId"
|
|
38
|
+
height="32px"
|
|
39
|
+
width="32px"
|
|
40
|
+
:imageId="item.imageId"
|
|
41
|
+
:thumbnail="true"
|
|
42
|
+
/>
|
|
43
|
+
</template>
|
|
44
|
+
<template
|
|
45
|
+
#item.tags="{ item }"
|
|
46
|
+
>
|
|
47
|
+
<FSTagGroup
|
|
48
|
+
variant="slide"
|
|
49
|
+
:showRemove="false"
|
|
50
|
+
:tags="item.tags"
|
|
51
|
+
/>
|
|
52
|
+
</template>
|
|
53
|
+
<template
|
|
54
|
+
#item.type="{ item }"
|
|
55
|
+
>
|
|
56
|
+
<FSDashboardExplorerElementTypeChip
|
|
57
|
+
:type="item.type"
|
|
58
|
+
/>
|
|
59
|
+
</template>
|
|
60
|
+
<template
|
|
61
|
+
#item.icon="{ item }"
|
|
62
|
+
>
|
|
63
|
+
<FSIcon>
|
|
64
|
+
{{ item.icon }}
|
|
65
|
+
</FSIcon>
|
|
66
|
+
</template>
|
|
67
|
+
<template
|
|
68
|
+
#item.locked="{ item }"
|
|
69
|
+
>
|
|
70
|
+
<FSIconCheck
|
|
71
|
+
v-if="item.locked != null"
|
|
72
|
+
:value="item.locked"
|
|
73
|
+
/>
|
|
74
|
+
</template>
|
|
75
|
+
<template
|
|
76
|
+
#item.tile="{ index, item, toggleSelect }"
|
|
77
|
+
>
|
|
78
|
+
<FSFolderTileUI
|
|
79
|
+
v-if="item.type === DashboardExplorerElementType.Folder"
|
|
80
|
+
:key="index"
|
|
81
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
82
|
+
:imageId="item.imageId"
|
|
83
|
+
:icon="item.icon"
|
|
84
|
+
:label="item.label"
|
|
85
|
+
:code="item.code"
|
|
86
|
+
:bottomColor="item.colors"
|
|
87
|
+
:recursiveFoldersIds="item.recursiveFoldersIds"
|
|
88
|
+
:recursiveDashboardOrganisationsIds="item.recursiveDashboardOrganisationsIds"
|
|
89
|
+
:recursiveDashboardShallowsIds="item.recursiveDashboardShallowsIds"
|
|
90
|
+
:modelValue="isSelected(item.id)"
|
|
91
|
+
:selectable="$props.selectable"
|
|
92
|
+
@update:modelValue="toggleSelect(item)"
|
|
93
|
+
/>
|
|
94
|
+
<FSDashboardOrganisationTileUI
|
|
95
|
+
v-if="item.type === DashboardExplorerElementType.DashboardOrganisation"
|
|
96
|
+
:key="index"
|
|
97
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
98
|
+
:bottomColor="item.colors"
|
|
99
|
+
:imageId="item.imageId"
|
|
100
|
+
:icon="item.icon"
|
|
101
|
+
:label="item.label"
|
|
102
|
+
:code="item.code"
|
|
103
|
+
:modelValue="isSelected(item.id)"
|
|
104
|
+
:selectable="$props.selectable"
|
|
105
|
+
@update:modelValue="toggleSelect(item)"
|
|
106
|
+
/>
|
|
107
|
+
<FSDashboardShallowTileUI
|
|
108
|
+
v-if="item.type === DashboardExplorerElementType.DashboardShallow"
|
|
109
|
+
:key="index"
|
|
110
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
111
|
+
:bottomColor="item.colors"
|
|
112
|
+
:imageId="item.imageId"
|
|
113
|
+
:icon="item.icon"
|
|
114
|
+
:label="item.label"
|
|
115
|
+
:code="item.code"
|
|
116
|
+
:modelValue="isSelected(item.id)"
|
|
117
|
+
:selectable="$props.selectable"
|
|
118
|
+
@update:modelValue="toggleSelect(item)"
|
|
119
|
+
/>
|
|
120
|
+
<FSDashboardOrganisationTypeTileUI
|
|
121
|
+
v-if="item.type === DashboardExplorerElementType.DashboardOrganisationType"
|
|
122
|
+
:key="index"
|
|
123
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
124
|
+
:bottomColor="item.colors"
|
|
125
|
+
:imageId="item.imageId"
|
|
126
|
+
:icon="item.icon"
|
|
127
|
+
:label="item.label"
|
|
128
|
+
:code="item.code"
|
|
129
|
+
:modelValue="isSelected(item.id)"
|
|
130
|
+
:selectable="$props.selectable"
|
|
131
|
+
@update:modelValue="toggleSelect(item)"
|
|
132
|
+
/>
|
|
133
|
+
</template>
|
|
134
|
+
</FSDataTable>
|
|
135
|
+
</template>
|
|
136
|
+
|
|
137
|
+
<script lang="ts">
|
|
138
|
+
import { computed, defineComponent, type PropType, ref, watch } from "vue";
|
|
139
|
+
import { type RouteLocation } from "vue-router";
|
|
140
|
+
import _ from "lodash";
|
|
141
|
+
|
|
142
|
+
import { DashboardExplorerElementType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
143
|
+
import { useDashboardExplorerElements } from "@dative-gpi/foundation-core-services/composables";
|
|
144
|
+
import { type DashboardExplorerElementInfos, type DashboardExplorerElementFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
145
|
+
import { dashboardExplorerElementTypeLabel } from "@dative-gpi/foundation-core-components/utils";
|
|
146
|
+
import { useDebounce } from "@dative-gpi/foundation-shared-components/composables";
|
|
147
|
+
|
|
148
|
+
import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
|
|
149
|
+
import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
|
|
150
|
+
import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
|
|
151
|
+
import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
|
|
152
|
+
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
153
|
+
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
154
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
155
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
156
|
+
|
|
157
|
+
import FSDashboardExplorerElementTypeChip from "./FSDashboardExplorerElementTypeChip.vue";
|
|
158
|
+
import FSDataTable from "../lists/FSDataTable.vue";
|
|
159
|
+
|
|
160
|
+
export default defineComponent({
|
|
161
|
+
name: "FSBaseDashboardsExplorer",
|
|
162
|
+
components: {
|
|
163
|
+
FSDashboardExplorerElementTypeChip,
|
|
164
|
+
FSDashboardOrganisationTypeTileUI,
|
|
165
|
+
FSDashboardOrganisationTileUI,
|
|
166
|
+
FSDashboardShallowTileUI,
|
|
167
|
+
FSFolderTileUI,
|
|
168
|
+
FSDataTable,
|
|
169
|
+
FSIconCheck,
|
|
170
|
+
FSTagGroup,
|
|
171
|
+
FSImage,
|
|
172
|
+
FSIcon
|
|
173
|
+
},
|
|
174
|
+
props: {
|
|
175
|
+
tableCode: {
|
|
176
|
+
type: String as PropType<string | null>,
|
|
177
|
+
required: false,
|
|
178
|
+
default: null
|
|
179
|
+
},
|
|
180
|
+
recursiveSearch: {
|
|
181
|
+
type: Boolean,
|
|
182
|
+
required: false,
|
|
183
|
+
default: true
|
|
184
|
+
},
|
|
185
|
+
parentId: {
|
|
186
|
+
type: String as PropType<string | null>,
|
|
187
|
+
required: false,
|
|
188
|
+
default: null
|
|
189
|
+
},
|
|
190
|
+
root: {
|
|
191
|
+
type: Boolean,
|
|
192
|
+
required: false,
|
|
193
|
+
default: true
|
|
194
|
+
},
|
|
195
|
+
allowedTypes: {
|
|
196
|
+
type: Array as PropType<DashboardExplorerElementType[]>,
|
|
197
|
+
required: false,
|
|
198
|
+
default: () => [
|
|
199
|
+
DashboardExplorerElementType.Folder,
|
|
200
|
+
DashboardExplorerElementType.DashboardOrganisation,
|
|
201
|
+
DashboardExplorerElementType.DashboardShallow,
|
|
202
|
+
DashboardExplorerElementType.DashboardOrganisationType
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
itemTo: {
|
|
206
|
+
type: Function as PropType<(item: DashboardExplorerElementInfos) => Partial<RouteLocation>>,
|
|
207
|
+
required: false
|
|
208
|
+
},
|
|
209
|
+
selectable: {
|
|
210
|
+
type: Boolean,
|
|
211
|
+
required: false,
|
|
212
|
+
default: true
|
|
213
|
+
},
|
|
214
|
+
singleSelect: {
|
|
215
|
+
type: Boolean,
|
|
216
|
+
required: false,
|
|
217
|
+
default: false
|
|
218
|
+
},
|
|
219
|
+
modelValue: {
|
|
220
|
+
type: Array as PropType<string[]>,
|
|
221
|
+
default: () => [],
|
|
222
|
+
required: false
|
|
223
|
+
},
|
|
224
|
+
dashboardExplorerElementsFilters: {
|
|
225
|
+
type: Object as PropType<DashboardExplorerElementFilters>,
|
|
226
|
+
required: false,
|
|
227
|
+
default: () => ({})
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
inheritAttrs: false,
|
|
231
|
+
emits: ["update:modelValue", "update:types"],
|
|
232
|
+
setup(props, { emit }) {
|
|
233
|
+
const { entities, fetching: fetchingDashboardExplorerElements, getMany: getManyDashboardExplorerElements } = useDashboardExplorerElements();
|
|
234
|
+
const { debounce } = useDebounce();
|
|
235
|
+
|
|
236
|
+
const search = ref("");
|
|
237
|
+
|
|
238
|
+
const dashboardExplorerElements = computed((): DashboardExplorerElementInfos[] => {
|
|
239
|
+
return entities.value
|
|
240
|
+
.filter(e => props.allowedTypes.includes(e.type))
|
|
241
|
+
.sort((a, b) => a.type - b.type);
|
|
242
|
+
});
|
|
243
|
+
|
|
244
|
+
const headersOptions = computed(() => ({
|
|
245
|
+
type: {
|
|
246
|
+
fixedFilters: props.allowedTypes.map(t => ({
|
|
247
|
+
value: t,
|
|
248
|
+
text: dashboardExplorerElementTypeLabel(t)
|
|
249
|
+
})),
|
|
250
|
+
methodFilter: (value: DashboardExplorerElementType, type: DashboardExplorerElementType) => {
|
|
251
|
+
return value === type;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
}));
|
|
255
|
+
|
|
256
|
+
const isSelected = (id: string): boolean => {
|
|
257
|
+
return props.modelValue.includes(id);
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
const onUpdate = (value: string[]): void => {
|
|
261
|
+
const types = value.map(id => entities.value.find(dee => dee.id === id)?.type);
|
|
262
|
+
emit("update:types", types);
|
|
263
|
+
|
|
264
|
+
emit("update:modelValue", value);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
const fetch = () => {
|
|
268
|
+
if (props.recursiveSearch && search.value) {
|
|
269
|
+
getManyDashboardExplorerElements({
|
|
270
|
+
ancestorId: props.parentId,
|
|
271
|
+
search: search.value,
|
|
272
|
+
types: props.allowedTypes,
|
|
273
|
+
...props.dashboardExplorerElementsFilters
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
getManyDashboardExplorerElements({
|
|
278
|
+
parentId: props.parentId,
|
|
279
|
+
root: props.root,
|
|
280
|
+
types: props.allowedTypes,
|
|
281
|
+
...props.dashboardExplorerElementsFilters
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
// Delay to wait before fetching after a search change
|
|
287
|
+
const debounceFetch = (): void => debounce(fetch, 1000);
|
|
288
|
+
|
|
289
|
+
watch([() => props.parentId, () => props.root, () => props.allowedTypes, () => props.dashboardExplorerElementsFilters], (next, previous) => {
|
|
290
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
291
|
+
fetch();
|
|
292
|
+
}
|
|
293
|
+
}, { immediate: true });
|
|
294
|
+
|
|
295
|
+
watch(search, (next, previous) => {
|
|
296
|
+
if (props.recursiveSearch && next !== previous) {
|
|
297
|
+
debounceFetch();
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
return {
|
|
302
|
+
fetchingDashboardExplorerElements,
|
|
303
|
+
DashboardExplorerElementType,
|
|
304
|
+
dashboardExplorerElements,
|
|
305
|
+
headersOptions,
|
|
306
|
+
search,
|
|
307
|
+
isSelected,
|
|
308
|
+
onUpdate
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
});
|
|
312
|
+
</script>
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSChip
|
|
3
|
+
:label="chipLabel"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
/>
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts">
|
|
9
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
10
|
+
|
|
11
|
+
import type { DashboardExplorerElementType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
12
|
+
import { dashboardExplorerElementTypeLabel } from "@dative-gpi/foundation-core-components/utils";
|
|
13
|
+
|
|
14
|
+
import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
|
|
15
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSDashboardExplorerElementTypeChip",
|
|
19
|
+
components: {
|
|
20
|
+
FSChip
|
|
21
|
+
},
|
|
22
|
+
props: {
|
|
23
|
+
type: {
|
|
24
|
+
type: Number as PropType<DashboardExplorerElementType>,
|
|
25
|
+
required: true
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
setup(props) {
|
|
29
|
+
const chipLabel = computed(() => dashboardExplorerElementTypeLabel(props.type));
|
|
30
|
+
|
|
31
|
+
return {
|
|
32
|
+
chipLabel,
|
|
33
|
+
ColorEnum
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
</script>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</FSRow>
|
|
71
71
|
</template>
|
|
72
72
|
<template
|
|
73
|
-
#item.
|
|
73
|
+
#item.models="{ item }"
|
|
74
74
|
>
|
|
75
75
|
<FSTagGroup
|
|
76
76
|
variant="slide"
|
|
77
|
-
:tags="item.
|
|
77
|
+
:tags="item.models.map((d: any) => d.label)"
|
|
78
78
|
:showRemove="false"
|
|
79
79
|
/>
|
|
80
80
|
</template>
|
|
@@ -109,7 +109,8 @@ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
|
|
|
109
109
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
110
110
|
import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
|
|
111
111
|
|
|
112
|
-
import type {
|
|
112
|
+
import type { ModelInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
113
|
+
import type { ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
113
114
|
import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
114
115
|
|
|
115
116
|
import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
|
|
@@ -168,8 +169,8 @@ export default defineComponent({
|
|
|
168
169
|
const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
|
|
169
170
|
|
|
170
171
|
const headersOptions = computed(() => ({
|
|
171
|
-
|
|
172
|
-
fixedFilters: chartOrganisationTypes.value.map(c => c.
|
|
172
|
+
models: {
|
|
173
|
+
fixedFilters: chartOrganisationTypes.value.map(c => c.models).reduce((acc, models) => {
|
|
173
174
|
for (const m of models) {
|
|
174
175
|
if (!acc.map((m) => m.id).includes(m.id)) {
|
|
175
176
|
acc.push(m);
|
|
@@ -183,7 +184,7 @@ export default defineComponent({
|
|
|
183
184
|
value: '',
|
|
184
185
|
text: '--'
|
|
185
186
|
}),
|
|
186
|
-
methodFilter: (value: string, items:
|
|
187
|
+
methodFilter: (value: string, items: ModelInfos[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
|
|
187
188
|
},
|
|
188
189
|
chartType: {
|
|
189
190
|
fixedFilters: getEnumEntries(ChartType).map(e => ({
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
/>
|
|
57
57
|
</template>
|
|
58
58
|
<template
|
|
59
|
-
#item.
|
|
59
|
+
#item.models="{ item }"
|
|
60
60
|
>
|
|
61
61
|
<FSTagGroup
|
|
62
62
|
variant="slide"
|
|
63
|
-
:tags="item.
|
|
63
|
+
:tags="item.models.map((d: any) => d.label)"
|
|
64
64
|
:showRemove="false"
|
|
65
65
|
/>
|
|
66
66
|
</template>
|
|
@@ -109,7 +109,8 @@ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
|
|
|
109
109
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
110
110
|
import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
|
|
111
111
|
|
|
112
|
-
import type {
|
|
112
|
+
import type { ModelInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
113
|
+
import type { ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
113
114
|
import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
114
115
|
|
|
115
116
|
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
@@ -168,8 +169,8 @@ export default defineComponent({
|
|
|
168
169
|
const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
|
|
169
170
|
|
|
170
171
|
const headersOptions = computed(() => ({
|
|
171
|
-
|
|
172
|
-
fixedFilters: chartOrganisations.value.map(c => c.
|
|
172
|
+
models: {
|
|
173
|
+
fixedFilters: chartOrganisations.value.map(c => c.models).reduce((acc, models) => {
|
|
173
174
|
for (const m of models) {
|
|
174
175
|
if (!acc.map((m) => m.id).includes(m.id)) {
|
|
175
176
|
acc.push(m);
|
|
@@ -183,7 +184,7 @@ export default defineComponent({
|
|
|
183
184
|
value: '',
|
|
184
185
|
text: '--'
|
|
185
186
|
}),
|
|
186
|
-
methodFilter: (value: string, items:
|
|
187
|
+
methodFilter: (value: string, items: ModelInfos[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
|
|
187
188
|
},
|
|
188
189
|
chartType: {
|
|
189
190
|
fixedFilters: getEnumEntries(ChartType).map(e => ({
|