bm-core-ui 2.9.1 → 2.9.3

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.
@@ -1799,12 +1799,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
1799
1799
  if (cell.retainCount > 0) {
1800
1800
  if (cell.itemType === BMCollectionViewLayoutAttributesType.Cell) {
1801
1801
  // Request and apply the new attributes for this cell
1802
- var attributes = this._layout.attributesForCellAtIndexPath(cell.indexPath);
1802
+ let attributes = this._layout.attributesForCellAtIndexPath(cell.indexPath);
1803
1803
  cell.attributes = attributes;
1804
1804
  }
1805
1805
  else if (cell.itemType === BMCollectionViewLayoutAttributesType.SupplementaryView) {
1806
1806
  // Request and apply the new attributes for this supplementary view
1807
- var attributes = this._layout.attributesForSupplementaryViewWithIdentifier(cell.reuseIdentifier, {atIndexPath: cell.indexPath});
1807
+ let attributes = this._layout.attributesForSupplementaryViewWithIdentifier(cell.reuseIdentifier, {atIndexPath: cell.indexPath});
1808
1808
  cell.attributes = attributes;
1809
1809
  }
1810
1810
  }
@@ -2140,11 +2140,11 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
2140
2140
  * If the cell was already measured, this will immediately return the cached measured size.
2141
2141
  * @param indexPath <BMIndexPath<T>> The index path of the cell whose size should be measured.
2142
2142
  * {
2143
- * @param layoutQueue <BMLayoutQueue> The layout queue to use for this measurement.
2143
+ * @param layoutQueue <BMViewLayoutQueue> The layout queue to use for this measurement.
2144
2144
  * @param dequeue <Boolean> Whether the layout queue should be drained automatically or not. If set to `NO`,
2145
2145
  * the layout queue must be drained after the first time this generator yields.
2146
2146
  * }
2147
- * @return <Iterator<BMSize or undefiend>> The iterator.
2147
+ * @return <Iterator<BMSize or undefined>> The iterator.
2148
2148
  */
2149
2149
  *_measuredSizeOfCellAtIndexPathGenerator(indexPath, {layoutQueue: queue, dequeue}) {
2150
2150
  // Return the cached size if it is available.
@@ -1679,12 +1679,39 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
1679
1679
  return;
1680
1680
  }
1681
1681
 
1682
+ // When the scrollbar offset is used, invalidate any measurement that exceeds the available space.
1683
+ if (this._expectedCellSize && this._collectionView.scrollBarSize) {
1684
+ switch (this.orientation) {
1685
+ case BMCollectionViewFlowLayoutOrientation.Horizontal:
1686
+ // Determine the available height.
1687
+ const insetHeight = this._sectionInsets.top + this._sectionInsets.bottom;
1688
+ const paddingHeight = this._topPadding + this._bottomPadding;
1689
+ const height = this._collectionView.frame.size.height - insetHeight - paddingHeight - this._collectionView.scrollBarSize;
1690
+
1691
+ // In horizontal mode, invalidate the measurements for cells that are too tall.
1692
+ this._collectionView.invalidateMeasuredSizeOfCellsWithBlock((size) => {
1693
+ return size.height > height;
1694
+ });
1695
+ break;
1696
+ default:
1697
+ // Determine the available width.
1698
+ const insetWidth = this._sectionInsets.left + this._sectionInsets.right;
1699
+ const width = this._collectionView.frame.size.width - insetWidth - this.collectionView.scrollBarSize;
1700
+
1701
+ // In default (vertical) mode, invalidate the measurements for cells that are too wide.
1702
+ this._collectionView.invalidateMeasuredSizeOfCellsWithBlock((size) => {
1703
+ return size.width > width;
1704
+ });
1705
+ break;
1706
+ }
1707
+ }
1708
+
1682
1709
  let iterator = this._prepareLayoutWithScrollbarOffsetGenerator(useOffset);
1683
1710
 
1684
1711
  // When not using automatic cell sizes, the generator function will run to finish from the first
1685
- // invocation of next
1712
+ // invocation of `next`.
1686
1713
  // When using automatic cell sizes, the first iteration will only build a rough outline of the expected layout
