@dative-gpi/foundation-core-components 1.0.27 → 1.0.28-remove-deprecated2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/components/autocompletes/FSAutocompleteChart.vue +60 -58
  2. package/components/autocompletes/FSAutocompleteDashboard.vue +59 -56
  3. package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +30 -39
  4. package/components/autocompletes/FSAutocompleteDataCategory.vue +52 -38
  5. package/components/autocompletes/FSAutocompleteDataDefinition.vue +25 -39
  6. package/components/autocompletes/FSAutocompleteGroup.vue +23 -38
  7. package/components/autocompletes/FSAutocompleteLocation.vue +23 -38
  8. package/components/autocompletes/FSAutocompleteManufacturer.vue +65 -2
  9. package/components/autocompletes/FSAutocompleteModel.vue +66 -3
  10. package/components/autocompletes/FSAutocompleteOrganisationType.vue +23 -0
  11. package/components/autocompletes/FSAutocompleteRole.vue +59 -56
  12. package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +105 -0
  13. package/components/autocompletes/FSAutocompleteUserOrganisation.vue +32 -57
  14. package/components/customProperties/FSMetaField.vue +31 -35
  15. package/components/customProperties/FSMetaHistory.vue +4 -4
  16. package/components/customProperties/FSMetaValue.vue +66 -33
  17. package/components/customProperties/helpers.ts +2 -1
  18. package/components/entities/FSBaseEntitiesList.vue +50 -0
  19. package/components/entities/FSDialogSelectEntities.vue +83 -0
  20. package/components/entities/FSEntityField.vue +203 -0
  21. package/components/entities/FSSelectEntitiesList.vue +209 -0
  22. package/components/entities/FSSimpleEntitiesList.vue +100 -0
  23. package/components/explorers/FSBaseDevicesExplorer.vue +310 -0
  24. package/components/explorers/FSBaseFoldersExplorer.vue +265 -0
  25. package/components/lists/FSDataTable.vue +23 -21
  26. package/components/lists/alerts/FSBaseAlertsList.vue +337 -0
  27. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  28. package/components/lists/authTokens/FSBaseAuthTokensList.vue +79 -0
  29. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +204 -0
  30. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +205 -0
  31. package/components/lists/charts/FSBaseChartsList.vue +268 -0
  32. package/components/lists/comments/FSBaseCommentsList.vue +143 -0
  33. package/components/lists/connectivityScenarios/FSBaseConnectivityScenariosList.vue +128 -0
  34. package/components/lists/dashboardOrganisationTypes/FSBaseDashboardOrganisationTypesList.vue +168 -0
  35. package/components/lists/dashboards/FSBaseDashboardsList.vue +227 -0
  36. package/components/lists/dashboards/FSSimpleDashboardsList.vue +63 -0
  37. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
  38. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +129 -0
  39. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +327 -0
  40. package/components/lists/deviceOrganisations/FSSimpleDeviceOrganisationsList.vue +44 -0
  41. package/components/lists/folders/FSBaseFoldersList.vue +127 -0
  42. package/components/lists/folders/FSSimpleFoldersList.vue +44 -0
  43. package/components/lists/groups/FSBaseGroupsList.vue +136 -0
  44. package/components/lists/groups/FSSimpleGroupsList.vue +44 -0
  45. package/components/lists/locations/FSBaseLocationsList.vue +118 -0
  46. package/components/lists/locations/FSSimpleLocationsList.vue +44 -0
  47. package/components/lists/models/FSBaseModelsList.vue +155 -0
  48. package/components/lists/models/FSSimpleModelsList.vue +44 -0
  49. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +128 -0
  50. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +128 -0
  51. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +157 -0
  52. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +145 -0
  53. package/components/lists/scenarios/FSBaseScenariosList.vue +241 -0
  54. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +156 -0
  55. package/components/lists/serviceAccountRoleOrganisations/FSBaseServiceAccountRoleOrganisationsList.vue +128 -0
  56. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +172 -0
  57. package/components/lists/userOrganisations/FSSimpleUserOrganisationsList.vue +45 -0
  58. package/components/tiles/FSDeviceOrganisationTile.vue +9 -2
  59. package/components/tiles/FSLocationTile.vue +66 -0
  60. package/components/treeviews/FSTreeViewFolder.vue +15 -3
  61. package/components/treeviews/FSTreeViewGroup.vue +22 -4
  62. package/package.json +9 -9
  63. package/utils/dashboards.ts +33 -5
  64. package/utils/index.ts +2 -2
  65. package/utils/permissions.ts +80 -0
  66. package/utils/roles.ts +4 -4
  67. package/utils/tables.ts +41 -0
  68. package/utils/users.ts +7 -4
  69. package/components/selects/FSAggregationSelector.vue +0 -51
  70. package/components/selects/FSAxisTypeSelector.vue +0 -48
  71. package/components/selects/FSDataCategorySelector.vue +0 -62
  72. package/components/selects/FSDataDefinitionSelector.vue +0 -66
  73. package/components/selects/FSDisplayAsSelector.vue +0 -52
  74. package/components/selects/FSFilterTypeSelector.vue +0 -53
  75. package/components/selects/FSHeatmapRuleSelector.vue +0 -52
  76. package/components/selects/FSModelSelector.vue +0 -56
  77. package/components/selects/FSOperationOnSelector.vue +0 -51
  78. package/components/selects/FSPlanningTypeSelector.vue +0 -51
  79. package/components/selects/FSPlotPerSelector.vue +0 -51
  80. package/components/selects/FSSelectSelectedEntities.vue +0 -59
  81. package/components/selects/FSSerieTypeSelector.vue +0 -51
  82. package/utils/charts.ts +0 -136
