bm-core-ui 2.12.0-beta.15 → 2.12.0-beta.17
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/build/@types/index.d.ts +2 -2
- package/build/BMCollectionView/BMCollectionView.js +49 -8
- package/build/BMCollectionView/BMCollectionViewFlowLayout.js +3 -3
- package/build/BMCollectionView/BMCollectionViewLayout.js +5 -0
- package/build/BMCoreUI.css +6 -0
- package/build/BMView/BMMenu.js +50 -9
- package/lib/@types/BMCoreUI.min.d.ts +2 -2
- package/lib/BMCoreUI.min.js +1 -1
- package/package.json +1 -1
package/build/@types/index.d.ts
CHANGED
|
@@ -9992,7 +9992,7 @@ export class BMMenu {
|
|
|
9992
9992
|
* The menu items displayed by this menu.
|
|
9993
9993
|
*
|
|
9994
9994
|
*/
|
|
9995
|
-
|
|
9995
|
+
items: BMMenuItem[];
|
|
9996
9996
|
|
|
9997
9997
|
/**
|
|
9998
9998
|
* An optional delegate object that will receive callbacks events from this menu.
|
|
@@ -10076,7 +10076,7 @@ export class BMMenu {
|
|
|
10076
10076
|
* The menu that opened this menu, if any.
|
|
10077
10077
|
*
|
|
10078
10078
|
*/
|
|
10079
|
-
|
|
10079
|
+
readonly supermenu?: BMMenu | null | undefined;
|
|
10080
10080
|
|
|
10081
10081
|
/**
|
|
10082
10082
|
* The menu's frame, relative to the viewport, available while this menu is visible.
|
|
@@ -489,6 +489,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
489
489
|
// If this frame is assigned as part of a layout animation, don't perform any changes
|
|
490
490
|
if (this._layoutAnimator) {
|
|
491
491
|
Object.getOwnPropertyDescriptor(BMView.prototype, 'frame').set.call(this, frame);
|
|
492
|
+
|
|
492
493
|
return;
|
|
493
494
|
}
|
|
494
495
|
|
|
@@ -1954,7 +1955,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
1954
1955
|
}
|
|
1955
1956
|
|
|
1956
1957
|
if (cell._exclusivelyRendered) {
|
|
1957
|
-
// If the cell was exclusively rendered, it should left alone
|
|
1958
|
+
// If the cell was exclusively rendered, it should be left alone
|
|
1958
1959
|
cell._exclusivelyRendered = undefined;
|
|
1959
1960
|
continue;
|
|
1960
1961
|
}
|
|
@@ -2160,7 +2161,9 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2160
2161
|
const iterators = indexPaths.map(p => this._measuredSizeOfCellAtIndexPathGenerator(p, {layoutQueue: queue, dequeue: NO}));
|
|
2161
2162
|
|
|
2162
2163
|
iterators.forEach(i => i.next());
|
|
2164
|
+
BMAnimationContextBeginStatic();
|
|
2163
2165
|
queue.dequeue();
|
|
2166
|
+
BMAnimationApply();
|
|
2164
2167
|
iterators.forEach(i => i.next());
|
|
2165
2168
|
},
|
|
2166
2169
|
|
|
@@ -2424,10 +2427,16 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2424
2427
|
constraints.push(constraint);
|
|
2425
2428
|
}
|
|
2426
2429
|
|
|
2430
|
+
cell._registerLayout();
|
|
2431
|
+
|
|
2427
2432
|
yield;
|
|
2428
2433
|
|
|
2429
2434
|
// Run a layout pass to measure the cell's subview
|
|
2430
|
-
if (dequeue)
|
|
2435
|
+
if (dequeue) {
|
|
2436
|
+
BMAnimationContextBeginStatic();
|
|
2437
|
+
cell.layoutQueue.dequeue();
|
|
2438
|
+
BMAnimationApply();
|
|
2439
|
+
}
|
|
2431
2440
|
|
|
2432
2441
|
cell.layoutQueue = layoutQueue;
|
|
2433
2442
|
|
|
@@ -2460,6 +2469,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2460
2469
|
}
|
|
2461
2470
|
|
|
2462
2471
|
// If the cell is still retained, reapply the previous attibutes
|
|
2472
|
+
BMAnimationContextBeginStatic();
|
|
2463
2473
|
if (cell.retainCount > 0 && previousAttributes) {
|
|
2464
2474
|
cell.attributes = previousAttributes;
|
|
2465
2475
|
}
|
|
@@ -2467,6 +2477,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2467
2477
|
cell._attributes = undefined;
|
|
2468
2478
|
attributes._cell = undefined;
|
|
2469
2479
|
}
|
|
2480
|
+
BMAnimationApply();
|
|
2470
2481
|
|
|
2471
2482
|
// Invalidate the cell's constraints to allow the next layout pass to correctly update the cells
|
|
2472
2483
|
cell._invalidatedConstraints = YES;
|
|
@@ -5343,9 +5354,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5343
5354
|
this._bounds.size.width = this._frame.size.width + 2 * this._offscreenBufferSize;
|
|
5344
5355
|
this._bounds.size.height = this._frame.size.height + 2 * this._offscreenBufferSize;
|
|
5345
5356
|
}
|
|
5357
|
+
|
|
5358
|
+
const oldLayout = this._layout;
|
|
5346
5359
|
|
|
5347
5360
|
// Ask the new layout to prepare its layout
|
|
5348
5361
|
layout.collectionView = this;
|
|
5362
|
+
this._layout = layout;
|
|
5349
5363
|
layout.prepareLayout();
|
|
5350
5364
|
|
|
5351
5365
|
var newSize = layout.contentSize();
|
|
@@ -5360,7 +5374,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5360
5374
|
// }
|
|
5361
5375
|
|
|
5362
5376
|
// Check to see if an offset is required
|
|
5363
|
-
var newOffset = layout.preferredScrollOffsetForTransitionFromLayout(
|
|
5377
|
+
var newOffset = layout.preferredScrollOffsetForTransitionFromLayout(oldLayout, {withOffset: this.scrollOffset.copy()});
|
|
5364
5378
|
|
|
5365
5379
|
// Then ensure that the new offset is constrained to the visible area
|
|
5366
5380
|
newOffset.x = Math.max(0, Math.min(newOffset.x, newSize.width - this.frame.size.width));
|
|
@@ -5465,7 +5479,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5465
5479
|
var attribute = newAttributes[newAttributes.length - 1];
|
|
5466
5480
|
|
|
5467
5481
|
if (attribute.itemType === BMCollectionViewLayoutAttributesType.Cell) {
|
|
5468
|
-
var oldAttribute =
|
|
5482
|
+
var oldAttribute = oldLayout.attributesForCellAtIndexPath(attribute.indexPath);
|
|
5469
5483
|
|
|
5470
5484
|
// Create the transition attributes for this cell
|
|
5471
5485
|
var transitionAttribute = _BMCollectionViewTransitionLayoutAttributesMakeWithSourceAttributes(oldAttribute, {targetAttributes: attribute});
|
|
@@ -5493,10 +5507,8 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5493
5507
|
var transitionLayout = new _BMCollectionViewTransitionLayout(transitionAttributes, this._size, newSize, layout);
|
|
5494
5508
|
transitionLayout.collectionView = this;
|
|
5495
5509
|
|
|
5496
|
-
var oldLayout = this._layout;
|
|
5497
|
-
|
|
5498
5510
|
// Unbind the old layout
|
|
5499
|
-
|
|
5511
|
+
oldLayout.collectionView = undefined;
|
|
5500
5512
|
|
|
5501
5513
|
// Temporarily make the transition layout the current layout
|
|
5502
5514
|
this._layout = transitionLayout;
|
|
@@ -6059,14 +6071,18 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
6059
6071
|
|
|
6060
6072
|
// If this update occurs because of a drag & drop operation, try to obtain the associated index paths from the data set
|
|
6061
6073
|
let dropPreviewMap;
|
|
6074
|
+
/** @type {Map} */
|
|
6075
|
+
let dropPreviewReverseMap;
|
|
6062
6076
|
if (this._dropPreviews && this.dataSet.indexPathForDragItem) {
|
|
6063
6077
|
dropPreviewMap = new Map();
|
|
6078
|
+
dropPreviewReverseMap = new Map();
|
|
6064
6079
|
|
|
6065
6080
|
for (const preview of this._dropPreviews) {
|
|
6066
6081
|
const indexPath = this.dataSet.indexPathForDragItem(preview.item);
|
|
6067
6082
|
|
|
6068
6083
|
if (indexPath) {
|
|
6069
6084
|
dropPreviewMap.set(indexPath, preview);
|
|
6085
|
+
dropPreviewReverseMap.set(preview, indexPath);
|
|
6070
6086
|
}
|
|
6071
6087
|
}
|
|
6072
6088
|
}
|
|
@@ -6464,6 +6480,18 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
6464
6480
|
for (const cell of insertedCells) {
|
|
6465
6481
|
cell._dropPreview.performDropToNode(cell.node);
|
|
6466
6482
|
|
|
6483
|
+
// Handle the cases where multiple drop previews target this cell
|
|
6484
|
+
for (const [preview, indexPath] of dropPreviewReverseMap.entries()) {
|
|
6485
|
+
if (indexPath.isLooselyEqualToIndexPath(cell.indexPath, {usingComparator: self.identityComparator}) && preview != cell._dropPreview) {
|
|
6486
|
+
preview.performDropToNode(cell.node);
|
|
6487
|
+
const index = self._dropPreviews.indexOf(cell._dropPreview);
|
|
6488
|
+
|
|
6489
|
+
if (index != -1) {
|
|
6490
|
+
self._dropPreviews.splice(index, 1);
|
|
6491
|
+
}
|
|
6492
|
+
}
|
|
6493
|
+
}
|
|
6494
|
+
|
|
6467
6495
|
const index = self._dropPreviews.indexOf(cell._dropPreview);
|
|
6468
6496
|
|
|
6469
6497
|
if (index != -1) {
|
|
@@ -6486,6 +6514,19 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
6486
6514
|
// Play all drop animations
|
|
6487
6515
|
for (const cell of dropMovingCells) {
|
|
6488
6516
|
cell._dropPreview.performDropToNode(cell.node);
|
|
6517
|
+
|
|
6518
|
+
// Handle the cases where multiple drop previews target this cell
|
|
6519
|
+
for (const [preview, indexPath] of dropPreviewReverseMap.entries()) {
|
|
6520
|
+
if (indexPath.isLooselyEqualToIndexPath(cell.indexPath, {usingComparator: self.identityComparator}) && preview != cell._dropPreview) {
|
|
6521
|
+
preview.performDropToNode(cell.node);
|
|
6522
|
+
const index = self._dropPreviews.indexOf(cell._dropPreview);
|
|
6523
|
+
|
|
6524
|
+
if (index != -1) {
|
|
6525
|
+
self._dropPreviews.splice(index, 1);
|
|
6526
|
+
}
|
|
6527
|
+
}
|
|
6528
|
+
}
|
|
6529
|
+
|
|
6489
6530
|
const index = self._dropPreviews.indexOf(cell._dropPreview);
|
|
6490
6531
|
|
|
6491
6532
|
if (index != -1) {
|
|
@@ -7368,4 +7409,4 @@ class BMCollectionViewDataSetAdapter {
|
|
|
7368
7409
|
}
|
|
7369
7410
|
}
|
|
7370
7411
|
|
|
7371
|
-
// #endregion
|
|
7412
|
+
// #endregion
|
|
@@ -3365,9 +3365,10 @@ BMCollectionViewFlowLayout.prototype = BMExtend(Object.create(BMCollectionViewLa
|
|
|
3365
3365
|
}
|
|
3366
3366
|
else {
|
|
3367
3367
|
// Because the measured size of the cells can depend upon the size of collection view's frame, in addition
|
|
3368
|
-
// to invalidating the layout, flow layout also invalidates the size of cells that are as wide as collection view's previous frame
|
|
3368
|
+
// to invalidating the layout, flow layout also invalidates the size of cells that are as wide as collection view's previous frame
|
|
3369
|
+
// or wider than the new frame
|
|
3369
3370
|
this.collectionView.invalidateMeasuredSizeOfCellsWithBlock(size => {
|
|
3370
|
-
return size.width >= this.cachedLayout.availableWidth;
|
|
3371
|
+
return size.width >= this.cachedLayout.availableWidth || size.width >= frame.width;
|
|
3371
3372
|
});
|
|
3372
3373
|
}
|
|
3373
3374
|
|
|
@@ -4976,4 +4977,3 @@ BMCollectionViewFlowLayout.flowLayout = function () {
|
|
|
4976
4977
|
}
|
|
4977
4978
|
|
|
4978
4979
|
// @endtype
|
|
4979
|
-
|
|
@@ -978,6 +978,11 @@ _BMCollectionViewTransitionLayout.prototype = BMExtend({}, BMCollectionViewLayou
|
|
|
978
978
|
return this.targetLayout.attributesForSupplementaryViewWithIdentifier(identifier, args);
|
|
979
979
|
},
|
|
980
980
|
|
|
981
|
+
// @override - BMCollectionViewLayout
|
|
982
|
+
constraintsForMeasuringCell(cell, args) {
|
|
983
|
+
return this.targetLayout.constraintsForMeasuringCell(cell, args);
|
|
984
|
+
},
|
|
985
|
+
|
|
981
986
|
/**
|
|
982
987
|
* Invoked by the collection view at the end of a layout transition.
|
|
983
988
|
* Causes the transition layout to apply the final attributes to all animated cells.
|
package/build/BMCoreUI.css
CHANGED
|
@@ -1353,6 +1353,12 @@ input:not(:checked) + .BMWindowSwitchGutter > .BMWindowSwitchKnob, .BMWindowSwit
|
|
|
1353
1353
|
pointer-events: none !important;
|
|
1354
1354
|
}
|
|
1355
1355
|
|
|
1356
|
+
/* This allows clicking on an item with a submenu during the event delaying period
|
|
1357
|
+
after a submenu has just been opened */
|
|
1358
|
+
.BMMenuContainer.BMMenuContainerSubmenuActive .BMMenuItemHighlighted {
|
|
1359
|
+
pointer-events: all !important;
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1356
1362
|
.BMMenuContainerFullScreen {
|
|
1357
1363
|
background-color: rgba(0, 0, 0, .33);
|
|
1358
1364
|
}
|
package/build/BMView/BMMenu.js
CHANGED
|
@@ -406,6 +406,42 @@ BMMenu.prototype = {
|
|
|
406
406
|
get items() {
|
|
407
407
|
return this._items.slice();
|
|
408
408
|
},
|
|
409
|
+
set items(items) {
|
|
410
|
+
this._items = items.slice();
|
|
411
|
+
|
|
412
|
+
// If this menu was already open when items are updated, destroy
|
|
413
|
+
// and re-render it
|
|
414
|
+
if (this._node) {
|
|
415
|
+
if (this._supermenu) {
|
|
416
|
+
this._node.remove();
|
|
417
|
+
}
|
|
418
|
+
else {
|
|
419
|
+
this._containerNode.remove();
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
this._renderMenu();
|
|
423
|
+
|
|
424
|
+
if (!this._supermenu) {
|
|
425
|
+
document.body.appendChild(this._containerNode);
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
this._setAnchorRect(this._rect);
|
|
429
|
+
|
|
430
|
+
// Restore the highlighted menu item
|
|
431
|
+
if (this._highlightedIndex != -1) {
|
|
432
|
+
const item = this._items[this._highlightedIndex];
|
|
433
|
+
if (item && !item._isSeparator && item._enabled) {
|
|
434
|
+
const index = this._highlightedIndex;
|
|
435
|
+
this._highlightedIndex = -1;
|
|
436
|
+
this.highlightedIndex = index;
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
for (const node of this._itemsContainerNode.children) {
|
|
441
|
+
BMHook(node, {opacity: 1, translateY: '0px'});
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
},
|
|
409
445
|
|
|
410
446
|
/**
|
|
411
447
|
* An optional delegate object that will receive callbacks events from this menu.
|
|
@@ -519,6 +555,9 @@ BMMenu.prototype = {
|
|
|
519
555
|
* The menu that opened this menu, if any.
|
|
520
556
|
*/
|
|
521
557
|
_supermenu: undefined, // <BMMenu, nullable>
|
|
558
|
+
get supermenu() {
|
|
559
|
+
return this._supermenu;
|
|
560
|
+
},
|
|
522
561
|
|
|
523
562
|
/**
|
|
524
563
|
* The menu's frame, relative to the viewport, available while this menu is visible.
|
|
@@ -1611,6 +1650,14 @@ BMMenu.prototype = {
|
|
|
1611
1650
|
closeAnimated(animated = YES, {withSupermenu = NO} = {}) {
|
|
1612
1651
|
// If the menu isn't visible this action has no effect.
|
|
1613
1652
|
if (!this._node) return;
|
|
1653
|
+
|
|
1654
|
+
const sourceNodeShadow = this._sourceNodeShadow;
|
|
1655
|
+
const containerNode = this._containerNode;
|
|
1656
|
+
const node = this._node;
|
|
1657
|
+
const itemsContainerNode = this._itemsContainerNode;
|
|
1658
|
+
const sourceNode = this._sourceNode;
|
|
1659
|
+
|
|
1660
|
+
this._node = undefined;
|
|
1614
1661
|
|
|
1615
1662
|
this._containerNode.removeEventListener('keydown', this, {passive: true});
|
|
1616
1663
|
this._containerNode.removeEventListener('keyup', this, {passive: true});
|
|
@@ -1655,8 +1702,8 @@ BMMenu.prototype = {
|
|
|
1655
1702
|
}
|
|
1656
1703
|
|
|
1657
1704
|
// Prevent interaction with the menu while its close animation is running
|
|
1658
|
-
|
|
1659
|
-
//
|
|
1705
|
+
node.style.pointerEvents = 'none';
|
|
1706
|
+
// node.inert = true;
|
|
1660
1707
|
|
|
1661
1708
|
if (!supermenu) {
|
|
1662
1709
|
this._containerNode.style.pointerEvents = 'none';
|
|
@@ -1693,12 +1740,6 @@ BMMenu.prototype = {
|
|
|
1693
1740
|
}
|
|
1694
1741
|
}
|
|
1695
1742
|
|
|
1696
|
-
const sourceNodeShadow = this._sourceNodeShadow;
|
|
1697
|
-
const containerNode = this._containerNode;
|
|
1698
|
-
const node = this._node;
|
|
1699
|
-
const itemsContainerNode = this._itemsContainerNode;
|
|
1700
|
-
const sourceNode = this._sourceNode;
|
|
1701
|
-
|
|
1702
1743
|
this._sourceNode = undefined;
|
|
1703
1744
|
this._sourceNodeShadow = undefined;
|
|
1704
1745
|
|
|
@@ -1729,7 +1770,7 @@ BMMenu.prototype = {
|
|
|
1729
1770
|
|
|
1730
1771
|
itemsContainerNode.style.overflow = 'hidden';
|
|
1731
1772
|
|
|
1732
|
-
__BMVelocityAnimate(
|
|
1773
|
+
__BMVelocityAnimate(node, {
|
|
1733
1774
|
scaleX: this._kind == BMMenuKind.PullDownMenu ? 1 : scale,
|
|
1734
1775
|
scaleY: scale,
|
|
1735
1776
|
opacity: (sourceNodeShadow && !supermenu) ? 1 : 0,
|
|
@@ -9992,7 +9992,7 @@ declare class BMMenu {
|
|
|
9992
9992
|
* The menu items displayed by this menu.
|
|
9993
9993
|
*
|
|
9994
9994
|
*/
|
|
9995
|
-
|
|
9995
|
+
items: BMMenuItem[];
|
|
9996
9996
|
|
|
9997
9997
|
/**
|
|
9998
9998
|
* An optional delegate object that will receive callbacks events from this menu.
|
|
@@ -10076,7 +10076,7 @@ declare class BMMenu {
|
|
|
10076
10076
|
* The menu that opened this menu, if any.
|
|
10077
10077
|
*
|
|
10078
10078
|
*/
|
|
10079
|
-
|
|
10079
|
+
readonly supermenu?: BMMenu | null | undefined;
|
|
10080
10080
|
|
|
10081
10081
|
/**
|
|
10082
10082
|
* The menu's frame, relative to the viewport, available while this menu is visible.
|