Skip to content
This repository was archived by the owner on Mar 13, 2018. It is now read-only.

Commit 0de21ba

Browse files
committed
polymer-flex-layout: clean up container in leftView; add more docs
1 parent 88a14ed commit 0de21ba

1 file changed

Lines changed: 29 additions & 9 deletions

File tree

polymer-flex-layout/polymer-flex-layout.html

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@
7878
/**
7979
* If true, polymer-flex-layout is the flex container.
8080
*
81+
* Example:
82+
*
83+
* <polymer-flex-layout isContainer>
84+
* <div>Left</div>
85+
* <div flex>Main</div>
86+
* <div>Right</div>
87+
* </polymer-flex-layout>
88+
*
89+
* ---------------------------------
90+
* |-------------------------------|
91+
* ||Left| Main |Right||
92+
* |-------------------------------|
93+
* ---------------------------------
94+
*
8195
* @attribute isContainer
8296
* @type boolean
8397
* @default false
@@ -93,20 +107,26 @@
93107
Polymer('polymer-flex-layout', {
94108
vertical: false,
95109
isContainer: false,
110+
layoutContainer: null,
96111
enteredView: function() {
97112
this.installControllerStyles();
98113
this.layoutContainer = this.isContainer ?
99114
this : (this.parentNode.host || this.parentNode);
100-
if (!this.isContainer) {
101-
this.style.display = 'none';
115+
this.verticalChanged();
116+
this.alignChanged();
117+
this.justifyChanged();
118+
},
119+
leftView: function() {
120+
this.layoutContainer = null;
121+
},
122+
layoutContainerChanged: function(old) {
123+
if (old) {
124+
old.classList.remove('flexbox');
125+
}
126+
this.style.display = this.layoutContainer === this ? '' : 'none';
127+
if (this.layoutContainer) {
128+
this.layoutContainer.classList.add('flexbox');
102129
}
103-
this.async(function() {
104-
this.layoutContainer && this.layoutContainer.classList.add('flexbox');
105-
this.verticalChanged();
106-
this.alignChanged();
107-
this.justifyChanged();
108-
});
109-
110130
},
111131
switchContainerClass: function(prefix, old, name) {
112132
if (this.layoutContainer && name) {

0 commit comments

Comments
 (0)