@xuda.io/xuda-widget-plugin-xuda-drive 1.0.112 → 1.0.114

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/runtime.mjs CHANGED
@@ -79878,7 +79878,7 @@ async function viewer(I, M) {
79878
79878
 
79879
79879
  `, ve = async function(Le, Re) {
79880
79880
  let Ue = M._session.domain;
79881
- M._session.is_deployment && (Ue = M._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io"), Re.app_id = N;
79881
+ Re.app_id = N;
79882
79882
  const Qe = await fetch(`https://${Ue}/cpi/${Le}`, {
79883
79883
  method: "POST",
79884
79884
  headers: {
@@ -80076,12 +80076,11 @@ async function viewer(I, M) {
80076
80076
  ""
80077
80077
  ).trim(), this.removeChipCount = 0) : this.removeChipCount++);
80078
80078
  },
80079
- // hideSearchPopper() {
80080
- // debugger;
80081
- // setTimeout(() => {
80082
- // this.showSearchPopper = false;
80083
- // }, 100);
80084
- // },
80079
+ hideSearchPopper() {
80080
+ setTimeout(() => {
80081
+ this.showSearchPopper = !1;
80082
+ }, 100);
80083
+ },
80085
80084
  searchDebounce: _.debounce(async function(Le) {
80086
80085
  await this.refreshDirectory();
80087
80086
  }, 400),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-widget-plugin-xuda-drive",
3
- "version": "1.0.112",
3
+ "version": "1.0.114",
4
4
  "description": "Xuda Drive widget plugin",
