@dative-gpi/foundation-core-components 0.0.229 → 0.1.68

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 +46 -53
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +46 -53
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +24 -39
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +46 -38
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +19 -39
  6. package/components/autocompletes/FSAutocompleteGroup.vue +17 -38
  7. package/components/autocompletes/FSAutocompleteLocation.vue +17 -38
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +57 -2
  9. package/components/autocompletes/FSAutocompleteModel.vue +58 -3
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +17 -0
  11. package/components/autocompletes/FSAutocompleteRole.vue +46 -53
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +99 -0
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +24 -57
  14. package/components/customProperties/FSMetaField.vue +5 -6
  15. package/components/customProperties/FSMetaFormContent.vue +4 -5
  16. package/components/customProperties/FSMetaGrid.vue +3 -4
  17. package/components/customProperties/FSMetaHistory.vue +16 -15
  18. package/components/customProperties/FSMetaValue.vue +67 -36
  19. package/components/customProperties/helpers.ts +5 -4
  20. package/components/entities/FSBaseEntitiesList.vue +50 -0
  21. package/components/entities/FSDialogSelectEntities.vue +76 -0
  22. package/components/entities/FSEntityField.vue +149 -0
  23. package/components/entities/FSSelectEntitiesList.vue +192 -0
  24. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  25. package/components/explorers/FSBaseFoldersExplorer.vue +258 -0
  26. package/components/lists/FSDataTable.vue +4 -8
  27. package/components/lists/alerts/FSBaseAlertsList.vue +357 -0
  28. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  29. package/components/lists/authTokens/FSBaseAuthTokensList.vue +78 -0
  30. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +159 -0
  31. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +159 -0
  32. package/components/lists/charts/FSBaseChartsList.vue +218 -0
  33. package/components/lists/comments/FSBaseCommentsList.vue +127 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +164 -0
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +222 -0
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +128 -0
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +354 -0
  40. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  41. package/components/lists/folders/FSBaseFoldersList.vue +116 -0
  42. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  43. package/components/lists/groups/FSBaseGroupsList.vue +133 -0
  44. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  45. package/components/lists/locations/FSBaseLocationsList.vue +115 -0
  46. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  47. package/components/lists/models/FSBaseModelsList.vue +152 -0
  48. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  49. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +127 -0
  50. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +127 -0
  51. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +120 -0
  52. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +107 -0
  53. package/components/lists/scenarios/FSBaseScenariosList.vue +206 -0
  54. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +153 -0
  55. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisations.vue +127 -0
  56. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +169 -0
  57. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  58. package/components/selects/FSAggregationSelector.vue +5 -5
  59. package/components/selects/FSAxisTypeSelector.vue +1 -1
  60. package/components/selects/FSDisplayAsSelector.vue +5 -5
  61. package/components/selects/FSFilterTypeSelector.vue +2 -2
  62. package/components/selects/FSHeatmapRuleSelector.vue +5 -5
  63. package/components/selects/FSOperationOnSelector.vue +5 -5
  64. package/components/selects/FSPlanningTypeSelector.vue +6 -5
  65. package/components/selects/FSPlotPerSelector.vue +5 -5
  66. package/components/selects/{FSSelectSelectedEntities.vue → FSSelectEntityType.vue} +12 -12
  67. package/components/selects/FSSerieTypeSelector.vue +5 -5
  68. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  69. package/components/tiles/FSLocationTile.vue +65 -0
  70. package/components/tiles/FSServiceAccountOrganisationTile.vue +68 -0
  71. package/components/tiles/FSUserOrganisationTile.vue +0 -2
  72. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  73. package/components/treeviews/FSTreeViewGroup.vue +15 -3
  74. package/package.json +7 -7
  75. package/utils/charts.ts +2 -1
  76. package/utils/dashboards.ts +31 -4
  77. package/utils/index.ts +2 -1
  78. package/utils/permissions.ts +80 -0
  79. package/utils/roles.ts +2 -3
  80. package/utils/tables.ts +41 -0
  81. package/utils/users.ts +4 -1
  82. package/components/selects/FSDataCategorySelector.vue +0 -62
  83. package/components/selects/FSDataDefinitionSelector.vue +0 -66
  84. package/components/selects/FSModelSelector.vue +0 -56
