@dative-gpi/foundation-core-components 1.0.66 → 1.0.67-map-edit

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.
Files changed (80) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +15 -8
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +14 -6
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +7 -1
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +11 -5
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +7 -1
  6. package/components/autocompletes/FSAutocompleteGroup.vue +7 -1
  7. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  9. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  11. package/components/autocompletes/FSAutocompleteRole.vue +14 -6
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  14. package/components/customProperties/FSMetaField.vue +35 -40
  15. package/components/customProperties/FSMetaFormContent.vue +4 -3
  16. package/components/customProperties/FSMetaHistory.vue +2 -2
  17. package/components/customProperties/helpers.ts +57 -165
  18. package/components/entities/FSBaseEntitiesList.vue +12 -2
  19. package/components/entities/FSDialogSelectEntities.vue +19 -2
  20. package/components/entities/FSEntityField.vue +68 -13
  21. package/components/entities/FSSelectEntitiesList.vue +40 -7
  22. package/components/explorers/FSBaseDevicesExplorer.vue +322 -0
  23. package/components/explorers/FSBaseFoldersExplorer.vue +126 -24
  24. package/components/lists/FSDataTable.vue +22 -16
  25. package/components/lists/alerts/FSBaseAlertsList.vue +96 -106
  26. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +4 -4
  27. package/components/lists/authTokens/FSBaseAuthTokensList.vue +6 -4
  28. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +97 -34
  29. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +98 -34
  30. package/components/lists/charts/FSBaseChartsList.vue +153 -64
  31. package/components/lists/comments/FSBaseCommentsList.vue +39 -23
  32. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  33. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +41 -8
  34. package/components/lists/dashboards/FSBaseDashboardsList.vue +76 -16
  35. package/components/lists/dashboards/FSSimpleDashboardsList.vue +33 -7
  36. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +8 -6
  37. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +8 -5
  38. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +70 -44
  39. package/components/lists/folders/FSBaseFoldersList.vue +27 -15
  40. package/components/lists/groups/FSBaseGroupsList.vue +13 -9
  41. package/components/lists/locations/FSBaseLocationsList.vue +17 -13
  42. package/components/lists/models/FSBaseModelsList.vue +31 -13
  43. package/components/lists/playlists/FSSimplePlaylistsList.vue +44 -0
  44. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +6 -5
  45. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +17 -16
  46. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +45 -8
  47. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +45 -7
  48. package/components/lists/scenarios/FSBaseScenariosList.vue +121 -86
  49. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +10 -7
  50. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  51. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +10 -7
  52. package/components/lists/userOrganisations/FSChipUserOrganisationsList.vue +61 -0
  53. package/components/tiles/FSChartTile.vue +71 -0
  54. package/components/tiles/FSDashboardOrganisationTile.vue +3 -3
  55. package/components/tiles/FSDashboardOrganisationTypeTile.vue +3 -3
  56. package/components/tiles/FSDashboardShallowTile.vue +3 -3
  57. package/components/tiles/FSDeviceOrganisationTile.vue +3 -3
  58. package/components/tiles/FSFolderTile.vue +7 -5
  59. package/components/tiles/FSGroupTile.vue +3 -3
  60. package/components/tiles/FSLocationTile.vue +5 -3
  61. package/components/tiles/FSModelTile.vue +64 -0
  62. package/components/tiles/FSServiceAccountOrganisationTile.vue +3 -3
  63. package/components/tiles/FSUserOrganisationTile.vue +3 -3
  64. package/components/treeviews/FSTreeViewGroup.vue +7 -1
  65. package/package.json +9 -9
  66. package/utils/dashboards.ts +4 -4
  67. package/utils/index.ts +0 -1
  68. package/utils/roles.ts +3 -3
  69. package/utils/users.ts +3 -3
  70. package/components/selects/FSAggregationSelector.vue +0 -51
  71. package/components/selects/FSAxisTypeSelector.vue +0 -48
  72. package/components/selects/FSDisplayAsSelector.vue +0 -52
  73. package/components/selects/FSFilterTypeSelector.vue +0 -53
  74. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  75. package/components/selects/FSOperationOnSelector.vue +0 -51
  76. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  77. package/components/selects/FSPlotPerSelector.vue +0 -51
  78. package/components/selects/FSSelectEntityType.vue +0 -59
  79. package/components/selects/FSSerieTypeSelector.vue +0 -51
  80. package/utils/charts.ts +0 -137
