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