@dative-gpi/foundation-shared-components 1.0.125 → 1.0.126
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/FSWindow.vue +92 -3
- package/package.json +4 -4
package/components/FSWindow.vue
CHANGED
|
@@ -1,10 +1,53 @@
|
|
|
1
1
|
<template>
|
|
2
|
+
<template
|
|
3
|
+
v-if="noMatch"
|
|
4
|
+
>
|
|
5
|
+
<slot
|
|
6
|
+
name="error"
|
|
7
|
+
>
|
|
8
|
+
<FSRow
|
|
9
|
+
padding="16px"
|
|
10
|
+
:width="$props.width"
|
|
11
|
+
>
|
|
12
|
+
<FSCol
|
|
13
|
+
align="center-center"
|
|
14
|
+
gap="16px"
|
|
15
|
+
>
|
|
16
|
+
<FSCol
|
|
17
|
+
align="center-center"
|
|
18
|
+
>
|
|
19
|
+
<FSIcon
|
|
20
|
+
size="42px"
|
|
21
|
+
:color="ColorEnum.Error"
|
|
22
|
+
>
|
|
23
|
+
mdi-alert-outline
|
|
24
|
+
</FSIcon>
|
|
25
|
+
<FSText
|
|
26
|
+
font="text-h3"
|
|
27
|
+
>
|
|
28
|
+
{{ $tr("window.no-access-title", "Nothing to see here") }}
|
|
29
|
+
</FSText>
|
|
30
|
+
</FSCol>
|
|
31
|
+
<FSText
|
|
32
|
+
:lineClamp="2"
|
|
33
|
+
>
|
|
34
|
+
{{ $tr("window.no-access-body", "It seems you either do not have access to this content, or there is nothing to display here") }}
|
|
35
|
+
</FSText>
|
|
36
|
+
<FSButton
|
|
37
|
+
:label="$tr('window.no-access-button', 'Go back')"
|
|
38
|
+
:color="ColorEnum.Primary"
|
|
39
|
+
@click="goBack"
|
|
40
|
+
/>
|
|
41
|
+
</FSCol>
|
|
42
|
+
</FSRow>
|
|
43
|
+
</slot>
|
|
44
|
+
</template>
|
|
2
45
|
<v-window
|
|
3
46
|
class="fs-window"
|
|
47
|
+
ref="windowRef"
|
|
4
48
|
:touch="false"
|
|
5
49
|
:style="style"
|
|
6
50
|
:modelValue="$props.modelValue"
|
|
7
|
-
@update:modelValue="$emit('update:modelValue', $event)"
|
|
8
51
|
v-bind="$attrs"
|
|
9
52
|
>
|
|
10
53
|
<template
|
|
@@ -35,8 +78,23 @@ import { computed, defineComponent, type PropType, ref, type StyleValue, type VN
|
|
|
35
78
|
import { useSlots } from "@dative-gpi/foundation-shared-components/composables";
|
|
36
79
|
import { sizeToVar } from "@dative-gpi/foundation-shared-components/utils";
|
|
37
80
|
|
|
81
|
+
import { ColorEnum } from "../models";
|
|
82
|
+
|
|
83
|
+
import FSButton from "./FSButton.vue";
|
|
84
|
+
import FSCard from "./FSCard.vue";
|
|
85
|
+
import FSIcon from "./FSIcon.vue";
|
|
86
|
+
import FSText from "./FSText.vue";
|
|
87
|
+
import FSRow from "./FSRow.vue";
|
|
88
|
+
|
|
38
89
|
export default defineComponent({
|
|
39
90
|
name: "FSWindow",
|
|
91
|
+
components: {
|
|
92
|
+
FSButton,
|
|
93
|
+
FSCard,
|
|
94
|
+
FSIcon,
|
|
95
|
+
FSText,
|
|
96
|
+
FSRow
|
|
97
|
+
},
|
|
40
98
|
props: {
|
|
41
99
|
width: {
|
|
42
100
|
type: [Array, String, Number] as PropType<string[] | number[] | string | number | null>,
|
|
@@ -54,11 +112,13 @@ export default defineComponent({
|
|
|
54
112
|
default: 0
|
|
55
113
|
}
|
|
56
114
|
},
|
|
57
|
-
emits: ["update:modelValue"],
|
|
58
|
-
setup(props) {
|
|
115
|
+
emits: ["update:modelValue", "error"],
|
|
116
|
+
setup(props, { emit }) {
|
|
59
117
|
const { slots, getChildren } = useSlots();
|
|
60
118
|
|
|
61
119
|
delete slots.default;
|
|
120
|
+
|
|
121
|
+
const windowRef = ref<any | null>(null);
|
|
62
122
|
|
|
63
123
|
const showOverflow = ref(true);
|
|
64
124
|
const overflowTimeout = ref<NodeJS.Timeout | null>(null);
|
|
@@ -84,10 +144,39 @@ export default defineComponent({
|
|
|
84
144
|
}, 560);
|
|
85
145
|
});
|
|
86
146
|
|
|
147
|
+
const noMatch = computed(() => {
|
|
148
|
+
if (!windowRef.value) {
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/components/VWindow/VWindow.tsx
|
|
153
|
+
// https://github.com/vuetifyjs/vuetify/blob/master/packages/vuetify/src/composables/group.ts#L161
|
|
154
|
+
const group = windowRef.value.group;
|
|
155
|
+
return !group.items.value.find((item: any) => item.value === props.modelValue);
|
|
156
|
+
});
|
|
157
|
+
|
|
158
|
+
const goBack = (): void => {
|
|
159
|
+
if (!windowRef.value) {
|
|
160
|
+
emit("error");
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const group = windowRef.value.group;
|
|
165
|
+
if (!group.items.value.length) {
|
|
166
|
+
emit("error");
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
emit("update:modelValue", group.items.value[0].value);
|
|
170
|
+
};
|
|
171
|
+
|
|
87
172
|
return {
|
|
173
|
+
ColorEnum,
|
|
174
|
+
windowRef,
|
|
175
|
+
noMatch,
|
|
88
176
|
slots,
|
|
89
177
|
style,
|
|
90
178
|
getChildren,
|
|
179
|
+
goBack,
|
|
91
180
|
value
|
|
92
181
|
};
|
|
93
182
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dative-gpi/foundation-shared-components",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.126",
|
|
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": "1.0.
|
|
14
|
-
"@dative-gpi/foundation-shared-services": "1.0.
|
|
13
|
+
"@dative-gpi/foundation-shared-domain": "1.0.126",
|
|
14
|
+
"@dative-gpi/foundation-shared-services": "1.0.126"
|
|
15
15
|
},
|
|
16
16
|
"peerDependencies": {
|
|
17
17
|
"@dative-gpi/bones-ui": "^1.0.0",
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"sass": "1.71.1",
|
|
36
36
|
"sass-loader": "13.3.2"
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "fa74ceb5e1e68ec7e0cf75fd43bdaf014f0ab552"
|
|
39
39
|
}
|