|
@ -11,11 +11,21 @@ const builder = { |
|
|
components: { |
|
|
components: { |
|
|
parent: {}, |
|
|
parent: {}, |
|
|
current: {}, |
|
|
current: {}, |
|
|
previous: {}, |
|
|
previous: null, |
|
|
next: {}, |
|
|
next: {}, |
|
|
openedChain: {} |
|
|
openedChain: {} |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Convenience function for the ChildbearerComponent.chainChild() method. |
|
|
|
|
|
* @param {Component} callComponent |
|
|
|
|
|
* @returns {builder} |
|
|
|
|
|
*/ |
|
|
|
|
|
_nextComponent(callComponent) { |
|
|
|
|
|
this.components.previous = callComponent; |
|
|
|
|
|
return this; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* @property {Function(Component|*): Component} |
|
|
* @property {Function(Component|*): Component} |
|
|
*/ |
|
|
*/ |
|
@ -139,6 +149,10 @@ const builder = { |
|
|
if (modifier) { |
|
|
if (modifier) { |
|
|
return compel.modifier(modifier); |
|
|
return compel.modifier(modifier); |
|
|
} |
|
|
} |
|
|
|
|
|
if (this.components.previous) { |
|
|
|
|
|
compel._parentComponent = this.components.previous; |
|
|
|
|
|
this.components.previous = null; |
|
|
|
|
|
} |
|
|
return compel; |
|
|
return compel; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
@ -171,12 +185,19 @@ const builder = { |
|
|
* @returns {InputComponent} |
|
|
* @returns {InputComponent} |
|
|
*/ |
|
|
*/ |
|
|
input: function (type, attr = {}, modifier = null) { |
|
|
input: function (type, attr = {}, modifier = null) { |
|
|
return new InputComponent( |
|
|
let comp = new InputComponent( |
|
|
document.createElement("input"), |
|
|
document.createElement("input"), |
|
|
Object.assign({ "type": type }, attr), |
|
|
Object.assign({ "type": type }, attr), |
|
|
modifier |
|
|
modifier |
|
|
) |
|
|
) |
|
|
.addStyleClass(`el-input`); |
|
|
.addStyleClass(`el-input`); |
|
|
|
|
|
|
|
|
|
|
|
if (this.components.previous) { |
|
|
|
|
|
comp._parentComponent = this.components.previous; |
|
|
|
|
|
this.components.previous = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return comp; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -298,12 +319,19 @@ const builder = { |
|
|
* @returns {InputComponent} |
|
|
* @returns {InputComponent} |
|
|
*/ |
|
|
*/ |
|
|
textarea: function (attr = {}, modifier = null) { |
|
|
textarea: function (attr = {}, modifier = null) { |
|
|
return new InputComponent( |
|
|
let comp = new InputComponent( |
|
|
document.createElement("textarea"), |
|
|
document.createElement("textarea"), |
|
|
attr, |
|
|
attr, |
|
|
modifier |
|
|
modifier |
|
|
) |
|
|
) |
|
|
.addStyleClass(`el-textarea`); |
|
|
.addStyleClass(`el-textarea`); |
|
|
|
|
|
|
|
|
|
|
|
if (this.components.previous) { |
|
|
|
|
|
comp._parentComponent = this.components.previous; |
|
|
|
|
|
this.components.previous = null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return comp; |
|
|
}, |
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -420,7 +448,14 @@ const builder = { |
|
|
* @param {Modifier} modifier |
|
|
* @param {Modifier} modifier |
|
|
* @returns {Row} |
|
|
* @returns {Row} |
|
|
*/ |
|
|
*/ |
|
|
row: function (attr = {}, modifier = null) { return new Row(attr, modifier) }, |
|
|
row: function (attr = {}, modifier = null) { |
|
|
|
|
|
let comp = new Row(attr, modifier); |
|
|
|
|
|
if (this.components.previous) { |
|
|
|
|
|
comp._parentComponent = this.components.previous; |
|
|
|
|
|
this.components.previous = null; |
|
|
|
|
|
} |
|
|
|
|
|
return comp; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
@ -429,7 +464,14 @@ const builder = { |
|
|
* @param {Modifier} modifier |
|
|
* @param {Modifier} modifier |
|
|
* @returns {Column} |
|
|
* @returns {Column} |
|
|
*/ |
|
|
*/ |
|
|
column: function (attr = {}, modifier = null) { return new Column(attr, modifier) }, |
|
|
column: function (attr = {}, modifier = null) { |
|
|
|
|
|
let comp = new Column(attr, modifier); |
|
|
|
|
|
if (this.components.previous) { |
|
|
|
|
|
comp._parentComponent = this.components.previous; |
|
|
|
|
|
this.components.previous = null; |
|
|
|
|
|
} |
|
|
|
|
|
return comp; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
@ -437,7 +479,14 @@ const builder = { |
|
|
* @param {Modifier} modifier |
|
|
* @param {Modifier} modifier |
|
|
* @returns {FlexContainerComponent} |
|
|
* @returns {FlexContainerComponent} |
|
|
*/ |
|
|
*/ |
|
|
section: function (attr = {}, modifier = null) { return new FlexContainerComponent(attr, modifier, "section") }, |
|
|
section: function (attr = {}, modifier = null) { |
|
|
|
|
|
let comp = new FlexContainerComponent(attr, modifier, "section"); |
|
|
|
|
|
if (this.components.previous) { |
|
|
|
|
|
comp._parentComponent = this.components.previous; |
|
|
|
|
|
this.components.previous = null; |
|
|
|
|
|
} |
|
|
|
|
|
return comp; |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* |
|
|
* |
|
|