HM-71. Доработки таблицы логов. Универсальной таблице добавлена возможность переопределять рендер строк и заголовков (#31)
This commit is contained in:
@ -26,15 +26,25 @@ class Component extends EmitService {
|
||||
|
||||
constructor (mainNodeSelector, parentNode) {
|
||||
super();
|
||||
const content = document.querySelector(mainNodeSelector).content;
|
||||
if (content.children.length > 1) {
|
||||
const message = '<template> должен содержать только один элемент children';
|
||||
throw new Error(message);
|
||||
if (!mainNodeSelector && !parentNode) {
|
||||
throw new Error('Компонент должен содержать хотябы селектор или родительский Node');
|
||||
}
|
||||
this.mainNode = content.firstElementChild.cloneNode(true);
|
||||
if (parentNode) {
|
||||
parentNode.appendChild(this.mainNode);
|
||||
|
||||
if (mainNodeSelector) {
|
||||
const content = document.querySelector(mainNodeSelector).content;
|
||||
if (content.children.length > 1) {
|
||||
const message = '<template> должен содержать только один элемент children';
|
||||
throw new Error(message);
|
||||
}
|
||||
this.mainNode = content.firstElementChild.cloneNode(true);
|
||||
|
||||
if (parentNode) {
|
||||
parentNode.appendChild(this.mainNode);
|
||||
}
|
||||
} else {
|
||||
this.mainNode = parentNode;
|
||||
}
|
||||
|
||||
this._listeners = [];
|
||||
this._events = {};
|
||||
this._isAlive = true;
|
||||
|
||||
Reference in New Issue
Block a user