@dative-gpi/foundation-core-components 1.0.70 → 1.0.71-groupings-2

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 (84) 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/FSAutocompleteGrouping.vue +105 -0
  8. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  9. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  10. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  11. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  12. package/components/autocompletes/FSAutocompleteRole.vue +14 -6
  13. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  14. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  15. package/components/customProperties/FSMetaField.vue +35 -40
  16. package/components/customProperties/FSMetaFormContent.vue +4 -3
  17. package/components/customProperties/FSMetaHistory.vue +2 -2
  18. package/components/customProperties/helpers.ts +57 -165
  19. package/components/entities/FSBaseEntitiesList.vue +12 -2
  20. package/components/entities/FSDialogSelectEntities.vue +19 -2
  21. package/components/entities/FSEntityField.vue +68 -13
  22. package/components/entities/FSSelectEntitiesList.vue +40 -7
  23. package/components/explorers/FSBaseDevicesExplorer.vue +322 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +99 -20
  25. package/components/fields/FSMagicConfigField.vue +171 -0
  26. package/components/fields/FSMagicField.vue +214 -0
  27. package/components/lists/FSDataTable.vue +22 -16
  28. package/components/lists/alerts/FSBaseAlertsList.vue +96 -106
  29. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +4 -4
  30. package/components/lists/authTokens/FSBaseAuthTokensList.vue +6 -4
  31. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +97 -34
  32. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +98 -34
  33. package/components/lists/charts/FSBaseChartsList.vue +153 -64
  34. package/components/lists/comments/FSBaseCommentsList.vue +39 -23
  35. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  36. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +41 -8
  37. package/components/lists/dashboards/FSBaseDashboardsList.vue +76 -16
  38. package/components/lists/dashboards/FSSimpleDashboardsList.vue +33 -7
  39. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +8 -6
  40. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +8 -5
  41. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +70 -44
  42. package/components/lists/folders/FSBaseFoldersList.vue +27 -15
  43. package/components/lists/groupings/FSBaseGroupingsList.vue +125 -0
  44. package/components/lists/groups/FSBaseGroupsList.vue +13 -9
  45. package/components/lists/locations/FSBaseLocationsList.vue +17 -13
  46. package/components/lists/models/FSBaseModelsList.vue +10 -5
  47. package/components/lists/playlists/FSSimplePlaylistsList.vue +44 -0
  48. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +6 -5
  49. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +6 -5
  50. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +45 -8
  51. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +45 -7
  52. package/components/lists/scenarios/FSBaseScenariosList.vue +121 -86
  53. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +10 -7
  54. package/components/lists/serviceAccountRoleOrganisations/{FSBaseServiceAccountRoleOrganisations.vue → FSBaseServiceAccountRoleOrganisationsList.vue} +6 -5
  55. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +10 -7
  56. package/components/lists/userOrganisations/FSChipUserOrganisationsList.vue +61 -0
  57. package/components/selects/FSPlotPerSelector.vue +94 -16
  58. package/components/tiles/FSChartTile.vue +71 -0
  59. package/components/tiles/FSDashboardOrganisationTile.vue +3 -3
  60. package/components/tiles/FSDashboardOrganisationTypeTile.vue +3 -3
  61. package/components/tiles/FSDashboardShallowTile.vue +3 -3
  62. package/components/tiles/FSDeviceOrganisationTile.vue +3 -3
  63. package/components/tiles/FSFolderTile.vue +7 -5
  64. package/components/tiles/FSGroupTile.vue +3 -3
  65. package/components/tiles/FSLocationTile.vue +5 -3
  66. package/components/tiles/FSModelTile.vue +64 -0
  67. package/components/tiles/FSServiceAccountOrganisationTile.vue +3 -3
  68. package/components/tiles/FSUserOrganisationTile.vue +3 -3
  69. package/components/treeviews/FSTreeViewGroup.vue +7 -1
  70. package/package.json +9 -9
  71. package/utils/dashboards.ts +4 -4
  72. package/utils/index.ts +0 -1
  73. package/utils/roles.ts +3 -3
  74. package/utils/users.ts +3 -3
  75. package/components/selects/FSAggregationSelector.vue +0 -51
  76. package/components/selects/FSAxisTypeSelector.vue +0 -48
  77. package/components/selects/FSDisplayAsSelector.vue +0 -52
  78. package/components/selects/FSFilterTypeSelector.vue +0 -53
  79. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  80. package/components/selects/FSOperationOnSelector.vue +0 -51
  81. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  82. package/components/selects/FSSelectEntityType.vue +0 -59
  83. package/components/selects/FSSerieTypeSelector.vue +0 -51
  84. 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
  >
@@ -29,9 +32,10 @@
29
32
  >
30
33
  <FSImage
31
34
  v-if="item.imageId"
32
- height="38px"
33
- width="38px"
35
+ height="32px"
36
+ width="32px"
34
37
  :imageId="item.imageId"
38
+ :thumbnail="true"
35
39
  />
36
40
  </template>
