@dative-gpi/foundation-shared-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/FSAutocompleteOrganisation.vue +44 -10
- package/components/fields/FSAutocompleteField.vue +32 -72
- package/components/lists/FSDataTableUI.vue +179 -386
- package/composables/useDebounce.ts +15 -15
- package/icons/sets.ts +28 -0
- package/icons/widgetTemplates/AlertsPodiumWidget.vue +18 -0
- package/icons/widgetTemplates/AlertsWidget.vue +54 -0
- package/icons/widgetTemplates/ChartsWidget.vue +18 -0
- package/icons/widgetTemplates/DashboardsWidget.vue +18 -0
- package/icons/widgetTemplates/DevicesWidget.vue +274 -0
- package/icons/widgetTemplates/EditWidget.vue +18 -0
- package/icons/widgetTemplates/GroupsWidget.vue +18 -0
- package/icons/widgetTemplates/LocationsWidget.vue +46 -0
- package/icons/widgetTemplates/MapWidget.vue +18 -0
- package/icons/widgetTemplates/ModelsWidget.vue +26 -0
- package/icons/widgetTemplates/ProfileWidget.vue +30 -0
- package/icons/widgetTemplates/TextWidget.vue +62 -0
- package/package.json +4 -4
- package/utils/icons.ts +139 -3
|
@@ -1,16 +1,22 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSAutocompleteField
|
|
3
|
-
:
|
|
3
|
+
:toggleSet="!$props.toggleSetDisabled && toggleSet"
|
|
4
|
+
:loading="loading"
|
|
4
5
|
:items="organisations"
|
|
6
|
+
:modelValue="$props.modelValue"
|
|
7
|
+
@update:modelValue="onUpdate"
|
|
8
|
+
v-model:search="search"
|
|
5
9
|
v-bind="$attrs" />
|
|
6
10
|
</template>
|
|
7
11
|
<script lang="ts">
|
|
8
|
-
import { PropType, defineComponent, watch } from 'vue'
|
|
12
|
+
import { PropType, computed, defineComponent, watch } from 'vue'
|
|
9
13
|
import _ from 'lodash';
|
|
10
14
|
|
|
11
15
|
import { OrganisationFilters } from '@dative-gpi/foundation-shared-domain/models';
|
|
12
16
|
import { useOrganisations } from '@dative-gpi/foundation-shared-services/composables';
|
|
13
17
|
|
|
18
|
+
import { useAutocomplete } from '../../composables';
|
|
19
|
+
|
|
14
20
|
import FSAutocompleteField from '../fields/FSAutocompleteField.vue'
|
|
15
21
|
|
|
16
22
|
export default defineComponent({
|
|
@@ -23,20 +29,48 @@ export default defineComponent({
|
|
|
23
29
|
type: Object as PropType<OrganisationFilters>,
|
|
24
30
|
required: false,
|
|
25
31
|
default: null
|
|
32
|
+
},
|
|
33
|
+
modelValue: {
|
|
34
|
+
type: [Array, String] as PropType<string[] | string | null>,
|
|
35
|
+
required: false,
|
|
36
|
+
default: null
|
|
37
|
+
},
|
|
38
|
+
toggleSetDisabled: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false,
|
|
41
|
+
default: false
|
|
26
42
|
}
|
|
27
43
|
},
|
|
28
|
-
|
|
29
|
-
|
|
44
|
+
emit: ['update:modelValue'],
|
|
45
|
+
setup(props, { emit }) {
|
|
46
|
+
const { entities: organisations, fetching: fetchingOrganisations, getMany: getManyOrganisations } = useOrganisations();
|
|
47
|
+
|
|
48
|
+
const innerFetch = (search: string | null) => {
|
|
49
|
+
return getManyOrganisations({ ...props.organisationFilters, search: search ?? undefined });
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const { toggleSet, search, init, onUpdate } = useAutocomplete(
|
|
53
|
+
organisations,
|
|
54
|
+
[() => props.organisationFilters],
|
|
55
|
+
emit,
|
|
56
|
+
innerFetch
|
|
57
|
+
);
|
|
58
|
+
|
|
59
|
+
const isSelected = (id: any) => {
|
|
60
|
+
return props.modelValue?.includes(id);
|
|
61
|
+
}
|
|
30
62
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
}, { immediate: true });
|
|
63
|
+
const loading = computed((): boolean => {
|
|
64
|
+
return init.value && fetchingOrganisations.value;
|
|
65
|
+
});
|
|
36
66
|
|
|
37
67
|
return {
|
|
38
68
|
organisations,
|
|
39
|
-
|
|
69
|
+
toggleSet,
|
|
70
|
+
loading,
|
|
71
|
+
search,
|
|
72
|
+
isSelected,
|
|
73
|
+
onUpdate
|
|
40
74
|
}
|
|
41
75
|
}
|
|
42
76
|
})
|
|
@@ -1,63 +1,44 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSCol>
|
|
3
|
-
<slot
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
<FSRow
|
|
8
|
-
:wrap="false"
|
|
9
|
-
>
|
|
10
|
-
<FSSpan
|
|
11
|
-
v-if="$props.label"
|
|
3
|
+
<slot v-if="!$props.hideHeader"
|
|
4
|
+
name="label">
|
|
5
|
+
<FSRow :wrap="false">
|
|
6
|
+
<FSSpan v-if="$props.label"
|
|
12
7
|
class="fs-autocomplete-field-label"
|
|
13
8
|
font="text-overline"
|
|
14
|
-
:style="style"
|
|
15
|
-
>
|
|
9
|
+
:style="style">
|
|
16
10
|
{{ $props.label }}
|
|
17
11
|
</FSSpan>
|
|
18
|
-
<FSSpan
|
|
19
|
-
v-if="$props.label && $props.required"
|
|
12
|
+
<FSSpan v-if="$props.label && $props.required"
|
|
20
13
|
class="fs-autocomplete-field-label"
|
|
21
14
|
style="margin-left: -8px;"
|
|
22
15
|
font="text-overline"
|
|
23
16
|
:ellipsis="false"
|
|
24
|
-
:style="style"
|
|
25
|
-
>
|
|
17
|
+
:style="style">
|
|
26
18
|
*
|
|
27
19
|
</FSSpan>
|
|
28
|
-
<v-spacer
|
|
29
|
-
|
|
30
|
-
/>
|
|
31
|
-
<FSSpan
|
|
32
|
-
v-if="messages.length > 0"
|
|
20
|
+
<v-spacer style="min-width: 40px;" />
|
|
21
|
+
<FSSpan v-if="messages.length > 0"
|
|
33
22
|
class="fs-autocomplete-field-messages"
|
|
34
23
|
font="text-overline"
|
|
35
|
-
:style="style"
|
|
36
|
-
>
|
|
24
|
+
:style="style">
|
|
37
25
|
{{ messages.join(", ") }}
|
|
38
26
|
</FSSpan>
|
|
39
27
|
</FSRow>
|
|
40
28
|
</slot>
|
|
41
|
-
<FSLoader
|
|
42
|
-
v-if="$props.loading"
|
|
29
|
+
<FSLoader v-if="$props.loading"
|
|
43
30
|
width="100%"
|
|
44
|
-
:height="['40px', '36px']"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
v-else
|
|
48
|
-
>
|
|
49
|
-
<FSToggleSet
|
|
50
|
-
v-if="$props.toggleSet"
|
|
31
|
+
:height="['40px', '36px']" />
|
|
32
|
+
<template v-else>
|
|
33
|
+
<FSToggleSet v-if="$props.toggleSet"
|
|
51
34
|
variant="slide"
|
|
52
35
|
:multiple="$props.multiple"
|
|
53
36
|
:values="$props.items"
|
|
54
37
|
:rules="$props.rules"
|
|
55
38
|
:modelValue="$props.modelValue"
|
|
56
39
|
@update:modelValue="onUpdate"
|
|
57
|
-
v-bind="$attrs"
|
|
58
|
-
|
|
59
|
-
<v-autocomplete
|
|
60
|
-
v-else
|
|
40
|
+
v-bind="$attrs" />
|
|
41
|
+
<v-autocomplete v-else
|
|
61
42
|
class="fs-autocomplete-field"
|
|
62
43
|
variant="outlined"
|
|
63
44
|
:menuIcon="null"
|
|
@@ -80,57 +61,36 @@
|
|
|
80
61
|
@update:modelValue="onUpdate"
|
|
81
62
|
@blur="blurred = true"
|
|
82
63
|
v-model:search="innerSearch"
|
|
83
|
-
v-bind="$attrs"
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
>
|
|
89
|
-
<slot
|
|
90
|
-
:name="name"
|
|
91
|
-
v-bind="slotData"
|
|
92
|
-
/>
|
|
64
|
+
v-bind="$attrs">
|
|
65
|
+
<template v-for="(_, name) in slots"
|
|
66
|
+
v-slot:[name]="slotData">
|
|
67
|
+
<slot :name="name"
|
|
68
|
+
v-bind="slotData" />
|
|
93
69
|
</template>
|
|
94
|
-
<template
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
<slot
|
|
98
|
-
name="clear"
|
|
99
|
-
>
|
|
100
|
-
<FSButton
|
|
101
|
-
v-if="$props.editable && $props.modelValue"
|
|
70
|
+
<template #clear>
|
|
71
|
+
<slot name="clear">
|
|
72
|
+
<FSButton v-if="$props.editable && $props.modelValue"
|
|
102
73
|
icon="mdi-close"
|
|
103
74
|
variant="icon"
|
|
104
75
|
:color="ColorEnum.Dark"
|
|
105
|
-
@click="$emit('update:modelValue', null)"
|
|
106
|
-
/>
|
|
76
|
+
@click="$emit('update:modelValue', null)" />
|
|
107
77
|
</slot>
|
|
108
78
|
</template>
|
|
109
|
-
<template
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
<slot
|
|
113
|
-
name="append-inner"
|
|
114
|
-
>
|
|
115
|
-
<FSButton
|
|
116
|
-
icon="mdi-chevron-down"
|
|
79
|
+
<template #append-inner>
|
|
80
|
+
<slot name="append-inner">
|
|
81
|
+
<FSButton icon="mdi-chevron-down"
|
|
117
82
|
variant="icon"
|
|
118
83
|
:editable="$props.editable"
|
|
119
|
-
:color="ColorEnum.Dark"
|
|
120
|
-
/>
|
|
84
|
+
:color="ColorEnum.Dark" />
|
|
121
85
|
</slot>
|
|
122
86
|
</template>
|
|
123
87
|
</v-autocomplete>
|
|
124
88
|
</template>
|
|
125
|
-
<slot
|
|
126
|
-
|
|
127
|
-
>
|
|
128
|
-
<FSSpan
|
|
129
|
-
v-if="$props.description"
|
|
89
|
+
<slot name="description">
|
|
90
|
+
<FSSpan v-if="$props.description"
|
|
130
91
|
class="fs-autocomplete-field-description"
|
|
131
92
|
font="text-underline"
|
|
132
|
-
:style="style"
|
|
133
|
-
>
|
|
93
|
+
:style="style">
|
|
134
94
|
{{ $props.description }}
|
|
135
95
|
</FSSpan>
|
|
136
96
|
</slot>
|