Browse Source

REFA,MINOR,FEAT: Added more logic depending on higher-component.

Changed hidden setup
master
chris 2 weeks ago
parent
commit
d8170fad15
  1. 22
      src/component.js

22
src/component.js

@ -112,12 +112,15 @@ class Component extends StyleAndScriptStoringComponent {
* @returns {Component}
*/
hidden(untilFound = false) {
Page.registerStyling(".compel-mech-hidden", { "hidden": "hidden" });
let styleClass = "compel-mech-hidden";
let hid = "hidden";
Page.registerStyling("." + styleClass, { [hid]: hid });
this.addStyleClass(styleClass);
this._modifier.removeStyleRule("display");
this.setAttribute(
"hidden",
(untilFound ? "until-found" : "hidden")
hid,
(untilFound ? "until-found" : hid)
);
this.subscribeOnGenerate(CommonCompelGroups.HIDDEN_ON_START);
@ -135,9 +138,20 @@ class Component extends StyleAndScriptStoringComponent {
isHigherComponent() {
this.subscribeOnGenerate(CommonCompelGroups.HIGHER_COMPEL);
this.#isCompel = true;
this.addStyleClass("compel-higher");
return this.setAttribute("data-compel-isHCompel", "true")
}
/**
*
* @returns {string}
*/
getHigherCompelSelector(){
return this._element
.closest('[data-compel-isHCompel="true"].compel-higher')
.getAttribute("data-autocompel");
}
/**
* Collects the given List in the _toRegister attribute.
* When generate() is called,
@ -281,6 +295,8 @@ class Component extends StyleAndScriptStoringComponent {
return this;
}
/**
* Defines how a child Component is to be appended.
* @param {Component} component the child component to add it.

Loading…
Cancel
Save