@nys-cui/cui-section 0.2.7 → 0.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/section.js +16 -0
- package/src/section.scss +1 -0
package/package.json
CHANGED
package/src/section.js
CHANGED
|
@@ -97,6 +97,8 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
97
97
|
dContainer.style.height = sectionHeight + 'px';
|
|
98
98
|
dContainer.style.overflow = "hidden";
|
|
99
99
|
|
|
100
|
+
this.sdSection.style.removeProperty('height');
|
|
101
|
+
|
|
100
102
|
// when the next css transition finishes (which should be the one we just triggered)
|
|
101
103
|
dContainer.addEventListener('transitionend', transitionEnd, true);
|
|
102
104
|
|
|
@@ -126,6 +128,15 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
126
128
|
var dContainerTransition = dContainer.style.transition;
|
|
127
129
|
dContainer.style.transition = '';
|
|
128
130
|
|
|
131
|
+
let sdSection = this.sdSection;
|
|
132
|
+
|
|
133
|
+
//sdSection.style.transition = '';
|
|
134
|
+
let header = sdSection.querySelector("header");
|
|
135
|
+
let headerStyle = getComputedStyle(header);
|
|
136
|
+
let sectionStyle = getComputedStyle(sdSection);
|
|
137
|
+
let collapseSectionHeight = header.offsetHeight + parseInt(headerStyle.marginBottom) + parseInt(headerStyle.marginTop);
|
|
138
|
+
collapseSectionHeight += parseInt(sectionStyle.borderBottom) + parseInt(sectionStyle.borderTop);
|
|
139
|
+
|
|
129
140
|
// on the next frame (as soon as the previous style change has taken effect),
|
|
130
141
|
// explicitly set the dContainer's height to its current pixel height, so we
|
|
131
142
|
// aren't transitioning out of 'auto'
|
|
@@ -134,12 +145,16 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
134
145
|
dContainer.style.transition = dContainerTransition;
|
|
135
146
|
dContainer.style.overflow = "hidden";
|
|
136
147
|
|
|
148
|
+
sdSection.style.setProperty("height", sdSection.offsetHeight + 'px', "important");
|
|
149
|
+
|
|
137
150
|
// on the next frame (as soon as the previous style change has taken effect),
|
|
138
151
|
// have the dContainer transition to height: 0
|
|
139
152
|
requestAnimationFrame(function () {
|
|
140
153
|
|
|
141
154
|
dContainer.style.height = 0 + 'px';
|
|
142
155
|
|
|
156
|
+
sdSection.style.setProperty("height", collapseSectionHeight + 'px', "important");
|
|
157
|
+
|
|
143
158
|
dContainer.addEventListener('transitionend', transitionEnd, true);
|
|
144
159
|
|
|
145
160
|
});
|
|
@@ -190,6 +205,7 @@ export default class CUI_SECTION extends HTMLElement {
|
|
|
190
205
|
|
|
191
206
|
this.sdSectionCollapseControl.classList.add('collapsed');
|
|
192
207
|
this.sdContentsContainer.setAttribute('data-collapsed', "true");
|
|
208
|
+
this.sdSection.style.setProperty("height", 'auto', "important");
|
|
193
209
|
}
|
|
194
210
|
|
|
195
211
|
this.sdSectionCollapseControl.addEventListener('click', () => {
|