Skip to content
Snippets Groups Projects
Commit 6bac20fb authored by Steinwender, Tamara's avatar Steinwender, Tamara
Browse files

Fix clipboard bug: placeholder is shown on filled table and disabled buttons bug

parent 06350c06
Branches
No related tags found
No related merge requests found
Pipeline #106147 failed
...@@ -237,7 +237,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -237,7 +237,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
this.tabulatorTable.on("tableBuilt", this.tableBuiltFunction.bind(this)); this.tabulatorTable.on("tableBuilt", this.tableBuiltFunction.bind(this));
this.tabulatorTable.on("rowClick", this.rowClickFunction.bind(this)); this.tabulatorTable.on("rowClick", this.rowClickFunction.bind(this));
this.tabulatorTable.on("rowSelectionChanged", this.rowSelectionChangedFunction.bind(this)); this.tabulatorTable.on("rowSelectionChanged", this.rowSelectionChangedFunction.bind(this));
this.tabulatorTable.on("dataLoaded", this.dataLoadedFunction.bind(this)); this.tabulatorTable.on("dataChanged", this.dataChangedFunction.bind(this));
}); });
//Register only one beforeunload Event for the clipboard warning //Register only one beforeunload Event for the clipboard warning
...@@ -292,7 +292,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -292,7 +292,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
} }
} }
dataLoadedFunction() { dataChangedFunction() {
if (this.tabulatorTable !== null) { if (this.tabulatorTable !== null) {
const that = this; const that = this;
...@@ -328,7 +328,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -328,7 +328,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
this.tabulatorTable.off("tableBuilt"); this.tabulatorTable.off("tableBuilt");
this.tabulatorTable.off("rowClick"); this.tabulatorTable.off("rowClick");
this.tabulatorTable.off("rowSelectionChanged"); this.tabulatorTable.off("rowSelectionChanged");
this.tabulatorTable.off("dataLoaded"); this.tabulatorTable.off("dataChanged");
} }
/** /**
...@@ -409,7 +409,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -409,7 +409,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
/** /**
* If clipboard files and the tabulator table exists, then clear the table and sets the new data * If clipboard files and the tabulator table exists, then clear the table and sets the new data
* *s
*/ */
generateClipboardTable() { generateClipboardTable() {
this.numberOfSelectedFiles = 0; this.numberOfSelectedFiles = 0;
...@@ -428,10 +428,20 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -428,10 +428,20 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
this.tabulatorTable.clearData(); this.tabulatorTable.clearData();
this.tabulatorTable.setData(data); this.tabulatorTable.setData(data);
if(this.clipboardFiles.files.length > 0) {
let placeholders = this._a(".tabulator-placeholder");
if(placeholders)
placeholders.forEach(placeholder => placeholder.style.display = "none");
} else {
let placeholders = this._a(".tabulator-placeholder");
if(placeholders)
placeholders.forEach(placeholder => placeholder.style.display = "inherit");
}
} }
if (this._('#select_all')) { if (this._('#select_all')) {
this._('#select_all').checked = false; this._('#select_all').checked = false;
} }
} }
/** /**
...@@ -442,7 +452,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -442,7 +452,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
async sendClipboardFiles(files) { async sendClipboardFiles(files) {
const i18n = this._i18n; const i18n = this._i18n;
for (let i = 0; i < files.length; i++) { for (let i = 0; i < files.length; i++) {
await this.sendFileEvent(files[i].file); await this.sendFileEvent(files[i].file, files.length);
} }
this.tabulatorTable.deselectRow(); this.tabulatorTable.deselectRow();
send({ send({
...@@ -453,8 +463,8 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -453,8 +463,8 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
}); });
} }
async sendFileEvent(file) { async sendFileEvent(file, maxFiles) {
const data = {file: file, data: file}; const data = {file: file, data: file, maxUpload: maxFiles};
const event = new CustomEvent('dbp-clipboard-file-picker-file-downloaded', { const event = new CustomEvent('dbp-clipboard-file-picker-file-downloaded', {
detail: data, detail: data,
bubbles: true, bubbles: true,
...@@ -517,6 +527,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -517,6 +527,7 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
} else { } else {
files = files.concat(event.detail.file); files = files.concat(event.detail.file);
} }
this.filesToSave = files; this.filesToSave = files;
if (files && files.length !== 0) { if (files && files.length !== 0) {
data = {files: files}; data = {files: files};
...@@ -908,24 +919,6 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -908,24 +919,6 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
justify-content: space-between; justify-content: space-between;
} }
.tabulator .tabulator-tableHolder .tabulator-placeholder span {
margin: initial;
}
/*
.checkmark {
height: 20px;
width: 20px;
left: 11px;
top: 4px;
}
.button-container .checkmark::after {
left: 8px;
top: 3px;
width: 4px;
height: 11px;
}*/
.table-wrapper { .table-wrapper {
position: relative; position: relative;
} }
...@@ -987,22 +980,6 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) { ...@@ -987,22 +980,6 @@ export class Clipboard extends ScopedElementsMixin(AdapterLitElement) {
display: block; display: block;
} }
/* .checkmark {
height: 25px;
width: 25px;
left: 9px;
top: 2px;
}
.button-container .checkmark::after {
left: 8px;
top: 2px;
width: 8px;
height: 15px;
}
*/
.btn-flex-container-mobile { .btn-flex-container-mobile {
flex-direction: column; flex-direction: column;
} }
......
...@@ -548,7 +548,7 @@ export class FileSource extends ScopedElementsMixin(DbpFileHandlingLitElement) { ...@@ -548,7 +548,7 @@ export class FileSource extends ScopedElementsMixin(DbpFileHandlingLitElement) {
nextcloud-file-url="${this.nextcloudFileURL}" nextcloud-file-url="${this.nextcloudFileURL}"
allowed-mime-types="${this.allowedMimeTypes}" allowed-mime-types="${this.allowedMimeTypes}"
@dbp-clipboard-file-picker-file-downloaded="${(event) => { @dbp-clipboard-file-picker-file-downloaded="${(event) => {
this.sendFileEvent(event.detail.file); this.sendFileEvent(event.detail.file, event.detail.maxUpload);
}}"></dbp-clipboard> }}"></dbp-clipboard>
`; `;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment