@dative-gpi/foundation-core-components 1.0.51 → 1.0.53

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 (23) hide show
  1. package/components/lists/alerts/FSBaseAlertsList.vue +342 -0
  2. package/components/lists/alerts/FSButtonAcknowledgeAlert.vue +101 -0
  3. package/components/lists/authTokens/FSBaseAuthTokensList.vue +3 -1
  4. package/components/lists/chartOrganisationTypes/FSBaseChartOrganisationTypesList.vue +156 -0
  5. package/components/lists/chartOrganisations/FSBaseChartOrganisationsList.vue +157 -0
  6. package/components/lists/charts/FSBaseChartsList.vue +204 -0
  7. package/components/lists/comments/FSBaseCommentsList.vue +127 -0
  8. package/components/lists/dashboards/FSBaseDashboardsList.vue +1 -6
  9. package/components/lists/dataCategories/FSBaseDataCategoriesList.vue +154 -0
  10. package/components/lists/dataDefinitions/FSBaseDataDefinitionsList.vue +128 -0
  11. package/components/lists/deviceOrganisations/FSBaseDeviceOrganisationsList.vue +1 -0
  12. package/components/lists/folders/FSBaseFoldersList.vue +1 -6
  13. package/components/lists/models/FSBaseModelsList.vue +126 -0
  14. package/components/lists/roleOrganisationTypes/FSBaseRoleOrganisationTypesList.vue +121 -0
  15. package/components/lists/roleOrganisations/FSBaseRoleOrganisationsList.vue +121 -0
  16. package/components/lists/scenarioOrganisationTypes/FSBaseScenarioOrganisationTypesList.vue +114 -0
  17. package/components/lists/scenarioOrganisations/FSBaseScenarioOrganisationsList.vue +101 -0
  18. package/components/lists/scenarios/FSBaseScenariosList.vue +200 -0
  19. package/components/lists/serviceAccountOrganisations/FSBaseServiceAccountOrganisationsList.vue +142 -0
  20. package/components/lists/userOrganisations/FSBaseUserOrganisationsList.vue +3 -1
  21. package/components/tiles/FSLocationTile.vue +65 -0
  22. package/package.json +7 -7
  23. package/utils/users.ts +3 -0
