@xuda.io/xuda-widget-plugin-xuda-drive 1.0.21 → 1.0.22
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/package.json +1 -1
- package/runtime.mjs +276 -107
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,15 +300,28 @@ 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);
|
|
@@ -252,7 +359,10 @@ export async function upload(fields, e) {
|
|
|
252
359
|
|
|
253
360
|
let _domain = e._session.domain;
|
|
254
361
|
if (e._session.is_deployment) {
|
|
255
|
-
_domain =
|
|
362
|
+
_domain =
|
|
363
|
+
e._session.opt.regional_server === "dev.xuda.io"
|
|
364
|
+
? "dev.xuda.io"
|
|
365
|
+
: "xuda.io";
|
|
256
366
|
}
|
|
257
367
|
|
|
258
368
|
request.open("POST", `https://${_domain}/rpi/runtime_upload_file`);
|
|
@@ -290,7 +400,7 @@ export async function upload(fields, e) {
|
|
|
290
400
|
|
|
291
401
|
// Let FilePond know the request has been cancelled
|
|
292
402
|
abort();
|
|
293
|
-
}
|
|
403
|
+
},
|
|
294
404
|
};
|
|
295
405
|
},
|
|
296
406
|
|
|
@@ -308,12 +418,15 @@ export async function upload(fields, e) {
|
|
|
308
418
|
let app_id = e._session.app_id;
|
|
309
419
|
let app_id_reference = APP_OBJ[app_id].app_id_reference;
|
|
310
420
|
|
|
311
|
-
axios_ajax(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
421
|
+
axios_ajax(
|
|
422
|
+
func.common.get_url(e.SESSION_ID, "rpi", "runtime_delete_file_bulk"),
|
|
423
|
+
{
|
|
424
|
+
app_id,
|
|
425
|
+
server_files: ret_obj.deletedArr,
|
|
426
|
+
app_id_reference: app_id_reference,
|
|
427
|
+
gtp_token: e._session.gtp_token,
|
|
428
|
+
}
|
|
429
|
+
);
|
|
317
430
|
load();
|
|
318
431
|
},
|
|
319
432
|
remove: (source, load, error) => {
|
|
@@ -321,20 +434,23 @@ export async function upload(fields, e) {
|
|
|
321
434
|
|
|
322
435
|
ret_obj.deletedArr.push(source_clean);
|
|
323
436
|
|
|
324
|
-
var myIndex = ret_obj.app_files.indexOf(
|
|
437
|
+
var myIndex = ret_obj.app_files.indexOf(
|
|
438
|
+
(file) => file.server_fileName === source
|
|
439
|
+
);
|
|
325
440
|
if (myIndex !== -1) {
|
|
326
441
|
ret_obj.app_files.splice(myIndex, 1);
|
|
327
442
|
}
|
|
328
443
|
|
|
329
444
|
////////////// CALLBACK
|
|
330
|
-
if (fields.instant_file_upload === "N" ? false : true)
|
|
445
|
+
if (fields.instant_file_upload === "N" ? false : true)
|
|
446
|
+
do_callback(true);
|
|
331
447
|
// Can call the error method if something is wrong, should exit after
|
|
332
448
|
// error('oh my goodness');
|
|
333
449
|
|
|
334
450
|
// Should call the load method when done, no parameters required
|
|
335
451
|
load();
|
|
336
|
-
}
|
|
337
|
-
}
|
|
452
|
+
},
|
|
453
|
+
},
|
|
338
454
|
};
|
|
339
455
|
|
|
340
456
|
if (fields.file_upload_drop_area_label) {
|
|
@@ -396,21 +512,39 @@ export async function upload(fields, e) {
|
|
|
396
512
|
export async function viewer(fields, e) {
|
|
397
513
|
const { app_id, gtp_token, app_token } = e._session;
|
|
398
514
|
|
|
399
|
-
await func.utils.load_js_on_demand(
|
|
515
|
+
await func.utils.load_js_on_demand(
|
|
516
|
+
"https://cdn.tailwindcss.com?plugins=forms"
|
|
517
|
+
);
|
|
400
518
|
|
|
401
|
-
await func.utils.load_js_on_demand(
|
|
519
|
+
await func.utils.load_js_on_demand(
|
|
520
|
+
"https://cdn.jsdelivr.net/npm/vue@3.5.6/dist/vue.global.js"
|
|
521
|
+
);
|
|
402
522
|
|
|
403
|
-
await func.utils.load_js_on_demand(
|
|
523
|
+
await func.utils.load_js_on_demand(
|
|
524
|
+
"https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js"
|
|
525
|
+
);
|
|
404
526
|
|
|
405
|
-
await func.utils.load_js_on_demand(
|
|
406
|
-
|
|
527
|
+
await func.utils.load_js_on_demand(
|
|
528
|
+
"https://unpkg.com/swiper/swiper-bundle.min.js"
|
|
529
|
+
);
|
|
530
|
+
await func.utils.load_css_on_demand(
|
|
531
|
+
"https://unpkg.com/swiper/swiper-bundle.min.css"
|
|
532
|
+
);
|
|
407
533
|
|
|
408
534
|
await func.utils.load_js_on_demand("https://unpkg.com/@vueuse/shared");
|
|
409
535
|
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.
|
|
536
|
+
await func.utils.load_js_on_demand(
|
|
537
|
+
"https://unpkg.com/@floating-ui/core@1.1.1"
|
|
538
|
+
);
|
|
539
|
+
await func.utils.load_js_on_demand(
|
|
540
|
+
"https://unpkg.com/@floating-ui/dom@1.1.1"
|
|
541
|
+
);
|
|
542
|
+
await func.utils.load_js_on_demand(
|
|
543
|
+
"https://unpkg.com/floating-vue@5.2.2/dist/floating-vue.umd.js"
|
|
544
|
+
);
|
|
545
|
+
await func.utils.load_css_on_demand(
|
|
546
|
+
"https://unpkg.com/floating-vue@^5.2.2/dist/style.css"
|
|
547
|
+
);
|
|
414
548
|
|
|
415
549
|
var fs = import("./fs-lightbox.js");
|
|
416
550
|
|
|
@@ -454,7 +588,7 @@ export async function viewer(fields, e) {
|
|
|
454
588
|
></circle>
|
|
455
589
|
</svg>
|
|
456
590
|
</div>
|
|
457
|
-
|
|
591
|
+
`,
|
|
458
592
|
};
|
|
459
593
|
|
|
460
594
|
var segmentComponent = {
|
|
@@ -468,7 +602,7 @@ export async function viewer(fields, e) {
|
|
|
468
602
|
},
|
|
469
603
|
set(v) {
|
|
470
604
|
this.$emit("update:modelValue", v);
|
|
471
|
-
}
|
|
605
|
+
},
|
|
472
606
|
},
|
|
473
607
|
segmentActive() {
|
|
474
608
|
// debugger;
|
|
@@ -478,7 +612,7 @@ export async function viewer(fields, e) {
|
|
|
478
612
|
|
|
479
613
|
// debugger;
|
|
480
614
|
return ret;
|
|
481
|
-
}
|
|
615
|
+
},
|
|
482
616
|
},
|
|
483
617
|
template: `
|
|
484
618
|
<div class="flex relative items-center rounded-lg bg-gray-100 [&>button]:px-4 [&>button]:py-2">
|
|
@@ -491,7 +625,7 @@ export async function viewer(fields, e) {
|
|
|
491
625
|
|
|
492
626
|
<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
627
|
</div>
|
|
494
|
-
|
|
628
|
+
`,
|
|
495
629
|
};
|
|
496
630
|
|
|
497
631
|
const html = `
|
|
@@ -737,18 +871,29 @@ export async function viewer(fields, e) {
|
|
|
737
871
|
`;
|
|
738
872
|
|
|
739
873
|
const search_drive = async function (opt) {
|
|
740
|
-
let domain = e._session.engine_mode === "live_preview" ? `dev.xuda.io` : `xuda.io`;
|
|
874
|
+
// let domain = e._session.engine_mode === "live_preview" ? `dev.xuda.io` : `xuda.io`;
|
|
875
|
+
|
|
876
|
+
let _domain = e._session.domain;
|
|
877
|
+
if (e._session.is_deployment) {
|
|
878
|
+
_domain =
|
|
879
|
+
e._session.opt.regional_server === "dev.xuda.io"
|
|
880
|
+
? "dev.xuda.io"
|
|
881
|
+
: "xuda.io";
|
|
882
|
+
}
|
|
741
883
|
|
|
742
|
-
const response = await fetch(
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
884
|
+
const response = await fetch(
|
|
885
|
+
`https://${_domain}/cpi/get_drive_files_workspace`,
|
|
886
|
+
{
|
|
887
|
+
method: "POST",
|
|
888
|
+
headers: {
|
|
889
|
+
Accept: "application/json",
|
|
890
|
+
"Content-Type": "application/json",
|
|
891
|
+
"xu-gtp-token": gtp_token,
|
|
892
|
+
"xu-app-token": app_token,
|
|
893
|
+
},
|
|
894
|
+
body: JSON.stringify(opt),
|
|
895
|
+
}
|
|
896
|
+
);
|
|
752
897
|
|
|
753
898
|
if (!response.ok) {
|
|
754
899
|
throw response.status;
|
|
@@ -778,29 +923,29 @@ export async function viewer(fields, e) {
|
|
|
778
923
|
components: {
|
|
779
924
|
VDropdown: FloatingVue.Dropdown,
|
|
780
925
|
segmentComponent,
|
|
781
|
-
sepcialLoader
|
|
926
|
+
sepcialLoader,
|
|
782
927
|
},
|
|
783
928
|
data() {
|
|
784
929
|
return {
|
|
785
930
|
sortDirOptions: [
|
|
786
931
|
{
|
|
787
932
|
label: "Ascending",
|
|
788
|
-
value: "asc"
|
|
933
|
+
value: "asc",
|
|
789
934
|
},
|
|
790
935
|
{
|
|
791
936
|
label: "Descending",
|
|
792
|
-
value: "desc"
|
|
793
|
-
}
|
|
937
|
+
value: "desc",
|
|
938
|
+
},
|
|
794
939
|
],
|
|
795
940
|
sortOptions: [
|
|
796
941
|
{
|
|
797
942
|
label: "Date",
|
|
798
|
-
value: "date"
|
|
943
|
+
value: "date",
|
|
799
944
|
},
|
|
800
945
|
{
|
|
801
946
|
label: "Name",
|
|
802
|
-
value: "name"
|
|
803
|
-
}
|
|
947
|
+
value: "name",
|
|
948
|
+
},
|
|
804
949
|
],
|
|
805
950
|
viewOptions: [
|
|
806
951
|
{
|
|
@@ -812,7 +957,7 @@ export async function viewer(fields, e) {
|
|
|
812
957
|
></path>
|
|
813
958
|
</svg>`,
|
|
814
959
|
label: "",
|
|
815
|
-
value: "gallery"
|
|
960
|
+
value: "gallery",
|
|
816
961
|
},
|
|
817
962
|
{
|
|
818
963
|
icon: ` <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
@@ -823,7 +968,7 @@ export async function viewer(fields, e) {
|
|
|
823
968
|
></path>
|
|
824
969
|
</svg>`,
|
|
825
970
|
label: "",
|
|
826
|
-
value: "list"
|
|
971
|
+
value: "list",
|
|
827
972
|
},
|
|
828
973
|
{
|
|
829
974
|
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 +976,8 @@ export async function viewer(fields, e) {
|
|
|
831
976
|
<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
977
|
</svg>`,
|
|
833
978
|
label: "",
|
|
834
|
-
value: "slider"
|
|
835
|
-
}
|
|
979
|
+
value: "slider",
|
|
980
|
+
},
|
|
836
981
|
],
|
|
837
982
|
options: fields,
|
|
838
983
|
folders: [],
|
|
@@ -853,18 +998,18 @@ export async function viewer(fields, e) {
|
|
|
853
998
|
{
|
|
854
999
|
label: "Filename",
|
|
855
1000
|
tag: "name",
|
|
856
|
-
modifier: "contains"
|
|
1001
|
+
modifier: "contains",
|
|
857
1002
|
},
|
|
858
1003
|
{
|
|
859
1004
|
label: "Tag",
|
|
860
1005
|
tag: "tag",
|
|
861
|
-
modifier: "equals"
|
|
1006
|
+
modifier: "equals",
|
|
862
1007
|
},
|
|
863
1008
|
{
|
|
864
1009
|
label: "Content",
|
|
865
1010
|
tag: "any",
|
|
866
|
-
modifier: "contains"
|
|
867
|
-
}
|
|
1011
|
+
modifier: "contains",
|
|
1012
|
+
},
|
|
868
1013
|
],
|
|
869
1014
|
opts: {
|
|
870
1015
|
search_string: "",
|
|
@@ -872,11 +1017,11 @@ export async function viewer(fields, e) {
|
|
|
872
1017
|
path: "/",
|
|
873
1018
|
search_string: "",
|
|
874
1019
|
sort_by: fields.sort_by || "date",
|
|
875
|
-
sort_dir: fields.sort_dir || "desc"
|
|
1020
|
+
sort_dir: fields.sort_dir || "desc",
|
|
876
1021
|
},
|
|
877
1022
|
limit: 5,
|
|
878
1023
|
isEndOfList: false,
|
|
879
|
-
allLoading: false
|
|
1024
|
+
allLoading: false,
|
|
880
1025
|
};
|
|
881
1026
|
},
|
|
882
1027
|
methods: {
|
|
@@ -889,8 +1034,15 @@ export async function viewer(fields, e) {
|
|
|
889
1034
|
this.isEndOfList = false;
|
|
890
1035
|
}
|
|
891
1036
|
|
|
892
|
-
const folders = await this.search_drive({
|
|
893
|
-
|
|
1037
|
+
const folders = await this.search_drive({
|
|
1038
|
+
...this.opts,
|
|
1039
|
+
type: "directory",
|
|
1040
|
+
});
|
|
1041
|
+
const files = await this.search_drive({
|
|
1042
|
+
...this.opts,
|
|
1043
|
+
...(all ? {} : { from: 0, to: this.limit }),
|
|
1044
|
+
type: "file",
|
|
1045
|
+
});
|
|
894
1046
|
|
|
895
1047
|
this.folders = folders.data.children || [];
|
|
896
1048
|
this.files = files.data.children || [];
|
|
@@ -906,7 +1058,9 @@ export async function viewer(fields, e) {
|
|
|
906
1058
|
});
|
|
907
1059
|
},
|
|
908
1060
|
uploadFiles() {
|
|
909
|
-
var pond = FilePond.find(
|
|
1061
|
+
var pond = FilePond.find(
|
|
1062
|
+
$("#imageUploaderComponent").find(`.filepond`)[0]
|
|
1063
|
+
);
|
|
910
1064
|
// debugger;
|
|
911
1065
|
this.uploaderLoading = true;
|
|
912
1066
|
pond.processFiles();
|
|
@@ -942,16 +1096,20 @@ export async function viewer(fields, e) {
|
|
|
942
1096
|
searchDebounce: _.debounce(async function ($event) {
|
|
943
1097
|
await this.refreshDirectory();
|
|
944
1098
|
}, 400),
|
|
945
|
-
moment
|
|
1099
|
+
moment,
|
|
946
1100
|
},
|
|
947
1101
|
mounted() {
|
|
948
1102
|
var onDrop = (files) => {
|
|
949
1103
|
this.uploadModal = true;
|
|
950
|
-
FilePond.find(
|
|
1104
|
+
FilePond.find(
|
|
1105
|
+
$("#imageUploaderComponent").find(`.filepond`)[0]
|
|
1106
|
+
)?.addFiles(files);
|
|
951
1107
|
// params.$refs.ImageUploader?.$refs?.pond?.addFiles(files);
|
|
952
1108
|
};
|
|
953
1109
|
|
|
954
|
-
const { isOverDropZone } = VueUse.useDropZone(this.$refs.dropZoneRef, {
|
|
1110
|
+
const { isOverDropZone } = VueUse.useDropZone(this.$refs.dropZoneRef, {
|
|
1111
|
+
onDrop,
|
|
1112
|
+
});
|
|
955
1113
|
|
|
956
1114
|
this.isOverDropZone = isOverDropZone;
|
|
957
1115
|
},
|
|
@@ -973,7 +1131,9 @@ export async function viewer(fields, e) {
|
|
|
973
1131
|
}
|
|
974
1132
|
},
|
|
975
1133
|
searchTags() {
|
|
976
|
-
return this.opts.search_string
|
|
1134
|
+
return this.opts.search_string
|
|
1135
|
+
.split(" ")
|
|
1136
|
+
.filter((e) => e.includes(":"));
|
|
977
1137
|
},
|
|
978
1138
|
search: {
|
|
979
1139
|
get() {
|
|
@@ -985,24 +1145,30 @@ export async function viewer(fields, e) {
|
|
|
985
1145
|
},
|
|
986
1146
|
|
|
987
1147
|
set(value) {
|
|
988
|
-
var existingTags = this.opts.search_string
|
|
1148
|
+
var existingTags = this.opts.search_string
|
|
1149
|
+
.split(" ")
|
|
1150
|
+
.filter((e) => e.includes(":"));
|
|
989
1151
|
|
|
990
|
-
this.opts.search_string = (
|
|
1152
|
+
this.opts.search_string = (
|
|
1153
|
+
existingTags.join(" ") +
|
|
1154
|
+
" " +
|
|
1155
|
+
value
|
|
1156
|
+
).trim();
|
|
991
1157
|
|
|
992
1158
|
if (value.length) {
|
|
993
1159
|
this.showSearchPopper = true;
|
|
994
1160
|
} else {
|
|
995
1161
|
this.showSearchPopper = false;
|
|
996
1162
|
}
|
|
997
|
-
}
|
|
998
|
-
}
|
|
1163
|
+
},
|
|
1164
|
+
},
|
|
999
1165
|
},
|
|
1000
1166
|
watch: {
|
|
1001
1167
|
opts: {
|
|
1002
1168
|
deep: true,
|
|
1003
1169
|
handler() {
|
|
1004
1170
|
this.searchDebounce();
|
|
1005
|
-
}
|
|
1171
|
+
},
|
|
1006
1172
|
},
|
|
1007
1173
|
view: {
|
|
1008
1174
|
handler(val) {
|
|
@@ -1011,7 +1177,7 @@ export async function viewer(fields, e) {
|
|
|
1011
1177
|
this.swiper = new Swiper(this.$refs["swiper-container"], {
|
|
1012
1178
|
loop: true,
|
|
1013
1179
|
slidesPerView: 1,
|
|
1014
|
-
spaceBetween: 20
|
|
1180
|
+
spaceBetween: 20,
|
|
1015
1181
|
});
|
|
1016
1182
|
});
|
|
1017
1183
|
}
|
|
@@ -1019,21 +1185,24 @@ export async function viewer(fields, e) {
|
|
|
1019
1185
|
this.$nextTick(() => {
|
|
1020
1186
|
refreshFsLightbox();
|
|
1021
1187
|
});
|
|
1022
|
-
}
|
|
1023
|
-
}
|
|
1188
|
+
},
|
|
1189
|
+
},
|
|
1024
1190
|
},
|
|
1025
1191
|
async created() {
|
|
1026
1192
|
this.refreshDirectory();
|
|
1027
1193
|
|
|
1028
1194
|
this.$nextTick(() => {
|
|
1029
1195
|
// debugger;
|
|
1030
|
-
this.initUploader(
|
|
1196
|
+
this.initUploader(
|
|
1197
|
+
{ ...fields, instant_file_upload: "N" },
|
|
1198
|
+
{ ...e, $containerP: $("#imageUploaderComponent") }
|
|
1199
|
+
);
|
|
1031
1200
|
});
|
|
1032
1201
|
|
|
1033
1202
|
this.$watch("opts", (value) => {
|
|
1034
1203
|
this.refreshDirectory();
|
|
1035
1204
|
});
|
|
1036
|
-
}
|
|
1205
|
+
},
|
|
1037
1206
|
});
|
|
1038
1207
|
|
|
1039
1208
|
setTimeout(() => {
|