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