@@ -0,0 +1,157 @@
1
+ <template>
2
+ <FSDataTable
3
+ :items="chartOrganisations"
4
+ :itemTo="$props.itemTo"
5
+ :loading="fetchingChartOrganisations"
6
+ :tableCode="$props.tableCode"
7
+ :modelValue="$props.modelValue"
8
+ @update:modelValue="$emit('update:modelValue', $event)"
9
+ v-bind="$attrs"
10
+ >
11
+ <template
12
+ v-for="(_, name) in $slots"
13
+ v-slot:[name]="slotData"
14
+ >
15
+ <slot
16
+ :name="name"
17
+ v-bind="slotData"
18
+ />
19
+ </template>
20
+
21
+ <template
22
+ #item.icon="{ item }"
23
+ >
24
+ <FSIcon>
25
+ {{ item.icon }}
26
+ </FSIcon>
27
+ </template>
28
+
29
+ <template
30
+ #item.imageId="{ item }"
31
+ >
32
+ <FSImage
33
+ v-if="item.imageId"
34
+ height="32px"
35
+ width="32px"
36
+ :imageId="item.imageId"
37
+ />
38
+ </template>
39
+
40
+ <template
41
+ #item.tags="{ item }"
42
+ >
43
+ <FSTagGroup
44
+ variant="slide"
45
+ :editable="false"
46
+ :tags="item.tags"
47
+ />
48
+ </template>
49
+
50
+ <template
51
+ #item.modelsLabels="{ item }"
52
+ >
53
+ <FSTagGroup
54
+ :editable="false"
55
+ :tags="item.modelsLabels.map((d: any) => d.label)"
56
+ />
57
+ </template>
58
+
59
+ <template
60
+ #item.tile="{ item }"
61
+ >
62
+ <FSChartTileUI
63
+ :label="item.label"
64
+ :categoryLabel="item.chartCategoryLabel"
65
+ :icon="item.icon"
66
+ :imageId="item.imageId"
67
+ :type="item.chartType"
68
+ :to="$props.itemTo && $props.itemTo(item)"
69
+ />
70
+ </template>
71
+ </FSDataTable>
72
+ </template>
73
+
74
+ <script lang="ts">
75
+ import { defineComponent, type PropType, watch } from "vue";
76
+ import type { RouteLocation } from "vue-router";
77
+ import _ from "lodash";
78
+
79
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
80
+ import { PlotPer } from "@dative-gpi/foundation-shared-domain/enums";
81
+
82
+ import { type ChartOrganisationFilters, type ChartOrganisationInfos } from "@dative-gpi/foundation-core-domain/models";
83
+ import { useChartOrganisations } from "@dative-gpi/foundation-core-services/composables";
84
+
85
+ import FSDataTable from "../FSDataTable.vue";
86
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
87
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
88
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
89
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
90
+
91
+ export default defineComponent({
92
+ name: "FSBaseChartOrganisationsList",
93
+ components: {
94
+ FSDataTable,
95
+ FSIcon,
96
+ FSImage,
97
+ FSTagGroup,
98
+ FSChartTileUI
99
+ },
100
+ props: {
101
+ modelValue: {
102
+ type: Array as PropType<string[]>,
103
+ default: () => [],
104
+ required: false
105
+ },
106
+ chartOrganisationFilters: {
107
+ type: Object as PropType<ChartOrganisationFilters>,
108
+ required: false,
109
+ default: null
110
+ },
111
+ plotPer: {
112
+ type: Number as PropType<PlotPer>,
113
+ required: false,
114
+ default: PlotPer.None
115
+ },
116
+ tableCode: {
117
+ type: String,
118
+ required: true
119
+ },
120
+ itemTo: {
121
+ type: Function as PropType<(item: ChartOrganisationInfos) => Partial<RouteLocation>>,
122
+ required: false
123
+ }
124
+ },
125
+ emits: ["update:modelValue"],
126
+ setup(props) {
127
+
128
+ const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
129
+
130
+ const isSelected = (id: string): boolean => {
131
+ return props.modelValue.includes(id);
132
+ };
133
+
134
+ const fetch = () =>{
135
+ if(props.plotPer === PlotPer.None) {
136
+ getManyChartOrganisations(props.chartOrganisationFilters);
137
+ } else {
138
+ getManyChartOrganisations({...props.chartOrganisationFilters, plotPer: props.plotPer});
139
+ }
140
+ }
141
+
142
+ watch(() => [props.chartOrganisationFilters, props.plotPer], (next, previous) => {
143
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
144
+ fetch();
145
+ }
146
+ }, { immediate: true });
147
+
148
+
149
+ return {
150
+ ColorEnum,
151
+ fetchingChartOrganisations,
152
+ chartOrganisations,
153
+ isSelected
154
+ };
155
+ }
156
+ });
157
+ </script>
@@ -0,0 +1,204 @@
1
+ <template>
2
+ <FSDataTable
3
+ :loading="fetchingChartOrganisationTypes || fetchingChartOrganisations"
4
+ :items="charts"
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
+
20
+ <template
21
+ #item.icon="{ item }"
22
+ >
23
+ <FSIcon>
24
+ {{ item.icon }}
25
+ </FSIcon>
26
+ </template>
27
+
28
+ <template
29
+ #item.imageId="{ item }"
30
+ >
31
+ <FSImage
32
+ v-if="item.imageId"
33
+ height="32px"
34
+ width="32px"
35
+ :imageId="item.imageId"
36
+ />
37
+ </template>
38
+
39
+ <template
40
+ #item.tags="{ item }"
41
+ >
42
+ <FSTagGroup
43
+ variant="slide"
44
+ :editable="false"
45
+ :tags="item.tags"
46
+ />
47
+ </template>
48
+
49
+ <template
50
+ #item.modelsLabels="{ item }"
51
+ >
52
+ <FSTagGroup
53
+ :editable="false"
54
+ :tags="item.modelsLabels.map((d: any) => d.label)"
55
+ />
56
+ </template>
57
+
58
+ <template
59
+ #item.tile="{ item }"
60
+ >
61
+ <FSChartTileUI
62
+ :label="item.label"
63
+ :categoryLabel="item.chartCategoryLabel"
64
+ :icon="item.icon"
65
+ :imageId="item.imageId"
66
+ :type="item.chartType"
67
+ :color="isSelected(item.id) ? ColorEnum.Primary : ColorEnum.Dark"
68
+ @click="update(item.id)"
69
+ />
70
+ </template>
71
+ </FSDataTable>
72
+ </template>
73
+
74
+ <script lang="ts">
75
+ import { defineComponent, type PropType, watch, computed } from "vue";
76
+ import _ from "lodash";
77
+
78
+ import {ColorEnum } from "@dative-gpi/foundation-shared-components/models";
79
+
80
+ import type { ChartOrganisationFilters, ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
81
+
82
+ import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
83
+
84
+ import FSChartTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSChartTileUI.vue";
85
+ import FSTagGroup from "@dative-gpi/foundation-shared-components/components/FSTagGroup.vue";
86
+ import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
87
+ import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
88
+ import FSDataTable from "../FSDataTable.vue";
89
+
90
+ export default defineComponent({
91
+ name: "FSBaseChartsList",
92
+ components: {
93
+ FSChartTileUI,
94
+ FSDataTable,
95
+ FSTagGroup,
96
+ FSImage,
97
+ FSIcon
98
+ },
99
+ props: {
100
+ modelValue: {
101
+ type: Array as PropType<string[]>,
102
+ default: () => [],
103
+ required: false
104
+ },
105
+ chartOrganisationFilters: {
106
+ type: Object as PropType<ChartOrganisationFilters>,
107
+ required: false,
108
+ default: null
109
+ },
110
+ chartOrganisationTypeFilters: {
111
+ type: Object as PropType<ChartOrganisationTypeFilters>,
112
+ required: false,
113
+ default: null
114
+ },
115
+ tableCode: {
116
+ type: String,
117
+ required: true
118
+ }
119
+ },
120
+ emits: ["update:modelValue"],
121
+ setup(props, { emit }) {
122
+
123
+ const { entities: chartOrganisations, fetching: fetchingChartOrganisations, getMany: getManyChartOrganisations } = useChartOrganisations();
124
+ const { entities: chartOrganisationTypes, fetching: fetchingChartOrganisationTypes, getMany: getManyChartOrganisationTypes } = useChartOrganisationTypes();
125
+
126
+ const isSelected = (value : string): boolean => {
127
+ return props.modelValue.includes(value);
128
+ };
129
+
130
+ const fetch = () =>{
131
+ getManyChartOrganisations(props.chartOrganisationFilters);
132
+ getManyChartOrganisationTypes(props.chartOrganisationTypeFilters)
133
+ }
134
+
135
+ const charts = computed(() => {
136
+ return chartOrganisations.value.map(c => {
137
+ return {
138
+ id: `${c.id}_${c.scope}`,
139
+ imageId: c.imageId,
140
+ chartId: c.chartId,
141
+ chartCategoryId: c.chartCategoryId,
142
+ chartCategoryLabel: c.chartCategoryLabel,
143
+ scope: c.scope,
144
+ label: c.label,
145
+ title: c.title,
146
+ code: c.code,
147
+ icon: c.icon,
148
+ tags: c.tags,
149
+ multiple: c.multiple,
150
+ chartType: c.chartType,
151
+ modelsLabels: c.modelsLabels
152
+ }
153
+ })
154
+ .concat(chartOrganisationTypes.value.map(c => {
155
+ return {
156
+ id: `${c.id}_${c.scope}`,
157
+ imageId: c.imageId,
158
+ chartId: c.chartId,
159
+ chartCategoryId: c.chartCategoryId,
160
+ chartCategoryLabel: c.chartCategoryLabel,
161
+ scope: c.scope,
162
+ label: c.label,
163
+ title: c.title,
164
+ code: c.code,
165
+ icon: c.icon,
166
+ tags: c.tags,
167
+ multiple: c.multiple,
168
+ chartType: c.chartType,
169
+ modelsLabels: c.modelsLabels
170
+ }
171
+ }))
172
+ })
173
+
174
+ const update = (value : string) =>
175
+ {
176
+ const item = isSelected(value);
177
+
178
+ if(item){
179
+ emit("update:modelValue", props.modelValue.filter(m => m != value))
180
+ }
181
+ else{
182
+ emit("update:modelValue", [...props.modelValue, value])
183
+ }
184
+ }
185
+
186
+ watch(() => [props.chartOrganisationFilters,props.chartOrganisationTypeFilters], (next, previous) => {
187
+ if ((!next && !previous) || !_.isEqual(next, previous)) {
188
+ fetch();
189
+ }
190
+ }, { immediate: true });
191
+
192
+ return {
193
+ fetchingChartOrganisationTypes,
194
+ fetchingChartOrganisations,
195
+ chartOrganisationTypes,
196
+ chartOrganisations,
197
+ ColorEnum,
198
+ charts,
199
+ isSelected,
200
+ update
201
+ };
202
+ }
203
+ });
204
+ </script>
@@ -0,0 +1,127 @@
1
+ <template>
2
+ <FSCol
3
+ v-if="$props.allowAlertComment"
4
+ padding="24px"
5
+ gap="48px"
6
+ align="center-center"
7
+ >
8
+ <FSText
9
+ font="text-h3"
10
+ >
11
+ {{ $tr('ui.common.comments', 'Comments') }}
12
+ </FSText>
13
+
14
+ <FSRow
15
+ width="500px"
16
+ >
17
+ <FSCommentField
18
+ :buttonLabel="$tr('ui.common.publish','Publish')"
19
+ :creating="creatingComment"
20
+ @submit="createNewComment"
21
+ :userImageId="currentUser?.imageId"
22
+ />
23
+ </FSRow>
24
+ <FSCommentTileUI
25
+ v-for="comment in orderedComments"
26
+ :key="comment.id"
27
+ :timestamp="epochToLongTimeFormat(comment.timestamp)"
28
+ :userName="comment.userName"
29
+ :userImageId="comment.userImageId"
30
+ :canEditRemove="currentUser?.id === comment.userId"
31
+ :comment="comment.comment"
32
+ :edited="comment.edited"
33
+ :id="comment.id"
34
+ @edit="updateComment"
35
+ @remove="removeComment(comment.id)"
36
+ />
37
+ </FSCol>
38
+ </template>
39
+
40
+ <script lang="ts">
41
+ import type { PropType} from "vue";
42
+ import { computed, defineComponent, onMounted, watch } from "vue";
43
+ import _ from "lodash";
44
+
45
+ import { useDateFormat, useCurrentUser } from "@dative-gpi/foundation-shared-services/composables";
46
+ import { useCreateComment,useComments,useUpdateComment, useRemoveComment } from "@dative-gpi/foundation-core-services/composables";
47
+ import type { CommentFilters } from "@dative-gpi/foundation-core-domain/models";
48
+ import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
49
+
50
+ import FSCommentField from "@dative-gpi/foundation-shared-components/components/fields/FSCommentField.vue";
51
+ import FSCommentTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSCommentTileUI.vue";
52
+ import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
53
+ import FSCol from "@dative-gpi/foundation-shared-components/components/FSCol.vue";
54
+ import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
55
+
56
+ export default defineComponent({
57
+ title: "FSBaseCommentsList",
58
+ components: {
59
+ FSText,
60
+ FSCol,
61
+ FSRow,
62
+ FSCommentTileUI,
63
+ FSCommentField
64
+ },
65
+ props: {
66
+ commentFilters: {
67
+ type: Object as PropType<CommentFilters>,
68
+ required: true
69
+ },
70
+ allowAlertComment: {
71
+ type: Boolean,
72
+ default: false
73
+ }
74
+ },
75
+ setup(props) {
76
+ const {fetch : fetchCurrentUser, entity: currentUser} = useCurrentUser();
77
+ const { create: createComment, creating : creatingComment } = useCreateComment();
78
+ const { getMany: fetchComments, entities: comments } = useComments();
79
+ const {update } = useUpdateComment();
80
+ const {remove } = useRemoveComment();
81
+ const { epochToLongTimeFormat } = useDateFormat();
82
+
83
+ const orderedComments = computed(() => {
84
+ return _.orderBy(comments.value, ['timestamp'], ['desc']);
85
+ });
86
+
87
+ onMounted(() => {
88
+ fetchCurrentUser();
89
+ });
90
+
91
+ const createNewComment = (comment: string) => {
92
+ if(props.commentFilters.alertId && comment){
93
+ createComment({
94
+ comment,
95
+ alertId: props.commentFilters.alertId,
96
+ });
97
+ }
98
+ };
99
+
100
+ const updateComment = (payload : any) => {
101
+ update(payload.commentId, {comment : payload.comment})
102
+ }
103
+
104
+ const removeComment = (commentId : string) => {
105
+ remove(commentId)
106
+ }
107
+
108
+ watch(() => props.commentFilters, (next, previous) => {
109
+ if (!_.isEqual(next, previous)) {
110
+ fetchComments(props.commentFilters);
111
+ }
112
+ }, { immediate: true });
113
+
114
+ return {
115
+ comments,
116
+ ColorEnum,
117
+ creatingComment,
118
+ currentUser,
119
+ orderedComments,
120
+ createNewComment,
121
+ updateComment,
122
+ removeComment,
123
+ epochToLongTimeFormat
124
+ };
125
+ }
126
+ });
127
+ </script>
@@ -1,11 +1,8 @@
1
1
  <template>
2
- <FSLoadDataTable
3
- v-if="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
4
- />
5
2
  <FSDataTable
6
- v-else
7
3
  :items="items"
8
4
  :itemTo="$props.itemTo"
5
+ :loading="fetchingDashboardOrganisationTypes || fetchingDashboardOrganisations || fetchingDashboardShallows"
9
6
  :tableCode="$props.tableCode"
10
7
  :modelValue="selecteds"
11
8
  @update:modelValue="onSelect"
@@ -90,7 +87,6 @@ import { DashboardType } from "@dative-gpi/foundation-shared-domain/enums";
90
87
 
91
88
  import FSDataTable from "../FSDataTable.vue";
92
89
  import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
93
- import FSLoadDataTable from "@dative-gpi/foundation-shared-components/components/lists/FSLoadDataTable.vue";
94
90
  import FSDashboardShallowTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardShallowTileUI.vue";
95
91
  import FSDashboardOrganisationTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTileUI.vue";
96
92
  import FSDashboardOrganisationTypeTileUI from "@dative-gpi/foundation-shared-components/components/tiles/FSDashboardOrganisationTypeTileUI.vue";
@@ -99,7 +95,6 @@ export default defineComponent({
99
95
  name: "FSBaseDashboardsList",
100
96
  components: {
101
97
  FSDataTable,
102
- FSLoadDataTable,
103
98
  FSIcon,
104
99
  FSDashboardOrganisationTileUI,
105
100
  FSDashboardOrganisationTypeTileUI,
@@ -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>