@@ -19,7 +19,8 @@
19
19
  :entity-type="$props.entityType"
20
20
  :filters="simpleListFilters"
21
21
  :showEdit="false"
22
- :showRemove="false"
22
+ :showRemove="showRemove"
23
+ @click:remove="onRemove"
23
24
  direction="row"
24
25
  />
25
26
  </FSSlideGroup>
@@ -38,12 +39,23 @@
38
39
  {{ $tr("ui.common.entities-list", "Entities list") }}
39
40
  </FSText>
40
41
  <FSBaseEntitiesList
42
+ :singleSelect="$props.singleSelect"
41
43
  :entity-type="$props.entityType"
42
44
  :tableCode="tableCode"
43
45
  :modelValue="$props.modelValue"
44
46
  @update:modelValue="$emit('update:modelValue', $event)"
45
47
  v-bind="baseTableAttrs"
46
- />
48
+ >
49
+ <template
50
+ v-for="(_, name) in $slots"
51
+ v-slot:[getNameSlot(name)]="slotData"
52
+ >
53
+ <slot
54
+ :name="name"
55
+ v-bind="slotData"
56
+ />
57
+ </template>
58
+ </FSBaseEntitiesList>
47
59
  </FSCol>
48
60
  </FSCol>
49
61
  </template>
@@ -52,7 +64,7 @@
52
64
  import { defineComponent, type PropType, computed } from "vue";
53
65
 
54
66
  import { EntityType } from "@dative-gpi/foundation-shared-domain/enums";
