@vaadin/vaadin-board 2.2.1 → 2.2.2

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 CHANGED
@@ -13,7 +13,7 @@
13
13
  "repository": "vaadin/vaadin-board",
14
14
  "homepage": "https://vaadin.com/components",
15
15
  "name": "@vaadin/vaadin-board",
16
- "version": "2.2.1",
16
+ "version": "2.2.2",
17
17
  "main": "vaadin-board.js",
18
18
  "author": "Vaadin Ltd",
19
19
  "license": "https://raw.githubusercontent.com/vaadin/vaadin-board/master/LICENSE.txt",
@@ -232,9 +232,7 @@ class BoardRowElement extends ElementMixin(mixinBehaviors([IronResizableBehavior
232
232
  _recalculateFlexBasis(forceResize) {
233
233
  const width = this.getBoundingClientRect().width;
234
234
  const breakpoints = this._measureBreakpointsInPx();
235
- if (forceResize || width != this._oldWidth
236
- || breakpoints.smallSize != this._oldBreakpoints.smallSize
237
- || breakpoints.mediumSize != this._oldBreakpoints.mediumSize) {
235
+ if (forceResize || this._shouldRecalculate(width, breakpoints)) {
238
236
  const nodes = this.$.insertionPoint.assignedNodes({ flatten: true });
239
237
  const isElementNode = function (node) {
240
238
  return !((node.nodeType === node.TEXT_NODE)
@@ -257,6 +255,37 @@ class BoardRowElement extends ElementMixin(mixinBehaviors([IronResizableBehavior
257
255
  }
258
256
  }
259
257
 
258
+ /** @private */
259
+ _shouldRecalculate(width, breakpoints) {
260
+ // Should not recalculate if row is invisible
261
+ if (this._isElementHidden()) {
262
+ return false;
263
+ }
264
+ return (
265
+ width !== this._oldWidth ||
266
+ breakpoints.smallSize !== this._oldBreakpoints.smallSize ||
267
+ breakpoints.mediumSize !== this._oldBreakpoints.mediumSize
268
+ );
269
+ }
270
+
271
+ /** @private */
272
+ _isElementHidden() {
273
+ // `offsetParent` is `null` when the element itself
274
+ // or one of its ancestors is hidden with `display: none`.
275
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
276
+ // However `offsetParent` is also null when the element is using fixed
277
+ // positioning, so additionally check if the element takes up layout space.
278
+ if (this.offsetParent === null && this.clientWidth === 0 && this.clientHeight === 0) {
279
+ return true;
280
+ }
281
+ // Check inline style first to save a re-flow.
282
+ if (this.style.visibility === 'hidden' || this.style.display === 'none') {
283
+ return true;
284
+ }
285
+ const computedStyle = window.getComputedStyle(this);
286
+ return computedStyle.visibility === 'hidden' || computedStyle.display === 'none';
287
+ }
288
+
260
289
  /**
261
290
  * Measure the breakpoints in pixels.
262
291
  *
@@ -51,7 +51,7 @@ class BoardElement extends ElementMixin(mixinBehaviors([IronResizableBehavior],
51
51
  }
52
52
 
53
53
  static get version() {
54
- return '2.2.1';
54
+ return '2.2.2';
55
55
  }
56
56
 
57
57
  static get cvdlName() {