From 579448b7de5cf52e5089ab8e77d12a1f415c4afb Mon Sep 17 00:00:00 2001 From: Alexandre_BRAVO Date: Fri, 20 Dec 2024 16:08:52 +0100 Subject: [PATCH] ajout checkbox all --- src/components/WebContentViewer.vue | 30 +++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/src/components/WebContentViewer.vue b/src/components/WebContentViewer.vue index 5e0ea1b..c266d41 100644 --- a/src/components/WebContentViewer.vue +++ b/src/components/WebContentViewer.vue @@ -14,8 +14,8 @@
+ class="NIQUE TA MERE CA CHANGE RIEN PARCE QUE HTML/CSS C DE LA MERDE" + @change="handleCheckAll($event)" v-model="checkedAll" />
{{ translate('name')}}
@@ -23,7 +23,7 @@
-
+
@@ -118,6 +118,8 @@ export default { currentDir: '', breadcrumbParts: [], cochedFiles: [], + checkedAll: false, + cachedSortedFiles: null, }; }, props: { @@ -130,7 +132,7 @@ export default { Required: true, } }, - computed: { + computed:{ sortedFiles() { const flattenAndSort = (files, parentPath = '') => { const flatList = []; @@ -156,6 +158,14 @@ export default { return flattenAndSort(this.zipContent); }, }, + watch: { + sortedFiles: { + handler(newVal) { + this.cachedSortedFiles = newVal; // Met à jour la variable chaque fois que sortedFiles change + }, + immediate: true, // Met à jour dès que le composant est monté + }, + }, async mounted() { this.isLoading = true; await this.loadZipContent(); @@ -394,7 +404,19 @@ export default { }, uncheckAll() { this.cochedFiles = []; + this.checkedAll = false; }, + handleCheckAll(event) { + this.sortedFiles.forEach(file => { + if(this.isVisible(file)) { + if (event.target.checked) { + this.cocheFile(file); + } else { + this.decocheFile(file); + } + } + }) + } }, };