5
5
  "scripts": {
6
6
  "pub": "npm version patch --force && npm publish --access public",
package/src/runtime.mjs CHANGED
@@ -1,39 +1,39 @@
1
- import * as FilePond from "filepond";
2
- import "filepond/dist/filepond.min.css";
1
+ import * as FilePond from 'filepond';
2
+ import 'filepond/dist/filepond.min.css';
3
3
 
4
4
  window.FilePond = FilePond;
5
5
 
6
- import FilePondPluginFilePoster from "filepond-plugin-file-poster";
7
- import "filepond-plugin-file-poster/dist/filepond-plugin-file-poster.css";
6
+ import FilePondPluginFilePoster from 'filepond-plugin-file-poster';
7
+ import 'filepond-plugin-file-poster/dist/filepond-plugin-file-poster.css';
8
8
 
9
- import FilePondPluginMediaPreview from "filepond-plugin-media-preview";
10
- import "filepond-plugin-media-preview/dist/filepond-plugin-media-preview.css";
9
+ import FilePondPluginMediaPreview from 'filepond-plugin-media-preview';
10
+ import 'filepond-plugin-media-preview/dist/filepond-plugin-media-preview.css';
11
11
 
12
- import FilePondPluginFileValidateType from "filepond-plugin-file-validate-type";
12
+ import FilePondPluginFileValidateType from 'filepond-plugin-file-validate-type';
13
13
 
14
- import * as pintura from "./vendors/pintura/pintura/pintura.js";
15
- import "./vendors/pintura/pintura/pintura.css";
14
+ import * as pintura from './vendors/pintura/pintura/pintura.js';
15
+ import './vendors/pintura/pintura/pintura.css';
16
16
 
17
- import FilePondPluginImageEditor from "./vendors/pintura/filepond-plugin-image-editor";
17
+ import FilePondPluginImageEditor from './vendors/pintura/filepond-plugin-image-editor';
18
18
 
19
- import moment from "moment";
20
- import { createApp } from "vue/dist/vue.esm-bundler";
21
- import "./vendors/tailwind.cdn.js";
22
- import Swiper from "swiper/bundle";
23
- import "swiper/css/bundle";
19
+ import moment from 'moment';
20
+ import { createApp } from 'vue/dist/vue.esm-bundler';
21
+ import './vendors/tailwind.cdn.js';
22
+ import Swiper from 'swiper/bundle';
23
+ import 'swiper/css/bundle';
24
24
 
25
- import "swiper/css/navigation";
26
- import "swiper/css";
25
+ import 'swiper/css/navigation';
26
+ import 'swiper/css';
27
27
 
28
- import FloatingVue from "floating-vue";
29
- import "floating-vue/dist/style.css";
30
- import * as fs from "./vendors/fs-lightbox.js";
28
+ import FloatingVue from 'floating-vue';
29
+ import 'floating-vue/dist/style.css';
30
+ import * as fs from './vendors/fs-lightbox.js';
31
31
 
32
- import { useDropZone, useDebounceFn } from "@vueuse/core";
32
+ import { useDropZone, useDebounceFn } from '@vueuse/core';
33
33
 
34
34
  export async function upload(fields, e) {
35
35
  return new Promise(async (resolve, reject) => {
36
- var overrideAction = "replace";
36
+ var overrideAction = 'replace';
37
37
  var existingFiles = {};
38
38
  fields.method = e.method;
39
39
 
@@ -53,15 +53,15 @@ export async function upload(fields, e) {
53
53
  init_files.push({
54
54
  source: val,
55
55
  options: {
56
- type: "local"
57
- }
56
+ type: 'local',
57
+ },
58
58
  });
59
59
  });
60
60
  };
61
61
 
62
62
  // init files from predefined array
63
63
  if (!_.isEmpty(fields.file_upload_init_file_array)) {
64
- if (typeof fields.file_upload_init_file_array === "string") {
64
+ if (typeof fields.file_upload_init_file_array === 'string') {
65
65
  fields.file_upload_init_file_array = eval(fields.file_upload_init_file_array);
66
66
  }
67
67
  if (fields.file_upload_init_file_array?.length) {
@@ -72,11 +72,11 @@ export async function upload(fields, e) {
72
72
  // init files from bind
73
73
  var initialBindValue;
74
74
 
75
- if (!_.isEmpty(fields["xu-bind"])) {
76
- initialBindValue = await e.api_utils.get_field_value(fields["xu-bind"]);
75
+ if (!_.isEmpty(fields['xu-bind'])) {
76
+ initialBindValue = await e.api_utils.get_field_value(fields['xu-bind']);
77
77
  let value = initialBindValue;
78
- if (typeof value === "string") {
79
- value = value.split(",").filter((e) => e);
78
+ if (typeof value === 'string') {
79
+ value = value.split(',').filter((e) => e);
80
80
  }
81
81
  if (value?.length) {
82
82
  init_files_fn(value);
@@ -103,11 +103,11 @@ export async function upload(fields, e) {
103
103
  // }
104
104
  });
105
105
 
106
- if (!_.isEmpty(fields["xu-bind"])) {
106
+ if (!_.isEmpty(fields['xu-bind'])) {
107
107
  var ret = ret_obj.app_files;
108
- if (typeof initialBindValue === "string") ret = ret_obj.app_files.map((f) => f.server_fileName).join(",");
108
+ if (typeof initialBindValue === 'string') ret = ret_obj.app_files.map((f) => f.server_fileName).join(',');
109
109
 
110
- await e.api_utils.set_field_value(fields["xu-bind"], ret);
110
+ await e.api_utils.set_field_value(fields['xu-bind'], ret);
111
111
  }
112
112
 
113
113
  if (is_remove && fields.event_name_for_successful_remove_callback) {
@@ -120,7 +120,7 @@ export async function upload(fields, e) {
120
120
 
121
121
  if (fields.clear_on_file_upload) {
122
122
  pond.removeFiles();
123
- e.api_utils.set_field_value(fields["xu-bind"], []);
123
+ e.api_utils.set_field_value(fields['xu-bind'], []);
124
124
  }
125
125
  }, 100);
126
126
  };
@@ -147,7 +147,7 @@ export async function upload(fields, e) {
147
147
  </mask>
148
148
  <rect fill="rgba(255,255,255,.3125)" x="0" y="0" width="100%" height="100%" mask="url(#my-mask)"/>
149
149
  <circle cx="50%" cy="50%" r="50%" fill="transparent" stroke-width="1" stroke="#fff"/>
150
- `
150
+ `,
151
151
  );
152
152
  };
153
153
 
@@ -159,10 +159,10 @@ export async function upload(fields, e) {
159
159
  });
160
160
 
161
161
  fetch(url, {
162
- method: "POST",
163
- body: e
162
+ method: 'POST',
163
+ body: e,
164
164
  }).then((res) => {
165
- console.log("Request complete! response:", res);
165
+ console.log('Request complete! response:', res);
166
166
  });
167
167
  };
168
168
 
@@ -180,7 +180,7 @@ export async function upload(fields, e) {
180
180
  imageEditorSupportImage: (file) => {
181
181
  // return /^image/.test(file);
182
182
 
183
- return file.type !== "image/svg+xml" && file.type !== "image/gif" && !file.type.includes("audio") && !file.type.includes("video");
183
+ return file.type !== 'image/svg+xml' && file.type !== 'image/gif' && !file.type.includes('audio') && !file.type.includes('video');
184
184
  },
185
185
 
186
186
  imageEditor: {
@@ -190,9 +190,9 @@ export async function upload(fields, e) {
190
190
 
191
191
  imageProcessor: pintura.processImage,
192
192
  editorOptions: {
193
- ...pintura.getEditorDefaults()
193
+ ...pintura.getEditorDefaults(),
194
194
  },
195
- legacyDataToImageState: pintura.legacyDataToImageState
195
+ legacyDataToImageState: pintura.legacyDataToImageState,
196
196
  },
197
197
  server: {
198
198
  load: (source, load, error, progress, abort, headers) => {
@@ -203,7 +203,7 @@ export async function upload(fields, e) {
203
203
  .then(function (response) {
204
204
  try {
205
205
  if (response.ok) return response.blob();
206
- throw new Error("bad image");
206
+ throw new Error('bad image');
207
207
  } catch (err) {
208
208
  error({});
209
209
  }
@@ -219,29 +219,29 @@ export async function upload(fields, e) {
219
219
  return {
220
220
  abort: () => {
221
221
  abort();
222
- }
222
+ },
223
223
  };
224
224
  },
225
225
  process: (fieldName, file, metadata, load, error, progress, abort, transfer, options) => {
226
226
  let formData = new FormData();
227
- formData.append("file", file, file.name);
227
+ formData.append('file', file, file.name);
228
228
  const { app_id, gtp_token, app_token } = e._session;
229
229
 
230
- formData.append("app_id_reference", APP_OBJ?.[app_id]?.app_id_reference);
231
- formData.append("app_id", app_id);
232
- formData.append("gtp_token", gtp_token);
233
- formData.append("app_token", app_token);
234
- formData.append("drive_type", "workspace");
235
- if (fields.file_upload_folder) formData.append("folder", fields.file_upload_folder);
236
- if (fields.public_file) formData.append("make_public", fields.public_file);
230
+ formData.append('app_id_reference', APP_OBJ?.[app_id]?.app_id_reference);
231
+ formData.append('app_id', app_id);
232
+ formData.append('gtp_token', gtp_token);
233
+ formData.append('app_token', app_token);
234
+ formData.append('drive_type', 'workspace');
235
+ if (fields.file_upload_folder) formData.append('folder', fields.file_upload_folder);
236
+ if (fields.public_file) formData.append('make_public', fields.public_file);
237
237
 
238
238
  let tags = fields.assign_file_tags || [];
239
239
 
240
240
  let file_tags = [];
241
241
  if (fields.auto_tag_generator) {
242
- let identifier = fields.auto_tag_identifier || " ";
242
+ let identifier = fields.auto_tag_identifier || ' ';
243
243
 
244
- const filename = file.name.split(".").slice(0, -1).join(".");
244
+ const filename = file.name.split('.').slice(0, -1).join('.');
245
245
  file_tags = filename.split(identifier);
246
246
  if (fields.auto_tag_translation) {
247
247
  for (let tag of file_tags) {
@@ -251,25 +251,25 @@ export async function upload(fields, e) {
251
251
  }
252
252
  }
253
253
  }
254
- formData.append("tags", [...tags, ...file_tags]);
254
+ formData.append('tags', [...tags, ...file_tags]);
255
255
 
256
256
  const request = new XMLHttpRequest();
257
257
 
258
258
  let _domain = e._session.domain;
259
259
  if (e._session.is_deployment) {
260
- _domain = e._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io";
260
+ _domain = e._session.opt.regional_server === 'dev.xuda.io' ? 'dev.xuda.io' : 'xuda.io';
261
261
  }
262
262
 
263
- if (overrideAction === "replace" && file.name in existingFiles) {
264
- formData.append("file_path", "/" + file.name);
265
- formData.append("file_name", file.name);
266
- request.open("POST", `https://${_domain}/cpi/update_drive_file_workspace`);
263
+ if (overrideAction === 'replace' && file.name in existingFiles) {
264
+ formData.append('file_path', '/' + file.name);
265
+ formData.append('file_name', file.name);
266
+ request.open('POST', `https://${_domain}/cpi/update_drive_file_workspace`);
267
267
  } else {
268
- request.open("POST", `https://${_domain}/cpi/upload_drive_file_workspace`);
268
+ request.open('POST', `https://${_domain}/cpi/upload_drive_file_workspace`);
269
269
  }
270
270
 
271
- request.setRequestHeader("xu-gtp-token", gtp_token);
272
- request.setRequestHeader("xu-app-token", app_token);
271
+ request.setRequestHeader('xu-gtp-token', gtp_token);
272
+ request.setRequestHeader('xu-app-token', app_token);
273
273
 
274
274
  // request.open("POST", `https://${_domain}/rpi/runtime_upload_file`);
275
275
 
@@ -305,7 +305,7 @@ export async function upload(fields, e) {
305
305
  var res = JSON.parse(request.responseText);
306
306
 
307
307
  error(res.data);
308
- this.$emit("error", error);
308
+ this.$emit('error', error);
309
309
  };
310
310
 
311
311
  request.send(formData);
@@ -318,7 +318,7 @@ export async function upload(fields, e) {
318
318
 
319
319
  // Let FilePond know the request has been cancelled
320
320
  abort();
321
- }
321
+ },
322
322
  };
323
323
  },
324
324
 
@@ -336,16 +336,16 @@ export async function upload(fields, e) {
336
336
  let app_id = e._session.app_id;
337
337
  let app_id_reference = APP_OBJ[app_id].app_id_reference;
338
338
 
339
- axios_ajax(func.common.get_url(e.SESSION_ID, "rpi", "runtime_delete_file_bulk"), {
339
+ axios_ajax(func.common.get_url(e.SESSION_ID, 'rpi', 'runtime_delete_file_bulk'), {
340
340
  app_id,
341
341
  server_files: ret_obj.deletedArr,
342
342
  app_id_reference: app_id_reference,
343
- gtp_token: e._session.gtp_token
343
+ gtp_token: e._session.gtp_token,
344
344
  });
345
345
  load();
346
346
  },
347
347
  remove: (source, load, error) => {
348
- var source_clean = source.split("/").pop();
348
+ var source_clean = source.split('/').pop();
349
349
 
350
350
  ret_obj.deletedArr.push(source_clean);
351
351
 
@@ -355,14 +355,14 @@ export async function upload(fields, e) {
355
355
  }
356
356
 
357
357
  ////////////// CALLBACK
358
- if (fields.instant_file_upload === "N" ? false : true) do_callback(true);
358
+ if (fields.instant_file_upload === 'N' ? false : true) do_callback(true);
359
359
  // Can call the error method if something is wrong, should exit after
360
360
  // error('oh my goodness');
361
361
 
362
362
  // Should call the load method when done, no parameters required
363
363
  load();
364
- }
365
- }
364
+ },
365
+ },
366
366
  };
367
367
 
368
368
  if (fields.file_upload_drop_area_label) {
@@ -376,45 +376,45 @@ export async function upload(fields, e) {
376
376
  opt.files = init_files;
377
377
  }
378
378
 
379
- opt.instantUpload = fields.instant_file_upload === "N" ? false : true;
379
+ opt.instantUpload = fields.instant_file_upload === 'N' ? false : true;
380
380
 
381
381
  if (fields.file_upload_mime_type_preset) {
382
382
  switch (fields.file_upload_mime_type_preset) {
383
- case "image":
384
- opt.acceptedFileTypes = ["image/*"];
383
+ case 'image':
384
+ opt.acceptedFileTypes = ['image/*'];
385
385
  break;
386
- case "video":
387
- opt.acceptedFileTypes = ["video/*"];
386
+ case 'video':
387
+ opt.acceptedFileTypes = ['video/*'];
388
388
  break;
389
- case "audio":
390
- opt.acceptedFileTypes = ["audio/*"];
389
+ case 'audio':
390
+ opt.acceptedFileTypes = ['audio/*'];
391
391
  break;
392
392
  default:
393
- opt.acceptedFileTypes = ["image/*"];
393
+ opt.acceptedFileTypes = ['image/*'];
394
394
  }
395
395
  } else {
396
396
  if (fields.file_upload_custom_mime_types) {
397
- opt.acceptedFileTypes = fields.file_upload_custom_mime_types.split(",");
397
+ opt.acceptedFileTypes = fields.file_upload_custom_mime_types.split(',');
398
398
  } else {
399
399
  opt.allowFileTypeValidation = false;
400
400
  }
401
401
  }
402
402
 
403
- if (fields.file_upload_mask === "circle") {
403
+ if (fields.file_upload_mask === 'circle') {
404
404
  opt.imagePreviewHeight = 170;
405
- opt.imageCropAspectRatio = "1:1";
405
+ opt.imageCropAspectRatio = '1:1';
406
406
  opt.imageResizeTargetWidth = 200;
407
407
  opt.imageResizeTargetHeight = 200;
408
- opt.stylePanelLayout = "compact circle";
409
- opt.styleLoadIndicatorPosition = "center bottom";
410
- opt.styleProgressIndicatorPosition = "right bottom";
411
- opt.styleButtonRemoveItemPosition = "left bottom";
412
- opt.styleButtonProcessItemPosition = "right bottom";
408
+ opt.stylePanelLayout = 'compact circle';
409
+ opt.styleLoadIndicatorPosition = 'center bottom';
410
+ opt.styleProgressIndicatorPosition = 'right bottom';
411
+ opt.styleButtonRemoveItemPosition = 'left bottom';
412
+ opt.styleButtonProcessItemPosition = 'right bottom';
413
413
  }
414
414
 
415
415
  pond = FilePond.create($imgInp[0], opt);
416
416
 
417
- pond.on("processfiles", (e) => {
417
+ pond.on('processfiles', (e) => {
418
418
  do_callback();
419
419
  });
420
420
 
@@ -431,7 +431,7 @@ export async function upload(fields, e) {
431
431
 
432
432
  resolve({
433
433
  pond,
434
- processFiles
434
+ processFiles,
435
435
  });
436
436
  });
437
437
  }
@@ -477,11 +477,11 @@ export async function viewer(fields, e) {
477
477
  ></circle>
478
478
  </svg>
479
479
  </div>
480
- `
480
+ `,
481
481
  };
482
482
 
483
483
  var segmentComponent = {
484
- props: ["options", "modelValue"],
484
+ props: ['options', 'modelValue'],
485
485
  computed: {
486
486
  model: {
487
487
  get() {
@@ -490,8 +490,8 @@ export async function viewer(fields, e) {
490
490
  return value;
491
491
  },
492
492
  set(v) {
493
- this.$emit("update:modelValue", v);
494
- }
493
+ this.$emit('update:modelValue', v);
494
+ },
495
495
  },
496
496
  segmentActive() {
497
497
  // debugger;
@@ -501,7 +501,7 @@ export async function viewer(fields, e) {
501
501
 
502
502
  // debugger;
503
503
  return ret;
504
- }
504
+ },
505
505
  },
506
506
  template: `
507
507
  <div class="flex relative items-center rounded-lg bg-gray-100 [&>button]:px-4 [&>button]:py-2">
@@ -514,11 +514,11 @@ export async function viewer(fields, e) {
514
514
 
515
515
  <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>
516
516
  </div>
517
- `
517
+ `,
518
518
  };
519
519
 
520
520
  var imagePreview = {
521
- props: ["file", "size"],
521
+ props: ['file', 'size'],
522
522
  template: `
523
523
 
524
524
 
@@ -579,7 +579,7 @@ export async function viewer(fields, e) {
579
579
  </div>
580
580
 
581
581
  </div>
582
- `
582
+ `,
583
583
  };
584
584
 
585
585
  const html = `
@@ -845,21 +845,21 @@ export async function viewer(fields, e) {
845
845
 
846
846
  const fetcher = async function (service, opt) {
847
847
  let _domain = e._session.domain;
848
- if (e._session.is_deployment) {
849
- _domain = e._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io";
850
- }
848
+ // if (e._session.is_deployment) {
849
+ // _domain = e._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io";
850
+ // }
851
851
 
852
852
  opt.app_id = app_id;
853
853
 
854
854
  const response = await fetch(`https://${_domain}/cpi/${service}`, {
855
- method: "POST",
855
+ method: 'POST',
856
856
  headers: {
857
- Accept: "application/json",
858
- "Content-Type": "application/json",
859
- "xu-gtp-token": gtp_token,
860
- "xu-app-token": app_token
857
+ Accept: 'application/json',
858
+ 'Content-Type': 'application/json',
859
+ 'xu-gtp-token': gtp_token,
860
+ 'xu-app-token': app_token,
861
861
  },
862
- body: JSON.stringify(opt)
862
+ body: JSON.stringify(opt),
863
863
  });
864
864
 
865
865
  const json = await response.json();
@@ -873,51 +873,51 @@ export async function viewer(fields, e) {
873
873
 
874
874
  const formatBytes = function (bytes) {
875
875
  if (bytes < 1024) {
876
- return bytes + " Bytes"; // Less than 1 KB
876
+ return bytes + ' Bytes'; // Less than 1 KB
877
877
  } else if (bytes < 1024 * 1024) {
878
- return (bytes / 1024).toFixed(2) + " KB"; // Less than 1 MB
878
+ return (bytes / 1024).toFixed(2) + ' KB'; // Less than 1 MB
879
879
  } else if (bytes < 1024 * 1024 * 1024) {
880
- return (bytes / (1024 * 1024)).toFixed(2) + " MB"; // Less than 1 GB
880
+ return (bytes / (1024 * 1024)).toFixed(2) + ' MB'; // Less than 1 GB
881
881
  } else {
882
- return (bytes / (1024 * 1024 * 1024)).toFixed(2) + " GB"; // 1 GB or more
882
+ return (bytes / (1024 * 1024 * 1024)).toFixed(2) + ' GB'; // 1 GB or more
883
883
  }
884
884
  };
885
885
 
886
886
  var containerId = crypto.randomUUID();
887
- e.$containerP.attr("widget-id", containerId);
887
+ e.$containerP.attr('widget-id', containerId);
888
888
 
889
889
  var app = createApp({
890
890
  template: html,
891
891
  components: {
892
892
  segmentComponent,
893
893
  sepcialLoader,
894
- imagePreview
894
+ imagePreview,
895
895
  },
896
896
  data() {
897
897
  return {
898
898
  replaceOptions: [
899
- { label: "Replace existing items", value: "replace" },
900
- { label: "Keep all items", value: "keep" }
899
+ { label: 'Replace existing items', value: 'replace' },
900
+ { label: 'Keep all items', value: 'keep' },
901
901
  ],
902
902
  sortDirOptions: [
903
903
  {
904
- label: "Ascending",
905
- value: "asc"
904
+ label: 'Ascending',
905
+ value: 'asc',
906
906
  },
907
907
  {
908
- label: "Descending",
909
- value: "desc"
910
- }
908
+ label: 'Descending',
909
+ value: 'desc',
910
+ },
911
911
  ],
912
912
  sortOptions: [
913
913
  {
914
- label: "Date",
915
- value: "date"
914
+ label: 'Date',
915
+ value: 'date',
916
916
  },
917
917
  {
918
- label: "Name",
919
- value: "name"
920
- }
918
+ label: 'Name',
919
+ value: 'name',
920
+ },
921
921
  ],
922
922
  viewOptions: [
923
923
  {
@@ -928,8 +928,8 @@ export async function viewer(fields, e) {
928
928
  clip-rule="evenodd"
929
929
  ></path>
930
930
  </svg>`,
931
- label: "",
932
- value: "gallery"
931
+ label: '',
932
+ value: 'gallery',
933
933
  },
934
934
  {
935
935
  icon: ` <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
@@ -939,22 +939,22 @@ export async function viewer(fields, e) {
939
939
  clip-rule="evenodd"
940
940
  ></path>
941
941
  </svg>`,
942
- label: "",
943
- value: "list"
942
+ label: '',
943
+ value: 'list',
944
944
  },
945
945
  {
946
946
  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">
947
947
  <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>
948
948
  <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>
949
949
  </svg>`,
950
- label: "",
951
- value: "slider"
952
- }
950
+ label: '',
951
+ value: 'slider',
952
+ },
953
953
  ],
954
954
  options: fields,
955
955
  folders: [],
956
956
  files: [],
957
- view: fields.default_view_type || "gallery",
957
+ view: fields.default_view_type || 'gallery',
958
958
  uploadModal: false,
959
959
  uploaderLoading: false,
960
960
  loadingSearch: false,
@@ -962,34 +962,34 @@ export async function viewer(fields, e) {
962
962
  formatBytes,
963
963
  initUploader: upload,
964
964
  swiper: null,
965
- existingTags: "",
965
+ existingTags: '',
966
966
  showSearchPopper: false,
967
967
  isOverDropZone: false,
968
968
  removeChipCount: 0,
969
969
  searchOptions: [
970
970
  {
971
- label: "Filename",
972
- tag: "name",
973
- modifier: "contains"
971
+ label: 'Filename',
972
+ tag: 'name',
973
+ modifier: 'contains',
974
974
  },
975
975
  {
976
- label: "Tag",
977
- tag: "tag",
978
- modifier: "equals"
976
+ label: 'Tag',
977
+ tag: 'tag',
978
+ modifier: 'equals',
979
979
  },
980
980
  {
981
- label: "Content",
982
- tag: "any",
983
- modifier: "contains"
984
- }
981
+ label: 'Content',
982
+ tag: 'any',
983
+ modifier: 'contains',
984
+ },
985
985
  ],
986
986
  opts: {
987
987
  app_id,
988
- path: "/",
989
- search_string: "",
990
- sort_by: fields.sort_by || "date",
991
- sort_dir: fields.sort_dir || "asc",
992
- ...(fields.filter_tags?.length ? { tags: fields.filter_tags } : {})
988
+ path: '/',
989
+ search_string: '',
990
+ sort_by: fields.sort_by || 'date',
991
+ sort_dir: fields.sort_dir || 'asc',
992
+ ...(fields.filter_tags?.length ? { tags: fields.filter_tags } : {}),
993
993
  // ...filter_tags
994
994
  },
995
995
  limit: 50,
@@ -997,14 +997,14 @@ export async function viewer(fields, e) {
997
997
  existingFiles: {},
998
998
  allLoading: false,
999
999
  showExistModal: false,
1000
- overrideAction: "replace",
1000
+ overrideAction: 'replace',
1001
1001
  pond: null,
1002
- processFiles: null
1002
+ processFiles: null,
1003
1003
  };
1004
1004
  },
1005
1005
  methods: {
1006
1006
  async refreshDirectory(all, bypassFolders = false) {
1007
- if (this.view === "slider") bypassFolders = true;
1007
+ if (this.view === 'slider') bypassFolders = true;
1008
1008
 
1009
1009
  this.loadingSearch = true;
1010
1010
 
@@ -1015,17 +1015,17 @@ export async function viewer(fields, e) {
1015
1015
  }
1016
1016
 
1017
1017
  if (!bypassFolders) {
1018
- const folders = await this.fetcher("get_drive_files_workspace", {
1018
+ const folders = await this.fetcher('get_drive_files_workspace', {
1019
1019
  ...this.opts,
1020
- type: "directory"
1020
+ type: 'directory',
1021
1021
  });
1022
1022
  this.folders = folders.data.children || [];
1023
1023
  }
1024
1024
 
1025
- const files = await this.fetcher("get_drive_files_workspace", {
1025
+ const files = await this.fetcher('get_drive_files_workspace', {
1026
1026
  ...this.opts,
1027
1027
  ...(all ? {} : { from: 0, to: this.limit }),
1028
- type: "file"
1028
+ type: 'file',
1029
1029
  });
1030
1030
 
1031
1031
  this.files = files.data.children || [];
@@ -1054,7 +1054,7 @@ export async function viewer(fields, e) {
1054
1054
  // this.processCb();
1055
1055
  this.processFiles(null, {
1056
1056
  overrideAction: this.overrideAction,
1057
- existingFiles: this.existingFiles
1057
+ existingFiles: this.existingFiles,
1058
1058
  });
1059
1059
 
1060
1060
  // this.pond.on("processfile", (e) => {
@@ -1074,9 +1074,9 @@ export async function viewer(fields, e) {
1074
1074
  promises.push(
1075
1075
  new Promise((resolve, reject) => {
1076
1076
  this.fetcher(`check_drive_file_workspace`, {
1077
- file_path: "/" + filename,
1077
+ file_path: '/' + filename,
1078
1078
  file_name: filename,
1079
- type: "file"
1079
+ type: 'file',
1080
1080
  })
1081
1081
  .then((e) => {
1082
1082
  resolve(e);
@@ -1092,7 +1092,7 @@ export async function viewer(fields, e) {
1092
1092
 
1093
1093
  reject(err);
1094
1094
  });
1095
- })
1095
+ }),
1096
1096
  );
1097
1097
  });
1098
1098
 
@@ -1123,10 +1123,10 @@ export async function viewer(fields, e) {
1123
1123
  this.opts.search_string = this.opts.search_string
1124
1124
  .replaceAll(
1125
1125
  this.opts.search_string
1126
- .split(" ")
1127
- .filter((e) => e.includes(":"))
1126
+ .split(' ')
1127
+ .filter((e) => e.includes(':'))
1128
1128
  .at(-1),
1129
- ""
1129
+ '',
1130
1130
  )
1131
1131
  .trim();
1132
1132
  this.removeChipCount = 0;
@@ -1135,49 +1135,48 @@ export async function viewer(fields, e) {
1135
1135
  }
1136
1136
  }
1137
1137
  },
1138
- // hideSearchPopper() {
1139
- // debugger;
1140
- // setTimeout(() => {
1141
- // this.showSearchPopper = false;
1142
- // }, 100);
1143
- // },
1138
+ hideSearchPopper() {
1139
+ setTimeout(() => {
1140
+ this.showSearchPopper = false;
1141
+ }, 100);
1142
+ },
1144
1143
  searchDebounce: _.debounce(async function ($event) {
1145
1144
  await this.refreshDirectory();
1146
1145
  }, 400),
1147
- moment
1146
+ moment,
1148
1147
  },
1149
1148
  mounted() {
1150
1149
  var onDrop = (files) => {
1151
- if (this.view === "slider") return;
1150
+ if (this.view === 'slider') return;
1152
1151
  this.uploadModal = true;
1153
1152
  this.pond.addFiles(files);
1154
1153
  };
1155
1154
 
1156
1155
  const { isOverDropZone } = useDropZone(this.$refs.dropZoneRef, {
1157
- onDrop
1156
+ onDrop,
1158
1157
  });
1159
1158
 
1160
1159
  this.isOverDropZone = isOverDropZone;
1161
1160
  },
1162
1161
  computed: {
1163
1162
  searchTags() {
1164
- return this.opts.search_string.split(" ").filter((e) => e.includes(":"));
1163
+ return this.opts.search_string.split(' ').filter((e) => e.includes(':'));
1165
1164
  },
1166
1165
  search: {
1167
1166
  get() {
1168
1167
  return this.opts.search_string
1169
- .split(" ")
1170
- .filter((e) => !e.includes(":"))
1168
+ .split(' ')
1169
+ .filter((e) => !e.includes(':'))
1171
1170
  .filter((e) => e)
1172
- .join(" ")
1171
+ .join(' ')
1173
1172
  .trim();
1174
1173
  },
1175
1174
 
1176
1175
  set(value) {
1177
1176
  // debugger;
1178
- var existingTags = this.opts.search_string.split(" ").filter((e) => e.includes(":"));
1177
+ var existingTags = this.opts.search_string.split(' ').filter((e) => e.includes(':'));
1179
1178
 
1180
- this.opts.search_string = (existingTags.join(" ") + " " + value).trim();
1179
+ this.opts.search_string = (existingTags.join(' ') + ' ' + value).trim();
1181
1180
 
1182
1181
  console.log(value);
1183
1182
 
@@ -1185,37 +1184,37 @@ export async function viewer(fields, e) {
1185
1184
  this.showSearchPopper = true;
1186
1185
  }
1187
1186
 
1188
- if (value.includes(":")) {
1187
+ if (value.includes(':')) {
1189
1188
  setTimeout(() => {
1190
1189
  this.showSearchPopper = false;
1191
1190
  }, 50);
1192
1191
  }
1193
- }
1194
- }
1192
+ },
1193
+ },
1195
1194
  },
1196
1195
  watch: {
1197
1196
  opts: {
1198
1197
  deep: true,
1199
1198
  handler() {
1200
1199
  this.searchDebounce();
1201
- }
1200
+ },
1202
1201
  },
1203
1202
  view: {
1204
1203
  handler(val) {
1205
- if (val === "slider") {
1204
+ if (val === 'slider') {
1206
1205
  this.$nextTick(() => {
1207
1206
  // setTimeout(() => {
1208
- this.swiper = new Swiper(this.$refs["swiper-container"], {
1207
+ this.swiper = new Swiper(this.$refs['swiper-container'], {
1209
1208
  loop: true,
1210
1209
  slidesPerView: 1,
1211
1210
  spaceBetween: 20,
1212
1211
  observer: true,
1213
1212
  observeParents: true,
1214
- ...fields.swiper_options
1213
+ ...fields.swiper_options,
1215
1214
  // ...(fields?.direction === "rtl" ? { reverseDirection: true } : {})
1216
1215
  });
1217
1216
 
1218
- this.swiper.on("slideChange", (event) => {
1217
+ this.swiper.on('slideChange', (event) => {
1219
1218
  if (event.activeIndex >= 5 && !this.isEndOfList && !this.loadingSearch && !this.allLoading) {
1220
1219
  this.refreshDirectory(true);
1221
1220
  }
@@ -1228,21 +1227,21 @@ export async function viewer(fields, e) {
1228
1227
  refreshFsLightbox();
1229
1228
  });
1230
1229
  },
1231
- immediate: true
1230
+ immediate: true,
1232
1231
  },
1233
1232
  files() {
1234
1233
  this.$nextTick(() => {
1235
1234
  refreshFsLightbox();
1236
1235
  this.swiper?.update?.();
1237
1236
  });
1238
- }
1237
+ },
1239
1238
  },
1240
1239
  async created() {
1241
1240
  this.refreshDirectory();
1242
1241
 
1243
1242
  this.$nextTick(async () => {
1244
1243
  // debugger;
1245
- var { pond, processFiles } = await this.initUploader({ ...fields, instant_file_upload: "N" }, { ...e, $containerP: $("#imageUploaderComponent") });
1244
+ var { pond, processFiles } = await this.initUploader({ ...fields, instant_file_upload: 'N' }, { ...e, $containerP: $('#imageUploaderComponent') });
1246
1245
 
1247
1246
  this.pond = pond;
1248
1247
  this.processFiles = processFiles;
@@ -1251,8 +1250,8 @@ export async function viewer(fields, e) {
1251
1250
  this.refreshDirectory(false, true);
1252
1251
  }, 2500);
1253
1252
 
1254
- this.pond.on("processfile", (e, { id }) => {
1255
- if (!e?.type !== "error") {
1253
+ this.pond.on('processfile', (e, { id }) => {
1254
+ if (!e?.type !== 'error') {
1256
1255
  this.pond.removeFiles(id);
1257
1256
  }
1258
1257
 
@@ -1265,15 +1264,15 @@ export async function viewer(fields, e) {
1265
1264
  refreshThrottled();
1266
1265
  });
1267
1266
 
1268
- this.pond.on("processfiles", (a, b) => {
1269
- console.log("Finished all");
1267
+ this.pond.on('processfiles', (a, b) => {
1268
+ console.log('Finished all');
1270
1269
  });
1271
1270
  });
1272
1271
 
1273
- this.$watch("opts", (value) => {
1272
+ this.$watch('opts', (value) => {
1274
1273
  this.refreshDirectory();
1275
1274
  });
1276
- }
1275
+ },
1277
1276
  });
1278
1277
 
1279
1278
  app.use(FloatingVue);