Nouvelle compilation
This commit is contained in:
parent
c9700978bc
commit
692ae9fa86
File diff suppressed because one or more lines are too long
@ -68,31 +68,21 @@ var initialise = function () { return __awaiter(void 0, void 0, void 0, function
|
||||
return [4, converter.run()];
|
||||
case 2:
|
||||
_a.sent();
|
||||
filtre1 = new Selector(converter);
|
||||
filtre1.datasViewElt = { id: "filtre1" };
|
||||
filtre1.datasFieldNb = 3;
|
||||
filtre1 = new Selector(converter, 3, { id: "filtre1" });
|
||||
filtre1.selector2HTML();
|
||||
filtre2 = new Selector(converter);
|
||||
filtre2.datasViewElt = { id: "filtre2" };
|
||||
filtre2.datasFieldNb = 4;
|
||||
filtre2 = new Selector(converter, 4, { id: "filtre2" });
|
||||
filtre2.selector2HTML();
|
||||
filtre3 = new Selector(converter);
|
||||
filtre3.datasViewElt = { id: "filtre3" };
|
||||
filtre3.datasFieldNb = 5;
|
||||
filtre3 = new Selector(converter, 5, { id: "filtre3" });
|
||||
filtre3.separator = ",";
|
||||
filtre3.selector2HTML();
|
||||
converter.datasSelectors = [filtre1, filtre2, filtre3];
|
||||
sortingField1 = new SortingField(converter);
|
||||
sortingField1.datasFieldNb = 0;
|
||||
sortingField1 = new SortingField(converter, 0);
|
||||
sortingField1.field2HTML();
|
||||
sortingField2 = new SortingField(converter);
|
||||
sortingField2.datasFieldNb = 1;
|
||||
sortingField2 = new SortingField(converter, 1);
|
||||
sortingField2.field2HTML();
|
||||
sortingField3 = new SortingField(converter);
|
||||
sortingField3.datasFieldNb = 2;
|
||||
sortingField3 = new SortingField(converter, 2);
|
||||
sortingField3.field2HTML();
|
||||
sortingField4 = new SortingField(converter);
|
||||
sortingField4.datasFieldNb = 4;
|
||||
sortingField4 = new SortingField(converter, 4);
|
||||
sortingField4.field2HTML();
|
||||
converter.datasSortingFields = [sortingField1, sortingField2, sortingField3, sortingField4];
|
||||
return [3, 4];
|
||||
|
@ -42,23 +42,32 @@ var FreeDatas2HTML = (function () {
|
||||
this._datasViewElt = { id: "", eltDOM: undefined };
|
||||
this.datasHTML = "";
|
||||
this._datasSourceUrl = "";
|
||||
this._datasSortingFunctions = [];
|
||||
this.parseMetas = undefined;
|
||||
this.parseDatas = [];
|
||||
this.parseErrors = [];
|
||||
this.stopIfParseErrors = false;
|
||||
this._datasSortingFunctions = [];
|
||||
this.datasSelectors = [];
|
||||
this.datasSortingFields = [];
|
||||
}
|
||||
FreeDatas2HTML.checkInDOMById = function (checkedElt) {
|
||||
var searchEltInDOM = document.getElementById(checkedElt.id);
|
||||
if (searchEltInDOM === null)
|
||||
throw new Error(errors.converterElementNotFound + checkedElt.id);
|
||||
else {
|
||||
checkedElt.eltDOM = searchEltInDOM;
|
||||
return checkedElt;
|
||||
}
|
||||
};
|
||||
FreeDatas2HTML.prototype.checkFieldExist = function (nb) {
|
||||
if (this.parseMetas === undefined || this.parseMetas.fields === undefined || this.parseMetas.fields[nb] === undefined)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
};
|
||||
Object.defineProperty(FreeDatas2HTML.prototype, "datasViewElt", {
|
||||
set: function (elt) {
|
||||
var checkContainerExist = document.getElementById(elt.id);
|
||||
if (checkContainerExist === null)
|
||||
throw new Error(errors.elementNotFound + elt.id);
|
||||
else {
|
||||
this._datasViewElt.id = elt.id;
|
||||
this._datasViewElt.eltDOM = checkContainerExist;
|
||||
}
|
||||
this._datasViewElt = FreeDatas2HTML.checkInDOMById(elt);
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
@ -66,7 +75,7 @@ var FreeDatas2HTML = (function () {
|
||||
Object.defineProperty(FreeDatas2HTML.prototype, "datasSourceUrl", {
|
||||
set: function (url) {
|
||||
if (url.trim().length === 0)
|
||||
throw new Error(errors.needUrl);
|
||||
throw new Error(errors.parserNeedUrl);
|
||||
else
|
||||
this._datasSourceUrl = url.trim();
|
||||
},
|
||||
@ -77,7 +86,10 @@ var FreeDatas2HTML = (function () {
|
||||
set: function (SortingFunctions) {
|
||||
this._datasSortingFunctions = [];
|
||||
for (var i = 0; i < SortingFunctions.length; i++) {
|
||||
this._datasSortingFunctions.push(SortingFunctions[i]);
|
||||
if (!this.checkFieldExist(SortingFunctions[i].datasFieldNb))
|
||||
throw new Error(errors.converterFieldNotFound);
|
||||
else
|
||||
this._datasSortingFunctions.push(SortingFunctions[i]);
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
@ -120,7 +132,7 @@ var FreeDatas2HTML = (function () {
|
||||
});
|
||||
}
|
||||
else
|
||||
reject(new Error(errors.needUrl));
|
||||
reject(new Error(errors.parserNeedUrl));
|
||||
})];
|
||||
});
|
||||
});
|
||||
@ -131,14 +143,14 @@ var FreeDatas2HTML = (function () {
|
||||
switch (_a.label) {
|
||||
case 0:
|
||||
if (this._datasViewElt.eltDOM === undefined)
|
||||
throw new Error(errors.needDatasElt);
|
||||
throw new Error(errors.converterNeedDatasElt);
|
||||
if (this._datasSourceUrl === "")
|
||||
throw new Error(errors.needUrl);
|
||||
throw new Error(errors.parserNeedUrl);
|
||||
return [4, this.parse()];
|
||||
case 1:
|
||||
_a.sent();
|
||||
if (this.parseDatas.length === 0 || this.parseMetas.fields === undefined)
|
||||
throw new Error(errors.datasNotFound);
|
||||
throw new Error(errors.parserDatasNotFound);
|
||||
else if (this.stopIfParseErrors && this.parseErrors.length !== 0)
|
||||
console.error(this.parseErrors);
|
||||
else {
|
||||
@ -152,7 +164,7 @@ var FreeDatas2HTML = (function () {
|
||||
};
|
||||
FreeDatas2HTML.prototype.refreshView = function () {
|
||||
if (this.parseMetas === undefined || this.parseMetas.fields === undefined || this._datasViewElt.eltDOM === undefined)
|
||||
throw new Error(errors.refreshFail);
|
||||
throw new Error(errors.converterRefreshFail);
|
||||
this.datasHTML = this.createDatasHTML(this.parseMetas.fields, this.parseDatas);
|
||||
this._datasViewElt.eltDOM.innerHTML = this.datasHTML;
|
||||
for (var i in this.datasSortingFields) {
|
||||
|
@ -1,17 +1,13 @@
|
||||
var errors = require("./errors.js");
|
||||
import { FreeDatas2HTML } from "./freeDatas2HTML";
|
||||
var Pagination = (function () {
|
||||
function Pagination(converter, pagesElt, pagesName) {
|
||||
if (pagesName === void 0) { pagesName = "Pages"; }
|
||||
if (converter.parseMetas === undefined || converter.parseMetas.fields === undefined)
|
||||
throw new Error(errors.paginationNeedDatas);
|
||||
else {
|
||||
var checkContainerExist = document.getElementById(pagesElt.id);
|
||||
if (checkContainerExist === null)
|
||||
throw new Error(errors.elementNotFound + pagesElt.id);
|
||||
else {
|
||||
this._converter = converter;
|
||||
this._pages = { displayElement: { id: pagesElt.id, eltDOM: checkContainerExist }, name: pagesName };
|
||||
}
|
||||
this._pages = { displayElement: FreeDatas2HTML.checkInDOMById(pagesElt), name: pagesName };
|
||||
this._converter = converter;
|
||||
}
|
||||
}
|
||||
Pagination.isPositiveInteger = function (nb) {
|
||||
@ -25,7 +21,7 @@ var Pagination = (function () {
|
||||
if (value === undefined || !Pagination.isPositiveInteger(value))
|
||||
throw new Error(errors.needPositiveInteger);
|
||||
if (this.options !== undefined && this.options.values.indexOf(value) === -1)
|
||||
throw new Error(errors.needPaginationByDefaultBeInOptions);
|
||||
throw new Error(errors.paginationNeedByfaultValueBeInOptions);
|
||||
this._selectedValue = value;
|
||||
},
|
||||
enumerable: true,
|
||||
@ -37,17 +33,15 @@ var Pagination = (function () {
|
||||
},
|
||||
set: function (options) {
|
||||
if (options !== undefined) {
|
||||
var checkContainerExist = document.getElementById(options.displayElement.id);
|
||||
if (checkContainerExist === null)
|
||||
throw new Error(errors.elementNotFound + options.displayElement.id);
|
||||
else
|
||||
options.displayElement.eltDOM = checkContainerExist;
|
||||
options.displayElement = FreeDatas2HTML.checkInDOMById(options.displayElement);
|
||||
if (options.values.length === 0)
|
||||
throw new Error(errors.needPaginationOptionsValues);
|
||||
throw new Error(errors.paginationNeedOptionsValues);
|
||||
for (var i in options.values) {
|
||||
if (!Pagination.isPositiveInteger(options.values[i]))
|
||||
throw new Error(errors.needPositiveInteger);
|
||||
}
|
||||
if (this.selectedValue !== undefined && options.values.indexOf(this.selectedValue) === -1)
|
||||
throw new Error(errors.paginationNeedByfaultValueBeInOptions);
|
||||
options.name = (options.name === undefined) ? "Pagination" : options.name;
|
||||
this._options = options;
|
||||
}
|
||||
|
@ -1,28 +1,38 @@
|
||||
var compare = require('natural-orderby').compare;
|
||||
var errors = require("./errors.js");
|
||||
import { FreeDatas2HTML } from "./freeDatas2HTML";
|
||||
var Selector = (function () {
|
||||
function Selector(converter) {
|
||||
function Selector(converter, datasFieldNb, elt) {
|
||||
this._datasViewElt = { id: "", eltDOM: undefined };
|
||||
this.name = "";
|
||||
this.values = [];
|
||||
if (converter.parseMetas === undefined || converter.parseMetas.fields === undefined || converter.parseDatas.length === 0)
|
||||
throw new Error(errors.selectorNeedDatas);
|
||||
else
|
||||
else if (!converter.checkFieldExist(Number(datasFieldNb)))
|
||||
throw new Error(errors.selectorFieldNotFound);
|
||||
else {
|
||||
this._datasViewElt = FreeDatas2HTML.checkInDOMById(elt);
|
||||
this._converter = converter;
|
||||
this._datasFieldNb = datasFieldNb;
|
||||
}
|
||||
}
|
||||
Object.defineProperty(Selector.prototype, "separator", {
|
||||
get: function () {
|
||||
return this._separator;
|
||||
},
|
||||
set: function (separator) {
|
||||
if (separator === "")
|
||||
this._separator = undefined;
|
||||
else
|
||||
this._separator = separator;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Selector.prototype, "datasViewElt", {
|
||||
get: function () {
|
||||
return this._datasViewElt;
|
||||
},
|
||||
set: function (elt) {
|
||||
var checkContainerExist = document.getElementById(elt.id);
|
||||
if (checkContainerExist === null)
|
||||
throw new Error(errors.elementNotFound + elt.id);
|
||||
else {
|
||||
this._datasViewElt.id = elt.id;
|
||||
this._datasViewElt.eltDOM = checkContainerExist;
|
||||
}
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
@ -30,22 +40,6 @@ var Selector = (function () {
|
||||
get: function () {
|
||||
return this._datasFieldNb;
|
||||
},
|
||||
set: function (datasFieldNb) {
|
||||
if (datasFieldNb !== undefined && this._converter.parseMetas.fields[datasFieldNb] === undefined)
|
||||
throw new Error(errors.selectorFieldNotFound);
|
||||
else
|
||||
this._datasFieldNb = datasFieldNb;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(Selector.prototype, "separator", {
|
||||
set: function (separator) {
|
||||
if (separator === "")
|
||||
this._separator = undefined;
|
||||
else
|
||||
this._separator = separator;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
@ -1,11 +1,13 @@
|
||||
var compare = require('natural-orderby').compare;
|
||||
var errors = require("./errors.js");
|
||||
var SortingField = (function () {
|
||||
function SortingField(converter, fieldsDOMSelector) {
|
||||
function SortingField(converter, datasFieldNb, fieldsDOMSelector) {
|
||||
if (fieldsDOMSelector === void 0) { fieldsDOMSelector = "th"; }
|
||||
this._order = undefined;
|
||||
if (converter.parseMetas === undefined || converter.parseMetas.fields === undefined)
|
||||
throw new Error(errors.sortingFieldNeedDatas);
|
||||
else if (!converter.checkFieldExist(Number(datasFieldNb)))
|
||||
throw new Error(errors.sortingFieldFieldNotFound);
|
||||
else {
|
||||
var fields = document.querySelectorAll(fieldsDOMSelector);
|
||||
if (fields === undefined)
|
||||
@ -14,20 +16,22 @@ var SortingField = (function () {
|
||||
throw new Error(errors.sortingFieldsNbFail);
|
||||
else {
|
||||
this._converter = converter;
|
||||
this._datasFieldNb = datasFieldNb;
|
||||
this._fieldsDOMSelector = fieldsDOMSelector;
|
||||
}
|
||||
}
|
||||
}
|
||||
Object.defineProperty(SortingField.prototype, "fieldsDOMSelector", {
|
||||
get: function () {
|
||||
return this._fieldsDOMSelector;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
Object.defineProperty(SortingField.prototype, "datasFieldNb", {
|
||||
get: function () {
|
||||
return this._datasFieldNb;
|
||||
},
|
||||
set: function (datasFieldNb) {
|
||||
if (datasFieldNb !== undefined && this._converter.parseMetas.fields[datasFieldNb] === undefined)
|
||||
throw new Error(errors.sortingFieldFieldNotFound);
|
||||
else
|
||||
this._datasFieldNb = datasFieldNb;
|
||||
},
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user