@dative-gpi/foundation-shared-components 0.0.18 → 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/FSDivider.vue +7 -2
- 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/FSButtonCancel.vue +28 -0
- package/components/buttons/FSButtonCancelIcon.vue +28 -0
- package/components/buttons/FSButtonCancelLabel.vue +27 -0
- package/components/buttons/FSButtonCancelMini.vue +27 -0
- package/components/buttons/FSButtonDuplicate.vue +28 -0
- package/components/buttons/FSButtonDuplicateIcon.vue +28 -0
- package/components/buttons/FSButtonDuplicateLabel.vue +27 -0
- package/components/buttons/FSButtonDuplicateMini.vue +27 -0
- package/components/buttons/FSButtonEdit.vue +28 -0
- package/components/buttons/FSButtonEditIcon.vue +28 -0
- package/components/buttons/FSButtonEditLabel.vue +27 -0
- package/components/buttons/FSButtonEditMini.vue +27 -0
- 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/buttons/FSButtonNext.vue +28 -0
- package/components/buttons/FSButtonNextIcon.vue +28 -0
- package/components/buttons/FSButtonNextLabel.vue +27 -0
- package/components/buttons/FSButtonNextMini.vue +27 -0
- package/components/buttons/FSButtonPrevious.vue +28 -0
- package/components/buttons/FSButtonPreviousIcon.vue +28 -0
- package/components/buttons/FSButtonPreviousLabel.vue +27 -0
- package/components/buttons/FSButtonPreviousMini.vue +27 -0
- package/components/buttons/FSButtonRedo.vue +28 -0
- package/components/buttons/FSButtonRedoIcon.vue +28 -0
- package/components/buttons/FSButtonRedoLabel.vue +27 -0
- package/components/buttons/FSButtonRedoMini.vue +27 -0
- package/components/buttons/FSButtonRemove.vue +28 -0
- package/components/buttons/FSButtonRemoveIcon.vue +28 -0
- package/components/buttons/FSButtonRemoveLabel.vue +27 -0
- package/components/buttons/FSButtonRemoveMini.vue +27 -0
- package/components/buttons/FSButtonSave.vue +28 -0
- package/components/buttons/FSButtonSaveIcon.vue +28 -0
- package/components/buttons/FSButtonSaveLabel.vue +27 -0
- package/components/buttons/FSButtonSaveMini.vue +27 -0
- package/components/buttons/FSButtonSearch.vue +28 -0
- package/components/buttons/FSButtonSearchIcon.vue +28 -0
- package/components/buttons/FSButtonSearchLabel.vue +27 -0
- package/components/buttons/FSButtonSearchMini.vue +27 -0
- package/components/buttons/FSButtonUndo.vue +28 -0
- package/components/buttons/FSButtonUndoIcon.vue +28 -0
- package/components/buttons/FSButtonUndoLabel.vue +27 -0
- package/components/buttons/FSButtonUndoMini.vue +27 -0
- package/components/buttons/FSButtonUpdate.vue +28 -0
- package/components/buttons/FSButtonUpdateIcon.vue +28 -0
- package/components/buttons/FSButtonUpdateLabel.vue +27 -0
- package/components/buttons/FSButtonUpdateMini.vue +27 -0
- package/components/buttons/FSButtonValidate.vue +28 -0
- package/components/buttons/FSButtonValidateIcon.vue +28 -0
- package/components/buttons/FSButtonValidateLabel.vue +27 -0
- package/components/buttons/FSButtonValidateMini.vue +27 -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
|
@@ -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
|
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-cancel"
|
|
4
|
+
:label="$tr('ui.button.cancel', 'Cancel')"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonCancel",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
icon="mdi-cancel"
|
|
4
|
+
variant="icon"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonCancelIcon",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
:label="$tr('ui.button.cancel', 'Cancel')"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonCancelLabel",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-cancel"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonCancelMini",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-content-copy"
|
|
4
|
+
:label="$tr('ui.button.duplicate', 'Duplicate')"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonDuplicate",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
icon="mdi-content-copy"
|
|
4
|
+
variant="icon"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonDuplicateIcon",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
:label="$tr('ui.button.duplicate', 'Duplicate')"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonDuplicateLabel",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-content-copy"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonDuplicateMini",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-pencil-outline"
|
|
4
|
+
:label="$tr('ui.button.edit', 'Edit')"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonEdit",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
icon="mdi-pencil-outline"
|
|
4
|
+
variant="icon"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
v-bind="$attrs"
|
|
7
|
+
/>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script lang="ts">
|
|
11
|
+
import { defineComponent } from "vue";
|
|
12
|
+
|
|
13
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
14
|
+
|
|
15
|
+
import FSButton from "../FSButton.vue";
|
|
16
|
+
|
|
17
|
+
export default defineComponent({
|
|
18
|
+
name: "FSButtonEditIcon",
|
|
19
|
+
components: {
|
|
20
|
+
FSButton
|
|
21
|
+
},
|
|
22
|
+
setup() {
|
|
23
|
+
return {
|
|
24
|
+
ColorEnum
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
:label="$tr('ui.button.edit', 'Edit')"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonEditLabel",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FSButton
|
|
3
|
+
prependIcon="mdi-pencil-outline"
|
|
4
|
+
:color="ColorEnum.Light"
|
|
5
|
+
v-bind="$attrs"
|
|
6
|
+
/>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script lang="ts">
|
|
10
|
+
import { defineComponent } from "vue";
|
|
11
|
+
|
|
12
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
13
|
+
|
|
14
|
+
import FSButton from "../FSButton.vue";
|
|
15
|
+
|
|
16
|
+
export default defineComponent({
|
|
17
|
+
name: "FSButtonEditMini",
|
|
18
|
+
components: {
|
|
19
|
+
FSButton
|
|
20
|
+
},
|
|
21
|
+
setup() {
|
|
22
|
+
return {
|
|
23
|
+
ColorEnum
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<FSButton
|
|
4
|
+
prependIcon="mdi-upload-outline"
|
|
5
|
+
:label="$tr('ui.button.import-file', 'Import file')"
|
|
6
|
+
:color="ColorEnum.Light"
|
|
7
|
+
@click="onClick"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
/>
|
|
10
|
+
<form>
|
|
11
|
+
<input
|
|
12
|
+
v-show="false"
|
|
13
|
+
type="file"
|
|
14
|
+
ref="input"
|
|
15
|
+
:accept="$props.accept"
|
|
16
|
+
@input="onInput"
|
|
17
|
+
/>
|
|
18
|
+
</form>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { defineComponent, ref } from "vue";
|
|
24
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
25
|
+
|
|
26
|
+
import FSButton from "../FSButton.vue";
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
name: "FSButtonFile",
|
|
30
|
+
components: {
|
|
31
|
+
FSButton
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
accept: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: false,
|
|
37
|
+
default: "",
|
|
38
|
+
},
|
|
39
|
+
readFile: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
required: false,
|
|
42
|
+
default: true,
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: ["update:modelValue"],
|
|
46
|
+
setup(props, { emit }) {
|
|
47
|
+
const input = ref(null);
|
|
48
|
+
|
|
49
|
+
const clear = () => {
|
|
50
|
+
input.value!.form && input.value!.form.reset();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onClick = () => {
|
|
54
|
+
input.value!.click();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const onInput = () => {
|
|
58
|
+
const file = input.value!.files && input.value!.files[0];
|
|
59
|
+
if (!file) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!props.readFile) {
|
|
63
|
+
emit("update:modelValue", file);
|
|
64
|
+
clear();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const reader = new FileReader();
|
|
68
|
+
reader.addEventListener("load", (fileEv) => {
|
|
69
|
+
emit("update:modelValue", fileEv.target && fileEv.target.result);
|
|
70
|
+
clear();
|
|
71
|
+
});
|
|
72
|
+
reader.readAsDataURL(file);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
ColorEnum,
|
|
78
|
+
input,
|
|
79
|
+
onClick,
|
|
80
|
+
onInput
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<FSButton
|
|
4
|
+
icon="mdi-upload-outline"
|
|
5
|
+
variant="icon"
|
|
6
|
+
:color="ColorEnum.Light"
|
|
7
|
+
@click="onClick"
|
|
8
|
+
v-bind="$attrs"
|
|
9
|
+
/>
|
|
10
|
+
<form>
|
|
11
|
+
<input
|
|
12
|
+
v-show="false"
|
|
13
|
+
type="file"
|
|
14
|
+
ref="input"
|
|
15
|
+
:accept="$props.accept"
|
|
16
|
+
@input="onInput"
|
|
17
|
+
/>
|
|
18
|
+
</form>
|
|
19
|
+
</div>
|
|
20
|
+
</template>
|
|
21
|
+
|
|
22
|
+
<script lang="ts">
|
|
23
|
+
import { defineComponent, ref } from "vue";
|
|
24
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
25
|
+
|
|
26
|
+
import FSButton from "../FSButton.vue";
|
|
27
|
+
|
|
28
|
+
export default defineComponent({
|
|
29
|
+
name: "FSButtonFileIcon",
|
|
30
|
+
components: {
|
|
31
|
+
FSButton
|
|
32
|
+
},
|
|
33
|
+
props: {
|
|
34
|
+
accept: {
|
|
35
|
+
type: String,
|
|
36
|
+
required: false,
|
|
37
|
+
default: "",
|
|
38
|
+
},
|
|
39
|
+
readFile: {
|
|
40
|
+
type: Boolean,
|
|
41
|
+
required: false,
|
|
42
|
+
default: true,
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
emits: ["update:modelValue"],
|
|
46
|
+
setup(props, { emit }) {
|
|
47
|
+
const input = ref(null);
|
|
48
|
+
|
|
49
|
+
const clear = () => {
|
|
50
|
+
input.value!.form && input.value!.form.reset();
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const onClick = () => {
|
|
54
|
+
input.value!.click();
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
const onInput = () => {
|
|
58
|
+
const file = input.value!.files && input.value!.files[0];
|
|
59
|
+
if (!file) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (!props.readFile) {
|
|
63
|
+
emit("update:modelValue", file);
|
|
64
|
+
clear();
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
const reader = new FileReader();
|
|
68
|
+
reader.addEventListener("load", (fileEv) => {
|
|
69
|
+
emit("update:modelValue", fileEv.target && fileEv.target.result);
|
|
70
|
+
clear();
|
|
71
|
+
});
|
|
72
|
+
reader.readAsDataURL(file);
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
return {
|
|
77
|
+
ColorEnum,
|
|
78
|
+
input,
|
|
79
|
+
onClick,
|
|
80
|
+
onInput
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
</script>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<FSButton
|
|
4
|
+
:label="$tr('ui.button.import-file', 'Import file')"
|
|
5
|
+
:color="ColorEnum.Light"
|
|
6
|
+
@click="onClick"
|
|
7
|
+
v-bind="$attrs"
|
|
8
|
+
/>
|
|
9
|
+
<form>
|
|
10
|
+
<input
|
|
11
|
+
v-show="false"
|
|
12
|
+
type="file"
|
|
13
|
+
ref="input"
|
|
14
|
+
:accept="$props.accept"
|
|
15
|
+
@input="onInput"
|
|
16
|
+
/>
|
|
17
|
+
</form>
|
|
18
|
+
</div>
|
|
19
|
+
</template>
|
|
20
|
+
|
|
21
|
+
<script lang="ts">
|
|
22
|
+
import { defineComponent, ref } from "vue";
|
|
23
|
+
import { ColorEnum } from "@dative-gpi/foundation-shared-components/models";
|
|
24
|
+
|
|
25
|
+
import FSButton from "../FSButton.vue";
|
|
26
|
+
|
|
27
|
+
export default defineComponent({
|
|
28
|
+
name: "FSButtonFileLabel",
|
|
29
|
+
components: {
|
|
30
|
+
FSButton
|
|
31
|
+
},
|
|
32
|
+
props: {
|
|
33
|
+
accept: {
|
|
34
|
+
type: String,
|
|
35
|
+
required: false,
|
|
36
|
+
default: "",
|
|
37
|
+
},
|
|
38
|
+
readFile: {
|
|
39
|
+
type: Boolean,
|
|
40
|
+
required: false,
|
|
41
|
+
default: true,
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
emits: ["update:modelValue"],
|
|
45
|
+
setup(props, { emit }) {
|
|
46
|
+
const input = ref(null);
|
|
47
|
+
|
|
48
|
+
const clear = () => {
|
|
49
|
+
input.value!.form && input.value!.form.reset();
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const onClick = () => {
|
|
53
|
+
input.value!.click();
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const onInput = () => {
|
|
57
|
+
const file = input.value!.files && input.value!.files[0];
|
|
58
|
+
if (!file) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
if (!props.readFile) {
|
|
62
|
+
emit("update:modelValue", file);
|
|
63
|
+
clear();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const reader = new FileReader();
|
|
67
|
+
reader.addEventListener("load", (fileEv) => {
|
|
68
|
+
emit("update:modelValue", fileEv.target && fileEv.target.result);
|
|
69
|
+
clear();
|
|
70
|
+
});
|
|
71
|
+
reader.readAsDataURL(file);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
ColorEnum,
|
|
77
|
+
input,
|
|
78
|
+
onClick,
|
|
79
|
+
onInput
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
</script>
|