37
41
  <template
@@ -63,19 +67,46 @@
63
67
  />
64
68
  </template>
65
69
  <template
66
- #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 }"
67
94
  >
68
95
  <FSFolderTileUI
69
96
  v-if="item.type == FoldersListType.Folder"
97
+ :key="index"
70
98
  :bottomColor="item.colors"
71
99
  v-bind="item"
100
+ :selectable="$props.selectable"
72
101
  :modelValue="isSelected(item.id)"
73
102
  @update:modelValue="toggleSelect(item)"
74
103
  :to="$props.itemTo && $props.itemTo(item)"
75
104
  />
76
105
  <FSDashboardOrganisationTileUI
77
106
  v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Organisation"
107
+ :key="index"
78
108
  :bottomColor="item.colors"
109
+ :selectable="$props.selectable"
79
110
  :modelValue="isSelected(item.id)"
80
111
  @update:modelValue="toggleSelect(item)"
81
112
  :to="$props.itemTo && $props.itemTo(item)"
@@ -83,7 +114,9 @@
83
114
  />
84
115
  <FSDashboardShallowTileUI
85
116
  v-if="item.type == FoldersListType.Dashboard && item.dashboardType == DashboardType.Shallow"
117
+ :key="index"
86
118
  :bottomColor="item.colors"
119
+ :selectable="$props.selectable"
87
120
  :modelValue="isSelected(item.id)"
88
121
  @update:modelValue="toggleSelect(item)"
89
122
  :to="$props.itemTo && $props.itemTo(item)"
@@ -95,33 +128,41 @@
95
128
 
96
129
  <script lang="ts">
97
130
  import _ from "lodash";
98
- import type { PropType} from "vue";
99
131
  import type { RouteLocation } from "vue-router";
100
- import { computed, defineComponent, onMounted, ref, watch } from "vue";
132
+ import { computed, defineComponent, onMounted, type PropType, ref, watch } from "vue";
101
133
 
102
134
  import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
103
135
  import { useDashboardOrganisations, useFolders, useDashboardShallows, useAppOrganisationId, useCurrentUserOrganisation } from "@dative-gpi/foundation-core-services/composables";
104
136
 
105
137
  import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
106
- import { FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
138
+ import { dashboardTypeLabel, FoldersListType, type FoldersListItem } from "@dative-gpi/foundation-core-components/utils";
107
139
  import type { FolderFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
108
140
 
109
- import FSDataTable from "../lists/FSDataTable.vue";
110
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";
111
146
  import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
112
- import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
113
147
  import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
114
- import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.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';
115
153
 
116
154
  export default defineComponent({
117
155
  name: "FSBaseFoldersExplorer",
118
156
  components: {
119
- FSDataTable,
120
- FSIcon,
121
- FSFolderTileUI,
122
157
  FSDashboardOrganisationTileUI,
123
158
  FSDashboardShallowTileUI,
124
- FSIconCheck
159
+ FSFolderTileUI,
160
+ FSDataTable,
161
+ FSIconCheck,
162
+ FSTagGroup,
163
+ FSImage,
164
+ FSChip,
165
+ FSIcon
125
166
  },
126
167
  props: {
127
168
  foldersFilters: {
@@ -151,11 +192,16 @@ export default defineComponent({
151
192
  tableCode: {
152
193
  type: String,
153
194
  required: true
195
+ },
196
+ selectable: {
197
+ type: Boolean,
198
+ required: false,
199
+ default: true
154
200
  }
155
201
  },
156
- emits: ["update:modelValue", "update:type", "update:dashboard-type"],
202
+ emits: ["update", "update:modelValue", "update:type", "update:dashboard-type"],
157
203
  setup(props, { emit }) {
158
-
204
+ const { $tr } = useTranslations();
159
205
  const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
160
206
  const { entity: organisation, get: getOrganisation } = useOrganisation();
161
207
  const { organisationId } = useAppOrganisationId();
@@ -194,14 +240,44 @@ export default defineComponent({
194
240
  })) as FoldersListItem[]
195
241
  ], d => d.label)
196
242
  ]
197
- })
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
+ }));
198
270
 
199
271
  const onSelect = (values: string[]) => {
200
272
  selecteds.value = values;
201
273
  const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
202
- emit("update:dashboard-type", selectedItems.map(i => i.dashboardType));
203
- emit("update:modelValue", selectedItems.map(i => i.id));
204
- 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 });
205
281
  };
206
282
 
207
283
  const isSelected = (id: string) => {
@@ -246,12 +322,15 @@ export default defineComponent({
246
322
  fetchingFolders,
247
323
  mainOrganisationDashboardId,
248
324
  mainUserDashboardId,
325
+ headersOptions,
326
+ ColorEnum,
249
327
  selecteds,
250
328
  items,
251
329
  onSelect,
252
330
  isSelected,
253
331
  FoldersListType,
254
- DashboardType
332
+ DashboardType,
333
+ dashboardTypeLabel
255
334
  };
256
335
  }
257
336
  });