@dative-gpi/foundation-shared-components 0.0.88 → 0.0.89
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/FSButton.vue +23 -7
- package/components/FSCalendar.vue +3 -1
- package/components/FSCalendarTwin.vue +16 -6
- package/components/FSCard.vue +9 -3
- package/components/FSCheckbox.vue +6 -2
- package/components/FSClickable.vue +33 -9
- package/components/FSDialog.vue +9 -5
- package/components/FSDialogMenu.vue +80 -0
- package/components/FSDialogSubmit.vue +0 -1
- package/components/FSEditImage.vue +196 -34
- package/components/FSImage.vue +21 -7
- package/components/FSLink.vue +4 -2
- package/components/FSOptionGroup.vue +51 -69
- package/components/FSOptionItem.vue +15 -6
- package/components/FSRadioGroup.vue +11 -3
- package/components/FSToggleSet.vue +22 -60
- package/components/FSWindow.vue +2 -0
- package/components/autocompletes/FSAutocompleteLanguage.vue +28 -22
- package/components/autocompletes/FSAutocompleteTimeZone.vue +117 -17
- package/components/buttons/FSButtonFileMini.vue +6 -1
- package/components/fields/FSAutocompleteField.vue +139 -72
- package/components/fields/FSBaseField.vue +134 -0
- package/components/fields/FSColorField.vue +1 -1
- package/components/fields/FSDateField.vue +124 -35
- package/components/fields/FSDateTimeField.vue +171 -63
- package/components/fields/FSIconField.vue +4 -2
- package/components/fields/FSNumberField.vue +9 -3
- package/components/fields/FSPasswordField.vue +15 -5
- package/components/fields/FSRichTextField.vue +34 -18
- package/components/fields/FSSearchField.vue +24 -8
- package/components/fields/FSSelectField.vue +254 -93
- package/components/fields/FSTagField.vue +15 -9
- package/components/fields/FSTextArea.vue +31 -59
- package/components/fields/FSTextField.vue +22 -70
- package/components/fields/FSTimeField.vue +20 -55
- package/components/fields/FSTimeSlotField.vue +13 -59
- package/components/lists/FSDataIteratorItem.vue +16 -4
- package/components/lists/FSDataTableUI.vue +420 -184
- package/components/lists/FSDraggable.vue +26 -13
- package/components/lists/FSFilterButton.vue +10 -4
- package/components/lists/FSHeaderButton.vue +3 -1
- package/components/lists/FSHiddenButton.vue +3 -1
- package/composables/useAutocomplete.ts +6 -7
- package/composables/useSlots.ts +6 -18
- package/package.json +4 -4
- package/styles/components/fs_base_field.scss +12 -0
- package/styles/components/fs_dialog.scss +10 -2
- package/styles/components/fs_dialog_menu.scss +11 -0
- package/styles/components/fs_draggable.scss +12 -0
- package/styles/components/fs_edit_image.scss +29 -2
- package/styles/components/fs_text_area.scss +0 -13
- package/styles/components/fs_text_field.scss +1 -14
- package/styles/components/index.scss +2 -0
- package/styles/globals/overrides.scss +4 -0
- package/components/autocompletes/FSAutocompleteOrganisation.vue +0 -77
package/components/FSImage.vue
CHANGED
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
:height="computedHeight"
|
|
6
6
|
:width="computedWidth"
|
|
7
7
|
:cover="$props.cover"
|
|
8
|
+
:src="realSource"
|
|
8
9
|
:style="style"
|
|
9
|
-
:src="source"
|
|
10
10
|
@error="onError"
|
|
11
11
|
v-bind="$attrs"
|
|
12
12
|
>
|
|
13
|
-
<template
|
|
13
|
+
<template
|
|
14
|
+
#placeholder
|
|
15
|
+
>
|
|
14
16
|
<FSLoader
|
|
15
17
|
v-if="$props.imageId"
|
|
16
18
|
class="fs-image-load"
|
|
@@ -19,7 +21,9 @@
|
|
|
19
21
|
:borderRadius="$props.borderRadius"
|
|
20
22
|
/>
|
|
21
23
|
</template>
|
|
22
|
-
<template
|
|
24
|
+
<template
|
|
25
|
+
#error
|
|
26
|
+
>
|
|
23
27
|
<FSLoader
|
|
24
28
|
v-if="!blurHash"
|
|
25
29
|
class="fs-image-load"
|
|
@@ -70,6 +74,11 @@ export default defineComponent({
|
|
|
70
74
|
required: false,
|
|
71
75
|
default: null
|
|
72
76
|
},
|
|
77
|
+
source: {
|
|
78
|
+
type: String as PropType<string | null>,
|
|
79
|
+
required: false,
|
|
80
|
+
default: null
|
|
81
|
+
},
|
|
73
82
|
aspectRatio: {
|
|
74
83
|
type: String as PropType<string | null>,
|
|
75
84
|
required: false,
|
|
@@ -146,7 +155,7 @@ export default defineComponent({
|
|
|
146
155
|
return undefined;
|
|
147
156
|
});
|
|
148
157
|
|
|
149
|
-
const
|
|
158
|
+
const realSource = computed((): string | null => {
|
|
150
159
|
if (props.imageB64) {
|
|
151
160
|
if (imageType.value && imageData.value) {
|
|
152
161
|
return `${imageType.value},${imageData.value}`;
|
|
@@ -158,6 +167,7 @@ export default defineComponent({
|
|
|
158
167
|
}
|
|
159
168
|
return IMAGE_RAW_URL(props.imageId);
|
|
160
169
|
}
|
|
170
|
+
return props.source;
|
|
161
171
|
});
|
|
162
172
|
|
|
163
173
|
const imageData = computed((): string | null => {
|
|
@@ -192,8 +202,12 @@ export default defineComponent({
|
|
|
192
202
|
if (blurHash.value && isBlurhashValid(blurHash.value.blurHash).result) {
|
|
193
203
|
const ctx = canvasRef.value.getContext("2d");
|
|
194
204
|
if (ctx) {
|
|
195
|
-
const
|
|
196
|
-
const
|
|
205
|
+
const width = (imageRef.value as any).$el.clientWidth;
|
|
206
|
+
const height = (imageRef.value as any).$el.clientHeight;
|
|
207
|
+
const pixels = decode(blurHash.value.blurHash, width, height);
|
|
208
|
+
const imageData = ctx.createImageData(width, height);
|
|
209
|
+
canvasRef.value.width = width;
|
|
210
|
+
canvasRef.value.height = height;
|
|
197
211
|
imageData.data.set(pixels);
|
|
198
212
|
ctx.putImageData(imageData, 0, 0);
|
|
199
213
|
}
|
|
@@ -204,10 +218,10 @@ export default defineComponent({
|
|
|
204
218
|
return {
|
|
205
219
|
computedHeight,
|
|
206
220
|
computedWidth,
|
|
221
|
+
realSource,
|
|
207
222
|
canvasRef,
|
|
208
223
|
imageRef,
|
|
209
224
|
blurHash,
|
|
210
|
-
source,
|
|
211
225
|
style,
|
|
212
226
|
onError
|
|
213
227
|
};
|
package/components/FSLink.vue
CHANGED
|
@@ -6,8 +6,12 @@
|
|
|
6
6
|
:gap="$props.gap"
|
|
7
7
|
:style="style"
|
|
8
8
|
>
|
|
9
|
-
<template
|
|
10
|
-
|
|
9
|
+
<template
|
|
10
|
+
v-if="$props.values.length"
|
|
11
|
+
>
|
|
12
|
+
<template
|
|
13
|
+
v-if="!$slots.item"
|
|
14
|
+
>
|
|
11
15
|
<FSOptionItem
|
|
12
16
|
v-for="(item, index) in $props.values"
|
|
13
17
|
:prependIcon="item.prependIcon"
|
|
@@ -22,24 +26,23 @@
|
|
|
22
26
|
@click="toggle(item)"
|
|
23
27
|
/>
|
|
24
28
|
</template>
|
|
25
|
-
<template
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
:icon="getFromFirstChild('icon', item)"
|
|
37
|
-
:editable="$props.editable"
|
|
38
|
-
@click="toggle(item)"
|
|
39
|
-
/>
|
|
29
|
+
<template
|
|
30
|
+
v-else
|
|
31
|
+
>
|
|
32
|
+
<template
|
|
33
|
+
v-for="item in $props.values"
|
|
34
|
+
>
|
|
35
|
+
<slot
|
|
36
|
+
name="item"
|
|
37
|
+
v-bind="{ item, toggle, getVariant, getColor, getClass }"
|
|
38
|
+
/>
|
|
39
|
+
</template>
|
|
40
40
|
</template>
|
|
41
41
|
</template>
|
|
42
|
-
<slot
|
|
42
|
+
<slot
|
|
43
|
+
v-else
|
|
44
|
+
v-bind="{ toggle, getVariant, getColor, getClass }"
|
|
45
|
+
/>
|
|
43
46
|
</FSWrapGroup>
|
|
44
47
|
<FSSlideGroup
|
|
45
48
|
v-else
|
|
@@ -48,8 +51,12 @@
|
|
|
48
51
|
:gap="$props.gap"
|
|
49
52
|
:style="style"
|
|
50
53
|
>
|
|
51
|
-
<template
|
|
52
|
-
|
|
54
|
+
<template
|
|
55
|
+
v-if="$props.values.length"
|
|
56
|
+
>
|
|
57
|
+
<template
|
|
58
|
+
v-if="!$slots.item"
|
|
59
|
+
>
|
|
53
60
|
<FSOptionItem
|
|
54
61
|
v-for="(item, index) in $props.values"
|
|
55
62
|
:prependIcon="item.prependIcon"
|
|
@@ -64,32 +71,31 @@
|
|
|
64
71
|
@click="toggle(item)"
|
|
65
72
|
/>
|
|
66
73
|
</template>
|
|
67
|
-
<template
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
:icon="getFromFirstChild('icon', item)"
|
|
79
|
-
:editable="$props.editable"
|
|
80
|
-
@click="toggle(item)"
|
|
81
|
-
/>
|
|
74
|
+
<template
|
|
75
|
+
v-else
|
|
76
|
+
>
|
|
77
|
+
<template
|
|
78
|
+
v-for="item in $props.values"
|
|
79
|
+
>
|
|
80
|
+
<slot
|
|
81
|
+
name="item"
|
|
82
|
+
v-bind="{ item, toggle, getVariant, getColor, getClass }"
|
|
83
|
+
/>
|
|
84
|
+
</template>
|
|
82
85
|
</template>
|
|
83
86
|
</template>
|
|
84
|
-
<slot
|
|
87
|
+
<slot
|
|
88
|
+
v-else
|
|
89
|
+
v-bind="{ toggle, getVariant, getColor, getClass }"
|
|
90
|
+
/>
|
|
85
91
|
</FSSlideGroup>
|
|
86
92
|
</template>
|
|
87
93
|
|
|
88
94
|
<script lang="ts">
|
|
89
95
|
import { computed, defineComponent, PropType } from "vue";
|
|
90
96
|
|
|
91
|
-
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
92
97
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
98
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
93
99
|
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
94
100
|
import { FSToggle } from "@dative-gpi/foundation-shared-components/models";
|
|
95
101
|
|
|
@@ -126,12 +132,12 @@ export default defineComponent({
|
|
|
126
132
|
default: "wrap"
|
|
127
133
|
},
|
|
128
134
|
optionVariant: {
|
|
129
|
-
type: String as PropType<"standard" | "full">,
|
|
135
|
+
type: String as PropType<"standard" | "background" | "full">,
|
|
130
136
|
required: false,
|
|
131
|
-
default: "
|
|
137
|
+
default: "standard"
|
|
132
138
|
},
|
|
133
139
|
activeVariant: {
|
|
134
|
-
type: String as PropType<"standard" | "full">,
|
|
140
|
+
type: String as PropType<"standard" | "background" | "full">,
|
|
135
141
|
required: false,
|
|
136
142
|
default: "full"
|
|
137
143
|
},
|
|
@@ -193,43 +199,21 @@ export default defineComponent({
|
|
|
193
199
|
},
|
|
194
200
|
emits: ["update:modelValue"],
|
|
195
201
|
setup(props, { emit }) {
|
|
196
|
-
const { getFirstChild } = useSlots();
|
|
197
202
|
const { getColors } = useColors();
|
|
198
203
|
|
|
199
204
|
const lights = getColors(ColorEnum.Light);
|
|
200
205
|
|
|
201
206
|
const colors = getColors(props.optionColor);
|
|
202
207
|
|
|
203
|
-
const firstChild = getFirstChild("item");
|
|
204
|
-
|
|
205
208
|
const style = computed((): { [key: string] : string | undefined } => {
|
|
206
209
|
return {
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
+
"--fs-option-group-border-size" : props.border ? "1px" : "0",
|
|
211
|
+
"--fs-option-group-border-radius": sizeToVar(props.borderRadius),
|
|
212
|
+
"--fs-option-group-border-color" : lights.base
|
|
210
213
|
};
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
const getFromFirstChild = (prop: string, value: FSToggle): any => {
|
|
214
|
-
switch (prop) {
|
|
215
|
-
case "prependIcon":
|
|
216
|
-
return firstChild.props.prependIcon ?? value.prependIcon;
|
|
217
|
-
case "label":
|
|
218
|
-
return firstChild.props.label ?? value.label;
|
|
219
|
-
case "appendIcon":
|
|
220
|
-
return firstChild.props.appendIcon ?? value.appendIcon;
|
|
221
|
-
case "icon":
|
|
222
|
-
return firstChild.props.icon ?? value.icon;
|
|
223
|
-
case "variant":
|
|
224
|
-
return firstChild.props.variant ?? getVariant(value);
|
|
225
|
-
case "color":
|
|
226
|
-
return firstChild.props.color ?? getColor(value);
|
|
227
|
-
default:
|
|
228
|
-
return firstChild.props[prop];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
214
|
+
});
|
|
231
215
|
|
|
232
|
-
const getVariant = (value: FSToggle): "standard" | "full" => {
|
|
216
|
+
const getVariant = (value: FSToggle): "standard" | "background" | "full" => {
|
|
233
217
|
if (Array.isArray(props.modelValue) && props.modelValue.some(v => v === value.id)) {
|
|
234
218
|
return props.activeVariant;
|
|
235
219
|
}
|
|
@@ -305,9 +289,7 @@ export default defineComponent({
|
|
|
305
289
|
};
|
|
306
290
|
|
|
307
291
|
return {
|
|
308
|
-
firstChild,
|
|
309
292
|
style,
|
|
310
|
-
getFromFirstChild,
|
|
311
293
|
getVariant,
|
|
312
294
|
getColor,
|
|
313
295
|
getClass,
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
:variant="$props.variant"
|
|
7
7
|
:color="$props.color"
|
|
8
8
|
:load="$props.load"
|
|
9
|
+
:border="false"
|
|
9
10
|
:width="width"
|
|
10
11
|
@click.stop="onClick"
|
|
11
12
|
v-bind="$attrs"
|
|
@@ -15,7 +16,10 @@
|
|
|
15
16
|
width="fill"
|
|
16
17
|
:wrap="false"
|
|
17
18
|
>
|
|
18
|
-
<slot
|
|
19
|
+
<slot
|
|
20
|
+
name="prepend"
|
|
21
|
+
v-bind="{ color: $props.color, colors }"
|
|
22
|
+
>
|
|
19
23
|
<FSIcon
|
|
20
24
|
v-if="$props.prependIcon || $props.icon"
|
|
21
25
|
size="l"
|
|
@@ -23,14 +27,19 @@
|
|
|
23
27
|
{{ $props.prependIcon ?? $props.icon }}
|
|
24
28
|
</FSIcon>
|
|
25
29
|
</slot>
|
|
26
|
-
<slot
|
|
30
|
+
<slot
|
|
31
|
+
v-bind="{ color: $props.color, colors }"
|
|
32
|
+
>
|
|
27
33
|
<FSSpan
|
|
28
34
|
v-if="$props.label"
|
|
29
35
|
>
|
|
30
36
|
{{ $props.label }}
|
|
31
37
|
</FSSpan>
|
|
32
38
|
</slot>
|
|
33
|
-
<slot
|
|
39
|
+
<slot
|
|
40
|
+
name="append"
|
|
41
|
+
v-bind="{ color: $props.color, colors }"
|
|
42
|
+
>
|
|
34
43
|
<FSIcon
|
|
35
44
|
v-if="$props.appendIcon"
|
|
36
45
|
size="l"
|
|
@@ -84,14 +93,14 @@ export default defineComponent({
|
|
|
84
93
|
default: null
|
|
85
94
|
},
|
|
86
95
|
variant: {
|
|
87
|
-
type: String as PropType<"standard" | "full">,
|
|
96
|
+
type: String as PropType<"standard" | "background" | "full">,
|
|
88
97
|
required: false,
|
|
89
|
-
default: "
|
|
98
|
+
default: "standard"
|
|
90
99
|
},
|
|
91
100
|
ItemWidth: {
|
|
92
101
|
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
93
102
|
required: false,
|
|
94
|
-
default: ["32px","28px"]
|
|
103
|
+
default: () => ["32px","28px"]
|
|
95
104
|
},
|
|
96
105
|
color: {
|
|
97
106
|
type: String as PropType<ColorBase>,
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<FSCol
|
|
2
|
+
<FSCol
|
|
3
|
+
width="hug"
|
|
4
|
+
:gap="$props.gap"
|
|
5
|
+
>
|
|
3
6
|
<FSRadio
|
|
4
7
|
v-for="(item, index) in $props.values"
|
|
5
8
|
:key="index"
|
|
@@ -29,10 +32,15 @@ export default defineComponent({
|
|
|
29
32
|
FSCol
|
|
30
33
|
},
|
|
31
34
|
props: {
|
|
35
|
+
gap: {
|
|
36
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
37
|
+
required: false,
|
|
38
|
+
default: "8px"
|
|
39
|
+
},
|
|
32
40
|
values: {
|
|
33
41
|
type: Array as PropType<{ value: string | boolean | number, label?: string, description?: string }[]>,
|
|
34
42
|
required: true,
|
|
35
|
-
default:
|
|
43
|
+
default: null
|
|
36
44
|
},
|
|
37
45
|
modelValue: {
|
|
38
46
|
type: [String, Boolean, Number],
|
|
@@ -48,7 +56,7 @@ export default defineComponent({
|
|
|
48
56
|
type: Boolean,
|
|
49
57
|
required: false,
|
|
50
58
|
default: true
|
|
51
|
-
}
|
|
59
|
+
},
|
|
52
60
|
},
|
|
53
61
|
emits: ["update:modelValue"],
|
|
54
62
|
setup(props, { emit }) {
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
v-if="$props.values.length"
|
|
16
16
|
>
|
|
17
17
|
<template
|
|
18
|
-
v-if="
|
|
18
|
+
v-if="!$slots.item"
|
|
19
19
|
>
|
|
20
20
|
<FSButton
|
|
21
21
|
v-for="(item, index) in $props.values"
|
|
@@ -34,24 +34,18 @@
|
|
|
34
34
|
<template
|
|
35
35
|
v-else
|
|
36
36
|
>
|
|
37
|
-
<
|
|
38
|
-
v-for="
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
:class="getFromFirstChild('class', item)"
|
|
46
|
-
:label="getFromFirstChild('label', item)"
|
|
47
|
-
:icon="getFromFirstChild('icon', item)"
|
|
48
|
-
:editable="$props.editable"
|
|
49
|
-
@click="toggle(item)"
|
|
50
|
-
/>
|
|
37
|
+
<template
|
|
38
|
+
v-for="item in $props.values"
|
|
39
|
+
>
|
|
40
|
+
<slot
|
|
41
|
+
name="item"
|
|
42
|
+
v-bind="{ item, toggle, getVariant, getColor, getClass }"
|
|
43
|
+
/>
|
|
44
|
+
</template>
|
|
51
45
|
</template>
|
|
52
46
|
</template>
|
|
53
47
|
<slot
|
|
54
|
-
v-
|
|
48
|
+
v-bind="{ toggle, getVariant, getColor, getClass }"
|
|
55
49
|
/>
|
|
56
50
|
</FSWrapGroup>
|
|
57
51
|
<FSSlideGroup
|
|
@@ -64,7 +58,7 @@
|
|
|
64
58
|
v-if="$props.values.length"
|
|
65
59
|
>
|
|
66
60
|
<template
|
|
67
|
-
v-if="
|
|
61
|
+
v-if="!$slots.item"
|
|
68
62
|
>
|
|
69
63
|
<FSButton
|
|
70
64
|
v-for="(item, index) in $props.values"
|
|
@@ -83,24 +77,18 @@
|
|
|
83
77
|
<template
|
|
84
78
|
v-else
|
|
85
79
|
>
|
|
86
|
-
<
|
|
87
|
-
v-for="
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
:class="getFromFirstChild('class', item)"
|
|
95
|
-
:label="getFromFirstChild('label', item)"
|
|
96
|
-
:icon="getFromFirstChild('icon', item)"
|
|
97
|
-
:editable="$props.editable"
|
|
98
|
-
@click="toggle(item)"
|
|
99
|
-
/>
|
|
80
|
+
<template
|
|
81
|
+
v-for="item in $props.values"
|
|
82
|
+
>
|
|
83
|
+
<slot
|
|
84
|
+
name="item"
|
|
85
|
+
v-bind="{ item, toggle, getVariant, getColor, getClass }"
|
|
86
|
+
/>
|
|
87
|
+
</template>
|
|
100
88
|
</template>
|
|
101
89
|
</template>
|
|
102
90
|
<slot
|
|
103
|
-
v-
|
|
91
|
+
v-bind="{ toggle, getVariant, getColor, getClass }"
|
|
104
92
|
/>
|
|
105
93
|
</FSSlideGroup>
|
|
106
94
|
</v-input>
|
|
@@ -110,7 +98,6 @@
|
|
|
110
98
|
import { defineComponent, PropType, ref } from "vue";
|
|
111
99
|
|
|
112
100
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
113
|
-
import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
114
101
|
import { FSToggle } from "@dative-gpi/foundation-shared-components/models";
|
|
115
102
|
|
|
116
103
|
import FSSlideGroup from "./FSSlideGroup.vue";
|
|
@@ -203,31 +190,8 @@ export default defineComponent({
|
|
|
203
190
|
},
|
|
204
191
|
emits: ["update:modelValue"],
|
|
205
192
|
setup(props, { emit }) {
|
|
206
|
-
const { getFirstChild } = useSlots();
|
|
207
|
-
|
|
208
|
-
const firstChild = getFirstChild("item");
|
|
209
|
-
|
|
210
|
-
const inputRef = ref(null);
|
|
211
193
|
const toggleSetRef = ref(null);
|
|
212
|
-
|
|
213
|
-
const getFromFirstChild = (prop: string, value: FSToggle): any => {
|
|
214
|
-
switch (prop) {
|
|
215
|
-
case "prependIcon":
|
|
216
|
-
return firstChild.props.prependIcon ?? value.prependIcon;
|
|
217
|
-
case "label":
|
|
218
|
-
return firstChild.props.label ?? value.label;
|
|
219
|
-
case "appendIcon":
|
|
220
|
-
return firstChild.props.appendIcon ?? value.appendIcon;
|
|
221
|
-
case "icon":
|
|
222
|
-
return firstChild.props.icon ?? value.icon;
|
|
223
|
-
case "variant":
|
|
224
|
-
return firstChild.props.variant ?? getVariant(value);
|
|
225
|
-
case "color":
|
|
226
|
-
return firstChild.props.color ?? getColor(value);
|
|
227
|
-
default:
|
|
228
|
-
return firstChild.props[prop];
|
|
229
|
-
}
|
|
230
|
-
}
|
|
194
|
+
const inputRef = ref(null);
|
|
231
195
|
|
|
232
196
|
const getVariant = (value: FSToggle): "standard" | "full" | "icon" => {
|
|
233
197
|
if (Array.isArray(props.modelValue) && props.modelValue.some(v => v === value.id)) {
|
|
@@ -329,10 +293,8 @@ export default defineComponent({
|
|
|
329
293
|
};
|
|
330
294
|
|
|
331
295
|
return {
|
|
332
|
-
inputRef,
|
|
333
296
|
toggleSetRef,
|
|
334
|
-
|
|
335
|
-
getFromFirstChild,
|
|
297
|
+
inputRef,
|
|
336
298
|
getVariant,
|
|
337
299
|
goToStart,
|
|
338
300
|
getColor,
|
package/components/FSWindow.vue
CHANGED
|
@@ -6,16 +6,19 @@
|
|
|
6
6
|
:items="languages"
|
|
7
7
|
:modelValue="$props.modelValue"
|
|
8
8
|
@update:modelValue="onUpdate"
|
|
9
|
-
v-model:search="search"
|
|
10
9
|
v-bind="$attrs"
|
|
11
10
|
>
|
|
12
11
|
<template
|
|
13
|
-
#selection="{ item }"
|
|
12
|
+
#autocomplete-selection="{ item }"
|
|
14
13
|
>
|
|
15
14
|
<FSRow
|
|
15
|
+
v-if="$props.modelValue"
|
|
16
16
|
align="center-center"
|
|
17
|
+
:wrap="false"
|
|
17
18
|
>
|
|
18
|
-
<FSIcon
|
|
19
|
+
<FSIcon
|
|
20
|
+
v-if="item.raw.icon"
|
|
21
|
+
>
|
|
19
22
|
{{ item.raw.icon }}
|
|
20
23
|
</FSIcon>
|
|
21
24
|
<FSSpan>
|
|
@@ -24,7 +27,7 @@
|
|
|
24
27
|
</FSRow>
|
|
25
28
|
</template>
|
|
26
29
|
<template
|
|
27
|
-
#item="{ props, item }"
|
|
30
|
+
#autocomplete-item="{ props, item }"
|
|
28
31
|
>
|
|
29
32
|
<v-list-item
|
|
30
33
|
v-bind="{ ...props, title: '' }"
|
|
@@ -34,9 +37,12 @@
|
|
|
34
37
|
>
|
|
35
38
|
<FSCheckbox
|
|
36
39
|
v-if="$props.multiple"
|
|
37
|
-
:modelValue="
|
|
40
|
+
:modelValue="$props.modelValue?.includes(item.value)"
|
|
41
|
+
@click="props.onClick"
|
|
38
42
|
/>
|
|
39
|
-
<FSIcon
|
|
43
|
+
<FSIcon
|
|
44
|
+
v-if="item.raw.icon"
|
|
45
|
+
>
|
|
40
46
|
{{ item.raw.icon }}
|
|
41
47
|
</FSIcon>
|
|
42
48
|
<FSSpan>
|
|
@@ -49,20 +55,26 @@
|
|
|
49
55
|
</template>
|
|
50
56
|
|
|
51
57
|
<script lang="ts">
|
|
52
|
-
import { computed,
|
|
58
|
+
import { computed, defineComponent, PropType } from "vue"
|
|
53
59
|
|
|
54
60
|
import { useAutocomplete } from "@dative-gpi/foundation-shared-components/composables";
|
|
55
61
|
import { useLanguages } from "@dative-gpi/foundation-shared-services/composables";
|
|
56
62
|
import { LanguageFilters } from "@dative-gpi/foundation-shared-domain/models";
|
|
57
63
|
|
|
58
|
-
import
|
|
59
|
-
import
|
|
64
|
+
import FSAutocompleteField from "../fields/FSAutocompleteField.vue";
|
|
65
|
+
import FSCheckbox from "../FSCheckbox.vue";
|
|
66
|
+
import FSIcon from "../FSIcon.vue";
|
|
67
|
+
import FSSpan from "../FSSpan.vue";
|
|
68
|
+
import FSRow from "../FSRow.vue";
|
|
60
69
|
|
|
61
70
|
export default defineComponent({
|
|
62
71
|
name: "FSAutocompleteLanguage",
|
|
63
72
|
components: {
|
|
64
73
|
FSAutocompleteField,
|
|
65
|
-
FSCheckbox
|
|
74
|
+
FSCheckbox,
|
|
75
|
+
FSIcon,
|
|
76
|
+
FSSpan,
|
|
77
|
+
FSRow
|
|
66
78
|
},
|
|
67
79
|
props: {
|
|
68
80
|
languageFilters: {
|
|
@@ -90,33 +102,27 @@ export default defineComponent({
|
|
|
90
102
|
setup(props, { emit }) {
|
|
91
103
|
const { getMany: getManyLanguages, fetching: fetchingLanguages, entities: languages } = useLanguages();
|
|
92
104
|
|
|
105
|
+
const loading = computed((): boolean => {
|
|
106
|
+
return init.value && fetchingLanguages.value;
|
|
107
|
+
});
|
|
108
|
+
|
|
93
109
|
const innerFetch = (search: string | null) => {
|
|
94
110
|
return getManyLanguages({ ...props.languageFilters, search: search ?? undefined });
|
|
95
111
|
};
|
|
96
112
|
|
|
97
|
-
const { toggleSet,
|
|
113
|
+
const { toggleSet, init, onUpdate } = useAutocomplete(
|
|
98
114
|
languages,
|
|
99
115
|
[() => props.languageFilters],
|
|
100
116
|
emit,
|
|
101
117
|
innerFetch
|
|
102
118
|
);
|
|
103
119
|
|
|
104
|
-
const isSelected = (id: any) => {
|
|
105
|
-
return props.modelValue?.includes(id);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const loading = computed((): boolean => {
|
|
109
|
-
return init.value && fetchingLanguages.value;
|
|
110
|
-
});
|
|
111
|
-
|
|
112
120
|
return {
|
|
113
121
|
languages,
|
|
114
122
|
toggleSet,
|
|
115
123
|
loading,
|
|
116
|
-
search,
|
|
117
|
-
isSelected,
|
|
118
124
|
onUpdate
|
|
119
125
|
};
|
|
120
126
|
}
|
|
121
|
-
})
|
|
127
|
+
});
|
|
122
128
|
</script>
|