@@ -0,0 +1,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,204 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="chartOrganisationTypes"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingChartOrganisationTypes"
6
+ :headersOptions="headersOptions"
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
+ #header.imageId-title
23
+ >
24
+ <FSIcon>
25
+ mdi-panorama-variant-outline
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.icon="{ item }"
30
+ >
31
+ <FSIcon>
32
+ {{ item.icon }}
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
+ :thumbnail="true"
44
+ />
45
+ </template>
46
+ <template
47
+ #item.tags="{ item }"
48
+ >
49
+ <FSTagGroup
50
+ variant="slide"
51
+ :editable="false"
52
+ :tags="item.tags"
53
+ />
54
+ </template>
55
+ <template
56
+ #item.chartType="{ item }"
57
+ >
58
+ <FSRow
59
+ :wrap="false"
60
+ >
61
+ <FSIcon
62
+ :icon="chartIcon(item.chartType)"
63
+ />
64
+ <FSText>
65
+ {{ chartTypeLabel(item.chartType) }}
66
+ </FSText>
67
+ </FSRow>
68
+ </template>
69
+ <template
70
+ #item.modelsLabels="{ item }"
71
+ >
72
+ <FSTagGroup
73
+ :editable="false"
74
+ :tags="item.modelsLabels.map((d: any) => d.label)"
75
+ />
76
+ </template>
77
+ <template
78
+ #item.tile="{item}"
79
+ >
80
+ <FSChartTileUI
81
+ variant="standard"
82
+ :label="item.label"
83
+ :category-label="item.chartCategoryLabel"
84
+ :icon="item.icon"
85
+ :imageId="item.imageId"
86
+ :type="item.chartType"
87
+ :color="ColorEnum.Light"
88
+ :to="$props.itemTo && $props.itemTo(item)"
89
+ />
90
+ </template>
91
+ </FSDataTable>
92
+ </template>
93
+
94
+ <script lang="ts">
95
+ import { computed, defineComponent, type PropType, watch } from "vue";
96
+ import type { RouteLocation } from "vue-router";
97
+ import _ from "lodash";
98
+
99
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
100
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
101
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
102
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
103
+
104
+ import type { ChartModelLabel, ChartOrganisationTypeFilters, ChartOrganisationTypeInfos } from "@dative-gpi/foundation-core-domain/models";
105
+ import { useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
106
+
107
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
108
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
109
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
110
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
111
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
112
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
113
+
114
+ import FSDataTable from "../FSDataTable.vue";
115
+
116
+ export default defineComponent({
117
+ name: "FSBaseChartOrganisationTypesList",
118
+ components: {
119
+ FSChartTileUI,
120
+ FSDataTable,
121
+ FSTagGroup,
122
+ FSImage,
123
+ FSIcon,
124
+ FSText,
125
+ FSRow
126
+ },
127
+ props: {
128
+ tableCode: {
129
+ type: String as PropType<string | null>,
130
+ required: false,
131
+ default: null
132
+ },
133
+ chartOrganisationTypeFilters: {
134
+ type: Object as PropType<ChartOrganisationTypeFilters>,
135
+ required: false,
136
+ default: null
137
+ },
138
+ itemTo: {
139
+ type: Function as PropType<(item: ChartOrganisationTypeInfos) => Partial<RouteLocation>>,
140
+ required: false
141
+ },
142
+ modelValue: {
143
+ type: Array as PropType<string[]>,
144
+ default: () => [],
145
+ required: false
146
+ }
147
+ },
148
+ emits: ["update:modelValue"],
149
+ setup(props) {
150
+ const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
151
+
152
+ const headersOptions = computed(() => ({
153
+ modelsLabels: {
154
+ fixedFilters: chartOrganisationTypes.value.map(c => c.modelsLabels).reduce((acc, models) => {
155
+ for (const m of models) {
156
+ if (!acc.map((m) => m.id).includes(m.id)) {
157
+ acc.push(m);
158
+ }
159
+ }
160
+ return acc;
161
+ }, []).map((m) => ({
162
+ value: m.id,
163
+ text: m.label
164
+ })).concat({
165
+ value: '',
166
+ text: '--'
167
+ }),
168
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
169
+ },
170
+ chartType: {
171
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
172
+ value: e.value,
173
+ text: chartTypeLabel(e.value)
174
+ })),
175
+ methodFilter: (value: ChartType, item: ChartType) => value == item
176
+ }
177
+ }));
178
+
179
+ const isSelected = (id: string): boolean => {
180
+ return props.modelValue.includes(id);
181
+ };
182
+
183
+ const fetch = () =>{
184
+ getManyChartOrganisationTypes(props.chartOrganisationTypeFilters);
185
+ };
186
+
187
+ watch(() => [props.chartOrganisationTypeFilters], (next, previous) => {
188
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
189
+ fetch();
190
+ }
191
+ }, { immediate: true });
192
+
193
+ return {
194
+ fetchingChartOrganisationTypes,
195
+ chartOrganisationTypes,
196
+ headersOptions,
197
+ ColorEnum,
198
+ chartTypeLabel,
199
+ isSelected,
200
+ chartIcon
201
+ };
202
+ }
203
+ });
204
+ </script>
@@ -0,0 +1,205 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="chartOrganisations"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingChartOrganisations"
6
+ :headersOptions="headersOptions"
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
+ #header.imageId-title
23
+ >
24
+ <FSIcon>
25
+ mdi-panorama-variant-outline
26
+ </FSIcon>
27
+ </template>
28
+ <template
29
+ #item.icon="{ item }"
30
+ >
31
+ <FSIcon>
32
+ {{ item.icon }}
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
+ :thumbnail="true"
44
+ />
45
+ </template>
46
+ <template
47
+ #item.tags="{ item }"
48
+ >
49
+ <FSTagGroup
50
+ variant="slide"
51
+ :editable="false"
52
+ :tags="item.tags"
53
+ />
54
+ </template>
55
+ <template
56
+ #item.modelsLabels="{ item }"
57
+ >
58
+ <FSTagGroup
59
+ :editable="false"
60
+ :tags="item.modelsLabels.map((d: any) => d.label)"
61
+ />
62
+ </template>
63
+ <template
64
+ #item.tile="{ item }"
65
+ >
66
+ <FSChartTileUI
67
+ variant="standard"
68
+ :label="item.label"
69
+ :categoryLabel="item.chartCategoryLabel"
70
+ :icon="item.icon"
71
+ :imageId="item.imageId"
72
+ :type="item.chartType"
73
+ :color="ColorEnum.Light"
74
+ :to="$props.itemTo && $props.itemTo(item)"
75
+ />
76
+ </template>
77
+ <template
78
+ #item.chartType="{ item }"
79
+ >
80
+ <FSRow
81
+ :wrap="false"
82
+ >
83
+ <FSIcon
84
+ :icon="chartIcon(item.chartType)"
85
+ />
86
+ <FSText>
87
+ {{ chartTypeLabel(item.chartType) }}
88
+ </FSText>
89
+ </FSRow>
90
+ </template>
91
+ </FSDataTable>
92
+ </template>
93
+
94
+ <script lang="ts">
95
+ import { computed, defineComponent, type PropType, watch } from "vue";
96
+ import type { RouteLocation } from "vue-router";
97
+ import _ from "lodash";
98
+
99
+ import { ChartType } from "@dative-gpi/foundation-shared-domain/enums";
100
+ import { getEnumEntries } from "@dative-gpi/foundation-shared-domain/tools";
101
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
102
+ import { chartTypeLabel, chartIcon } from "@dative-gpi/foundation-shared-components/tools";
103
+
104
+ import type { ChartModelLabel, ChartOrganisationFilters, ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
105
+ import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
106
+
107
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
108
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
109
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
110
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
111
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
112
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
113
+
114
+ import FSDataTable from "../FSDataTable.vue";
115
+
116
+ export default defineComponent({
117
+ name: "FSBaseChartOrganisationsList",
118
+ components: {
119
+ FSChartTileUI,
120
+ FSDataTable,
121
+ FSTagGroup,
122
+ FSImage,
123
+ FSIcon,
124
+ FSText,
125
+ FSRow,
126
+ },
127
+ props: {
128
+ tableCode: {
129
+ type: String as PropType<string | null>,
130
+ required: false,
131
+ default: null
132
+ },
133
+ chartOrganisationFilters: {
134
+ type: Object as PropType<ChartOrganisationFilters>,
135
+ required: false,
136
+ default: null
137
+ },
138
+ itemTo: {
139
+ type: Function as PropType<(item: ChartOrganisationInfos) => Partial<RouteLocation>>,
140
+ required: false
141
+ },
142
+ modelValue: {
143
+ type: Array as PropType<string[]>,
144
+ default: () => [],
145
+ required: false
146
+ }
147
+ },
148
+ emits: ["update:modelValue"],
149
+ setup(props) {
150
+ const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
151
+
152
+ const headersOptions = computed(() => ({
153
+ modelsLabels: {
154
+ fixedFilters: chartOrganisations.value.map(c => c.modelsLabels).reduce((acc, models) => {
155
+ for (const m of models) {
156
+ if (!acc.map((m) => m.id).includes(m.id)) {
157
+ acc.push(m);
158
+ }
159
+ }
160
+ return acc;
161
+ }, []).map((m) => ({
162
+ value: m.id,
163
+ text: m.label
164
+ })).concat({
165
+ value: '',
166
+ text: '--'
167
+ }),
168
+ methodFilter: (value: string, items: ChartModelLabel[]) => (items.length == 0 && value == '') || (items.length > 0 && items.some(ml => ml.id == value))
169
+ },
170
+ chartType: {
171
+ fixedFilters: getEnumEntries(ChartType).map(e => ({
172
+ value: e.value,
173
+ text: chartTypeLabel(e.value)
174
+ })),
175
+ methodFilter: (value: ChartType, item: ChartType) => value == item
176
+ }
177
+ }));
178
+
179
+
180
+ const isSelected = (id: string): boolean => {
181
+ return props.modelValue.includes(id);
182
+ };
183
+
184
+ const fetch = () =>{
185
+ getManyChartOrganisations(props.chartOrganisationFilters);
186
+ }
187
+
188
+ watch(() => [props.chartOrganisationFilters], (next, previous) => {
189
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
190
+ fetch();
191
+ }
192
+ }, { immediate: true });
193
+
194
+ return {
195
+ fetchingChartOrganisations,
196
+ chartOrganisations,
197
+ headersOptions,
198
+ ColorEnum,
199
+ chartTypeLabel,
200
+ isSelected,
201
+ chartIcon
202
+ };
203
+ }
204
+ });
205
+ </script>