@xuda.io/xuda-widget-plugin-xuda-drive 1.0.11 → 1.0.13

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 (2) hide show
  1. package/package.json +1 -1
  2. package/runtime.mjs +67 -24
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xuda.io/xuda-widget-plugin-xuda-drive",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
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
@@ -574,39 +574,82 @@ export async function viewer(fields, e) {
574
574
 
575
575
  let viewer_type = fields.default_view_type || "gallery";
576
576
 
577
- let opt = { app_id, type: "file", search_string: "a" };
577
+ const render_view = async function () {
578
+ e.$containerP.find(".drive_view_wrapper").empty();
578
579
 
579
- try {
580
- const ret = await search_drive();
580
+ let opt = { app_id, type: "file", search_string: "a" };
581
+
582
+ try {
583
+ const ret = await search_drive();
584
+
585
+ let $wrapper;
581
586
 
582
- for (let file of ret.data) {
583
587
  switch (viewer_type) {
584
588
  case "gallery": {
585
- e.$containerP.append(`
586
- <section class="mt-8 pb-16" aria-labelledby="gallery-heading">
589
+ $wrapper = `
590
+ <div class="drive_view_wrapper">
591
+ <section class="mt-8 pb-16" aria-labelledby="gallery-heading">
587
592
  <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="${file.file_url}" alt="${file.name}" 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
- `);
593
+ <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]">`;
603
594
  break;
604
595
  }
605
596
  default:
606
597
  break;
607
598
  }
599
+
600
+ for (let file of ret.data) {
601
+ switch (viewer_type) {
602
+ case "gallery": {
603
+ $wrapper.append(`
604
+ <li class="relative">
605
+ <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"'>
606
+ <img src="${file.file_url}" alt="${file.name}" class="pointer-events-none object-cover" x-state:on="Current" x-state:off="Default" x-state-description='Current: "", Default: "group-hover:opacity-75"' />
607
+ <button type="button" class="absolute inset-0 focus:outline-none">
608
+ <span class="sr-only">View details for IMG_4985.HEIC</span>
609
+ </button>
610
+ </div>
611
+ <p class="pointer-events-none mt-2 block truncate text-sm font-medium text-gray-900">IMG_4985.HEIC</p>
612
+ <p class="pointer-events-none block text-sm font-medium text-gray-500">3.9 MB</p>
613
+ </li>
614
+
615
+ `);
616
+ break;
617
+ }
618
+ default:
619
+ break;
620
+ }
621
+ }
622
+
623
+ e.$containerP.append($wrapper);
624
+ } catch (err) {
625
+ console.error(err);
608
626
  }
609
- } catch (err) {
610
- console.error(err);
611
- }
627
+ };
628
+
629
+ render_view();
612
630
  }
631
+
632
+ // `
633
+
634
+ // <div class="drive_view_wrapper">
635
+
636
+ // <section class="mt-8 pb-16" aria-labelledby="gallery-heading">
637
+ // <h2 id="gallery-heading" class="sr-only">Recently viewed</h2>
638
+ // <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]">
639
+
640
+ // <li class="relative">
641
+ // <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"'>
642
+ // <img src="${file.file_url}" alt="${file.name}" class="pointer-events-none object-cover" x-state:on="Current" x-state:off="Default" x-state-description='Current: "", Default: "group-hover:opacity-75"' />
643
+ // <button type="button" class="absolute inset-0 focus:outline-none">
644
+ // <span class="sr-only">View details for IMG_4985.HEIC</span>
645
+ // </button>
646
+ // </div>
647
+ // <p class="pointer-events-none mt-2 block truncate text-sm font-medium text-gray-900">IMG_4985.HEIC</p>
648
+ // <p class="pointer-events-none block text-sm font-medium text-gray-500">3.9 MB</p>
649
+ // </li>
650
+
651
+ // </ul>
652
+ // </section>
653
+
654
+ // <div>
655
+ // `