Browse Source

MINOR,FEAT,REFA,DOC,LINT:

Update Component.js and FlexContainerComponent.js
dev-main
Default User 1 month ago
committed by chris
parent
commit
3e04d6c6c2
  1. 17
      src/component/Component.js
  2. 12
      src/component/FlexContainerComponent.js

17
src/component/Component.js

@ -124,6 +124,23 @@ class Component extends StyleAndScriptStoringComponent {
return this; return this;
} }
/**
* Since the "hidden" method call was quite often called as being conditional,
* and to resolve that it needed to be wrapped into an apply (and if condition within that) call.
* This method is purely convinience as it reduces unnecessary code line.
* @experimental
* @convenience
* @param {boolean} [condition=false]
* @param {boolean} [untilFound=false]
* @returns {Component}
*/
hiddenByCondition(condition = false, untilFound = false) {
if (condition) {
return this.hidden(untilFound);
}
return this;
}
/** /**
* Subscribes element under higher_compel group * Subscribes element under higher_compel group
* sets corr. variable true * sets corr. variable true

12
src/component/FlexContainerComponent.js

@ -78,10 +78,9 @@ class FlexContainerComponent extends Component {
/** /**
* *
* @param {number} [recessFraction=0.0] recessFraction a fraction/percentage of the recess * @param {number} [recessFraction=0.0] recessFraction a fraction/percentage (<1.0) of the recess
* that should be left out before distributing the remaining space. * that should be left out before distributing the remaining space.
* @param {number} [gapPerChild=1] gapPerChild the gap per child, therefore inbetween children * @param {number} [gapPerChild=1] gapPerChild the gap per child, therefore the recess between children
* that shouldn't be distributed to the children
*/ */
_distributingSpacing(recessFraction = 0.0, gapPerChild = 1) { _distributingSpacing(recessFraction = 0.0, gapPerChild = 1) {
if (this._children && this._children.length > 1) { if (this._children && this._children.length > 1) {
@ -110,13 +109,14 @@ class FlexContainerComponent extends Component {
* Distributes the spacing of the childrens evengly, * Distributes the spacing of the childrens evengly,
* according to the flexdirection of this component. * according to the flexdirection of this component.
* By default this will be executed imediately when called. * By default this will be executed imediately when called.
* The spacing is distributed by:
* 100 - 100 * recessFraction - (children) * gapPerChild
* *
* @param {boolean} [rightNow=true] if set to false it will set properties accordingly * @param {boolean} [rightNow=true] if set to false it will set properties accordingly
* so that the distribution will be executed on generate * so that the distribution will be executed on generate
* @param {number} [recessFraction=0.0] recessFraction a fraction/percentage of the recess * @param {number} [recessFraction=0.0] recessFraction a fraction/percentage (<1.0) of the recess
* that should be left out before distributing the remaining space. * that should be left out before distributing the remaining space.
* @param {number} [gapPerChild=1] gapPerChild the gap per child, therefore inbetween children * @param {number} [gapPerChild=1] gapPerChild the gap per child, therefore the recess between children
* that shouldn't be distributed to the children
* @returns {FlexContainerComponent} * @returns {FlexContainerComponent}
*/ */
distibuteSpacingEvenly(rightNow = true, recessFraction = 0.0, gapPerChild = 1) { distibuteSpacingEvenly(rightNow = true, recessFraction = 0.0, gapPerChild = 1) {

Loading…
Cancel
Save