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