bm-core-ui 2.11.6 → 2.11.7

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.
@@ -583,6 +583,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
583
583
  * The window toolbar DOM node.
584
584
  */
585
585
  _toolbar: undefined, // <DOMNode>
586
+
586
587
  get toolbar() {
587
588
  return this._toolbar;
588
589
  },
@@ -626,9 +627,9 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
626
627
  return this._anchorPoint;
627
628
  },
628
629
  set anchorPoint(point) {
629
- this._anchorPoint = point && point.copy();
630
630
  this.anchorNode = undefined;
631
631
  this._anchorRect = undefined;
632
+ this._anchorPoint = point && point.copy();
632
633
  },
633
634
 
634
635
  /**
@@ -641,9 +642,9 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
641
642
  return this._anchorRect;
642
643
  },
643
644
  set anchorRect(rect) {
644
- this._anchorRect = rect && rect.copy();
645
645
  this.anchorNode = undefined;
646
646
  this._anchorPoint = undefined;
647
+ this._anchorRect = rect && rect.copy();
647
648
  },
648
649
 
649
650
 
@@ -657,9 +658,21 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
657
658
  return this._anchorNode;
658
659
  },
659
660
  set anchorNode(node) {
661
+ if (this._keepsNodeHidden && this._visible) {
662
+ if (this._anchorNode) {
663
+ this._anchorNode.classList.remove('BMWindowAnchorNodeHidden');
664
+ }
665
+ }
666
+
660
667
  this._anchorNode = node;
661
668
  this._anchorPoint = undefined;
662
669
  this._anchorRect = undefined;
670
+
671
+ if (this._keepsNodeHidden && this._visible) {
672
+ if (this._anchorNode) {
673
+ this._anchorNode.classList.add('BMWindowAnchorNodeHidden');
674
+ }
675
+ }
663
676
  },
664
677
 
665
678
  /**
@@ -1288,6 +1301,11 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1288
1301
  }
1289
1302
  },
1290
1303
 
1304
+ /**
1305
+ * When set to `YES`, the anchor node remains hidden while the window is visible.
1306
+ */
1307
+ _keepsNodeHidden: NO, // <Boolean>
1308
+
1291
1309
  /**
1292
1310
  * @protected
1293
1311
  * This method is invoked during `bringToFrontAnimated()` to run the animations that will make this window visible.
@@ -1331,9 +1349,26 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1331
1349
  // and then to the animation node, but inversed
1332
1350
  const frame = self._fullScreen ? BMRectMake(0, 0, window.innerWidth, window.innerHeight) : self.frame;
1333
1351
  const transformRect = frame.rectWithTransformToRect(rect);
1352
+
1353
+ let windowShouldKeepNodeHidden = NO;
1354
+ if (self.delegate && self.delegate.windowShouldKeepNodeHidden) {
1355
+ windowShouldKeepNodeHidden = self.delegate.windowShouldKeepNodeHidden(self, node);
1356
+ }
1334
1357
 
1335
1358
  document.body.appendChild(animationNode);
1336
- node.style.display = 'none';
1359
+
1360
+ if (windowShouldKeepNodeHidden) {
1361
+ node.classList.add('BMWindowAnchorNodeHidden');
1362
+ this._keepsNodeHidden = YES;
1363
+ }
1364
+ else {
1365
+ node.animate([
1366
+ {opacity: 0, easing: 'cubic-bezier(0.77, 0, 0.175, 1)'},
1367
+ {opacity: 0, easing: 'cubic-bezier(0.77, 0, 0.175, 1)', offset: 0.5},
1368
+ {opacity: 1}
1369
+ ], _BMWindowAnimationDurationDefault);
1370
+ this._keepsNodeHidden = NO;
1371
+ }
1337
1372
 
1338
1373
  __BMVelocityAnimate(this._window, {opacity: 1, translateX: ['0px', transformRect.origin.x + 'px'], translateY: ['0px', transformRect.origin.y + 'px'],
1339
1374
  scaleX: [1, transformRect.size.width], scaleY: [1, transformRect.size.height]}, {
@@ -1350,18 +1385,6 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1350
1385
  easing: _BMWindowAnimationEasingDefault,
1351
1386
  complete: function () {
1352
1387
  animationNode.remove();
1353
- var windowShouldKeepNodeHidden = NO;
1354
- if (self.delegate && self.delegate.windowShouldKeepNodeHidden) {
1355
- windowShouldKeepNodeHidden = self.delegate.windowShouldKeepNodeHidden(self, node);
1356
- }
1357
- if (windowShouldKeepNodeHidden) {
1358
- self._nodeDisplay = nodeDisplay;
1359
- }
1360
- else {
1361
- node.style.display = nodeDisplay;
1362
- self._nodeDisplay = undefined;
1363
- }
1364
-
1365
1388
  completionHandler();
1366
1389
  }
1367
1390
  }, YES);
@@ -1392,7 +1415,9 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1392
1415
  bringToFrontAnimated: function (animated, args = {}) {
1393
1416
  this._visible = YES;
1394
1417
 
1395
- this.becomeKeyWindow();
1418
+ if (!this.isKeyWindow) {
1419
+ this.becomeKeyWindow();
1420
+ }
1396
1421
 
1397
1422
  for (let window of this._toolWindows) {
1398
1423
  if (window.opensAutomatically) window.bringToFrontAnimated(animated);
@@ -1450,7 +1475,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1450
1475
  this.anchorRect = undefined;
1451
1476
  this.anchorNode = undefined;
1452
1477
 
1453
- if (this._keyboardShortcutsEnabled) {
1478
+ if (this._keyboardShortcutsEnabled && this.isKeyWindow) {
1454
1479
  this.node.focus();
1455
1480
  }
1456
1481
  }
@@ -1521,16 +1546,13 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1521
1546
  // Create a copy of the given node which will be used in the animation in place of the original node
1522
1547
  const node = this._anchorNode;
1523
1548
 
1524
- if (typeof self._nodeDisplay != 'undefined') {
1525
- node.style.display = self._nodeDisplay;
1549
+ if (this._keepsNodeHidden) {
1550
+ node.classList.remove('BMWindowAnchorNodeHidden');
1526
1551
  }
1527
1552
 
1528
1553
  const rect = BMRectMakeWithNodeFrame(node);
1529
1554
  const animationNode = node.cloneNode(YES);
1530
1555
 
1531
- const nodeDisplay = (typeof self._nodeDisplay != 'undefined') ? self._nodeDisplay : node.style.display;
1532
- self._nodeDisplay = undefined;
1533
-
1534
1556
  animationNode.style.position = 'fixed';
1535
1557
  animationNode.style.zIndex = BM_WINDOW_Z_INDEX_MAX + 1;
1536
1558
  animationNode.style.transform = '';
@@ -1548,7 +1570,17 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1548
1570
  scaleX: 1 / transformRect.size.width, scaleY: 1 / transformRect.size.height, opacity: 0});
1549
1571
 
1550
1572
  document.body.appendChild(animationNode);
1551
- node.style.display = 'none';
1573
+
1574
+ if (this._keepsNodeHidden) {
1575
+ node.classList.add('BMWindowAnchorNodeHidden');
1576
+ }
1577
+ else {
1578
+ node.animate([
1579
+ {opacity: 1, easing: 'cubic-bezier(0.77, 0, 0.175, 1)'},
1580
+ {opacity: 0, easing: 'cubic-bezier(0.77, 0, 0.175, 1)', offset: 0.5},
1581
+ {opacity: 0}
1582
+ ], _BMWindowAnimationDurationDefault);
1583
+ }
1552
1584
 
1553
1585
  __BMVelocityAnimate(this._window, {opacity: 0, translateX: transformRect.origin.x + 'px', translateY: transformRect.origin.y + 'px',
1554
1586
  scaleX: transformRect.size.width, scaleY: transformRect.size.height}, {
@@ -1563,7 +1595,10 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1563
1595
  scaleX: [1, 1 / transformRect.size.width], scaleY: [1, 1 / transformRect.size.height]}, {
1564
1596
  duration: _BMWindowAnimationDurationDefault,
1565
1597
  easing: _BMWindowAnimationEasingDefault,
1566
- complete: function () { node.style.display = nodeDisplay; animationNode.remove(); }
1598
+ complete: function () {
1599
+ node.classList.remove('BMWindowAnchorNodeHidden');
1600
+ animationNode.remove();
1601
+ }
1567
1602
  }, YES);
1568
1603
  }
1569
1604
  else {
@@ -8216,6 +8216,12 @@ declare class BMMenu {
8216
8216
  */
