@bagelink/vue 0.0.160 → 0.0.162
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/Btn.vue.d.ts +2 -2
- package/dist/components/Btn.vue.d.ts.map +1 -1
- package/dist/components/Comments.vue.d.ts.map +1 -1
- package/dist/components/DropDown.vue.d.ts.map +1 -1
- package/dist/components/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/LangText.vue.d.ts.map +1 -1
- package/dist/components/NavBar.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/PersonPreviewFormkit.vue.d.ts +1 -1
- package/dist/components/PersonPreviewFormkit.vue.d.ts.map +1 -1
- package/dist/components/RTXEditor.vue.d.ts.map +1 -1
- package/dist/components/TableSchema.vue.d.ts.map +1 -1
- package/dist/components/charts/BarChart.vue.d.ts.map +1 -1
- package/dist/components/dashboard/Lineart.vue.d.ts +1 -1
- package/dist/components/dashboard/Lineart.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/CheckInput.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/Checkbox.vue.d.ts.map +1 -1
- package/dist/components/form/inputs/PasswordInput.vue.d.ts.map +1 -1
- package/dist/components/formkit/AddressArray.vue.d.ts.map +1 -1
- package/dist/components/formkit/BankDetailsArray.vue.d.ts.map +1 -1
- package/dist/components/formkit/ContactArrayFormKit.vue.d.ts.map +1 -1
- package/dist/components/formkit/FileUploader.vue.d.ts.map +1 -1
- package/dist/components/formkit/MiscFields.vue.d.ts.map +1 -1
- package/dist/index.cjs +60 -49
- package/dist/index.mjs +60 -49
- package/dist/style.css +1468 -1402
- package/package.json +1 -1
- package/src/components/Btn.vue +127 -132
- package/src/components/Comments.vue +155 -169
- package/src/components/DropDown.vue +73 -77
- package/src/components/FileUploader.vue +133 -141
- package/src/components/FormKitTable.vue +191 -205
- package/src/components/LangText.vue +14 -14
- package/src/components/NavBar.vue +264 -261
- package/src/components/PersonPreview.vue +123 -148
- package/src/components/PersonPreviewFormkit.vue +124 -148
- package/src/components/RTXEditor.vue +91 -91
- package/src/components/TableSchema.vue +150 -156
- package/src/components/charts/BarChart.vue +212 -227
- package/src/components/dashboard/Lineart.vue +117 -130
- package/src/components/form/inputs/CheckInput.vue +90 -90
- package/src/components/form/inputs/Checkbox.vue +38 -41
- package/src/components/form/inputs/PasswordInput.vue +56 -63
- package/src/components/formkit/AddressArray.vue +150 -173
- package/src/components/formkit/BankDetailsArray.vue +175 -198
- package/src/components/formkit/ContactArrayFormKit.vue +124 -142
- package/src/components/formkit/FileUploader.vue +256 -260
- package/src/components/formkit/MiscFields.vue +42 -42
- package/src/components/formkit/Toggle.vue +97 -97
- package/src/styles/bagel.css +1 -0
- package/src/styles/buttons.css +5 -0
- package/src/styles/dark.css +46 -0
- package/src/styles/fonts/Ploni.css +8 -8
- package/src/styles/inputs.css +57 -13
- package/src/styles/layout.css +43 -0
- package/src/styles/text.css +83 -10
- package/src/styles/theme.css +25 -155
- package/src/styles/fonts/Ploni/ploni-black.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-black.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-black.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-bold.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-bold.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-bold.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-demibold.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-demibold.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-demibold.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-light.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-light.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-light.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-medium.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-medium.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-medium.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-regular.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-regular.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-regular.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-ultrabold.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-ultrabold.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-ultrabold.woff2 +0 -0
- package/src/styles/fonts/Ploni/ploni-ultralight.eot +0 -0
- package/src/styles/fonts/Ploni/ploni-ultralight.woff +0 -0
- package/src/styles/fonts/Ploni/ploni-ultralight.woff2 +0 -0
|
@@ -1,56 +1,48 @@
|
|
|
1
1
|
<template>
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
<input
|
|
42
|
-
class="file-input"
|
|
43
|
-
type="file"
|
|
44
|
-
@change="handleFileInput"
|
|
45
|
-
ref="fileInputEl"
|
|
46
|
-
:multiple="!singleFile"
|
|
47
|
-
>
|
|
48
|
-
</div>
|
|
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>
|
|
49
41
|
</template>
|
|
50
42
|
|
|
51
43
|
<script setup lang="ts">
|
|
52
|
-
import { ref, onMounted, onUnmounted } from
|
|
53
|
-
import { useBagel } from
|
|
44
|
+
import { ref, onMounted, onUnmounted } from "vue";
|
|
45
|
+
import { useBagel } from "..";
|
|
54
46
|
|
|
55
47
|
const bagel = useBagel();
|
|
56
48
|
|
|
@@ -58,34 +50,34 @@ const draggingOver = ref(false);
|
|
|
58
50
|
const dropCircle = ref<HTMLElement>();
|
|
59
51
|
const dropZoneEl = ref<HTMLElement>();
|
|
60
52
|
const fileInputEl = ref<HTMLInputElement>();
|
|
61
|
-
const circleTop = ref(
|
|
62
|
-
const circleLeft = ref(
|
|
53
|
+
const circleTop = ref("0");
|
|
54
|
+
const circleLeft = ref("0");
|
|
63
55
|
const files = ref<
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
56
|
+
{
|
|
57
|
+
progress: string;
|
|
58
|
+
uploading: boolean;
|
|
59
|
+
uid: string;
|
|
60
|
+
file: File;
|
|
61
|
+
}[]
|
|
70
62
|
>([]);
|
|
71
63
|
const props = withDefaults(
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
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
|
+
}
|
|
89
81
|
);
|
|
90
82
|
|
|
91
83
|
/**
|
|
@@ -93,57 +85,57 @@ const props = withDefaults(
|
|
|
93
85
|
*/
|
|
94
86
|
|
|
95
87
|
function openFileDialog() {
|
|
96
|
-
|
|
88
|
+
fileInputEl.value?.click();
|
|
97
89
|
}
|
|
98
90
|
|
|
99
91
|
function onDragOver(e: DragEvent) {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
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
|
+
}
|
|
116
108
|
}
|
|
117
109
|
|
|
118
110
|
function handleFileInput(e: Event) {
|
|
119
|
-
|
|
120
|
-
|
|
111
|
+
const filesToAdd: FileList = (e.target as any).files;
|
|
112
|
+
addFiles(filesToAdd);
|
|
121
113
|
}
|
|
122
114
|
|
|
123
115
|
function preventDefaults(e: Event) {
|
|
124
|
-
|
|
116
|
+
e.preventDefault();
|
|
125
117
|
}
|
|
126
118
|
|
|
127
119
|
function hideCircle(e: DragEvent) {
|
|
128
|
-
|
|
120
|
+
console.log({ e });
|
|
129
121
|
|
|
130
|
-
|
|
122
|
+
draggingOver.value = false;
|
|
131
123
|
}
|
|
132
124
|
|
|
133
|
-
const events = [
|
|
125
|
+
const events = ["dragenter", "dragover", "dragleave", "drop"];
|
|
134
126
|
|
|
135
127
|
onMounted(() => {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
128
|
+
events.forEach((event) => {
|
|
129
|
+
document.addEventListener(event, preventDefaults);
|
|
130
|
+
});
|
|
131
|
+
document.addEventListener("dragover", onDragOver);
|
|
140
132
|
});
|
|
141
133
|
|
|
142
134
|
onUnmounted(() => {
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
135
|
+
document.removeEventListener("dragover", onDragOver);
|
|
136
|
+
events.forEach((event) => {
|
|
137
|
+
document.removeEventListener(event, preventDefaults);
|
|
138
|
+
});
|
|
147
139
|
});
|
|
148
140
|
|
|
149
141
|
/**
|
|
@@ -151,23 +143,23 @@ onUnmounted(() => {
|
|
|
151
143
|
*/
|
|
152
144
|
|
|
153
145
|
function addFiles(addedFiles: FileList) {
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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();
|
|
164
156
|
}
|
|
165
157
|
|
|
166
158
|
/**
|
|
167
159
|
*
|
|
168
160
|
*
|
|
169
161
|
*/
|
|
170
|
-
const emit = defineEmits([
|
|
162
|
+
const emit = defineEmits(["complete", "done"]);
|
|
171
163
|
|
|
172
164
|
/**
|
|
173
165
|
*
|
|
@@ -175,10 +167,10 @@ const emit = defineEmits(['complete', 'done']);
|
|
|
175
167
|
*/
|
|
176
168
|
|
|
177
169
|
function uploadFiles() {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
170
|
+
files.value.forEach((item) => {
|
|
171
|
+
item.uploading = true;
|
|
172
|
+
/// TODO upload file
|
|
173
|
+
});
|
|
182
174
|
}
|
|
183
175
|
|
|
184
176
|
// function updateProgress(e: ProgressEvent, uid: string) {
|
|
@@ -202,14 +194,14 @@ function uploadFiles() {
|
|
|
202
194
|
// }
|
|
203
195
|
|
|
204
196
|
async function onDrop(e: DragEvent) {
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
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
|
+
}
|
|
213
205
|
}
|
|
214
206
|
</script>
|
|
215
207
|
<style>
|
|
@@ -235,15 +227,15 @@ async function onDrop(e: DragEvent) {
|
|
|
235
227
|
} */
|
|
236
228
|
|
|
237
229
|
.files-wrapper {
|
|
238
|
-
|
|
230
|
+
/* flex-direction: column;
|
|
239
231
|
border-radius: 10px; */
|
|
240
|
-
|
|
241
|
-
|
|
232
|
+
/*overflow: hidden;*/
|
|
233
|
+
/* min-height: 100px;
|
|
242
234
|
font-size: var(--input-font-size); */
|
|
243
235
|
}
|
|
244
236
|
|
|
245
237
|
.drop-zone {
|
|
246
|
-
|
|
238
|
+
/* background-color: var(--bgl-bg);
|
|
247
239
|
height: 100%;
|
|
248
240
|
width: 100%;
|
|
249
241
|
flex-grow: 1;
|
|
@@ -262,17 +254,17 @@ async function onDrop(e: DragEvent) {
|
|
|
262
254
|
}
|
|
263
255
|
|
|
264
256
|
.drop-zone:hover {
|
|
265
|
-
|
|
266
|
-
outline: dashed 1px var(--bgl-
|
|
257
|
+
/* color: var(--bgl-primary);
|
|
258
|
+
outline: dashed 1px var(--bgl-primary-tint); */
|
|
267
259
|
}
|
|
268
260
|
|
|
269
261
|
.drop-circle {
|
|
270
|
-
|
|
262
|
+
/* pointer-events: none;
|
|
271
263
|
position: absolute;
|
|
272
264
|
width: 100px;
|
|
273
265
|
height: 100px;
|
|
274
266
|
border-radius: 50%;
|
|
275
|
-
background-color: var(--bgl-
|
|
267
|
+
background-color: var(--bgl-primary-tint);
|
|
276
268
|
display: flex;
|
|
277
269
|
top: v-bind(circleTop);
|
|
278
270
|
left: v-bind(circleLeft);
|
|
@@ -287,7 +279,7 @@ async function onDrop(e: DragEvent) {
|
|
|
287
279
|
transition: transform 0.2s ease-in-out;
|
|
288
280
|
} */
|
|
289
281
|
.load-file-bar {
|
|
290
|
-
|
|
282
|
+
/* display: flex;
|
|
291
283
|
align-items: center;
|
|
292
284
|
justify-content: space-between;
|
|
293
285
|
background: var(--bgl-white);
|
|
@@ -301,17 +293,17 @@ async function onDrop(e: DragEvent) {
|
|
|
301
293
|
}
|
|
302
294
|
|
|
303
295
|
.load-file-bar p {
|
|
304
|
-
|
|
296
|
+
/* width: calc(100% - 40px);
|
|
305
297
|
overflow: hidden;
|
|
306
298
|
text-overflow: ellipsis; */
|
|
307
299
|
}
|
|
308
300
|
|
|
309
301
|
.load-file-bar span {
|
|
310
|
-
|
|
302
|
+
/* font-size: 10px; */
|
|
311
303
|
}
|
|
312
304
|
|
|
313
305
|
.pie {
|
|
314
|
-
|
|
306
|
+
/* width: 30px;
|
|
315
307
|
height: 30px;
|
|
316
308
|
position: relative;
|
|
317
309
|
display: flex;
|
|
@@ -324,7 +316,7 @@ async function onDrop(e: DragEvent) {
|
|
|
324
316
|
position: absolute;
|
|
325
317
|
border-radius: 50%;
|
|
326
318
|
inset: 0;
|
|
327
|
-
background: conic-gradient(var(--bgl-
|
|
319
|
+
background: conic-gradient(var(--bgl-primary) calc(var(--p) * 1%), #0000 0);
|
|
328
320
|
-webkit-mask: radial-gradient(
|
|
329
321
|
farthest-side,
|
|
330
322
|
#0000 calc(99% - var(--b)),
|