@dative-gpi/foundation-core-components 1.0.26 → 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,227 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :items="items"
5
+ :itemTo="$props.itemTo"
6
+ :loading="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
7
+ :tableCode="$props.tableCode"
8
+ :modelValue="selecteds"
9
+ @update:modelValue="onSelect"
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
+
30
+ <template
31
+ #item.main="{ item }"
32
+ >
33
+ <FSIcon
34
+ v-if="item.id === mainOrganisationDashboardId"
35
+ >
36
+ mdi-account-group-outline
37
+ </FSIcon>
38
+ <FSIcon
39
+ v-if="item.id === mainUserDashboardId"
40
+ >
41
+ mdi-home
42
+ </FSIcon>
43
+ </template>
44
+
45
+ <template
46
+ #item.tile="{ item, toggleSelect }"
47
+ >
48
+ <FSDashboardOrganisationTypeTileUI
49
+ v-if="item.dashboardType == DashboardType.OrganisationType"
50
+ :bottomColor="item.colors"
51
+ :to="$props.itemTo && $props.itemTo(item)"
52
+ :modelValue="isSelected(item.id)"
53
+ @update:modelValue="toggleSelect(item)"
54
+ v-bind="item"
55
+ />
56
+ <FSDashboardOrganisationTileUI
57
+ v-if="item.dashboardType == DashboardType.Organisation"
58
+ :bottomColor="item.colors"
59
+ :to="$props.itemTo && $props.itemTo(item)"
60
+ :modelValue="isSelected(item.id)"
61
+ @update:modelValue="toggleSelect(item)"
62
+ v-bind="item"
63
+ />
64
+ <FSDashboardShallowTileUI
65
+ v-if="item.dashboardType == DashboardType.Shallow"
66
+ :bottomColor="item.colors"
67
+ :modelValue="isSelected(item.id)"
68
+ @update:modelValue="toggleSelect(item)"
69
+ :to="$props.itemTo && $props.itemTo(item)"
70
+ v-bind="item"
71
+ />
72
+ </template>
73
+ </FSDataTable>
74
+ </template>
75
+
76
+ <script lang="ts">
77
+ import _ from "lodash";
78
+ import type { PropType} from "vue";
79
+ import type { RouteLocation } from "vue-router";
80
+ import { computed, defineComponent, onMounted, ref, watch } from "vue";
81
+
82
+ import { useAppOrganisationId, useCurrentUserOrganisation, useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
83
+ import type { DashboardOrganisationTypeFilters, DashboardOrganisationFilters, DashboardShallowFilters, DashboardInfos } from "@dative-gpi/foundation-core-domain/models";
84
+ import { useOrganisation } from "@dative-gpi/foundation-shared-services/composables";
85
+
86
+ import type { DashboardsListItem } from "@/core/foundation-core-components/utils";
87
+ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
88
+
89
+ import FSDataTable from "../FSDataTable.vue";
90
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
91
+ import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
92
+ import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
93
+ import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
94
+
95
+ export default defineComponent({
96
+ name: "FSBaseDashboardsList",
97
+ components: {
98
+ FSDataTable,
99
+ FSIcon,
100
+ FSDashboardOrganisationTileUI,
101
+ FSDashboardOrganisationTypeTileUI,
102
+ FSDashboardShallowTileUI
103
+ },
104
+ props: {
105
+ tableCode: {
106
+ type: String as PropType<string | null>,
107
+ required: false,
108
+ default: null
109
+ },
110
+ dashboardOrganisationTypeFetchFilter: {
111
+ type: Object as PropType<DashboardOrganisationTypeFilters>,
112
+ default: undefined,
113
+ required: false
114
+ },
115
+ dashboardOrganisationsFilters: {
116
+ type: Object as PropType<DashboardOrganisationFilters>,
117
+ default: undefined,
118
+ required: false
119
+ },
120
+ dashboardShallowsFilters: {
121
+ type: Object as PropType<DashboardShallowFilters>,
122
+ default: undefined,
123
+ required: false
124
+ },
125
+ itemTo: {
126
+ type: Function as PropType<(item: DashboardInfos) => Partial<RouteLocation>>,
127
+ required: false
128
+ },
129
+ modelValue: {
130
+ type: Array as PropType<string[]>,
131
+ default: () => [],
132
+ required: false
133
+ }
134
+ },
135
+ emits: ["update", "update:modelValue", "update:type"],
136
+ setup(props, { emit }) {
137
+ const { entities: dashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, getMany: getManyDashboardOrganisationTypes } = useDashboardOrganisationTypes();
138
+ const { entities: dashboardOrganisations, fetching: fetchingDashboardOrganisations, getMany: getManyDashboardOrganisations } = useDashboardOrganisations();
139
+ const { entities: dashboardShallows, fetching: fetchingDashboardShallows, getMany: getManyDashboardShallows } = useDashboardShallows();
140
+ const { fetch: fetchUserOrganisation, entity: userOrganisation } = useCurrentUserOrganisation();
141
+ const { entity: organisation, get: getOrganisation } = useOrganisation();
142
+ const { organisationId } = useAppOrganisationId();
143
+
144
+ const selecteds = ref<string[]>(props.modelValue);
145
+
146
+ const items = computed((): DashboardsListItem[] => {
147
+ return _.sortBy([
148
+ ...dashboardOrganisationTypes.value.map(g => ({
149
+ ...g,
150
+ dashboardType: DashboardType.OrganisationType
151
+ })) as DashboardsListItem[],
152
+ ...dashboardOrganisations.value.map(d => ({
153
+ ...d,
154
+ dashboardType: DashboardType.Organisation
155
+ })) as DashboardsListItem[],
156
+ ...dashboardShallows.value.map(d => ({
157
+ ...d,
158
+ dashboardType: DashboardType.Shallow
159
+ })) as DashboardsListItem[]
160
+ ], d => d.label);
161
+ });
162
+
163
+ const mainUserDashboardId = computed(() => {
164
+ return userOrganisation.value?.mainDashboardId;
165
+ });
166
+
167
+ const mainOrganisationDashboardId = computed(() => {
168
+ return organisation.value?.mainDashboardId;
169
+ });
170
+
171
+ const onSelect = (values: string[]) => {
172
+ selecteds.value = values;
173
+ const selectedItems = items.value.filter(i => selecteds.value!.includes(i.id));
174
+ const newModelValue = selectedItems.map(i => i.id);
175
+ const newType = selectedItems.map(i => i.dashboardType);
176
+ emit("update:modelValue", newModelValue);
177
+ emit("update:type", newType);
178
+ emit("update", { modelValue: newModelValue, type: newType });
179
+ };
180
+
181
+ const isSelected = (id: string) => {
182
+ return selecteds.value?.includes(id);
183
+ };
184
+
185
+ onMounted(() => {
186
+ fetchUserOrganisation();
187
+ })
188
+
189
+ watch(() => organisationId.value, () => {
190
+ if (organisationId.value) {
191
+ getOrganisation(organisationId.value);
192
+ }
193
+ }, { immediate: true });
194
+
195
+ watch(() => props.dashboardOrganisationTypeFetchFilter, (next, previous) => {
196
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
197
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFetchFilter);
198
+ }
199
+ }, { immediate: true });
200
+
201
+ watch(() => props.dashboardOrganisationsFilters, (next, previous) => {
202
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
203
+ getManyDashboardOrganisations(props.dashboardOrganisationsFilters);
204
+ }
205
+ }, { immediate: true });
206
+
207
+ watch(() => props.dashboardShallowsFilters, (next, previous) => {
208
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
209
+ getManyDashboardShallows(props.dashboardShallowsFilters);
210
+ }
211
+ }, { immediate: true });
212
+
213
+ return {
214
+ fetchingDashboardOrganisationTypes,
215
+ fetchingDashboardOrganisations,
216
+ fetchingDashboardShallows,
217
+ selecteds,
218
+ items,
219
+ mainUserDashboardId,
220
+ mainOrganisationDashboardId,
221
+ onSelect,
222
+ isSelected,
223
+ DashboardType
224
+ };
225
+ }
226
+ });
227
+ </script>
@@ -0,0 +1,63 @@
1
+ <template>
2
+ <FSSimpleList
3
+ :items="dashboards"
4
+ :loading="fetching"
5
+ v-bind="$attrs"
6
+ />
7
+ </template>
8
+
9
+ <script lang="ts">
10
+ import { defineComponent, type PropType, watch, computed } from "vue";
11
+
12
+ import type { DashboardOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
13
+ import { useDashboardOrganisations } from "@dative-gpi/foundation-core-services/composables";
14
+ import { useDashboardOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
15
+
16
+ import FSSimpleList from "@dative-gpi/foundation-shared-components/components/lists/FSSimpleList.vue";
17
+
18
+ export default defineComponent({
19
+ name: "FSSimpleDashboardsList",
20
+ components: {
21
+ FSSimpleList,
22
+ },
23
+ props: {
24
+ dashboardOrganisationFilters: {
25
+ type: Object as PropType<DashboardOrganisationFilters>,
26
+ required: false,
27
+ default: () => ({})
28
+ },
29
+ dashboardOrganisationTypeFilters: {
30
+ type: Object as PropType<DashboardOrganisationFilters>,
31
+ required: false,
32
+ default: () => ({})
33
+ }
34
+ },
35
+ setup(props){
36
+ const { entities: dashboardOrganisations,
37
+ getMany: getManyDashboardOrganisations,
38
+ fetching: fetchingDashboardOrganisations } = useDashboardOrganisations();
39
+ const { entities: dashboardOrganisationTypes,
40
+ getMany: getManyDashboardOrganisationTypes,
41
+ fetching: fetchingDashboardOrganisationTypes } = useDashboardOrganisationTypes();
42
+
43
+ const fetching = computed(() => fetchingDashboardOrganisations.value
44
+ || fetchingDashboardOrganisationTypes.value);
45
+
46
+ const dashboards = computed(() => {
47
+ return [...dashboardOrganisations.value, ...dashboardOrganisationTypes.value];
48
+ });
49
+
50
+ const fetch = () => {
51
+ getManyDashboardOrganisations(props.dashboardOrganisationFilters);
52
+ getManyDashboardOrganisationTypes(props.dashboardOrganisationTypeFilters);
53
+ }
54
+
55
+ watch(() => [props.dashboardOrganisationFilters, props.dashboardOrganisationTypeFilters], fetch, { immediate: true });
56
+
57
+ return {
58
+ dashboards,
59
+ fetching
60
+ }
61
+ }
62
+ });
63
+ </script>
@@ -0,0 +1,154 @@
1
+ <template>
2
+ <FSCol>
3
+ <FSRow
4
+ align="bottom-center"
5
+ width="50%"
6
+ >
7
+ <FSSearchField
8
+ v-model="search"
9
+ />
10
+ <FSButtonCheckbox
11
+ :label="$tr('ui.common.data-correlated','Correlated only')"
12
+ :color="ColorEnum.Success"
13
+ prependIcon="mdi-link"
14
+ v-model="correlated"
15
+ />
16
+ </FSRow>
17
+ <FSFadeOut
18
+ maxHeight="150px"
19
+ maskHeight="0px"
20
+ >
21
+ <FSDataTable
22
+ :loading="fetchingDataCategories"
23
+ :items="dataCategories"
24
+ :modelValue="$props.modelValue"
25
+ :showSearch="false"
26
+ :tableCode="$props.tableCode"
27
+ :search="search"
28
+ @update:modelValue="$emit('update:modelValue', $event)"
29
+ v-bind="$attrs"
30
+ >
31
+ <template
32
+ v-for="(_, name) in $slots"
33
+ v-slot:[name]="slotData"
34
+ >
35
+ <slot
36
+ :name="name"
37
+ v-bind="slotData"
38
+ />
39
+ </template>
40
+ <template
41
+ #item.tile="{ item }"
42
+ >
43
+ <FSClickable
44
+ padding="12px"
45
+ height="60px"
46
+ width="233px"
47
+ :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Dark"
48
+ @click="$emit('update:modelValue', [item.id])"
49
+ v-bind="$attrs"
50
+ >
51
+ <template
52
+ #default
53
+ >
54
+ <FSRow
55
+ align="center-center"
56
+ :wrap="false"
57
+ >
58
+ <FSSpan
59
+ :lineClamp="1"
60
+ >
61
+ {{ item.label }}
62
+ </FSSpan>
63
+ <v-spacer/>
64
+ <FSIcon
65
+ :color="item.correlated ? ColorEnum.Primary : ColorEnum.Light"
66
+ :icon="item.correlated ? 'mdi-link' : 'mdi-link-off'"
67
+ variant="dark"
68
+ />
69
+ </FSRow>
70
+ </template>
71
+ </FSClickable>
72
+ </template>
73
+ </FSDataTable>
74
+ </FSFadeOut>
75
+ </FSCol>
76
+ </template>
77
+
78
+ <script lang="ts">
79
+ import { defineComponent, type PropType, ref, watch } from "vue";
80
+ import _ from "lodash";
81
+
82
+ import {ColorEnum} from "@dative-gpi/foundation-shared-components/models";
83
+
84
+ import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
85
+ import type { DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
86
+
87
+ import FSDataTable from "../FSDataTable.vue";
88
+ import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
89
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
90
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
91
+ import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
92
+ import FSFadeOut from "@dative-gpi/foundation-shared-components/components/FSFadeOut.vue";
93
+ import FSClickable from "@dative-gpi/foundation-shared-components/components/FSClickable.vue";
94
+ import FSSearchField from "@dative-gpi/foundation-shared-components/components/fields/FSSearchField.vue";
95
+ import FSButtonCheckbox from "@dative-gpi/foundation-shared-components/components/buttons/FSButtonCheckbox.vue";
96
+
97
+ export default defineComponent({
98
+ name: "FSBaseDataCategoriesList",
99
+ components: {
100
+ FSDataTable,
101
+ FSCol,
102
+ FSFadeOut,
103
+ FSClickable,
104
+ FSRow,
105
+ FSSpan,
106
+ FSSearchField,
107
+ FSButtonCheckbox,
108
+ FSIcon
109
+ },
110
+ props: {
111
+ tableCode: {
112
+ type: String as PropType<string | null>,
113
+ required: false,
114
+ default: null
115
+ },
116
+ dataCategoryFilters: {
117
+ type: Object as PropType<DataCategoryFilters>,
118
+ required: false,
119
+ default: null
120
+ },
121
+ modelValue: {
122
+ type: Array as PropType<string[]>,
123
+ default: () => [],
124
+ required: false
125
+ }
126
+ },
127
+ emits: ["update:modelValue"],
128
+ setup(props) {
129
+ const { getMany: fetchDataCategories, fetching: fetchingDataCategories, entities: dataCategories } = useDataCategories();
130
+
131
+ const search = ref<string | null | undefined >();
132
+ const correlated = ref<boolean>(false);
133
+
134
+ const isSelected = (id: string): boolean => {
135
+ return props.modelValue.includes(id);
136
+ };
137
+
138
+ watch(() => [props.dataCategoryFilters, search.value, correlated.value] , (next, previous) => {
139
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
140
+ fetchDataCategories({...props.dataCategoryFilters, search: search.value, correlated: correlated.value ? true : undefined});
141
+ }
142
+ }, { immediate: true });
143
+
144
+ return {
145
+ fetchingDataCategories,
146
+ dataCategories,
147
+ ColorEnum,
148
+ search,
149
+ correlated,
150
+ isSelected
151
+ };
152
+ }
153
+ });
154
+ </script>
@@ -0,0 +1,129 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingDataDefinitions"
4
+ :items="dataDefinitions"
5
+ :tableCode="$props.tableCode"
6
+ :modelValue="$props.modelValue"
7
+ @update:modelValue="$emit('update:modelValue', $event)"
8
+ v-bind="$attrs"
9
+ >
10
+ <template
11
+ v-for="(_, name) in $slots"
12
+ v-slot:[name]="slotData"
13
+ >
14
+ <slot
15
+ :name="name"
16
+ v-bind="slotData"
17
+ />
18
+ </template>
19
+ <template
20
+ #toolbar
21
+ >
22
+ <FSButtonCheckbox
23
+ :label="$tr('ui.common.data-correlated','Correlated only')"
24
+ :color="ColorEnum.Success"
25
+ />
26
+ </template>
27
+ <template
28
+ #item.tile="{ item }"
29
+ >
30
+ <FSClickable
31
+ padding="12px"
32
+ height="60px"
33
+ width="233px"
34
+ :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Light"
35
+ @click="$emit('update:modelValue', [item.id])"
36
+ v-bind="$attrs"
37
+ >
38
+ <template
39
+ #default
40
+ >
41
+ <FSRow
42
+ align="center-center"
43
+ >
44
+ <FSIcon
45
+ icon="mdi-thermometer"
46
+ />
47
+ <FSSpan
48
+ :lineClamp="1"
49
+ >
50
+ {{ item.label }}
51
+ </FSSpan>
52
+ <v-spacer/>
53
+ <FSIcon
54
+ :color="ColorEnum.Primary"
55
+ icon="mdi-link"
56
+ />
57
+ </FSRow>
58
+ </template>
59
+ </FSClickable>
60
+ </template>
61
+ </FSDataTable>
62
+ </template>
63
+
64
+ <script lang="ts">
65
+ import { defineComponent, type PropType, watch } from "vue";
66
+ import _ from "lodash";
67
+
68
+ import {ColorEnum} from "@dative-gpi/foundation-shared-components/models";
69
+
70
+ import { useDataDefinitions } from "@dative-gpi/foundation-core-services/composables";
71
+ import type { DataDefinitionFilters } from "@dative-gpi/foundation-core-domain/models";
72
+
73
+ import FSDataTable from "../FSDataTable.vue";
74
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
75
+ import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
76
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
77
+ import FSClickable from "@dative-gpi/foundation-shared-components/components/FSClickable.vue";
78
+ import FSButtonCheckbox from "@dative-gpi/foundation-shared-components/components/buttons/FSButtonCheckbox.vue";
79
+
80
+ export default defineComponent({
81
+ name: "FSBaseDataDefinitionsList",
82
+ components: {
83
+ FSButtonCheckbox,
84
+ FSDataTable,
85
+ FSClickable,
86
+ FSSpan,
87
+ FSIcon,
88
+ FSRow,
89
+ },
90
+ props: {
91
+ tableCode: {
92
+ type: String as PropType<string | null>,
93
+ required: false,
94
+ default: null
95
+ },
96
+ dataDefinitionFilters: {
97
+ type: Object as PropType<DataDefinitionFilters>,
98
+ required: false,
99
+ default: null
100
+ },
101
+ modelValue: {
102
+ type: Array as PropType<string[]>,
103
+ default: () => [],
104
+ required: false
105
+ }
106
+ },
107
+ emits: ["update:modelValue"],
108
+ setup(props) {
109
+ const { getMany: fetchDataDefinitions, fetching: fetchingDataDefinitions, entities: dataDefinitions } = useDataDefinitions();
110
+
111
+ const isSelected = (id: string): boolean => {
112
+ return props.modelValue.includes(id);
113
+ };
114
+
115
+ watch(() => props.dataDefinitionFilters, (next, previous) => {
116
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
117
+ fetchDataDefinitions(props.dataDefinitionFilters);
118
+ }
119
+ }, { immediate: true });
120
+
121
+ return {
122
+ fetchingDataDefinitions,
123
+ dataDefinitions,
124
+ ColorEnum,
125
+ isSelected
126
+ };
127
+ }
128
+ });
129
+ </script>