Compare commits

..

No commits in common. "c97c0ead0b6b71867da399fa99469294c48758e8" and "15f60d3c128254d4138de6728a2e8f8a50720439" have entirely different histories.

2 changed files with 665 additions and 639 deletions

View File

@ -1,4 +1,4 @@
import { FreeDatas2HTML, Pagination, SearchEngine, Selector } from "../../src/FreeDatas2HTML"; import { FreeDatas2HTML, Pagination, Selector } from "../../src/FreeDatas2HTML";
import { MixedFieldsRender } from "../../src/extensions/MixedFieldsRender"; import { MixedFieldsRender } from "../../src/extensions/MixedFieldsRender";
const initialise=async () => const initialise=async () =>
@ -13,43 +13,43 @@ const initialise=async () =>
// Chaînes à utiliser par le moteur de rendu : // Chaînes à utiliser par le moteur de rendu :
const renderSettings= const renderSettings=
{ {
allBegining: "<ul>", allBegining: "",
allEnding: "</ul>", allEnding: "",
datasLinesDisplaying: `<li><h3>##0##</h3><ul><li>##8##</li><li>Lieu(x) d'exercice : ##7##</li>##10####11####4####12##</ul></li>` datasLinesDisplaying: `<h3>##0##</h3><p>##8##.<br>Lieux d'activité : ##7##.##10## ##11####4####12##</p>`
}; };
// Fonctions spécifiques pour créer les liens hypertextes : // Fonctions spécifiques pour créer les liens hypertextes :
const rendName2HTML=(values: {[index: string]:string} ) : string => const rendName2HTML=(values: {[index: string]:string} ) : string =>
{ {
if(values["Présentation"] !== undefined && values["Présentation"].trim() !== "") if(values["Présentation"] !== undefined && values["Présentation"].trim() !== "")
return `<a href="${values['Présentation'].trim()}" title="Présentation de ${values["Nom commercial"].trim()}">${values["Nom commercial"].trim()}</a>`; return `<a href="${values['Présentation'].trim()}" title="Lire notre article de présentation de ce partenaire">${values["Nom commercial"].trim()}</a>`;
else else
return values["Nom commercial"].trim(); return values["Nom commercial"].trim();
}; };
const rendSite2HTML=(values: {[index: string]:string} ) : string => const rendSite2HTML=(values: {[index: string]:string} ) : string =>
{ {
if(values["Site"].trim() !== "") if(values["Site"].trim() !== "")
return `<li><a href="${values['Site'].trim()}" target="_blank" title="Visiter le site de ${values['Nom commercial'].trim()}">Page internet</a></li>`; return `<br><a href="${values['Site'].trim()}" target="_blank" title="Visiter le site de ${values['Nom commercial'].trim()}">Page internet</a>`;
else else
return ""; return "";
}; };
const rendEmail2HTML=(values: {[index: string]:string} ) : string => const rendEmail2HTML=(values: {[index: string]:string} ) : string =>
{ {
if(values["E-mail"].trim() !== "") if(values["E-mail"].trim() !== "")
return `<li><a href="mailto:${values['E-mail'].trim()}?subject=Le segal" title="Contactez ${values['Nom commercial'].trim()}">Courriel</a></li>`; return `<br><a href="mailto:${values['E-mail'].trim()}" title="Contactez ${values['Nom commercial'].trim()}">E-Mail</a>`;
else else
return ""; return "";
}; };
const rendTel2HTML=(values: {[index: string]:string} ) : string => const rendTel2HTML=(values: {[index: string]:string} ) : string =>
{ {
if(values["Fixe"].trim() !== "") if(values["Fixe"].trim() !== "")
return `<li><a href="tel:${values['Fixe'].trim()}" title="Appelez ${values['Nom commercial'].trim()}">${values['Fixe'].trim()}</a></li>`; return `<br><a href="tel:${values['Fixe'].trim()}" title="Appelez ${values['Nom commercial'].trim()}">${values['Fixe'].trim()}</a>`;
else else
return ""; return "";
}; };
const rendMobile2HTML=(values: {[index: string]:string} ) : string => const rendMobile2HTML=(values: {[index: string]:string} ) : string =>
{ {
if(values["Portable"].trim() !== "") if(values["Portable"].trim() !== "")
return `<li><a href="tel:${values['Portable'].trim()}" title="Appelez ${values['Portable'].trim()}">${values['Portable'].trim()}</a></li>`; return `<br><a href="tel:${values['Portable'].trim()}" title="Appelez ${values['Portable'].trim()}">${values['Portable'].trim()}</a>`;
else else
return ""; return "";
}; };
@ -58,27 +58,23 @@ const initialise=async () =>
myRender.fieldRenders=[{ name:"Nom commercial", rend2HTML: rendName2HTML}, { name:"E-mail", rend2HTML: rendEmail2HTML}, { name:"Site", rend2HTML: rendSite2HTML}, { name:"Fixe", rend2HTML: rendTel2HTML}, { name:"Portable", rend2HTML: rendMobile2HTML}]; myRender.fieldRenders=[{ name:"Nom commercial", rend2HTML: rendName2HTML}, { name:"E-mail", rend2HTML: rendEmail2HTML}, { name:"Site", rend2HTML: rendSite2HTML}, { name:"Fixe", rend2HTML: rendTel2HTML}, { name:"Portable", rend2HTML: rendMobile2HTML}];
converter.datasRender=myRender; converter.datasRender=myRender;
// Création des filtres : // Création de filtres :
const filtre1=new Selector(converter, 8, { id:"filtreActivites"} ); const filtre1=new Selector(converter, 8, { id:"filtreActivites"} );
//let filtre2=new Selector(converter, 7, { id:"filtreLieux"}, "," ); let filtre2=new Selector(converter, 7, { id:"filtreLieux"}, "," );
filtre1.filter2HTML("Domaine d'activité"); filtre1.filter2HTML("Domaine d'activité");
//filtre2.filter2HTML("Lieux"); filtre2.filter2HTML("Lieux");
converter.datasFilters=[filtre1,filtre2];
// Dont un moteur de recherche : // Configuration de la pagination :
const mySearch=new SearchEngine(converter, { id:"search" }); const pagination=new Pagination(converter, { id:"pages" }, "Page à afficher :");
mySearch.label=""; pagination.options={ displayElement: { id:"pagination" }, values: [10,20,50,100] , name: "Choix de pagination :" };
mySearch.btnTxt="Chercher"; pagination.selectedValue=10;
// La recherche se lance automatiquement, dès que 2 caractères sont saisis : converter.pagination=pagination;
mySearch.automaticSearch=true; pagination.options2HTML();
mySearch.nbCharsForSearch=2;
mySearch.placeholder="Exemples de recherche : creperie port-louis, pain bio...";
mySearch.filter2HTML();
converter.datasFilters=[filtre1,mySearch]; // Affichage initial avec l'id de l'élément HTML devant afficher le compteur :
// Id de l'élément HTML devant afficher la liste de partenaires :
converter.datasViewElt={ id:"partenaires" }; converter.datasViewElt={ id:"partenaires" };
// Pas d'affichage initial, car il est généré en PHP côté backend. converter.refreshView();
} }
catch(e) catch(e)
{ {
@ -87,5 +83,5 @@ const initialise=async () =>
} }
} }
console.log("**** Hello les devs :-)\nLe code source de ce script est libre et vous pouvez le trouver à cette adresse :\n https://forge.chapril.org/Fab_Blab/freeDatas2HTML/src/branch/master/integrations/src/segal.ts"); console.log("Hello, ami développeur :-)\nLe code source TypeScript utilisé pour faire fonctionner cette page est lisible ici : :\nhttps://forge.chapril.org/Fab_Blab/freeDatas2HTML/src/branch/master/integrations/src/segal.ts\nUn bug ? Une suggestion ? => fabrice@le-fab-lab.com");
initialise(); initialise();

1256
package-lock.json generated

File diff suppressed because it is too large Load Diff