Nouvelles compilations en JS des scripts + site démo.
This commit is contained in:
parent
6998eb67aa
commit
7053679a49
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -67,7 +67,7 @@ var FreeDatas2HTML = (function () {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (datas2Parse.trim() !== "")
|
if (datas2Parse.trim() !== "")
|
||||||
this.parser.datas2Parse = datas2Parse.trim();
|
this.parser.datas2Parse = datas2Parse;
|
||||||
else if (datasRemoteSource !== undefined)
|
else if (datasRemoteSource !== undefined)
|
||||||
this.parser.setRemoteSource(datasRemoteSource);
|
this.parser.setRemoteSource(datasRemoteSource);
|
||||||
}
|
}
|
||||||
@ -219,12 +219,6 @@ var FreeDatas2HTML = (function () {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
FreeDatas2HTML.prototype.datasCounter2HTML = function () {
|
|
||||||
if (this.datasCounterElt !== undefined) {
|
|
||||||
this.datasCounterElt = FreeDatas2HTML.checkInDOMById(this.datasCounterElt);
|
|
||||||
this.datasCounterElt.eltDOM.textContent = "" + this._nbDatasValid;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
FreeDatas2HTML.prototype.refreshView = function () {
|
FreeDatas2HTML.prototype.refreshView = function () {
|
||||||
if (this._fields.length === 0 || this._datasViewElt === undefined)
|
if (this._fields.length === 0 || this._datasViewElt === undefined)
|
||||||
throw new Error(errors.converterRefreshFail);
|
throw new Error(errors.converterRefreshFail);
|
||||||
@ -245,6 +239,12 @@ var FreeDatas2HTML = (function () {
|
|||||||
this.pagination.pages2HTML();
|
this.pagination.pages2HTML();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
FreeDatas2HTML.prototype.datasCounter2HTML = function () {
|
||||||
|
if (this.datasCounterElt !== undefined) {
|
||||||
|
this.datasCounterElt = FreeDatas2HTML.checkInDOMById(this.datasCounterElt);
|
||||||
|
this.datasCounterElt.eltDOM.textContent = "" + this._nbDatasValid;
|
||||||
|
}
|
||||||
|
};
|
||||||
FreeDatas2HTML.prototype.datas2HTML = function () {
|
FreeDatas2HTML.prototype.datas2HTML = function () {
|
||||||
if (this.datasSortedField !== undefined) {
|
if (this.datasSortedField !== undefined) {
|
||||||
var field_1 = this._fields[this.datasSortedField.datasFieldNb];
|
var field_1 = this._fields[this.datasSortedField.datasFieldNb];
|
||||||
@ -278,13 +278,12 @@ var FreeDatas2HTML = (function () {
|
|||||||
}
|
}
|
||||||
this._nbDatasValid = nbTotal;
|
this._nbDatasValid = nbTotal;
|
||||||
if (this._fields2Rend.length !== 0) {
|
if (this._fields2Rend.length !== 0) {
|
||||||
var newDatas2Display = [];
|
var realFields = this.realFields2Rend(), newDatas2Display = [];
|
||||||
for (var row in datas2Display) {
|
for (var row in datas2Display) {
|
||||||
var i = 0, newData = {};
|
var newData = {};
|
||||||
for (var field in datas2Display[row]) {
|
for (var field in datas2Display[row]) {
|
||||||
if (this._fields2Rend.indexOf(i) !== -1)
|
if (realFields.indexOf(field) !== -1)
|
||||||
newData[field] = datas2Display[row][field];
|
newData[field] = datas2Display[row][field];
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
newDatas2Display.push(newData);
|
newDatas2Display.push(newData);
|
||||||
}
|
}
|
||||||
|
@ -120,8 +120,6 @@ var ParserForJSON = (function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fields = goodFields;
|
fields = goodFields;
|
||||||
console.log(datasParsed.fields);
|
|
||||||
console.log(goodFields);
|
|
||||||
if (fields.length === 0)
|
if (fields.length === 0)
|
||||||
throw new Error(errors.parserFail);
|
throw new Error(errors.parserFail);
|
||||||
for (i = 0; i < nbDatas; i++) {
|
for (i = 0; i < nbDatas; i++) {
|
||||||
|
@ -21,16 +21,16 @@ var SortingField = (function () {
|
|||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(SortingField.prototype, "fieldsDOMSelector", {
|
Object.defineProperty(SortingField.prototype, "datasFieldNb", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this._fieldsDOMSelector;
|
return this._datasFieldNb;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
});
|
});
|
||||||
Object.defineProperty(SortingField.prototype, "datasFieldNb", {
|
Object.defineProperty(SortingField.prototype, "fieldsDOMSelector", {
|
||||||
get: function () {
|
get: function () {
|
||||||
return this._datasFieldNb;
|
return this._fieldsDOMSelector;
|
||||||
},
|
},
|
||||||
enumerable: true,
|
enumerable: true,
|
||||||
configurable: true
|
configurable: true
|
||||||
@ -49,8 +49,8 @@ var SortingField = (function () {
|
|||||||
else if (fields.length !== this._converter.realFields2Rend().length)
|
else if (fields.length !== this._converter.realFields2Rend().length)
|
||||||
throw new Error(errors.sortingFieldsNbFail);
|
throw new Error(errors.sortingFieldsNbFail);
|
||||||
else {
|
else {
|
||||||
var index = this._converter.getFieldDisplayRank(this._datasFieldNb);
|
|
||||||
var htmlContent = void 0;
|
var htmlContent = void 0;
|
||||||
|
var index = this._converter.getFieldDisplayRank(this._datasFieldNb);
|
||||||
htmlContent = fields[index].innerHTML;
|
htmlContent = fields[index].innerHTML;
|
||||||
htmlContent = "<a href='#freeDatas2HTMLSorting" + this._datasFieldNb + "' id='freeDatas2HTMLSorting" + this._datasFieldNb + "'>" + htmlContent + "</a>";
|
htmlContent = "<a href='#freeDatas2HTMLSorting" + this._datasFieldNb + "' id='freeDatas2HTMLSorting" + this._datasFieldNb + "'>" + htmlContent + "</a>";
|
||||||
fields[index].innerHTML = htmlContent;
|
fields[index].innerHTML = htmlContent;
|
||||||
|
@ -88,7 +88,7 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
filtre2.filter2HTML();
|
filtre2.filter2HTML();
|
||||||
filtre3 = new Selector(converter, 5, { id: "filtre3" }, ",");
|
filtre3 = new Selector(converter, 5, { id: "filtre3" }, ",");
|
||||||
filtre3.filter2HTML();
|
filtre3.filter2HTML();
|
||||||
mySearch = new SearchEngine(converter, { id: "search" }, [1, 3, 5]);
|
mySearch = new SearchEngine(converter, { id: "search" });
|
||||||
mySearch.label = "Qui cherche trouve ?";
|
mySearch.label = "Qui cherche trouve ?";
|
||||||
mySearch.btnTxt = "Va chercher !";
|
mySearch.btnTxt = "Va chercher !";
|
||||||
mySearch.automaticSearch = true;
|
mySearch.automaticSearch = true;
|
||||||
@ -110,11 +110,11 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
case 2:
|
case 2:
|
||||||
e_1 = _a.sent();
|
e_1 = _a.sent();
|
||||||
console.error(e_1);
|
console.error(e_1);
|
||||||
if (document.getElementById("datas") !== null)
|
document.getElementById("datas").innerHTML = "<div class=\"alert alert-warning\">D\u00E9sol\u00E9, mais un probl\u00E8me technique emp\u00EAche l'affichage des donn\u00E9es.</div>";
|
||||||
document.getElementById("datas").innerHTML = "<strong>Désolé, mais un problème technique empêche l'affichage des données.</strong>";
|
|
||||||
return [3, 3];
|
return [3, 3];
|
||||||
case 3: return [2];
|
case 3: return [2];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}); };
|
}); };
|
||||||
|
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/src/demo/exampleWithCSV.ts\nUn bug ? Une suggestion ? => fabrice@le-fab-lab.com");
|
||||||
initialise();
|
initialise();
|
||||||
|
@ -65,7 +65,7 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
}
|
}
|
||||||
pagination = new Pagination(converter, { id: "pages" }, "Page à afficher :");
|
pagination = new Pagination(converter, { id: "pages" }, "Page à afficher :");
|
||||||
pagination.options = { displayElement: { id: "paginationOptions" }, values: [15, 30, 50], name: "Nombre de lignes par page :" };
|
pagination.options = { displayElement: { id: "paginationOptions" }, values: [15, 30, 50], name: "Nombre de lignes par page :" };
|
||||||
pagination.selectedValue = 30;
|
pagination.selectedValue = 15;
|
||||||
converter.pagination = pagination;
|
converter.pagination = pagination;
|
||||||
pagination.options2HTML();
|
pagination.options2HTML();
|
||||||
filtre1 = new Selector(converter, 3, { id: "filtre1" });
|
filtre1 = new Selector(converter, 3, { id: "filtre1" });
|
||||||
@ -77,17 +77,16 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
converter.datasSortingFields = [sortingField1, sortingField2];
|
converter.datasSortingFields = [sortingField1, sortingField2];
|
||||||
}
|
}
|
||||||
converter.datasViewElt = { id: "datas" };
|
converter.datasViewElt = { id: "datas" };
|
||||||
converter.datasCounterElt = { id: "compteur" };
|
|
||||||
converter.refreshView();
|
converter.refreshView();
|
||||||
return [3, 3];
|
return [3, 3];
|
||||||
case 2:
|
case 2:
|
||||||
e_1 = _a.sent();
|
e_1 = _a.sent();
|
||||||
console.error(e_1);
|
console.error(e_1);
|
||||||
if (document.getElementById("datas") !== null)
|
document.getElementById("datas").innerHTML = "<div class=\"alert alert-warning\">D\u00E9sol\u00E9, mais un probl\u00E8me technique emp\u00EAche l'affichage des donn\u00E9es.</div>";
|
||||||
document.getElementById("datas").innerHTML = "<strong>Désolé, mais un problème technique empêche l'affichage des données.</strong>";
|
|
||||||
return [3, 3];
|
return [3, 3];
|
||||||
case 3: return [2];
|
case 3: return [2];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}); };
|
}); };
|
||||||
|
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/src/demo/exampleWithHTML.ts\nUn bug ? Une suggestion ? => fabrice@le-fab-lab.com");
|
||||||
initialise();
|
initialise();
|
||||||
|
@ -34,15 +34,15 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|||||||
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
import { FreeDatas2HTML, Pagination, Render, Selector, SortingField } from "../FreeDatas2HTML";
|
import { FreeDatas2HTML, Pagination, Render, SearchEngine, Selector, SortingField } from "../FreeDatas2HTML";
|
||||||
var initialise = function () { return __awaiter(void 0, void 0, void 0, function () {
|
var initialise = function () { return __awaiter(void 0, void 0, void 0, function () {
|
||||||
var converter, myRender, pagination, sortingField1, sortingField2, sortingField3, filtre1, e_1;
|
var converter, myRender, pagination, sortingField1, sortingField2, sortingField3, filtre1, mySearch, e_1;
|
||||||
return __generator(this, function (_a) {
|
return __generator(this, function (_a) {
|
||||||
switch (_a.label) {
|
switch (_a.label) {
|
||||||
case 0:
|
case 0:
|
||||||
_a.trys.push([0, 2, , 3]);
|
_a.trys.push([0, 2, , 3]);
|
||||||
converter = new FreeDatas2HTML("JSON");
|
converter = new FreeDatas2HTML("JSON");
|
||||||
converter.parser.setRemoteSource({ url: "http://localhost:8080/datas/posts.json", withCredentials: true, headers: [{ key: "Authorization", value: "Token YWxhZGRpbjpvcGVuc2VzYW1l" }] });
|
converter.parser.setRemoteSource({ url: "http://localhost:8080/datas/posts2.json", withCredentials: true, headers: [{ key: "Authorization", value: "Token YWxhZGRpbjpvcGVuc2VzYW1l" }] });
|
||||||
return [4, converter.run()];
|
return [4, converter.run()];
|
||||||
case 1:
|
case 1:
|
||||||
_a.sent();
|
_a.sent();
|
||||||
@ -65,7 +65,7 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
converter.datasRender = myRender;
|
converter.datasRender = myRender;
|
||||||
}
|
}
|
||||||
pagination = new Pagination(converter, { id: "pages" }, "Page à afficher :");
|
pagination = new Pagination(converter, { id: "pages" }, "Page à afficher :");
|
||||||
pagination.options = { displayElement: { id: "paginationOptions" }, values: [15, 30, 50, 100], name: "Nombre de lignes par page :" };
|
pagination.options = { displayElement: { id: "paginationOptions" }, values: [15, 30, 90, 150], name: "Nombre de lignes par page :" };
|
||||||
pagination.selectedValue = 15;
|
pagination.selectedValue = 15;
|
||||||
converter.pagination = pagination;
|
converter.pagination = pagination;
|
||||||
pagination.options2HTML();
|
pagination.options2HTML();
|
||||||
@ -77,7 +77,14 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
}
|
}
|
||||||
filtre1 = new Selector(converter, 0, { id: "filtre1" });
|
filtre1 = new Selector(converter, 0, { id: "filtre1" });
|
||||||
filtre1.filter2HTML();
|
filtre1.filter2HTML();
|
||||||
converter.datasFilters = [filtre1];
|
mySearch = new SearchEngine(converter, { id: "search" }, [2, 3]);
|
||||||
|
mySearch.label = "Qui cherche trouve ?";
|
||||||
|
mySearch.btnTxt = "Va chercher !";
|
||||||
|
mySearch.automaticSearch = true;
|
||||||
|
mySearch.nbCharsForSearch = 2;
|
||||||
|
mySearch.placeholder = "Tapes en NB, chef !";
|
||||||
|
mySearch.filter2HTML();
|
||||||
|
converter.datasFilters = [filtre1, mySearch];
|
||||||
converter.datasViewElt = { id: "datas" };
|
converter.datasViewElt = { id: "datas" };
|
||||||
converter.datasCounterElt = { id: "compteur" };
|
converter.datasCounterElt = { id: "compteur" };
|
||||||
converter.refreshView();
|
converter.refreshView();
|
||||||
@ -85,11 +92,11 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
|||||||
case 2:
|
case 2:
|
||||||
e_1 = _a.sent();
|
e_1 = _a.sent();
|
||||||
console.error(e_1);
|
console.error(e_1);
|
||||||
if (document.getElementById("datas") !== null)
|
document.getElementById("datas").innerHTML = "<div class=\"alert alert-warning\">D\u00E9sol\u00E9, mais un probl\u00E8me technique emp\u00EAche l'affichage des donn\u00E9es.</div>";
|
||||||
document.getElementById("datas").innerHTML = "<strong>Désolé, mais un problème technique empêche l'affichage des données.</strong>";
|
|
||||||
return [3, 3];
|
return [3, 3];
|
||||||
case 3: return [2];
|
case 3: return [2];
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}); };
|
}); };
|
||||||
|
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/src/demo/exampleWithJSON.ts\nUn bug ? Une suggestion ? => fabrice@le-fab-lab.com");
|
||||||
initialise();
|
initialise();
|
||||||
|
@ -46,18 +46,15 @@ var initialise = function () {
|
|||||||
var searchElt_1 = document.getElementById("search");
|
var searchElt_1 = document.getElementById("search");
|
||||||
if (dataDisplayElt_1 === null || dataDisplayOptionsElt_1 === null || myFile_1 === null || myForm === null || pagesElt_1 === null || paginationElt_1 === null || searchElt_1 === null)
|
if (dataDisplayElt_1 === null || dataDisplayOptionsElt_1 === null || myFile_1 === null || myForm === null || pagesElt_1 === null || paginationElt_1 === null || searchElt_1 === null)
|
||||||
throw new Error("Tous les éléments HTML nécessaires au fonctionnement n'ont pas été trouvés dans la page;");
|
throw new Error("Tous les éléments HTML nécessaires au fonctionnement n'ont pas été trouvés dans la page;");
|
||||||
var reInitialise_1 = function () {
|
var converter_1;
|
||||||
|
var myRender_1 = new Render();
|
||||||
|
myRender_1.settings.allBegining = "<table class='table-hover'><caption>Nombre de résultats : <span id='counter'></span></caption>";
|
||||||
|
myFile_1.addEventListener("change", function (e) {
|
||||||
dataDisplayElt_1.innerHTML = "";
|
dataDisplayElt_1.innerHTML = "";
|
||||||
dataDisplayOptionsElt_1.innerHTML = "";
|
dataDisplayOptionsElt_1.innerHTML = "";
|
||||||
pagesElt_1.innerHTML = "";
|
pagesElt_1.innerHTML = "";
|
||||||
paginationElt_1.innerHTML = "";
|
paginationElt_1.innerHTML = "";
|
||||||
searchElt_1.innerHTML = "";
|
searchElt_1.innerHTML = "";
|
||||||
};
|
|
||||||
var converter_1;
|
|
||||||
var myRender_1 = new Render();
|
|
||||||
myRender_1.settings.allBegining = "<table class='table-hover'><caption>Nombre de résultats : <span id='counter'></span></caption>";
|
|
||||||
myFile_1.addEventListener("change", function (e) {
|
|
||||||
reInitialise_1();
|
|
||||||
converter_1 = new FreeDatas2HTML("CSV");
|
converter_1 = new FreeDatas2HTML("CSV");
|
||||||
converter_1.datasRender = myRender_1;
|
converter_1.datasRender = myRender_1;
|
||||||
var selectedFiles = myFile_1.files;
|
var selectedFiles = myFile_1.files;
|
||||||
@ -103,7 +100,7 @@ var initialise = function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fields2Rend.length === 0)
|
if (fields2Rend.length === 0)
|
||||||
dataDisplayElt_1.innerHTML = "<p class='text-danger'>Vous n'avez s\u00E9lectionn\u00E9 aucun champ \u00E0 afficher !</p>";
|
dataDisplayElt_1.innerHTML = "<p class='text-danger'>Merci de s\u00E9lectionner les champs que vous souhaitez afficher !</p>";
|
||||||
else {
|
else {
|
||||||
converter_1.fields2Rend = fields2Rend;
|
converter_1.fields2Rend = fields2Rend;
|
||||||
converter_1.datasViewElt = { id: "datas" };
|
converter_1.datasViewElt = { id: "datas" };
|
||||||
@ -116,8 +113,8 @@ var initialise = function () {
|
|||||||
mySearch.filter2HTML();
|
mySearch.filter2HTML();
|
||||||
converter_1.datasFilters = [mySearch];
|
converter_1.datasFilters = [mySearch];
|
||||||
var pagination = new Pagination(converter_1, { id: "pages" }, "Page à afficher :");
|
var pagination = new Pagination(converter_1, { id: "pages" }, "Page à afficher :");
|
||||||
pagination.options = { displayElement: { id: "paginationOptions" }, values: [10, 20, 50, 500], name: "Choix de pagination :" };
|
pagination.options = { displayElement: { id: "paginationOptions" }, values: [10, 20, 50, 100, 500], name: "Choix de pagination :" };
|
||||||
pagination.selectedValue = 10;
|
pagination.selectedValue = 20;
|
||||||
converter_1.pagination = pagination;
|
converter_1.pagination = pagination;
|
||||||
pagination.options2HTML();
|
pagination.options2HTML();
|
||||||
converter_1.datasCounterElt = { id: "counter" };
|
converter_1.datasCounterElt = { id: "counter" };
|
||||||
@ -128,12 +125,20 @@ var initialise = function () {
|
|||||||
converter_1.datasSortingFields.push(sortingField);
|
converter_1.datasSortingFields.push(sortingField);
|
||||||
}
|
}
|
||||||
converter_1.refreshView();
|
converter_1.refreshView();
|
||||||
|
var here = window.location;
|
||||||
|
if (window.location.hash !== "") {
|
||||||
|
window.location.hash = "";
|
||||||
|
window.location.assign(here + "paginationOptions");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
window.location.assign(here + "#paginationOptions");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
document.getElementById("datas").innerHTML = "<strong>D\u00E9sol\u00E9, mais un probl\u00E8me impr\u00E9vu emp\u00EAche l'affichage des donn\u00E9es.</strong>";
|
document.getElementById("datas").innerHTML = "<div class=\"alert alert-warning\">D\u00E9sol\u00E9, mais un probl\u00E8me technique emp\u00EAche le fonctionnement normal de cette page.</div>";
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
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/src/demo/exampleWithUserFile.ts\nUn bug ? Une suggestion ? => fabrice@le-fab-lab.com");
|
||||||
initialise();
|
initialise();
|
||||||
|
Loading…
Reference in New Issue
Block a user