@xuda.io/xuda-widget-plugin-xuda-drive 1.0.46 → 1.0.48

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.
Files changed (3) hide show
  1. package/index.mjs +30 -5
  2. package/package.json +1 -1
  3. package/runtime.mjs +281 -112
package/index.mjs CHANGED
@@ -5,7 +5,7 @@ var common_fields = {
5
5
  },
6
6
  file_upload_allow_multiple_files: {
7
7
  label: "Allow Multiple Files",
8
- type: "string",
8
+ type: "boolean",
9
9
  render: "segment",
10
10
  tooltip: "",
11
11
  defaultValue: () => false,
@@ -51,7 +51,7 @@ var common_fields = {
51
51
  },
52
52
  public_file: {
53
53
  label: "Public File",
54
- type: "string",
54
+ type: "boolean",
55
55
  render: "segment",
56
56
  tooltip: "",
57
57
  defaultValue: () => false,
@@ -78,7 +78,7 @@ var common_fields = {
78
78
  },
79
79
  auto_tag_generator: {
80
80
  label: "Auto Tag Generator",
81
- type: "string",
81
+ type: "boolean",
82
82
  render: "segment",
83
83
  tooltip: "Create tags extract from file name",
84
84
  defaultValue: () => false,
@@ -105,6 +105,7 @@ var common_fields = {
105
105
  render: "editor",
106
106
  "render_params.language": "json"
107
107
  },
108
+
108
109
  custom_tags_parser: {
109
110
  label: "Custom Tags Parser",
110
111
  type: "object",
@@ -124,7 +125,7 @@ var common_fields = {
124
125
  },
125
126
  clear_on_file_upload: {
126
127
  label: "Clear on File Upload",
127
- type: "string",
128
+ type: "boolean",
128
129
  render: "segment",
129
130
  tooltip: "",
130
131
  defaultValue: () => false,
@@ -145,7 +146,7 @@ var common_fields = {
145
146
  },
146
147
  prompt_file_exist: {
147
148
  label: "Prompt file exist",
148
- type: "string",
149
+ type: "boolean",
149
150
  render: "segment",
150
151
  tooltip: "",
151
152
  defaultValue: () => true,
@@ -176,6 +177,30 @@ var common_fields = {
176
177
  value: "ltr"
177
178
  }
178
179
  ]
180
+ },
181
+ navigation: {
182
+ label: "Navigation",
183
+ type: "boolean",
184
+ render: "segment",
185
+ tooltip: "",
186
+ defaultValue: () => true,
187
+ options: [
188
+ {
189
+ label: "Show",
190
+ value: true
191
+ },
192
+ {
193
+ label: "Hide",
194
+ value: false
195
+ }
196
+ ]
197
+ },
198
+ swiper_options: {
199
+ label: "Swiper options",
200
+ type: "object",
201
+ tooltip: "",
202
+ render: "editor",
203
+ "render_params.language": "json"
179
204
  }
180
205
  };
181
206
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-widget-plugin-xuda-drive",
3
- "version": "1.0.46",
3
+ "version": "1.0.48",
4
4
  "description": "Xuda Drive widget plugin",
5
5
  "scripts": {
6
6
  "pub": "npm version patch --force && npm publish --access public"
package/runtime.mjs CHANGED
@@ -8,28 +8,106 @@ export async function upload(fields, e) {
8
8
 
9
9
  var widget_cssClass = fields.widget_cssClass;
10
10
 
11
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond/dist/filepond.js"));
12
-
13
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/jquery-filepond/filepond.jquery.js"));
14
-
15
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/@xuda.io/pintura/filepond-plugin-image-editor/FilePondPluginImageEditor.js"));
16
-
17
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"));
18
-
19
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/@xuda.io/pintura/pintura/pintura-iife.js"));
20
-
21
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-file-poster/dist/filepond-plugin-file-poster.min.js"));
22
-
23
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-media-preview/dist/filepond-plugin-media-preview.min.js"));
24
-
25
- await func.utils.load_js_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-file-validate-type/dist/filepond-plugin-file-validate-type.min.js"));
26
-
27
- await func.utils.load_css_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond/dist/filepond.css"));
28
-
29
- func.utils.load_css_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/@xuda.io/pintura/pintura/pintura.css"));
30
- func.utils.load_css_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css"));
31
- func.utils.load_css_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-media-preview/dist/filepond-plugin-media-preview.min.css"));
32
- func.utils.load_css_on_demand(func.common.get_url(e.SESSION_ID, "dist", "runtime/node_modules/filepond-plugin-file-poster/dist/filepond-plugin-file-poster.min.css"));
11
+ await func.utils.load_js_on_demand(
12
+ func.common.get_url(
13
+ e.SESSION_ID,
14
+ "dist",
15
+ "runtime/node_modules/filepond/dist/filepond.js"
16
+ )
17
+ );
18
+
19
+ await func.utils.load_js_on_demand(
20
+ func.common.get_url(
21
+ e.SESSION_ID,
22
+ "dist",
23
+ "runtime/node_modules/jquery-filepond/filepond.jquery.js"
24
+ )
25
+ );
26
+
27
+ await func.utils.load_js_on_demand(
28
+ func.common.get_url(
29
+ e.SESSION_ID,
30
+ "dist",
31
+ "runtime/node_modules/@xuda.io/pintura/filepond-plugin-image-editor/FilePondPluginImageEditor.js"
32
+ )
33
+ );
34
+
35
+ await func.utils.load_js_on_demand(
36
+ func.common.get_url(
37
+ e.SESSION_ID,
38
+ "dist",
39
+ "runtime/node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.min.js"
40
+ )
41
+ );
42
+
43
+ await func.utils.load_js_on_demand(
44
+ func.common.get_url(
45
+ e.SESSION_ID,
46
+ "dist",
47
+ "runtime/node_modules/@xuda.io/pintura/pintura/pintura-iife.js"
48
+ )
49
+ );
50
+
51
+ await func.utils.load_js_on_demand(
52
+ func.common.get_url(
53
+ e.SESSION_ID,
54
+ "dist",
55
+ "runtime/node_modules/filepond-plugin-file-poster/dist/filepond-plugin-file-poster.min.js"
56
+ )
57
+ );
58
+
59
+ await func.utils.load_js_on_demand(
60
+ func.common.get_url(
61
+ e.SESSION_ID,
62
+ "dist",
63
+ "runtime/node_modules/filepond-plugin-media-preview/dist/filepond-plugin-media-preview.min.js"
64
+ )
65
+ );
66
+
67
+ await func.utils.load_js_on_demand(
68
+ func.common.get_url(
69
+ e.SESSION_ID,
70
+ "dist",
71
+ "runtime/node_modules/filepond-plugin-file-validate-type/dist/filepond-plugin-file-validate-type.min.js"
72
+ )
73
+ );
74
+
75
+ await func.utils.load_css_on_demand(
76
+ func.common.get_url(
77
+ e.SESSION_ID,
78
+ "dist",
79
+ "runtime/node_modules/filepond/dist/filepond.css"
80
+ )
81
+ );
82
+
83
+ func.utils.load_css_on_demand(
84
+ func.common.get_url(
85
+ e.SESSION_ID,
86
+ "dist",
87
+ "runtime/node_modules/@xuda.io/pintura/pintura/pintura.css"
88
+ )
89
+ );
90
+ func.utils.load_css_on_demand(
91
+ func.common.get_url(
92
+ e.SESSION_ID,
93
+ "dist",
94
+ "runtime/node_modules/filepond-plugin-image-preview/dist/filepond-plugin-image-preview.css"
95
+ )
96
+ );
97
+ func.utils.load_css_on_demand(
98
+ func.common.get_url(
99
+ e.SESSION_ID,
100
+ "dist",
101
+ "runtime/node_modules/filepond-plugin-media-preview/dist/filepond-plugin-media-preview.min.css"
102
+ )
103
+ );
104
+ func.utils.load_css_on_demand(
105
+ func.common.get_url(
106
+ e.SESSION_ID,
107
+ "dist",
108
+ "runtime/node_modules/filepond-plugin-file-poster/dist/filepond-plugin-file-poster.min.css"
109
+ )
110
+ );
33
111
 
34
112
  var pond = undefined;
35
113
 
@@ -42,8 +120,8 @@ export async function upload(fields, e) {
42
120
  init_files.push({
43
121
  source: val,
44
122
  options: {
45
- type: "local"
46
- }
123
+ type: "local",
124
+ },
47
125
  });
48
126
  });
49
127
  };
@@ -51,7 +129,9 @@ export async function upload(fields, e) {
51
129
  // init files from predefined array
52
130
  if (!_.isEmpty(fields.file_upload_init_file_array)) {
53
131
  if (typeof fields.file_upload_init_file_array === "string") {
54
- fields.file_upload_init_file_array = eval(fields.file_upload_init_file_array);
132
+ fields.file_upload_init_file_array = eval(
133
+ fields.file_upload_init_file_array
134
+ );
55
135
  }
56
136
  if (fields.file_upload_init_file_array?.length) {
57
137
  init_files_fn(fields.file_upload_init_file_array);
@@ -94,17 +174,22 @@ export async function upload(fields, e) {
94
174
 
95
175
  if (!_.isEmpty(fields["xu-bind"])) {
96
176
  var ret = ret_obj.app_files;
97
- if (typeof initialBindValue === "string") ret = ret_obj.app_files.map((f) => f.server_fileName).join(",");
177
+ if (typeof initialBindValue === "string")
178
+ ret = ret_obj.app_files.map((f) => f.server_fileName).join(",");
98
179
 
99
180
  await e.api_utils.set_field_value(fields["xu-bind"], ret);
100
181
  }
101
182
 
102
183
  if (is_remove && fields.event_name_for_successful_remove_callback) {
103
- await e.api_utils.invoke_event(fields.event_name_for_successful_remove_callback);
184
+ await e.api_utils.invoke_event(
185
+ fields.event_name_for_successful_remove_callback
186
+ );
104
187
  }
105
188
 
106
189
  if (!is_remove && fields.event_name_for_successful_callback) {
107
- await e.api_utils.invoke_event(fields.event_name_for_successful_callback);
190
+ await e.api_utils.invoke_event(
191
+ fields.event_name_for_successful_callback
192
+ );
108
193
  }
109
194
 
110
195
  if (fields.clear_on_file_upload) {
@@ -114,10 +199,14 @@ export async function upload(fields, e) {
114
199
  }, 100);
115
200
  };
116
201
 
117
- var $pallet_wrapper = $(`<div class="image_wrapper" style="border: none !important;">`);
202
+ var $pallet_wrapper = $(
203
+ `<div class="image_wrapper" style="border: none !important;">`
204
+ );
118
205
 
119
206
  var input_id = new Date().valueOf();
120
- var $imgInp = $(`<input class="filepond ${widget_cssClass}" id="${input_id}" />`).appendTo($pallet_wrapper);
207
+ var $imgInp = $(
208
+ `<input class="filepond ${widget_cssClass}" id="${input_id}" />`
209
+ ).appendTo($pallet_wrapper);
121
210
 
122
211
  e.$containerP.html($pallet_wrapper);
123
212
 
@@ -149,7 +238,7 @@ export async function upload(fields, e) {
149
238
 
150
239
  fetch(url, {
151
240
  method: "POST",
152
- body: e
241
+ body: e,
153
242
  }).then((res) => {
154
243
  console.log("Request complete! response:", res);
155
244
  });
@@ -169,7 +258,12 @@ export async function upload(fields, e) {
169
258
  imageEditorSupportImage: (file) => {
170
259
  // return /^image/.test(file);
171
260
 
172
- return file.type !== "image/svg+xml" && file.type !== "image/gif" && !file.type.includes("audio") && !file.type.includes("video");
261
+ return (
262
+ file.type !== "image/svg+xml" &&
263
+ file.type !== "image/gif" &&
264
+ !file.type.includes("audio") &&
265
+ !file.type.includes("video")
266
+ );
173
267
  },
174
268
 
175
269
  imageEditor: {
@@ -179,9 +273,9 @@ export async function upload(fields, e) {
179
273
 
180
274
  imageProcessor: pintura.processImage,
181
275
  editorOptions: {
182
- ...pintura.getEditorDefaults()
276
+ ...pintura.getEditorDefaults(),
183
277
  },
184
- legacyDataToImageState: pintura.legacyDataToImageState
278
+ legacyDataToImageState: pintura.legacyDataToImageState,
185
279
  },
186
280
  server: {
187
281
  load: (source, load, error, progress, abort, headers) => {
@@ -208,21 +302,36 @@ export async function upload(fields, e) {
208
302
  return {
209
303
  abort: () => {
210
304
  abort();
211
- }
305
+ },
212
306
  };
213
307
  },
214
- process: (fieldName, file, metadata, load, error, progress, abort, transfer, options) => {
308
+ process: (
309
+ fieldName,
310
+ file,
311
+ metadata,
312
+ load,
313
+ error,
314
+ progress,
315
+ abort,
316
+ transfer,
317
+ options
318
+ ) => {
215
319
  let formData = new FormData();
216
320
  formData.append("file", file, file.name);
217
321
  const { app_id, gtp_token, app_token } = e._session;
218
322
 
219
- formData.append("app_id_reference", APP_OBJ?.[app_id]?.app_id_reference);
323
+ formData.append(
324
+ "app_id_reference",
325
+ APP_OBJ?.[app_id]?.app_id_reference
326
+ );
220
327
  formData.append("app_id", app_id);
221
328
  formData.append("gtp_token", gtp_token);
222
329
  formData.append("app_token", app_token);
223
330
  formData.append("drive_type", "workspace");
224
- if (fields.file_upload_folder) formData.append("folder", fields.file_upload_folder);
225
- if (fields.public_file) formData.append("make_public", fields.public_file);
331
+ if (fields.file_upload_folder)
332
+ formData.append("folder", fields.file_upload_folder);
333
+ if (fields.public_file)
334
+ formData.append("make_public", fields.public_file);
226
335
 
227
336
  let tags = fields.assign_file_tags || [];
228
337
 
@@ -246,15 +355,24 @@ export async function upload(fields, e) {
246
355
 
247
356
  let _domain = e._session.domain;
248
357
  if (e._session.is_deployment) {
249
- _domain = e._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io";
358
+ _domain =
359
+ e._session.opt.regional_server === "dev.xuda.io"
360
+ ? "dev.xuda.io"
361
+ : "xuda.io";
250
362
  }
251
363
 
252
364
  if (overrideAction === "replace" && file.name in existingFiles) {
253
365
  formData.append("file_path", "/" + file.name);
254
366
  formData.append("file_name", file.name);
255
- request.open("POST", `https://${_domain}/cpi/update_drive_file_workspace`);
367
+ request.open(
368
+ "POST",
369
+ `https://${_domain}/cpi/update_drive_file_workspace`
370
+ );
256
371
  } else {
257
- request.open("POST", `https://${_domain}/cpi/upload_drive_file_workspace`);
372
+ request.open(
373
+ "POST",
374
+ `https://${_domain}/cpi/upload_drive_file_workspace`
375
+ );
258
376
  }
259
377
 
260
378
  request.setRequestHeader("xu-gtp-token", gtp_token);
@@ -307,7 +425,7 @@ export async function upload(fields, e) {
307
425
 
308
426
  // Let FilePond know the request has been cancelled
309
427
  abort();
310
- }
428
+ },
311
429
  };
312
430
  },
313
431
 
@@ -325,12 +443,15 @@ export async function upload(fields, e) {
325
443
  let app_id = e._session.app_id;
326
444
  let app_id_reference = APP_OBJ[app_id].app_id_reference;
327
445
 
328
- axios_ajax(func.common.get_url(e.SESSION_ID, "rpi", "runtime_delete_file_bulk"), {
329
- app_id,
330
- server_files: ret_obj.deletedArr,
331
- app_id_reference: app_id_reference,
332
- gtp_token: e._session.gtp_token
333
- });
446
+ axios_ajax(
447
+ func.common.get_url(e.SESSION_ID, "rpi", "runtime_delete_file_bulk"),
448
+ {
449
+ app_id,
450
+ server_files: ret_obj.deletedArr,
451
+ app_id_reference: app_id_reference,
452
+ gtp_token: e._session.gtp_token,
453
+ }
454
+ );
334
455
  load();
335
456
  },
336
457
  remove: (source, load, error) => {
@@ -338,20 +459,23 @@ export async function upload(fields, e) {
338
459
 
339
460
  ret_obj.deletedArr.push(source_clean);
340
461
 
341
- var myIndex = ret_obj.app_files.indexOf((file) => file.server_fileName === source);
462
+ var myIndex = ret_obj.app_files.indexOf(
463
+ (file) => file.server_fileName === source
464
+ );
342
465
  if (myIndex !== -1) {
343
466
  ret_obj.app_files.splice(myIndex, 1);
344
467
  }
345
468
 
346
469
  ////////////// CALLBACK
347
- if (fields.instant_file_upload === "N" ? false : true) do_callback(true);
470
+ if (fields.instant_file_upload === "N" ? false : true)
471
+ do_callback(true);
348
472
  // Can call the error method if something is wrong, should exit after
349
473
  // error('oh my goodness');
350
474
 
351
475
  // Should call the load method when done, no parameters required
352
476
  load();
353
- }
354
- }
477
+ },
478
+ },
355
479
  };
356
480
 
357
481
  if (fields.file_upload_drop_area_label) {
@@ -420,28 +544,46 @@ export async function upload(fields, e) {
420
544
 
421
545
  return {
422
546
  pond,
423
- processFiles
547
+ processFiles,
424
548
  };
425
549
  }
426
550
 
427
551
  export async function viewer(fields, e) {
428
552
  const { app_id, gtp_token, app_token } = e._session;
429
553
 
430
- await func.utils.load_js_on_demand("https://cdn.tailwindcss.com?plugins=forms");
554
+ await func.utils.load_js_on_demand(
555
+ "https://cdn.tailwindcss.com?plugins=forms"
556
+ );
431
557
 
432
- await func.utils.load_js_on_demand("https://cdn.jsdelivr.net/npm/vue@3.5.6/dist/vue.global.js");
558
+ await func.utils.load_js_on_demand(
559
+ "https://cdn.jsdelivr.net/npm/vue@3.5.6/dist/vue.global.js"
560
+ );
433
561
 
434
- await func.utils.load_js_on_demand("https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js");
562
+ await func.utils.load_js_on_demand(
563
+ "https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.30.1/moment.min.js"
564
+ );
435
565
 
436
- await func.utils.load_js_on_demand("https://unpkg.com/swiper/swiper-bundle.min.js");
437
- await func.utils.load_css_on_demand("https://unpkg.com/swiper/swiper-bundle.min.css");
566
+ await func.utils.load_js_on_demand(
567
+ "https://unpkg.com/swiper/swiper-bundle.min.js"
568
+ );
569
+ await func.utils.load_css_on_demand(
570
+ "https://unpkg.com/swiper/swiper-bundle.min.css"
571
+ );
438
572
 
439
573
  await func.utils.load_js_on_demand("https://unpkg.com/@vueuse/shared");
440
574
  await func.utils.load_js_on_demand("https://unpkg.com/@vueuse/core");
441
- await func.utils.load_js_on_demand("https://unpkg.com/@floating-ui/core@1.1.1");
442
- await func.utils.load_js_on_demand("https://unpkg.com/@floating-ui/dom@1.1.1");
443
- await func.utils.load_js_on_demand("https://unpkg.com/floating-vue@5.2.2/dist/floating-vue.umd.js");
444
- await func.utils.load_css_on_demand("https://unpkg.com/floating-vue@^5.2.2/dist/style.css");
575
+ await func.utils.load_js_on_demand(
576
+ "https://unpkg.com/@floating-ui/core@1.1.1"
577
+ );
578
+ await func.utils.load_js_on_demand(
579
+ "https://unpkg.com/@floating-ui/dom@1.1.1"
580
+ );
581
+ await func.utils.load_js_on_demand(
582
+ "https://unpkg.com/floating-vue@5.2.2/dist/floating-vue.umd.js"
583
+ );
584
+ await func.utils.load_css_on_demand(
585
+ "https://unpkg.com/floating-vue@^5.2.2/dist/style.css"
586
+ );
445
587
 
446
588
  var fs = import("./fs-lightbox.js");
447
589
 
@@ -485,7 +627,7 @@ export async function viewer(fields, e) {
485
627
  ></circle>
486
628
  </svg>
487
629
  </div>
488
- `
630
+ `,
489
631
  };
490
632
 
491
633
  var segmentComponent = {
@@ -499,7 +641,7 @@ export async function viewer(fields, e) {
499
641
  },
500
642
  set(v) {
501
643
  this.$emit("update:modelValue", v);
502
- }
644
+ },
503
645
  },
504
646
  segmentActive() {
505
647
  // debugger;
@@ -509,7 +651,7 @@ export async function viewer(fields, e) {
509
651
 
510
652
  // debugger;
511
653
  return ret;
512
- }
654
+ },
513
655
  },
514
656
  template: `
515
657
  <div class="flex relative items-center rounded-lg bg-gray-100 [&>button]:px-4 [&>button]:py-2">
@@ -522,7 +664,7 @@ export async function viewer(fields, e) {
522
664
 
523
665
  <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>
524
666
  </div>
525
- `
667
+ `,
526
668
  };
527
669
 
528
670
  // <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" />
@@ -674,7 +816,7 @@ export async function viewer(fields, e) {
674
816
  </template>
675
817
 
676
818
  <div v-if="view === 'slider'" class="relative flex items-center justify-between py-4 px-4 flex-1 h-full overflow-hidden">
677
- <div class="absolute inset-y-0 left-6 z-10 flex items-center">
819
+ <div v-if="options.navigation" class="absolute inset-y-0 left-6 z-10 flex items-center">
678
820
  <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">
679
821
  <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>
680
822
  </button>
@@ -693,7 +835,7 @@ export async function viewer(fields, e) {
693
835
  </div>
694
836
  </div>
695
837
 
696
- <div class="absolute inset-y-0 right-6 z-10 flex items-center">
838
+ <div v-if="options.navigation" class="absolute inset-y-0 right-6 z-10 flex items-center">
697
839
  <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">
698
840
  <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>
699
841
  </button>
@@ -796,7 +938,10 @@ export async function viewer(fields, e) {
796
938
  const fetcher = async function (service, opt) {
797
939
  let _domain = e._session.domain;
798
940
  if (e._session.is_deployment) {
799
- _domain = e._session.opt.regional_server === "dev.xuda.io" ? "dev.xuda.io" : "xuda.io";
941
+ _domain =
942
+ e._session.opt.regional_server === "dev.xuda.io"
943
+ ? "dev.xuda.io"
944
+ : "xuda.io";
800
945
  }
801
946
 
802
947
  opt.app_id = app_id;
@@ -807,9 +952,9 @@ export async function viewer(fields, e) {
807
952
  Accept: "application/json",
808
953
  "Content-Type": "application/json",
809
954
  "xu-gtp-token": gtp_token,
810
- "xu-app-token": app_token
955
+ "xu-app-token": app_token,
811
956
  },
812
- body: JSON.stringify(opt)
957
+ body: JSON.stringify(opt),
813
958
  });
814
959
 
815
960
  const json = await response.json();
@@ -840,38 +985,38 @@ export async function viewer(fields, e) {
840
985
  var app = createApp({
841
986
  template: html,
842
987
  directives: {
843
- tooltip: FloatingVue.vTooltip
988
+ tooltip: FloatingVue.vTooltip,
844
989
  },
845
990
  components: {
846
991
  VDropdown: FloatingVue.Dropdown,
847
992
  segmentComponent,
848
- sepcialLoader
993
+ sepcialLoader,
849
994
  },
850
995
  data() {
851
996
  return {
852
997
  replaceOptions: [
853
998
  { label: "Replace existing items", value: "replace" },
854
- { label: "Keep all items", value: "keep" }
999
+ { label: "Keep all items", value: "keep" },
855
1000
  ],
856
1001
  sortDirOptions: [
857
1002
  {
858
1003
  label: "Ascending",
859
- value: "asc"
1004
+ value: "asc",
860
1005
  },
861
1006
  {
862
1007
  label: "Descending",
863
- value: "desc"
864
- }
1008
+ value: "desc",
1009
+ },
865
1010
  ],
866
1011
  sortOptions: [
867
1012
  {
868
1013
  label: "Date",
869
- value: "date"
1014
+ value: "date",
870
1015
  },
871
1016
  {
872
1017
  label: "Name",
873
- value: "name"
874
- }
1018
+ value: "name",
1019
+ },
875
1020
  ],
876
1021
  viewOptions: [
877
1022
  {
@@ -883,7 +1028,7 @@ export async function viewer(fields, e) {
883
1028
  ></path>
884
1029
  </svg>`,
885
1030
  label: "",
886
- value: "gallery"
1031
+ value: "gallery",
887
1032
  },
888
1033
  {
889
1034
  icon: ` <svg class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
@@ -894,7 +1039,7 @@ export async function viewer(fields, e) {
894
1039
  ></path>
895
1040
  </svg>`,
896
1041
  label: "",
897
- value: "list"
1042
+ value: "list",
898
1043
  },
899
1044
  {
900
1045
  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">
@@ -902,8 +1047,8 @@ export async function viewer(fields, e) {
902
1047
  <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>
903
1048
  </svg>`,
904
1049
  label: "",
905
- value: "slider"
906
- }
1050
+ value: "slider",
1051
+ },
907
1052
  ],
908
1053
  options: fields,
909
1054
  folders: [],
@@ -924,18 +1069,18 @@ export async function viewer(fields, e) {
924
1069
  {
925
1070
  label: "Filename",
926
1071
  tag: "name",
927
- modifier: "contains"
1072
+ modifier: "contains",
928
1073
  },
929
1074
  {
930
1075
  label: "Tag",
931
1076
  tag: "tag",
932
- modifier: "equals"
1077
+ modifier: "equals",
933
1078
  },
934
1079
  {
935
1080
  label: "Content",
936
1081
  tag: "any",
937
- modifier: "contains"
938
- }
1082
+ modifier: "contains",
1083
+ },
939
1084
  ],
940
1085
  opts: {
941
1086
  app_id,
@@ -943,17 +1088,17 @@ export async function viewer(fields, e) {
943
1088
  search_string: "",
944
1089
  sort_by: fields.sort_by || "date",
945
1090
  sort_dir: fields.sort_dir || "desc",
946
- ...(fields.filter_tags?.length ? { tags: fields.filter_tags } : {})
1091
+ ...(fields.filter_tags?.length ? { tags: fields.filter_tags } : {}),
947
1092
  // ...filter_tags
948
1093
  },
949
- limit: 10,
1094
+ limit: 50,
950
1095
  isEndOfList: false,
951
1096
  existingFiles: {},
952
1097
  allLoading: false,
953
1098
  showExistModal: false,
954
1099
  overrideAction: "replace",
955
1100
  pond: null,
956
- processFiles: null
1101
+ processFiles: null,
957
1102
  };
958
1103
  },
959
1104
  methods: {
@@ -971,7 +1116,7 @@ export async function viewer(fields, e) {
971
1116
  if (!bypassFolders) {
972
1117
  const folders = await this.fetcher("get_drive_files_workspace", {
973
1118
  ...this.opts,
974
- type: "directory"
1119
+ type: "directory",
975
1120
  });
976
1121
  this.folders = folders.data.children || [];
977
1122
  }
@@ -979,7 +1124,7 @@ export async function viewer(fields, e) {
979
1124
  const files = await this.fetcher("get_drive_files_workspace", {
980
1125
  ...this.opts,
981
1126
  ...(all ? {} : { from: 0, to: this.limit }),
982
- type: "file"
1127
+ type: "file",
983
1128
  });
984
1129
 
985
1130
  this.files = files.data.children || [];
@@ -1006,7 +1151,10 @@ export async function viewer(fields, e) {
1006
1151
  if (is_after_confirm) {
1007
1152
  this.showExistModal = false;
1008
1153
  // this.processCb();
1009
- this.processFiles(null, { overrideAction: this.overrideAction, existingFiles: this.existingFiles });
1154
+ this.processFiles(null, {
1155
+ overrideAction: this.overrideAction,
1156
+ existingFiles: this.existingFiles,
1157
+ });
1010
1158
 
1011
1159
  // this.pond.on("processfile", (e) => {
1012
1160
  // this.uploaderLoading = false;
@@ -1019,7 +1167,9 @@ export async function viewer(fields, e) {
1019
1167
  let promises = [];
1020
1168
  this.existingFiles = {};
1021
1169
 
1022
- var filesMapped = this.pond.getFiles().map((e) => ({ id: e.id, filename: e.file.name }));
1170
+ var filesMapped = this.pond
1171
+ .getFiles()
1172
+ .map((e) => ({ id: e.id, filename: e.file.name }));
1023
1173
 
1024
1174
  filesMapped.forEach(({ filename }) => {
1025
1175
  promises.push(
@@ -1027,7 +1177,7 @@ export async function viewer(fields, e) {
1027
1177
  this.fetcher(`check_drive_file_workspace`, {
1028
1178
  file_path: "/" + filename,
1029
1179
  file_name: filename,
1030
- type: "file"
1180
+ type: "file",
1031
1181
  })
1032
1182
  .then((e) => {
1033
1183
  resolve(e);
@@ -1055,7 +1205,9 @@ export async function viewer(fields, e) {
1055
1205
  }
1056
1206
 
1057
1207
  filesMapped
1058
- .filter((e) => !Object.keys(this.existingFiles).includes(e.filename))
1208
+ .filter(
1209
+ (e) => !Object.keys(this.existingFiles).includes(e.filename)
1210
+ )
1059
1211
  .forEach((e) => {
1060
1212
  this.processFiles(e.id);
1061
1213
  });
@@ -1095,7 +1247,7 @@ export async function viewer(fields, e) {
1095
1247
  searchDebounce: _.debounce(async function ($event) {
1096
1248
  await this.refreshDirectory();
1097
1249
  }, 400),
1098
- moment
1250
+ moment,
1099
1251
  },
1100
1252
  mounted() {
1101
1253
  var onDrop = (files) => {
@@ -1105,14 +1257,16 @@ export async function viewer(fields, e) {
1105
1257
  };
1106
1258
 
1107
1259
  const { isOverDropZone } = VueUse.useDropZone(this.$refs.dropZoneRef, {
1108
- onDrop
1260
+ onDrop,
1109
1261
  });
1110
1262
 
1111
1263
  this.isOverDropZone = isOverDropZone;
1112
1264
  },
1113
1265
  computed: {
1114
1266
  searchTags() {
1115
- return this.opts.search_string.split(" ").filter((e) => e.includes(":"));
1267
+ return this.opts.search_string
1268
+ .split(" ")
1269
+ .filter((e) => e.includes(":"));
1116
1270
  },
1117
1271
  search: {
1118
1272
  get() {
@@ -1126,9 +1280,15 @@ export async function viewer(fields, e) {
1126
1280
 
1127
1281
  set(value) {
1128
1282
  // debugger;
1129
- var existingTags = this.opts.search_string.split(" ").filter((e) => e.includes(":"));
1283
+ var existingTags = this.opts.search_string
1284
+ .split(" ")
1285
+ .filter((e) => e.includes(":"));
1130
1286
 
1131
- this.opts.search_string = (existingTags.join(" ") + " " + value).trim();
1287
+ this.opts.search_string = (
1288
+ existingTags.join(" ") +
1289
+ " " +
1290
+ value
1291
+ ).trim();
1132
1292
 
1133
1293
  console.log(value);
1134
1294
 
@@ -1141,15 +1301,15 @@ export async function viewer(fields, e) {
1141
1301
  this.showSearchPopper = false;
1142
1302
  }, 50);
1143
1303
  }
1144
- }
1145
- }
1304
+ },
1305
+ },
1146
1306
  },
1147
1307
  watch: {
1148
1308
  opts: {
1149
1309
  deep: true,
1150
1310
  handler() {
1151
1311
  this.searchDebounce();
1152
- }
1312
+ },
1153
1313
  },
1154
1314
  view: {
1155
1315
  handler(val) {
@@ -1162,11 +1322,17 @@ export async function viewer(fields, e) {
1162
1322
  spaceBetween: 20,
1163
1323
  observer: true,
1164
1324
  observeParents: true,
1165
- ...(fields?.direction === "rtl" ? { reverseDirection: true } : {})
1325
+ ...fields.swiper_options,
1326
+ // ...(fields?.direction === "rtl" ? { reverseDirection: true } : {})
1166
1327
  });
1167
1328
 
1168
1329
  this.swiper.on("slideChange", (event) => {
1169
- if (event.activeIndex >= 5 && !this.isEndOfList && !this.loadingSearch && !this.allLoading) {
1330
+ if (
1331
+ event.activeIndex >= 5 &&
1332
+ !this.isEndOfList &&
1333
+ !this.loadingSearch &&
1334
+ !this.allLoading
1335
+ ) {
1170
1336
  this.refreshDirectory(true);
1171
1337
  }
1172
1338
  });
@@ -1178,21 +1344,24 @@ export async function viewer(fields, e) {
1178
1344
  refreshFsLightbox();
1179
1345
  });
1180
1346
  },
1181
- immediate: true
1347
+ immediate: true,
1182
1348
  },
1183
1349
  files() {
1184
1350
  this.$nextTick(() => {
1185
1351
  refreshFsLightbox();
1186
1352
  this.swiper?.update?.();
1187
1353
  });
1188
- }
1354
+ },
1189
1355
  },
1190
1356
  async created() {
1191
1357
  this.refreshDirectory();
1192
1358
 
1193
1359
  this.$nextTick(async () => {
1194
1360
  // debugger;
1195
- var { pond, processFiles } = await this.initUploader({ ...fields, instant_file_upload: "N" }, { ...e, $containerP: $("#imageUploaderComponent") });
1361
+ var { pond, processFiles } = await this.initUploader(
1362
+ { ...fields, instant_file_upload: "N" },
1363
+ { ...e, $containerP: $("#imageUploaderComponent") }
1364
+ );
1196
1365
 
1197
1366
  this.pond = pond;
1198
1367
  this.processFiles = processFiles;
@@ -1223,7 +1392,7 @@ export async function viewer(fields, e) {
1223
1392
  this.$watch("opts", (value) => {
1224
1393
  this.refreshDirectory();
1225
1394
  });
1226
- }
1395
+ },
1227
1396
  });
1228
1397
 
1229
1398
  // app.use(FloatingVue);