@dative-gpi/foundation-core-components 1.1.23 → 1.1.24-unit-formatter
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 +2 -11
- package/components/entities/FSBaseEntitiesList.vue +0 -4
- package/components/entities/FSEntityField.vue +5 -11
- package/components/entities/FSSelectEntitiesList.vue +8 -35
- package/components/entities/FSSimpleEntitiesList.vue +2 -15
- package/components/entities/FSTileEntitiesList.vue +3 -1
- package/components/explorers/FSBaseFoldersExplorer.vue +337 -0
- package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +6 -7
- package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +6 -7
- package/components/lists/charts/FSBaseChartsList.vue +14 -7
- package/components/lists/dashboards/FSBaseDashboardsList.vue +224 -40
- package/components/lists/dashboards/FSSimpleDashboardsList.vue +53 -27
- package/components/lists/dashboards/FSTileDashboardsList.vue +62 -30
- package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +8 -10
- package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +7 -10
- package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +1 -66
- package/components/lists/folders/FSBaseFoldersList.vue +5 -1
- package/components/lists/groupings/FSBaseGroupingsList.vue +17 -5
- package/components/lists/groups/FSSimpleGroupsList.vue +0 -1
- package/components/lists/locations/FSBaseLocationsList.vue +3 -3
- package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +1 -21
- package/components/lists/userOrganisations/{FSUserOrganisationsChipGroup.vue → FSChipUserOrganisationsList.vue} +2 -2
- package/components/tiles/FSLocationTile.vue +1 -2
- package/package.json +8 -8
- package/utils/dashboards.ts +30 -12
- package/utils/tables.ts +7 -13
- package/utils/users.ts +1 -1
- package/components/explorers/FSBaseDashboardsExplorer.vue +0 -312
- package/components/explorers/FSDashboardExplorerElementTypeChip.vue +0 -37
- package/components/lists/groupings/FSSimpleGroupingsList.vue +0 -44
- package/components/lists/groupings/FSTileGroupingsList.vue +0 -79
- package/components/lists/playlists/FSTilePlaylistsList.vue +0 -93
- package/components/lists/subgroupings/FSBaseSubgroupingsList.vue +0 -197
- package/components/lists/subgroupings/FSSimpleSubgroupingsList.vue +0 -45
- package/components/lists/subgroupings/FSSubgroupingsChipGroup.vue +0 -61
- package/components/lists/subgroupings/FSTileSubgroupingsList.vue +0 -81
- package/components/tiles/FSGroupingTile.vue +0 -67
- package/components/tiles/FSPlaylistTile.vue +0 -78
- package/components/tiles/FSSubgroupingTile.vue +0 -69
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
5
5
|
:multiple="$props.multiple"
|
|
6
6
|
:placeholder="placeholder"
|
|
7
|
-
:items="
|
|
7
|
+
:items="dataCategories"
|
|
8
8
|
:loading="loading"
|
|
9
9
|
:modelValue="$props.modelValue"
|
|
10
10
|
@update:modelValue="onUpdate"
|
|
@@ -124,15 +124,6 @@ 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
|
-
|
|
136
127
|
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
137
128
|
dataCategories,
|
|
138
129
|
[() => props.dataCategoriesFilters],
|
|
@@ -141,7 +132,7 @@ export default defineComponent({
|
|
|
141
132
|
);
|
|
142
133
|
|
|
143
134
|
return {
|
|
144
|
-
|
|
135
|
+
dataCategories,
|
|
145
136
|
placeholder,
|
|
146
137
|
ColorEnum,
|
|
147
138
|
toggleSet,
|
|
@@ -47,10 +47,6 @@ 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"));
|
|
54
50
|
default:
|
|
55
51
|
return null;
|
|
56
52
|
};
|
|
@@ -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 { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, 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,8 +138,10 @@ export default defineComponent({
|
|
|
138
138
|
} satisfies DeviceOrganisationFilters;
|
|
139
139
|
case EntityType.Dashboard:
|
|
140
140
|
return {
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
dashboardOrganisationsIds: props.modelValue,
|
|
142
|
+
dashboardOrganisationTypesIds: props.modelValue,
|
|
143
|
+
dashboardShallowsIds: props.modelValue
|
|
144
|
+
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
|
|
143
145
|
case EntityType.Group:
|
|
144
146
|
return {
|
|
145
147
|
groupsIds: props.modelValue
|
|
@@ -160,14 +162,6 @@ export default defineComponent({
|
|
|
160
162
|
return {
|
|
161
163
|
modelsIds: props.modelValue
|
|
162
164
|
} 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;
|
|
171
165
|
default:
|
|
172
166
|
return undefined;
|
|
173
167
|
};
|
|
@@ -42,7 +42,6 @@
|
|
|
42
42
|
:singleSelect="$props.singleSelect"
|
|
43
43
|
:entity-type="$props.entityType"
|
|
44
44
|
:tableCode="tableCode"
|
|
45
|
-
:selectable="true"
|
|
46
45
|
:modelValue="$props.modelValue"
|
|
47
46
|
@update:modelValue="$emit('update:modelValue', $event)"
|
|
48
47
|
v-bind="baseTableAttrs"
|
|
@@ -65,7 +64,7 @@
|
|
|
65
64
|
import { defineComponent, type PropType, computed } from "vue";
|
|
66
65
|
|
|
67
66
|
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
68
|
-
import type {
|
|
67
|
+
import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DashboardShallowFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
69
68
|
|
|
70
69
|
import { TABLES as T } from "../../utils";
|
|
71
70
|
|
|
@@ -124,8 +123,10 @@ export default defineComponent({
|
|
|
124
123
|
} satisfies DeviceOrganisationFilters;
|
|
125
124
|
case EntityType.Dashboard:
|
|
126
125
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
dashboardOrganisationsIds: props.modelValue,
|
|
127
|
+
dashboardOrganisationTypesIds: props.modelValue,
|
|
128
|
+
dashboardShallowsIds: props.modelValue
|
|
129
|
+
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters & DashboardShallowFilters;
|
|
129
130
|
case EntityType.Group:
|
|
130
131
|
return {
|
|
131
132
|
groupsIds: props.modelValue
|
|
@@ -146,14 +147,6 @@ export default defineComponent({
|
|
|
146
147
|
return {
|
|
147
148
|
modelsIds: props.modelValue
|
|
148
149
|
} 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;
|
|
157
150
|
default:
|
|
158
151
|
return undefined;
|
|
159
152
|
};
|
|
@@ -163,18 +156,6 @@ export default defineComponent({
|
|
|
163
156
|
switch(props.entityType) {
|
|
164
157
|
case EntityType.Device:
|
|
165
158
|
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;
|
|
178
159
|
default:
|
|
179
160
|
return null;
|
|
180
161
|
};
|
|
@@ -189,7 +170,9 @@ export default defineComponent({
|
|
|
189
170
|
};
|
|
190
171
|
case EntityType.Dashboard:
|
|
191
172
|
return {
|
|
192
|
-
|
|
173
|
+
dashboardShallowsFilters: props.filters,
|
|
174
|
+
dashboardOrganisationsFilters: props.filters,
|
|
175
|
+
dashboardOrganisationTypeFetchFilter: props.filters,
|
|
193
176
|
...attrs
|
|
194
177
|
};
|
|
195
178
|
case EntityType.Group:
|
|
@@ -217,16 +200,6 @@ export default defineComponent({
|
|
|
217
200
|
modelsFilters: props.filters,
|
|
218
201
|
...attrs
|
|
219
202
|
};
|
|
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
|
-
};
|
|
230
203
|
default:
|
|
231
204
|
return null;
|
|
232
205
|
};
|
|
@@ -43,10 +43,6 @@ 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"));
|
|
50
46
|
default:
|
|
51
47
|
return null;
|
|
52
48
|
};
|
|
@@ -62,7 +58,8 @@ export default defineComponent({
|
|
|
62
58
|
case EntityType.Dashboard:
|
|
63
59
|
return {
|
|
64
60
|
...attrs,
|
|
65
|
-
|
|
61
|
+
dashboardOrganisationFilters : props.filters,
|
|
62
|
+
dashboardOrganisationTypeFilters : props.filters
|
|
66
63
|
};
|
|
67
64
|
case EntityType.Folder:
|
|
68
65
|
return {
|
|
@@ -89,16 +86,6 @@ export default defineComponent({
|
|
|
89
86
|
...attrs,
|
|
90
87
|
modelFilters : props.filters
|
|
91
88
|
};
|
|
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
|
-
};
|
|
102
89
|
default:
|
|
103
90
|
return null;
|
|
104
91
|
}
|
|
@@ -55,7 +55,9 @@ export default defineComponent({
|
|
|
55
55
|
case EntityType.Dashboard:
|
|
56
56
|
return {
|
|
57
57
|
...attrs,
|
|
58
|
-
|
|
58
|
+
dashboardOrganisationFilters : props.filters,
|
|
59
|
+
dashboardOrganisationTypeFilters : props.filters,
|
|
60
|
+
dashboardShallowFilters : props.filters
|
|
59
61
|
};
|
|
60
62
|
case EntityType.Folder:
|
|
61
63
|
return {
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSDataTable
|
|
3
|
+
defaultMode="iterator"
|
|
4
|
+
:items="items"
|
|
5
|
+
:item-to="$props.itemTo"
|
|
6
|
+
:loading="fetchingFolders || fetchingDashboardOrganisations || fetchingDashboardShallows"
|
|
7
|
+
:tableCode="$props.tableCode"
|
|
8
|
+
:headersOptions="headersOptions"
|
|
9
|
+
:modelValue="selecteds"
|
|
10
|
+
:selectable="$props.selectable"
|
|
11
|
+
@update:modelValue="onSelect"
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
>
|
|
14
|
+
<template
|
|
15
|
+
v-for="(_, name) in $slots"
|
|
16
|
+
v-slot:[name]="slotData"
|
|
17
|
+
>
|
|
18
|
+
<slot
|
|
19
|
+
:name="name"
|
|
20
|
+
v-bind="slotData"
|
|
21
|
+
/>
|
|
22
|
+
</template>
|
|
23
|
+
<template
|
|
24
|
+
#header.imageId-title
|
|
25
|
+
>
|
|
26
|
+
<FSIcon>
|
|
27
|
+
mdi-panorama-variant-outline
|
|
28
|
+
</FSIcon>
|
|
29
|
+
</template>
|
|
30
|
+
<template
|
|
31
|
+
#item.imageId="{ item }"
|
|
32
|
+
>
|
|
33
|
+
<FSImage
|
|
34
|
+
v-if="item.imageId"
|
|
35
|
+
height="32px"
|
|
36
|
+
width="32px"
|
|
37
|
+
:imageId="item.imageId"
|
|
38
|
+
:thumbnail="true"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
41
|
+
<template
|
|
42
|
+
#item.icon="{ item }"
|
|
43
|
+
>
|
|
44
|
+
<FSIcon>
|
|
45
|
+
{{ item.icon }}
|
|
46
|
+
</FSIcon>
|
|
47
|
+
</template>
|
|
48
|
+
<template
|
|
49
|
+
#item.main="{ item }"
|
|
50
|
+
>
|
|
51
|
+
<FSIcon
|
|
52
|
+
v-if="item.id === mainOrganisationDashboardId"
|
|
53
|
+
>
|
|
54
|
+
mdi-account-group-outline
|
|
55
|
+
</FSIcon>
|
|
56
|
+
<FSIcon
|
|
57
|
+
v-if="item.id === mainUserDashboardId"
|
|
58
|
+
>
|
|
59
|
+
mdi-home
|
|
60
|
+
</FSIcon>
|
|
61
|
+
</template>
|
|
62
|
+
<template
|
|
63
|
+
#item.locked="{ item }"
|
|
64
|
+
>
|
|
65
|
+
<FSIconCheck
|
|
66
|
+
:value="item.locked"
|
|
67
|
+
/>
|
|
68
|
+
</template>
|
|
69
|
+
<template
|
|
70
|
+
#item.tags="{ item }"
|
|
71
|
+
>
|
|
72
|
+
<FSTagGroup
|
|
73
|
+
variant="slide"
|
|
74
|
+
:showRemove="false"
|
|
75
|
+
:tags="item.tags"
|
|
76
|
+
/>
|
|
77
|
+
</template>
|
|
78
|
+
<template
|
|
79
|
+
#item.dashboardType="{ item }"
|
|
80
|
+
>
|
|
81
|
+
<FSChip
|
|
82
|
+
v-if="item.type === FoldersListType.Dashboard"
|
|
83
|
+
:color="ColorEnum.Light"
|
|
84
|
+
:label="dashboardTypeLabel(item.dashboardType)"
|
|
85
|
+
/>
|
|
86
|
+
<FSChip
|
|
87
|
+
v-else-if="item.type === FoldersListType.Folder"
|
|
88
|
+
:color="ColorEnum.Light"
|
|
89
|
+
:label="$tr('ui.common.folder', 'Folder')"
|
|
90
|
+
/>
|
|
91
|
+
</template>
|
|
92
|
+
<template
|
|
93
|
+
#item.tile="{ index, item, toggleSelect }"
|
|
94
|
+
>
|
|
95
|
+
<FSFolderTileUI
|
|
96
|
+
v-if="item.type == FoldersListType.Folder"
|
|
97
|
+
:key="index"
|
|
98
|
+
:bottomColor="item.colors"
|
|
99
|
+
v-bind="item"
|
|
100
|
+
:selectable="$props.selectable"
|
|
101
|
+
:modelValue="isSelected(item.id)"
|
|
102
|
+
@update:modelValue="toggleSelect(item)"
|
|
103
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
104
|
+
/>
|
|
105
|
+
<FSDashboardOrganisationTileUI
|
|
106
|
+
v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Organisation"
|
|
107
|
+
:key="index"
|
|
108
|
+
:bottomColor="item.colors"
|
|
109
|
+
:selectable="$props.selectable"
|
|
110
|
+
:modelValue="isSelected(item.id)"
|
|
111
|
+
@update:modelValue="toggleSelect(item)"
|
|
112
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
113
|
+
v-bind="item"
|
|
114
|
+
/>
|
|
115
|
+
<FSDashboardShallowTileUI
|
|
116
|
+
v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Shallow"
|
|
117
|
+
:key="index"
|
|
118
|
+
:bottomColor="item.colors"
|
|
119
|
+
:selectable="$props.selectable"
|
|
120
|
+
:modelValue="isSelected(item.id)"
|
|
121
|
+
@update:modelValue="toggleSelect(item)"
|
|
122
|
+
:to="$props.itemTo && $props.itemTo(item)"
|
|
123
|
+
v-bind="item"
|
|
124
|
+
/>
|
|
125
|
+
</template>
|
|
126
|
+
</FSDataTable>
|
|
127
|
+
</template>
|
|
128
|
+
|
|
129
|
+
<script lang="ts">
|
|
130
|
+
import _ from "lodash";
|
|
131
|
+
import type { RouteLocation } from "vue-router";
|
|
132
|
+
import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
|
|
133
|
+
|
|
134
|
+
import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
|
|
135
|
+
import { useDashboardOrganisations, useFolders, useDashboardShallows, useAppOrganisationId, useCurrentUserOrganisation } from "@dative-gpi/foundation-core-services/composables";
|
|
136
|
+
|
|
137
|
+
import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
138
|
+
import { dashboardTypeLabel, FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
|
|
139
|
+
import type { FolderFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
140
|
+
|
|
141
|
+
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
142
|
+
import FSChip from '@dative-gpi/foundation-shared-components/components/FSChip.vue';
|
|
143
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
144
|
+
import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
|
|
145
|
+
import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
|
|
146
|
+
import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
|
|
147
|
+
import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
|
|
148
|
+
import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
|
|
149
|
+
|
|
150
|
+
import FSDataTable from "../lists/FSDataTable.vue";
|
|
151
|
+
import { ColorEnum } from '@dative-gpi/foundation-shared-components/models';
|
|
152
|
+
import { useTranslations } from '@dative-gpi/bones-ui';
|
|
153
|
+
|
|
154
|
+
export default defineComponent({
|
|
155
|
+
name: "FSBaseFoldersExplorer",
|
|
156
|
+
components: {
|
|
157
|
+
FSDashboardOrganisationTileUI,
|
|
158
|
+
FSDashboardShallowTileUI,
|
|
159
|
+
FSFolderTileUI,
|
|
160
|
+
FSDataTable,
|
|
161
|
+
FSIconCheck,
|
|
162
|
+
FSTagGroup,
|
|
163
|
+
FSImage,
|
|
164
|
+
FSChip,
|
|
165
|
+
FSIcon
|
|
166
|
+
},
|
|
167
|
+
props: {
|
|
168
|
+
foldersFilters: {
|
|
169
|
+
type: Object as PropType<FolderFilters>,
|
|
170
|
+
default: undefined,
|
|
171
|
+
required: false
|
|
172
|
+
},
|
|
173
|
+
dashboardOrganisationsFilters: {
|
|
174
|
+
type: Object as PropType<DashboardOrganisationFilters>,
|
|
175
|
+
default: undefined,
|
|
176
|
+
required: false
|
|
177
|
+
},
|
|
178
|
+
dashboardShallowsFilters: {
|
|
179
|
+
type: Object as PropType<DashboardShallowFilters>,
|
|
180
|
+
default: undefined,
|
|
181
|
+
required: false
|
|
182
|
+
},
|
|
183
|
+
modelValue: {
|
|
184
|
+
type: Array as PropType<string[]>,
|
|
185
|
+
required: false,
|
|
186
|
+
default: () => []
|
|
187
|
+
},
|
|
188
|
+
itemTo: {
|
|
189
|
+
type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
|
|
190
|
+
required: false
|
|
191
|
+
},
|
|
192
|
+
tableCode: {
|
|
193
|
+
type: String,
|
|
194
|
+
required: true
|
|
195
|
+
},
|
|
196
|
+
selectable: {
|
|
197
|
+
type: Boolean,
|
|
198
|
+
required: false,
|
|
199
|
+
default: true
|
|
200
|
+
}
|
|
201
|
+
},
|
|
202
|
+
emits: ["update", "update:modelValue", "update:type", "update:dashboard-type"],
|
|
203
|
+
setup(props, { emit }) {
|
|
204
|
+
const { $tr } = useTranslations();
|
|
205
|
+
const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
|
|
206
|
+
const { entity: organisation, get: getOrganisation } = useOrganisation();
|
|
207
|
+
const { organisationId } = useAppOrganisationId();
|
|
208
|
+
|
|
209
|
+
const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
|
|
210
|
+
const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
|
|
211
|
+
const { entities: folders, fetching: fetchingFolders, getMany: getManyFolders } = useFolders();
|
|
212
|
+
|
|
213
|
+
const selecteds = ref<string[]>([]);
|
|
214
|
+
|
|
215
|
+
const mainUserDashboardId = computed(() => {
|
|
216
|
+
return userOrganisation.value?.mainDashboardId;
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const mainOrganisationDashboardId = computed(() => {
|
|
220
|
+
return organisation.value?.mainDashboardId;
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
const items = computed((): FoldersListItem[] => {
|
|
224
|
+
return [
|
|
225
|
+
...folders.value.map(g => ({
|
|
226
|
+
...g,
|
|
227
|
+
type: FoldersListType.Folder,
|
|
228
|
+
dashboardType: DashboardType.None
|
|
229
|
+
})) as FoldersListItem[],
|
|
230
|
+
..._.sortBy([
|
|
231
|
+
...dashboardOrganisations.value.map(d => ({
|
|
232
|
+
...d,
|
|
233
|
+
type: FoldersListType.Dashboard,
|
|
234
|
+
dashboardType: DashboardType.Organisation
|
|
235
|
+
})) as FoldersListItem[],
|
|
236
|
+
...dashboardShallows.value.map(d => ({
|
|
237
|
+
...d,
|
|
238
|
+
type: FoldersListType.Dashboard,
|
|
239
|
+
dashboardType: DashboardType.Shallow
|
|
240
|
+
})) as FoldersListItem[]
|
|
241
|
+
], d => d.label)
|
|
242
|
+
]
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
const headersOptions = computed(() => ({
|
|
246
|
+
dashboardType: {
|
|
247
|
+
fixedFilters: [
|
|
248
|
+
{
|
|
249
|
+
value: DashboardType.Organisation,
|
|
250
|
+
text: dashboardTypeLabel(DashboardType.Organisation)
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
value: DashboardType.Shallow,
|
|
254
|
+
text: dashboardTypeLabel(DashboardType.Shallow)
|
|
255
|
+
},
|
|
256
|
+
{
|
|
257
|
+
value: 10,
|
|
258
|
+
text: $tr("ui.common.folder", "Folder")
|
|
259
|
+
},
|
|
260
|
+
],
|
|
261
|
+
methodFilter: (value: number, dashboardType: DashboardType) => {
|
|
262
|
+
if(dashboardType !== DashboardType.None) {
|
|
263
|
+
return value === dashboardType;
|
|
264
|
+
} else {
|
|
265
|
+
return value === 10;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}));
|
|
270
|
+
|
|
271
|
+
const onSelect = (values: string[]) => {
|
|
272
|
+
selecteds.value = values;
|
|
273
|
+
const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
|
|
274
|
+
const newDashboardType = selectedItems.map(i => i.dashboardType);
|
|
275
|
+
const newModelValue = selectedItems.map(i => i.id);
|
|
276
|
+
const newType = selectedItems.map(i => i.type);
|
|
277
|
+
emit("update:dashboard-type", newDashboardType);
|
|
278
|
+
emit("update:modelValue", newModelValue);
|
|
279
|
+
emit("update:type", newType);
|
|
280
|
+
emit("update", { dashboardType: newDashboardType, modelValue: newModelValue, type: newType });
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
const isSelected = (id: string) => {
|
|
284
|
+
return selecteds.value?.includes(id);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
onMounted(() => {
|
|
288
|
+
fetchUserOrganisation();
|
|
289
|
+
})
|
|
290
|
+
|
|
291
|
+
watch(() => organisationId.value, () => {
|
|
292
|
+
if (organisationId.value) {
|
|
293
|
+
getOrganisation(organisationId.value);
|
|
294
|
+
}
|
|
295
|
+
}, { immediate: true });
|
|
296
|
+
|
|
297
|
+
watch(() => props.foldersFilters, (next, previous) => {
|
|
298
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
299
|
+
getManyFolders(props.foldersFilters, f => f.parentId == props.foldersFilters?.parentId);
|
|
300
|
+
}
|
|
301
|
+
}, { immediate: true });
|
|
302
|
+
|
|
303
|
+
watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
|
|
304
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
305
|
+
getManyDashboardOrganisations(props.dashboardOrganisationsFilters, f => f.folderId == props.foldersFilters?.parentId);
|
|
306
|
+
}
|
|
307
|
+
}, { immediate: true });
|
|
308
|
+
|
|
309
|
+
watch(() => props.dashboardShallowsFilters, (next, previous) => {
|
|
310
|
+
if ((!next && !previous) || !_.isEqual(next, previous)) {
|
|
311
|
+
getManyDashboardShallows(props.dashboardShallowsFilters, f => f.folderId == props.foldersFilters?.parentId);
|
|
312
|
+
}
|
|
313
|
+
}, { immediate: true });
|
|
314
|
+
|
|
315
|
+
watch(() => props.modelValue, (next) => {
|
|
316
|
+
selecteds.value = next;
|
|
317
|
+
}, { immediate: true });
|
|
318
|
+
|
|
319
|
+
return {
|
|
320
|
+
fetchingDashboardOrganisations,
|
|
321
|
+
fetchingDashboardShallows,
|
|
322
|
+
fetchingFolders,
|
|
323
|
+
mainOrganisationDashboardId,
|
|
324
|
+
mainUserDashboardId,
|
|
325
|
+
headersOptions,
|
|
326
|
+
ColorEnum,
|
|
327
|
+
selecteds,
|
|
328
|
+
items,
|
|
329
|
+
onSelect,
|
|
330
|
+
isSelected,
|
|
331
|
+
FoldersListType,
|
|
332
|
+
DashboardType,
|
|
333
|
+
dashboardTypeLabel
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
});
|
|
337
|
+
</script>
|
|
@@ -70,11 +70,11 @@
|
|
|
70
70
|
</FSRow>
|
|
71
71
|
</template>
|
|
72
72
|
<template
|
|
73
|
-
#item.
|
|
73
|
+
#item.modelsLabels="{ item }"
|
|
74
74
|
>
|
|
75
75
|
<FSTagGroup
|
|
76
76
|
variant="slide"
|
|
77
|
-
:tags="item.
|
|
77
|
+
:tags="item.modelsLabels.map((d: any) => d.label)"
|
|
78
78
|
:showRemove="false"
|
|
79
79
|
/>
|
|
80
80
|
</template>
|
|
@@ -109,8 +109,7 @@ 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 {
|
|
113
|
-
import type { ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
112
|
+
import type { ChartModelLabel, ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
114
113
|
import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
115
114
|
|
|
116
115
|
import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
|
|
@@ -169,8 +168,8 @@ export default defineComponent({
|
|
|
169
168
|
const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
|
|
170
169
|
|
|
171
170
|
const headersOptions = computed(() => ({
|
|
172
|
-
|
|
173
|
-
fixedFilters: chartOrganisationTypes.value.map(c => c.
|
|
171
|
+
modelsLabels: {
|
|
172
|
+
fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
|
|
174
173
|
for (const m of models) {
|
|
175
174
|
if (!acc.map((m) => m.id).includes(m.id)) {
|
|
176
175
|
acc.push(m);
|
|
@@ -184,7 +183,7 @@ export default defineComponent({
|
|
|
184
183
|
value: '',
|
|
185
184
|
text: '--'
|
|
186
185
|
}),
|
|
187
|
-
methodFilter: (value: string, items:
|
|
186
|
+
methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
|
|
188
187
|
},
|
|
189
188
|
chartType: {
|
|
190
189
|
fixedFilters: getEnumEntries(ChartType).map(e => ({
|
|
@@ -56,11 +56,11 @@
|
|
|
56
56
|
/>
|
|
57
57
|
</template>
|
|
58
58
|
<template
|
|
59
|
-
#item.
|
|
59
|
+
#item.modelsLabels="{ item }"
|
|
60
60
|
>
|
|
61
61
|
<FSTagGroup
|
|
62
62
|
variant="slide"
|
|
63
|
-
:tags="item.
|
|
63
|
+
:tags="item.modelsLabels.map((d: any) => d.label)"
|
|
64
64
|
:showRemove="false"
|
|
65
65
|
/>
|
|
66
66
|
</template>
|
|
@@ -109,8 +109,7 @@ 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 {
|
|
113
|
-
import type { ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
112
|
+
import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
|
|
114
113
|
import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
115
114
|
|
|
116
115
|
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
@@ -169,8 +168,8 @@ export default defineComponent({
|
|
|
169
168
|
const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
|
|
170
169
|
|
|
171
170
|
const headersOptions = computed(() => ({
|
|
172
|
-
|
|
173
|
-
fixedFilters: chartOrganisations.value.map(c => c.
|
|
171
|
+
modelsLabels: {
|
|
172
|
+
fixedFilters: chartOrganisations.value.map(c => c.modelsLabels).reduce((acc, models) => {
|
|
174
173
|
for (const m of models) {
|
|
175
174
|
if (!acc.map((m) => m.id).includes(m.id)) {
|
|
176
175
|
acc.push(m);
|
|
@@ -184,7 +183,7 @@ export default defineComponent({
|
|
|
184
183
|
value: '',
|
|
185
184
|
text: '--'
|
|
186
185
|
}),
|
|
187
|
-
methodFilter: (value: string, items:
|
|
186
|
+
methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
|
|
188
187
|
},
|
|
189
188
|
chartType: {
|
|
190
189
|
fixedFilters: getEnumEntries(ChartType).map(e => ({
|