@xuda.io/xuda-widget-plugin-xuda-drive 1.0.97 → 1.0.99
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/index.mjs +93 -75
- package/dist/{es/runtime.css → runtime.css} +2 -2
- package/dist/runtime.mjs +77372 -0
- package/package.json +1 -1
- package/src/index.mjs +93 -75
- package/vite.config.js +7 -50
- package/dist/es/runtime.es.js +0 -860
- package/dist/es/vendor-C-Nj-m2v.mjs +0 -76513
- package/dist/umd/runtime.css +0 -17
- package/dist/umd/runtime.umd.js +0 -646
package/dist/es/runtime.es.js
DELETED
|
@@ -1,860 +0,0 @@
|
|
|
1
|
-
import { r as registerPlugin, p as plugin, a as plugin$1, b as plugin$2, c as plugin$3, g as getEditorDefaults, d as create$f, l as legacyDataToImageState, e as processImage, f as createDefaultImageWriter, h as createDefaultImageReader, o as openEditor, i as createApp, u as useDebounceFn, S as Swiper, j as useDropZone, k as hooks, G as Gt } from "./vendor-C-Nj-m2v.mjs";
|
|
2
|
-
async function upload(fields, e) {
|
|
3
|
-
return new Promise(async (resolve, reject) => {
|
|
4
|
-
var u;
|
|
5
|
-
var overrideAction = "replace", existingFiles = {};
|
|
6
|
-
fields.method = e.method;
|
|
7
|
-
var ret_obj = { app_files: [], addedArr: [], deletedArr: [] }, init_files = [], widget_cssClass = fields.widget_cssClass, pond = void 0, init_files_fn = (i) => {
|
|
8
|
-
$.each(i, function(l, a) {
|
|
9
|
-
a != null && a.server_fileName && (a = a.server_fileName), a = func.utils.get_drive_url(e.SESSION_ID, a).value, ret_obj.app_files.push(a), init_files.push({
|
|
10
|
-
source: a,
|
|
11
|
-
options: {
|
|
12
|
-
type: "local"
|
|
13
|
-
}
|
|
14
|
-
});
|
|
15
|
-
});
|
|
16
|
-
};
|
|
17
|
-
_.isEmpty(fields.file_upload_init_file_array) || (typeof fields.file_upload_init_file_array == "string" && (fields.file_upload_init_file_array = eval(fields.file_upload_init_file_array)), (u = fields.file_upload_init_file_array) != null && u.length && init_files_fn(fields.file_upload_init_file_array));
|
|
18
|
-
var initialBindValue;
|
|
19
|
-
if (!_.isEmpty(fields["xu-bind"])) {
|
|
20
|
-
initialBindValue = await e.api_utils.get_field_value(fields["xu-bind"]);
|
|
21
|
-
let i = initialBindValue;
|
|
22
|
-
typeof i == "string" && (i = i.split(",").filter((l) => l)), i != null && i.length && init_files_fn(i);
|
|
23
|
-
}
|
|
24
|
-
const do_callback = function(i) {
|
|
25
|
-
setTimeout(async () => {
|
|
26
|
-
var l = pond.getFiles();
|
|
27
|
-
if (ret_obj.app_files = [], l.forEach((p) => {
|
|
28
|
-
var n = { data: {} };
|
|
29
|
-
i ? n.data.server_fileName = p.serverId : n.data = JSON.parse(p.serverId).data, ret_obj.app_files.push(n.data);
|
|
30
|
-
}), !_.isEmpty(fields["xu-bind"])) {
|
|
31
|
-
var a = ret_obj.app_files;
|
|
32
|
-
typeof initialBindValue == "string" && (a = ret_obj.app_files.map((p) => p.server_fileName).join(",")), await e.api_utils.set_field_value(fields["xu-bind"], a);
|
|
33
|
-
}
|
|
34
|
-
i && fields.event_name_for_successful_remove_callback && await e.api_utils.invoke_event(fields.event_name_for_successful_remove_callback), !i && fields.event_name_for_successful_callback && await e.api_utils.invoke_event(fields.event_name_for_successful_callback), fields.clear_on_file_upload && (pond.removeFiles(), e.api_utils.set_field_value(fields["xu-bind"], []));
|
|
35
|
-
}, 100);
|
|
36
|
-
};
|
|
37
|
-
var $pallet_wrapper = $('<div class="image_wrapper" style="border: none !important;">'), input_id = (/* @__PURE__ */ new Date()).valueOf(), $imgInp = $(`<input class="filepond ${widget_cssClass}" id="${input_id}" />`).appendTo($pallet_wrapper);
|
|
38
|
-
e.$containerP.html($pallet_wrapper), registerPlugin(plugin), registerPlugin(plugin$1), registerPlugin(plugin$2), registerPlugin(plugin$3);
|
|
39
|
-
const axios_ajax = function(i, l) {
|
|
40
|
-
$.each(l, function(a, p) {
|
|
41
|
-
e.append(a, p);
|
|
42
|
-
}), fetch(i, {
|
|
43
|
-
method: "POST",
|
|
44
|
-
body: e
|
|
45
|
-
}).then((a) => {
|
|
46
|
-
console.log("Request complete! response:", a);
|
|
47
|
-
});
|
|
48
|
-
};
|
|
49
|
-
var opt = {
|
|
50
|
-
allowProcess: !0,
|
|
51
|
-
allowRemove: !0,
|
|
52
|
-
allowRevert: !0,
|
|
53
|
-
imageCropAspectRatio: 1,
|
|
54
|
-
imageResizeTargetWidth: 200,
|
|
55
|
-
// allowProcess: false,
|
|
56
|
-
imageEditInstantEdit: !1,
|
|
57
|
-
credits: !1,
|
|
58
|
-
allowMultiple: !1,
|
|
59
|
-
imageEditorSupportImage: (i) => i.type !== "image/svg+xml" && i.type !== "image/gif" && !i.type.includes("audio") && !i.type.includes("video"),
|
|
60
|
-
imageEditor: {
|
|
61
|
-
createEditor: openEditor,
|
|
62
|
-
imageReader: [createDefaultImageReader],
|
|
63
|
-
imageWriter: [createDefaultImageWriter],
|
|
64
|
-
imageProcessor: processImage,
|
|
65
|
-
editorOptions: {
|
|
66
|
-
...getEditorDefaults()
|
|
67
|
-
},
|
|
68
|
-
legacyDataToImageState
|
|
69
|
-
},
|
|
70
|
-
server: {
|
|
71
|
-
load: (i, l, a, p, n, h) => {
|
|
72
|
-
try {
|
|
73
|
-
fetch(i).then(function(v) {
|
|
74
|
-
try {
|
|
75
|
-
if (v.ok) return v.blob();
|
|
76
|
-
throw new Error("bad image");
|
|
77
|
-
} catch {
|
|
78
|
-
a({});
|
|
79
|
-
}
|
|
80
|
-
}).then(l).catch((v) => {
|
|
81
|
-
a({});
|
|
82
|
-
});
|
|
83
|
-
} catch {
|
|
84
|
-
a({});
|
|
85
|
-
}
|
|
86
|
-
return {
|
|
87
|
-
abort: () => {
|
|
88
|
-
n();
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
},
|
|
92
|
-
process: (i, l, a, p, n, h, v, g, k) => {
|
|
93
|
-
var w;
|
|
94
|
-
let f = new FormData();
|
|
95
|
-
f.append("file", l, l.name);
|
|
96
|
-
const { app_id: m, gtp_token: x, app_token: t } = e._session;
|
|
97
|
-
f.append("app_id_reference", (w = APP_OBJ == null ? void 0 : APP_OBJ[m]) == null ? void 0 : w.app_id_reference), f.append("app_id", m), f.append("gtp_token", x), f.append("app_token", t), f.append("drive_type", "workspace"), fields.file_upload_folder && f.append("folder", fields.file_upload_folder), fields.public_file && f.append("make_public", fields.public_file);
|
|
98
|
-
let o = fields.assign_file_tags || [], d = [];
|
|
99
|
-
if (fields.auto_tag_generator) {
|
|
100
|
-
let r = fields.auto_tag_identifier || " ";
|
|
101
|
-
if (d = l.name.split(".").slice(0, -1).join(".").split(r), fields.auto_tag_translation)
|
|
102
|
-
for (let b of d)
|
|
103
|
-
fields.auto_tag_translation[b] && (b = fields.auto_tag_translation[b]);
|
|
104
|
-
}
|
|
105
|
-
f.append("tags", [...o, ...d]);
|
|
106
|
-
const s = new XMLHttpRequest();
|
|
107
|
-
let c = e._session.domain;
|
|
108
|
-
return e._session.is_deployment && (c = e._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io"), overrideAction === "replace" && l.name in existingFiles ? (f.append("file_path", "/" + l.name), f.append("file_name", l.name), s.open("POST", `https://${c}/cpi/update_drive_file_workspace`)) : s.open("POST", `https://${c}/cpi/upload_drive_file_workspace`), s.setRequestHeader("xu-gtp-token", x), s.setRequestHeader("xu-app-token", t), s.upload.onprogress = (r) => {
|
|
109
|
-
h(r.lengthComputable, r.loaded, r.total);
|
|
110
|
-
}, s.onload = async function() {
|
|
111
|
-
var r = {};
|
|
112
|
-
try {
|
|
113
|
-
r = JSON.parse(s.responseText);
|
|
114
|
-
} catch {
|
|
115
|
-
}
|
|
116
|
-
if (s.status >= 200 && s.status < 300 && r.code > 0) {
|
|
117
|
-
p(s.responseText);
|
|
118
|
-
var y = r.data;
|
|
119
|
-
ret_obj.addedArr.push(y), delete r.code, ret_obj.app_files.push(y);
|
|
120
|
-
} else
|
|
121
|
-
n(r.data);
|
|
122
|
-
}, s.onerror = () => {
|
|
123
|
-
var r = JSON.parse(s.responseText);
|
|
124
|
-
n(r.data), this.$emit("error", n);
|
|
125
|
-
}, s.send(f), {
|
|
126
|
-
abort: () => {
|
|
127
|
-
s.abort(), v();
|
|
128
|
-
}
|
|
129
|
-
};
|
|
130
|
-
},
|
|
131
|
-
revert: (i, l, a) => {
|
|
132
|
-
var p = JSON.parse(i), n = p.data;
|
|
133
|
-
ret_obj.deletedArr.push(n);
|
|
134
|
-
var h = ret_obj.app_files.indexOf(n.server_fileName);
|
|
135
|
-
h !== -1 && ret_obj.app_files.splice(h, 1);
|
|
136
|
-
let v = e._session.app_id, g = APP_OBJ[v].app_id_reference;
|
|
137
|
-
axios_ajax(func.common.get_url(e.SESSION_ID, "rpi", "runtime_delete_file_bulk"), {
|
|
138
|
-
app_id: v,
|
|
139
|
-
server_files: ret_obj.deletedArr,
|
|
140
|
-
app_id_reference: g,
|
|
141
|
-
gtp_token: e._session.gtp_token
|
|
142
|
-
}), l();
|
|
143
|
-
},
|
|
144
|
-
remove: (i, l, a) => {
|
|
145
|
-
var p = i.split("/").pop();
|
|
146
|
-
ret_obj.deletedArr.push(p);
|
|
147
|
-
var n = ret_obj.app_files.indexOf((h) => h.server_fileName === i);
|
|
148
|
-
n !== -1 && ret_obj.app_files.splice(n, 1), fields.instant_file_upload !== "N" && do_callback(!0), l();
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
};
|
|
152
|
-
if (fields.file_upload_drop_area_label && (opt.labelIdle = fields.file_upload_drop_area_label), fields.file_upload_allow_multiple_files && (opt.allowMultiple = !0), init_files && (opt.files = init_files), opt.instantUpload = fields.instant_file_upload !== "N", fields.file_upload_mime_type_preset)
|
|
153
|
-
switch (fields.file_upload_mime_type_preset) {
|
|
154
|
-
case "image":
|
|
155
|
-
opt.acceptedFileTypes = ["image/*"];
|
|
156
|
-
break;
|
|
157
|
-
case "video":
|
|
158
|
-
opt.acceptedFileTypes = ["video/*"];
|
|
159
|
-
break;
|
|
160
|
-
case "audio":
|
|
161
|
-
opt.acceptedFileTypes = ["audio/*"];
|
|
162
|
-
break;
|
|
163
|
-
default:
|
|
164
|
-
opt.acceptedFileTypes = ["image/*"];
|
|
165
|
-
}
|
|
166
|
-
else
|
|
167
|
-
fields.file_upload_custom_mime_types ? opt.acceptedFileTypes = fields.file_upload_custom_mime_types.split(",") : opt.allowFileTypeValidation = !1;
|
|
168
|
-
fields.file_upload_mask === "circle" && (opt.imagePreviewHeight = 170, opt.imageCropAspectRatio = "1:1", opt.imageResizeTargetWidth = 200, opt.imageResizeTargetHeight = 200, opt.stylePanelLayout = "compact circle", opt.styleLoadIndicatorPosition = "center bottom", opt.styleProgressIndicatorPosition = "right bottom", opt.styleButtonRemoveItemPosition = "left bottom", opt.styleButtonProcessItemPosition = "right bottom"), pond = create$f($imgInp[0], opt), pond.on("processfiles", (i) => {
|
|
169
|
-
do_callback();
|
|
170
|
-
});
|
|
171
|
-
function processFiles(i, l = {}) {
|
|
172
|
-
overrideAction = l.overrideAction, existingFiles = l.existingFiles, i ? pond.processFiles(i) : pond.processFiles();
|
|
173
|
-
}
|
|
174
|
-
resolve({
|
|
175
|
-
pond,
|
|
176
|
-
processFiles
|
|
177
|
-
});
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
async function viewer(u, i) {
|
|
181
|
-
const { app_id: l, gtp_token: a, app_token: p } = i._session;
|
|
182
|
-
var n = {
|
|
183
|
-
template: `
|
|
184
|
-
<div class="relative isolate [--spinner-dots-stroke-dasharray:0_3.315] [--spinner-stroke:1] [--spinner-thumb-animation-duration:1.5s] *:size-full">
|
|
185
|
-
<span class="sr-only">Loading…</span>
|
|
186
|
-
|
|
187
|
-
<span class="absolute grid place-items-center inset-0 font-semibold">
|
|
188
|
-
<slot> </slot>
|
|
189
|
-
</span>
|
|
190
|
-
|
|
191
|
-
<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
192
|
-
<g class="motion-safe:origin-[--spinner-origin] motion-safe:animate-spin motion-safe:will-change-transform motion-safe:[animation-direction:reverse] motion-safe:[animation-duration:12s]" fill="currentColor" opacity="0.5">
|
|
193
|
-
<circle cx="8" cy="2.75" r="0.5"></circle>
|
|
194
|
-
<circle cx="8" cy="13.25" r="0.5"></circle>
|
|
195
|
-
<circle cx="3.01001" cy="6.35999" r="0.5"></circle>
|
|
196
|
-
<circle cx="12.98" cy="6.35999" r="0.5"></circle>
|
|
197
|
-
<circle cx="3.01001" cy="9.62" r="0.5"></circle>
|
|
198
|
-
<circle cx="12.99" cy="9.62" r="0.5"></circle>
|
|
199
|
-
<circle cx="4.91998" cy="3.75" r="0.5"></circle>
|
|
200
|
-
<circle cx="11.08" cy="3.75" r="0.5"></circle>
|
|
201
|
-
<circle cx="4.91998" cy="12.25" r="0.5"></circle>
|
|
202
|
-
<circle cx="11.08" cy="12.25" r="0.5"></circle>
|
|
203
|
-
</g>
|
|
204
|
-
|
|
205
|
-
<circle
|
|
206
|
-
class="motion-safe:origin-[--spinner-origin] motion-safe:animate-spin motion-safe:will-change-transform motion-safe:[animation-duration:--spinner-thumb-animation-duration]"
|
|
207
|
-
cx="8"
|
|
208
|
-
cy="8"
|
|
209
|
-
r="5.25"
|
|
210
|
-
pathLength="360"
|
|
211
|
-
stroke="currentColor"
|
|
212
|
-
stroke-linecap="round"
|
|
213
|
-
stroke-linejoin="round"
|
|
214
|
-
stroke-dashoffset="100"
|
|
215
|
-
stroke-dasharray="90 270"
|
|
216
|
-
stroke-width="var(--spinner-stroke,1.5)"
|
|
217
|
-
></circle>
|
|
218
|
-
</svg>
|
|
219
|
-
</div>
|
|
220
|
-
`
|
|
221
|
-
}, h = {
|
|
222
|
-
props: ["options", "modelValue"],
|
|
223
|
-
computed: {
|
|
224
|
-
model: {
|
|
225
|
-
get() {
|
|
226
|
-
var t = this.modelValue;
|
|
227
|
-
return t;
|
|
228
|
-
},
|
|
229
|
-
set(t) {
|
|
230
|
-
this.$emit("update:modelValue", t);
|
|
231
|
-
}
|
|
232
|
-
},
|
|
233
|
-
segmentActive() {
|
|
234
|
-
var t = _.findIndex(this.options, (o) => o.value === this.model);
|
|
235
|
-
return t;
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
template: `
|
|
239
|
-
<div class="flex relative items-center rounded-lg bg-gray-100 [&>button]:px-4 [&>button]:py-2">
|
|
240
|
-
<button v-for="option in options" @click="model = option.value" type="button" class="flex items-center gap-2 text-gray-500 focus:outline-none relative z-20 text-sm">
|
|
241
|
-
<span v-html="option.icon"/>
|
|
242
|
-
<div class="truncate empty:hidden">{{ option.label }}</div>
|
|
243
|
-
<span class="sr-only">Use {{option.label}} view</span>
|
|
244
|
-
</button>
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
<div :style="{ left: segmentActive > 0 ? (Number(segmentActive) / options.length) * 100 + '%' : 0, width: 100 / options.length + '%' }" class="after:absolute transition-all duration-300 after:inset-[3px] after:bg-white after:rounded-lg after:shadow absolute h-full rounded"></div>
|
|
248
|
-
</div>
|
|
249
|
-
`
|
|
250
|
-
}, v = {
|
|
251
|
-
props: ["file", "size"],
|
|
252
|
-
template: `
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
<div class="aspect-[3/2] group relative block w-full overflow-hidden rounded-lg bg-gray-100 border">
|
|
256
|
-
<div v-if="size === 'sm' && (file.extension === 'mp3' || file.extension === 'mp4')">
|
|
257
|
-
<svg class="h-5 w-10" v-if="file.extension === 'mp3'" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
258
|
-
<path fill="#dc2625" d="M12,20a1.00061,1.00061,0,0,1-.625-.21875L6.64941,16H3a.99943.99943,0,0,1-1-1V9A.99943.99943,0,0,1,3,8H6.64941L11.375,4.21875A1.00025,1.00025,0,0,1,13,5V19a.9993.9993,0,0,1-1,1Z" />
|
|
259
|
-
<path fill="#f1a8a7" d="M18.501,18.3623a.99995.99995,0,0,1-.64356-1.76562,6.00231,6.00231,0,0,0,.38574-8.83984.9999.9999,0,0,1,1.41407-1.41407,8.00064,8.00064,0,0,1-.51465,11.78516A.99536.99536,0,0,1,18.501,18.3623Z" />
|
|
260
|
-
<path fill="#ea7c7c" d="M15.92969,15.29785a1,1,0,0,1-.64356-1.7666A1.99114,1.99114,0,0,0,16,12a2.01438,2.01438,0,0,0-.58594-1.41406.99989.99989,0,0,1,1.41406-1.41406,3.99974,3.99974,0,0,1-.25683,5.89257A.99968.99968,0,0,1,15.92969,15.29785Z" />
|
|
261
|
-
</svg>
|
|
262
|
-
|
|
263
|
-
<svg class="h-5 w-10" v-else-if="file.extension === 'mp4'" xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" viewBox="0 0 24 24">
|
|
264
|
-
<path fill="#ea7c7c" d="M14,18H5c-1.65611-0.00181-2.99819-1.34389-3-3V9c0.00181-1.65611,1.34389-2.99819,3-3h9c1.65611,0.00181,2.99819,1.34389,3,3v6C16.99819,16.65611,15.65611,17.99819,14,18z" />
|
|
265
|
-
<path
|
|
266
|
-
fill="#dc2625"
|
|
267
|
-
d="M21.89465,7.55359c-0.24683-0.49432-0.8476-0.69495-1.34192-0.44812l-3.56421,1.7821C16.98999,8.92572,16.99994,8.96149,17,9v6c-0.00006,0.03851-0.01001,0.07428-0.01147,0.11243l3.56421,1.7821C20.69165,16.96381,20.84479,16.99994,21,17c0.55212-0.00037,0.99969-0.44788,1-1V8C21.99994,7.84503,21.96387,7.6922,21.89465,7.55359z" />
|
|
268
|
-
</svg>
|
|
269
|
-
</div>
|
|
270
|
-
|
|
271
|
-
<template v-else-if="size !== 'sm' && (file.extension === 'mp3' || file.extension === 'mp4')">
|
|
272
|
-
<div v-if="file.extension === 'mp3'" class="flex h-full flex-col items-center justify-center bg-light-50">
|
|
273
|
-
<audio class="w-[90%]" controls>
|
|
274
|
-
<source :src="file.access_link" type="audio/ogg" />
|
|
275
|
-
<source :src="file.access_link" type="audio/mpeg" />
|
|
276
|
-
<source :src="file.access_link" type="audio/mp3" />
|
|
277
|
-
</audio>
|
|
278
|
-
</div>
|
|
279
|
-
|
|
280
|
-
<video v-else-if="file.extension === 'mp4'" controls class="h-full object-cover">
|
|
281
|
-
<source :src="file.access_link" type="video/mp4" />
|
|
282
|
-
<source :src="file.access_link" type="video/ogg" />
|
|
283
|
-
</video>
|
|
284
|
-
</template>
|
|
285
|
-
|
|
286
|
-
<a v-else-if="file.extension === 'svg' || file.extension === 'png' || file.extension === 'jpg' || file.extension === 'jpeg' || file.extension === 'webp'" data-fslightbox="gallery" :href="file.access_link">
|
|
287
|
-
<img :src="file.access_link" :alt="file.name" class="pointer-events-none object-cover checker-bg" />
|
|
288
|
-
</a>
|
|
289
|
-
|
|
290
|
-
<div v-else-if="file.type === 'directory'">
|
|
291
|
-
<div class="flex h-full cursor-pointer flex-col items-center justify-center gap-4">
|
|
292
|
-
<svg class="h-24 w-24 text-light-800 dark:text-newDark-700" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path></svg>
|
|
293
|
-
</div>
|
|
294
|
-
</div>
|
|
295
|
-
|
|
296
|
-
<div class="flex items-center justify-center bg-light-50 dark:bg-newDark-950" v-else>
|
|
297
|
-
<h1 :class="[size === 'sm' ? 'text-xs' : 'text-2xl sm:text-5xl', 'bg-gradient-to-r from-xudaTint-300 to-xudaTint-600 bg-clip-text py-2 font-extrabold text-transparent']">{{ file.extension }}</h1>
|
|
298
|
-
</div>
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
<div v-tooltip="file.tags.join(', ')" class="rounded-full flex items-center gap-2 absolute top-3 right-3 px-3 py-1 text-sm bg-white border" v-if="file.tags?.length">
|
|
302
|
-
<svg class="size-4" xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 256 256">
|
|
303
|
-
<g fill="#878787">
|
|
304
|
-
<path d="m240 128l-45.62 68.44a8 8 0 0 1-6.66 3.56H40a8 8 0 0 1-8-8V64a8 8 0 0 1 8-8h147.72a8 8 0 0 1 6.66 3.56Z" opacity=".2" />
|
|
305
|
-
<path d="M246.66 123.56L201 55.13A15.94 15.94 0 0 0 187.72 48H40a16 16 0 0 0-16 16v128a16 16 0 0 0 16 16h147.72a16 16 0 0 0 13.28-7.12l45.63-68.44a8 8 0 0 0 .03-8.88M187.72 192H40V64h147.72l42.66 64Z" />
|
|
306
|
-
</g>
|
|
307
|
-
</svg>
|
|
308
|
-
{{ file.tags.length }} tags
|
|
309
|
-
</div>
|
|
310
|
-
|
|
311
|
-
</div>
|
|
312
|
-
`
|
|
313
|
-
};
|
|
314
|
-
const g = `
|
|
315
|
-
<div class="flex flex-col divide-y overflow-hidden h-full" dir="ltr">
|
|
316
|
-
<div v-if="options.show_toolbar !== false" class="flex items-center py-2 px-6">
|
|
317
|
-
<div class="flex gap-2 items-center flex-1">
|
|
318
|
-
<h1 class="text-2xl font-bold text-gray-900 capitalize" v-text="options.toolbar_label || view"></h1>
|
|
319
|
-
</div>
|
|
320
|
-
|
|
321
|
-
<div class="flex items-center gap-4">
|
|
322
|
-
<div class="relative">
|
|
323
|
-
<div class="pointer-events-none absolute inset-y-0 left-0 flex items-center pl-3">
|
|
324
|
-
<svg class="h-5 w-5 text-gray-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
325
|
-
<path fill-rule="evenodd" d="M9 3.5a5.5 5.5 0 100 11 5.5 5.5 0 000-11zM2 9a7 7 0 1112.452 4.391l3.328 3.329a.75.75 0 11-1.06 1.06l-3.329-3.328A7 7 0 012 9z" clip-rule="evenodd"></path>
|
|
326
|
-
</svg>
|
|
327
|
-
</div>
|
|
328
|
-
|
|
329
|
-
<VDropdown popperClass="w-96" :triggers="[]" :disposeTimeout="10" :shown="showSearchPopper" :autoHide="false" placement="bottom">
|
|
330
|
-
<ul class="focus:ring-2 focus:ring-offset-2 focus:ring-neutral-400 relative min-h-[38px] flex items-center justify-between w-full py-2 px-3 text-left bg-white border rounded-md shadow-sm cursor-default border-neutral-200/70 focus:outline-none text-sm flex items-center gap-2 px-2">
|
|
331
|
-
<li v-for="(chip, i) in searchTags" :class="[removeChipCount && i == searchTags.length - 1 ? 'bg-neutral-400' : 'bg-neutral-200 ']" class="rounded-lg flex items-stretch text-sm overflow-hidden">
|
|
332
|
-
<div :class="[removeChipCount && i == searchTags.length - 1 ? 'bg-neutral-500/20' : 'bg-neutral-300']" class="uppercase flex items-center text-[0.65rem] px-2">{{ chip.split(':')[0] }}</div>
|
|
333
|
-
<div class="px-2 flex items-center">{{ chip.split(':')[1] }}</div>
|
|
334
|
-
</li>
|
|
335
|
-
<li>
|
|
336
|
-
<input type="text" ref="search" placeholder="Search" @focus="search.length ? (showSearchPopper = true) : ''" @blur="hideSearchPopper" class="border-0 ring-0 focus:ring-0 py-0 px-1" v-model.trim="search" @keyup.delete="removeLastSearch" />
|
|
337
|
-
</li>
|
|
338
|
-
|
|
339
|
-
<div class="absolute right-4 flex items-center gap-2 empty:hidden">
|
|
340
|
-
<sepcial-loader class="size-5" v-if="loadingSearch" />
|
|
341
|
-
|
|
342
|
-
<template v-if="search.length">
|
|
343
|
-
<button @click="search = '' ">
|
|
344
|
-
<svg class="w-4 h-4" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
|
345
|
-
<path fill-rule="evenodd" d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" clip-rule="evenodd"></path>
|
|
346
|
-
</svg>
|
|
347
|
-
</button>
|
|
348
|
-
</template>
|
|
349
|
-
</div>
|
|
350
|
-
</ul>
|
|
351
|
-
<template #popper>
|
|
352
|
-
<div class="space-y-3 divide-y xuda-divide p-4">
|
|
353
|
-
<div v-for="option in searchOptions" class="search-option [&:not(:first-child)]:pt-3">
|
|
354
|
-
<div class="search-option-label text-xs font-semibold mb-1 text-light-800">{{ option.label }}</div>
|
|
355
|
-
<button class="search-option-action hover:bg-black px-2 -mx-2 py-1 block w-full text-left rounded-md hover:text-white text-sm" @click="search ? ((search = option.tag+':'+ search), $refs.search.focus()) : ''">{{option.label}} {{option.modifier}} "{{ search }}"</button>
|
|
356
|
-
</div>
|
|
357
|
-
</div>
|
|
358
|
-
</template>
|
|
359
|
-
</VDropdown>
|
|
360
|
-
</div>
|
|
361
|
-
|
|
362
|
-
<segment-component :options="sortDirOptions" v-model="opts.sort_dir" />
|
|
363
|
-
|
|
364
|
-
<segment-component :options="sortOptions" v-model="opts.sort_by" />
|
|
365
|
-
|
|
366
|
-
<segment-component :options="viewOptions" v-model="view" />
|
|
367
|
-
|
|
368
|
-
<div>
|
|
369
|
-
<button
|
|
370
|
-
@click="uploadModal = true"
|
|
371
|
-
type="button"
|
|
372
|
-
class="inline-flex items-center justify-center px-4 py-2 text-sm font-medium tracking-wide text-white transition-colors duration-200 rounded-md bg-neutral-950 hover:bg-neutral-900 focus:ring-2 focus:ring-offset-2 focus:ring-neutral-900 focus:shadow-outline focus:outline-none"
|
|
373
|
-
>
|
|
374
|
-
Upload
|
|
375
|
-
</button>
|
|
376
|
-
</div>
|
|
377
|
-
</div>
|
|
378
|
-
</div>
|
|
379
|
-
|
|
380
|
-
<!-- Tabs -->
|
|
381
|
-
<div ref="dropZoneRef" class="flex-1 overflow-auto size-full relative">
|
|
382
|
-
<div v-if="isOverDropZone && view !== 'slider'" class="absolute inset-0 z-10 px-2 py-2 animate">
|
|
383
|
-
<div class="size-full flex flex-col justify-between items-center !border-black border-2 rounded-2xl bg-black/20">
|
|
384
|
-
<div></div>
|
|
385
|
-
|
|
386
|
-
<div></div>
|
|
387
|
-
</div>
|
|
388
|
-
</div>
|
|
389
|
-
|
|
390
|
-
<template v-if="view === 'gallery' || view === 'list'">
|
|
391
|
-
<div class="flex-1 overflow-auto" :class="{ 'grid gap-x-4 gap-y-4 grid-cols-2 sm:grid-cols-3 sm:gap-x-6 md:grid-cols-4 lg:grid-cols-4 xl:grid-cols-5 xl:gap-x-6 p-4': view === 'gallery', 'flex flex-col divide-y': view === 'list' }">
|
|
392
|
-
<div :class="{ 'md:col-span-4 xl:col-span-5 grid gap-x-4 gap-y-3 grid-cols-2 sm:grid-cols-3 sm:gap-x-6 md:grid-cols-4 lg:grid-cols-4 xl:grid-cols-5 sm:gap-x-6': view === 'gallery'}">
|
|
393
|
-
<template v-for="folder in folders">
|
|
394
|
-
<div v-if="view === 'gallery'" class="flex items-center justify-between px-3 group gap-2 rounded-lg bg-gray-100 border py-3">
|
|
395
|
-
<div class="flex items-center gap-2 truncate flex-1">
|
|
396
|
-
<svg class="h-7 w-7 shrink-0" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path></svg>
|
|
397
|
-
<div>{{folder.name}}</div>
|
|
398
|
-
</div>
|
|
399
|
-
<div class="flex items-center justify-between gap-2">
|
|
400
|
-
<div class="hidden font-normal sm:block">{{ folder.size }}</div>
|
|
401
|
-
</div>
|
|
402
|
-
</div>
|
|
403
|
-
</template>
|
|
404
|
-
</div>
|
|
405
|
-
|
|
406
|
-
<template v-for="file in (view === 'list' ? [...folders, ...files] : files)">
|
|
407
|
-
<div v-if="view === 'gallery'" class="relative">
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
<imagePreview :file="file" />
|
|
411
|
-
|
|
412
|
-
<div class="mt-2 block truncate font-medium text-sm text-gray-900" v-text="file.name"></div>
|
|
413
|
-
<div class="flex items-center justify-between text-xs text-gray-500">
|
|
414
|
-
<div class="truncate" v-text="file.size"></div>
|
|
415
|
-
<div class="truncate" v-text="moment(file.date_created).format('lll')"></div>
|
|
416
|
-
</div>
|
|
417
|
-
</div>
|
|
418
|
-
<div v-if="view === 'list'" class="flex group items-center justify-between py-2 px-4 hover:bg-neutral-100 transition-all">
|
|
419
|
-
<div class="flex items-center gap-4 truncate max-w-6xl">
|
|
420
|
-
<a v-if="file.type==='file'" data-fslightbox="gallery" :href="file.access_link" class="group block shrink-0 overflow-hidden">
|
|
421
|
-
<img :src="file.access_link" :alt="file.name" class="pointer-events-none object-cover checker-bg flex w-10 h-8 items-center" />
|
|
422
|
-
</a>
|
|
423
|
-
<div class="w-10 h-8 grid place-items-center shrink-0 rounded-lg bg-gray-100 border" v-if="file.type==='directory'">
|
|
424
|
-
<svg class="size-6" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path d="M2 6a2 2 0 012-2h5l2 2h5a2 2 0 012 2v6a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"></path></svg>
|
|
425
|
-
</div>
|
|
426
|
-
|
|
427
|
-
<div class="pointer-events-none block w-56 truncate text-left font-medium 2xl:w-full" v-text="file.name"></div>
|
|
428
|
-
</div>
|
|
429
|
-
<div class="flex items-center gap-3 truncate text-gray-500">
|
|
430
|
-
<div class="flex flex-wrap gap-1">
|
|
431
|
-
<div class="inline-flex bg-neutral-100 group-hover:bg-neutral-200 py-1 px-2 text-xs rounded-full" v-for="tag in file.tags">{{ tag }}</div>
|
|
432
|
-
</div>
|
|
433
|
-
<div class="truncate" v-text="file.size"></div>
|
|
434
|
-
<div class="truncate" v-text="moment(file.date_created).format('lll')"></div>
|
|
435
|
-
</div>
|
|
436
|
-
</div>
|
|
437
|
-
</template>
|
|
438
|
-
</div>
|
|
439
|
-
|
|
440
|
-
<div v-if="!isEndOfList && (!loadingSearch || loadingSearch && allLoading) && files.length" class="sticky text-center col-span-5 py-6 bottom-0 left-0 right-0">
|
|
441
|
-
<button :class="[allLoading ? 'px-1.5' : 'px-4']" class="px-4 bg-black/80 rounded-full py-1.5 transition-all text-white font-semibold" @click="refreshDirectory(true)">
|
|
442
|
-
<template v-if="allLoading">
|
|
443
|
-
<sepcial-loader class="size-6" />
|
|
444
|
-
</template>
|
|
445
|
-
|
|
446
|
-
<template v-else> Load all </template>
|
|
447
|
-
</button>
|
|
448
|
-
</div>
|
|
449
|
-
</template>
|
|
450
|
-
|
|
451
|
-
<div v-if="view === 'slider'" class="relative flex items-center justify-between py-4 px-4 flex-1 h-full overflow-hidden">
|
|
452
|
-
<div v-if="options.navigation" class="absolute inset-y-0 left-6 z-10 flex items-center">
|
|
453
|
-
<button @click="options.direction === 'rtl' ? swiper.slideNext() : swiper.slidePrev()" class="bg-white -ml-2 lg:-ml-4 flex justify-center items-center w-10 h-10 rounded-full shadow focus:outline-none">
|
|
454
|
-
<svg viewBox="0 0 20 20" fill="currentColor" class="chevron-left w-6 h-6"><path fill-rule="evenodd" d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z" clip-rule="evenodd"></path></svg>
|
|
455
|
-
</button>
|
|
456
|
-
</div>
|
|
457
|
-
|
|
458
|
-
<div class="swiper-container flex-1 w-full h-full" :dir="options.direction || 'ltr'" ref="swiper-container">
|
|
459
|
-
<div class="swiper-wrapper">
|
|
460
|
-
<!-- Slides -->
|
|
461
|
-
<template v-for="file in files" hidden>
|
|
462
|
-
<div class="swiper-slide">
|
|
463
|
-
<a data-fslightbox="gallery" :href="file.access_link" class="flex-shrink-0">
|
|
464
|
-
<img class="h-full w-full object-cover" :src="file.access_link" :alt="file.name" />
|
|
465
|
-
</a>
|
|
466
|
-
</div>
|
|
467
|
-
</template>
|
|
468
|
-
</div>
|
|
469
|
-
</div>
|
|
470
|
-
|
|
471
|
-
<div v-if="options.navigation" class="absolute inset-y-0 right-6 z-10 flex items-center">
|
|
472
|
-
<button @click="options.direction === 'rtl' ? swiper.slidePrev() : swiper.slideNext()" class="bg-white -mr-2 lg:-mr-4 flex justify-center items-center w-10 h-10 rounded-full shadow focus:outline-none">
|
|
473
|
-
<svg viewBox="0 0 20 20" fill="currentColor" class="chevron-right w-6 h-6"><path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd"></path></svg>
|
|
474
|
-
</button>
|
|
475
|
-
</div>
|
|
476
|
-
</div>
|
|
477
|
-
</div>
|
|
478
|
-
|
|
479
|
-
<teleport to="body">
|
|
480
|
-
<div @keydown.escape.window="uploadModal = false" v-show="uploadModal" class="fixed top-0 left-0 z-[99] w-screen h-screen" x-cloak>
|
|
481
|
-
<div v-show="uploadModal" @click="uploadModal=false" class="absolute inset-0 w-full h-full bg-white backdrop-blur-sm bg-opacity-70"></div>
|
|
482
|
-
|
|
483
|
-
<transition key="wrapper" enter-from-class="opacity-0" enter-active-class="ease-out duration-300" enter-to-class="opacity-100" leave-from-class="opacity-100" leave-active-class="ease-in duration-300" leave-to-class="opacity-0">
|
|
484
|
-
<div class="flex items-center justify-center size-full" v-show="uploadModal">
|
|
485
|
-
<transition
|
|
486
|
-
key="inner"
|
|
487
|
-
enter-active-class="ease-out duration-300"
|
|
488
|
-
enter-from-class="opacity-0 -translate-y-2 sm:scale-95"
|
|
489
|
-
enter-to-class="opacity-100 translate-y-0 sm:scale-100"
|
|
490
|
-
leave-active-class="ease-in duration-200"
|
|
491
|
-
leave-from-class="opacity-100 translate-y-0 sm:scale-100"
|
|
492
|
-
leave-to-class="opacity-0 -translate-y-2 sm:scale-95"
|
|
493
|
-
>
|
|
494
|
-
<div v-show="uploadModal" class="relative w-full py-6 bg-white border shadow-lg px-7 border-neutral-200 sm:max-w-lg sm:rounded-lg overflow-hidden">
|
|
495
|
-
<div class="flex items-center justify-between pb-3">
|
|
496
|
-
<h3 class="text-lg font-semibold" v-text="'Upload file' + (options.file_upload_allow_multiple_files ? 's' : '')"></h3>
|
|
497
|
-
<button @click="uploadModal=false" class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 text-gray-600 rounded-full hover:text-gray-800 hover:bg-gray-50">
|
|
498
|
-
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
|
|
499
|
-
</button>
|
|
500
|
-
</div>
|
|
501
|
-
<div id="imageUploaderComponent" class="relative w-auto pb-8 h-48 [&>div]:h-full [&>div>div]:h-full"></div>
|
|
502
|
-
<div class="flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2">
|
|
503
|
-
<button @click="uploadModal=false" type="button" class="inline-flex gap-2 items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border rounded-md focus:outline-none focus:ring-2 focus:ring-neutral-100 focus:ring-offset-2">
|
|
504
|
-
<div>Dismiss</div>
|
|
505
|
-
</button>
|
|
506
|
-
<button
|
|
507
|
-
@click="uploadFiles(false)"
|
|
508
|
-
:disabled="uploaderLoading"
|
|
509
|
-
type="button"
|
|
510
|
-
class="inline-flex items-center gap-2 justify-center h-10 px-4 py-2 text-sm font-medium text-white transition-colors border border-transparent rounded-md focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-2 bg-neutral-950 hover:bg-neutral-900 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
511
|
-
>
|
|
512
|
-
<template v-if="uploaderLoading">
|
|
513
|
-
<sepcial-loader class="size-5" />
|
|
514
|
-
Uploading
|
|
515
|
-
</template>
|
|
516
|
-
|
|
517
|
-
<template v-else>Upload</template>
|
|
518
|
-
</button>
|
|
519
|
-
</div>
|
|
520
|
-
|
|
521
|
-
<div v-show="showExistModal" class="absolute inset-0 bg-white py-6 px-7 flex flex-col">
|
|
522
|
-
<div class="flex items-center justify-between pb-3">
|
|
523
|
-
<h3 class="text-lg font-semibold">Upload options</h3>
|
|
524
|
-
<button @click="showExistModal=false" class="absolute top-0 right-0 flex items-center justify-center w-8 h-8 mt-5 mr-5 text-gray-600 rounded-full hover:text-gray-800 hover:bg-gray-50">
|
|
525
|
-
<svg class="w-5 h-5" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M6 18L18 6M6 6l12 12" /></svg>
|
|
526
|
-
</button>
|
|
527
|
-
</div>
|
|
528
|
-
|
|
529
|
-
<div class="flex-1">
|
|
530
|
-
<p class="text-gray-800">One or more items already exists in this location. Do you want to replace the existing items with a new version or keep both items? Replacing the items won't change sharing settings.</p>
|
|
531
|
-
|
|
532
|
-
<fieldset>
|
|
533
|
-
<div class="mt-6 space-y-5 pl-2">
|
|
534
|
-
<div v-for="option in replaceOptions" :key="option.value">
|
|
535
|
-
<label :for="option.value" class="flex items-center cursor-pointer">
|
|
536
|
-
<input :id="option.value" name="notification-method" type="radio" :value="option.value" v-model="overrideAction" :checked="option.value === overrideAction" class="option-radio peer" />
|
|
537
|
-
<div class="ml-3 block font-medium peer-checked:text-black text-light-700 cursor-pointer">{{ option.label }}</div>
|
|
538
|
-
</label>
|
|
539
|
-
</div>
|
|
540
|
-
</div>
|
|
541
|
-
</fieldset>
|
|
542
|
-
</div>
|
|
543
|
-
|
|
544
|
-
<div class="flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2">
|
|
545
|
-
<button @click="showExistModal=false" type="button" class="inline-flex gap-2 items-center justify-center h-10 px-4 py-2 text-sm font-medium transition-colors border rounded-md focus:outline-none focus:ring-2 focus:ring-neutral-100 focus:ring-offset-2">
|
|
546
|
-
<div>Dismiss</div>
|
|
547
|
-
</button>
|
|
548
|
-
<button
|
|
549
|
-
@click="uploadFiles(true)"
|
|
550
|
-
:disabled="uploaderLoading"
|
|
551
|
-
type="button"
|
|
552
|
-
class="inline-flex items-center gap-2 justify-center h-10 px-4 py-2 text-sm font-medium text-white transition-colors border border-transparent rounded-md focus:outline-none focus:ring-2 focus:ring-neutral-900 focus:ring-offset-2 bg-neutral-950 hover:bg-neutral-900 disabled:opacity-50 disabled:cursor-not-allowed"
|
|
553
|
-
>
|
|
554
|
-
Upload
|
|
555
|
-
</button>
|
|
556
|
-
</div>
|
|
557
|
-
</div>
|
|
558
|
-
</div>
|
|
559
|
-
</transition>
|
|
560
|
-
</div>
|
|
561
|
-
</transition>
|
|
562
|
-
</div>
|
|
563
|
-
</teleport>
|
|
564
|
-
</div>
|
|
565
|
-
|
|
566
|
-
`, k = async function(t, o) {
|
|
567
|
-
let d = i._session.domain;
|
|
568
|
-
i._session.is_deployment && (d = i._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io"), o.app_id = l;
|
|
569
|
-
const s = await fetch(`https://${d}/cpi/${t}`, {
|
|
570
|
-
method: "POST",
|
|
571
|
-
headers: {
|
|
572
|
-
Accept: "application/json",
|
|
573
|
-
"Content-Type": "application/json",
|
|
574
|
-
"xu-gtp-token": a,
|
|
575
|
-
"xu-app-token": p
|
|
576
|
-
},
|
|
577
|
-
body: JSON.stringify(o)
|
|
578
|
-
}), c = await s.json();
|
|
579
|
-
if (!s.ok)
|
|
580
|
-
throw c;
|
|
581
|
-
return c;
|
|
582
|
-
}, f = function(t) {
|
|
583
|
-
return t < 1024 ? t + " Bytes" : t < 1024 * 1024 ? (t / 1024).toFixed(2) + " KB" : t < 1024 * 1024 * 1024 ? (t / (1024 * 1024)).toFixed(2) + " MB" : (t / (1024 * 1024 * 1024)).toFixed(2) + " GB";
|
|
584
|
-
};
|
|
585
|
-
var m = crypto.randomUUID();
|
|
586
|
-
i.$containerP.attr("widget-id", m);
|
|
587
|
-
var x = createApp({
|
|
588
|
-
template: g,
|
|
589
|
-
components: {
|
|
590
|
-
segmentComponent: h,
|
|
591
|
-
sepcialLoader: n,
|
|
592
|
-
imagePreview: v
|
|
593
|
-
},
|
|
594
|
-
data() {
|
|
595
|
-
var t;
|
|
596
|
-
return {
|
|
597
|
-
replaceOptions: [
|
|
598
|
-
{ label: "Replace existing items", value: "replace" },
|
|
599
|
-
{ label: "Keep all items", value: "keep" }
|
|
600
|
-
],
|
|
601
|
-
sortDirOptions: [
|
|
602
|
-
{
|
|
603
|
-
label: "Ascending",
|
|
604
|
-
value: "asc"
|
|
605
|
-
},
|
|
606
|
-
{
|
|
607
|
-
label: "Descending",
|
|
608
|
-
value: "desc"
|
|
609
|
-
}
|
|
610
|
-
],
|
|
611
|
-
sortOptions: [
|
|
612
|
-
{
|
|
613
|
-
label: "Date",
|
|
614
|
-
value: "date"
|
|
615
|
-
},
|
|
616
|
-
{
|
|
617
|
-
label: "Name",
|
|
618
|
-
value: "name"
|
|
619
|
-
}
|
|
620
|
-
],
|
|
621
|
-
viewOptions: [
|
|
622
|
-
{
|
|
623
|
-
icon: ` <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
624
|
-
<path
|
|
625
|
-
fill-rule="evenodd"
|
|
626
|
-
d="M4.25 2A2.25 2.25 0 002 4.25v2.5A2.25 2.25 0 004.25 9h2.5A2.25 2.25 0 009 6.75v-2.5A2.25 2.25 0 006.75 2h-2.5zm0 9A2.25 2.25 0 002 13.25v2.5A2.25 2.25 0 004.25 18h2.5A2.25 2.25 0 009 15.75v-2.5A2.25 2.25 0 006.75 11h-2.5zm9-9A2.25 2.25 0 0011 4.25v2.5A2.25 2.25 0 0013.25 9h2.5A2.25 2.25 0 0018 6.75v-2.5A2.25 2.25 0 0015.75 2h-2.5zm0 9A2.25 2.25 0 0011 13.25v2.5A2.25 2.25 0 0013.25 18h2.5A2.25 2.25 0 0018 15.75v-2.5A2.25 2.25 0 0015.75 11h-2.5z"
|
|
627
|
-
clip-rule="evenodd"
|
|
628
|
-
></path>
|
|
629
|
-
</svg>`,
|
|
630
|
-
label: "",
|
|
631
|
-
value: "gallery"
|
|
632
|
-
},
|
|
633
|
-
{
|
|
634
|
-
icon: ` <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
635
|
-
<path
|
|
636
|
-
fill-rule="evenodd"
|
|
637
|
-
d="M2 3.75A.75.75 0 012.75 3h14.5a.75.75 0 010 1.5H2.75A.75.75 0 012 3.75zm0 4.167a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75a.75.75 0 01-.75-.75zm0 4.166a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75a.75.75 0 01-.75-.75zm0 4.167a.75.75 0 01.75-.75h14.5a.75.75 0 010 1.5H2.75a.75.75 0 01-.75-.75z"
|
|
638
|
-
clip-rule="evenodd"
|
|
639
|
-
></path>
|
|
640
|
-
</svg>`,
|
|
641
|
-
label: "",
|
|
642
|
-
value: "list"
|
|
643
|
-
},
|
|
644
|
-
{
|
|
645
|
-
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">
|
|
646
|
-
<path d="M200,64V192a8,8,0,0,1-8,8H64a8,8,0,0,1-8-8V64a8,8,0,0,1,8-8H192A8,8,0,0,1,200,64Z" opacity="0.2"></path>
|
|
647
|
-
<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>
|
|
648
|
-
</svg>`,
|
|
649
|
-
label: "",
|
|
650
|
-
value: "slider"
|
|
651
|
-
}
|
|
652
|
-
],
|
|
653
|
-
options: u,
|
|
654
|
-
folders: [],
|
|
655
|
-
files: [],
|
|
656
|
-
view: u.default_view_type || "gallery",
|
|
657
|
-
uploadModal: !1,
|
|
658
|
-
uploaderLoading: !1,
|
|
659
|
-
loadingSearch: !1,
|
|
660
|
-
fetcher: k,
|
|
661
|
-
formatBytes: f,
|
|
662
|
-
initUploader: upload,
|
|
663
|
-
swiper: null,
|
|
664
|
-
existingTags: "",
|
|
665
|
-
showSearchPopper: !1,
|
|
666
|
-
isOverDropZone: !1,
|
|
667
|
-
removeChipCount: 0,
|
|
668
|
-
searchOptions: [
|
|
669
|
-
{
|
|
670
|
-
label: "Filename",
|
|
671
|
-
tag: "name",
|
|
672
|
-
modifier: "contains"
|
|
673
|
-
},
|
|
674
|
-
{
|
|
675
|
-
label: "Tag",
|
|
676
|
-
tag: "tag",
|
|
677
|
-
modifier: "equals"
|
|
678
|
-
},
|
|
679
|
-
{
|
|
680
|
-
label: "Content",
|
|
681
|
-
tag: "any",
|
|
682
|
-
modifier: "contains"
|
|
683
|
-
}
|
|
684
|
-
],
|
|
685
|
-
opts: {
|
|
686
|
-
app_id: l,
|
|
687
|
-
path: "/",
|
|
688
|
-
search_string: "",
|
|
689
|
-
sort_by: u.sort_by || "date",
|
|
690
|
-
sort_dir: u.sort_dir || "desc",
|
|
691
|
-
...(t = u.filter_tags) != null && t.length ? { tags: u.filter_tags } : {}
|
|
692
|
-
// ...filter_tags
|
|
693
|
-
},
|
|
694
|
-
limit: 50,
|
|
695
|
-
isEndOfList: !1,
|
|
696
|
-
existingFiles: {},
|
|
697
|
-
allLoading: !1,
|
|
698
|
-
showExistModal: !1,
|
|
699
|
-
overrideAction: "replace",
|
|
700
|
-
pond: null,
|
|
701
|
-
processFiles: null
|
|
702
|
-
};
|
|
703
|
-
},
|
|
704
|
-
methods: {
|
|
705
|
-
async refreshDirectory(t, o = !1) {
|
|
706
|
-
if (this.view === "slider" && (o = !0), this.loadingSearch = !0, t ? this.allLoading = !0 : this.isEndOfList = !1, !o) {
|
|
707
|
-
const s = await this.fetcher("get_drive_files_workspace", {
|
|
708
|
-
...this.opts,
|
|
709
|
-
type: "directory"
|
|
710
|
-
});
|
|
711
|
-
this.folders = s.data.children || [];
|
|
712
|
-
}
|
|
713
|
-
const d = await this.fetcher("get_drive_files_workspace", {
|
|
714
|
-
...this.opts,
|
|
715
|
-
...t ? {} : { from: 0, to: this.limit },
|
|
716
|
-
type: "file"
|
|
717
|
-
});
|
|
718
|
-
this.files = d.data.children || [], t && (this.allLoading = !1, this.isEndOfList = !0), this.files.length < this.limit && (this.allLoading = !1, this.isEndOfList = !0), this.loadingSearch = !1, this.$nextTick(() => {
|
|
719
|
-
refreshFsLightbox();
|
|
720
|
-
});
|
|
721
|
-
},
|
|
722
|
-
uploadFiles(t) {
|
|
723
|
-
if (this.uploaderLoading = !0, t)
|
|
724
|
-
this.showExistModal = !1, this.processFiles(null, {
|
|
725
|
-
overrideAction: this.overrideAction,
|
|
726
|
-
existingFiles: this.existingFiles
|
|
727
|
-
});
|
|
728
|
-
else {
|
|
729
|
-
let d = [];
|
|
730
|
-
this.existingFiles = {};
|
|
731
|
-
var o = this.pond.getFiles().map((s) => ({ id: s.id, filename: s.file.name }));
|
|
732
|
-
o.forEach(({ filename: s }) => {
|
|
733
|
-
d.push(
|
|
734
|
-
new Promise((c, w) => {
|
|
735
|
-
this.fetcher("check_drive_file_workspace", {
|
|
736
|
-
file_path: "/" + s,
|
|
737
|
-
file_name: s,
|
|
738
|
-
type: "file"
|
|
739
|
-
}).then((r) => {
|
|
740
|
-
c(r);
|
|
741
|
-
}).catch((r) => {
|
|
742
|
-
if (this.uploaderLoading = !1, r.code === -764) {
|
|
743
|
-
this.existingFiles[s] = r.duplicates, c(r);
|
|
744
|
-
return;
|
|
745
|
-
}
|
|
746
|
-
w(r);
|
|
747
|
-
});
|
|
748
|
-
})
|
|
749
|
-
);
|
|
750
|
-
}), Promise.all(d).then((s) => {
|
|
751
|
-
Object.keys(this.existingFiles).length && (this.showExistModal = !0), o.filter((c) => !Object.keys(this.existingFiles).includes(c.filename)).forEach((c) => {
|
|
752
|
-
this.processFiles(c.id);
|
|
753
|
-
});
|
|
754
|
-
}).catch((s) => {
|
|
755
|
-
debugger;
|
|
756
|
-
this.showExistModal = !0;
|
|
757
|
-
});
|
|
758
|
-
}
|
|
759
|
-
},
|
|
760
|
-
removeLastSearch(t) {
|
|
761
|
-
t.target.value || (this.removeChipCount === 1 ? (this.opts.search_string = this.opts.search_string.replaceAll(
|
|
762
|
-
this.opts.search_string.split(" ").filter((o) => o.includes(":")).at(-1),
|
|
763
|
-
""
|
|
764
|
-
).trim(), this.removeChipCount = 0) : this.removeChipCount++);
|
|
765
|
-
},
|
|
766
|
-
// hideSearchPopper() {
|
|
767
|
-
// debugger;
|
|
768
|
-
// setTimeout(() => {
|
|
769
|
-
// this.showSearchPopper = false;
|
|
770
|
-
// }, 100);
|
|
771
|
-
// },
|
|
772
|
-
searchDebounce: _.debounce(async function(t) {
|
|
773
|
-
await this.refreshDirectory();
|
|
774
|
-
}, 400),
|
|
775
|
-
moment: hooks
|
|
776
|
-
},
|
|
777
|
-
mounted() {
|
|
778
|
-
var t = (d) => {
|
|
779
|
-
this.view !== "slider" && (this.uploadModal = !0, this.pond.addFiles(d));
|
|
780
|
-
};
|
|
781
|
-
const { isOverDropZone: o } = useDropZone(this.$refs.dropZoneRef, {
|
|
782
|
-
onDrop: t
|
|
783
|
-
});
|
|
784
|
-
this.isOverDropZone = o;
|
|
785
|
-
},
|
|
786
|
-
computed: {
|
|
787
|
-
searchTags() {
|
|
788
|
-
return this.opts.search_string.split(" ").filter((t) => t.includes(":"));
|
|
789
|
-
},
|
|
790
|
-
search: {
|
|
791
|
-
get() {
|
|
792
|
-
return this.opts.search_string.split(" ").filter((t) => !t.includes(":")).filter((t) => t).join(" ").trim();
|
|
793
|
-
},
|
|
794
|
-
set(t) {
|
|
795
|
-
var o = this.opts.search_string.split(" ").filter((d) => d.includes(":"));
|
|
796
|
-
this.opts.search_string = (o.join(" ") + " " + t).trim(), console.log(t), t.length && (this.showSearchPopper = !0), t.includes(":") && setTimeout(() => {
|
|
797
|
-
this.showSearchPopper = !1;
|
|
798
|
-
}, 50);
|
|
799
|
-
}
|
|
800
|
-
}
|
|
801
|
-
},
|
|
802
|
-
watch: {
|
|
803
|
-
opts: {
|
|
804
|
-
deep: !0,
|
|
805
|
-
handler() {
|
|
806
|
-
this.searchDebounce();
|
|
807
|
-
}
|
|
808
|
-
},
|
|
809
|
-
view: {
|
|
810
|
-
handler(t) {
|
|
811
|
-
t === "slider" && this.$nextTick(() => {
|
|
812
|
-
this.swiper = new Swiper(this.$refs["swiper-container"], {
|
|
813
|
-
loop: !0,
|
|
814
|
-
slidesPerView: 1,
|
|
815
|
-
spaceBetween: 20,
|
|
816
|
-
observer: !0,
|
|
817
|
-
observeParents: !0,
|
|
818
|
-
...u.swiper_options
|
|
819
|
-
// ...(fields?.direction === "rtl" ? { reverseDirection: true } : {})
|
|
820
|
-
}), this.swiper.on("slideChange", (o) => {
|
|
821
|
-
o.activeIndex >= 5 && !this.isEndOfList && !this.loadingSearch && !this.allLoading && this.refreshDirectory(!0);
|
|
822
|
-
});
|
|
823
|
-
}), this.$nextTick(() => {
|
|
824
|
-
refreshFsLightbox();
|
|
825
|
-
});
|
|
826
|
-
},
|
|
827
|
-
immediate: !0
|
|
828
|
-
},
|
|
829
|
-
files() {
|
|
830
|
-
this.$nextTick(() => {
|
|
831
|
-
var t, o;
|
|
832
|
-
refreshFsLightbox(), (o = (t = this.swiper) == null ? void 0 : t.update) == null || o.call(t);
|
|
833
|
-
});
|
|
834
|
-
}
|
|
835
|
-
},
|
|
836
|
-
async created() {
|
|
837
|
-
this.refreshDirectory(), this.$nextTick(async () => {
|
|
838
|
-
var { pond: t, processFiles: o } = await this.initUploader({ ...u, instant_file_upload: "N" }, { ...i, $containerP: $("#imageUploaderComponent") });
|
|
839
|
-
this.pond = t, this.processFiles = o;
|
|
840
|
-
var d = useDebounceFn(() => {
|
|
841
|
-
this.refreshDirectory(!1, !0);
|
|
842
|
-
}, 2500);
|
|
843
|
-
this.pond.on("processfile", (s, { id: c }) => {
|
|
844
|
-
!(s != null && s.type) !== "error" && this.pond.removeFiles(c), this.pond.getFiles().length || (this.uploaderLoading = !1, this.uploadModal = !1, this.pond.removeFiles()), d();
|
|
845
|
-
}), this.pond.on("processfiles", (s, c) => {
|
|
846
|
-
console.log("Finished all");
|
|
847
|
-
});
|
|
848
|
-
}), this.$watch("opts", (t) => {
|
|
849
|
-
this.refreshDirectory();
|
|
850
|
-
});
|
|
851
|
-
}
|
|
852
|
-
});
|
|
853
|
-
x.use(Gt), setTimeout(() => {
|
|
854
|
-
x.mount(`[widget-id='${m}']`);
|
|
855
|
-
}, 1e3);
|
|
856
|
-
}
|
|
857
|
-
export {
|
|
858
|
-
upload,
|
|
859
|
-
viewer
|
|
860
|
-
};
|