@dative-gpi/foundation-shared-components 0.0.19 → 0.0.20
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 +31 -57
- package/components/FSCard.vue +4 -4
- package/components/FSCarousel.vue +4 -3
- package/components/FSClickable.vue +125 -0
- package/components/FSLoader.vue +9 -31
- package/components/FSSlideGroup.vue +69 -8
- package/components/FSToggleSet.vue +20 -1
- package/components/FSWrapGroup.vue +22 -2
- package/components/buttons/FSButtonFile.vue +84 -0
- package/components/buttons/FSButtonFileIcon.vue +84 -0
- package/components/buttons/FSButtonFileLabel.vue +83 -0
- package/components/buttons/FSButtonFileMini.vue +83 -0
- package/components/fields/FSIconField.vue +18 -5
- package/components/lists/FSDataTableUI.vue +2 -0
- package/package.json +4 -4
- package/styles/components/fs_button.scss +0 -28
- package/styles/components/fs_clickable.scss +26 -0
- package/styles/components/fs_data_table.scss +2 -2
- package/styles/components/index.scss +1 -0
- package/styles/globals/overrides.scss +3 -2
- package/utils/css.ts +16 -2
- package/components/FSFileButton.vue +0 -246
package/components/FSButton.vue
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="!['icon'].includes(props.variant)"
|
|
4
|
-
:
|
|
5
|
-
:
|
|
2
|
+
<FSClickable
|
|
3
|
+
v-if="!['icon'].includes($props.variant)"
|
|
4
|
+
:height="['40px', '36px']"
|
|
5
|
+
:editable="$props.editable"
|
|
6
|
+
:color="$props.color"
|
|
6
7
|
:class="classes"
|
|
7
|
-
:
|
|
8
|
+
:style="style"
|
|
8
9
|
v-bind="$attrs"
|
|
9
10
|
>
|
|
10
11
|
<FSRow
|
|
@@ -12,60 +13,60 @@
|
|
|
12
13
|
width="hug"
|
|
13
14
|
:wrap="false"
|
|
14
15
|
>
|
|
15
|
-
<slot name="prepend" v-bind="{ color: props.color, colors }">
|
|
16
|
+
<slot name="prepend" v-bind="{ color: $props.color, colors }">
|
|
16
17
|
<FSIcon
|
|
17
|
-
v-if="props.prependIcon || props.icon"
|
|
18
|
+
v-if="$props.prependIcon || $props.icon"
|
|
18
19
|
size="l"
|
|
19
20
|
>
|
|
20
|
-
{{ props.prependIcon ?? props.icon }}
|
|
21
|
+
{{ $props.prependIcon ?? $props.icon }}
|
|
21
22
|
</FSIcon>
|
|
22
23
|
</slot>
|
|
23
|
-
<slot v-bind="{ color: props.color, colors }">
|
|
24
|
+
<slot v-bind="{ color: $props.color, colors }">
|
|
24
25
|
<FSSpan
|
|
25
|
-
v-if="props.label"
|
|
26
|
+
v-if="$props.label"
|
|
26
27
|
>
|
|
27
|
-
{{ props.label }}
|
|
28
|
+
{{ $props.label }}
|
|
28
29
|
</FSSpan>
|
|
29
30
|
</slot>
|
|
30
|
-
<slot name="append" v-bind="{ color: props.color, colors }">
|
|
31
|
+
<slot name="append" v-bind="{ color: $props.color, colors }">
|
|
31
32
|
<FSIcon
|
|
32
|
-
v-if="props.appendIcon"
|
|
33
|
+
v-if="$props.appendIcon"
|
|
33
34
|
size="l"
|
|
34
35
|
>
|
|
35
|
-
{{ props.appendIcon }}
|
|
36
|
+
{{ $props.appendIcon }}
|
|
36
37
|
</FSIcon>
|
|
37
38
|
</slot>
|
|
38
39
|
</FSRow>
|
|
39
|
-
</
|
|
40
|
+
</FSClickable>
|
|
40
41
|
<FSRow
|
|
41
|
-
v-else-if="props.icon"
|
|
42
|
+
v-else-if="$props.icon"
|
|
42
43
|
align="center-center"
|
|
43
44
|
width="hug"
|
|
44
|
-
:style="style"
|
|
45
45
|
:class="classes"
|
|
46
|
+
:style="style"
|
|
46
47
|
v-bind="$attrs"
|
|
47
48
|
>
|
|
48
49
|
<FSIcon
|
|
49
50
|
size="l"
|
|
50
51
|
>
|
|
51
|
-
{{ props.icon }}
|
|
52
|
+
{{ $props.icon }}
|
|
52
53
|
</FSIcon>
|
|
53
54
|
<FSSpan
|
|
54
|
-
v-if="props.label"
|
|
55
|
+
v-if="$props.label"
|
|
55
56
|
font="text-overline"
|
|
56
57
|
>
|
|
57
|
-
{{ props.label }}
|
|
58
|
+
{{ $props.label }}
|
|
58
59
|
</FSSpan>
|
|
59
60
|
</FSRow>
|
|
60
61
|
</template>
|
|
61
62
|
|
|
62
63
|
<script lang="ts">
|
|
63
|
-
import { computed, defineComponent,
|
|
64
|
-
import { useDefaults } from "vuetify";
|
|
64
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
65
65
|
|
|
66
66
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
67
67
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
68
68
|
|
|
69
|
+
import FSClickable from "./FSClickable.vue";
|
|
69
70
|
import FSSpan from "./FSSpan.vue";
|
|
70
71
|
import FSIcon from "./FSIcon.vue";
|
|
71
72
|
import FSRow from "./FSRow.vue";
|
|
@@ -73,6 +74,7 @@ import FSRow from "./FSRow.vue";
|
|
|
73
74
|
export default defineComponent({
|
|
74
75
|
name: "FSButton",
|
|
75
76
|
components: {
|
|
77
|
+
FSClickable,
|
|
76
78
|
FSSpan,
|
|
77
79
|
FSIcon,
|
|
78
80
|
FSRow
|
|
@@ -120,17 +122,14 @@ export default defineComponent({
|
|
|
120
122
|
}
|
|
121
123
|
},
|
|
122
124
|
setup(props) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const { getColors, getContrasts } = useColors();
|
|
125
|
+
const { getColors } = useColors();
|
|
126
126
|
const { slots } = useSlots();
|
|
127
127
|
|
|
128
|
-
const textColors = computed(() => getContrasts(props.color));
|
|
129
128
|
const colors = computed(() => getColors(props.color));
|
|
130
129
|
const lights = getColors(ColorEnum.Light);
|
|
131
130
|
const darks = getColors(ColorEnum.Dark);
|
|
132
131
|
|
|
133
|
-
const
|
|
132
|
+
const hasNoText = computed(() => {
|
|
134
133
|
return !slots.default && !props.label;
|
|
135
134
|
});
|
|
136
135
|
|
|
@@ -139,10 +138,7 @@ export default defineComponent({
|
|
|
139
138
|
switch (props.variant) {
|
|
140
139
|
case "standard":
|
|
141
140
|
case "full": return {
|
|
142
|
-
"--fs-button-padding"
|
|
143
|
-
"--fs-button-background-color": lights.base,
|
|
144
|
-
"--fs-button-border-color" : lights.dark,
|
|
145
|
-
"--fs-button-color" : lights.dark,
|
|
141
|
+
"--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
|
|
146
142
|
};
|
|
147
143
|
case "icon": return {
|
|
148
144
|
"--fs-button-color": lights.dark,
|
|
@@ -151,28 +147,10 @@ export default defineComponent({
|
|
|
151
147
|
}
|
|
152
148
|
switch (props.variant) {
|
|
153
149
|
case "standard": return {
|
|
154
|
-
"--fs-button-padding"
|
|
155
|
-
"--fs-button-background-color" : colors.value.light,
|
|
156
|
-
"--fs-button-border-color" : colors.value.base,
|
|
157
|
-
"--fs-button-color" : textColors.value.base,
|
|
158
|
-
"--fs-button-hover-background-color" : colors.value.base,
|
|
159
|
-
"--fs-button-hover-border-color" : colors.value.base,
|
|
160
|
-
"--fs-button-hover-color" : textColors.value.light,
|
|
161
|
-
"--fs-button-active-background-color": colors.value.dark,
|
|
162
|
-
"--fs-button-active-border-color" : colors.value.dark,
|
|
163
|
-
"--fs-button-active-color" : textColors.value.light,
|
|
150
|
+
"--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
|
|
164
151
|
};
|
|
165
152
|
case "full": return {
|
|
166
|
-
"--fs-button-padding"
|
|
167
|
-
"--fs-button-background-color" : colors.value.base,
|
|
168
|
-
"--fs-button-border-color" : colors.value.base,
|
|
169
|
-
"--fs-button-color" : textColors.value.light,
|
|
170
|
-
"--fs-button-hover-background-color" : colors.value.base,
|
|
171
|
-
"--fs-button-hover-border-color" : colors.value.base,
|
|
172
|
-
"--fs-button-hover-color" : textColors.value.light,
|
|
173
|
-
"--fs-button-active-background-color": colors.value.dark,
|
|
174
|
-
"--fs-button-active-border-color" : colors.value.dark,
|
|
175
|
-
"--fs-button-active-color" : textColors.value.light,
|
|
153
|
+
"--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
|
|
176
154
|
};
|
|
177
155
|
case "icon": switch (props.color) {
|
|
178
156
|
case ColorEnum.Dark:
|
|
@@ -190,9 +168,6 @@ export default defineComponent({
|
|
|
190
168
|
|
|
191
169
|
const classes = computed((): string[] => {
|
|
192
170
|
const classNames: string[] = [];
|
|
193
|
-
if (!props.editable) {
|
|
194
|
-
classNames.push("fs-button--disabled");
|
|
195
|
-
}
|
|
196
171
|
if (props.fullWidth) {
|
|
197
172
|
classNames.push("fs-button-full-width");
|
|
198
173
|
}
|
|
@@ -208,10 +183,9 @@ export default defineComponent({
|
|
|
208
183
|
});
|
|
209
184
|
|
|
210
185
|
return {
|
|
211
|
-
|
|
186
|
+
classes,
|
|
212
187
|
colors,
|
|
213
|
-
style
|
|
214
|
-
classes
|
|
188
|
+
style
|
|
215
189
|
};
|
|
216
190
|
}
|
|
217
191
|
});
|
package/components/FSCard.vue
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
</template>
|
|
30
30
|
|
|
31
31
|
<script lang="ts">
|
|
32
|
-
import { computed, defineComponent } from "vue";
|
|
32
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
33
33
|
|
|
34
34
|
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
35
35
|
|
|
@@ -46,19 +46,19 @@ export default defineComponent({
|
|
|
46
46
|
},
|
|
47
47
|
props: {
|
|
48
48
|
width: {
|
|
49
|
-
type: [String, Number]
|
|
49
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
|
|
50
50
|
required: false,
|
|
51
51
|
default: null
|
|
52
52
|
},
|
|
53
53
|
height: {
|
|
54
|
-
type: [String, Number]
|
|
54
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
|
|
55
55
|
required: false,
|
|
56
56
|
default: null
|
|
57
57
|
},
|
|
58
58
|
gap: {
|
|
59
59
|
type: [String, Number],
|
|
60
60
|
required: false,
|
|
61
|
-
default:
|
|
61
|
+
default: "8px"
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
64
|
setup(props) {
|
|
@@ -21,16 +21,17 @@
|
|
|
21
21
|
</template>
|
|
22
22
|
|
|
23
23
|
<script lang="ts">
|
|
24
|
-
import { computed, defineComponent, VNode } from "vue";
|
|
24
|
+
import { computed, defineComponent, PropType, VNode } from "vue";
|
|
25
25
|
|
|
26
26
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
27
27
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
28
|
+
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
28
29
|
|
|
29
30
|
export default defineComponent({
|
|
30
31
|
name: "FSCarousel",
|
|
31
32
|
props: {
|
|
32
33
|
height: {
|
|
33
|
-
type: [String, Number]
|
|
34
|
+
type: [Array, String, Number] as PropType<string[] | number[] | string | number>,
|
|
34
35
|
required: false,
|
|
35
36
|
default: "100%"
|
|
36
37
|
}
|
|
@@ -45,7 +46,7 @@ export default defineComponent({
|
|
|
45
46
|
|
|
46
47
|
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
47
48
|
return {
|
|
48
|
-
"--fs-carousel-height" :
|
|
49
|
+
"--fs-carousel-height" : sizeToVar(props.height),
|
|
49
50
|
"--fs-carousel-background-color": backgrounds.base
|
|
50
51
|
};
|
|
51
52
|
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCard
|
|
3
|
+
:border="$props.border"
|
|
4
|
+
:class="classes"
|
|
5
|
+
:style="style"
|
|
6
|
+
@click.stop="onClick"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
>
|
|
9
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
10
|
+
<slot :name="name" v-bind="slotData" />
|
|
11
|
+
</template>
|
|
12
|
+
</FSCard>
|
|
13
|
+
</template>
|
|
14
|
+
|
|
15
|
+
<script lang="ts">
|
|
16
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
17
|
+
|
|
18
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
19
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
20
|
+
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
21
|
+
|
|
22
|
+
import FSCard from "./FSCard.vue";
|
|
23
|
+
|
|
24
|
+
export default defineComponent({
|
|
25
|
+
name: "FSClickable",
|
|
26
|
+
components: {
|
|
27
|
+
FSCard
|
|
28
|
+
},
|
|
29
|
+
props: {
|
|
30
|
+
border: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
required: false,
|
|
33
|
+
default: true
|
|
34
|
+
},
|
|
35
|
+
borderRadius: {
|
|
36
|
+
type: [String, Number],
|
|
37
|
+
required: false,
|
|
38
|
+
default: "4px"
|
|
39
|
+
},
|
|
40
|
+
variant: {
|
|
41
|
+
type: String as PropType<"standard" | "full">,
|
|
42
|
+
required: false,
|
|
43
|
+
default: "standard"
|
|
44
|
+
},
|
|
45
|
+
color: {
|
|
46
|
+
type: String as PropType<ColorBase>,
|
|
47
|
+
required: false,
|
|
48
|
+
default: ColorEnum.Primary
|
|
49
|
+
},
|
|
50
|
+
editable: {
|
|
51
|
+
type: Boolean,
|
|
52
|
+
required: false,
|
|
53
|
+
default: true
|
|
54
|
+
}
|
|
55
|
+
},
|
|
56
|
+
emits: ["click"],
|
|
57
|
+
setup(props, { emit }) {
|
|
58
|
+
const { getColors, getContrasts } = useColors();
|
|
59
|
+
|
|
60
|
+
const textColors = computed(() => getContrasts(props.color));
|
|
61
|
+
const colors = computed(() => getColors(props.color));
|
|
62
|
+
const lights = getColors(ColorEnum.Light);
|
|
63
|
+
|
|
64
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
65
|
+
if (!props.editable) {
|
|
66
|
+
return {
|
|
67
|
+
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
68
|
+
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
69
|
+
"--fs-clickable-background-color": lights.base,
|
|
70
|
+
"--fs-clickable-border-color" : lights.dark,
|
|
71
|
+
"--fs-clickable-color" : lights.dark,
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
switch (props.variant) {
|
|
75
|
+
case "standard": return {
|
|
76
|
+
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
77
|
+
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
78
|
+
"--fs-clickable-background-color" : colors.value.light,
|
|
79
|
+
"--fs-clickable-border-color" : colors.value.base,
|
|
80
|
+
"--fs-clickable-color" : textColors.value.base,
|
|
81
|
+
"--fs-clickable-hover-background-color" : colors.value.base,
|
|
82
|
+
"--fs-clickable-hover-border-color" : colors.value.base,
|
|
83
|
+
"--fs-clickable-hover-color" : textColors.value.light,
|
|
84
|
+
"--fs-clickable-active-background-color": colors.value.dark,
|
|
85
|
+
"--fs-clickable-active-border-color" : colors.value.dark,
|
|
86
|
+
"--fs-clickable-active-color" : textColors.value.light,
|
|
87
|
+
};
|
|
88
|
+
case "full": return {
|
|
89
|
+
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
90
|
+
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
91
|
+
"--fs-clickable-background-color" : colors.value.base,
|
|
92
|
+
"--fs-clickable-border-color" : colors.value.base,
|
|
93
|
+
"--fs-clickable-color" : textColors.value.light,
|
|
94
|
+
"--fs-clickable-hover-background-color" : colors.value.base,
|
|
95
|
+
"--fs-clickable-hover-border-color" : colors.value.base,
|
|
96
|
+
"--fs-clickable-hover-color" : textColors.value.light,
|
|
97
|
+
"--fs-clickable-active-background-color": colors.value.dark,
|
|
98
|
+
"--fs-clickable-active-border-color" : colors.value.dark,
|
|
99
|
+
"--fs-clickable-active-color" : textColors.value.light,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const classes = computed((): string[] => {
|
|
105
|
+
const classNames: string[] = ["fs-clickable"];
|
|
106
|
+
if (!props.editable) {
|
|
107
|
+
classNames.push("fs-clickable-disabled");
|
|
108
|
+
}
|
|
109
|
+
return classNames;
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
const onClick = () => {
|
|
113
|
+
if (props.editable) {
|
|
114
|
+
emit("click");
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
return {
|
|
119
|
+
classes,
|
|
120
|
+
style,
|
|
121
|
+
onClick
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
</script>
|
package/components/FSLoader.vue
CHANGED
|
@@ -49,18 +49,7 @@ export default defineComponent({
|
|
|
49
49
|
|
|
50
50
|
const getHeight = computed((): string | number => {
|
|
51
51
|
switch (props.variant) {
|
|
52
|
-
case "standard":
|
|
53
|
-
if (Array.isArray(props.height)) {
|
|
54
|
-
if (isExtraSmall.value) {
|
|
55
|
-
return props.height[2] ?? props.height[1] ?? props.height[0];
|
|
56
|
-
}
|
|
57
|
-
if (isMobileSized.value) {
|
|
58
|
-
return props.height[1] ?? props.height[0];
|
|
59
|
-
}
|
|
60
|
-
return props.height[0];
|
|
61
|
-
}
|
|
62
|
-
return props.height;
|
|
63
|
-
}
|
|
52
|
+
case "standard": return sizeToVar(props.height);
|
|
64
53
|
case "button":
|
|
65
54
|
case "input": return isMobileSized.value ? "36px" : "40px";
|
|
66
55
|
case "chip": return isMobileSized.value ? "20px" : "24px";
|
|
@@ -77,25 +66,14 @@ export default defineComponent({
|
|
|
77
66
|
|
|
78
67
|
const getWidth = computed((): string | number => {
|
|
79
68
|
switch (props.variant) {
|
|
80
|
-
case "standard":
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
return props.width[0];
|
|
89
|
-
}
|
|
90
|
-
return props.width;
|
|
91
|
-
}
|
|
92
|
-
case "button": return isMobileSized ? "36px" : "40px";
|
|
93
|
-
case "input": return isMobileSized ? "calc(50% - 124px)" : "calc(50% - 132px)";
|
|
94
|
-
case "chip": return "8vw";
|
|
95
|
-
case "text-h1": return "calc(50% - 32px)";
|
|
96
|
-
case "text-h2": return "calc(60% - 32px)";
|
|
97
|
-
case "text-h3": return "calc(65% - 32px)";
|
|
98
|
-
default: return "calc(75% - 32px)";
|
|
69
|
+
case "standard": return sizeToVar(props.width);
|
|
70
|
+
case "button": return isMobileSized ? "36px" : "40px";
|
|
71
|
+
case "input": return isMobileSized ? "calc(50% - 124px)" : "calc(50% - 132px)";
|
|
72
|
+
case "chip": return "8vw";
|
|
73
|
+
case "text-h1": return "calc(50% - 32px)";
|
|
74
|
+
case "text-h2": return "calc(60% - 32px)";
|
|
75
|
+
case "text-h3": return "calc(65% - 32px)";
|
|
76
|
+
default: return "calc(75% - 32px)";
|
|
99
77
|
}
|
|
100
78
|
});
|
|
101
79
|
|
|
@@ -1,28 +1,62 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-slide-group
|
|
3
3
|
class="fs-slide-group"
|
|
4
|
+
ref="slideGroupRef"
|
|
4
5
|
:showArrows="true"
|
|
5
6
|
:style="style"
|
|
6
7
|
v-bind="$attrs"
|
|
7
8
|
>
|
|
8
|
-
<
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
9
|
+
<template #prev>
|
|
10
|
+
<FSButton
|
|
11
|
+
v-if="$props.dash"
|
|
12
|
+
icon="mdi-chevron-double-left"
|
|
13
|
+
variant="icon"
|
|
14
|
+
@click="goToStart"
|
|
15
|
+
/>
|
|
16
|
+
<FSButtonPreviousIcon
|
|
17
|
+
:color="ColorEnum.Dark"
|
|
18
|
+
/>
|
|
19
|
+
</template>
|
|
20
|
+
<template #default>
|
|
21
|
+
<v-slide-group-item
|
|
22
|
+
v-for="(component, index) in getChildren()"
|
|
23
|
+
:key="index"
|
|
24
|
+
>
|
|
25
|
+
<component :is="component" />
|
|
26
|
+
</v-slide-group-item>
|
|
27
|
+
</template>
|
|
28
|
+
<template #next>
|
|
29
|
+
<FSButtonNextIcon
|
|
30
|
+
:color="ColorEnum.Dark"
|
|
31
|
+
/>
|
|
32
|
+
<FSButton
|
|
33
|
+
v-if="$props.dash"
|
|
34
|
+
icon="mdi-chevron-double-right"
|
|
35
|
+
variant="icon"
|
|
36
|
+
@click="goToEnd"
|
|
37
|
+
/>
|
|
38
|
+
</template>
|
|
14
39
|
</v-slide-group>
|
|
15
40
|
</template>
|
|
16
41
|
|
|
17
42
|
<script lang="ts">
|
|
18
|
-
import { computed, defineComponent } from "vue";
|
|
43
|
+
import { computed, defineComponent, ref } from "vue";
|
|
19
44
|
|
|
20
45
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
21
46
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
22
47
|
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
23
48
|
|
|
49
|
+
import FSButtonPreviousIcon from "./buttons/FSButtonPreviousIcon.vue";
|
|
50
|
+
import FSButtonNextIcon from "./buttons/FSButtonNextIcon.vue";
|
|
51
|
+
import FSButton from "./FSButton.vue";
|
|
52
|
+
|
|
24
53
|
export default defineComponent({
|
|
25
54
|
name: "FSSlideGroup",
|
|
55
|
+
components: {
|
|
56
|
+
FSButtonPreviousIcon,
|
|
57
|
+
FSButtonNextIcon,
|
|
58
|
+
FSButton
|
|
59
|
+
},
|
|
26
60
|
props: {
|
|
27
61
|
padding: {
|
|
28
62
|
type: [String, Number],
|
|
@@ -33,6 +67,11 @@ export default defineComponent({
|
|
|
33
67
|
type: [String, Number],
|
|
34
68
|
required: false,
|
|
35
69
|
default: "8px"
|
|
70
|
+
},
|
|
71
|
+
dash: {
|
|
72
|
+
type: Boolean,
|
|
73
|
+
required: false,
|
|
74
|
+
default: true
|
|
36
75
|
}
|
|
37
76
|
},
|
|
38
77
|
setup(props) {
|
|
@@ -41,16 +80,38 @@ export default defineComponent({
|
|
|
41
80
|
|
|
42
81
|
const darks = getColors(ColorEnum.Dark);
|
|
43
82
|
|
|
83
|
+
const slideGroupRef = ref(null);
|
|
84
|
+
|
|
44
85
|
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => ({
|
|
86
|
+
"--fs-group-arrows-width": props.dash ? "52px" : "32px",
|
|
45
87
|
"--fs-group-padding" : sizeToVar(props.padding),
|
|
46
88
|
"--fs-group-gap" : sizeToVar(props.gap),
|
|
47
89
|
"--fs-group-color" : darks.light,
|
|
48
90
|
"--fs-group-hover-color": darks.dark
|
|
49
91
|
}));
|
|
50
92
|
|
|
93
|
+
const goToStart = () => {
|
|
94
|
+
if (slideGroupRef.value) {
|
|
95
|
+
slideGroupRef.value.scrollOffset = 0;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const goToEnd = () => {
|
|
100
|
+
if (slideGroupRef.value) {
|
|
101
|
+
const contentSize = slideGroupRef.value.$el.children[1].children[0].clientWidth;
|
|
102
|
+
const containerSize = slideGroupRef.value.$el.clientWidth;
|
|
103
|
+
const arrowsOffset = props.dash ? 104 : 64;
|
|
104
|
+
slideGroupRef.value.scrollOffset = (contentSize - containerSize + arrowsOffset);
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
|
|
51
108
|
return {
|
|
109
|
+
slideGroupRef,
|
|
110
|
+
ColorEnum,
|
|
52
111
|
style,
|
|
53
|
-
getChildren
|
|
112
|
+
getChildren,
|
|
113
|
+
goToStart,
|
|
114
|
+
goToEnd
|
|
54
115
|
};
|
|
55
116
|
}
|
|
56
117
|
});
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSWrapGroup
|
|
3
3
|
v-if="['wrap'].includes($props.variant)"
|
|
4
|
+
ref="toggleSetRef"
|
|
4
5
|
:padding="$props.padding"
|
|
5
6
|
:gap="$props.gap"
|
|
6
7
|
>
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
</FSWrapGroup>
|
|
41
42
|
<FSSlideGroup
|
|
42
43
|
v-else
|
|
44
|
+
ref="toggleSetRef"
|
|
43
45
|
:padding="$props.padding"
|
|
44
46
|
:gap="$props.gap"
|
|
45
47
|
>
|
|
@@ -80,7 +82,7 @@
|
|
|
80
82
|
</template>
|
|
81
83
|
|
|
82
84
|
<script lang="ts">
|
|
83
|
-
import { defineComponent, PropType } from "vue";
|
|
85
|
+
import { defineComponent, PropType, ref } from "vue";
|
|
84
86
|
|
|
85
87
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
86
88
|
import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
@@ -175,6 +177,8 @@ export default defineComponent({
|
|
|
175
177
|
|
|
176
178
|
const firstChild = getFirstChild("item");
|
|
177
179
|
|
|
180
|
+
const toggleSetRef = ref(null);
|
|
181
|
+
|
|
178
182
|
const getFromFirstChild = (prop: string, value: FSToggle): any => {
|
|
179
183
|
switch (prop) {
|
|
180
184
|
case "prependIcon":
|
|
@@ -269,12 +273,27 @@ export default defineComponent({
|
|
|
269
273
|
}
|
|
270
274
|
};
|
|
271
275
|
|
|
276
|
+
const goToStart = () => {
|
|
277
|
+
if (toggleSetRef.value) {
|
|
278
|
+
toggleSetRef.value.goToStart();
|
|
279
|
+
}
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
const goToEnd = () => {
|
|
283
|
+
if (toggleSetRef.value) {
|
|
284
|
+
toggleSetRef.value.goToEnd();
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
|
|
272
288
|
return {
|
|
289
|
+
toggleSetRef,
|
|
273
290
|
firstChild,
|
|
274
291
|
getFromFirstChild,
|
|
275
292
|
getVariant,
|
|
293
|
+
goToStart,
|
|
276
294
|
getColor,
|
|
277
295
|
getClass,
|
|
296
|
+
goToEnd,
|
|
278
297
|
toggle
|
|
279
298
|
};
|
|
280
299
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-slide-group
|
|
3
3
|
class="fs-wrap-group"
|
|
4
|
+
ref="wrapGroupRef"
|
|
4
5
|
:style="style"
|
|
5
6
|
v-bind="$attrs"
|
|
6
7
|
>
|
|
@@ -14,7 +15,7 @@
|
|
|
14
15
|
</template>
|
|
15
16
|
|
|
16
17
|
<script lang="ts">
|
|
17
|
-
import { computed, defineComponent } from "vue";
|
|
18
|
+
import { computed, defineComponent, ref } from "vue";
|
|
18
19
|
|
|
19
20
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
20
21
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
@@ -40,6 +41,8 @@ export default defineComponent({
|
|
|
40
41
|
|
|
41
42
|
const darks = getColors(ColorEnum.Dark);
|
|
42
43
|
|
|
44
|
+
const wrapGroupRef = ref(null);
|
|
45
|
+
|
|
43
46
|
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => ({
|
|
44
47
|
"--fs-group-padding" : sizeToVar(props.padding),
|
|
45
48
|
"--fs-group-gap" : sizeToVar(props.gap),
|
|
@@ -47,9 +50,26 @@ export default defineComponent({
|
|
|
47
50
|
"--fs-group-hover-color": darks.dark
|
|
48
51
|
}));
|
|
49
52
|
|
|
53
|
+
const goToStart = () => {
|
|
54
|
+
if (wrapGroupRef.value) {
|
|
55
|
+
wrapGroupRef.value.scrollOffset = 0;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
const goToEnd = () => {
|
|
60
|
+
if (wrapGroupRef.value) {
|
|
61
|
+
const contentSize = wrapGroupRef.value.$el.children[1].children[0].clientWidth;
|
|
62
|
+
const containerSize = wrapGroupRef.value.$el.clientWidth;
|
|
63
|
+
wrapGroupRef.value.scrollOffset = (contentSize - containerSize);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
50
67
|
return {
|
|
68
|
+
wrapGroupRef,
|
|
51
69
|
style,
|
|
52
|
-
getChildren
|
|
70
|
+
getChildren,
|
|
71
|
+
goToStart,
|
|
72
|
+
goToEnd
|
|
53
73
|
};
|
|
54
74
|
}
|
|
55
75
|
});
|