@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,44 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="groups"
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 { GroupFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useGroups } 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: "FSSimpleGroupsList",
19
+ components: {
20
+ FSSimpleList,
21
+ },
22
+ props: {
23
+ groupFilters: {
24
+ type: Object as PropType<GroupFilters>,
25
+ required: false,
26
+ default: () => ({})
27
+ }
28
+ },
29
+ setup(props){
30
+ const { entities: groups, getMany, fetching } = useGroups();
31
+
32
+ const fetch = () => {
33
+ getMany(props.groupFilters);
34
+ }
35
+
36
+ watch(() => props.groupFilters, fetch, { immediate: true });
37
+
38
+ return {
39
+ groups,
40
+ fetching
41
+ }
42
+ }
43
+ });
44
+ </script>
@@ -0,0 +1,118 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :loading="fetchingLocations"
5
+ :items="locations"
6
+ :showSelect="$props.editable"
7
+ :tableCode="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
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon >
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+
29
+ <template
30
+ #item.tile="{ item, toggleSelect }"
31
+ >
32
+ <FSLocationTileUI
33
+ v-bind="item"
34
+ :bottomColor="item.colors"
35
+ :address="item.address.placeLabel"
36
+ :editable="true"
37
+ :singleSelect="singleSelect"
38
+ :modelValue="isSelected(item.id)"
39
+ :to="$props.itemTo && $props.itemTo(item)"
40
+ @update:modelValue="toggleSelect(item)"
41
+ />
42
+ </template>
43
+ </FSDataTable>
44
+ </template>
45
+
46
+ <script lang="ts">
47
+ import _ from "lodash";
48
+ import type { RouteLocation } from "vue-router";
49
+ import { defineComponent, type PropType, watch } from "vue";
50
+
51
+ import { useLocations } from "@dative-gpi/foundation-core-services/composables";
52
+ import type { LocationFilters, LocationInfos } from "@dative-gpi/foundation-core-domain/models";
53
+
54
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
55
+
56
+ import FSDataTable from "../FSDataTable.vue";
57
+ import FSLocationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSLocationTileUI.vue";
58
+
59
+ export default defineComponent({
60
+ name: "FSBaseLocationsList",
61
+ components: {
62
+ FSLocationTileUI,
63
+ FSDataTable,
64
+ FSIcon
65
+ },
66
+ props: {
67
+ tableCode: {
68
+ type: String as PropType<string | null>,
69
+ required: false,
70
+ default: null
71
+ },
72
+ locationsFilters: {
73
+ type: Object as PropType<LocationFilters>,
74
+ required: false,
75
+ default: null
76
+ },
77
+ editable: {
78
+ type: Boolean,
79
+ required: false,
80
+ default: true
81
+ },
82
+ itemTo: {
83
+ type: Function as PropType<(item: LocationInfos) => Partial<RouteLocation>>,
84
+ required: false
85
+ },
86
+ singleSelect: {
87
+ type: Boolean,
88
+ required: false,
89
+ default: false
90
+ },
91
+ modelValue: {
92
+ type: Array as PropType<string[]>,
93
+ default: () => [],
94
+ required: false
95
+ }
96
+ },
97
+ emits: ["update:modelValue"],
98
+ setup(props) {
99
+ const { getMany: fetchLocations, fetching: fetchingLocations, entities: locations } = useLocations();
100
+
101
+ watch(() => props.locationsFilters, (next, previous) => {
102
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
103
+ fetchLocations(props.locationsFilters);
104
+ }
105
+ }, { immediate: true });
106
+
107
+ const isSelected = (id: string) => {
108
+ return props.modelValue?.includes(id);
109
+ };
110
+
111
+ return {
112
+ fetchingLocations,
113
+ isSelected,
114
+ locations
115
+ };
116
+ }
117
+ });
118
+ </script>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="locations"
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 { LocationFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useLocations } 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: "FSSimpleLocationsList",
19
+ components: {
20
+ FSSimpleList,
21
+ },
22
+ props: {
23
+ locationFilters: {
24
+ type: Object as PropType<LocationFilters>,
25
+ required: false,
26
+ default: () => ({})
27
+ }
28
+ },
29
+ setup(props){
30
+ const { entities: locations, getMany, fetching } = useLocations();
31
+
32
+ const fetch = () => {
33
+ getMany(props.locationFilters);
34
+ }
35
+
36
+ watch(() => props.locationFilters, fetch, { immediate: true });
37
+
38
+ return {
39
+ locations,
40
+ fetching
41
+ }
42
+ }
43
+ });
44
+ </script>
@@ -0,0 +1,155 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :singleSelect="$props.singleSelect"
5
+ :showSelect="$props.editable"
6
+ :tableCode="$props.tableCode"
7
+ :loading="fetchingModels"
8
+ :items="models"
9
+ :modelValue="$props.modelValue"
10
+ @update:modelValue="$emit('update:modelValue', $event)"
11
+ v-bind="$attrs"
12
+ >
13
+ <template
14
+ v-for="(_, name) in $slots"
15
+ v-slot:[name]="slotData"
16
+ >
17
+ <slot
18
+ :name="name"
19
+ v-bind="slotData"
20
+ />
21
+ </template>
22
+ <template
23
+ #header.imageId-title
24
+ >
25
+ <FSIcon>
26
+ mdi-panorama-variant-outline
27
+ </FSIcon>
28
+ </template>
29
+ <template
30
+ #header.connectable-title
31
+ >
32
+ <FSIcon>
33
+ mdi-wifi
34
+ </FSIcon>
35
+ </template>
36
+ <template
37
+ #item.imageId="{ item }"
38
+ >
39
+ <FSImage
40
+ v-if="item.imageId"
41
+ height="32px"
42
+ width="32px"
43
+ :imageId="item.imageId"
44
+ :thumbnail="true"
45
+ />
46
+ </template>
47
+ <template
48
+ #item.icon="{ item }"
49
+ >
50
+ <FSIcon >
51
+ {{ item.icon }}
52
+ </FSIcon>
53
+ </template>
54
+ <template
55
+ #item.connectable="{ item }"
56
+ >
57
+ <FSIconCheck
58
+ :value="item.connectable"
59
+ />
60
+ </template>
61
+ <template
62
+ #item.tile="{ item, toggleSelect }"
63
+ >
64
+ <FSModelTileUI
65
+ :to="$props.itemTo && $props.itemTo(item)"
66
+ :singleSelect="$props.singleSelect"
67
+ :imageId="item.imageId"
68
+ :label="item.label"
69
+ :modelValue="isSelected(item.id)"
70
+ @update:modelValue="toggleSelect(item)"
71
+ v-bind="item"
72
+ />
73
+ </template>
74
+ </FSDataTable>
75
+ </template>
76
+
77
+ <script lang="ts">
78
+ import _ from "lodash";
79
+ import type { RouteLocation } from "vue-router";
80
+ import { defineComponent, type PropType, watch } from "vue";
81
+
82
+ import {ColorEnum} from "@dative-gpi/foundation-shared-components/models";
83
+
84
+ import { useModels } from "@dative-gpi/foundation-core-services/composables";
85
+ import type { ModelFilters, ModelInfos } from "@dative-gpi/foundation-core-domain/models";
86
+
87
+ import FSDataTable from "../FSDataTable.vue";
88
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
89
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
90
+ import FSIconCheck from "@dative-gpi/foundation-shared-components/components/FSIconCheck.vue";
91
+ import FSModelTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSModelTileUI.vue";
92
+
93
+ export default defineComponent({
94
+ name: "FSBaseModelsList",
95
+ components: {
96
+ FSModelTileUI,
97
+ FSDataTable,
98
+ FSIconCheck,
99
+ FSImage,
100
+ FSIcon,
101
+ },
102
+ props: {
103
+ tableCode: {
104
+ type: String as PropType<string | null>,
105
+ required: false,
106
+ default: null
107
+ },
108
+ modelsFilters: {
109
+ type: Object as PropType<ModelFilters>,
110
+ required: false,
111
+ default: null
112
+ },
113
+ itemTo: {
114
+ type: Function as PropType<(item: ModelInfos) => Partial<RouteLocation>>,
115
+ required: false
116
+ },
117
+ editable: {
118
+ type: Boolean,
119
+ required: false,
120
+ default: true
121
+ },
122
+ singleSelect: {
123
+ type: Boolean,
124
+ required: false,
125
+ default: false
126
+ },
127
+ modelValue: {
128
+ type: Array as PropType<string[]>,
129
+ default: () => [],
130
+ required: false
131
+ }
132
+ },
133
+ emits: ["update:modelValue"],
134
+ setup(props) {
135
+ const { getMany: fetchModels, fetching: fetchingModels, entities: models } = useModels();
136
+
137
+ const isSelected = (id: string): boolean => {
138
+ return props.modelValue.includes(id);
139
+ };
140
+
141
+ watch(() => props.modelsFilters, (next, previous) => {
142
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
143
+ fetchModels(props.modelsFilters);
144
+ }
145
+ }, { immediate: true });
146
+
147
+ return {
148
+ fetchingModels,
149
+ ColorEnum,
150
+ models,
151
+ isSelected
152
+ };
153
+ }
154
+ });
155
+ </script>
@@ -0,0 +1,44 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="models"
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 { ModelFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useModels } 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: "FSSimpleModelsList",
19
+ components: {
20
+ FSSimpleList,
21
+ },
22
+ props: {
23
+ modelFilters: {
24
+ type: Object as PropType<ModelFilters>,
25
+ required: false,
26
+ default: () => ({})
27
+ }
28
+ },
29
+ setup(props){
30
+ const { entities: models, getMany, fetching } = useModels();
31
+
32
+ const fetch = () => {
33
+ getMany(props.modelFilters);
34
+ }
35
+
36
+ watch(() => props.modelFilters, fetch, { immediate: true });
37
+
38
+ return {
39
+ models,
40
+ fetching
41
+ }
42
+ }
43
+ });
44
+ </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="roleOrganisationTypes"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingRoleOrganisations"
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
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.userType="{ item }"
30
+ >
31
+ <FSRow
32
+ align="center-left"
33
+ >
34
+ <FSIcon>
35
+ {{ userTypeIcon(item.userType) }}
36
+ </FSIcon>
37
+ <FSText>
38
+ {{ userTypeLabel(item.userType) }}
39
+ </FSText>
40
+ </FSRow>
41
+ </template>
42
+ <template
43
+ #item.tags="{ item }"
44
+ >
45
+ <FSTagGroup
46
+ variant="slide"
47
+ :editable="false"
48
+ :tags="item.tags"
49
+ />
50
+ </template>
51
+ </FSDataTable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import type { PropType} from "vue";
56
+ import { defineComponent, watch } from "vue";
57
+ import type { RouteLocation } from "vue-router";
58
+ import _ from "lodash";
59
+
60
+ import type { RoleOrganisationTypeFilters, RoleOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
61
+ import { userTypeIcon, userTypeLabel } from "@dative-gpi/foundation-core-components/utils";
62
+ import { useRoleOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
63
+
64
+ import FSDataTable from "../FSDataTable.vue";
65
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
66
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
67
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
68
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
69
+
70
+ export default defineComponent({
71
+ name: "FSBaseRoleOrganisationTypesList",
72
+ components: {
73
+ FSRow,
74
+ FSIcon,
75
+ FSText,
76
+ FSTagGroup,
77
+ FSDataTable,
78
+ },
79
+ props: {
80
+ tableCode: {
81
+ type: String as PropType<string | null>,
82
+ required: false,
83
+ default: null
84
+ },
85
+ roleOrganisationTypesFilters: {
86
+ type: Object as PropType<RoleOrganisationTypeFilters | null>,
87
+ required: false,
88
+ default: null
89
+ },
90
+ itemTo: {
91
+ type: Function as PropType<(item: RoleOrganisationTypeInfos) => Partial<RouteLocation>>,
92
+ required: false
93
+ },
94
+ editable: {
95
+ type: Boolean,
96
+ required: false,
97
+ default: true
98
+ },
99
+ modelValue: {
100
+ type: Array as PropType<string[]>,
101
+ required: false,
102
+ default: () => []
103
+ }
104
+ },
105
+ emits: ["update:modelValue"],
106
+ setup(props) {
107
+ const { getMany: getManyRoleOrganisationTypes, entities: roleOrganisationTypes, fetching: fetchingRoleOrganisations } = useRoleOrganisationTypes();
108
+
109
+ const isSelected = (id: string): boolean => {
110
+ return props.modelValue.includes(id);
111
+ };
112
+
113
+ watch(() => props.roleOrganisationTypesFilters, (next, previous) => {
114
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
115
+ getManyRoleOrganisationTypes(props.roleOrganisationTypesFilters ?? undefined);
116
+ }
117
+ }, { immediate: true });
118
+
119
+ return {
120
+ fetchingRoleOrganisations,
121
+ roleOrganisationTypes,
122
+ userTypeLabel,
123
+ userTypeIcon,
124
+ isSelected
125
+ };
126
+ }
127
+ });
128
+ </script>
@@ -0,0 +1,128 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingRoleOrganisations"
4
+ :showSelect="$props.editable"
5
+ :tableCode="$props.tableCode"
6
+ :items="roleOrganisations"
7
+ :itemTo="$props.itemTo"
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
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.userType="{ item }"
30
+ >
31
+ <FSRow
32
+ align="center-left"
33
+ >
34
+ <FSIcon>
35
+ {{ userTypeIcon(item.userType) }}
36
+ </FSIcon>
37
+ <FSText>
38
+ {{ userTypeLabel(item.userType) }}
39
+ </FSText>
40
+ </FSRow>
41
+ </template>
42
+ <template
43
+ #item.tags="{ item }"
44
+ >
45
+ <FSTagGroup
46
+ variant="slide"
47
+ :editable="false"
48
+ :tags="item.tags"
49
+ />
50
+ </template>
51
+ </FSDataTable>
52
+ </template>
53
+
54
+ <script lang="ts">
55
+ import { defineComponent, type PropType, watch } from "vue";
56
+ import { type RouteLocation } from "vue-router";
57
+ import _ from "lodash";
58
+
59
+ import { type RoleOrganisationFilters, type RoleOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
60
+ import { userTypeIcon, userTypeLabel } from "@dative-gpi/foundation-core-components/utils";
61
+ import { useRoleOrganisations } from "@dative-gpi/foundation-core-services/composables";
62
+
63
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
64
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
65
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
66
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
67
+
68
+ import FSDataTable from "../FSDataTable.vue";
69
+
70
+ export default defineComponent({
71
+ name: "FSBaseRoleOrganisationsList",
72
+ components: {
73
+ FSDataTable,
74
+ FSTagGroup,
75
+ FSIcon,
76
+ FSText,
77
+ FSRow
78
+ },
79
+ props: {
80
+ tableCode: {
81
+ type: String as PropType<string | null>,
82
+ required: false,
83
+ default: null
84
+ },
85
+ roleOrganisationsFilters: {
86
+ type: Object as PropType<RoleOrganisationFilters | null>,
87
+ required: false,
88
+ default: null
89
+ },
90
+ itemTo: {
91
+ type: Function as PropType<(item: RoleOrganisationInfos) => Partial<RouteLocation>>,
92
+ required: false
93
+ },
94
+ editable: {
95
+ type: Boolean,
96
+ required: false,
97
+ default: true
98
+ },
99
+ modelValue: {
100
+ type: Array as PropType<string[]>,
101
+ required: false,
102
+ default: () => []
103
+ }
104
+ },
105
+ emits: ["update:modelValue"],
106
+ setup(props) {
107
+ const { getMany: getManyRoleOrganisations, entities: roleOrganisations, fetching: fetchingRoleOrganisations } = useRoleOrganisations();
108
+
109
+ const isSelected = (id: string): boolean => {
110
+ return props.modelValue.includes(id);
111
+ };
112
+
113
+ watch(() => props.roleOrganisationsFilters, (next, previous) => {
114
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
115
+ getManyRoleOrganisations(props.roleOrganisationsFilters ?? undefined);
116
+ }
117
+ }, { immediate: true });
118
+
119
+ return {
120
+ fetchingRoleOrganisations,
121
+ roleOrganisations,
122
+ userTypeLabel,
123
+ userTypeIcon,
124
+ isSelected
125
+ };
126
+ }
127
+ });
128
+ </script>