@dative-gpi/foundation-core-components 0.0.84 → 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/components/lists/FSDataTable.vue +37 -31
- 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>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSLoadDataTable
|
|
3
|
-
v-if="
|
|
3
|
+
v-if="gettingUserOrganisationTable"
|
|
4
4
|
/>
|
|
5
5
|
<FSDataTableUI
|
|
6
6
|
v-else
|
|
@@ -18,14 +18,20 @@
|
|
|
18
18
|
@update:page="updatePage"
|
|
19
19
|
v-bind="$attrs"
|
|
20
20
|
>
|
|
21
|
-
<template
|
|
22
|
-
|
|
21
|
+
<template
|
|
22
|
+
v-for="(_, name) in $slots"
|
|
23
|
+
v-slot:[name]="slotData"
|
|
24
|
+
>
|
|
25
|
+
<slot
|
|
26
|
+
:name="name"
|
|
27
|
+
v-bind="slotData"
|
|
28
|
+
/>
|
|
23
29
|
</template>
|
|
24
30
|
</FSDataTableUI>
|
|
25
31
|
</template>
|
|
26
32
|
|
|
27
33
|
<script lang="ts">
|
|
28
|
-
import { defineComponent,
|
|
34
|
+
import { defineComponent, onUnmounted, ref, Ref, watch } from "vue";
|
|
29
35
|
import { useRouter } from "vue-router";
|
|
30
36
|
|
|
31
37
|
import { useUserOrganisationTable, useUpdateUserOrganisationTable } from "@dative-gpi/foundation-core-services/composables";
|
|
@@ -48,8 +54,8 @@ export default defineComponent({
|
|
|
48
54
|
}
|
|
49
55
|
},
|
|
50
56
|
setup(props) {
|
|
51
|
-
const { get, getting, entity } = useUserOrganisationTable();
|
|
52
|
-
const { update } = useUpdateUserOrganisationTable();
|
|
57
|
+
const { get: getUserOrganisationTable, getting: gettingUserOrganisationTable, entity: userOrganisationTable } = useUserOrganisationTable();
|
|
58
|
+
const { update: updateUserOrganisationTable } = useUpdateUserOrganisationTable();
|
|
53
59
|
const { debounce, cancel } = useDebounce();
|
|
54
60
|
const router = useRouter();
|
|
55
61
|
|
|
@@ -63,24 +69,26 @@ export default defineComponent({
|
|
|
63
69
|
const reset = (): void => {
|
|
64
70
|
if (router && router.currentRoute.value.query[props.tableCode]) {
|
|
65
71
|
const query = JSON.parse(router.currentRoute.value.query[props.tableCode] as string);
|
|
66
|
-
innerHeaders.value = query.columns;
|
|
72
|
+
// innerHeaders.value = query.columns;
|
|
73
|
+
// innerFilters.value = query.filters;
|
|
67
74
|
innerRowsPerPage.value = query.rowsPerPage;
|
|
68
75
|
innerSortBy.value = query.sortByKey ? {
|
|
69
76
|
key: query.sortByKey,
|
|
70
77
|
order: query.sortByOrder
|
|
71
78
|
} : null;
|
|
72
79
|
innerMode.value = query.mode;
|
|
73
|
-
innerFilters.value = query.filters;
|
|
74
80
|
innerPage.value = query.page;
|
|
75
81
|
}
|
|
76
|
-
else {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
order: entity.value.sortByOrder
|
|
82
|
+
else if (userOrganisationTable.value) {
|
|
83
|
+
innerRowsPerPage.value = userOrganisationTable.value.rowsPerPage;
|
|
84
|
+
innerSortBy.value = userOrganisationTable.value.sortByKey ? {
|
|
85
|
+
key: userOrganisationTable.value.sortByKey!,
|
|
86
|
+
order: userOrganisationTable.value.sortByOrder!
|
|
82
87
|
} : null;
|
|
83
|
-
innerMode.value =
|
|
88
|
+
innerMode.value = userOrganisationTable.value.mode;
|
|
89
|
+
}
|
|
90
|
+
if (userOrganisationTable.value) {
|
|
91
|
+
innerHeaders.value = userOrganisationTable.value.columns;
|
|
84
92
|
}
|
|
85
93
|
};
|
|
86
94
|
|
|
@@ -116,7 +124,7 @@ export default defineComponent({
|
|
|
116
124
|
|
|
117
125
|
const updateTable = (): void => {
|
|
118
126
|
updateRouter();
|
|
119
|
-
|
|
127
|
+
updateUserOrganisationTable(props.tableCode, {
|
|
120
128
|
columns: innerHeaders.value.map(column => ({
|
|
121
129
|
columnId: column.columnId,
|
|
122
130
|
hidden: column.hidden,
|
|
@@ -135,12 +143,12 @@ export default defineComponent({
|
|
|
135
143
|
query: {
|
|
136
144
|
...router.currentRoute.value.query,
|
|
137
145
|
[props.tableCode]: JSON.stringify({
|
|
138
|
-
columns: innerHeaders.value,
|
|
146
|
+
// columns: innerHeaders.value,
|
|
147
|
+
// filters: innerFilters.value,
|
|
139
148
|
rowsPerPage: innerRowsPerPage.value,
|
|
140
149
|
sortByKey: innerSortBy.value?.key,
|
|
141
150
|
sortByOrder: innerSortBy.value?.order,
|
|
142
151
|
mode: innerMode.value,
|
|
143
|
-
filters: innerFilters.value,
|
|
144
152
|
page: innerPage.value
|
|
145
153
|
})
|
|
146
154
|
}
|
|
@@ -148,36 +156,34 @@ export default defineComponent({
|
|
|
148
156
|
}
|
|
149
157
|
};
|
|
150
158
|
|
|
151
|
-
onMounted(() => {
|
|
152
|
-
get(props.tableCode);
|
|
153
|
-
});
|
|
154
|
-
|
|
155
159
|
onUnmounted(() => {
|
|
156
160
|
cancel();
|
|
157
161
|
updateTable();
|
|
158
162
|
});
|
|
159
163
|
|
|
160
164
|
watch(() => props.tableCode, () => {
|
|
161
|
-
|
|
162
|
-
|
|
165
|
+
if (props.tableCode) {
|
|
166
|
+
getUserOrganisationTable(props.tableCode);
|
|
167
|
+
}
|
|
168
|
+
}, { immediate: true });
|
|
163
169
|
|
|
164
|
-
watch(
|
|
170
|
+
watch(userOrganisationTable, () => {
|
|
165
171
|
reset();
|
|
166
172
|
});
|
|
167
173
|
|
|
168
174
|
return {
|
|
169
|
-
|
|
170
|
-
innerHeaders,
|
|
175
|
+
gettingUserOrganisationTable,
|
|
171
176
|
innerRowsPerPage,
|
|
177
|
+
innerFilters,
|
|
178
|
+
innerHeaders,
|
|
172
179
|
innerSortBy,
|
|
173
180
|
innerMode,
|
|
174
|
-
innerFilters,
|
|
175
181
|
innerPage,
|
|
176
|
-
updateHeaders,
|
|
177
|
-
updateMode,
|
|
178
|
-
updateSortBy,
|
|
179
182
|
updateRowsPerPage,
|
|
180
183
|
updateFilters,
|
|
184
|
+
updateHeaders,
|
|
185
|
+
updateSortBy,
|
|
186
|
+
updateMode,
|
|
181
187
|
updatePage
|
|
182
188
|
};
|
|
183
189
|
},
|
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
|
}
|