<ui-vboxhistogramm id="histo1" column-count="5" column-width="10px"></ui-vboxhistogramm> <ui-vboxhistogramm id="histo2" column-count="5" column-width="10px"></ui-vboxhistogramm> <ui-vboxhistogramm id="histo3" column-count="5" column-width="10px"></ui-vboxhistogramm>
divElement.style.background = "color";
// , . . class ExtendedStyleDeclaration { constructor(parentNode) { this._root = parentNode; } declare(declarationObject) { // } } // (element.xstyle.column), class VBoxHistogrammCulumnStyle extends ExtendedStyleDeclaration { constructor(parentNode) { super(parentNode); } set count(value) { // , xstyle saveProperty(this, "count", value); // (canvas svg, ) } get count() { return getLastProperty(this, "count"); } set width(value){} get width() {} } // (element.xstyle) class VBoxHistogrammStyle extends ExtendedStyleDeclaration { constructor(parentNode) { super(parentNode); this.column = new VBoxHistogrammCulumnStyle(this); } set width(value) { // , // ( ()), , . saveProperty(this, "width", value); // , CSS-. // , , width , - if(condition) { this._root.style.width = this.width; } else { this._root.style.width = " "; } } get width() { return getLastProperty(this, "width"); } } // class VBoxHistogrammProto extends HTMLElement { createdCallback() { setGroupsToQueue(this); // group, declareGroup this.xstyle = new VBoxHistogrammStyle(this); // } }
let histo1 = document.getElementById("histo1"); histo1.xstyle.width = "100px"; //or histo1.xstyle.declare( { width : "100px", column: { count: 5, width: "10px" } }); histo1.xstyle.column.count = 15; // 15 . , . count ( CSS-). //or histo1.xstyle.column.declare( { count: 5, width: "10px" });
<ui-vboxhistogramm id="histo1" group="histogroup1"></ui-vboxhistogramm> <ui-vboxhistogramm id="histo2" group="histogroup1"></ui-vboxhistogramm> <ui-vboxhistogramm id="histo3" group="histogroup1 histogroup2"></ui-vboxhistogramm>
// declareGroup groups, let groups = declareGroup( { histogroup1: { width: "100px", column: { count: 5, width: "10px" } }, histogroup2:{} }); // // histogroup1 histo5 let histo5 = document.getElementById("histo5"); histo5.groupList.add(groups.histogroup1); // groups histo6 let histo6 = document.getElementById("histo6"); histo6.xstyle.declare( { group: groups });
Source: https://habr.com/ru/post/273367/
All Articles