8217
8217
  private _node?: DOMNode | null | undefined;
8218
8218
 
8219
+ /**
8220
+ * The DOM node containing the menu items.
8221
+ *
8222
+ */
8223
+ private _itemsContainerNode?: DOMNode | null | undefined;
8224
+
8219
8225
  /**
8220
8226
  * The container DOM node currently used by this menu
8221
8227
  *
@@ -12834,7 +12840,7 @@ declare interface BMCollectionViewDataSet<T = any> {
12834
12840
  * @return An array of index paths specifying the positions of the items after they have been moved.
12835
12841
  * The index paths in this array are not required to match either of the lists supplied by
12836
12842
  * collection view.
12837
- *
12843
+ *
12838
12844
  */
12839
12845
  moveItemsFromIndexPaths?(indexPaths: BMIndexPath<T>[], {toIndexPath}: {toIndexPath: BMIndexPath<T>}): BMIndexPath<T>[];
12840
12846
 
@@ -12847,7 +12853,7 @@ declare interface BMCollectionViewDataSet<T = any> {
12847
12853
  * and remove just some of the items, by changing their internal data structures appropriately.
12848
12854
  * The order of the items in the array is guaranteed to be such that the target index paths are in ascending order.
12849
12855
  * @param indexPaths An array of index paths identifying which items have to be removed.
12850
- *
12856
+ *
12851
12857
  */
12852
12858
  removeItemsAtIndexPaths?(indexPaths: BMIndexPath<T>[]): void;
12853
12859
 
@@ -12860,10 +12866,23 @@ declare interface BMCollectionViewDataSet<T = any> {
12860
12866
  * and add just some of the items, by changing their internal data structures appropriately.
12861
12867
  * @param items An array of objects to add to the collection view.
12862
12868
  * @param toIndexPath The starting index path to which the items should be inserted.
12863
- *
12869
+ *
12864
12870
  */
12865
12871
  insertItems?(items: any[], {toIndexPath}: {toIndexPath: BMIndexPath<T>}): void;
12866
12872
 
12873
+
12874
+ /**
12875
+ * This method may be implemented by data set objects that support transferring items to another collection view.
12876
+ * Data set objects implementing this method are expected to create a copy of the specified item and return it.
12877
+ * The item is guaranteed to be an object that was returned at some point by the data set when it provided an index path.
12878
+ * If this method is not implemented, collection view will create a copy of the item by stringifying it and parsing it back
12879
+ * into an object.
12880
+ * @param item The item whose copy should be created for the transfer.
12881
+ * @return A copy of the specified item.
12882
+ *
12883
+ */
12884
+ copyOfItem?(item: any): any;
12885
+
12867
12886
  }
12868
12887
 
12869
12888
 
@@ -13043,6 +13062,20 @@ declare interface BMCollectionViewDataSource<T = any> {
13043
13062
  */
13044
13063
  collectionViewInsertItems?(collectionView: BMCollectionView, items: any[], {toIndexPath}: {toIndexPath: BMIndexPath<T>}): void;
13045
13064
 
13065
+
13066
+ /**
13067
+ * This method may be implemented by data source objects that support transferring items to another collection view.
13068
+ * Data source objects implementing this method are expected to create a copy of the specified item and return it.
13069
+ * The item is guaranteed to be an object that was returned at some point by the data set when it provided an index path.
13070
+ * If this method is not implemented, collection view will create a copy of the item by stringifying it and parsing it back
13071
+ * into an object.
13072
+ * @param collectionView The collection view from which items are being transferred.
13073
+ * @param item The item whose copy should be created for the transfer.
13074
+ * @return A copy of the specified item.
13075
+ *
13076
+ */
13077
+ collectionViewCopyOfItem?(collectionView: BMCollectionView, item: any): any;
13078
+
13046
13079
  }
13047
13080
 
13048
13081
 
@@ -13831,7 +13864,7 @@ declare class BMWindow extends BMView {
13831
13864
  * The DOM node in which the window contents should be added.
13832
13865
  *
13833
13866
  */
13834
- readonly content: DOMNode;
13867
+ private _content: DOMNode;
13835
13868
 
13836
13869
  /**
13837
13870
  * A string that is used for when this window is minimized.
@@ -13991,6 +14024,12 @@ declare class BMWindow extends BMView {
13991
14024
  toggleAnimated(animated?: boolean | null | undefined, {completionHandler}?: {completionHandler?: (() => void) | null | undefined}): void;
13992
14025
 
13993
14026
 
14027
+ /**
14028
+ * When set to `YES`, the anchor node remains hidden while the window is visible.
14029
+ *
14030
+ */
14031
+ private _keepsNodeHidden: boolean;
14032
+
13994
14033
  /**
13995
14034
  * This method is invoked during `bringToFrontAnimated()` to run the animations that will make this window visible.
13996
14035
  * Subclasses can override this method to perform custom animations.