From 71b40e9fcb9b87458df18a5c1069c952366168f6 Mon Sep 17 00:00:00 2001
From: Tamara Steinwender <tamara.steinwender@tugraz.at>
Date: Wed, 7 Jul 2021 15:38:21 +0200
Subject: [PATCH] Filepicker finetuning

---
 packages/common/styles.js                        |  2 +-
 packages/file-handling/src/clipboard.js          |  3 ++-
 packages/file-handling/src/file-sink.js          |  9 +++++++++
 .../file-handling/src/nextcloud-file-picker.js   | 16 +++++++++++-----
 packages/file-handling/src/styles.js             |  5 +++++
 5 files changed, 28 insertions(+), 7 deletions(-)

diff --git a/packages/common/styles.js b/packages/common/styles.js
index 8d6475a6..1032f331 100644
--- a/packages/common/styles.js
+++ b/packages/common/styles.js
@@ -455,7 +455,7 @@ export function getButtonCSS() {
         }
 
         button.button[disabled], .button[disabled], fieldset[disabled] .button {
-            opacity: .5;
+            opacity: .4;
             cursor: not-allowed;
         }
     `;
diff --git a/packages/file-handling/src/clipboard.js b/packages/file-handling/src/clipboard.js
index 82120277..92f3da20 100644
--- a/packages/file-handling/src/clipboard.js
+++ b/packages/file-handling/src/clipboard.js
@@ -240,7 +240,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
                         this._("#select_all_checkmark").title = this.checkAllSelected() ? i18n.t('clipboard.select-nothing') : i18n.t('clipboard.select-all');
                     }
                 },
-                renderComplete: () => {
+                dataLoaded: () => {
                     if (this.tabulatorTable !== null) {
                         const that = this;
                         setTimeout(function(){
@@ -337,6 +337,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
      *
      */
     generateClipboardTable() {
+        this.numberOfSelectedFiles = 0;
         if (this.clipboardFiles.files) {
             let data = [];
             for (let i = 0; i < this.clipboardFiles.files.length; i++) {
diff --git a/packages/file-handling/src/file-sink.js b/packages/file-handling/src/file-sink.js
index d25ef063..b4b2ed54 100644
--- a/packages/file-handling/src/file-sink.js
+++ b/packages/file-handling/src/file-sink.js
@@ -247,6 +247,15 @@ export class FileSink extends ScopedElementsMixin(DbpFileHandlingLitElement) {
 
     closeDialog(e) {
         this.sendDestination();
+        if (this.enabledTargets.includes('clipboard')) {
+            const filePicker = this._('#clipboard-file-picker');
+            if (filePicker && filePicker.tabulatorTable) {
+                filePicker.tabulatorTable.deselectRow();
+                if (filePicker._('#select_all')) {
+                    filePicker._("#select_all").checked = false;
+                }
+            }
+        }
         MicroModal.close(this._('#modal-picker'));
         this.isDialogOpen = false;
     }
diff --git a/packages/file-handling/src/nextcloud-file-picker.js b/packages/file-handling/src/nextcloud-file-picker.js
index 8b149ed8..341738d9 100644
--- a/packages/file-handling/src/nextcloud-file-picker.js
+++ b/packages/file-handling/src/nextcloud-file-picker.js
@@ -215,7 +215,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                         title: i18n.t('nextcloud-file-picker.last-modified'),
                         responsive: 3,
                         widthGrow: 1,
-                        minWidth: 100,
+                        minWidth: 150,
                         field: "lastmod",
                         sorter: (a, b, aRow, bRow, column, dir, sorterParams) => {
                             const a_timestamp = Date.parse(a);
@@ -307,11 +307,14 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                 rowAdded: (row) => {
                     row.getElement().classList.toggle("addRowAnimation");
                 },
-                renderComplete: () => {
+                dataLoaded: () => {
                     if (this.tabulatorTable !== null) {
                         const that = this;
                         setTimeout(function(){
+                            console.log("start2");
                             if (that._('.tabulator-responsive-collapse-toggle-open')) {
+                                console.log("yes2");
+
                                 that._a('.tabulator-responsive-collapse-toggle-open').forEach(element => element.addEventListener("click", that.toggleCollapse.bind(that)));
                             }
 
@@ -320,8 +323,7 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
                             }
                         }, 0);
                     }
-
-                },
+                }
             });
 
 
@@ -1489,7 +1491,11 @@ export class NextcloudFilePicker extends ScopedElementsMixin(DBPLitElement) {
             .remember-container{
                 display: inline-block;
                 line-height: 28px;
-                padding-left: 44px;
+                padding-left: 34px;
+            }
+
+            .remember-container .checkmark{
+                left: 0px;
             }
 
 
diff --git a/packages/file-handling/src/styles.js b/packages/file-handling/src/styles.js
index 70cd49b7..ff348cc9 100644
--- a/packages/file-handling/src/styles.js
+++ b/packages/file-handling/src/styles.js
@@ -236,6 +236,11 @@ export function getFileHandlingCss() {
         .tabulator-row-handle{
             padding: 0px !important;
         }
+        
+        .tabulator-selected .tabulator-responsive-collapse-toggle-open, 
+        .tabulator-selected .tabulator-responsive-collapse-toggle-close{
+            color: white;
+        }
 
         @media only screen
         and (orientation: portrait)
-- 
GitLab