@dative-gpi/foundation-core-components 1.0.27 → 1.0.28-remove-deprecated2

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