1687
- // and must be retained so different portions of the layout can subsequently be computed
1714
+ // and must be retained so different portions of the layout can subsequently be computed.
1688
1715
  let result = iterator.next();
1689
1716
  if (!result.done) {
1690
1717
  this._layoutIterator = iterator;
@@ -629,7 +629,7 @@ export function BMView() {} // <constructor>
629
629
 
630
630
  node: undefined, // <DOMNode>
631
631
 
632
- _keyboardShortcuts: undefined, // <Dictionary<string, [BMKeyboardShortcut]>>
632
+ _keyboardShortcuts: undefined, // <Dictionary<[BMKeyboardShortcut]>>
633
633
 
634
634
  registerKeyboardShortcut(shortcut) {
635
635
  return BMView.prototype.registerKeyboardShortcut.apply(this, arguments);
@@ -2210,7 +2210,7 @@ BMView.prototype = BMExtend(BMView.prototype, {
2210
2210
  /**
2211
2211
  * The keyboard shortcuts that have been registered to this view.
2212
2212
  */
2213
- _keyboardShortcuts: undefined, // <Dictionary<string, [BMKeyboardShortcut]>>
2213
+ _keyboardShortcuts: undefined, // <Dictionary<BMKeyboardShortcut[]>>
2214
2214
 
2215
2215
  /**
2216
2216
  * Registers a keyboard shortcut that can be activated when this view has keyboard focus.
@@ -2282,6 +2282,7 @@ BMView.prototype = BMExtend(BMView.prototype, {
2282
2282
  _keyboardShortcutsEnabled: NO, // <Boolean>
2283
2283
 
2284
2284
  /**
2285
+ * @protected
2285
2286
  * Enables keyboard shortcut handling. This makes the view's `node` focusable and attaches
2286
2287
  * the relevant event handlers to it.
2287
2288
  */
@@ -3075,6 +3076,7 @@ BMView.prototype = BMExtend(BMView.prototype, {
3075
3076
 
3076
3077
  /**
3077
3078
  * A generator that is used internally by CoreUI to layout subviews.
3079
+ * @returns <Iterator<undefined>>
3078
3080
  */
3079
3081
  *_layoutSubviewsGenerator() {
3080
3082
 
@@ -1087,6 +1087,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1087
1087
  },
1088
1088
 
1089
1089
  /**
1090
+ * @protected
1090
1091
  * Enables keyboard shortcut handling. This makes the window's `node` focusable and attaches
1091
1092
  * the relevant event handlers to it. If this window is the key window and the keyboard focus
1092
1093
  * is outside of this window, this window will acquire keyboard focus.
@@ -233,7 +233,7 @@ export function BMAddSmoothMousewheelInteractionToNode(node, args) {
233
233
  * The property descriptors will be copied in the order in which the parameters are specified. For example, if the third parameter has a property
234
234
  * with the same name as the second parameter, the target object will have the third parameter's definition of that property.
235
235
  * @param target <AnyObject, nullable> The object to which properties will be copied. May be set to undefined, in which case a new object will be created.
236
- * @param ... <[AnyObject], nullable> Additional objects may be specified. The property descriptors will be copied over to the target object.
236
+ * @param ... <[AnyObject]> Additional objects may be specified. The property descriptors will be copied over to the target object.
237
237
  * @return <AnyObject> The target object.
238
238
  */
239
239
  export function BMExtend(target) {
@@ -275,7 +275,7 @@ export function BMExtend(target) {
275
275
  * This will not redefine or reconfigure existing properties on the target object. For example, if any readonly property on the target object also exists on any of the
276
276
  * other objects, the target object's value for that property will not change.
277
277
  * @param target <AnyObject, nullable> The object to which properties will be copied. May be set to undefined, in which case a new object will be created.
278
- * @param ... <[AnyObject], nullable> Additional objects may be specified. The property values will be copied over to the target object.
278
+ * @param ... <[AnyObject]> Additional objects may be specified. The property values will be copied over to the target object.
279
279
  * @return <AnyObject> The target object.
280
280
  */
281
281
  export function BMCopyProperties(target) {