@xuda.io/xuda-widget-plugin-xuda-drive 1.0.23 → 1.0.25
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/index.mjs +1 -1
- package/package.json +1 -1
- package/runtime.mjs +273 -122
package/index.mjs
CHANGED
package/package.json
CHANGED
package/runtime.mjs
CHANGED
|
@@ -6,28 +6,106 @@ export async function upload(fields, e) {
|
|
|
6
6
|
|
|
7
7
|
var widget_cssClass = fields.widget_cssClass;
|
|
8
8
|
|
|
9
|
-
await func.utils.load_js_on_demand(
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
await func.utils.load_js_on_demand(
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
await func.utils.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
9
|
+
await func.utils.load_js_on_demand(
|
|
10
|
+
func.common.get_url(
|
|
11
|
+
e.SESSION_ID,
|
|
12
|
+
"dist",
|
|
13
|
+
"runtime/node_modules/filepond/dist/filepond.js"
|
|
14
|
+
)
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
await func.utils.load_js_on_demand(
|
|
18
|
+
func.common.get_url(
|
|
19
|
+
e.SESSION_ID,
|
|
20
|
+
"dist",
|
|
21
|
+
"runtime/node_modules/jquery-filepond/filepond.jquery.js"
|
|
22
|
+
)
|
|
23
|
+
);
|
|
24
|
+
|
|
25
|
+
await func.utils.load_js_on_demand(
|
|
26
|
+
func.common.get_url(
|
|
27
|
+
e.SESSION_ID,
|
|
28
|
+
"dist",
|
|
29
|
+
"runtime/node_modules/@xuda.io/pintura/filepond-plugin-image-editor/FilePondPluginImageEditor.js"
|
|
30
|
+
)
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
await func.utils.load_js_on_demand(
|
|
34
|
+
func.common.get_url(
|
|
35
|
+
e.SESSION_ID,
|
|
36
|
+
"dist",
|
|
37
|
+
"runtime/node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"
|
|
38
|
+
)
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
await func.utils.load_js_on_demand(
|
|
42
|
+
func.common.get_url(
|
|
43
|
+
e.SESSION_ID,
|
|
44
|
+
"dist",
|
|
45
|
+
"runtime/node_modules/@xuda.io/pintura/pintura/pintura-iife.js"
|
|
46
|
+
)
|
|
47
|
+
);
|
|
48
|
+
|
|
49
|
+
await func.utils.load_js_on_demand(
|
|
50
|
+
func.common.get_url(
|
|
51
|
+
e.SESSION_ID,
|
|
52
|
+
"dist",
|
|
53
|
+
"runtime/node_modules/filepond-plugin-file-poster/dist/filepond-plugin-file-poster.min.js"
|
|
54
|
+
)
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
await func.utils.load_js_on_demand(
|
|
58
|
+
func.common.get_url(
|
|
59
|
+
e.SESSION_ID,
|
|
60
|
+
"dist",
|
|
61
|
+
"runtime/node_modules/filepond-plugin-media-preview/dist/filepond-plugin-media-preview.min.js"
|
|
62
|
+
)
|
|
63
|
+
);
|
|
64
|
+
|
|
65
|
+
await func.utils.load_js_on_demand(
|
|
66
|
+
func.common.get_url(
|
|
67
|
+
e.SESSION_ID,
|
|
68
|
+
"dist",
|
|
69
|
+
"runtime/node_modules/filepond-plugin-file-validate-type/dist/filepond-plugin-file-validate-type.min.js"
|
|
70
|
+
)
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
await func.utils.load_css_on_demand(
|
|
74
|
+
func.common.get_url(
|
|
75
|
+
e.SESSION_ID,
|
|
76
|
+
"dist",
|
|
77
|
+
"runtime/node_modules/filepond/dist/filepond.css"
|
|
78
|
+
)
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
func.utils.load_css_on_demand(
|
|
82
|
+
func.common.get_url(
|
|
83
|
+
e.SESSION_ID,
|
|
84
|
+
"dist",
|
|
85
|
+
"runtime/node_modules/@xuda.io/pintura/pintura/pintura.css"
|
|
86
|
+
)
|
|
87
|
+
);
|
|
88
|
+
func.utils.load_css_on_demand(
|
|
89
|
+
func.common.get_url(
|
|
90
|
+
e.SESSION_ID,
|
|
91
|
+
"dist",
|
|
92
|
+
"runtime/node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css"
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
func.utils.load_css_on_demand(
|
|
96
|
+
func.common.get_url(
|
|
97
|
+
e.SESSION_ID,
|
|
98
|
+
"dist",
|
|
99
|
+
"runtime/node_modules/filepond-plugin-media-preview/dist/filepond-plugin-media-preview.min.css"
|
|
100
|
+
)
|
|
101
|
+
);
|
|
102
|
+
func.utils.load_css_on_demand(
|
|
103
|
+
func.common.get_url(
|
|
104
|
+
e.SESSION_ID,
|
|
105
|
+
"dist",
|
|
106
|
+
"runtime/node_modules/filepond-plugin-file-poster/dist/filepond-plugin-file-poster.min.css"
|
|
107
|
+
)
|
|
108
|
+
);
|
|
31
109
|
|
|
32
110
|
var pond = undefined;
|
|
33
111
|
|
|
@@ -40,8 +118,8 @@ export async function upload(fields, e) {
|
|
|
40
118
|
init_files.push({
|
|
41
119
|
source: val,
|
|
42
120
|
options: {
|
|
43
|
-
type: "local"
|
|
44
|
-
}
|
|
121
|
+
type: "local",
|
|
122
|
+
},
|
|
45
123
|
});
|
|
46
124
|
});
|
|
47
125
|
};
|
|
@@ -49,7 +127,9 @@ export async function upload(fields, e) {
|
|
|
49
127
|
// init files from predefined array
|
|
50
128
|
if (!_.isEmpty(fields.file_upload_init_file_array)) {
|
|
51
129
|
if (typeof fields.file_upload_init_file_array === "string") {
|
|
52
|
-
fields.file_upload_init_file_array = eval(
|
|
130
|
+
fields.file_upload_init_file_array = eval(
|
|
131
|
+
fields.file_upload_init_file_array
|
|
132
|
+
);
|
|
53
133
|
}
|
|
54
134
|
if (fields.file_upload_init_file_array?.length) {
|
|
55
135
|
init_files_fn(fields.file_upload_init_file_array);
|
|
@@ -92,17 +172,22 @@ export async function upload(fields, e) {
|
|
|
92
172
|
|
|
93
173
|
if (!_.isEmpty(fields["xu-bind"])) {
|
|
94
174
|
var ret = ret_obj.app_files;
|
|
95
|
-
if (typeof initialBindValue === "string")
|
|
175
|
+
if (typeof initialBindValue === "string")
|
|
176
|
+
ret = ret_obj.app_files.map((f) => f.server_fileName).join(",");
|
|
96
177
|
|
|
97
178
|
await e.api_utils.set_field_value(fields["xu-bind"], ret);
|
|
98
179
|
}
|
|
99
180
|
|
|
100
181
|
if (is_remove && fields.event_name_for_successful_remove_callback) {
|
|
101
|
-
await e.api_utils.invoke_event(
|
|
182
|
+
await e.api_utils.invoke_event(
|
|
183
|
+
fields.event_name_for_successful_remove_callback
|
|
184
|
+
);
|
|
102
185
|
}
|
|
103
186
|
|
|
104
187
|
if (!is_remove && fields.event_name_for_successful_callback) {
|
|
105
|
-
await e.api_utils.invoke_event(
|
|
188
|
+
await e.api_utils.invoke_event(
|
|
189
|
+
fields.event_name_for_successful_callback
|
|
190
|
+
);
|
|
106
191
|
}
|
|
107
192
|
|
|
108
193
|
if (fields.clear_on_file_upload) {
|
|
@@ -112,10 +197,14 @@ export async function upload(fields, e) {
|
|
|
112
197
|
}, 100);
|
|
113
198
|
};
|
|
114
199
|
|
|
115
|
-
var $pallet_wrapper = $(
|
|
200
|
+
var $pallet_wrapper = $(
|
|
201
|
+
`<div class="image_wrapper" style="border: none !important;">`
|
|
202
|
+
);
|
|
116
203
|
|
|
117
204
|
var input_id = new Date().valueOf();
|
|
118
|
-
var $imgInp = $(
|
|
205
|
+
var $imgInp = $(
|
|
206
|
+
`<input class="filepond ${widget_cssClass}" id="${input_id}" />`
|
|
207
|
+
).appendTo($pallet_wrapper);
|
|
119
208
|
|
|
120
209
|
e.$containerP.html($pallet_wrapper);
|
|
121
210
|
|
|
@@ -147,7 +236,7 @@ export async function upload(fields, e) {
|
|
|
147
236
|
|
|
148
237
|
fetch(url, {
|
|
149
238
|
method: "POST",
|
|
150
|
-
body: e
|
|
239
|
+
body: e,
|
|
151
240
|
}).then((res) => {
|
|
152
241
|
console.log("Request complete! response:", res);
|
|
153
242
|
});
|
|
@@ -167,7 +256,12 @@ export async function upload(fields, e) {
|
|
|
167
256
|
imageEditorSupportImage: (file) => {
|
|
168
257
|
// return /^image/.test(file);
|
|
169
258
|
|
|
170
|
-
return
|
|
259
|
+
return (
|
|
260
|
+
file.type !== "image/svg+xml" &&
|
|
261
|
+
file.type !== "image/gif" &&
|
|
262
|
+
!file.type.includes("audio") &&
|
|
263
|
+
!file.type.includes("video")
|
|
264
|
+
);
|
|
171
265
|
},
|
|
172
266
|
|
|
173
267
|
imageEditor: {
|
|
@@ -177,9 +271,9 @@ export async function upload(fields, e) {
|
|
|
177
271
|
|
|
178
272
|
imageProcessor: pintura.processImage,
|
|
179
273
|
editorOptions: {
|
|
180
|
-
...pintura.getEditorDefaults()
|
|
274
|
+
...pintura.getEditorDefaults(),
|
|
181
275
|
},
|
|
182
|
-
legacyDataToImageState: pintura.legacyDataToImageState
|
|
276
|
+
legacyDataToImageState: pintura.legacyDataToImageState,
|
|
183
277
|
},
|
|
184
278
|
server: {
|
|
185
279
|
load: (source, load, error, progress, abort, headers) => {
|
|
@@ -206,33 +300,35 @@ export async function upload(fields, e) {
|
|
|
206
300
|
return {
|
|
207
301
|
abort: () => {
|
|
208
302
|
abort();
|
|
209
|
-
}
|
|
303
|
+
},
|
|
210
304
|
};
|
|
211
305
|
},
|
|
212
|
-
process: (
|
|
306
|
+
process: (
|
|
307
|
+
fieldName,
|
|
308
|
+
file,
|
|
309
|
+
metadata,
|
|
310
|
+
load,
|
|
311
|
+
error,
|
|
312
|
+
progress,
|
|
313
|
+
abort,
|
|
314
|
+
transfer,
|
|
315
|
+
options
|
|
316
|
+
) => {
|
|
213
317
|
let formData = new FormData();
|
|
214
318
|
formData.append("file", file, file.name);
|
|
215
319
|
const { app_id, gtp_token, app_token } = e._session;
|
|
216
320
|
|
|
217
|
-
formData.append(
|
|
321
|
+
formData.append(
|
|
322
|
+
"app_id_reference",
|
|
323
|
+
APP_OBJ?.[app_id]?.app_id_reference
|
|
324
|
+
);
|
|
218
325
|
formData.append("app_id", app_id);
|
|
219
326
|
formData.append("gtp_token", gtp_token);
|
|
220
327
|
formData.append("app_token", app_token);
|
|
221
328
|
formData.append("folder", fields.file_upload_folder);
|
|
222
329
|
formData.append("public", fields.public_file);
|
|
223
330
|
|
|
224
|
-
let tags = [];
|
|
225
|
-
|
|
226
|
-
if (fields.file_tags) {
|
|
227
|
-
function csvToArray(csvString) {
|
|
228
|
-
// Split the string into rows (by newline)
|
|
229
|
-
const rows = csvString.split("\n");
|
|
230
|
-
|
|
231
|
-
// Map through each row and split by commas to create arrays for each row
|
|
232
|
-
return rows.map((row) => row.split(","));
|
|
233
|
-
}
|
|
234
|
-
tags = csvToArray(fields.upload_tags);
|
|
235
|
-
}
|
|
331
|
+
let tags = fields.assign_file_tags || [];
|
|
236
332
|
|
|
237
333
|
let file_tags = [];
|
|
238
334
|
if (fields.auto_tag_generator) {
|
|
@@ -252,7 +348,10 @@ export async function upload(fields, e) {
|
|
|
252
348
|
|
|
253
349
|
let _domain = e._session.domain;
|
|
254
350
|
if (e._session.is_deployment) {
|
|
255
|
-
_domain =
|
|
351
|
+
_domain =
|
|
352
|
+
e._session.opt.regional_server === "dev.xuda.io"
|
|
353
|
+
? "dev.xuda.io"
|
|
354
|
+
: "xuda.io";
|
|
256
355
|
}
|
|
257
356
|
|
|
258
357
|
request.open("POST", `https://${_domain}/rpi/runtime_upload_file`);
|
|
@@ -290,7 +389,7 @@ export async function upload(fields, e) {
|
|
|
290
389
|
|
|
291
390
|
// Let FilePond know the request has been cancelled
|
|
292
391
|
abort();
|
|
293
|
-
}
|
|
392
|
+
},
|
|
294
393
|
};
|
|
295
394
|
},
|
|
296
395
|
|
|
@@ -308,12 +407,15 @@ export async function upload(fields, e) {
|
|
|
308
407
|
let app_id = e._session.app_id;
|
|
309
408
|
let app_id_reference = APP_OBJ[app_id].app_id_reference;
|
|
310
409
|
|
|
311
|
-
axios_ajax(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
410
|
+
axios_ajax(
|
|
411
|
+
func.common.get_url(e.SESSION_ID, "rpi", "runtime_delete_file_bulk"),
|
|
412
|
+
{
|
|
413
|
+
app_id,
|
|
414
|
+
server_files: ret_obj.deletedArr,
|
|
415
|
+
app_id_reference: app_id_reference,
|
|
416
|
+
gtp_token: e._session.gtp_token,
|
|
417
|
+
}
|
|
418
|
+
);
|
|
317
419
|
load();
|
|
318
420
|
},
|
|
319
421
|
remove: (source, load, error) => {
|
|
@@ -321,20 +423,23 @@ export async function upload(fields, e) {
|
|
|
321
423
|
|
|
322
424
|
ret_obj.deletedArr.push(source_clean);
|
|
323
425
|
|
|
324
|
-
var myIndex = ret_obj.app_files.indexOf(
|
|
426
|
+
var myIndex = ret_obj.app_files.indexOf(
|
|
427
|
+
(file) => file.server_fileName === source
|
|
428
|
+
);
|
|
325
429
|
if (myIndex !== -1) {
|
|
326
430
|
ret_obj.app_files.splice(myIndex, 1);
|
|
327
431
|
}
|
|
328
432
|
|
|
329
433
|
////////////// CALLBACK
|
|
330
|
-
if (fields.instant_file_upload === "N" ? false : true)
|
|
434
|
+
if (fields.instant_file_upload === "N" ? false : true)
|
|
435
|
+
do_callback(true);
|
|
331
436
|
// Can call the error method if something is wrong, should exit after
|
|
332
437
|
// error('oh my goodness');
|
|
333
438
|
|
|
334
439
|
// Should call the load method when done, no parameters required
|
|
335
440
|
load();
|
|
336
|
-
}
|
|
337
|
-
}
|
|
441
|
+
},
|
|
442
|
+
},
|
|
338
443
|
};
|
|
339
444
|
|
|
340
445
|
if (fields.file_upload_drop_area_label) {
|
|
@@ -396,21 +501,39 @@ export async function upload(fields, e) {
|
|
|
396
501
|
export async function viewer(fields, e) {
|
|
397
502
|
const { app_id, gtp_token, app_token } = e._session;
|
|
398
503
|
|
|
399
|
-
await func.utils.load_js_on_demand(
|
|
504
|
+
await func.utils.load_js_on_demand(
|
|
505
|
+
"https://cdn.tailwindcss.com?plugins=forms"
|
|
506
|
+
);
|
|
400
507
|
|
|
401
|
-
await func.utils.load_js_on_demand(
|
|
508
|
+
await func.utils.load_js_on_demand(
|
|
509
|
+
"https://cdn.jsdelivr.net/npm/vue@3.5.6/dist/vue.global.js"
|
|
510
|
+
);
|
|
402
511
|
|
|
403
|
-
await func.utils.load_js_on_demand(
|
|
512
|
+
await func.utils.load_js_on_demand(
|
|
513
|
+
"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js"
|
|
514
|
+
);
|
|
404
515
|
|
|
405
|
-
await func.utils.load_js_on_demand(
|
|
406
|
-
|
|
516
|
+
await func.utils.load_js_on_demand(
|
|
517
|
+
"https://unpkg.com/swiper/swiper-bundle.min.js"
|
|
518
|
+
);
|
|
519
|
+
await func.utils.load_css_on_demand(
|
|
520
|
+
"https://unpkg.com/swiper/swiper-bundle.min.css"
|
|
521
|
+
);
|
|
407
522
|
|
|
408
523
|
await func.utils.load_js_on_demand("https://unpkg.com/@vueuse/shared");
|
|
409
524
|
await func.utils.load_js_on_demand("https://unpkg.com/@vueuse/core");
|
|
410
|
-
await func.utils.load_js_on_demand(
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
await func.utils.
|
|
525
|
+
await func.utils.load_js_on_demand(
|
|
526
|
+
"https://unpkg.com/@floating-ui/core@1.1.1"
|
|
527
|
+
);
|
|
528
|
+
await func.utils.load_js_on_demand(
|
|
529
|
+
"https://unpkg.com/@floating-ui/dom@1.1.1"
|
|
530
|
+
);
|
|
531
|
+
await func.utils.load_js_on_demand(
|
|
532
|
+
"https://unpkg.com/floating-vue@5.2.2/dist/floating-vue.umd.js"
|
|
533
|
+
);
|
|
534
|
+
await func.utils.load_css_on_demand(
|
|
535
|
+
"https://unpkg.com/floating-vue@^5.2.2/dist/style.css"
|
|
536
|
+
);
|
|
414
537
|
|
|
415
538
|
var fs = import("./fs-lightbox.js");
|
|
416
539
|
|
|
@@ -454,7 +577,7 @@ export async function viewer(fields, e) {
|
|
|
454
577
|
></circle>
|
|
455
578
|
</svg>
|
|
456
579
|
</div>
|
|
457
|
-
|
|
580
|
+
`,
|
|
458
581
|
};
|
|
459
582
|
|
|
460
583
|
var segmentComponent = {
|
|
@@ -468,7 +591,7 @@ export async function viewer(fields, e) {
|
|
|
468
591
|
},
|
|
469
592
|
set(v) {
|
|
470
593
|
this.$emit("update:modelValue", v);
|
|
471
|
-
}
|
|
594
|
+
},
|
|
472
595
|
},
|
|
473
596
|
segmentActive() {
|
|
474
597
|
// debugger;
|
|
@@ -478,7 +601,7 @@ export async function viewer(fields, e) {
|
|
|
478
601
|
|
|
479
602
|
// debugger;
|
|
480
603
|
return ret;
|
|
481
|
-
}
|
|
604
|
+
},
|
|
482
605
|
},
|
|
483
606
|
template: `
|
|
484
607
|
<div class="flex relative items-center rounded-lg bg-gray-100 [&>button]:px-4 [&>button]:py-2">
|
|
@@ -491,11 +614,11 @@ export async function viewer(fields, e) {
|
|
|
491
614
|
|
|
492
615
|
<div :style="{ left: segmentActive > 0 ? (Number(segmentActive) / options.length) * 100 + '%' : 0, width: 100 / options.length + '%' }" class="after:absolute transition-all duration-300 after:inset-[1px] after:bg-white after:rounded-lg after:shadow absolute h-full rounded"></div>
|
|
493
616
|
</div>
|
|
494
|
-
|
|
617
|
+
`,
|
|
495
618
|
};
|
|
496
619
|
|
|
497
620
|
const html = `
|
|
498
|
-
<div class="flex flex-col divide-y overflow-hidden h-full"
|
|
621
|
+
<div class="flex flex-col divide-y overflow-hidden h-full">
|
|
499
622
|
|
|
500
623
|
<div v-if="options.show_toolbar !== 'N'" class="flex items-center py-2 px-6">
|
|
501
624
|
<div class="flex gap-2 items-center flex-1">
|
|
@@ -737,18 +860,22 @@ export async function viewer(fields, e) {
|
|
|
737
860
|
`;
|
|
738
861
|
|
|
739
862
|
const search_drive = async function (opt) {
|
|
740
|
-
let domain =
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
863
|
+
let domain =
|
|
864
|
+
e._session.engine_mode === "live_preview" ? `dev.xuda.io` : `xuda.io`;
|
|
865
|
+
|
|
866
|
+
const response = await fetch(
|
|
867
|
+
`https://${domain}/cpi/get_drive_files_workspace`,
|
|
868
|
+
{
|
|
869
|
+
method: "POST",
|
|
870
|
+
headers: {
|
|
871
|
+
Accept: "application/json",
|
|
872
|
+
"Content-Type": "application/json",
|
|
873
|
+
"xu-gtp-token": gtp_token,
|
|
874
|
+
"xu-app-token": app_token,
|
|
875
|
+
},
|
|
876
|
+
body: JSON.stringify(opt),
|
|
877
|
+
}
|
|
878
|
+
);
|
|
752
879
|
|
|
753
880
|
if (!response.ok) {
|
|
754
881
|
throw response.status;
|
|
@@ -778,29 +905,29 @@ export async function viewer(fields, e) {
|
|
|
778
905
|
components: {
|
|
779
906
|
VDropdown: FloatingVue.Dropdown,
|
|
780
907
|
segmentComponent,
|
|
781
|
-
sepcialLoader
|
|
908
|
+
sepcialLoader,
|
|
782
909
|
},
|
|
783
910
|
data() {
|
|
784
911
|
return {
|
|
785
912
|
sortDirOptions: [
|
|
786
913
|
{
|
|
787
914
|
label: "Ascending",
|
|
788
|
-
value: "asc"
|
|
915
|
+
value: "asc",
|
|
789
916
|
},
|
|
790
917
|
{
|
|
791
918
|
label: "Descending",
|
|
792
|
-
value: "desc"
|
|
793
|
-
}
|
|
919
|
+
value: "desc",
|
|
920
|
+
},
|
|
794
921
|
],
|
|
795
922
|
sortOptions: [
|
|
796
923
|
{
|
|
797
924
|
label: "Date",
|
|
798
|
-
value: "date"
|
|
925
|
+
value: "date",
|
|
799
926
|
},
|
|
800
927
|
{
|
|
801
928
|
label: "Name",
|
|
802
|
-
value: "name"
|
|
803
|
-
}
|
|
929
|
+
value: "name",
|
|
930
|
+
},
|
|
804
931
|
],
|
|
805
932
|
viewOptions: [
|
|
806
933
|
{
|
|
@@ -812,7 +939,7 @@ export async function viewer(fields, e) {
|
|
|
812
939
|
></path>
|
|
813
940
|
</svg>`,
|
|
814
941
|
label: "",
|
|
815
|
-
value: "gallery"
|
|
942
|
+
value: "gallery",
|
|
816
943
|
},
|
|
817
944
|
{
|
|
818
945
|
icon: ` <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
@@ -823,7 +950,7 @@ export async function viewer(fields, e) {
|
|
|
823
950
|
></path>
|
|
824
951
|
</svg>`,
|
|
825
952
|
label: "",
|
|
826
|
-
value: "list"
|
|
953
|
+
value: "list",
|
|
827
954
|
},
|
|
828
955
|
{
|
|
829
956
|
icon: ` <svg class="h-5 w-5" xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
|
|
@@ -831,8 +958,8 @@ export async function viewer(fields, e) {
|
|
|
831
958
|
<path d="M192,48H64A16,16,0,0,0,48,64V192a16,16,0,0,0,16,16H192a16,16,0,0,0,16-16V64A16,16,0,0,0,192,48Zm0,144H64V64H192V192ZM240,56V200a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0ZM32,56V200a8,8,0,0,1-16,0V56a8,8,0,0,1,16,0Z"></path>
|
|
832
959
|
</svg>`,
|
|
833
960
|
label: "",
|
|
834
|
-
value: "slider"
|
|
835
|
-
}
|
|
961
|
+
value: "slider",
|
|
962
|
+
},
|
|
836
963
|
],
|
|
837
964
|
options: fields,
|
|
838
965
|
folders: [],
|
|
@@ -853,18 +980,18 @@ export async function viewer(fields, e) {
|
|
|
853
980
|
{
|
|
854
981
|
label: "Filename",
|
|
855
982
|
tag: "name",
|
|
856
|
-
modifier: "contains"
|
|
983
|
+
modifier: "contains",
|
|
857
984
|
},
|
|
858
985
|
{
|
|
859
986
|
label: "Tag",
|
|
860
987
|
tag: "tag",
|
|
861
|
-
modifier: "equals"
|
|
988
|
+
modifier: "equals",
|
|
862
989
|
},
|
|
863
990
|
{
|
|
864
991
|
label: "Content",
|
|
865
992
|
tag: "any",
|
|
866
|
-
modifier: "contains"
|
|
867
|
-
}
|
|
993
|
+
modifier: "contains",
|
|
994
|
+
},
|
|
868
995
|
],
|
|
869
996
|
opts: {
|
|
870
997
|
search_string: "",
|
|
@@ -872,11 +999,11 @@ export async function viewer(fields, e) {
|
|
|
872
999
|
path: "/",
|
|
873
1000
|
search_string: "",
|
|
874
1001
|
sort_by: fields.sort_by || "date",
|
|
875
|
-
sort_dir: fields.sort_dir || "desc"
|
|
1002
|
+
sort_dir: fields.sort_dir || "desc",
|
|
876
1003
|
},
|
|
877
|
-
limit:
|
|
1004
|
+
limit: 5,
|
|
878
1005
|
isEndOfList: false,
|
|
879
|
-
allLoading: false
|
|
1006
|
+
allLoading: false,
|
|
880
1007
|
};
|
|
881
1008
|
},
|
|
882
1009
|
methods: {
|
|
@@ -889,8 +1016,15 @@ export async function viewer(fields, e) {
|
|
|
889
1016
|
this.isEndOfList = false;
|
|
890
1017
|
}
|
|
891
1018
|
|
|
892
|
-
const folders = await this.search_drive({
|
|
893
|
-
|
|
1019
|
+
const folders = await this.search_drive({
|
|
1020
|
+
...this.opts,
|
|
1021
|
+
type: "directory",
|
|
1022
|
+
});
|
|
1023
|
+
const files = await this.search_drive({
|
|
1024
|
+
...this.opts,
|
|
1025
|
+
...(all ? {} : { from: 0, to: this.limit }),
|
|
1026
|
+
type: "file",
|
|
1027
|
+
});
|
|
894
1028
|
|
|
895
1029
|
this.folders = folders.data.children || [];
|
|
896
1030
|
this.files = files.data.children || [];
|
|
@@ -906,7 +1040,9 @@ export async function viewer(fields, e) {
|
|
|
906
1040
|
});
|
|
907
1041
|
},
|
|
908
1042
|
uploadFiles() {
|
|
909
|
-
var pond = FilePond.find(
|
|
1043
|
+
var pond = FilePond.find(
|
|
1044
|
+
$("#imageUploaderComponent").find(`.filepond`)[0]
|
|
1045
|
+
);
|
|
910
1046
|
// debugger;
|
|
911
1047
|
this.uploaderLoading = true;
|
|
912
1048
|
pond.processFiles();
|
|
@@ -942,16 +1078,20 @@ export async function viewer(fields, e) {
|
|
|
942
1078
|
searchDebounce: _.debounce(async function ($event) {
|
|
943
1079
|
await this.refreshDirectory();
|
|
944
1080
|
}, 400),
|
|
945
|
-
moment
|
|
1081
|
+
moment,
|
|
946
1082
|
},
|
|
947
1083
|
mounted() {
|
|
948
1084
|
var onDrop = (files) => {
|
|
949
1085
|
this.uploadModal = true;
|
|
950
|
-
FilePond.find(
|
|
1086
|
+
FilePond.find(
|
|
1087
|
+
$("#imageUploaderComponent").find(`.filepond`)[0]
|
|
1088
|
+
)?.addFiles(files);
|
|
951
1089
|
// params.$refs.ImageUploader?.$refs?.pond?.addFiles(files);
|
|
952
1090
|
};
|
|
953
1091
|
|
|
954
|
-
const { isOverDropZone } = VueUse.useDropZone(this.$refs.dropZoneRef, {
|
|
1092
|
+
const { isOverDropZone } = VueUse.useDropZone(this.$refs.dropZoneRef, {
|
|
1093
|
+
onDrop,
|
|
1094
|
+
});
|
|
955
1095
|
|
|
956
1096
|
this.isOverDropZone = isOverDropZone;
|
|
957
1097
|
},
|
|
@@ -973,7 +1113,9 @@ export async function viewer(fields, e) {
|
|
|
973
1113
|
}
|
|
974
1114
|
},
|
|
975
1115
|
searchTags() {
|
|
976
|
-
return this.opts.search_string
|
|
1116
|
+
return this.opts.search_string
|
|
1117
|
+
.split(" ")
|
|
1118
|
+
.filter((e) => e.includes(":"));
|
|
977
1119
|
},
|
|
978
1120
|
search: {
|
|
979
1121
|
get() {
|
|
@@ -985,24 +1127,30 @@ export async function viewer(fields, e) {
|
|
|
985
1127
|
},
|
|
986
1128
|
|
|
987
1129
|
set(value) {
|
|
988
|
-
var existingTags = this.opts.search_string
|
|
1130
|
+
var existingTags = this.opts.search_string
|
|
1131
|
+
.split(" ")
|
|
1132
|
+
.filter((e) => e.includes(":"));
|
|
989
1133
|
|
|
990
|
-
this.opts.search_string = (
|
|
1134
|
+
this.opts.search_string = (
|
|
1135
|
+
existingTags.join(" ") +
|
|
1136
|
+
" " +
|
|
1137
|
+
value
|
|
1138
|
+
).trim();
|
|
991
1139
|
|
|
992
1140
|
if (value.length) {
|
|
993
1141
|
this.showSearchPopper = true;
|
|
994
1142
|
} else {
|
|
995
1143
|
this.showSearchPopper = false;
|
|
996
1144
|
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
1145
|
+
},
|
|
1146
|
+
},
|
|
999
1147
|
},
|
|
1000
1148
|
watch: {
|
|
1001
1149
|
opts: {
|
|
1002
1150
|
deep: true,
|
|
1003
1151
|
handler() {
|
|
1004
1152
|
this.searchDebounce();
|
|
1005
|
-
}
|
|
1153
|
+
},
|
|
1006
1154
|
},
|
|
1007
1155
|
view: {
|
|
1008
1156
|
handler(val) {
|
|
@@ -1011,7 +1159,7 @@ export async function viewer(fields, e) {
|
|
|
1011
1159
|
this.swiper = new Swiper(this.$refs["swiper-container"], {
|
|
1012
1160
|
loop: true,
|
|
1013
1161
|
slidesPerView: 1,
|
|
1014
|
-
spaceBetween: 20
|
|
1162
|
+
spaceBetween: 20,
|
|
1015
1163
|
});
|
|
1016
1164
|
});
|
|
1017
1165
|
}
|
|
@@ -1019,21 +1167,24 @@ export async function viewer(fields, e) {
|
|
|
1019
1167
|
this.$nextTick(() => {
|
|
1020
1168
|
refreshFsLightbox();
|
|
1021
1169
|
});
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1170
|
+
},
|
|
1171
|
+
},
|
|
1024
1172
|
},
|
|
1025
1173
|
async created() {
|
|
1026
1174
|
this.refreshDirectory();
|
|
1027
1175
|
|
|
1028
1176
|
this.$nextTick(() => {
|
|
1029
1177
|
// debugger;
|
|
1030
|
-
this.initUploader(
|
|
1178
|
+
this.initUploader(
|
|
1179
|
+
{ ...fields, instant_file_upload: "N" },
|
|
1180
|
+
{ ...e, $containerP: $("#imageUploaderComponent") }
|
|
1181
|
+
);
|
|
1031
1182
|
});
|
|
1032
1183
|
|
|
1033
1184
|
this.$watch("opts", (value) => {
|
|
1034
1185
|
this.refreshDirectory();
|
|
1035
1186
|
});
|
|
1036
|
-
}
|
|
1187
|
+
},
|
|
1037
1188
|
});
|
|
1038
1189
|
|
|
1039
1190
|
setTimeout(() => {
|