@xuda.io/xuda-widget-plugin-xuda-drive 1.0.7 → 1.0.8

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 +2 -2
  2. package/package.json +1 -1
  3. package/runtime.mjs +38 -20
package/index.mjs CHANGED
@@ -153,8 +153,8 @@ export const methods = {
153
153
  value: "",
154
154
  },
155
155
  {
156
- label: "Thumbnails",
157
- value: "thumbnails",
156
+ label: "Gallery",
157
+ value: "gallery",
158
158
  },
159
159
  {
160
160
  label: "List",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-widget-plugin-xuda-drive",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
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
@@ -539,23 +539,7 @@ export async function viewer(fields, e) {
539
539
 
540
540
  <!-- Tabs -->
541
541
 
542
- <!-- Gallery -->
543
- <section class="mt-8 pb-16" aria-labelledby="gallery-heading">
544
- <h2 id="gallery-heading" class="sr-only">Recently viewed</h2>
545
- <ul role="list" class="grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 sm:gap-x-6 md:grid-cols-4 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8 [&>li>div>img]:aspect-[3/2]">
546
- <li class="relative">
547
- <div class="aspect-w-10 aspect-h-7 group block w-full overflow-hidden rounded-lg bg-gray-100 ring-2 ring-indigo-500 ring-offset-2" x-state:on="Current" x-state:off="Default" x-state-description='Current: "ring-2 ring-indigo-500 ring-offset-2", Default: "focus-within:ring-2 focus-within:ring-indigo-500 focus-within:ring-offset-2 focus-within:ring-offset-gray-100"'>
548
- <img src="https://images.unsplash.com/photo-1582053433976-25c00369fc93?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=512&amp;q=80" alt="" class="pointer-events-none object-cover" x-state:on="Current" x-state:off="Default" x-state-description='Current: "", Default: "group-hover:opacity-75"' />
549
- <button type="button" class="absolute inset-0 focus:outline-none">
550
- <span class="sr-only">View details for IMG_4985.HEIC</span>
551
- </button>
552
- </div>
553
- <p class="pointer-events-none mt-2 block truncate text-sm font-medium text-gray-900">IMG_4985.HEIC</p>
554
- <p class="pointer-events-none block text-sm font-medium text-gray-500">3.9 MB</p>
555
- </li>
556
-
557
- </ul>
558
- </section>
542
+
559
543
  </div>
560
544
  </main>
561
545
 
@@ -563,9 +547,7 @@ export async function viewer(fields, e) {
563
547
 
564
548
  e.$containerP.html(html);
565
549
 
566
- let opt = { app_id, type: "file" };
567
-
568
- try {
550
+ const search_drive = async function () {
569
551
  let domain =
570
552
  e._session.engine_mode === "live_preview" ? `dev.xuda.io` : `xuda.io`;
571
553
 
@@ -588,6 +570,42 @@ export async function viewer(fields, e) {
588
570
  }
589
571
  const json = await response.json();
590
572
  return json;
573
+ };
574
+
575
+ let viewer_type = fields.default_view_type || "gallery";
576
+
577
+ let opt = { app_id, type: "file", search_string: "a" };
578
+
579
+ try {
580
+ const ret = search_drive();
581
+
582
+ for (let file of ret.data.docs) {
583
+ switch (viewer_type) {
584
+ case "gallery": {
585
+ e.$containerP.append(`
586
+ <section class="mt-8 pb-16" aria-labelledby="gallery-heading">
587
+ <h2 id="gallery-heading" class="sr-only">Recently viewed</h2>
588
+ <ul role="list" class="grid grid-cols-2 gap-x-4 gap-y-8 sm:grid-cols-3 sm:gap-x-6 md:grid-cols-4 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8 [&>li>div>img]:aspect-[3/2]">
589
+ <li class="relative">
590
+ <div class="aspect-w-10 aspect-h-7 group block w-full overflow-hidden rounded-lg bg-gray-100 ring-2 ring-indigo-500 ring-offset-2" x-state:on="Current" x-state:off="Default" x-state-description='Current: "ring-2 ring-indigo-500 ring-offset-2", Default: "focus-within:ring-2 focus-within:ring-indigo-500 focus-within:ring-offset-2 focus-within:ring-offset-gray-100"'>
591
+ <img src="https://images.unsplash.com/photo-1582053433976-25c00369fc93?ixid=MXwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHw%3D&amp;ixlib=rb-1.2.1&amp;auto=format&amp;fit=crop&amp;w=512&amp;q=80" alt="" class="pointer-events-none object-cover" x-state:on="Current" x-state:off="Default" x-state-description='Current: "", Default: "group-hover:opacity-75"' />
592
+ <button type="button" class="absolute inset-0 focus:outline-none">
593
+ <span class="sr-only">View details for IMG_4985.HEIC</span>
594
+ </button>
595
+ </div>
596
+ <p class="pointer-events-none mt-2 block truncate text-sm font-medium text-gray-900">IMG_4985.HEIC</p>
597
+ <p class="pointer-events-none block text-sm font-medium text-gray-500">3.9 MB</p>
598
+ </li>
599
+
600
+ </ul>
601
+ </section>
602
+ `);
603
+ break;
604
+ }
605
+ default:
606
+ break;
607
+ }
608
+ }
591
609
  } catch (err) {
592
610
  console.error(err);
593
611
  }