@dative-gpi/foundation-shared-components 0.0.20 → 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 +23 -17
- package/components/FSClickable.vue +39 -3
- package/components/FSContainer.vue +2 -1
- package/components/FSLink.vue +15 -3
- 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 -8
- package/styles/components/fs_clickable.scss +5 -0
package/components/FSButton.vue
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSClickable
|
|
3
3
|
v-if="!['icon'].includes($props.variant)"
|
|
4
|
-
:height="['40px', '36px']"
|
|
5
4
|
:editable="$props.editable"
|
|
5
|
+
:height="['40px', '36px']"
|
|
6
|
+
:variant="$props.variant"
|
|
6
7
|
:color="$props.color"
|
|
8
|
+
:padding="padding"
|
|
7
9
|
:class="classes"
|
|
8
10
|
:style="style"
|
|
11
|
+
:width="width"
|
|
9
12
|
v-bind="$attrs"
|
|
10
13
|
>
|
|
11
14
|
<FSRow
|
|
12
15
|
align="center-center"
|
|
13
|
-
width="
|
|
16
|
+
width="fill"
|
|
14
17
|
:wrap="false"
|
|
15
18
|
>
|
|
16
19
|
<slot name="prepend" v-bind="{ color: $props.color, colors }">
|
|
@@ -129,29 +132,15 @@ export default defineComponent({
|
|
|
129
132
|
const lights = getColors(ColorEnum.Light);
|
|
130
133
|
const darks = getColors(ColorEnum.Dark);
|
|
131
134
|
|
|
132
|
-
const hasNoText = computed(() => {
|
|
133
|
-
return !slots.default && !props.label;
|
|
134
|
-
});
|
|
135
|
-
|
|
136
135
|
const style = computed((): { [code: string]: string } & Partial<CSSStyleDeclaration> => {
|
|
137
136
|
if (!props.editable) {
|
|
138
137
|
switch (props.variant) {
|
|
139
|
-
case "standard":
|
|
140
|
-
case "full": return {
|
|
141
|
-
"--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
|
|
142
|
-
};
|
|
143
138
|
case "icon": return {
|
|
144
139
|
"--fs-button-color": lights.dark,
|
|
145
140
|
};
|
|
146
141
|
}
|
|
147
142
|
}
|
|
148
143
|
switch (props.variant) {
|
|
149
|
-
case "standard": return {
|
|
150
|
-
"--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
|
|
151
|
-
};
|
|
152
|
-
case "full": return {
|
|
153
|
-
"--fs-button-padding": !hasNoText.value ? "0 16px" : "0 7px"
|
|
154
|
-
};
|
|
155
144
|
case "icon": switch (props.color) {
|
|
156
145
|
case ColorEnum.Dark:
|
|
157
146
|
case ColorEnum.Light: return {
|
|
@@ -182,10 +171,27 @@ export default defineComponent({
|
|
|
182
171
|
return classNames;
|
|
183
172
|
});
|
|
184
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
|
+
|
|
185
189
|
return {
|
|
186
190
|
classes,
|
|
191
|
+
padding,
|
|
187
192
|
colors,
|
|
188
|
-
style
|
|
193
|
+
style,
|
|
194
|
+
width
|
|
189
195
|
};
|
|
190
196
|
}
|
|
191
197
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<FSCard
|
|
3
|
+
v-if="!href"
|
|
3
4
|
:border="$props.border"
|
|
4
5
|
:class="classes"
|
|
5
6
|
:style="style"
|
|
@@ -10,10 +11,26 @@
|
|
|
10
11
|
<slot :name="name" v-bind="slotData" />
|
|
11
12
|
</template>
|
|
12
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>
|
|
13
29
|
</template>
|
|
14
30
|
|
|
15
31
|
<script lang="ts">
|
|
16
32
|
import { computed, defineComponent, PropType } from "vue";
|
|
33
|
+
import { RouteLocation, useRouter } from "vue-router";
|
|
17
34
|
|
|
18
35
|
import { ColorBase, ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
19
36
|
import { useColors } from "@dative-gpi/foundation-shared-components/composables";
|
|
@@ -27,6 +44,11 @@ export default defineComponent({
|
|
|
27
44
|
FSCard
|
|
28
45
|
},
|
|
29
46
|
props: {
|
|
47
|
+
to: {
|
|
48
|
+
type: [String, Object] as PropType<string | RouteLocation>,
|
|
49
|
+
required: false,
|
|
50
|
+
default: null
|
|
51
|
+
},
|
|
30
52
|
border: {
|
|
31
53
|
type: Boolean,
|
|
32
54
|
required: false,
|
|
@@ -56,6 +78,7 @@ export default defineComponent({
|
|
|
56
78
|
emits: ["click"],
|
|
57
79
|
setup(props, { emit }) {
|
|
58
80
|
const { getColors, getContrasts } = useColors();
|
|
81
|
+
const router = useRouter();
|
|
59
82
|
|
|
60
83
|
const textColors = computed(() => getContrasts(props.color));
|
|
61
84
|
const colors = computed(() => getColors(props.color));
|
|
@@ -68,7 +91,7 @@ export default defineComponent({
|
|
|
68
91
|
"--fs-clickable-border-radius" : sizeToVar(props.borderRadius),
|
|
69
92
|
"--fs-clickable-background-color": lights.base,
|
|
70
93
|
"--fs-clickable-border-color" : lights.dark,
|
|
71
|
-
"--fs-clickable-color" : lights.dark
|
|
94
|
+
"--fs-clickable-color" : lights.dark
|
|
72
95
|
};
|
|
73
96
|
}
|
|
74
97
|
switch (props.variant) {
|
|
@@ -83,7 +106,7 @@ export default defineComponent({
|
|
|
83
106
|
"--fs-clickable-hover-color" : textColors.value.light,
|
|
84
107
|
"--fs-clickable-active-background-color": colors.value.dark,
|
|
85
108
|
"--fs-clickable-active-border-color" : colors.value.dark,
|
|
86
|
-
"--fs-clickable-active-color" : textColors.value.light
|
|
109
|
+
"--fs-clickable-active-color" : textColors.value.light
|
|
87
110
|
};
|
|
88
111
|
case "full": return {
|
|
89
112
|
"--fs-clickable-border-size" : props.border ? "1px" : "0",
|
|
@@ -96,7 +119,7 @@ export default defineComponent({
|
|
|
96
119
|
"--fs-clickable-hover-color" : textColors.value.light,
|
|
97
120
|
"--fs-clickable-active-background-color": colors.value.dark,
|
|
98
121
|
"--fs-clickable-active-border-color" : colors.value.dark,
|
|
99
|
-
"--fs-clickable-active-color" : textColors.value.light
|
|
122
|
+
"--fs-clickable-active-color" : textColors.value.light
|
|
100
123
|
};
|
|
101
124
|
}
|
|
102
125
|
});
|
|
@@ -109,6 +132,18 @@ export default defineComponent({
|
|
|
109
132
|
return classNames;
|
|
110
133
|
});
|
|
111
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
|
+
|
|
112
147
|
const onClick = () => {
|
|
113
148
|
if (props.editable) {
|
|
114
149
|
emit("click");
|
|
@@ -118,6 +153,7 @@ export default defineComponent({
|
|
|
118
153
|
return {
|
|
119
154
|
classes,
|
|
120
155
|
style,
|
|
156
|
+
href,
|
|
121
157
|
onClick
|
|
122
158
|
};
|
|
123
159
|
}
|
|
@@ -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
|
});
|
|
@@ -38,6 +38,7 @@
|
|
|
38
38
|
gap="4px"
|
|
39
39
|
>
|
|
40
40
|
<FSConnectivity
|
|
41
|
+
v-if="$props.deviceConnectivity"
|
|
41
42
|
:deviceConnectivity="$props.deviceConnectivity"
|
|
42
43
|
/>
|
|
43
44
|
<FSWorstAlert
|
|
@@ -129,7 +130,7 @@ export default defineComponent({
|
|
|
129
130
|
deviceAlerts: {
|
|
130
131
|
type: Array as PropType<FSDeviceAlert[]>,
|
|
131
132
|
required: false,
|
|
132
|
-
default:
|
|
133
|
+
default: () => []
|
|
133
134
|
},
|
|
134
135
|
modelStatuses: {
|
|
135
136
|
type: Array as PropType<FSModelStatus[]>,
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { computed, onMounted, onUnmounted, ref } from "vue";
|
|
2
2
|
|
|
3
|
+
let initialized = false;
|
|
4
|
+
|
|
3
5
|
export const useBreakpoints = () => {
|
|
4
6
|
const windowWidth = ref(window.innerWidth);
|
|
5
7
|
|
|
@@ -7,14 +9,6 @@ export const useBreakpoints = () => {
|
|
|
7
9
|
windowWidth.value = window.innerWidth;
|
|
8
10
|
};
|
|
9
11
|
|
|
10
|
-
onMounted(() => {
|
|
11
|
-
window.addEventListener("resize", onSizeChange);
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
onUnmounted(() => {
|
|
15
|
-
window.removeEventListener("resize", onSizeChange);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
12
|
const isTouchScreenEnabled = computed((): boolean => {
|
|
19
13
|
return navigator.maxTouchPoints > 0;
|
|
20
14
|
});
|
|
@@ -27,6 +21,11 @@ export const useBreakpoints = () => {
|
|
|
27
21
|
return windowWidth.value < 600;
|
|
28
22
|
});
|
|
29
23
|
|
|
24
|
+
if (!initialized) {
|
|
25
|
+
window.addEventListener("resize", onSizeChange);
|
|
26
|
+
initialized = true;
|
|
27
|
+
}
|
|
28
|
+
|
|
30
29
|
return {
|
|
31
30
|
isTouchScreenEnabled,
|
|
32
31
|
isMobileSized,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.21",
|
|
5
5
|
"description": "",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
"author": "",
|
|
11
11
|
"license": "ISC",
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@dative-gpi/foundation-shared-domain": "0.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "0.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "0.0.21",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "0.0.21",
|
|
15
15
|
"@fontsource/montserrat": "^5.0.16",
|
|
16
16
|
"@lexical/clipboard": "^0.12.5",
|
|
17
17
|
"@lexical/history": "^0.12.5",
|
|
@@ -32,5 +32,5 @@
|
|
|
32
32
|
"sass": "^1.69.5",
|
|
33
33
|
"sass-loader": "^13.3.2"
|
|
34
34
|
},
|
|
35
|
-
"gitHead": "
|
|
35
|
+
"gitHead": "27642f99177d57e7349dd826e922442a6c0720cb"
|
|
36
36
|
}
|