@@ -0,0 +1,354 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingDeviceOrganisations"
4
+ :singleSelect="$props.singleSelect"
5
+ :headersOptions="headersOptions"
6
+ :showSelect="$props.editable"
7
+ :tableCode="$props.tableCode"
8
+ :items="deviceOrganisations"
9
+ :itemTo="$props.itemTo"
10
+ :modelValue="$props.modelValue"
11
+ @update:modelValue="$emit('update:modelValue', $event)"
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
+ #header.connectable-title
32
+ >
33
+ <FSIcon>
34
+ mdi-wifi
35
+ </FSIcon>
36
+ </template>
37
+ <template
38
+ #header.connectivity-title
39
+ >
40
+ <FSIcon>
41
+ mdi-wifi
42
+ </FSIcon>
43
+ </template>
44
+ <template
45
+ #item.imageId="{ item }"
46
+ >
47
+ <FSImage
48
+ v-if="item.imageId"
49
+ height="32px"
50
+ width="32px"
51
+ :imageId="item.imageId"
52
+ />
53
+ </template>
54
+ <template
55
+ #item.connectable="{ item }"
56
+ >
57
+ <FSCol>
58
+ <FSConnectivity
59
+ v-if="item.connectivity.status != ConnectivityStatus.None"
60
+ :deviceConnectivity="item.connectivity"
61
+ />
62
+ </FSCol>
63
+ </template>
64
+ <template
65
+ #item.connectivity="{ item }"
66
+ >
67
+ <FSCol>
68
+ <FSConnectivity
69
+ v-if="item.connectivity.status != ConnectivityStatus.None"
70
+ :deviceConnectivity="item.connectivity"
71
+ />
72
+ </FSCol>
73
+ </template>
74
+ <template
75
+ #item.unrestricted="{ item }"
76
+ >
77
+ <FSIconCheck
78
+ :value="item.unrestricted"
79
+ />
80
+ </template>
81
+ <template
82
+ #item.tags="{ item }"
83
+ >
84
+ <FSTagGroup
85
+ variant="slide"
86
+ :editable="false"
87
+ :tags="item.tags"
88
+ />
89
+ </template>
90
+ <template
91
+ #item.worstAlert="{ item }"
92
+ >
93
+ <FSWorstAlert
94
+ v-if="item.worstAlert"
95
+ :deviceWorstAlert="item.worstAlert"
96
+ :deviceAlerts="item.alerts"
97
+ :alertTo="$props.alertTo"
98
+ />
99
+ <div
100
+ v-else
101
+ />
102
+ </template>
103
+ <template
104
+ #item.alerts="{ item }"
105
+ >
106
+ <FSWorstAlert
107
+ v-if="item.worstAlert"
108
+ :deviceWorstAlert="item.worstAlert"
109
+ :deviceAlerts="item.alerts"
110
+ :alertTo="$props.alertTo"
111
+ />
112
+ <div
113
+ v-else
114
+ />
115
+ </template>
116
+ <template
117
+ #item.status="{ item }"
118
+ >
119
+ <FSStatusesCarousel
120
+ :modelStatuses="item.modelStatuses"
121
+ :deviceStatuses="item.status.statuses"
122
+ />
123
+ </template>
124
+ <template
125
+ #item.actions="{ item }"
126
+ >
127
+ <slot
128
+ name="actions"
129
+ v-bind="{ item }"
130
+ >
131
+ </slot>
132
+ </template>
133
+ <template
134
+ v-for="(property, index) in customProperties"
135
+ #[`item.meta.${property.code}`]="{ item }"
136
+ :key="index"
137
+ >
138
+ <FSMetaValue
139
+ :customProperty="property"
140
+ :meta="item.meta"
141
+ />
142
+ </template>
143
+ <template
144
+ v-for="(property, index) in customProperties"
145
+ #[`filter.meta.${property.code}`]="{ filter }"
146
+ :key="index"
147
+ >
148
+ <FSMetaValue
149
+ v-if="filter.text !== '—'"
150
+ variant="colorless"
151
+ :customProperty="property"
152
+ :meta="{ [property.code]: filter.text }"
153
+ />
154
+ </template>
155
+ <template
156
+ #item.tile="{ item, toggleSelect }"
157
+ >
158
+ <FSDeviceOrganisationTileUI
159
+ :to="$props.itemTo && $props.itemTo(item)"
160
+ :deviceConnectivity="item.connectivity"
161
+ :deviceStatuses="item.status.statuses"
162
+ :deviceWorstAlert="item.worstAlert"
163
+ :singleSelect="$props.singleSelect"
164
+ :deviceAlerts="item.alerts"
165
+ :alertTo="$props.alertTo"
166
+ :modelValue="isSelected(item.id)"
167
+ @update:modelValue="toggleSelect(item)"
168
+ v-bind="item"
169
+ />
170
+ </template>
171
+ </FSDataTable>
172
+ </template>
173
+
174
+ <script lang="ts">
175
+ import { computed, defineComponent, onMounted, type PropType, watch } from "vue";
176
+ import { type RouteLocation } from "vue-router";
177
+ import _ from "lodash";
178
+
179
+ import { alphanumericSort, connectivityLabel } from "@dative-gpi/foundation-shared-components/utils";
180
+ import { ConnectivityStatus, PropertyEntity } from "@dative-gpi/foundation-shared-domain/enums";
181
+
182
+ import type { DeviceConnectivityDetails, DeviceOrganisationAlert, DeviceOrganisationFilters, DeviceOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
183
+ import { useCustomProperties, useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
184
+
185
+ import FSMetaValue from "../../customProperties/FSMetaValue.vue";
186
+ import FSDataTable from "../FSDataTable.vue";
187
+
188
+ import FSDeviceOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDeviceOrganisationTileUI.vue";
189
+ import FSStatusesCarousel from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSStatusesCarousel.vue";
190
+ import FSConnectivity from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSConnectivity.vue";
191
+ import FSWorstAlert from "@dative-gpi/foundation-shared-components/components/deviceOrganisations/FSWorstAlert.vue";
192
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
193
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
194
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
195
+
196
+ export default defineComponent({
197
+ name: "FSBaseDeviceOrganisationsList",
198
+ components: {
199
+ FSDeviceOrganisationTileUI,
200
+ FSStatusesCarousel,
201
+ FSConnectivity,
202
+ FSWorstAlert,
203
+ FSDataTable,
204
+ FSIconCheck,
205
+ FSMetaValue,
206
+ FSTagGroup,
207
+ FSImage
208
+ },
209
+ props: {
210
+ tableCode: {
211
+ type: String,
212
+ required: true
213
+ },
214
+ deviceOrganisationFilters: {
215
+ type: Object as PropType<DeviceOrganisationFilters>,
216
+ required: false,
217
+ default: null
218
+ },
219
+ connectedOnly: {
220
+ type: Boolean,
221
+ required: false,
222
+ default: false
223
+ },
224
+ itemTo: {
225
+ type: Function as PropType<(item: DeviceOrganisationInfos) => Partial<RouteLocation>>,
226
+ required: false
227
+ },
228
+ alertTo: {
229
+ type: Function,
230
+ required: false,
231
+ default: null
232
+ },
233
+ editable: {
234
+ type: Boolean,
235
+ required: false,
236
+ default: true
237
+ },
238
+ singleSelect: {
239
+ type: Boolean,
240
+ required: false,
241
+ default: false
242
+ },
243
+ modelValue: {
244
+ type: Array as PropType<string[]>,
245
+ default: () => [],
246
+ required: false
247
+ }
248
+ },
249
+ emits: ["update:modelValue"],
250
+ setup(props) {
251
+ const { fetching: fecthingCustomProperties, entities: customProperties, getMany: getManyCustomProperties } = useCustomProperties();
252
+ const { entities, fetching: fetchingDeviceOrganisations, getMany: getManyDeviceOrganisations } = useDeviceOrganisations();
253
+
254
+ const deviceOrganisations = computed((): DeviceOrganisationInfos[] => {
255
+ if (props.connectedOnly) {
256
+ return entities.value.filter(d => d.connectivity != null && d.connectivity.status != ConnectivityStatus.None);
257
+ }
258
+ return entities.value;
259
+ });
260
+
261
+ const headersOptions = computed(() => ({
262
+ connectable: {
263
+ fixedFilters: [{
264
+ value: ConnectivityStatus.None,
265
+ text: "—"
266
+ }, {
267
+ value: ConnectivityStatus.Offline,
268
+ text: connectivityLabel(ConnectivityStatus.Offline)
269
+ }, {
270
+ value: ConnectivityStatus.AlmostOffline,
271
+ text: connectivityLabel(ConnectivityStatus.AlmostOffline)
272
+ }, {
273
+ value: ConnectivityStatus.PartiallyConnected,
274
+ text: connectivityLabel(ConnectivityStatus.PartiallyConnected)
275
+ }, {
276
+ value: ConnectivityStatus.Connected,
277
+ text: connectivityLabel(ConnectivityStatus.Connected)
278
+ }],
279
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => !item.status && !value || item.status == value,
280
+ sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
281
+ },
282
+ connectivity: {
283
+ fixedFilters: [{
284
+ value: ConnectivityStatus.None,
285
+ text: "—"
286
+ }, {
287
+ value: ConnectivityStatus.Offline,
288
+ text: connectivityLabel(ConnectivityStatus.Offline)
289
+ }, {
290
+ value: ConnectivityStatus.AlmostOffline,
291
+ text: connectivityLabel(ConnectivityStatus.AlmostOffline)
292
+ }, {
293
+ value: ConnectivityStatus.PartiallyConnected,
294
+ text: connectivityLabel(ConnectivityStatus.PartiallyConnected)
295
+ }, {
296
+ value: ConnectivityStatus.Connected,
297
+ text: connectivityLabel(ConnectivityStatus.Connected)
298
+ }],
299
+ methodFilter: (value: ConnectivityStatus, item: DeviceConnectivityDetails) => !item.status && !value || item.status == value,
300
+ sort: (a: DeviceConnectivityDetails, b: DeviceConnectivityDetails) => alphanumericSort(a?.status, b?.status)
301
+ },
302
+ worstAlert: {
303
+ sort: (a: DeviceOrganisationAlert, b: DeviceOrganisationAlert) => alphanumericSort(a?.criticity, b?.criticity)
304
+ },
305
+ ...customProperties.value.reduce((acc, cp) => ({
306
+ ...acc,
307
+ [`meta.${cp.code}`]: {
308
+ fixedFilters: cp.useOnlyAllowedValues ? [{
309
+ value: (null as string | null),
310
+ text: "—"
311
+ }].concat(Object.keys(cp.allowedValues).map(av => ({
312
+ value: av,
313
+ text: av
314
+ }))): undefined,
315
+ methodFilterRaw: (value: any, item: DeviceOrganisationInfos) => {
316
+ if (cp.useOnlyAllowedValues) {
317
+ return (!Object.keys(cp.allowedValues).includes(item.meta[cp.code])) && !value || item.meta[cp.code] === value;
318
+ }
319
+ return !item.meta[cp.code] && !value || item.meta[cp.code] === value;
320
+ },
321
+ sort: (a: string, b: string) => alphanumericSort(a, b)
322
+ }
323
+ }), {})
324
+ }));
325
+
326
+ const isSelected = (id: string): boolean => {
327
+ return props.modelValue.includes(id);
328
+ };
329
+
330
+ onMounted((): void => {
331
+ getManyCustomProperties({
332
+ entities: [PropertyEntity.Device, PropertyEntity.DeviceOrganisation]
333
+ });
334
+ });
335
+
336
+ watch(() => props.deviceOrganisationFilters, (next, previous) => {
337
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
338
+ getManyDeviceOrganisations(props.deviceOrganisationFilters);
339
+ }
340
+ }, { immediate: true });
341
+
342
+ return {
343
+ fetchingDeviceOrganisations,
344
+ fecthingCustomProperties,
345
+ deviceOrganisations,
346
+ ConnectivityStatus,
347
+ customProperties,
348
+ headersOptions,
349
+ isSelected
350
+ };
351
+ }
352
+ });
353
+ </script>
354
+
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="deviceOrganisations"
4
+ :loading="fetching"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent, type PropType, watch } from "vue";
11
+
12
+ import type { DeviceOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useDeviceOrganisations } from "@dative-gpi/foundation-core-services/composables";
14
+
15
+ import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
16
+
17
+ export default defineComponent({
18
+ name: "FSSimpleDeviceOrganisationsList",
19
+ components: {
20
+ FSSimpleList,
21
+ },
22
+ props: {
23
+ deviceOrganisationFilters: {
24
+ type: Object as PropType<DeviceOrganisationFilters>,
25
+ required: false,
26
+ default: () => ({})
27
+ }
28
+ },
29
+ setup(props){
30
+ const { entities: deviceOrganisations, getMany, fetching } = useDeviceOrganisations();
31
+
32
+ const fetch = () => {
33
+ getMany(props.deviceOrganisationFilters);
34
+ }
35
+
36
+ watch(() => props.deviceOrganisationFilters, fetch, { immediate: true });
37
+
38
+ return {
39
+ deviceOrganisations,
40
+ fetching
41
+ }
42
+ }
43
+ });
44
+ </script>
@@ -0,0 +1,116 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="folders"
4
+ :item-to="$props.itemTo"
5
+ :loading="fetchingFolders"
6
+ :tableCode="$props.tableCode"
7
+ :modelValue="$props.modelValue"
8
+ @update:modelValue="$emit('update:modelValue', $event)"
9
+ v-bind="$attrs"
10
+ >
11
+ <template
12
+ v-for="(_, name) in $slots"
13
+ v-slot:[name]="slotData"
14
+ >
15
+ <slot
16
+ :name="name"
17
+ v-bind="slotData"
18
+ />
19
+ </template>
20
+
21
+ <template
22
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+
29
+ <template
30
+ #item.tile="{ item, toggleSelect }"
31
+ >
32
+ <FSFolderTileUI
33
+ :bottomColor="item.colors"
34
+ v-bind="item"
35
+ :modelValue="isSelected(item.id)"
36
+ @update:modelValue="toggleSelect(item)"
37
+ :to="$props.itemTo && $props.itemTo(item)"
38
+ />
39
+ </template>
40
+ </FSDataTable>
41
+ </template>
42
+
43
+ <script lang="ts">
44
+ import _ from "lodash";
45
+ import type { PropType} from "vue";
46
+ import type { RouteLocation } from "vue-router";
47
+ import { defineComponent, watch } from "vue";
48
+
49
+ import { useFolders } from "@dative-gpi/foundation-core-services/composables";
50
+
51
+ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
52
+ import { FoldersListType } from "@dative-gpi/foundation-core-components/utils";
53
+ import type { FolderFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
54
+
55
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
56
+ import FSFolderTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSFolderTileUI.vue";
57
+
58
+ import FSDataTable from "../FSDataTable.vue";
59
+
60
+ export default defineComponent({
61
+ name: "FSBaseFoldersList",
62
+ components: {
63
+ FSDataTable,
64
+ FSIcon,
65
+ FSFolderTileUI
66
+ },
67
+ props: {
68
+ foldersFilters: {
69
+ type: Object as PropType<FolderFilters>,
70
+ default: undefined,
71
+ required: false
72
+ },
73
+ modelValue: {
74
+ type: Array as PropType<string[]>,
75
+ required: false,
76
+ default: () => []
77
+ },
78
+ itemTo: {
79
+ type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
80
+ required: false
81
+ },
82
+ tableCode: {
83
+ type: String,
84
+ required: true
85
+ }
86
+ },
87
+ emits: ["update:modelValue"],
88
+ setup(props, { emit }) {
89
+
90
+ const { entities: folders, fetching: fetchingFolders, getMany: getManyFolders } = useFolders();
91
+
92
+ const onSelect = (values: string[]) => {
93
+ emit("update:modelValue", values);
94
+ };
95
+
96
+ const isSelected = (id: string) => {
97
+ return props.modelValue?.includes(id);
98
+ };
99
+
100
+ watch(() => props.foldersFilters, (next, previous) => {
101
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
102
+ getManyFolders(props.foldersFilters, f => f.parentId == props.foldersFilters?.parentId);
103
+ }
104
+ }, { immediate: true });
105
+
106
+ return {
107
+ fetchingFolders,
108
+ folders,
109
+ onSelect,
110
+ isSelected,
111
+ FoldersListType,
112
+ DashboardType
113
+ };
114
+ }
115
+ });
116
+ </script>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="folders"
4
+ :loading="fetching"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent, type PropType, watch } from "vue";
11
+
12
+ import type { FolderFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useFolders } from "@dative-gpi/foundation-core-services/composables";
14
+
15
+ import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
16
+
17
+ export default defineComponent({
18
+ name: "FSSimpleFoldersList",
19
+ components: {
20
+ FSSimpleList,
21
+ },
22
+ props: {
23
+ folderFilters: {
24
+ type: Object as PropType<FolderFilters>,
25
+ required: false,
26
+ default: () => ({})
27
+ }
28
+ },
29
+ setup(props){
30
+ const { entities: folders, getMany, fetching } = useFolders();
31
+
32
+ const fetch = () => {
33
+ getMany(props.folderFilters);
34
+ }
35
+
36
+ watch(() => props.folderFilters, fetch, { immediate: true });
37
+
38
+ return {
39
+ folders,
40
+ fetching
41
+ }
42
+ }
43
+ });
44
+ </script>
@@ -0,0 +1,133 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingGroups"
4
+ :items="groups"
5
+ :showSelect="$props.editable"
6
+ :tableCode="$props.tableCode"
7
+ :modelValue="$props.modelValue"
8
+ @update:modelValue="$emit('update:modelValue', $event)"
9
+ v-bind="$attrs"
10
+ >
11
+ <template
12
+ v-for="(_, name) in $slots"
13
+ v-slot:[name]="slotData"
14
+ >
15
+ <slot
16
+ :name="name"
17
+ v-bind="slotData"
18
+ />
19
+ </template>
20
+ <template
21
+ #header.imageId-title
22
+ >
23
+ <FSIcon>
24
+ mdi-panorama-variant-outline
25
+ </FSIcon>
26
+ </template>
27
+ <template
28
+ #item.imageId="{ item }"
29
+ >
30
+ <FSImage
31
+ v-if="item.imageId"
32
+ height="38px"
33
+ width="38px"
34
+ :imageId="item.imageId"
35
+ />
36
+ </template>
37
+ <template
38
+ #item.icon="{ item }"
39
+ >
40
+ <FSIcon>
41
+ {{ item.icon }}
42
+ </FSIcon>
43
+ </template>
44
+ <template
45
+ #item.tags="{ item }"
46
+ >
47
+ <FSTagGroup
48
+ variant="slide"
49
+ :editable="false"
50
+ :tags="item.tags"
51
+ />
52
+ </template>
53
+ <template
54
+ #item.tile="{ item, toggleSelect }"
55
+ >
56
+ <FSGroupTileUI
57
+ :editable="$props.editable"
58
+ :modelValue="isSelected(item.id)"
59
+ @update:modelValue="toggleSelect(item)"
60
+ v-bind="item"
61
+ />
62
+ </template>
63
+ </FSDataTable>
64
+ </template>
65
+
66
+ <script lang="ts">
67
+ import { defineComponent, watch } from "vue";
68
+ import type { PropType} from "vue";
69
+ import _ from "lodash";
70
+
71
+ import type { GroupFilters } from "@dative-gpi/foundation-core-domain/models";
72
+ import { useGroups } from "@dative-gpi/foundation-core-services/composables";
73
+
74
+ import FSDataTable from "../FSDataTable.vue";
75
+
76
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
77
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
78
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
79
+ import FSGroupTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSGroupTileUI.vue";
80
+
81
+
82
+ export default defineComponent({
83
+ name: "FSBaseGroupsList",
84
+ components: {
85
+ FSDataTable,
86
+ FSImage,
87
+ FSIcon,
88
+ FSGroupTileUI,
89
+ FSTagGroup
90
+ },
91
+ props: {
92
+ tableCode: {
93
+ type: String,
94
+ required: true
95
+ },
96
+ groupsFilters: {
97
+ type: Object as PropType<GroupFilters>,
98
+ required: false,
99
+ default: null
100
+ },
101
+ editable: {
102
+ type: Boolean,
103
+ required: false,
104
+ default: true
105
+ },
106
+ modelValue: {
107
+ type: Array as PropType<string[]>,
108
+ required: false,
109
+ default: () => []
110
+ }
111
+ },
112
+ emits: ["update:modelValue"],
113
+ setup(props) {
114
+ const { getMany: fetchGroups, fetching: fetchingGroups, entities: groups } = useGroups();
115
+
116
+ const isSelected = (id: string) => {
117
+ return props.modelValue.includes(id);
118
+ };
119
+
120
+ watch(() => props.groupsFilters, (next, previous) => {
121
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
122
+ fetchGroups(props.groupsFilters);
123
+ }
124
+ }, { immediate: true });
125
+
126
+ return {
127
+ fetchingGroups,
128
+ groups,
129
+ isSelected
130
+ };
131
+ }
132
+ });
133
+ </script>