Browse Source

MINOR,REFA,FEAT: added children and store variables

master
chris 4 days ago
parent
commit
df8ceb0bd8
  1. 28
      src/componentAncestry/addStyleAndFunctions.js
  2. 5
      src/componentAncestry/wrapperComponent.js

28
src/componentAncestry/addStyleAndFunctions.js

@ -14,10 +14,18 @@ class StyleAndScriptStoringComponent extends ModifiableComponent {
* @type {ExtStorage} * @type {ExtStorage}
*/ */
_styleClassesExtStore _styleClassesExtStore
/**
* @type {boolean}
*/
_isClassESDefault;
/** /**
* @type {ExtStorage} * @type {ExtStorage}
*/ */
_stylesExtStore; _stylesExtStore;
/**
* @type {boolean}
*/
_isStyleESDefault;
/** /**
* @type {Array<SStoreDefinition>} * @type {Array<SStoreDefinition>}
*/ */
@ -26,25 +34,40 @@ class StyleAndScriptStoringComponent extends ModifiableComponent {
* @type {ExtStorage} * @type {ExtStorage}
*/ */
_functionsExtStore; _functionsExtStore;
/**
* @type {boolean}
*/
_isFunESDefault;
/** /**
* @type {Array<SStoreDefinition>} * @type {Array<SStoreDefinition>}
*/ */
_functions; _functions;
/**
*
* @param {HTMLElement} element
* @param {Map<string,string>} attr
*/
constructor(element, attr = {}) { constructor(element, attr = {}) {
super(element, attr); super(element, attr);
this._styleClassesExtStore = ExtStoreType.CENTRALIZED_DOC_HEAD this._styleClassesExtStore = ExtStoreType.CENTRALIZED_DOC_HEAD
.setOverwriteBehaviour(OverwriteBehaviour.REPLACE); .setOverwriteBehaviour(OverwriteBehaviour.REPLACE);
this._isClassESDefault = true;
this._stylesExtStore = ExtStoreType.INTERNALIZED_WITHIN this._stylesExtStore = ExtStoreType.INTERNALIZED_WITHIN
.setOverwriteBehaviour(OverwriteBehaviour.REPLACE); .setOverwriteBehaviour(OverwriteBehaviour.REPLACE);
this._isStyleESDefault = true;
this._styles = []; this._styles = [];
this._functionsExtStore = ExtStoreType.CENTRALIZED_DOC_HEAD this._functionsExtStore = ExtStoreType.CENTRALIZED_DOC_HEAD
.setOverwriteBehaviour(OverwriteBehaviour.REPLACE); .setOverwriteBehaviour(OverwriteBehaviour.REPLACE);
this._isFunESDefault = true;
this._functions = []; this._functions = [];
} }
@ -55,7 +78,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent {
* @todo: Differentiate between directions (horizontal, vertiacl) * @todo: Differentiate between directions (horizontal, vertiacl)
* @override * @override
* @inheritdoc * @inheritdoc
* Sets the alignment (modifications) for this element or more specific for its children. * Sets the alignment (modifications) for this element.
* @param {Alignment} alignment * @param {Alignment} alignment
* @returns {Component} this component object * @returns {Component} this component object
*/ */
@ -80,6 +103,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent {
* @override * @override
* @inheritdoc * @inheritdoc
* Sets the arrangement (modifications) for this element or more specific for its children. * Sets the arrangement (modifications) for this element or more specific for its children.
* Therefore it defines the space distribution to the children.
* @param {Arrangement} arrangement * @param {Arrangement} arrangement
* @returns {Component} this component object * @returns {Component} this component object
*/ */
@ -110,6 +134,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent {
} else { } else {
this._stylesExtStore.OverwriteBehaviour(extStore); this._stylesExtStore.OverwriteBehaviour(extStore);
} }
this._isStyleESDefault = false;
} else { } else {
console.log("(Style)ExtStore was empty, did nothing"); console.log("(Style)ExtStore was empty, did nothing");
} }
@ -133,6 +158,7 @@ class StyleAndScriptStoringComponent extends ModifiableComponent {
} else { } else {
this._stylesExtStore.OverwriteBehaviour(extStore); this._stylesExtStore.OverwriteBehaviour(extStore);
} }
this._isFunESDefault = false;
} else { } else {
console.log("(Function)ExtStore was empty, did nothing"); console.log("(Function)ExtStore was empty, did nothing");
} }

5
src/componentAncestry/wrapperComponent.js

@ -58,6 +58,7 @@ class ElementWrapper {
/** /**
* (Wrapper) Sets the innerText of the element * (Wrapper) Sets the innerText of the element
* @todo add Alignment of text functionality
* @param {string} text * @param {string} text
* @returns {Component} this component object * @returns {Component} this component object
*/ */
@ -192,9 +193,13 @@ class ChildbearerComponent extends ElementWrapper {
for (let i = 0; i < component.length; i++) { for (let i = 0; i < component.length; i++) {
this.childContext(component[i]); this.childContext(component[i]);
} }
} else {
if (!(component instanceof Component)) {
this.childContext(component.toComponent())
} else { } else {
this._children.push(component); this._children.push(component);
} }
}
return this; return this;
} }
} }

Loading…
Cancel
Save