@dative-gpi/foundation-core-components 1.0.176 → 1.0.177
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.
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField
|
|
3
|
+
itemTitle="label"
|
|
4
|
+
:label="$props.label ?? $tr('ui.common.user', 'User')"
|
|
5
|
+
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
6
|
+
:multiple="$props.multiple"
|
|
7
|
+
:placeholder="placeholder"
|
|
8
|
+
:items="serviceAccountOrganisations"
|
|
9
|
+
:loading="loading"
|
|
10
|
+
:modelValue="$props.modelValue"
|
|
11
|
+
@update:modelValue="onUpdate"
|
|
12
|
+
v-bind="$attrs"
|
|
13
|
+
>
|
|
14
|
+
<template
|
|
15
|
+
#item-prepend="{ item }"
|
|
16
|
+
>
|
|
17
|
+
<FSImage
|
|
18
|
+
v-if="item.imageId"
|
|
19
|
+
height="26px"
|
|
20
|
+
width="26px"
|
|
21
|
+
:imageId="item.imageId"
|
|
22
|
+
:thumbnail="true"
|
|
23
|
+
/>
|
|
24
|
+
</template>
|
|
25
|
+
<template
|
|
26
|
+
#toggle-set-item="props"
|
|
27
|
+
>
|
|
28
|
+
<FSButton
|
|
29
|
+
:padding="props.item.imageId ? ['6px 16px', '4px 12px'] : undefined"
|
|
30
|
+
:variant="props.getVariant(props.item)"
|
|
31
|
+
:color="props.getColor(props.item)"
|
|
32
|
+
:class="props.getClass(props.item)"
|
|
33
|
+
:label="props.item.label"
|
|
34
|
+
@click="props.toggle(props.item)"
|
|
35
|
+
>
|
|
36
|
+
<template
|
|
37
|
+
v-if="props.item.imageId"
|
|
38
|
+
#prepend
|
|
39
|
+
>
|
|
40
|
+
<FSImage
|
|
41
|
+
height="26px"
|
|
42
|
+
width="26px"
|
|
43
|
+
:imageId="props.item.imageId"
|
|
44
|
+
:thumbnail="true"
|
|
45
|
+
/>
|
|
46
|
+
</template>
|
|
47
|
+
</FSButton>
|
|
48
|
+
</template>
|
|
49
|
+
</FSAutocompleteField>
|
|
50
|
+
</template>
|
|
51
|
+
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
import { computed, defineComponent, type PropType } from "vue";
|
|
54
|
+
|
|
55
|
+
import type { ServiceAccountOrganisationFilters, ServiceAccountOrganisationInfos} from "@dative-gpi/foundation-core-domain/models";
|
|
56
|
+
import { useServiceAccountOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
57
|
+
|
|
58
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
59
|
+
import { useTranslations as useTranslationsProvider } from "@dative-gpi/bones-ui";
|
|
60
|
+
|
|
61
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
62
|
+
import FSButton from "@dative-gpi/foundation-shared-components/components/FSButton.vue";
|
|
63
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
64
|
+
|
|
65
|
+
export default defineComponent({
|
|
66
|
+
name: "FSAutocompleteServiceAccountOrganisation",
|
|
67
|
+
components: {
|
|
68
|
+
FSAutocompleteField,
|
|
69
|
+
FSButton,
|
|
70
|
+
FSImage
|
|
71
|
+
},
|
|
72
|
+
props: {
|
|
73
|
+
serviceAccountOrganisationFilters: {
|
|
74
|
+
type: Object as PropType<ServiceAccountOrganisationFilters>,
|
|
75
|
+
required: false,
|
|
76
|
+
default: null
|
|
77
|
+
},
|
|
78
|
+
modelValue: {
|
|
79
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
80
|
+
required: false,
|
|
81
|
+
default: null
|
|
82
|
+
},
|
|
83
|
+
multiple: {
|
|
84
|
+
type: Boolean,
|
|
85
|
+
required: false,
|
|
86
|
+
default: false
|
|
87
|
+
},
|
|
88
|
+
toggleSetDisabled: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
required: false,
|
|
91
|
+
default: false
|
|
92
|
+
},
|
|
93
|
+
label: {
|
|
94
|
+
type: String as PropType<string | null>,
|
|
95
|
+
required: false,
|
|
96
|
+
default: null
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
emits: ["update:modelValue"],
|
|
100
|
+
setup(props, { emit }) {
|
|
101
|
+
const { getMany: getServiceAccountOrganisations, fetching: fetchingServiceAccountOrganisations, entities: serviceAccountOrganisations } = useServiceAccountOrganisations();
|
|
102
|
+
const { $tr } = useTranslationsProvider();
|
|
103
|
+
|
|
104
|
+
const loading = computed((): boolean => {
|
|
105
|
+
return init.value && fetchingServiceAccountOrganisations.value;
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
const placeholder = computed((): string | null => {
|
|
109
|
+
if (props.multiple && props.modelValue) {
|
|
110
|
+
return $tr("autocomplete.service-account.placeholder", "{0} service account(s) selected", props.modelValue.length);
|
|
111
|
+
}
|
|
112
|
+
return null;
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const fetch = (search: string | null) => {
|
|
116
|
+
return getServiceAccountOrganisations({ ...props.serviceAccountOrganisationFilters, search: search ?? undefined });
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
120
|
+
serviceAccountOrganisations,
|
|
121
|
+
[() => props.serviceAccountOrganisationFilters],
|
|
122
|
+
emit,
|
|
123
|
+
fetch,
|
|
124
|
+
null,
|
|
125
|
+
(item: ServiceAccountOrganisationInfos) => item.id,
|
|
126
|
+
(item: ServiceAccountOrganisationInfos) => item.label
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
return {
|
|
130
|
+
serviceAccountOrganisations,
|
|
131
|
+
placeholder,
|
|
132
|
+
toggleSet,
|
|
133
|
+
loading,
|
|
134
|
+
onUpdate
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
</script>
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-core-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.177",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,11 +10,11 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-core-domain": "1.0.
|
|
14
|
-
"@dative-gpi/foundation-core-services": "1.0.
|
|
15
|
-
"@dative-gpi/foundation-shared-components": "1.0.
|
|
16
|
-
"@dative-gpi/foundation-shared-domain": "1.0.
|
|
17
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "1.0.177",
|
|
14
|
+
"@dative-gpi/foundation-core-services": "1.0.177",
|
|
15
|
+
"@dative-gpi/foundation-shared-components": "1.0.177",
|
|
16
|
+
"@dative-gpi/foundation-shared-domain": "1.0.177",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "1.0.177"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
"sass": "1.71.1",
|
|
27
27
|
"sass-loader": "13.3.2"
|
|
28
28
|
},
|
|
29
|
-
"gitHead": "
|
|
29
|
+
"gitHead": "0b54c0dddfdfcad69143175aae2c98a04eac9bca"
|
|
30
30
|
}
|