@bagelink/vue 0.0.164 → 0.0.170
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/dist/components/DataPreview.vue.d.ts +3 -19
- package/dist/components/DataPreview.vue.d.ts.map +1 -1
- package/dist/components/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/FormSchema.vue.d.ts +3 -19
- package/dist/components/FormSchema.vue.d.ts.map +1 -1
- package/dist/components/PersonPreview.vue.d.ts +1 -1
- package/dist/components/PersonPreview.vue.d.ts.map +1 -1
- package/dist/components/TabbedLayout.vue.d.ts +1 -1
- package/dist/components/TabbedLayout.vue.d.ts.map +1 -1
- package/dist/components/formkit/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/formkit/index.d.ts +10 -8
- package/dist/components/formkit/index.d.ts.map +1 -1
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/index.cjs +206 -349
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +206 -349
- package/dist/plugins/bagel.d.ts +3 -0
- package/dist/plugins/bagel.d.ts.map +1 -1
- package/dist/style.css +227 -323
- package/package.json +1 -1
- package/src/components/DataPreview.vue +5 -6
- package/src/components/FormSchema.vue +7 -10
- package/src/components/PersonPreview.vue +147 -123
- package/src/components/TabbedLayout.vue +50 -59
- package/src/components/form/inputs/Checkbox.vue +1 -1
- package/src/components/formkit/FileUploader.vue +264 -254
- package/src/components/formkit/index.ts +10 -8
- package/src/components/index.ts +0 -1
- package/src/index.ts +1 -1
- package/src/plugins/bagel.ts +17 -1
- package/src/styles/dark.css +79 -21
- package/src/styles/inputs.css +4 -9
- package/src/styles/theme.css +6 -0
- package/src/components/FileUploader.vue +0 -345
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createInput } from '@formkit/vue';
|
|
2
|
+
import type { FormKitTypeDefinition } from '@formkit/core';
|
|
2
3
|
import ContactArrayFormKit from './ContactArrayFormKit.vue';
|
|
3
4
|
import AddressArray from './AddressArray.vue';
|
|
4
5
|
import BankDetailsArray from './BankDetailsArray.vue';
|
|
@@ -8,14 +9,14 @@ import FileUploader from './FileUploader.vue';
|
|
|
8
9
|
import PPV from '../PersonPreviewFormkit.vue';
|
|
9
10
|
import TextVariableExamples from '../whatsapp/form/TextVariableExamples.vue';
|
|
10
11
|
|
|
11
|
-
const ContactArrayInput = createInput(ContactArrayFormKit);
|
|
12
|
-
const AddressInput = createInput(AddressArray);
|
|
13
|
-
const BankDetailsInput = createInput(BankDetailsArray);
|
|
14
|
-
const MiscFieldsInput = createInput(MiscFieldsBtns);
|
|
15
|
-
const ToggleSwitchInput = createInput(Toggle);
|
|
16
|
-
const FileUploadInput = createInput(FileUploader);
|
|
17
|
-
const TextVariablesInput = createInput(TextVariableExamples);
|
|
18
|
-
const PersonPreviewInput = createInput(PPV);
|
|
12
|
+
const ContactArrayInput: FormKitTypeDefinition = createInput(ContactArrayFormKit);
|
|
13
|
+
const AddressInput: FormKitTypeDefinition = createInput(AddressArray);
|
|
14
|
+
const BankDetailsInput: FormKitTypeDefinition = createInput(BankDetailsArray);
|
|
15
|
+
const MiscFieldsInput: FormKitTypeDefinition = createInput(MiscFieldsBtns);
|
|
16
|
+
const ToggleSwitchInput: FormKitTypeDefinition = createInput(Toggle);
|
|
17
|
+
const FileUploadInput: FormKitTypeDefinition = createInput(FileUploader);
|
|
18
|
+
const TextVariablesInput: FormKitTypeDefinition = createInput(TextVariableExamples);
|
|
19
|
+
const PersonPreviewInput: FormKitTypeDefinition = createInput(PPV);
|
|
19
20
|
|
|
20
21
|
export {
|
|
21
22
|
TextVariablesInput,
|
|
@@ -28,6 +29,7 @@ export {
|
|
|
28
29
|
FileUploadInput,
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
export { default as FileUploader } from './FileUploader.vue';
|
|
31
33
|
export type { BankDetailsContext } from './BankDetailsArray.vue';
|
|
32
34
|
export type { AddressArrContext } from './AddressArray.vue';
|
|
33
35
|
export type { ContactArrContext } from './ContactArrayFormKit.vue';
|
package/src/components/index.ts
CHANGED
|
@@ -18,7 +18,6 @@ export { default as RouterWrapper } from './RouterWrapper.vue';
|
|
|
18
18
|
export { default as ContactSubmissions } from './ContactSubmissions.vue';
|
|
19
19
|
export { default as PersonPreview } from './PersonPreview.vue';
|
|
20
20
|
export { default as DataPreview } from './DataPreview.vue';
|
|
21
|
-
export { default as FileUploader } from './FileUploader.vue';
|
|
22
21
|
|
|
23
22
|
export * from './charts';
|
|
24
23
|
export * from './formkit';
|
package/src/index.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export {
|
|
2
|
-
BagelVue, type BagelOptions, bagelInjectionKey, useBagel,
|
|
2
|
+
BagelVue, type BagelOptions, bagelInjectionKey, useBagel, useI18nT, i18nTInjectionKey,
|
|
3
3
|
} from './plugins/bagel';
|
|
4
4
|
export { ModalPlugin, useModal } from './plugins/modal';
|
|
5
5
|
export * from './utils';
|
package/src/plugins/bagel.ts
CHANGED
|
@@ -3,6 +3,10 @@ import type { InjectionKey, Plugin } from 'vue';
|
|
|
3
3
|
import { Bagel } from '@bagelink/sdk';
|
|
4
4
|
|
|
5
5
|
export const bagelInjectionKey = Symbol('bagel') as InjectionKey<Bagel>;
|
|
6
|
+
export const i18nTInjectionKey = Symbol('bagel') as InjectionKey<
|
|
7
|
+
// eslint-disable-next-line no-unused-vars
|
|
8
|
+
(key: string) => string
|
|
9
|
+
>;
|
|
6
10
|
|
|
7
11
|
export function useBagel() {
|
|
8
12
|
const bagel = inject(bagelInjectionKey);
|
|
@@ -11,16 +15,28 @@ export function useBagel() {
|
|
|
11
15
|
return bagel;
|
|
12
16
|
}
|
|
13
17
|
|
|
18
|
+
export function useI18nT() {
|
|
19
|
+
const i18nT = inject(i18nTInjectionKey);
|
|
20
|
+
if (!i18nT) throw new Error('No i18nT provided');
|
|
21
|
+
|
|
22
|
+
return i18nT;
|
|
23
|
+
}
|
|
24
|
+
|
|
14
25
|
export interface BagelOptions {
|
|
15
26
|
host: string
|
|
16
27
|
// eslint-disable-next-line no-unused-vars
|
|
17
|
-
onError?: (err: Error) => void
|
|
28
|
+
onError?: (err: Error) => void,
|
|
29
|
+
// eslint-disable-next-line no-unused-vars
|
|
30
|
+
i18nT?: (key: string) => string
|
|
18
31
|
}
|
|
19
32
|
|
|
20
33
|
export const BagelVue: Plugin = {
|
|
21
34
|
install: (app, options: BagelOptions) => {
|
|
22
35
|
const bagel = new Bagel({ host: options.host, onError: options.onError });
|
|
36
|
+
|
|
23
37
|
app.config.globalProperties.$bagel = bagel;
|
|
24
38
|
app.provide(bagelInjectionKey, bagel);
|
|
39
|
+
app.config.globalProperties.$i18T = options?.i18nT || ((key: string) => key);
|
|
40
|
+
app.provide(i18nTInjectionKey, options?.i18nT || ((key: string) => key));
|
|
25
41
|
},
|
|
26
42
|
};
|
package/src/styles/dark.css
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
[theme="dark"] {
|
|
2
|
-
--bgl-
|
|
3
|
-
--bgl-
|
|
4
|
-
|
|
2
|
+
--bgl-primary: #1c4fe1;
|
|
3
|
+
--bgl-primary-tint: #1c4fe180;
|
|
4
|
+
|
|
5
|
+
/* --bgl-blue-20: rgba(46, 91, 255, 20%); */
|
|
6
|
+
/* --bgl-blue-dark: #191c30; */
|
|
7
|
+
--bgl-blue-light: #34363b;
|
|
5
8
|
--bgl-black: #dbdcdc;
|
|
6
|
-
--bgl-black-tint: #
|
|
7
|
-
--bgl-white:
|
|
8
|
-
--bgl-gray: #
|
|
9
|
-
--bgl-gray-light: #
|
|
9
|
+
--bgl-black-tint: #7a7a7a;
|
|
10
|
+
--bgl-white: rgb(41, 42, 45);
|
|
11
|
+
--bgl-gray: #7f7d7d;
|
|
12
|
+
--bgl-gray-light: #191b1c;
|
|
10
13
|
--bgl-gray-80: #e8ecef;
|
|
11
14
|
--bgl-gray-20: rgba(183, 183, 183, 0.2);
|
|
12
15
|
--bgl-pink: #f1416c;
|
|
@@ -15,32 +18,87 @@
|
|
|
15
18
|
--bgl-yellow: #ffbb00;
|
|
16
19
|
--bgl-yellow-light: #fff6d5;
|
|
17
20
|
--bgl-green: #52875b;
|
|
18
|
-
--border-color: #
|
|
19
|
-
--bgl-bg: #
|
|
21
|
+
--border-color: #383a3f;
|
|
22
|
+
--bgl-bg: #121317;
|
|
20
23
|
--bgl-shadow: #4c577d26;
|
|
21
|
-
--input-bg: #
|
|
22
|
-
--input-color: #
|
|
23
|
-
--label-color: #
|
|
24
|
-
--placeholder-color: #
|
|
25
|
-
|
|
26
|
-
--bgl-hover-filter: brightness(
|
|
27
|
-
--bgl-active-filter: brightness(
|
|
24
|
+
--input-bg: #1d2023;
|
|
25
|
+
--input-color: #d3d4d4;
|
|
26
|
+
--label-color: #d3d4d480;
|
|
27
|
+
--placeholder-color: #ccd4dd60;
|
|
28
|
+
|
|
29
|
+
--bgl-hover-filter: brightness(130%);
|
|
30
|
+
--bgl-active-filter: brightness(110%);
|
|
28
31
|
}
|
|
29
32
|
|
|
30
33
|
[theme="dark"] .formkit-outer input:focus-visible,
|
|
31
34
|
[theme="dark"] .formkit-outer select:focus-visible,
|
|
32
35
|
[theme="dark"] .formkit-outer textarea:focus-visible,
|
|
33
|
-
.input.active
|
|
36
|
+
[theme="dark"] .input.active,
|
|
37
|
+
[theme="dark"] .bagel-input input:focus-visible,
|
|
38
|
+
[theme="dark"] .bagel-input select:focus-visible,
|
|
39
|
+
[theme="dark"] .bagel-input textarea:focus-visible {
|
|
34
40
|
outline: none;
|
|
35
|
-
box-shadow: inset 0 0 10px
|
|
41
|
+
box-shadow: inset 0 0 10px var(--bgl-bg);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
[theme="dark"] .formkit-outer select {
|
|
45
|
+
background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
|
|
36
46
|
}
|
|
37
47
|
|
|
38
48
|
/* use this is to override the nav color */
|
|
39
49
|
[theme="dark"] .nav {
|
|
40
|
-
|
|
41
|
-
|
|
50
|
+
color: var(--bgl-black) !important;
|
|
51
|
+
background: transparent;
|
|
52
|
+
border-radius: 0 !important;
|
|
53
|
+
border-inline-end: 1px solid var(--bgl-gray-20);
|
|
54
|
+
margin-top: 0 !important;
|
|
55
|
+
margin-bottom: 0 !important;
|
|
56
|
+
margin-inline-start: 0 !important;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
[theme="dark"] .nav * {
|
|
60
|
+
color: var(--bgl-black) !important;
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
[theme="dark"] .dropdown-project-head {
|
|
65
|
+
background: var(--bgl-bg) !important;
|
|
66
|
+
color: var(--bgl-white) !important;
|
|
42
67
|
}
|
|
43
68
|
|
|
44
|
-
[theme="dark"]
|
|
69
|
+
[theme="dark"] .dropdown-project-body {
|
|
70
|
+
color: var(--bgl-black-tint) !important;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* until here */
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
[theme="dark"] input::-webkit-calendar-picker-indicator {
|
|
45
77
|
filter: invert(48%);
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
[theme="dark"] ::selection {
|
|
81
|
+
color: var(--bgl-black);
|
|
82
|
+
background: var(--bgl-primary-tint);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
[theme="dark"] .whatsapp-msg {
|
|
86
|
+
color: var(--bgl-gray-light);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
[theme="dark"] button.formkit-input,
|
|
90
|
+
[theme="dark"] .btn,
|
|
91
|
+
[theme="dark"] .btn-icon,
|
|
92
|
+
[theme="dark"] .primary-checkbox input:checked+span,
|
|
93
|
+
[theme="dark"] .btn.light {
|
|
94
|
+
color: var(--bgl-black);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
[theme="dark"] .bagel-input.checkbox.check .slider:before {
|
|
99
|
+
color: var(--bgl-black) !important;
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
[theme="dark"] .nav-expend {
|
|
103
|
+
top: 67px;
|
|
46
104
|
}
|
package/src/styles/inputs.css
CHANGED
|
@@ -91,14 +91,6 @@ select {
|
|
|
91
91
|
width: fit-content;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
.bagel-input input:focus-visible,
|
|
95
|
-
.bagel-input select:focus-visible,
|
|
96
|
-
.bagel-input textarea:focus-visible,
|
|
97
|
-
.input.active {
|
|
98
|
-
outline: none;
|
|
99
|
-
box-shadow: inset 0 0 10px #00000012;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
94
|
.bagel-input:focus-within label {
|
|
103
95
|
color: var(--bgl-primary);
|
|
104
96
|
}
|
|
@@ -262,7 +254,10 @@ button.formkit-input:active {
|
|
|
262
254
|
.formkit-outer input:focus-visible,
|
|
263
255
|
.formkit-outer select:focus-visible,
|
|
264
256
|
.formkit-outer textarea:focus-visible,
|
|
265
|
-
.input.active
|
|
257
|
+
.input.active,
|
|
258
|
+
.bagel-input input:focus-visible,
|
|
259
|
+
.bagel-input select:focus-visible,
|
|
260
|
+
.bagel-input textarea:focus-visible {
|
|
266
261
|
outline: none;
|
|
267
262
|
box-shadow: inset 0 0 10px #00000012;
|
|
268
263
|
}
|
package/src/styles/theme.css
CHANGED
|
@@ -85,6 +85,7 @@
|
|
|
85
85
|
margin-top: 0;
|
|
86
86
|
margin-bottom: 20px;
|
|
87
87
|
width: 100%;
|
|
88
|
+
padding-inline-end: 40px;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
.modal-footer {
|
|
@@ -450,6 +451,11 @@ body {
|
|
|
450
451
|
inset-inline-start: 0;
|
|
451
452
|
}
|
|
452
453
|
|
|
454
|
+
.DonationsDashbored .tabs {
|
|
455
|
+
border-bottom: 1px solid var(--border-color);
|
|
456
|
+
border-top: none;
|
|
457
|
+
}
|
|
458
|
+
|
|
453
459
|
.copy-url {
|
|
454
460
|
background-color: var(--bgl-gray-light);
|
|
455
461
|
border-radius: var(--btn-border-radius);
|
|
@@ -1,345 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="files-wrapper flex">
|
|
3
|
-
<div
|
|
4
|
-
ref="dropZoneEl"
|
|
5
|
-
class="drop-zone flex-grow"
|
|
6
|
-
@click="openFileDialog"
|
|
7
|
-
@dragenter="draggingOver = true"
|
|
8
|
-
@drop.prevent.stop="onDrop"
|
|
9
|
-
>
|
|
10
|
-
<Transition name="pop">
|
|
11
|
-
<div ref="dropCircle" v-if="draggingOver" class="drop-circle" />
|
|
12
|
-
</Transition>
|
|
13
|
-
<div class="img-label">
|
|
14
|
-
<p>
|
|
15
|
-
{{ dragDropLabel }} <span>{{ browseLabel }}</span>
|
|
16
|
-
</p>
|
|
17
|
-
</div>
|
|
18
|
-
<div class="uploading-wrap">
|
|
19
|
-
<div
|
|
20
|
-
v-for="(item, index) in files"
|
|
21
|
-
:class="{ uploading: item.uploading }"
|
|
22
|
-
:key="index"
|
|
23
|
-
>
|
|
24
|
-
<div class="load-file-bar">
|
|
25
|
-
<p>{{ item.file.name }}</p>
|
|
26
|
-
<div class="pie" :style="`--p:${item.progress}`" style="--b: 2px">
|
|
27
|
-
<span>{{ `${item.progress}` }}</span>
|
|
28
|
-
</div>
|
|
29
|
-
</div>
|
|
30
|
-
</div>
|
|
31
|
-
</div>
|
|
32
|
-
</div>
|
|
33
|
-
<input
|
|
34
|
-
class="file-input"
|
|
35
|
-
type="file"
|
|
36
|
-
@change="handleFileInput"
|
|
37
|
-
ref="fileInputEl"
|
|
38
|
-
:multiple="!singleFile"
|
|
39
|
-
/>
|
|
40
|
-
</div>
|
|
41
|
-
</template>
|
|
42
|
-
|
|
43
|
-
<script setup lang="ts">
|
|
44
|
-
import { ref, onMounted, onUnmounted } from "vue";
|
|
45
|
-
import { useBagel } from "..";
|
|
46
|
-
|
|
47
|
-
const bagel = useBagel();
|
|
48
|
-
|
|
49
|
-
const draggingOver = ref(false);
|
|
50
|
-
const dropCircle = ref<HTMLElement>();
|
|
51
|
-
const dropZoneEl = ref<HTMLElement>();
|
|
52
|
-
const fileInputEl = ref<HTMLInputElement>();
|
|
53
|
-
const circleTop = ref("0");
|
|
54
|
-
const circleLeft = ref("0");
|
|
55
|
-
const files = ref<
|
|
56
|
-
{
|
|
57
|
-
progress: string;
|
|
58
|
-
uploading: boolean;
|
|
59
|
-
uid: string;
|
|
60
|
-
file: File;
|
|
61
|
-
}[]
|
|
62
|
-
>([]);
|
|
63
|
-
const props = withDefaults(
|
|
64
|
-
defineProps<{
|
|
65
|
-
id?: string;
|
|
66
|
-
// folder?: string,
|
|
67
|
-
private?: 1 | 0;
|
|
68
|
-
singleFile?: boolean;
|
|
69
|
-
beforeUpload?: () => Promise<any>;
|
|
70
|
-
dragDropLabel?: string;
|
|
71
|
-
browseLabel?: string;
|
|
72
|
-
}>(),
|
|
73
|
-
{
|
|
74
|
-
private: 0,
|
|
75
|
-
entity: "",
|
|
76
|
-
id: "",
|
|
77
|
-
beforeUpload: async () => {},
|
|
78
|
-
dragDropLabel: "Drag and drop your files here",
|
|
79
|
-
browseLabel: "Browse",
|
|
80
|
-
}
|
|
81
|
-
);
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* Drag and drop
|
|
85
|
-
*/
|
|
86
|
-
|
|
87
|
-
function openFileDialog() {
|
|
88
|
-
fileInputEl.value?.click();
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
function onDragOver(e: DragEvent) {
|
|
92
|
-
if (!draggingOver.value) return;
|
|
93
|
-
// set the position of the circle to the cursor
|
|
94
|
-
const parentEl = dropZoneEl.value?.getBoundingClientRect?.() || {
|
|
95
|
-
left: 0,
|
|
96
|
-
top: 0,
|
|
97
|
-
width: 0,
|
|
98
|
-
height: 0,
|
|
99
|
-
};
|
|
100
|
-
const x = e.clientX - parentEl.left;
|
|
101
|
-
const y = e.clientY - parentEl.top;
|
|
102
|
-
circleLeft.value = `${x}px`;
|
|
103
|
-
circleTop.value = `${y}px`;
|
|
104
|
-
// if the cursor is outside the dropzone, hide the circle
|
|
105
|
-
if (x < 0 || x > parentEl.width || y < 0 || y > parentEl.height) {
|
|
106
|
-
draggingOver.value = false;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function handleFileInput(e: Event) {
|
|
111
|
-
const filesToAdd: FileList = (e.target as any).files;
|
|
112
|
-
addFiles(filesToAdd);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function preventDefaults(e: Event) {
|
|
116
|
-
e.preventDefault();
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
function hideCircle(e: DragEvent) {
|
|
120
|
-
console.log({ e });
|
|
121
|
-
|
|
122
|
-
draggingOver.value = false;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
const events = ["dragenter", "dragover", "dragleave", "drop"];
|
|
126
|
-
|
|
127
|
-
onMounted(() => {
|
|
128
|
-
events.forEach((event) => {
|
|
129
|
-
document.addEventListener(event, preventDefaults);
|
|
130
|
-
});
|
|
131
|
-
document.addEventListener("dragover", onDragOver);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
onUnmounted(() => {
|
|
135
|
-
document.removeEventListener("dragover", onDragOver);
|
|
136
|
-
events.forEach((event) => {
|
|
137
|
-
document.removeEventListener(event, preventDefaults);
|
|
138
|
-
});
|
|
139
|
-
});
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* managing files
|
|
143
|
-
*/
|
|
144
|
-
|
|
145
|
-
function addFiles(addedFiles: FileList) {
|
|
146
|
-
if (props.singleFile && files.value.length > 1) return;
|
|
147
|
-
for (let i = 0; i < addedFiles.length; i++) {
|
|
148
|
-
files.value.push({
|
|
149
|
-
file: addedFiles[i],
|
|
150
|
-
uid: Math.random().toString(36).substring(2, 9),
|
|
151
|
-
progress: "",
|
|
152
|
-
uploading: false,
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
uploadFiles();
|
|
156
|
-
}
|
|
157
|
-
|
|
158
|
-
/**
|
|
159
|
-
*
|
|
160
|
-
*
|
|
161
|
-
*/
|
|
162
|
-
const emit = defineEmits(["complete", "done"]);
|
|
163
|
-
|
|
164
|
-
/**
|
|
165
|
-
*
|
|
166
|
-
* server stuff
|
|
167
|
-
*/
|
|
168
|
-
|
|
169
|
-
function uploadFiles() {
|
|
170
|
-
files.value.forEach((item) => {
|
|
171
|
-
item.uploading = true;
|
|
172
|
-
/// TODO upload file
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// function updateProgress(e: ProgressEvent, uid: string) {
|
|
177
|
-
// files.value.find((item) => item.uid === uid).progress = (
|
|
178
|
-
// (e.loaded / e.total)
|
|
179
|
-
// * 100
|
|
180
|
-
// ).toFixed(0);
|
|
181
|
-
// }
|
|
182
|
-
|
|
183
|
-
// function uploadCompleteCallback(file: any, uid: string) {
|
|
184
|
-
// files.value.forEach((item, index) => {
|
|
185
|
-
// if (item.uid === uid) {
|
|
186
|
-
// files.value.splice(index, 1);
|
|
187
|
-
// }
|
|
188
|
-
// });
|
|
189
|
-
// emit('complete', file);
|
|
190
|
-
// if (files.value.length === 0) {
|
|
191
|
-
// fileInputEl.value.value = '';
|
|
192
|
-
// emit('done');
|
|
193
|
-
// }
|
|
194
|
-
// }
|
|
195
|
-
|
|
196
|
-
async function onDrop(e: DragEvent) {
|
|
197
|
-
hideCircle(e);
|
|
198
|
-
preventDefaults(e);
|
|
199
|
-
const filesToAdd = e.dataTransfer?.files;
|
|
200
|
-
if (filesToAdd) {
|
|
201
|
-
addFiles(filesToAdd);
|
|
202
|
-
const file = await bagel.uploadFile(filesToAdd[0]);
|
|
203
|
-
emit("complete", file);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
</script>
|
|
207
|
-
<style>
|
|
208
|
-
/* .uploading-wrap {
|
|
209
|
-
width: 100%;
|
|
210
|
-
} */
|
|
211
|
-
|
|
212
|
-
/* .uploading {
|
|
213
|
-
margin: 0.5rem;
|
|
214
|
-
} */
|
|
215
|
-
|
|
216
|
-
/* .img-label .icon-font {
|
|
217
|
-
font-size: 30px;
|
|
218
|
-
margin-bottom: 10px;
|
|
219
|
-
} */
|
|
220
|
-
|
|
221
|
-
/* .img-label span {
|
|
222
|
-
text-decoration: underline;
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
.file-input {
|
|
226
|
-
display: none;
|
|
227
|
-
} */
|
|
228
|
-
|
|
229
|
-
.files-wrapper {
|
|
230
|
-
/* flex-direction: column;
|
|
231
|
-
border-radius: 10px; */
|
|
232
|
-
/*overflow: hidden;*/
|
|
233
|
-
/* min-height: 100px;
|
|
234
|
-
font-size: var(--input-font-size); */
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
.drop-zone {
|
|
238
|
-
/* background-color: var(--bgl-bg);
|
|
239
|
-
height: 100%;
|
|
240
|
-
width: 100%;
|
|
241
|
-
flex-grow: 1;
|
|
242
|
-
position: relative;
|
|
243
|
-
overflow: hidden;
|
|
244
|
-
cursor: pointer;
|
|
245
|
-
transition: var(--bgl-transition);
|
|
246
|
-
outline: dashed 1px var(--bgl-black-tint);
|
|
247
|
-
border-radius: 10px;
|
|
248
|
-
padding: 1px;
|
|
249
|
-
display: flex;
|
|
250
|
-
flex-direction: column;
|
|
251
|
-
align-items: center;
|
|
252
|
-
justify-content: center;
|
|
253
|
-
color: var(--input-color); */
|
|
254
|
-
}
|
|
255
|
-
|
|
256
|
-
.drop-zone:hover {
|
|
257
|
-
/* color: var(--bgl-primary);
|
|
258
|
-
outline: dashed 1px var(--bgl-primary-tint); */
|
|
259
|
-
}
|
|
260
|
-
|
|
261
|
-
.drop-circle {
|
|
262
|
-
/* pointer-events: none;
|
|
263
|
-
position: absolute;
|
|
264
|
-
width: 100px;
|
|
265
|
-
height: 100px;
|
|
266
|
-
border-radius: 50%;
|
|
267
|
-
background-color: var(--bgl-primary-tint);
|
|
268
|
-
display: flex;
|
|
269
|
-
top: v-bind(circleTop);
|
|
270
|
-
left: v-bind(circleLeft);
|
|
271
|
-
transform: translate(-50%, -50%) scale(1);
|
|
272
|
-
transform-origin: left top; */
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
/* .drop-circle.active {
|
|
276
|
-
color: red;
|
|
277
|
-
background-color: black;
|
|
278
|
-
transform: translate(-50%, -50%) scale(1);
|
|
279
|
-
transition: transform 0.2s ease-in-out;
|
|
280
|
-
} */
|
|
281
|
-
.load-file-bar {
|
|
282
|
-
/* display: flex;
|
|
283
|
-
align-items: center;
|
|
284
|
-
justify-content: space-between;
|
|
285
|
-
background: var(--bgl-white);
|
|
286
|
-
border-radius: var(--btn-border-radius);
|
|
287
|
-
width: 100%;
|
|
288
|
-
color: var(--input-color);
|
|
289
|
-
height: var(--btn-height);
|
|
290
|
-
padding: 0.5rem;
|
|
291
|
-
box-shadow: 0 1px 2px 0 rgb(0 0 0 / 10%);
|
|
292
|
-
white-space: nowrap; */
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
.load-file-bar p {
|
|
296
|
-
/* width: calc(100% - 40px);
|
|
297
|
-
overflow: hidden;
|
|
298
|
-
text-overflow: ellipsis; */
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
.load-file-bar span {
|
|
302
|
-
/* font-size: 10px; */
|
|
303
|
-
}
|
|
304
|
-
|
|
305
|
-
.pie {
|
|
306
|
-
/* width: 30px;
|
|
307
|
-
height: 30px;
|
|
308
|
-
position: relative;
|
|
309
|
-
display: flex;
|
|
310
|
-
align-items: center;
|
|
311
|
-
justify-content: center; */
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
/* .pie:before {
|
|
315
|
-
content: '';
|
|
316
|
-
position: absolute;
|
|
317
|
-
border-radius: 50%;
|
|
318
|
-
inset: 0;
|
|
319
|
-
background: conic-gradient(var(--bgl-primary) calc(var(--p) * 1%), #0000 0);
|
|
320
|
-
-webkit-mask: radial-gradient(
|
|
321
|
-
farthest-side,
|
|
322
|
-
#0000 calc(99% - var(--b)),
|
|
323
|
-
#000 calc(100% - var(--b))
|
|
324
|
-
);
|
|
325
|
-
mask: radial-gradient(
|
|
326
|
-
farthest-side,
|
|
327
|
-
#0000 calc(99% - var(--b)),
|
|
328
|
-
#000 calc(100% - var(--b))
|
|
329
|
-
);
|
|
330
|
-
} */
|
|
331
|
-
</style>
|
|
332
|
-
<style>
|
|
333
|
-
/* .pop-enter-active {
|
|
334
|
-
transition: scale 0.2s cubic-bezier(0.55, 0, 0.1, 1);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.pop-leave-active {
|
|
338
|
-
transition: scale 0.2s cubic-bezier(0.55, 0, 0.1, 1);
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
.pop-enter-from,
|
|
342
|
-
.pop-leave-to {
|
|
343
|
-
scale: 0;
|
|
344
|
-
} */
|
|
345
|
-
</style>
|