From 75961dd34aaa74b2e65855a43500655feae2725c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20PENHO=C3=8BT?= Date: Wed, 20 Oct 2021 17:34:10 +0200 Subject: [PATCH] =?UTF-8?q?Adaptation=20des=20appels=20=C3=A0=20la=20class?= =?UTF-8?q?e=20g=C3=A9rant=20le=20rendu=20HTML.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/exampleWithCSV.ts | 2 +- src/exampleWithHTML.ts | 2 +- src/exampleWithJSON.ts | 2 +- src/freeDatas2HTML.ts | 11 +++++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/exampleWithCSV.ts b/src/exampleWithCSV.ts index 4126737..94835e9 100644 --- a/src/exampleWithCSV.ts +++ b/src/exampleWithCSV.ts @@ -24,7 +24,7 @@ const initialise = async () => converter.datasViewElt={ id:"datas" }; await converter.run(); // Adaptation du rendu suivant la taille de l'écran - const myRender=new Render(converter); + const myRender=new Render(); if(window.innerWidth < 800) { myRender.settings= diff --git a/src/exampleWithHTML.ts b/src/exampleWithHTML.ts index ebecd47..955c3a5 100644 --- a/src/exampleWithHTML.ts +++ b/src/exampleWithHTML.ts @@ -9,7 +9,7 @@ const initialise = async () => converter.datasViewElt={ id:"datas" }; await converter.run(); // Adaptation du rendu suivant la taille de l'écran - const myRender=new Render(converter); + const myRender=new Render(); if(window.innerWidth < 800) { myRender.settings= diff --git a/src/exampleWithJSON.ts b/src/exampleWithJSON.ts index 58484fa..b8d70b5 100644 --- a/src/exampleWithJSON.ts +++ b/src/exampleWithJSON.ts @@ -10,7 +10,7 @@ const initialise = async () => converter.datasViewElt={ id:"datas" }; await converter.run(); // Adaptation du rendu suivant la taille de l'écran - const myRender=new Render(converter); + const myRender=new Render(); if(window.innerWidth < 800) { myRender.settings= diff --git a/src/freeDatas2HTML.ts b/src/freeDatas2HTML.ts index 7516507..c86951f 100644 --- a/src/freeDatas2HTML.ts +++ b/src/freeDatas2HTML.ts @@ -26,7 +26,7 @@ export class FreeDatas2HTML // Le nom des champs trouvés dans les données : public fields: string[]|undefined=undefined; // Les données à proprement parler : - public datas: {[index: string]:any}[]=[]; + public datas: {[index: string]:string}[]=[]; // Les erreurs rencontrées durant le traitement des données reçues : public parseErrors: ParseErrors[]|undefined; // Doit-on tout arrêter si une erreur est rencontrée durant le traitement ? @@ -50,7 +50,7 @@ export class FreeDatas2HTML // Il doit donc déjà avoir été testé constructor(datasType:"CSV"|"HTML"|"JSON", datas2Parse="", datasRemoteSource?:RemoteSources) { - this.datasRender=new Render(this); + this.datasRender=new Render(); switch (datasType) { case "CSV": @@ -151,9 +151,11 @@ export class FreeDatas2HTML else { // revoir l'intérêt de copier ces 3 attributs ? - this.fields=this.parser.parseResults.fields; + this.fields=this.parser.parseResults.fields; this.datas=this.parser.parseResults.datas; this.parseErrors=this.parser.parseResults.errors; + // Les champs ne bougeront plus donc on peut aussi les passer au moteur de rendu + this.datasRender.fields=this.fields; if(this._datasViewElt !== undefined) this.refreshView(); return true; @@ -230,7 +232,8 @@ export class FreeDatas2HTML // Tout réaffichage peut entraîner une modification du nombre de pages (évolution filtres, etc.) if(this.pagination !== undefined) this.pagination.pages2HTML(nbTotal); - return this.datasRender.rend2HTML(datas2Display); + this.datasRender.datas=datas2Display; + return this.datasRender.rend2HTML(); } }