55
- import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
67
+ import type { DashboardOrganisationFilters, DashboardOrganisationTypeFilters, DashboardShallowFilters, DeviceOrganisationFilters, FolderFilters, GroupFilters, LocationFilters, ModelFilters, UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
56
68
 
57
69
  import { TABLES as T } from "../../utils";
58
70
 
@@ -81,6 +93,11 @@ export default defineComponent({
81
93
  type: Number as PropType<EntityType>,
82
94
  required: true
83
95
  },
96
+ singleSelect: {
97
+ type: Boolean,
98
+ required: false,
99
+ default: false
100
+ },
84
101
  modelValue: {
85
102
  type: Array as PropType<string[]>,
86
103
  required: false,
@@ -90,9 +107,14 @@ export default defineComponent({
90
107
  type: Object,
91
108
  required: false,
92
109
  default: null
110
+ },
111
+ showRemove: {
112
+ type: Boolean,
113
+ required: false,
114
+ default: false
93
115
  }
94
116
  },
95
- setup(props, { attrs }){
117
+ setup(props, { emit, attrs }){
96
118
  const simpleListFilters = computed(() => {
97
119
  switch(props.entityType) {
98
120
  case EntityType.Device:
@@ -102,8 +124,9 @@ export default defineComponent({
102
124
  case EntityType.Dashboard:
103
125
  return {
104
126
  dashboardOrganisationsIds: props.modelValue,
105
- dashboardOrganisationTypesIds: props.modelValue
106
- } satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters;
127
+ dashboardOrganisationTypesIds: props.modelValue,
128
+ dashboardShallowsIds: props.modelValue
129
+ } satisfies DashboardOrganisationFilters & DashboardOrganisationTypeFilters & DashboardShallowFilters;
107
130
  case EntityType.Group:
108
131
  return {
109
132
  groupsIds: props.modelValue
@@ -182,10 +205,20 @@ export default defineComponent({
182
205
  };
183
206
  });
184
207
 
208
+ const onRemove = (id: string) => {
209
+ emit("update:modelValue", props.modelValue.filter((i) => i !== id));
210
+ }
211
+
212
+ const getNameSlot = (name: string | number) => {
213
+ return name.toString().replace("base-list-", "");
214
+ }
215
+
185
216
  return {
186
217
  simpleListFilters,
187
218
  baseTableAttrs,
188
- tableCode
219
+ tableCode,
220
+ onRemove,
221
+ getNameSlot
189
222
  }
190
223
  }
191
224
  });
@@ -0,0 +1,322 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :loading="fetchingDeviceExplorerElements"
5
+ :singleSelect="$props.singleSelect"
6
+ :items="deviceExplorerElements"
7
+ :selectable="$props.selectable"
8
+ :tableCode="$props.tableCode"
9
+ :itemTo="$props.itemTo"
10
+ :noSearch="$props.recursiveSearch"
11
+ :modelValue="$props.modelValue"
12
+ @update:modelValue="onUpdate"
13
+ v-model:search="search"
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
+ #header.imageId-title
27
+ >
28
+ <FSIcon>
29
+ mdi-panorama-variant-outline
30
+ </FSIcon>
31
+ </template>
32
+ <template
33
+ #header.connectivity-title
34
+ >
35
+ <FSIcon>
36
+ mdi-wifi
37
+ </FSIcon>
38
+ </template>
39
+ <template
40
+ #item.imageId="{ item }"
41
+ >
42
+ <FSImage
43
+ v-if="item.imageId"
44
+ height="32px"
45
+ width="32px"
46
+ :imageId="item.imageId"
47
+ :thumbnail="true"
48
+ />
49
+ </template>
50
+ <template
51
+ #item.tags="{ item }"
52
+ >
53
+ <FSTagGroup
54
+ variant="slide"
55
+ :showRemove="false"
56
+ :tags="item.tags"
57
+ />
58
+ </template>
59
+ <template
60
+ #item.type="{ item }"
61
+ >
62
+ <FSIcon
63
+ v-if="item.type === DeviceExplorerElementType.Group"
64
+ >
65
+ mdi-folder-outline
66
+ </FSIcon>
67
+ <FSIcon
68
+ v-else
69
+ >
70
+ mdi-widgets-outline
71
+ </FSIcon>
72
+ </template>
73
+
74
+ <template
75
+ #item.icon="{ item }"
76
+ >
77
+ <FSIcon
78
+ v-if="item.type === DeviceExplorerElementType.Group"
79
+ >
80
+ {{ item.icon }}
81
+ </FSIcon>
82
+ </template>
83
+ <template
84
+ #item.connectivity="{ item }"
85
+ >
86
+ <FSCol
87
+ v-if="item.type === DeviceExplorerElementType.DeviceOrganisation"
88
+ >
89
+ <FSConnectivity
90
+ v-if="item.connectivity.status != ConnectivityStatus.None"
91
+ :deviceConnectivity="item.connectivity"
92
+ />
93
+ </FSCol>
94
+ </template>
95
+ <template
96
+ #item.worstAlert="{ item }"
97
+ >
98
+ <FSWorstAlert
99
+ v-if="item.worstAlert"
100
+ :deviceWorstAlert="item.worstAlert"
101
+ :deviceAlerts="item.alerts"
102
+ :alertTo="$props.alertTo"
103
+ />
104
+ <div
105
+ v-else
106
+ />
107
+ </template>
108
+ <template
109
+ #item.alerts="{ item }"
110
+ >
111
+ <FSWorstAlert
112
+ v-if="item.worstAlert"
113
+ :deviceWorstAlert="item.worstAlert"
114
+ :deviceAlerts="item.alerts"
115
+ :alertTo="$props.alertTo"
116
+ />
117
+ <div
118
+ v-else
119
+ />
120
+ </template>
121
+ <template
122
+ #item.status="{ item }"
123
+ >
124
+ <FSStatusesCarousel
125
+ v-if="item.type === DeviceExplorerElementType.DeviceOrganisation"
126
+ :modelStatuses="item.modelStatuses"
127
+ :deviceStatuses="item.status.statuses"
128
+ />
129
+ </template>
130
+
131
+ <template
132
+ #item.tile="{ index, item, toggleSelect }"
133
+ >
134
+ <FSGroupTileUI
135
+ v-if="item.type === DeviceExplorerElementType.Group"
136
+ :key="index"
137
+ :to="$props.itemTo && $props.itemTo(item)"
138
+ :imageId="item.imageId"
139
+ :icon="item.icon"
140
+ :label="item.label"
141
+ :code="item.code"
142
+ :recursiveGroupsIds="item.recursiveGroupsIds"
143
+ :recursiveDeviceOrganisationsIds="item.recursiveDeviceOrganisationsIds"
144
+ :modelValue="isSelected(item.id)"
145
+ :selectable="$props.selectable"
146
+ @update:modelValue="toggleSelect(item)"
147
+ />
148
+ <FSDeviceOrganisationTileUI
149
+ v-if="item.type === DeviceExplorerElementType.DeviceOrganisation"
150
+ :key="index"
151
+ :to="$props.itemTo && $props.itemTo(item)"
152
+ :deviceConnectivity="item.connectivity"
153
+ :deviceStatuses="item.status.statuses"
154
+ :deviceWorstAlert="item.worstAlert"
155
+ :deviceAlerts="item.alerts"
156
+ :imageId="item.imageId"
157
+ :label="item.label"
158
+ :code="item.code"
159
+ :modelStatuses="item.modelStatuses"
160
+ :alertTo="$props.alertTo"
161
+ :modelValue="isSelected(item.id)"
162
+ :selectable="$props.selectable"
163
+ @update:modelValue="toggleSelect(item)"
164
+ />
165
+ </template>
166
+ </FSDataTable>
167
+ </template>
168
+
169
+ <script lang="ts">
170
+ import { computed, defineComponent, type PropType, ref, watch } from "vue";
171
+ import { type RouteLocation } from "vue-router";
172
+ import _ from "lodash";
173
+
174
+ import { ConnectivityStatus, DeviceExplorerElementType } from "@dative-gpi/foundation-shared-domain/enums";
175
+ import { useDeviceExplorerElements } from "@dative-gpi/foundation-core-services/composables";
176
+ import { type DeviceExplorerElementInfos} from "@dative-gpi/foundation-core-domain/models";
177
+ import { useDebounce } from "@dative-gpi/foundation-shared-components/composables";
178
+
179
+ import FSDeviceOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDeviceOrganisationTileUI.vue";
180
+ import FSStatusesCarousel from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSStatusesCarousel.vue";
181
+ import FSConnectivity from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSConnectivity.vue";
182
+ import FSWorstAlert from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSWorstAlert.vue";
183
+ import FSGroupTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSGroupTileUI.vue";
184
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
185
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
186
+
187
+ import FSDataTable from "../lists/FSDataTable.vue";
188
+
189
+ export default defineComponent({
190
+ name: "FSBaseDevicesExplorer",
191
+ components: {
192
+ FSDeviceOrganisationTileUI,
193
+ FSStatusesCarousel,
194
+ FSConnectivity,
195
+ FSGroupTileUI,
196
+ FSWorstAlert,
197
+ FSDataTable,
198
+ FSTagGroup,
199
+ FSImage
200
+ },
201
+ props: {
202
+ tableCode: {
203
+ type: String as PropType<string | null>,
204
+ required: false,
205
+ default: null
206
+ },
207
+ recursiveSearch: {
208
+ type: Boolean,
209
+ required: false,
210
+ default: true
211
+ },
212
+ parentId: {
213
+ type: String as PropType<string | null>,
214
+ required: false,
215
+ default: null
216
+ },
217
+ root: {
218
+ type: Boolean,
219
+ required: false,
220
+ default: true
221
+ },
222
+ connectedOnly: {
223
+ type: Boolean,
224
+ required: false,
225
+ default: false
226
+ },
227
+ itemTo: {
228
+ type: Function as PropType<(item: DeviceExplorerElementInfos) => Partial<RouteLocation>>,
229
+ required: false
230
+ },
231
+ alertTo: {
232
+ type: Function,
233
+ required: false,
234
+ default: null
235
+ },
236
+ selectable: {
237
+ type: Boolean,
238
+ required: false,
239
+ default: true
240
+ },
241
+ singleSelect: {
242
+ type: Boolean,
243
+ required: false,
244
+ default: false
245
+ },
246
+ modelValue: {
247
+ type: Array as PropType<string[]>,
248
+ default: () => [],
249
+ required: false
250
+ }
251
+ },
252
+ emits: ["update:modelValue", "update:types"],
253
+ setup(props, { emit }) {
254
+ const { entities, fetching: fetchingDeviceExplorerElements, getMany: getManyDeviceExplorerElements } = useDeviceExplorerElements();
255
+ const { debounce } = useDebounce();
256
+
257
+ const search = ref("");
258
+
259
+ const deviceExplorerElements = computed((): DeviceExplorerElementInfos[] => {
260
+ let elements = entities.value.slice();
261
+ if (props.connectedOnly) {
262
+ elements = elements.filter(dee =>
263
+ dee.type === DeviceExplorerElementType.Group ||
264
+ (dee.connectivity != null && dee.connectivity.status != ConnectivityStatus.None)
265
+ );
266
+ }
267
+ return elements.sort((a, b) => a.type - b.type);
268
+ });
269
+
270
+ const isSelected = (id: string): boolean => {
271
+ return props.modelValue.includes(id);
272
+ };
273
+
274
+ const onUpdate = (value: string[]): void => {
275
+ const types = value.map(id => entities.value.find(dee => dee.id === id)?.type);
276
+ emit("update:types", types);
277
+
278
+ emit("update:modelValue", value);
279
+ }
280
+
281
+ const fetch = () => {
282
+ if (props.recursiveSearch && search.value) {
283
+ getManyDeviceExplorerElements({
284
+ ancestorId: props.parentId,
285
+ search: search.value
286
+ });
287
+ }
288
+ else {
289
+ getManyDeviceExplorerElements({
290
+ parentId: props.parentId,
291
+ root: props.root
292
+ });
293
+ }
294
+ }
295
+
296
+ // Delay to wait before fetching after a search change
297
+ const debounceFetch = (): void => debounce(fetch, 1000);
298
+
299
+ watch([() => props.parentId, () => props.root], (next, previous) => {
300
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
301
+ fetch();
302
+ }
303
+ }, { immediate: true });
304
+
305
+ watch(search, (next, previous) => {
306
+ if (props.recursiveSearch && next !== previous) {
307
+ debounceFetch();
308
+ }
309
+ });
310
+
311
+ return {
312
+ fetchingDeviceExplorerElements,
313
+ DeviceExplorerElementType,
314
+ deviceExplorerElements,
315
+ ConnectivityStatus,
316
+ search,
317
+ isSelected,
318
+ onUpdate
319
+ };
320
+ }
321
+ });
322
+ </script>
@@ -1,10 +1,13 @@
1
1
  <template>
2
2
  <FSDataTable
3
+ defaultMode="iterator"
3
4
  :items="items"
4
5
  :item-to="$props.itemTo"
5
6
  :loading="fetchingFolders || fetchingDashboardOrganisations || fetchingDashboardShallows"
6
7
  :tableCode="$props.tableCode"
8
+ :headersOptions="headersOptions"
7
9
  :modelValue="selecteds"
10
+ :selectable="$props.selectable"
8
11
  @update:modelValue="onSelect"
9
12
  v-bind="$attrs"
10
13
  >
@@ -17,7 +20,31 @@
17
20
  v-bind="slotData"
18
21
  />
19
22
  </template>
20
-
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>
21
48
  <template
22
49
  #item.main="{ item }"
23
50
  >
@@ -32,29 +59,54 @@
32
59
  mdi-home
33
60
  </FSIcon>
34
61
  </template>
35
-
36
62
  <template
37
- #item.icon="{ item }"
63
+ #item.locked="{ item }"
38
64
  >
39
- <FSIcon>
40
- {{ item.icon }}
41
- </FSIcon>
65
+ <FSIconCheck
66
+ :value="item.locked"
67
+ />
42
68
  </template>
43
-
44
69
  <template
45
- #item.tile="{ item, toggleSelect }"
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 }"
46
94
  >
47
95
  <FSFolderTileUI
48
96
  v-if="item.type == FoldersListType.Folder"
97
+ :key="index"
49
98
  :bottomColor="item.colors"
50
99
  v-bind="item"
100
+ :selectable="$props.selectable"
51
101
  :modelValue="isSelected(item.id)"
52
102
  @update:modelValue="toggleSelect(item)"
53
103
  :to="$props.itemTo && $props.itemTo(item)"
54
104
  />
55
105
  <FSDashboardOrganisationTileUI
56
106
  v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Organisation"
107
+ :key="index"
57
108
  :bottomColor="item.colors"
109
+ :selectable="$props.selectable"
58
110
  :modelValue="isSelected(item.id)"
59
111
  @update:modelValue="toggleSelect(item)"
60
112
  :to="$props.itemTo && $props.itemTo(item)"
@@ -62,7 +114,9 @@
62
114
  />
63
115
  <FSDashboardShallowTileUI
64
116
  v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Shallow"
117
+ :key="index"
65
118
  :bottomColor="item.colors"
119
+ :selectable="$props.selectable"
66
120
  :modelValue="isSelected(item.id)"
67
121
  @update:modelValue="toggleSelect(item)"
68
122
  :to="$props.itemTo && $props.itemTo(item)"
@@ -74,31 +128,41 @@
74
128
 
75
129
  <script lang="ts">
76
130
  import _ from "lodash";
77
- import type { PropType} from "vue";
78
131
  import type { RouteLocation } from "vue-router";
79
- import { computed, defineComponent, onMounted, ref, watch } from "vue";
132
+ import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
80
133
 
81
134
  import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
82
135
  import { useDashboardOrganisations, useFolders, useDashboardShallows, useAppOrganisationId, useCurrentUserOrganisation } from "@dative-gpi/foundation-core-services/composables";
83
136
 
84
137
  import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
85
- import { FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
138
+ import { dashboardTypeLabel, FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
86
139
  import type { FolderFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
87
140
 
88
- import FSDataTable from "../lists/FSDataTable.vue";
89
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";
90
146
  import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
91
- import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
92
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';
93
153
 
94
154
  export default defineComponent({
95
155
  name: "FSBaseFoldersExplorer",
96
156
  components: {
97
- FSDataTable,
98
- FSIcon,
99
- FSFolderTileUI,
100
157
  FSDashboardOrganisationTileUI,
101
- FSDashboardShallowTileUI
158
+ FSDashboardShallowTileUI,
159
+ FSFolderTileUI,
160
+ FSDataTable,
161
+ FSIconCheck,
162
+ FSTagGroup,
163
+ FSImage,
164
+ FSChip,
165
+ FSIcon
102
166
  },
103
167
  props: {
104
168
  foldersFilters: {
@@ -128,11 +192,16 @@ export default defineComponent({
128
192
  tableCode: {
129
193
  type: String,
130
194
  required: true
195
+ },
196
+ selectable: {
197
+ type: Boolean,
198
+ required: false,
199
+ default: true
131
200
  }
132
201
  },
133
- emits: ["update:modelValue", "update:type", "update:dashboard-type"],
202
+ emits: ["update", "update:modelValue", "update:type", "update:dashboard-type"],
134
203
  setup(props, { emit }) {
135
-
204
+ const { $tr } = useTranslations();
136
205
  const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
137
206
  const { entity: organisation, get: getOrganisation } = useOrganisation();
138
207
  const { organisationId } = useAppOrganisationId();
@@ -171,14 +240,44 @@ export default defineComponent({
171
240
  })) as FoldersListItem[]
172
241
  ], d => d.label)
173
242
  ]
174
- })
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
+ }));
175
270
 
176
271
  const onSelect = (values: string[]) => {
177
272
  selecteds.value = values;
178
273
  const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
179
- emit("update:dashboard-type", selectedItems.map(i => i.dashboardType));
180
- emit("update:modelValue", selectedItems.map(i => i.id));
181
- emit("update:type", selectedItems.map(i => i.type));
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 });
182
281
  };
183
282
 
184
283
  const isSelected = (id: string) => {
@@ -223,12 +322,15 @@ export default defineComponent({
223
322
  fetchingFolders,
224
323
  mainOrganisationDashboardId,
225
324
  mainUserDashboardId,
325
+ headersOptions,
326
+ ColorEnum,
226
327
  selecteds,
227
328
  items,
228
329
  onSelect,
229
330
  isSelected,
230
331
  FoldersListType,
231
- DashboardType
332
+ DashboardType,
333
+ dashboardTypeLabel
232
334
  };
233
335
  }
234
336
  });