@dative-gpi/foundation-shared-components 0.0.19 → 0.0.21
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 +47 -67
- package/components/FSCard.vue +4 -4
- package/components/FSCarousel.vue +4 -3
- package/components/FSClickable.vue +161 -0
- package/components/FSContainer.vue +2 -1
- package/components/FSLink.vue +15 -3
- 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/components/tiles/FSDeviceOrganisationTileUI.vue +2 -1
- package/composables/useBreakpoints.ts +7 -8
- package/package.json +4 -4
- package/styles/components/fs_button.scss +0 -36
- package/styles/components/fs_clickable.scss +31 -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,71 +1,75 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
<
|
|
3
|
-
v-if="!['icon'].includes(props.variant)"
|
|
4
|
-
:
|
|
5
|
-
:
|
|
2
|
+
<FSClickable
|
|
3
|
+
v-if="!['icon'].includes($props.variant)"
|
|
4
|
+
:editable="$props.editable"
|
|
5
|
+
:height="['40px', '36px']"
|
|
6
|
+
:variant="$props.variant"
|
|
7
|
+
:color="$props.color"
|
|
8
|
+
:padding="padding"
|
|
6
9
|
:class="classes"
|
|
7
|
-
:
|
|
10
|
+
:style="style"
|
|
11
|
+
:width="width"
|
|
8
12
|
v-bind="$attrs"
|
|
9
13
|
>
|
|
10
14
|
<FSRow
|
|
11
15
|
align="center-center"
|
|
12
|
-
width="
|
|
16
|
+
width="fill"
|
|
13
17
|
:wrap="false"
|
|
14
18
|
>
|
|
15
|
-
<slot name="prepend" v-bind="{ color: props.color, colors }">
|
|
19
|
+
<slot name="prepend" v-bind="{ color: $props.color, colors }">
|
|
16
20
|
<FSIcon
|
|
17
|
-
v-if="props.prependIcon || props.icon"
|
|
21
|
+
v-if="$props.prependIcon || $props.icon"
|
|
18
22
|
size="l"
|
|
19
23
|
>
|
|
20
|
-
{{ props.prependIcon ?? props.icon }}
|
|
24
|
+
{{ $props.prependIcon ?? $props.icon }}
|
|
21
25
|
</FSIcon>
|
|
22
26
|
</slot>
|
|
23
|
-
<slot v-bind="{ color: props.color, colors }">
|
|
27
|
+
<slot v-bind="{ color: $props.color, colors }">
|
|
24
28
|
<FSSpan
|
|
25
|
-
v-if="props.label"
|
|
29
|
+
v-if="$props.label"
|
|
26
30
|
>
|
|
27
|
-
{{ props.label }}
|
|
31
|
+
{{ $props.label }}
|
|
28
32
|
</FSSpan>
|
|
29
33
|
</slot>
|
|
30
|
-
<slot name="append" v-bind="{ color: props.color, colors }">
|
|
34
|
+
<slot name="append" v-bind="{ color: $props.color, colors }">
|
|
31
35
|
<FSIcon
|
|
32
|
-
v-if="props.appendIcon"
|
|
36
|
+
v-if="$props.appendIcon"
|
|
33
37
|
size="l"
|
|
34
38
|
>
|
|
35
|
-
{{ props.appendIcon }}
|
|
39
|
+
{{ $props.appendIcon }}
|
|
36
40
|
</FSIcon>
|
|
37
41
|
</slot>
|
|
38
42
|
</FSRow>
|
|
39
|
-
</
|
|
43
|
+
</FSClickable>
|
|
40
44
|
<FSRow
|
|
41
|
-
v-else-if="props.icon"
|
|
45
|
+
v-else-if="$props.icon"
|
|
42
46
|
align="center-center"
|
|
43
47
|
width="hug"
|
|
44
|
-
:style="style"
|
|
45
48
|
:class="classes"
|
|
49
|
+
:style="style"
|
|
46
50
|
v-bind="$attrs"
|
|
47
51
|
>
|
|
48
52
|
<FSIcon
|
|
49
53
|
size="l"
|
|
50
54
|
>
|
|
51
|
-
{{ props.icon }}
|
|
55
|
+
{{ $props.icon }}
|
|
52
56
|
</FSIcon>
|
|
53
57
|
<FSSpan
|
|
54
|
-
v-if="props.label"
|
|
58
|
+
v-if="$props.label"
|
|
55
59
|
font="text-overline"
|
|
56
60
|
>
|
|
57
|
-
{{ props.label }}
|
|
61
|
+
{{ $props.label }}
|
|
58
62
|
</FSSpan>
|
|
59
63
|
</FSRow>
|
|
60
64
|
</template>
|
|
61
65
|
|
|
62
66
|
<script lang="ts">
|
|
63
|
-
import { computed, defineComponent,
|
|
64
|
-
import { useDefaults } from "vuetify";
|
|
67
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
65
68
|
|
|
66
69
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
67
70
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
68
71
|
|
|
72
|
+
import FSClickable from "./FSClickable.vue";
|
|
69
73
|
import FSSpan from "./FSSpan.vue";
|
|
70
74
|
import FSIcon from "./FSIcon.vue";
|
|
71
75
|
import FSRow from "./FSRow.vue";
|
|
@@ -73,6 +77,7 @@ import FSRow from "./FSRow.vue";
|
|
|
73
77
|
export default defineComponent({
|
|
74
78
|
name: "FSButton",
|
|
75
79
|
components: {
|
|
80
|
+
FSClickable,
|
|
76
81
|
FSSpan,
|
|
77
82
|
FSIcon,
|
|
78
83
|
FSRow
|
|
@@ -120,60 +125,22 @@ export default defineComponent({
|
|
|
120
125
|
}
|
|
121
126
|
},
|
|
122
127
|
setup(props) {
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
const { getColors, getContrasts } = useColors();
|
|
128
|
+
const { getColors } = useColors();
|
|
126
129
|
const { slots } = useSlots();
|
|
127
130
|
|
|
128
|
-
const textColors = computed(() => getContrasts(props.color));
|
|
129
131
|
const colors = computed(() => getColors(props.color));
|
|
130
132
|
const lights = getColors(ColorEnum.Light);
|
|
131
133
|
const darks = getColors(ColorEnum.Dark);
|
|
132
134
|
|
|
133
|
-
const isEmpty = computed(() => {
|
|
134
|
-
return !slots.default && !props.label;
|
|
135
|
-
});
|
|
136
|
-
|
|
137
135
|
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
138
136
|
if (!props.editable) {
|
|
139
137
|
switch (props.variant) {
|
|
140
|
-
case "standard":
|
|
141
|
-
case "full": return {
|
|
142
|
-
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
143
|
-
"--fs-button-background-color": lights.base,
|
|
144
|
-
"--fs-button-border-color" : lights.dark,
|
|
145
|
-
"--fs-button-color" : lights.dark,
|
|
146
|
-
};
|
|
147
138
|
case "icon": return {
|
|
148
139
|
"--fs-button-color": lights.dark,
|
|
149
140
|
};
|
|
150
141
|
}
|
|
151
142
|
}
|
|
152
143
|
switch (props.variant) {
|
|
153
|
-
case "standard": return {
|
|
154
|
-
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
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,
|
|
164
|
-
};
|
|
165
|
-
case "full": return {
|
|
166
|
-
"--fs-button-padding" : !isEmpty.value ? "0 16px" : "0",
|
|
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,
|
|
176
|
-
};
|
|
177
144
|
case "icon": switch (props.color) {
|
|
178
145
|
case ColorEnum.Dark:
|
|
179
146
|
case ColorEnum.Light: return {
|
|
@@ -190,9 +157,6 @@ export default defineComponent({
|
|
|
190
157
|
|
|
191
158
|
const classes = computed((): string[] => {
|
|
192
159
|
const classNames: string[] = [];
|
|
193
|
-
if (!props.editable) {
|
|
194
|
-
classNames.push("fs-button--disabled");
|
|
195
|
-
}
|
|
196
160
|
if (props.fullWidth) {
|
|
197
161
|
classNames.push("fs-button-full-width");
|
|
198
162
|
}
|
|
@@ -207,11 +171,27 @@ export default defineComponent({
|
|
|
207
171
|
return classNames;
|
|
208
172
|
});
|
|
209
173
|
|
|
174
|
+
const padding = computed((): string | number => {
|
|
175
|
+
switch (props.variant) {
|
|
176
|
+
case "standard":
|
|
177
|
+
case "full": return (!slots.default && !props.label) ? "0 7px" : "0 16px";
|
|
178
|
+
default: return "0px";
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
const width = computed((): string | number => {
|
|
183
|
+
if (props.fullWidth) {
|
|
184
|
+
return "100%";
|
|
185
|
+
}
|
|
186
|
+
return "fit-content";
|
|
187
|
+
});
|
|
188
|
+
|
|
210
189
|
return {
|
|
211
|
-
|
|
190
|
+
classes,
|
|
191
|
+
padding,
|
|
212
192
|
colors,
|
|
213
193
|
style,
|
|
214
|
-
|
|
194
|
+
width
|
|
215
195
|
};
|
|
216
196
|
}
|
|
217
197
|
});
|
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,161 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSCard
|
|
3
|
+
v-if="!href"
|
|
4
|
+
:border="$props.border"
|
|
5
|
+
:class="classes"
|
|
6
|
+
:style="style"
|
|
7
|
+
@click.stop="onClick"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
>
|
|
10
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
11
|
+
<slot :name="name" v-bind="slotData" />
|
|
12
|
+
</template>
|
|
13
|
+
</FSCard>
|
|
14
|
+
<a
|
|
15
|
+
v-else
|
|
16
|
+
:href="href"
|
|
17
|
+
>
|
|
18
|
+
<FSCard
|
|
19
|
+
:border="$props.border"
|
|
20
|
+
:class="classes"
|
|
21
|
+
:style="style"
|
|
22
|
+
v-bind="$attrs"
|
|
23
|
+
>
|
|
24
|
+
<template v-for="(_, name) in $slots" v-slot:[name]="slotData">
|
|
25
|
+
<slot :name="name" v-bind="slotData" />
|
|
26
|
+
</template>
|
|
27
|
+
</FSCard>
|
|
28
|
+
</a>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts">
|
|
32
|
+
import { computed, defineComponent, PropType } from "vue";
|
|
33
|
+
import { RouteLocation, useRouter } from "vue-router";
|
|
34
|
+
|
|
35
|
+
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
36
|
+
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
37
|
+
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
38
|
+
|
|
39
|
+
import FSCard from "./FSCard.vue";
|
|
40
|
+
|
|
41
|
+
export default defineComponent({
|
|
42
|
+
name: "FSClickable",
|
|
43
|
+
components: {
|
|
44
|
+
FSCard
|
|
45
|
+
},
|
|
46
|
+
props: {
|
|
47
|
+
to: {
|
|
48
|
+
type: [String, Object] as PropType<string | RouteLocation>,
|
|
49
|
+
required: false,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
52
|
+
border: {
|
|
53
|
+
type: Boolean,
|
|
54
|
+
required: false,
|
|
55
|
+
default: true
|
|
56
|
+
},
|
|
57
|
+
borderRadius: {
|
|
58
|
+
type: [String, Number],
|
|
59
|
+
required: false,
|
|
60
|
+
default: "4px"
|
|
61
|
+
},
|
|
62
|
+
variant: {
|
|
63
|
+
type: String as PropType<"standard" | "full">,
|
|
64
|
+
required: false,
|
|
65
|
+
default: "standard"
|
|
66
|
+
},
|
|
67
|
+
color: {
|
|
68
|
+
type: String as PropType<ColorBase>,
|
|
69
|
+
required: false,
|
|
70
|
+
default: ColorEnum.Primary
|
|
71
|
+
},
|
|
72
|
+
editable: {
|
|
73
|
+
type: Boolean,
|
|
74
|
+
required: false,
|
|
75
|
+
default: true
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
emits: ["click"],
|
|
79
|
+
setup(props, { emit }) {
|
|
80
|
+
const { getColors, getContrasts } = useColors();
|
|
81
|
+
const router = useRouter();
|
|
82
|
+
|
|
83
|
+
const textColors = computed(() => getContrasts(props.color));
|
|
84
|
+
const colors = computed(() => getColors(props.color));
|
|
85
|
+
const lights = getColors(ColorEnum.Light);
|
|
86
|
+
|
|
87
|
+
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
88
|
+
if (!props.editable) {
|
|
89
|
+
return {
|
|
90
|
+
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
91
|
+
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
92
|
+
"--fs-clickable-background-color": lights.base,
|
|
93
|
+
"--fs-clickable-border-color" : lights.dark,
|
|
94
|
+
"--fs-clickable-color" : lights.dark
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
switch (props.variant) {
|
|
98
|
+
case "standard": return {
|
|
99
|
+
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
100
|
+
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
101
|
+
"--fs-clickable-background-color" : colors.value.light,
|
|
102
|
+
"--fs-clickable-border-color" : colors.value.base,
|
|
103
|
+
"--fs-clickable-color" : textColors.value.base,
|
|
104
|
+
"--fs-clickable-hover-background-color" : colors.value.base,
|
|
105
|
+
"--fs-clickable-hover-border-color" : colors.value.base,
|
|
106
|
+
"--fs-clickable-hover-color" : textColors.value.light,
|
|
107
|
+
"--fs-clickable-active-background-color": colors.value.dark,
|
|
108
|
+
"--fs-clickable-active-border-color" : colors.value.dark,
|
|
109
|
+
"--fs-clickable-active-color" : textColors.value.light
|
|
110
|
+
};
|
|
111
|
+
case "full": return {
|
|
112
|
+
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
113
|
+
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
114
|
+
"--fs-clickable-background-color" : colors.value.base,
|
|
115
|
+
"--fs-clickable-border-color" : colors.value.base,
|
|
116
|
+
"--fs-clickable-color" : textColors.value.light,
|
|
117
|
+
"--fs-clickable-hover-background-color" : colors.value.base,
|
|
118
|
+
"--fs-clickable-hover-border-color" : colors.value.base,
|
|
119
|
+
"--fs-clickable-hover-color" : textColors.value.light,
|
|
120
|
+
"--fs-clickable-active-background-color": colors.value.dark,
|
|
121
|
+
"--fs-clickable-active-border-color" : colors.value.dark,
|
|
122
|
+
"--fs-clickable-active-color" : textColors.value.light
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
const classes = computed((): string[] => {
|
|
128
|
+
const classNames: string[] = ["fs-clickable"];
|
|
129
|
+
if (!props.editable) {
|
|
130
|
+
classNames.push("fs-clickable-disabled");
|
|
131
|
+
}
|
|
132
|
+
return classNames;
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
const href = computed((): string | null => {
|
|
136
|
+
if (!props.to) {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
if (typeof props.to === "string") {
|
|
140
|
+
return props.to;
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return router.resolve(props.to).href;
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
const onClick = () => {
|
|
148
|
+
if (props.editable) {
|
|
149
|
+
emit("click");
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
classes,
|
|
155
|
+
style,
|
|
156
|
+
href,
|
|
157
|
+
onClick
|
|
158
|
+
};
|
|
159
|
+
}
|
|
160
|
+
});
|
|
161
|
+
</script>
|
|
@@ -12,6 +12,7 @@ import { computed, defineComponent } from "vue";
|
|
|
12
12
|
|
|
13
13
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
14
14
|
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
15
|
+
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
15
16
|
|
|
16
17
|
export default defineComponent({
|
|
17
18
|
name: "FSContainer",
|
|
@@ -40,7 +41,7 @@ export default defineComponent({
|
|
|
40
41
|
|
|
41
42
|
const style = computed((): {[code: string]: string} & Partial<CSSStyleDeclaration> => {
|
|
42
43
|
return {
|
|
43
|
-
"--fs-container-padding" :
|
|
44
|
+
"--fs-container-padding" : sizeToVar(props.padding),
|
|
44
45
|
"--fs-container-background-color": backgrounds.base,
|
|
45
46
|
"--fs-container-border-color" : lights.dark
|
|
46
47
|
};
|
package/components/FSLink.vue
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<a
|
|
3
|
-
:href="$props.to"
|
|
4
3
|
:class="classes"
|
|
5
4
|
:style="style"
|
|
5
|
+
:href="href"
|
|
6
6
|
v-bind="$attrs"
|
|
7
7
|
>
|
|
8
8
|
<slot />
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
<script lang="ts">
|
|
13
13
|
import { computed, defineComponent, PropType } from "vue";
|
|
14
|
+
import { RouteLocation, useRouter } from "vue-router";
|
|
14
15
|
|
|
15
16
|
import { useColors, useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
16
17
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
@@ -19,7 +20,7 @@ export default defineComponent({
|
|
|
19
20
|
name: "FSLink",
|
|
20
21
|
props: {
|
|
21
22
|
to: {
|
|
22
|
-
type: String,
|
|
23
|
+
type: [String, Object] as PropType<string | RouteLocation>,
|
|
23
24
|
required: false,
|
|
24
25
|
default: "_blank"
|
|
25
26
|
},
|
|
@@ -52,6 +53,7 @@ export default defineComponent({
|
|
|
52
53
|
setup(props) {
|
|
53
54
|
const { getColors } = useColors();
|
|
54
55
|
const { slots } = useSlots();
|
|
56
|
+
const router = useRouter();
|
|
55
57
|
|
|
56
58
|
const colors = computed(() => getColors(props.color));
|
|
57
59
|
|
|
@@ -86,9 +88,19 @@ export default defineComponent({
|
|
|
86
88
|
}
|
|
87
89
|
});
|
|
88
90
|
|
|
91
|
+
const href = computed((): string => {
|
|
92
|
+
if (typeof props.to === "string") {
|
|
93
|
+
return props.to;
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
return router.resolve(props.to).href;
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
|
|
89
100
|
return {
|
|
90
101
|
classes,
|
|
91
|
-
style
|
|
102
|
+
style,
|
|
103
|
+
href
|
|
92
104
|
};
|
|
93
105
|
}
|
|
94
106
|
});
|
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
|
});
|