You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

187 lines
4.4 KiB

/**
* @extends Modifier
* @inheritdoc
*/
class ChainableModifier extends Modifier {
/**
* @type {Component}
*/
_component;
/**
*
* @param {Component} component
*/
constructor(component) {
super();
this._component = component;
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
fillMaxSize(widthFraction = 1, heightFraction = 1) {
return super.fillMaxSize(widthFraction, heightFraction);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
fillMaxWidth(fraction = 1) {
return super.fillMaxWidth(fraction);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
fillMaxHeight(fraction = 1) {
return super.fillMaxHeight(fraction);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
background(color) {
return super.background(color);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
color(color) {
return super.color(color);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
setStyleRule(key, value) {
return super.setStyleRule(key, value);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
addStyleRuleMap(rulemap) {
return super.addStyleRuleMap(rulemap);
}
/**
* @inheritdoc
* @override
* @returns {ChainableModifier}
*/
removeStyleRule(key) {
return super.removeStyleRule(key);
}
/**
* @inheritdoc
*
* In Case it is called from a ChainableModifier chain,
* the Return type would be DimensionsChainedModifier instead of DimensionsChain.
* @override
* @param {Dimensions | number | undefined} [modify=null] dimensions
* @returns {ChainableModifier | DimensionsChainedModifier}
*/
dimensions(modify = null) {
if (modify instanceof Dimensions || Number.isInteger(modify)) {
return super.dimensions(modify);
}
return new DimensionsChainedModifier(this);
}
/**
* @inheritdoc
* @override
* @param {Padding | number | undefined} [modify=null] modify as in modifiers
* @returns {ChainableModifier | PaddingChainedModifier}
*/
padding(modify = null) {
if (modify instanceof Padding || Number.isInteger(modify)) {
return super.padding(modify);
}
return new PaddingChainedModifier(this);
}
/**
* @inheritdoc
* @override
* @param {Margin | number | undefined} [modify=null] modify as in modifiers
* @returns {ChainableModifier | MarginChainedModifier}
*/
margin(modify = null) {
if (modify instanceof Margin || Number.isInteger(modify)) {
return super.margin(modify);
}
return new MarginChainedModifier(this);
}
/**
* @inheritdoc
*
* @override
* @param {Shape | number | undefined} [modify=null] modify
* @returns {ChainableModifier | ShapeChainedModifier}
*/
clip(modify = null) {
if (modify instanceof Shape || Number.isInteger(modify)) {
return super.clip(modify);
}
return new ShapeChainedModifier(this);
}
/**
*
* @inheritdoc
*
* @override
* @param {Border | number | undefined} [modify=null] modify
* @returns {ChainableModifier | BorderChainedModifier}
*/
border(modify = null) {
if (modify instanceof Border || Number.isInteger(modify)) {
return super.border(modify);
}
return new BorderChainedModifier(this);
}
/**
*
* @returns {Component}
*/
toComponent() {
return this._component.modifier(this);
}
/**
*
* @param {Component|Array<Component>} innerComponent
* @returns {Component} the parent Component
*/
childContext(innerComponent) {
return this._component
.modifier(this)
.childContext(innerComponent);
}
/**
* Calls chainChild() from Component (ChildbearerComponent)
* @see {ChildbearerComponent.chainChild}
* @returns {builder}
*/
chainChild() {
return this._component
.modifier(this)
.chainChild();
}
}