bm-core-ui 2.11.3 → 2.11.5

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.
@@ -305,7 +305,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
305
305
 
306
306
  this._usesLegacyDataSet = NO;
307
307
  this._dataSource = source;
308
- this._dataSet = BMCollectionViewDataSetAdapter.adapterWithDataSource(source);
308
+ this._dataSet = BMCollectionViewDataSetAdapter.adapterWithDataSource(this, source);
309
309
 
310
310
  this.dataSetDidChangeFromDataSet(oldDataSet);
311
311
  },
@@ -889,22 +889,32 @@ BMMenu.prototype = {
889
889
  }
890
890
 
891
891
  // Make the menu expand
892
+ menuNode.style.overflow = 'hidden';
892
893
  __BMVelocityAnimate(menuNode, {scaleX: 1, scaleY: 1, opacity: 1, translateZ: 0, translateY: 0, translateX: 0}, {
893
894
  duration,
894
895
  easing,
895
- complete: _ => ((menuNode.style.pointerEvents = 'all'), menuContainer.style.pointerEvents = 'all')
896
+ complete: _ => {
897
+ menuNode.style.pointerEvents = 'all';
898
+ menuContainer.style.pointerEvents = 'all';
899
+ }
896
900
  }, BMMENU_USE_WEB_ANIMATIONS);
897
901
 
898
902
  // Animate each child node in
899
903
  let delay = 50;
900
- for (let child of menuNode.childNodes) {
904
+ let delayIncrement = Math.min(16, 100 / menuNode.childNodes.length);
905
+
906
+ for (let i = 0; i < menuNode.childNodes.length; i++) {
907
+ const child = menuNode.childNodes[i];
901
908
  BMHook(child, {translateY: '16px', translateZ: 0, opacity: 0});
902
909
  __BMVelocityAnimate(child, {translateY: '0px', translateZ: 0, opacity: 1}, {
903
910
  duration: 100,
904
911
  easing: 'easeOutQuad',
905
- delay: delay
912
+ delay: delay,
913
+ complete: i == menuNode.childNodes.length - 1 ? () => {
914
+ menuNode.style.overflow = '';
915
+ } : undefined,
906
916
  }, BMMENU_USE_WEB_ANIMATIONS);
907
- delay += 16;
917
+ delay += delayIncrement;
908
918
  }
909
919
 
910
920
  // Retain the preivously focused node, to restore its focus when the menu closes
@@ -1008,7 +1018,7 @@ BMMenu.prototype = {
1008
1018
  if (point.x > windowWidth / 2) {
1009
1019
  transformOriginX = '100%';
1010
1020
 
1011
- menuNode.style.maxWidth = point.x + 'px';
1021
+ menuNode.style.maxWidth = rect.origin.x + 'px';
1012
1022
  point.x = rect.origin.x - width;
1013
1023
  }
1014
1024
  else {
@@ -1020,7 +1030,7 @@ BMMenu.prototype = {
1020
1030
  if (point.y > windowHeight / 2) {
1021
1031
  transformOriginY = ' 100%';
1022
1032
 
1023
- menuNode.style.maxHeight = point.y + 'px';
1033
+ menuNode.style.maxHeight = rect.bottom + 'px';
1024
1034
  point.y = Math.max(rect.bottom + paddingBottom - height, 0);
1025
1035
  }
1026
1036
  else {
@@ -1035,22 +1045,32 @@ BMMenu.prototype = {
1035
1045
  menuNode.style.top = point.y + 'px';
1036
1046
 
1037
1047
  // Animate the menu in
1048
+ menuNode.style.overflow = 'hidden';
1038
1049
  (window.Velocity || $.Velocity).animate(menuNode, {scaleX: 1, scaleY: 1, opacity: 1, translateZ: 0}, {
1039
1050
  duration: 200,
1040
1051
  easing: 'easeOutQuad',
1041
- complete: _ => ((menuNode.style.pointerEvents = 'all'), menuContainer.style.pointerEvents = 'all')
1052
+ complete: _ => {
1053
+ menuNode.style.pointerEvents = 'all';
1054
+ menuContainer.style.pointerEvents = 'all';
1055
+ }
1042
1056
  });
1043
1057
 
1044
1058
  // Animate each menu item in
1045
1059
  let delay = 0;
1046
- for (let child of menuNode.childNodes) {
1060
+ let delayIncrement = Math.min(16, 100 / menuNode.childNodes.length);
1061
+
1062
+ for (let i = 0; i < menuNode.childNodes.length; i++) {
1063
+ const child = menuNode.childNodes[i];
1047
1064
  BMHook(child, {translateY: '16px', translateZ: 0, opacity: 0});
1048
1065
  (window.Velocity || $.Velocity).animate(child, {translateY: '0px', translateZ: 0, opacity: 1}, {
1049
1066
  duration: 100,
1050
1067
  easing: 'easeOutQuad',
1051
- delay: delay
1068
+ delay: delay,
1069
+ complete: i == menuNode.childNodes.length - 1 ? () => {
1070
+ menuNode.style.overflow = '';
1071
+ } : undefined,
1052
1072
  });
1053
- delay += 16;
1073
+ delay += delayIncrement;
1054
1074
  }
1055
1075
 
1056
1076
  // Retain the preivously focused node, to restore its focus when the menu closes
@@ -1367,6 +1387,8 @@ BMMenu.prototype = {
1367
1387
 
1368
1388
  this._isSupermenuClosing = NO;
1369
1389
 
1390
+ this._node.style.pointerEvents = 'none';
1391
+
1370
1392
  __BMVelocityAnimate(this._node, {
1371
1393
  scaleX: this._kind == BMMenuKind.PullDownMenu ? 1 : scale,
1372
1394
  scaleY: scale,