@dative-gpi/foundation-core-components 1.0.36 → 1.0.37-report-v1

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 +18 -8
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +16 -6
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +7 -1
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +11 -5
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +7 -1
  6. package/components/autocompletes/FSAutocompleteGroup.vue +7 -1
  7. package/components/autocompletes/FSAutocompleteLocation.vue +6 -0
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +8 -0
  9. package/components/autocompletes/FSAutocompleteModel.vue +9 -1
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +7 -1
  11. package/components/autocompletes/FSAutocompleteRole.vue +17 -6
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +7 -1
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +9 -1
  14. package/components/chips/FSChipGroupUserOrganisation.vue +61 -0
  15. package/components/chips/FSChipGroupUserOrganisationUI.vue +38 -0
  16. package/components/customProperties/FSMetaField.vue +31 -35
  17. package/components/customProperties/FSMetaHistory.vue +4 -4
  18. package/components/customProperties/FSMetaValue.vue +66 -33
  19. package/components/customProperties/helpers.ts +2 -1
  20. package/components/entities/FSBaseEntitiesList.vue +50 -0
  21. package/components/entities/FSDialogSelectEntities.vue +83 -0
  22. package/components/entities/FSEntityField.vue +203 -0
  23. package/components/entities/FSSelectEntitiesList.vue +209 -0
  24. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  25. package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
  26. package/components/explorers/FSBaseFoldersExplorer.vue +277 -0
  27. package/components/lists/FSDataTable.vue +23 -21
  28. package/components/lists/alerts/FSBaseAlertsList.vue +338 -0
  29. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  30. package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
  31. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +205 -0
  32. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +206 -0
  33. package/components/lists/charts/FSBaseChartsList.vue +268 -0
  34. package/components/lists/comments/FSBaseCommentsList.vue +143 -0
  35. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  36. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +179 -0
  37. package/components/lists/dashboards/FSBaseDashboardsList.vue +235 -0
  38. package/components/lists/dashboards/FSSimpleDashboardsList.vue +62 -0
  39. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +155 -0
  40. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +130 -0
  41. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +378 -0
  42. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  43. package/components/lists/folders/FSBaseFoldersList.vue +127 -0
  44. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  45. package/components/lists/groups/FSBaseGroupsList.vue +136 -0
  46. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  47. package/components/lists/locations/FSBaseLocationsList.vue +118 -0
  48. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  49. package/components/lists/models/FSBaseModelsList.vue +155 -0
  50. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  51. package/components/lists/reports/FSBaseReportExecutionsList.vue +137 -0
  52. package/components/lists/reports/FSBaseReportsList.vue +140 -0
  53. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
  54. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
  55. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
  56. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
  57. package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
  58. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +155 -0
  59. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  60. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +171 -0
  61. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  62. package/components/tiles/FSChartTile.vue +70 -0
  63. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  64. package/components/tiles/FSLocationTile.vue +66 -0
  65. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  66. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  67. package/package.json +9 -9
  68. package/utils/dashboards.ts +33 -5
  69. package/utils/index.ts +2 -2
  70. package/utils/permissions.ts +80 -0
  71. package/utils/roles.ts +4 -4
  72. package/utils/tables.ts +41 -0
  73. package/utils/users.ts +7 -4
  74. package/components/selects/FSAggregationSelector.vue +0 -51
  75. package/components/selects/FSAxisTypeSelector.vue +0 -48
  76. package/components/selects/FSDisplayAsSelector.vue +0 -52
  77. package/components/selects/FSFilterTypeSelector.vue +0 -53
  78. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  79. package/components/selects/FSOperationOnSelector.vue +0 -51
  80. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  81. package/components/selects/FSPlotPerSelector.vue +0 -51
  82. package/components/selects/FSSelectSelectedEntities.vue +0 -59
  83. package/components/selects/FSSerieTypeSelector.vue +0 -51
  84. package/utils/charts.ts +0 -136
