@dative-gpi/foundation-core-components 1.1.12 → 1.1.13
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/FSEntityField.vue +3 -5
- package/components/entities/FSSelectEntitiesList.vue +4 -8
- package/components/entities/FSSimpleEntitiesList.vue +1 -3
- package/components/entities/FSTileEntitiesList.vue +1 -3
- package/components/explorers/FSBaseDashboardsExplorer.vue +312 -0
- package/components/explorers/FSDashboardExplorerElementTypeChip.vue +37 -0
- 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/folders/FSBaseFoldersList.vue +1 -5
- package/package.json +7 -7
- package/utils/dashboards.ts +10 -28
- package/utils/tables.ts +11 -7
- package/components/explorers/FSBaseFoldersExplorer.vue +0 -337
|
@@ -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 & DashboardShallowFilters;
|
|
141
|
+
dashboardExplorerElementsIds: props.modelValue,
|
|
142
|
+
} satisfies DashboardExplorerElementFilters;
|
|
145
143
|
case EntityType.Group:
|
|
146
144
|
return {
|
|
147
145
|
groupsIds: props.modelValue
|
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
import { defineComponent, type PropType, computed } from "vue";
|
|
66
66
|
|
|
67
67
|
import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
|
|
68
|
-
import type {
|
|
68
|
+
import type { DashboardExplorerElementFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, GroupingFilters, LocationFilters, ModelFilters, SubgroupingFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
69
69
|
|
|
70
70
|
import { TABLES as T } from "../../utils";
|
|
71
71
|
|
|
@@ -124,10 +124,8 @@ export default defineComponent({
|
|
|
124
124
|
} satisfies DeviceOrganisationFilters;
|
|
125
125
|
case EntityType.Dashboard:
|
|
126
126
|
return {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
dashboardShallowsIds: props.modelValue
|
|
130
|
-
} satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters & DashboardShallowFilters;
|
|
127
|
+
dashboardExplorerElementsIds: props.modelValue,
|
|
128
|
+
} satisfies DashboardExplorerElementFilters;
|
|
131
129
|
case EntityType.Group:
|
|
132
130
|
return {
|
|
133
131
|
groupsIds: props.modelValue
|
|
@@ -191,9 +189,7 @@ export default defineComponent({
|
|
|
191
189
|
};
|
|
192
190
|
case EntityType.Dashboard:
|
|
193
191
|
return {
|
|
194
|
-
|
|
195
|
-
dashboardOrganisationsFilters: props.filters,
|
|
196
|
-
dashboardOrganisationTypeFetchFilter: props.filters,
|
|
192
|
+
dashboardExplorerElementsFilters: props.filters,
|
|
197
193
|
...attrs
|
|
198
194
|
};
|
|
199
195
|
case EntityType.Group:
|
|
@@ -62,9 +62,7 @@ export default defineComponent({
|
|
|
62
62
|
case EntityType.Dashboard:
|
|
63
63
|
return {
|
|
64
64
|
...attrs,
|
|
65
|
-
|
|
66
|
-
dashboardOrganisationTypeFilters : props.filters,
|
|
67
|
-
dashboardShallowFilters : props.filters
|
|
65
|
+
dashboardExplorerElementsFilters: props.filters
|
|
68
66
|
};
|
|
69
67
|
case EntityType.Folder:
|
|
70
68
|
return {
|
|
@@ -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>
|