@dative-gpi/foundation-core-components 1.0.34 → 1.0.35
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.
- package/components/autocompletes/FSAutocompleteChart.vue +41 -49
- package/components/autocompletes/FSAutocompleteDashboard.vue +43 -51
- package/components/autocompletes/FSAutocompleteDashboardOrganisation.vue +24 -39
- package/components/autocompletes/FSAutocompleteDataCategory.vue +39 -61
- package/components/autocompletes/FSAutocompleteDataDefinition.vue +13 -51
- package/components/autocompletes/FSAutocompleteGroup.vue +17 -38
- package/components/autocompletes/FSAutocompleteLocation.vue +17 -38
- package/components/autocompletes/FSAutocompleteManufacturer.vue +57 -2
- package/components/autocompletes/FSAutocompleteModel.vue +57 -2
- package/components/autocompletes/FSAutocompleteOrganisationType.vue +17 -0
- package/components/autocompletes/FSAutocompleteRole.vue +41 -49
- package/components/autocompletes/FSAutocompleteServiceAccountRoleOrganisation.vue +19 -40
- package/components/autocompletes/FSAutocompleteUserOrganisation.vue +20 -42
- package/package.json +7 -7
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<FSAutocompleteField
|
|
3
3
|
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
4
4
|
:multiple="$props.multiple"
|
|
5
|
+
:placeholder="placeholder"
|
|
5
6
|
:loading="loading"
|
|
6
7
|
:items="charts"
|
|
7
8
|
:modelValue="$props.modelValue"
|
|
@@ -9,51 +10,22 @@
|
|
|
9
10
|
v-bind="$attrs"
|
|
10
11
|
>
|
|
11
12
|
<template
|
|
12
|
-
#
|
|
13
|
+
#item-prepend="{ item }"
|
|
13
14
|
>
|
|
14
|
-
<
|
|
15
|
-
v-if="
|
|
16
|
-
align="center-center"
|
|
17
|
-
:wrap="false"
|
|
15
|
+
<FSIcon
|
|
16
|
+
v-if="item.icon"
|
|
18
17
|
>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
{{ item.raw.icon }}
|
|
23
|
-
</FSIcon>
|
|
24
|
-
<FSSpan>
|
|
25
|
-
{{ item.raw.label }}
|
|
26
|
-
</FSSpan>
|
|
27
|
-
<FSChip
|
|
28
|
-
:color="chartOriginColor(item.raw.type)"
|
|
29
|
-
:label="chartOriginLabel(item.raw.type)"
|
|
30
|
-
:editable="false"
|
|
31
|
-
/>
|
|
32
|
-
</FSRow>
|
|
18
|
+
{{ item.icon }}
|
|
19
|
+
</FSIcon>
|
|
33
20
|
</template>
|
|
34
21
|
<template
|
|
35
|
-
#item-
|
|
22
|
+
#item-append="{ item }"
|
|
36
23
|
>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
v-if="item.raw.icon"
|
|
43
|
-
>
|
|
44
|
-
{{ item.raw.icon }}
|
|
45
|
-
</FSIcon>
|
|
46
|
-
<FSSpan
|
|
47
|
-
:font="font"
|
|
48
|
-
>
|
|
49
|
-
{{ item.raw.label }}
|
|
50
|
-
</FSSpan>
|
|
51
|
-
<FSChip
|
|
52
|
-
:color="chartOriginColor(item.raw.type)"
|
|
53
|
-
:label="chartOriginLabel(item.raw.type)"
|
|
54
|
-
:editable="false"
|
|
55
|
-
/>
|
|
56
|
-
</FSRow>
|
|
24
|
+
<FSChip
|
|
25
|
+
:color="chartOriginColor(item.type)"
|
|
26
|
+
:label="chartOriginLabel(item.type)"
|
|
27
|
+
:editable="false"
|
|
28
|
+
/>
|
|
57
29
|
</template>
|
|
58
30
|
<template
|
|
59
31
|
#toggle-set-item="props"
|
|
@@ -87,6 +59,7 @@ import { computed, defineComponent, type PropType } from "vue";
|
|
|
87
59
|
import { type ChartOrganisationFilters, ChartOrigin, type ChartOrganisationTypeFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
88
60
|
import { useChartOrganisations, useChartOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
89
61
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
90
63
|
|
|
91
64
|
import { chartOriginColor, chartOriginLabel } from "../../utils";
|
|
92
65
|
|
|
@@ -94,8 +67,6 @@ import FSAutocompleteField from "@dative-gpi/foundation-shared-components/compon
|
|
|
94
67
|
import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
|
|
95
68
|
import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
|
|
96
69
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
97
|
-
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
98
|
-
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
99
70
|
|
|
100
71
|
export default defineComponent({
|
|
101
72
|
name: "FSAutocompleteChart",
|
|
@@ -103,9 +74,7 @@ export default defineComponent({
|
|
|
103
74
|
FSAutocompleteField,
|
|
104
75
|
FSButton,
|
|
105
76
|
FSChip,
|
|
106
|
-
FSIcon
|
|
107
|
-
FSSpan,
|
|
108
|
-
FSRow
|
|
77
|
+
FSIcon
|
|
109
78
|
},
|
|
110
79
|
props: {
|
|
111
80
|
chartOrganisationTypeFilters: {
|
|
@@ -128,6 +97,16 @@ export default defineComponent({
|
|
|
128
97
|
required: false,
|
|
129
98
|
default: ChartOrigin.None
|
|
130
99
|
},
|
|
100
|
+
ignoreChartOrganisationTypes: {
|
|
101
|
+
type: Boolean,
|
|
102
|
+
required: false,
|
|
103
|
+
default: false
|
|
104
|
+
},
|
|
105
|
+
ignoreChartOrganisations: {
|
|
106
|
+
type: Boolean,
|
|
107
|
+
required: false,
|
|
108
|
+
default: false
|
|
109
|
+
},
|
|
131
110
|
multiple: {
|
|
132
111
|
type: Boolean,
|
|
133
112
|
required: false,
|
|
@@ -143,6 +122,7 @@ export default defineComponent({
|
|
|
143
122
|
setup(props, { emit }) {
|
|
144
123
|
const { getMany: getManyChartOrganisationTypes, fetching: fetchingChartOrganisationTypes, entities: chartOrganisationTypes } = useChartOrganisationTypes();
|
|
145
124
|
const { getMany: getManyChartOrganisations, fetching: fetchingChartOrganisations, entities: chartOrganisations } = useChartOrganisations();
|
|
125
|
+
const { $tr } = useTranslationsProvider();
|
|
146
126
|
|
|
147
127
|
const charts = computed(() => {
|
|
148
128
|
return chartOrganisationTypes.value.map(rot => ({
|
|
@@ -162,6 +142,13 @@ export default defineComponent({
|
|
|
162
142
|
return init.value && (fetchingChartOrganisationTypes.value || fetchingChartOrganisations.value);
|
|
163
143
|
});
|
|
164
144
|
|
|
145
|
+
const placeholder = computed((): string | null => {
|
|
146
|
+
if (props.multiple && props.modelValue) {
|
|
147
|
+
return $tr("ui.autocomplete-chart.placeholder", "{0} chart(s) selected", props.modelValue.length);
|
|
148
|
+
}
|
|
149
|
+
return null;
|
|
150
|
+
});
|
|
151
|
+
|
|
165
152
|
const update = (value: Chart[] | Chart | null) => {
|
|
166
153
|
if (Array.isArray(value)) {
|
|
167
154
|
emit("update:modelValue", value.map(v => v.id));
|
|
@@ -174,10 +161,14 @@ export default defineComponent({
|
|
|
174
161
|
};
|
|
175
162
|
|
|
176
163
|
const fetch = (search: string | null) => {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
164
|
+
const promises = [];
|
|
165
|
+
if (!props.ignoreChartOrganisationTypes) {
|
|
166
|
+
promises.push(getManyChartOrganisationTypes({ ...props.chartOrganisationTypeFilters, search: search ?? undefined }));
|
|
167
|
+
}
|
|
168
|
+
if (!props.ignoreChartOrganisations) {
|
|
169
|
+
promises.push(getManyChartOrganisations({ ...props.chartOrganisationFilters, search: search ?? undefined }));
|
|
170
|
+
}
|
|
171
|
+
return Promise.all(promises);
|
|
181
172
|
};
|
|
182
173
|
|
|
183
174
|
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
@@ -189,6 +180,7 @@ export default defineComponent({
|
|
|
189
180
|
);
|
|
190
181
|
|
|
191
182
|
return {
|
|
183
|
+
placeholder,
|
|
192
184
|
toggleSet,
|
|
193
185
|
loading,
|
|
194
186
|
charts,
|
|
@@ -2,58 +2,30 @@
|
|
|
2
2
|
<FSAutocompleteField
|
|
3
3
|
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
4
4
|
:multiple="$props.multiple"
|
|
5
|
-
:
|
|
5
|
+
:placeholder="placeholder"
|
|
6
6
|
:items="dashboards"
|
|
7
|
+
:loading="loading"
|
|
7
8
|
:modelValue="$props.modelValue"
|
|
8
9
|
@update:modelValue="onUpdate"
|
|
9
10
|
v-bind="$attrs"
|
|
10
11
|
>
|
|
11
12
|
<template
|
|
12
|
-
#
|
|
13
|
+
#item-prepend="{ item }"
|
|
13
14
|
>
|
|
14
|
-
<
|
|
15
|
-
v-if="
|
|
16
|
-
align="center-center"
|
|
17
|
-
:wrap="false"
|
|
15
|
+
<FSIcon
|
|
16
|
+
v-if="item.icon"
|
|
18
17
|
>
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
{{ item.raw.icon }}
|
|
23
|
-
</FSIcon>
|
|
24
|
-
<FSSpan>
|
|
25
|
-
{{ item.raw.label }}
|
|
26
|
-
</FSSpan>
|
|
27
|
-
<FSChip
|
|
28
|
-
:color="dashboardTypeColor(item.raw.type)"
|
|
29
|
-
:label="dashboardTypeLabel(item.raw.type)"
|
|
30
|
-
:editable="false"
|
|
31
|
-
/>
|
|
32
|
-
</FSRow>
|
|
18
|
+
{{ item.icon }}
|
|
19
|
+
</FSIcon>
|
|
33
20
|
</template>
|
|
34
21
|
<template
|
|
35
|
-
#item-
|
|
22
|
+
#item-append="{ item }"
|
|
36
23
|
>
|
|
37
|
-
<
|
|
38
|
-
|
|
39
|
-
:
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
v-if="item.raw.icon"
|
|
43
|
-
>
|
|
44
|
-
{{ item.raw.icon }}
|
|
45
|
-
</FSIcon>
|
|
46
|
-
<FSSpan
|
|
47
|
-
:font="font"
|
|
48
|
-
>
|
|
49
|
-
{{ item.raw.label }}
|
|
50
|
-
</FSSpan>
|
|
51
|
-
<FSChip
|
|
52
|
-
:color="dashboardTypeColor(item.raw.type)"
|
|
53
|
-
:label="dashboardTypeLabel(item.raw.type)"
|
|
54
|
-
:editable="false"
|
|
55
|
-
/>
|
|
56
|
-
</FSRow>
|
|
24
|
+
<FSChip
|
|
25
|
+
:color="dashboardTypeColor(item.type)"
|
|
26
|
+
:label="dashboardTypeLabel(item.type)"
|
|
27
|
+
:editable="false"
|
|
28
|
+
/>
|
|
57
29
|
</template>
|
|
58
30
|
<template
|
|
59
31
|
#toggle-set-item="props"
|
|
@@ -87,6 +59,7 @@ import { computed, defineComponent, type PropType } from "vue";
|
|
|
87
59
|
import { type DashboardOrganisationFilters, type DashboardOrganisationTypeFilters, type DashboardShallowFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
88
60
|
import { useDashboardOrganisations, useDashboardOrganisationTypes, useDashboardShallows } from "@dative-gpi/foundation-core-services/composables";
|
|
89
61
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
62
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
90
63
|
import { DashboardType } from "@dative-gpi/foundation-shared-domain/models";
|
|
91
64
|
|
|
92
65
|
import { dashboardTypeColor, dashboardTypeLabel } from "../../utils";
|
|
@@ -95,8 +68,6 @@ import FSAutocompleteField from "@dative-gpi/foundation-shared-components/compon
|
|
|
95
68
|
import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
|
|
96
69
|
import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
|
|
97
70
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
98
|
-
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
99
|
-
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
100
71
|
|
|
101
72
|
|
|
102
73
|
export default defineComponent({
|
|
@@ -105,9 +76,7 @@ export default defineComponent({
|
|
|
105
76
|
FSAutocompleteField,
|
|
106
77
|
FSButton,
|
|
107
78
|
FSChip,
|
|
108
|
-
FSIcon
|
|
109
|
-
FSSpan,
|
|
110
|
-
FSRow
|
|
79
|
+
FSIcon
|
|
111
80
|
},
|
|
112
81
|
props: {
|
|
113
82
|
dashboardOrganisationTypeFilters: {
|
|
@@ -135,6 +104,16 @@ export default defineComponent({
|
|
|
135
104
|
required: false,
|
|
136
105
|
default: DashboardType.None
|
|
137
106
|
},
|
|
107
|
+
ignoreDashboardOrganisationTypes: {
|
|
108
|
+
type: Boolean,
|
|
109
|
+
required: false,
|
|
110
|
+
default: false
|
|
111
|
+
},
|
|
112
|
+
ignoreDashboardOrganisations: {
|
|
113
|
+
type: Boolean,
|
|
114
|
+
required: false,
|
|
115
|
+
default: false
|
|
116
|
+
},
|
|
138
117
|
multiple: {
|
|
139
118
|
type: Boolean,
|
|
140
119
|
required: false,
|
|
@@ -151,6 +130,7 @@ export default defineComponent({
|
|
|
151
130
|
const { getMany: getManyDashboardOrganisationTypes, fetching: fetchingDashboardOrganisationTypes, entities: dashboardOrganisationTypes } = useDashboardOrganisationTypes();
|
|
152
131
|
const { getMany: getManyDashboardOrganisations, fetching: fetchingDashboardOrganisations, entities: dashboardOrganisations } = useDashboardOrganisations();
|
|
153
132
|
const { getMany: getManyDashboardShallows, fetching: fetchingDashboardShallows, entities: dashboardShallows } = useDashboardShallows();
|
|
133
|
+
const { $tr } = useTranslationsProvider();
|
|
154
134
|
|
|
155
135
|
const dashboards = computed(() => {
|
|
156
136
|
return dashboardOrganisationTypes.value.map(rot => ({
|
|
@@ -175,6 +155,13 @@ export default defineComponent({
|
|
|
175
155
|
return init.value && (fetchingDashboardOrganisationTypes.value || fetchingDashboardOrganisations.value || fetchingDashboardShallows.value);
|
|
176
156
|
});
|
|
177
157
|
|
|
158
|
+
const placeholder = computed((): string | null => {
|
|
159
|
+
if (props.multiple && props.modelValue) {
|
|
160
|
+
return $tr("ui.autocomplete-dashboard.placeholder", "{0} dashboard(s) selected", props.modelValue.length);
|
|
161
|
+
}
|
|
162
|
+
return null;
|
|
163
|
+
});
|
|
164
|
+
|
|
178
165
|
const update = (value: Dashboard[] | Dashboard | null) => {
|
|
179
166
|
if (Array.isArray(value)) {
|
|
180
167
|
emit("update:modelValue", value.map(v => v.id));
|
|
@@ -187,11 +174,15 @@ export default defineComponent({
|
|
|
187
174
|
};
|
|
188
175
|
|
|
189
176
|
const fetch = (search: string | null) => {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
177
|
+
const promises = [];
|
|
178
|
+
if (!props.ignoreDashboardOrganisationTypes) {
|
|
179
|
+
promises.push(getManyDashboardOrganisationTypes({ ...props.dashboardOrganisationTypeFilters, search: search ?? undefined }));
|
|
180
|
+
}
|
|
181
|
+
if (!props.ignoreDashboardOrganisations) {
|
|
182
|
+
promises.push(getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined }));
|
|
183
|
+
promises.push(getManyDashboardShallows({ ...props.dashboardShallowFilters, search: search ?? undefined }));
|
|
184
|
+
}
|
|
185
|
+
return Promise.all(promises);
|
|
195
186
|
};
|
|
196
187
|
|
|
197
188
|
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
@@ -203,6 +194,7 @@ export default defineComponent({
|
|
|
203
194
|
);
|
|
204
195
|
|
|
205
196
|
return {
|
|
197
|
+
placeholder,
|
|
206
198
|
dashboards,
|
|
207
199
|
toggleSet,
|
|
208
200
|
loading,
|
|
@@ -1,48 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSAutocompleteField
|
|
3
3
|
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
4
|
-
:loading="loading"
|
|
5
4
|
:items="dashboardOrganisations"
|
|
5
|
+
:multiple="$props.multiple"
|
|
6
|
+
:placeholder="placeholder"
|
|
7
|
+
:loading="loading"
|
|
6
8
|
:modelValue="$props.modelValue"
|
|
7
9
|
@update:modelValue="onUpdate"
|
|
8
10
|
v-bind="$attrs"
|
|
9
11
|
>
|
|
10
12
|
<template
|
|
11
|
-
#
|
|
12
|
-
>
|
|
13
|
-
<FSRow
|
|
14
|
-
v-if="$props.modelValue"
|
|
15
|
-
align="center-center"
|
|
16
|
-
:wrap="false"
|
|
17
|
-
>
|
|
18
|
-
<FSIcon
|
|
19
|
-
v-if="item.raw.icon"
|
|
20
|
-
>
|
|
21
|
-
{{ item.raw.icon }}
|
|
22
|
-
</FSIcon>
|
|
23
|
-
<FSSpan>
|
|
24
|
-
{{ item.raw.label }}
|
|
25
|
-
</FSSpan>
|
|
26
|
-
</FSRow>
|
|
27
|
-
</template>
|
|
28
|
-
<template
|
|
29
|
-
#item-label="{ item, font }"
|
|
13
|
+
#item-prepend="{ item }"
|
|
30
14
|
>
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
:wrap="false"
|
|
15
|
+
<FSIcon
|
|
16
|
+
v-if="item.icon"
|
|
34
17
|
>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
>
|
|
38
|
-
{{ item.raw.icon }}
|
|
39
|
-
</FSIcon>
|
|
40
|
-
<FSSpan
|
|
41
|
-
:font="font"
|
|
42
|
-
>
|
|
43
|
-
{{ item.raw.label }}
|
|
44
|
-
</FSSpan>
|
|
45
|
-
</FSRow>
|
|
18
|
+
{{ item.icon }}
|
|
19
|
+
</FSIcon>
|
|
46
20
|
</template>
|
|
47
21
|
</FSAutocompleteField>
|
|
48
22
|
</template>
|
|
@@ -53,20 +27,17 @@ import { computed, defineComponent, type PropType } from "vue";
|
|
|
53
27
|
import { type DashboardOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
54
28
|
import { useDashboardOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
55
29
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
30
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
56
31
|
|
|
57
32
|
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
58
33
|
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
59
|
-
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
60
|
-
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
61
34
|
|
|
62
35
|
|
|
63
36
|
export default defineComponent({
|
|
64
37
|
name: "FSAutocompleteDashboard",
|
|
65
38
|
components: {
|
|
66
39
|
FSAutocompleteField,
|
|
67
|
-
FSIcon
|
|
68
|
-
FSSpan,
|
|
69
|
-
FSRow
|
|
40
|
+
FSIcon
|
|
70
41
|
},
|
|
71
42
|
props: {
|
|
72
43
|
dashboardOrganisationFilters: {
|
|
@@ -79,6 +50,11 @@ export default defineComponent({
|
|
|
79
50
|
required: false,
|
|
80
51
|
default: null
|
|
81
52
|
},
|
|
53
|
+
multiple: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
required: false,
|
|
56
|
+
default: false
|
|
57
|
+
},
|
|
82
58
|
toggleSetDisabled: {
|
|
83
59
|
type: Boolean,
|
|
84
60
|
required: false,
|
|
@@ -88,11 +64,19 @@ export default defineComponent({
|
|
|
88
64
|
emits: ["update:modelValue"],
|
|
89
65
|
setup(props, { emit }) {
|
|
90
66
|
const { getMany: getManyDashboardOrganisations, fetching: fetchingDashboardOrganisations, entities: dashboardOrganisations } = useDashboardOrganisations();
|
|
67
|
+
const { $tr } = useTranslationsProvider();
|
|
91
68
|
|
|
92
69
|
const loading = computed((): boolean => {
|
|
93
70
|
return init.value && fetchingDashboardOrganisations.value;
|
|
94
71
|
});
|
|
95
72
|
|
|
73
|
+
const placeholder = computed((): string | null => {
|
|
74
|
+
if (props.multiple && props.modelValue) {
|
|
75
|
+
return $tr("ui.autocomplete-dashboard-organisation.placeholder", "{0} dashboard(s) selected", props.modelValue.length);
|
|
76
|
+
}
|
|
77
|
+
return null;
|
|
78
|
+
});
|
|
79
|
+
|
|
96
80
|
const fetch = (search: string | null) => {
|
|
97
81
|
return getManyDashboardOrganisations({ ...props.dashboardOrganisationFilters, search: search ?? undefined });
|
|
98
82
|
};
|
|
@@ -106,6 +90,7 @@ export default defineComponent({
|
|
|
106
90
|
|
|
107
91
|
return {
|
|
108
92
|
dashboardOrganisations,
|
|
93
|
+
placeholder,
|
|
109
94
|
toggleSet,
|
|
110
95
|
loading,
|
|
111
96
|
onUpdate
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
<FSAutocompleteField
|
|
3
3
|
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
4
4
|
:multiple="$props.multiple"
|
|
5
|
+
:placeholder="placeholder"
|
|
5
6
|
:items="dataCategories"
|
|
6
7
|
:loading="loading"
|
|
7
8
|
:modelValue="$props.modelValue"
|
|
@@ -9,67 +10,48 @@
|
|
|
9
10
|
v-bind="$attrs"
|
|
10
11
|
>
|
|
11
12
|
<template
|
|
12
|
-
#
|
|
13
|
-
>
|
|
14
|
-
<FSRow
|
|
15
|
-
v-if="$props.modelValue"
|
|
16
|
-
align="center-center"
|
|
17
|
-
padding="0 8px 0 0"
|
|
18
|
-
gap="4px"
|
|
19
|
-
:wrap="false"
|
|
20
|
-
>
|
|
21
|
-
<FSSpan>
|
|
22
|
-
{{ item.raw.label }}
|
|
23
|
-
</FSSpan>
|
|
24
|
-
<FSIcon
|
|
25
|
-
v-if="$props.multiple"
|
|
26
|
-
:color="item.raw.correlated ? ColorEnum.Success : ColorEnum.Warning"
|
|
27
|
-
>
|
|
28
|
-
{{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
|
|
29
|
-
</FSIcon>
|
|
30
|
-
</FSRow>
|
|
31
|
-
</template>
|
|
32
|
-
<template
|
|
33
|
-
v-if="selected"
|
|
34
|
-
#autocomplete-suffix
|
|
13
|
+
#item-append="{ item }"
|
|
35
14
|
>
|
|
36
15
|
<FSChip
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
:
|
|
16
|
+
v-if="item.correlated"
|
|
17
|
+
prependIcon="mdi-link"
|
|
18
|
+
:label="$tr('ui.autocomplete-data-category.linked','Linked')"
|
|
19
|
+
:color="ColorEnum.Success"
|
|
20
|
+
/>
|
|
21
|
+
<FSChip
|
|
22
|
+
v-else
|
|
23
|
+
prependIcon="mdi-link-off"
|
|
24
|
+
:label="$tr('ui.autocomplete-data-category.not-linked','Not linked')"
|
|
25
|
+
:color="ColorEnum.Warning"
|
|
40
26
|
/>
|
|
41
|
-
</template>
|
|
42
|
-
<template
|
|
43
|
-
#item-label="{ item, font }"
|
|
44
|
-
>
|
|
45
|
-
<FSRow
|
|
46
|
-
align="center-left"
|
|
47
|
-
:wrap="false"
|
|
48
|
-
>
|
|
49
|
-
<FSSpan
|
|
50
|
-
:font="font"
|
|
51
|
-
>
|
|
52
|
-
{{ item.raw.label }}
|
|
53
|
-
</FSSpan>
|
|
54
|
-
<FSIcon
|
|
55
|
-
:color="item.raw.correlated ? ColorEnum.Success : ColorEnum.Warning"
|
|
56
|
-
>
|
|
57
|
-
{{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
|
|
58
|
-
</FSIcon>
|
|
59
|
-
</FSRow>
|
|
60
27
|
</template>
|
|
61
28
|
<template
|
|
62
29
|
#toggle-set-item="props"
|
|
63
30
|
>
|
|
64
31
|
<FSButton
|
|
65
|
-
:iconColor="props.item.correlated ? ColorEnum.Success : ColorEnum.Warning"
|
|
66
|
-
:prependIcon="props.item.correlated ? 'mdi-link' : 'mdi-link-off'"
|
|
67
32
|
:variant="props.getVariant(props.item)"
|
|
68
33
|
:color="props.getColor(props.item)"
|
|
69
34
|
:class="props.getClass(props.item)"
|
|
70
35
|
:label="props.item.label"
|
|
71
36
|
@click="props.toggle(props.item)"
|
|
72
|
-
|
|
37
|
+
>
|
|
38
|
+
<template
|
|
39
|
+
#append
|
|
40
|
+
>
|
|
41
|
+
<FSChip
|
|
42
|
+
v-if="props.item.correlated"
|
|
43
|
+
prependIcon="mdi-link"
|
|
44
|
+
:label="$tr('ui.autocomplete-data-category.linked','Linked')"
|
|
45
|
+
:color="ColorEnum.Success"
|
|
46
|
+
/>
|
|
47
|
+
<FSChip
|
|
48
|
+
v-else
|
|
49
|
+
prependIcon="mdi-link-off"
|
|
50
|
+
:label="$tr('ui.autocomplete-data-category.not-linked','Not linked')"
|
|
51
|
+
:color="ColorEnum.Warning"
|
|
52
|
+
/>
|
|
53
|
+
</template>
|
|
54
|
+
</FSButton>
|
|
73
55
|
</template>
|
|
74
56
|
</FSAutocompleteField>
|
|
75
57
|
</template>
|
|
@@ -77,27 +59,22 @@
|
|
|
77
59
|
<script lang="ts">
|
|
78
60
|
import { computed, defineComponent, type PropType } from "vue";
|
|
79
61
|
|
|
80
|
-
import { type DataCategoryInfos, type DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
81
62
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
63
|
+
import { type DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
82
64
|
import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
|
|
65
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
83
66
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
84
67
|
|
|
85
68
|
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
86
69
|
import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
|
|
87
|
-
import FSIcon from "@dative-gpi/foundation-shared-components/components/FSIcon.vue";
|
|
88
|
-
import FSSpan from "@dative-gpi/foundation-shared-components/components/FSSpan.vue";
|
|
89
70
|
import FSChip from "@dative-gpi/foundation-shared-components/components/FSChip.vue";
|
|
90
|
-
import FSRow from "@dative-gpi/foundation-shared-components/components/FSRow.vue";
|
|
91
71
|
|
|
92
72
|
export default defineComponent({
|
|
93
73
|
name: "FSAutocompleteDataCategory",
|
|
94
74
|
components: {
|
|
95
75
|
FSAutocompleteField,
|
|
96
76
|
FSButton,
|
|
97
|
-
|
|
98
|
-
FSSpan,
|
|
99
|
-
FSChip,
|
|
100
|
-
FSRow
|
|
77
|
+
FSChip
|
|
101
78
|
},
|
|
102
79
|
props: {
|
|
103
80
|
dataCategoriesFilters: {
|
|
@@ -124,16 +101,17 @@ export default defineComponent({
|
|
|
124
101
|
emits: ["update:modelValue"],
|
|
125
102
|
setup(props, { emit }) {
|
|
126
103
|
const { getMany: getManyDataCategories, fetching: fetchingDataCategories, entities: dataCategories } = useDataCategories();
|
|
104
|
+
const { $tr } = useTranslationsProvider();
|
|
127
105
|
|
|
128
106
|
const loading = computed((): boolean => {
|
|
129
107
|
return init.value && fetchingDataCategories.value;
|
|
130
108
|
});
|
|
131
109
|
|
|
132
|
-
const
|
|
133
|
-
if (props.multiple) {
|
|
134
|
-
return
|
|
110
|
+
const placeholder = computed((): string | null => {
|
|
111
|
+
if (props.multiple && props.modelValue) {
|
|
112
|
+
return $tr("ui.autocomplete-data-category.placeholder", "{0} data category(ies) selected", props.modelValue.length);
|
|
135
113
|
}
|
|
136
|
-
return
|
|
114
|
+
return null;
|
|
137
115
|
});
|
|
138
116
|
|
|
139
117
|
const fetch = (search: string | null) => {
|
|
@@ -149,9 +127,9 @@ export default defineComponent({
|
|
|
149
127
|
|
|
150
128
|
return {
|
|
151
129
|
dataCategories,
|
|
130
|
+
placeholder,
|
|
152
131
|
ColorEnum,
|
|
153
132
|
toggleSet,
|
|
154
|
-
selected,
|
|
155
133
|
loading,
|
|
156
134
|
onUpdate
|
|
157
135
|
};
|