@@ -0,0 +1,101 @@
1
+ <template>
2
+ <FSButton
3
+ prependIcon="mdi-checkbox-blank-outline"
4
+ :label="$tr('ui.alert.acknowledge', 'Acknowledge')"
5
+ @click="dialog = true"
6
+ />
7
+ <FSDialogSubmit
8
+ :title="$tr('ui.alert.acknowledge', 'Acknowledge')"
9
+ :load="acknowledgingAlert"
10
+ @click:submitButton="onAcknowledge"
11
+ v-model="dialog"
12
+ >
13
+ <template
14
+ #body
15
+ >
16
+ <FSCol
17
+ gap="16px"
18
+ >
19
+ <FSRow>
20
+ <FSIcon
21
+ :color="ColorEnum.Warning"
22
+ >
23
+ mdi-alert-outline
24
+ </FSIcon>
25
+ <FSRow
26
+ gap="2px"
27
+ >
28
+ <FSSpan>
29
+ {{ $tr("ui.alert.acknowledge-warning", "Do you want to acknowledge this alert?") }}
30
+ </FSSpan>
31
+ </FSRow>
32
+ </FSRow>
33
+ <FSSpan>
34
+ {{ $tr("ui.alert.acknowledge-final-warning", "This action is definitive") }}
35
+ </FSSpan>
36
+ <FSErrorToast
37
+ v-if="error"
38
+ :errorCode="error"
39
+ />
40
+ </FSCol>
41
+ </template>
42
+ </FSDialogSubmit>
43
+ </template>
44
+
45
+ <script lang="ts">
46
+ import { defineComponent, ref } from "vue";
47
+
48
+ import { useAcknowledgeAlert } from "@dative-gpi/foundation-core-services/composables";
49
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
50
+ import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
51
+ import FSDialogSubmit from "@dative-gpi/foundation-shared-components/components/FSDialogSubmit.vue";
52
+ import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
53
+ import FSErrorToast from "@dative-gpi/foundation-shared-components/components/FSErrorToast.vue";
54
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
55
+ import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
56
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
57
+
58
+ export default defineComponent({
59
+ name: "FSButtonAcknowledgeAlert",
60
+ components: {
61
+ FSButton,
62
+ FSCol,
63
+ FSDialogSubmit,
64
+ FSErrorToast,
65
+ FSIcon,
66
+ FSRow,
67
+ FSSpan,
68
+ },
69
+ props: {
70
+ alertId: {
71
+ type: String,
72
+ required: true
73
+ }
74
+ },
75
+ setup(props) {
76
+ const { fetch: acknowledgeAlert, fetching: acknowledgingAlert } = useAcknowledgeAlert();
77
+
78
+ const error = ref<string | null>(null);
79
+ const dialog = ref(false);
80
+
81
+ const onAcknowledge = async (): Promise<void> => {
82
+ try {
83
+ error.value = null;
84
+ await acknowledgeAlert(props.alertId);
85
+ dialog.value = false;
86
+ }
87
+ catch (exception: any) {
88
+ error.value = exception.response.data;
89
+ }
90
+ };
91
+
92
+ return {
93
+ acknowledgingAlert,
94
+ ColorEnum,
95
+ dialog,
96
+ error,
97
+ onAcknowledge
98
+ };
99
+ }
100
+ })
101
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="authTokens"
4
+ :loading="fetchingAuthTokens"
5
+ :tableCode="$props.tableCode"
6
+ v-bind="$attrs"
7
+ >
8
+ <template
9
+ v-for="(_, name) in $slots"
10
+ v-slot:[name]="slotData"
11
+ >
12
+ <slot
13
+ :name="name"
14
+ v-bind="slotData"
15
+ />
16
+ </template>
17
+ <template
18
+ #item.creationDate="{item}"
19
+ >
20
+ <FSText>
21
+ {{ epochToLongTimeFormat(item.creationDate) }}
22
+ </FSText>
23
+ </template>
24
+ <template
25
+ #item.dateMax="{item}"
26
+ >
27
+ <FSText>
28
+ {{ epochToLongTimeFormat(item.dateMax) }}
29
+ </FSText>
30
+ </template>
31
+ </FSDataTable>
32
+ </template>
33
+
34
+ <script lang="ts">
35
+ import { defineComponent, type PropType, watch } from "vue";
36
+ import _ from "lodash";
37
+
38
+ import { useDateFormat, useAuthTokens } from "@dative-gpi/foundation-shared-services/composables";
39
+ import { type AuthTokenFilters } from "@dative-gpi/foundation-shared-domain/models";
40
+
41
+ import FSDataTable from "../FSDataTable.vue";
42
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
43
+
44
+ export default defineComponent({
45
+ name: "FSBaseAuthTokensList",
46
+ components: {
47
+ FSDataTable,
48
+ FSText
49
+ },
50
+ props: {
51
+ tableCode: {
52
+ type: String as PropType<string | null>,
53
+ required: false,
54
+ default: null
55
+ },
56
+ authTokensFilters: {
57
+ type: Object as PropType<AuthTokenFilters | null>,
58
+ required: false,
59
+ default: null
60
+ }
61
+ },
62
+ setup(props) {
63
+ const { getMany: fetchAuthTokens, entities: authTokens, fetching: fetchingAuthTokens } = useAuthTokens();
64
+ const { epochToLongTimeFormat } = useDateFormat();
65
+
66
+ watch(() => props.authTokensFilters, (next, previous) => {
67
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
68
+ fetchAuthTokens(props.authTokensFilters ?? undefined);
69
+ }
70
+ }, { immediate: true });
71
+
72
+ return {
73
+ authTokens,
74
+ fetchingAuthTokens,
75
+ epochToLongTimeFormat
76
+ };
77
+ }
78
+ });
79
+ </script>
@@ -0,0 +1,205 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :items="chartOrganisationTypes"
5
+ :itemTo="$props.itemTo"
6
+ :loading="fetchingChartOrganisationTypes"
7
+ :headersOptions="headersOptions"
8
+ :tableCode="$props.tableCode"
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
+ #item.icon="{ item }"
31
+ >
32
+ <FSIcon>
33
+ {{ item.icon }}
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.tags="{ item }"
49
+ >
50
+ <FSTagGroup
51
+ variant="slide"
52
+ :editable="false"
53
+ :tags="item.tags"
54
+ />
55
+ </template>
56
+ <template
57
+ #item.chartType="{ item }"
58
+ >
59
+ <FSRow
60
+ :wrap="false"
61
+ >
62
+ <FSIcon
63
+ :icon="chartIcon(item.chartType)"
64
+ />
65
+ <FSText>
66
+ {{ chartTypeLabel(item.chartType) }}
67
+ </FSText>
68
+ </FSRow>
69
+ </template>
70
+ <template
71
+ #item.modelsLabels="{ item }"
72
+ >
73
+ <FSTagGroup
74
+ :editable="false"
75
+ :tags="item.modelsLabels.map((d: any) => d.label)"
76
+ />
77
+ </template>
78
+ <template
79
+ #item.tile="{item}"
80
+ >
81
+ <FSChartTileUI
82
+ variant="standard"
83
+ :label="item.label"
84
+ :category-label="item.chartCategoryLabel"
85
+ :icon="item.icon"
86
+ :imageId="item.imageId"
87
+ :type="item.chartType"
88
+ :color="ColorEnum.Light"
89
+ :to="$props.itemTo && $props.itemTo(item)"
90
+ />
91
+ </template>
92
+ </FSDataTable>
93
+ </template>
94
+
95
+ <script lang="ts">
96
+ import { computed, defineComponent, type PropType, watch } from "vue";
97
+ import type { RouteLocation } from "vue-router";
98
+ import _ from "lodash";
99
+
100
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
101
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
102
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
103
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
104
+
105
+ import type { ChartModelLabel, ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
106
+ import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
107
+
108
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
109
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
110
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
111
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
112
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
113
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
114
+
115
+ import FSDataTable from "../FSDataTable.vue";
116
+
117
+ export default defineComponent({
118
+ name: "FSBaseChartOrganisationTypesList",
119
+ components: {
120
+ FSChartTileUI,
121
+ FSDataTable,
122
+ FSTagGroup,
123
+ FSImage,
124
+ FSIcon,
125
+ FSText,
126
+ FSRow
127
+ },
128
+ props: {
129
+ tableCode: {
130
+ type: String as PropType<string | null>,
131
+ required: false,
132
+ default: null
133
+ },
134
+ chartOrganisationTypeFilters: {
135
+ type: Object as PropType<ChartOrganisationTypeFilters>,
136
+ required: false,
137
+ default: null
138
+ },
139
+ itemTo: {
140
+ type: Function as PropType<(item: ChartOrganisationTypeInfos) => Partial<RouteLocation>>,
141
+ required: false
142
+ },
143
+ modelValue: {
144
+ type: Array as PropType<string[]>,
145
+ default: () => [],
146
+ required: false
147
+ }
148
+ },
149
+ emits: ["update:modelValue"],
150
+ setup(props) {
151
+ const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
152
+
153
+ const headersOptions = computed(() => ({
154
+ modelsLabels: {
155
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
156
+ for (const m of models) {
157
+ if (!acc.map((m) => m.id).includes(m.id)) {
158
+ acc.push(m);
159
+ }
160
+ }
161
+ return acc;
162
+ }, []).map((m) => ({
163
+ value: m.id,
164
+ text: m.label
165
+ })).concat({
166
+ value: '',
167
+ text: '--'
168
+ }),
169
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
170
+ },
171
+ chartType: {
172
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
173
+ value: e.value,
174
+ text: chartTypeLabel(e.value)
175
+ })),
176
+ methodFilter: (value: ChartType, item: ChartType) => value == item
177
+ }
178
+ }));
179
+
180
+ const isSelected = (id: string): boolean => {
181
+ return props.modelValue.includes(id);
182
+ };
183
+
184
+ const fetch = () =>{
185
+ getManyChartOrganisationTypes(props.chartOrganisationTypeFilters);
186
+ };
187
+
188
+ watch(() => [props.chartOrganisationTypeFilters], (next, previous) => {
189
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
190
+ fetch();
191
+ }
192
+ }, { immediate: true });
193
+
194
+ return {
195
+ fetchingChartOrganisationTypes,
196
+ chartOrganisationTypes,
197
+ headersOptions,
198
+ ColorEnum,
199
+ chartTypeLabel,
200
+ isSelected,
201
+ chartIcon
202
+ };
203
+ }
204
+ });
205
+ </script>
@@ -0,0 +1,206 @@
1
+ <template>
2
+ <FSDataTable
3
+ defaultMode="iterator"
4
+ :items="chartOrganisations"
5
+ :itemTo="$props.itemTo"
6
+ :loading="fetchingChartOrganisations"
7
+ :headersOptions="headersOptions"
8
+ :tableCode="$props.tableCode"
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
+ #item.icon="{ item }"
31
+ >
32
+ <FSIcon>
33
+ {{ item.icon }}
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.tags="{ item }"
49
+ >
50
+ <FSTagGroup
51
+ variant="slide"
52
+ :editable="false"
53
+ :tags="item.tags"
54
+ />
55
+ </template>
56
+ <template
57
+ #item.modelsLabels="{ item }"
58
+ >
59
+ <FSTagGroup
60
+ :editable="false"
61
+ :tags="item.modelsLabels.map((d: any) => d.label)"
62
+ />
63
+ </template>
64
+ <template
65
+ #item.tile="{ item }"
66
+ >
67
+ <FSChartTileUI
68
+ variant="standard"
69
+ :label="item.label"
70
+ :categoryLabel="item.chartCategoryLabel"
71
+ :icon="item.icon"
72
+ :imageId="item.imageId"
73
+ :type="item.chartType"
74
+ :color="ColorEnum.Light"
75
+ :to="$props.itemTo && $props.itemTo(item)"
76
+ />
77
+ </template>
78
+ <template
79
+ #item.chartType="{ item }"
80
+ >
81
+ <FSRow
82
+ :wrap="false"
83
+ >
84
+ <FSIcon
85
+ :icon="chartIcon(item.chartType)"
86
+ />
87
+ <FSText>
88
+ {{ chartTypeLabel(item.chartType) }}
89
+ </FSText>
90
+ </FSRow>
91
+ </template>
92
+ </FSDataTable>
93
+ </template>
94
+
95
+ <script lang="ts">
96
+ import { computed, defineComponent, type PropType, watch } from "vue";
97
+ import type { RouteLocation } from "vue-router";
98
+ import _ from "lodash";
99
+
100
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
101
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
102
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
103
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
104
+
105
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
106
+ import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
107
+
108
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
109
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
110
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
111
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
112
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
113
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
114
+
115
+ import FSDataTable from "../FSDataTable.vue";
116
+
117
+ export default defineComponent({
118
+ name: "FSBaseChartOrganisationsList",
119
+ components: {
120
+ FSChartTileUI,
121
+ FSDataTable,
122
+ FSTagGroup,
123
+ FSImage,
124
+ FSIcon,
125
+ FSText,
126
+ FSRow,
127
+ },
128
+ props: {
129
+ tableCode: {
130
+ type: String as PropType<string | null>,
131
+ required: false,
132
+ default: null
133
+ },
134
+ chartOrganisationFilters: {
135
+ type: Object as PropType<ChartOrganisationFilters>,
136
+ required: false,
137
+ default: null
138
+ },
139
+ itemTo: {
140
+ type: Function as PropType<(item: ChartOrganisationInfos) => Partial<RouteLocation>>,
141
+ required: false
142
+ },
143
+ modelValue: {
144
+ type: Array as PropType<string[]>,
145
+ default: () => [],
146
+ required: false
147
+ }
148
+ },
149
+ emits: ["update:modelValue"],
150
+ setup(props) {
151
+ const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
152
+
153
+ const headersOptions = computed(() => ({
154
+ modelsLabels: {
155
+ fixedFilters: chartOrganisations.value.map(c => c.modelsLabels).reduce((acc, models) => {
156
+ for (const m of models) {
157
+ if (!acc.map((m) => m.id).includes(m.id)) {
158
+ acc.push(m);
159
+ }
160
+ }
161
+ return acc;
162
+ }, []).map((m) => ({
163
+ value: m.id,
164
+ text: m.label
165
+ })).concat({
166
+ value: '',
167
+ text: '--'
168
+ }),
169
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
170
+ },
171
+ chartType: {
172
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
173
+ value: e.value,
174
+ text: chartTypeLabel(e.value)
175
+ })),
176
+ methodFilter: (value: ChartType, item: ChartType) => value == item
177
+ }
178
+ }));
179
+
180
+
181
+ const isSelected = (id: string): boolean => {
182
+ return props.modelValue.includes(id);
183
+ };
184
+
185
+ const fetch = () =>{
186
+ getManyChartOrganisations(props.chartOrganisationFilters);
187
+ }
188
+
189
+ watch(() => [props.chartOrganisationFilters], (next, previous) => {
190
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
191
+ fetch();
192
+ }
193
+ }, { immediate: true });
194
+
195
+ return {
196
+ fetchingChartOrganisations,
197
+ chartOrganisations,
198
+ headersOptions,
199
+ ColorEnum,
200
+ chartTypeLabel,
201
+ isSelected,
202
+ chartIcon
203
+ };
204
+ }
205
+ });
206
+ </script>