@dative-gpi/foundation-core-components 0.0.85 → 0.0.86
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/FSAutocompleteDataCategory.vue +112 -0
- package/components/autocompletes/FSAutocompleteDataDefinition.vue +112 -0
- package/components/autocompletes/FSAutocompleteGroup.vue +70 -0
- package/components/autocompletes/FSAutocompleteManufacturer.vue +70 -0
- package/components/autocompletes/FSAutocompleteModel.vue +70 -0
- package/components/autocompletes/FSAutocompleteOrganisationType.vue +70 -0
- package/components/autocompletes/FSAutocompleteUserOrganisation.vue +109 -0
- package/package.json +7 -7
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="dataCategories"
|
|
5
|
+
:multiple="$props.multiple"
|
|
6
|
+
:modelValue="$props.modelValue"
|
|
7
|
+
@update:modelValue="onUpdate"
|
|
8
|
+
v-model:search="search"
|
|
9
|
+
v-bind="$attrs">
|
|
10
|
+
<template #selection="{ item }">
|
|
11
|
+
<FSRow align="center-center"
|
|
12
|
+
:wrap="false"
|
|
13
|
+
:gap="0">
|
|
14
|
+
<FSText>
|
|
15
|
+
{{ item.raw.label }}
|
|
16
|
+
</FSText>
|
|
17
|
+
<FSIcon>
|
|
18
|
+
{{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
|
|
19
|
+
</FSIcon>
|
|
20
|
+
</FSRow>
|
|
21
|
+
</template>
|
|
22
|
+
<template #item="{ props, item }">
|
|
23
|
+
<v-list-item v-bind="{ ...props, title: '' }">
|
|
24
|
+
<FSRow align="center-left">
|
|
25
|
+
<FSCheckbox v-if="$props.multiple"
|
|
26
|
+
:modelValue="isSelected(item.value)" />
|
|
27
|
+
<FSRow :gap="2">
|
|
28
|
+
<FSText>
|
|
29
|
+
{{ item.raw.label }}
|
|
30
|
+
</FSText>
|
|
31
|
+
<FSIcon>
|
|
32
|
+
{{ item.raw.correlated ? 'mdi-link' : 'mdi-link-off' }}
|
|
33
|
+
</FSIcon>
|
|
34
|
+
</FSRow>
|
|
35
|
+
</FSRow>
|
|
36
|
+
</v-list-item>
|
|
37
|
+
</template>
|
|
38
|
+
</FSAutocompleteField>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script lang="ts">
|
|
42
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
43
|
+
|
|
44
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
45
|
+
import { useDataCategories } from "@dative-gpi/foundation-core-services/composables";
|
|
46
|
+
import { DataCategoryFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
47
|
+
|
|
48
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
49
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
50
|
+
|
|
51
|
+
export default defineComponent({
|
|
52
|
+
name: "FSAutocompleteDataCategory",
|
|
53
|
+
components: {
|
|
54
|
+
FSAutocompleteField,
|
|
55
|
+
FSText
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
dataCategoriesFilters: {
|
|
59
|
+
type: Object as PropType<DataCategoryFilters>,
|
|
60
|
+
required: false,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
modelValue: {
|
|
64
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
65
|
+
required: false,
|
|
66
|
+
default: null
|
|
67
|
+
},
|
|
68
|
+
multiple: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
toggleSetDisabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
required: false,
|
|
76
|
+
default: false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
emits: ["update:modelValue"],
|
|
80
|
+
setup(props, { emit }) {
|
|
81
|
+
const { getMany: getManyDataCategories, fetching: fetchingDataCategories, entities: dataCategories } = useDataCategories();
|
|
82
|
+
|
|
83
|
+
const innerFetch = (search: string | null) => {
|
|
84
|
+
return getManyDataCategories({ ...props.dataCategoriesFilters, search: search ?? undefined });
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
88
|
+
dataCategories,
|
|
89
|
+
[() => props.dataCategoriesFilters],
|
|
90
|
+
emit,
|
|
91
|
+
innerFetch
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const loading = computed((): boolean => {
|
|
95
|
+
return init.value && fetchingDataCategories.value;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const isSelected = (id: any) => {
|
|
99
|
+
return props.modelValue?.includes(id);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
dataCategories,
|
|
104
|
+
toggleSet,
|
|
105
|
+
loading,
|
|
106
|
+
search,
|
|
107
|
+
onUpdate,
|
|
108
|
+
isSelected
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="dataDefinitions"
|
|
5
|
+
:multiple="$props.multiple"
|
|
6
|
+
:modelValue="$props.modelValue"
|
|
7
|
+
@update:modelValue="onUpdate"
|
|
8
|
+
v-model:search="search"
|
|
9
|
+
v-bind="$attrs">
|
|
10
|
+
<template #selection="{ item }">
|
|
11
|
+
<FSRow align="center-center"
|
|
12
|
+
:wrap="false"
|
|
13
|
+
:gap="0">
|
|
14
|
+
<FSText>
|
|
15
|
+
{{ item.raw.label }}
|
|
16
|
+
</FSText>
|
|
17
|
+
<FSText v-if="item.raw.unit">
|
|
18
|
+
({{ item.raw.unit }})
|
|
19
|
+
</FSText>
|
|
20
|
+
</FSRow>
|
|
21
|
+
</template>
|
|
22
|
+
<template #item="{ props, item }">
|
|
23
|
+
<v-list-item v-bind="{ ...props, title: '' }">
|
|
24
|
+
<FSRow align="center-left">
|
|
25
|
+
<FSCheckbox v-if="$props.multiple"
|
|
26
|
+
:modelValue="isSelected(item.value)" />
|
|
27
|
+
<FSRow :gap="0">
|
|
28
|
+
<FSText>
|
|
29
|
+
{{ item.raw.label }}
|
|
30
|
+
</FSText>
|
|
31
|
+
<FSText v-if="item.raw.unit">
|
|
32
|
+
({{ item.raw.unit }})
|
|
33
|
+
</FSText>
|
|
34
|
+
</FSRow>
|
|
35
|
+
</FSRow>
|
|
36
|
+
</v-list-item>
|
|
37
|
+
</template>
|
|
38
|
+
</FSAutocompleteField>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script lang="ts">
|
|
42
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
43
|
+
|
|
44
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
45
|
+
import { useDataDefinitions } from "@dative-gpi/foundation-core-services/composables";
|
|
46
|
+
import { DataDefinitionFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
47
|
+
|
|
48
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
49
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
50
|
+
|
|
51
|
+
export default defineComponent({
|
|
52
|
+
name: "FSAutocompleteDataDefinition",
|
|
53
|
+
components: {
|
|
54
|
+
FSAutocompleteField,
|
|
55
|
+
FSText
|
|
56
|
+
},
|
|
57
|
+
props: {
|
|
58
|
+
dataDefinitionFilters: {
|
|
59
|
+
type: Object as PropType<DataDefinitionFilters>,
|
|
60
|
+
required: false,
|
|
61
|
+
default: null
|
|
62
|
+
},
|
|
63
|
+
modelValue: {
|
|
64
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
65
|
+
required: false,
|
|
66
|
+
default: null
|
|
67
|
+
},
|
|
68
|
+
multiple: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
required: false,
|
|
71
|
+
default: false
|
|
72
|
+
},
|
|
73
|
+
toggleSetDisabled: {
|
|
74
|
+
type: Boolean,
|
|
75
|
+
required: false,
|
|
76
|
+
default: false
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
emits: ["update:modelValue"],
|
|
80
|
+
setup(props, { emit }) {
|
|
81
|
+
const { getMany: getManyDataDefinitions, fetching: fetchingDataDefinitions, entities: dataDefinitions } = useDataDefinitions();
|
|
82
|
+
|
|
83
|
+
const innerFetch = (search: string | null) => {
|
|
84
|
+
return getManyDataDefinitions({ ...props.dataDefinitionFilters, search: search ?? undefined });
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
88
|
+
dataDefinitions,
|
|
89
|
+
[() => props.dataDefinitionFilters],
|
|
90
|
+
emit,
|
|
91
|
+
innerFetch
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const loading = computed((): boolean => {
|
|
95
|
+
return init.value && fetchingDataDefinitions.value;
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const isSelected = (id: any) => {
|
|
99
|
+
return props.modelValue?.includes(id);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
return {
|
|
103
|
+
dataDefinitions,
|
|
104
|
+
toggleSet,
|
|
105
|
+
loading,
|
|
106
|
+
search,
|
|
107
|
+
onUpdate,
|
|
108
|
+
isSelected
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="groups"
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
@update:modelValue="onUpdate"
|
|
7
|
+
v-model:search="search"
|
|
8
|
+
v-bind="$attrs" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
13
|
+
|
|
14
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
+
import { useGroups } from "@dative-gpi/foundation-core-services/composables";
|
|
16
|
+
import { GroupFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
17
|
+
|
|
18
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "FSAutocompleteGroup",
|
|
22
|
+
components: {
|
|
23
|
+
FSAutocompleteField
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
groupFilters: {
|
|
27
|
+
type: Object as PropType<GroupFilters>,
|
|
28
|
+
required: false,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
33
|
+
required: false,
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
toggleSetDisabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: false,
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const { getMany: getManyGroups, fetching: fetchingGroups, entities: groups } = useGroups();
|
|
45
|
+
|
|
46
|
+
const innerFetch = (search: string | null) => {
|
|
47
|
+
return getManyGroups({ ...props.groupFilters, search: search ?? undefined });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
51
|
+
groups,
|
|
52
|
+
[() => props.groupFilters],
|
|
53
|
+
emit,
|
|
54
|
+
innerFetch
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const loading = computed((): boolean => {
|
|
58
|
+
return init.value && fetchingGroups.value;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
groups,
|
|
63
|
+
toggleSet,
|
|
64
|
+
loading,
|
|
65
|
+
search,
|
|
66
|
+
onUpdate
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="manufacturers"
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
@update:modelValue="onUpdate"
|
|
7
|
+
v-model:search="search"
|
|
8
|
+
v-bind="$attrs" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
13
|
+
|
|
14
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
+
import { useManufacturers } from "@dative-gpi/foundation-core-services/composables";
|
|
16
|
+
import { ManufacturerFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
17
|
+
|
|
18
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "FSAutocompleteManufacturer",
|
|
22
|
+
components: {
|
|
23
|
+
FSAutocompleteField
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
manufacturerFilters: {
|
|
27
|
+
type: Object as PropType<ManufacturerFilters>,
|
|
28
|
+
required: false,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
33
|
+
required: false,
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
toggleSetDisabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: false,
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const { getMany: getManyManufacturers, fetching: fetchingManufacturers, entities: manufacturers } = useManufacturers();
|
|
45
|
+
|
|
46
|
+
const innerFetch = (search: string | null) => {
|
|
47
|
+
return getManyManufacturers({ ...props.manufacturerFilters, search: search ?? undefined });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
51
|
+
manufacturers,
|
|
52
|
+
[() => props.manufacturerFilters],
|
|
53
|
+
emit,
|
|
54
|
+
innerFetch
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const loading = computed((): boolean => {
|
|
58
|
+
return init.value && fetchingManufacturers.value;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
manufacturers,
|
|
63
|
+
toggleSet,
|
|
64
|
+
loading,
|
|
65
|
+
search,
|
|
66
|
+
onUpdate
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="models"
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
@update:modelValue="onUpdate"
|
|
7
|
+
v-model:search="search"
|
|
8
|
+
v-bind="$attrs" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
13
|
+
|
|
14
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
+
import { useModels } from "@dative-gpi/foundation-core-services/composables";
|
|
16
|
+
import { ModelFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
17
|
+
|
|
18
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "FSAutocompleteModel",
|
|
22
|
+
components: {
|
|
23
|
+
FSAutocompleteField
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
modelFilters: {
|
|
27
|
+
type: Object as PropType<ModelFilters>,
|
|
28
|
+
required: false,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
33
|
+
required: false,
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
toggleSetDisabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: false,
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const { getMany: getManyModels, fetching: fetchingModels, entities: models } = useModels();
|
|
45
|
+
|
|
46
|
+
const innerFetch = (search: string | null) => {
|
|
47
|
+
return getManyModels({ ...props.modelFilters, search: search ?? undefined });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
51
|
+
models,
|
|
52
|
+
[() => props.modelFilters],
|
|
53
|
+
emit,
|
|
54
|
+
innerFetch
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const loading = computed((): boolean => {
|
|
58
|
+
return init.value && fetchingModels.value;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
models,
|
|
63
|
+
toggleSet,
|
|
64
|
+
loading,
|
|
65
|
+
search,
|
|
66
|
+
onUpdate
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="organisationTypes"
|
|
5
|
+
:modelValue="$props.modelValue"
|
|
6
|
+
@update:modelValue="onUpdate"
|
|
7
|
+
v-model:search="search"
|
|
8
|
+
v-bind="$attrs" />
|
|
9
|
+
</template>
|
|
10
|
+
|
|
11
|
+
<script lang="ts">
|
|
12
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
13
|
+
|
|
14
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
15
|
+
import { useOrganisationTypes } from "@dative-gpi/foundation-core-services/composables";
|
|
16
|
+
import { OrganisationTypeFilters } from "@dative-gpi/foundation-shared-domain/models";
|
|
17
|
+
|
|
18
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
19
|
+
|
|
20
|
+
export default defineComponent({
|
|
21
|
+
name: "FSAutocompleteOrganisationType",
|
|
22
|
+
components: {
|
|
23
|
+
FSAutocompleteField
|
|
24
|
+
},
|
|
25
|
+
props: {
|
|
26
|
+
organisationTypeFilters: {
|
|
27
|
+
type: Object as PropType<OrganisationTypeFilters>,
|
|
28
|
+
required: false,
|
|
29
|
+
default: null
|
|
30
|
+
},
|
|
31
|
+
modelValue: {
|
|
32
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
33
|
+
required: false,
|
|
34
|
+
default: null
|
|
35
|
+
},
|
|
36
|
+
toggleSetDisabled: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
required: false,
|
|
39
|
+
default: false
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
emits: ["update:modelValue"],
|
|
43
|
+
setup(props, { emit }) {
|
|
44
|
+
const { getMany: getManyOrganisationTypes, fetching: fetchingOrganisationTypes, entities: organisationTypes } = useOrganisationTypes();
|
|
45
|
+
|
|
46
|
+
const innerFetch = (search: string | null) => {
|
|
47
|
+
return getManyOrganisationTypes({ ...props.organisationTypeFilters, search: search ?? undefined });
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
51
|
+
organisationTypes,
|
|
52
|
+
[() => props.organisationTypeFilters],
|
|
53
|
+
emit,
|
|
54
|
+
innerFetch
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
const loading = computed((): boolean => {
|
|
58
|
+
return init.value && fetchingOrganisationTypes.value;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
organisationTypes,
|
|
63
|
+
toggleSet,
|
|
64
|
+
loading,
|
|
65
|
+
search,
|
|
66
|
+
onUpdate
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
</script>
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSAutocompleteField :toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
3
|
+
:loading="loading"
|
|
4
|
+
:items="userOrganisations"
|
|
5
|
+
:multiple="$props.multiple"
|
|
6
|
+
:modelValue="$props.modelValue"
|
|
7
|
+
@update:modelValue="onUpdate"
|
|
8
|
+
v-model:search="search"
|
|
9
|
+
v-bind="$attrs">
|
|
10
|
+
<template #selection="{ item }">
|
|
11
|
+
<FSRow align="center-center"
|
|
12
|
+
:wrap="false">
|
|
13
|
+
<FSImage height="26px"
|
|
14
|
+
width="26px"
|
|
15
|
+
:imageId="item.raw.imageId" />
|
|
16
|
+
<FSText>
|
|
17
|
+
{{ item.raw.label }}
|
|
18
|
+
</FSText>
|
|
19
|
+
</FSRow>
|
|
20
|
+
</template>
|
|
21
|
+
<template #item="{ props, item }">
|
|
22
|
+
<v-list-item v-bind="{ ...props, title: '' }">
|
|
23
|
+
<FSRow align="center-left">
|
|
24
|
+
<FSCheckbox v-if="$props.multiple"
|
|
25
|
+
:modelValue="isSelected(item.value)" />
|
|
26
|
+
<FSImage height="26px"
|
|
27
|
+
width="26px"
|
|
28
|
+
:imageId="item.raw.imageId" />
|
|
29
|
+
<FSText>
|
|
30
|
+
{{ item.raw.label }}
|
|
31
|
+
</FSText>
|
|
32
|
+
</FSRow>
|
|
33
|
+
</v-list-item>
|
|
34
|
+
</template>
|
|
35
|
+
</FSAutocompleteField>
|
|
36
|
+
</template>
|
|
37
|
+
|
|
38
|
+
<script lang="ts">
|
|
39
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
40
|
+
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
41
|
+
import { useUserOrganisations } from "@dative-gpi/foundation-core-services/composables";
|
|
42
|
+
import { UserOrganisationFilters } from "@dative-gpi/foundation-core-domain/models";
|
|
43
|
+
|
|
44
|
+
import FSAutocompleteField from "@dative-gpi/foundation-shared-components/components/fields/FSAutocompleteField.vue";
|
|
45
|
+
import FSImage from "@dative-gpi/foundation-shared-components/components/FSImage.vue";
|
|
46
|
+
import FSText from "@dative-gpi/foundation-shared-components/components/FSText.vue";
|
|
47
|
+
|
|
48
|
+
export default defineComponent({
|
|
49
|
+
name: "FSAutocompleteUserOrganisation",
|
|
50
|
+
components: {
|
|
51
|
+
FSAutocompleteField,
|
|
52
|
+
FSImage,
|
|
53
|
+
FSText
|
|
54
|
+
},
|
|
55
|
+
props: {
|
|
56
|
+
userOrganisationFilters: {
|
|
57
|
+
type: Object as PropType<UserOrganisationFilters>,
|
|
58
|
+
required: false,
|
|
59
|
+
default: null
|
|
60
|
+
},
|
|
61
|
+
modelValue: {
|
|
62
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
63
|
+
required: false,
|
|
64
|
+
default: null
|
|
65
|
+
},
|
|
66
|
+
multiple: {
|
|
67
|
+
type: Boolean,
|
|
68
|
+
required: false,
|
|
69
|
+
default: false
|
|
70
|
+
},
|
|
71
|
+
toggleSetDisabled: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: false
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
emits: ["update:modelValue"],
|
|
78
|
+
setup(props, { emit }) {
|
|
79
|
+
const { getMany: getManyUserOrganisations, fetching: fetchingUserOrganisations, entities: userOrganisations } = useUserOrganisations();
|
|
80
|
+
|
|
81
|
+
const innerFetch = (search: string | null) => {
|
|
82
|
+
return getManyUserOrganisations({ ...props.userOrganisationFilters, search: search ?? undefined });
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
86
|
+
userOrganisations,
|
|
87
|
+
[() => props.userOrganisationFilters],
|
|
88
|
+
emit,
|
|
89
|
+
innerFetch
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
const isSelected = (id: any) => {
|
|
93
|
+
return props.modelValue?.includes(id);
|
|
94
|
+
}
|
|
95
|
+
const loading = computed((): boolean => {
|
|
96
|
+
return init.value && fetchingUserOrganisations.value;
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
return {
|
|
100
|
+
userOrganisations,
|
|
101
|
+
toggleSet,
|
|
102
|
+
loading,
|
|
103
|
+
search,
|
|
104
|
+
isSelected,
|
|
105
|
+
onUpdate
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
</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": "0.0.
|
|
4
|
+
"version": "0.0.86",
|
|
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": "0.0.
|
|
14
|
-
"@dative-gpi/foundation-core-services": "0.0.
|
|
15
|
-
"@dative-gpi/foundation-shared-components": "0.0.
|
|
16
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
17
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
13
|
+
"@dative-gpi/foundation-core-domain": "0.0.86",
|
|
14
|
+
"@dative-gpi/foundation-core-services": "0.0.86",
|
|
15
|
+
"@dative-gpi/foundation-shared-components": "0.0.86",
|
|
16
|
+
"@dative-gpi/foundation-shared-domain": "0.0.86",
|
|
17
|
+
"@dative-gpi/foundation-shared-services": "0.0.86",
|
|
18
18
|
"color": "^4.2.3",
|
|
19
19
|
"vue": "^3.4.23",
|
|
20
20
|
"vuedraggable": "^4.1.0"
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"sass": "^1.69.5",
|
|
25
25
|
"sass-loader": "^13.3.2"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "ff4a752918cbf77980545c0056db4235bcb23a11"
|
|
28
28
|
}
|