bm-core-ui 2.12.0-beta.10 → 2.12.0-beta.12

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.
@@ -5838,6 +5838,12 @@ export class BMDragSession implements EventHandlerObject {
5838
5838
  */
5839
5839
  readonly transferKind?: BMDragTransferKind | null | undefined;
5840
5840
 
5841
+ /**
5842
+ * Set to `YES` after this drag session finishes.
5843
+ *
5844
+ */
5845
+ private _finished: boolean;
5846
+
5841
5847
  /**
5842
5848
  * Sets up the drag previews and indicator and appropriate event handlers and starts tracking
5843
5849
  * a drag originating from the event with which this drag session was initialized.
@@ -5902,6 +5908,22 @@ export class BMDragSession implements EventHandlerObject {
5902
5908
  private _setDropTarget(target?: BMView | null | undefined): void;
5903
5909
 
5904
5910
 
5911
+ /**
5912
+ * Causes this drag session to request a new drop action from its delegate if no
5913
+ * drop session is currently active, then set it as the current drop action.
5914
+ *
5915
+ */
5916
+ invalidateDropAction(): void;
5917
+
5918
+
5919
+ /**
5920
+ * Causes this drag session to request a new drop action from its delegate if the specified drop session
5921
+ * is the currently active one, then set it as the current action for the this session.
5922
+ *
5923
+ */
5924
+ private _invalidateDropActionForDropSession(): void;
5925
+
5926
+
5905
5927
  /**
5906
5928
  * Updates the drop action displayed by this drag session, based on the current
5907
5929
  * source and target drop actions.
@@ -5997,6 +6019,15 @@ export class BMDropSession {
5997
6019
  */
5998
6020
  readonly dropAction: BMDropSessionAction;
5999
6021
 
6022
+ /**
6023
+ * Causes this drop session to request a new drop action from its delegate if it
6024
+ * is the current active drop session for the current drag session, then set it as the current action
6025
+ * for the drag session.
6026
+ *
6027
+ */
6028
+ invalidateDropAction(): void;
6029
+
6030
+
6000
6031
  /**
6001
6032
  * An array of drop previews that can be used to customize the drop animation. This property is only
6002
6033
  * initialized at the end of accepted drop sessions if the delegate object implemented the
@@ -3582,13 +3582,20 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
3582
3582
  // If this collection view was already waiting for the data set to insert some data from a drop,
3583
3583
  // play the generic drop animation for those previews
3584
3584
  if (this._dropPreviews) {
3585
- for (const preview of this._dropPreviews) {
3586
- preview.performDrop();
3587
- }
3585
+ BMAnimateWithBlock(() => {
3586
+ for (const preview of this._dropPreviews) {
3587
+ preview.performDrop();
3588
+ }
3589
+ }, {duration: 300, easing: 'easeInQuad'});
3588
3590
  }
3589
3591
 
3590
3592
  // If there are no items to accept, don't perform any other changes
3591
3593
  if (!session.dropItems.length) {
3594
+ BMAnimateWithBlock(() => {
3595
+ for (const preview of session.dropPreviews) {
3596
+ preview.performDrop();
3597
+ }
3598
+ }, {duration: 300, easing: 'easeInQuad'});
3592
3599
  return;
3593
3600
  }
3594
3601
 
@@ -3625,9 +3632,12 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
3625
3632
  this._dropPreviews = undefined;
3626
3633
  }
3627
3634
 
3628
- for (const preview of dropPreviews) {
3629
- preview.performDrop();
3630
- }
3635
+ BMAnimateWithBlock(() => {
3636
+ for (const preview of dropPreviews) {
3637
+ preview.performDrop();
3638
+ }
3639
+ }, {duration: 300, easing: 'easeInQuad'});
3640
+
3631
3641
  }
3632
3642
  }, _BMCollectionViewAsynchronousDropDelay);
3633
3643
  }
@@ -6811,7 +6821,10 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
6811
6821
  self.scrollOffset = offset;
6812
6822
 
6813
6823
  if (!currentContext) {
6814
- BMAnimationApply();
6824
+ return BMAnimationApply();
6825
+ }
6826
+ else {
6827
+ return new Promise(resolve => BMAnimationContextAddCompletionHandler(resolve));
6815
6828
  }
6816
6829
  }
6817
6830
  else {
@@ -375,6 +375,11 @@ BMDragSession.prototype = {
375
375
  return this._transferKind;
376
376
  },
377
377
 
378
+ /**
379
+ * Set to `YES` after this drag session finishes.
380
+ */
381
+ _finished: NO, // <Boolean>
382
+
378
383
  /**
379
384
  * Sets up the drag previews and indicator and appropriate event handlers and starts tracking
380
385
  * a drag originating from the event with which this drag session was initialized.
@@ -586,6 +591,8 @@ BMDragSession.prototype = {
586
591
  async _dragDidFinishWithEvent(event) {
587
592
  event.preventDefault();
588
593
 
594
+ this._finished = YES;
595
+
589
596
  this._action = this._dropAction;
590
597
 
591
598
  // Instruct the delegates that the session is about to end
@@ -855,7 +862,7 @@ BMDragSession.prototype = {
855
862
  const session = this._dropSessions.get(target);
856
863
  session._delegate.dropSessionDidEnter?.(session);
857
864
 
858
- let action = session._delegate.dropSessionDidUpdate?.(this) ?? BMDropSessionAction.actionWithKind(BMDropSessionActionKind.Ignore);
865
+ let action = session._delegate.dropSessionDidUpdate?.(session) ?? BMDropSessionAction.actionWithKind(BMDropSessionActionKind.Ignore);
859
866
 
860
867
  // If the target action is delete, the source delegate must be able to specify
861
868
  // a transfer of kind move
@@ -912,6 +919,48 @@ BMDragSession.prototype = {
912
919
  }, 16);
913
920
  },
914
921
 
922
+
923
+ /**
924
+ * Causes this drag session to request a new drop action from its delegate if no
925
+ * drop session is currently active, then set it as the current drop action.
926
+ */
927
+ invalidateDropAction() {
928
+ if (this._finished || this._dropTarget && this._dropTarget != this._sourceView) {
929
+ return;
930
+ }
931
+
932
+ // Dispatch an update to the source view then update the drop action accordingly
933
+ const sourceAction = this._delegate.dragSessionDidUpdate?.(this);
934
+ if (sourceAction) {
935
+ this._sourceDropAction = sourceAction;
936
+ this._updateDropAction();
937
+ }
938
+ },
939
+
940
+
941
+ /**
942
+ * Causes this drag session to request a new drop action from its delegate if the specified drop session
943
+ * is the currently active one, then set it as the current action for the this session.
944
+ */
945
+ _invalidateDropActionForDropSession(session) {
946
+ if (this._finished || !this._dropTarget || this._dropTarget == this._sourceView) {
947
+ return;
948
+ }
949
+
950
+ const dropSession = this._dropSessions.get(this._dropTarget);
951
+ if (dropSession != session) {
952
+ return;
953
+ }
954
+
955
+ // Dispatch an update to the target view then update the drop action accordingly
956
+ const targetAction = session._delegate.dropSessionDidUpdate?.(session) ?? BMDropSessionAction.actionWithKind(BMDropSessionActionKind.Ignore);
957
+ if (targetAction) {
958
+ session._dropAction = targetAction;
959
+ this._targetDropAction = targetAction;
960
+ this._updateDropAction();
961
+ }
962
+ },
963
+
915
964
  /**
916
965
  * Updates the drop action displayed by this drag session, based on the current
917
966
  * source and target drop actions.
@@ -1109,6 +1158,15 @@ BMDropSession.prototype = {
1109
1158
  return this._dropAction;
1110
1159
  },
1111
1160
 
1161
+ /**
1162
+ * Causes this drop session to request a new drop action from its delegate if it
1163
+ * is the current active drop session for the current drag session, then set it as the current action
1164
+ * for the drag session.
1165
+ */
1166
+ invalidateDropAction() {
1167
+ this._dragSession._invalidateDropActionForDropSession(this);
1168
+ },
1169
+
1112
1170
  /**
1113
1171
  * An array of drop previews that can be used to customize the drop animation. This property is only
1114
1172
  * initialized at the end of accepted drop sessions if the delegate object implemented the
@@ -1282,7 +1282,9 @@ BMMenu.prototype = {
1282
1282
  // If the mouse pointer enters the submenu's frame, cause it to acquire focus
1283
1283
  // and resume events
1284
1284
  if (submenuFrame.intersectsPoint(currentPosition)) {
1285
- submenu._node.focus();
1285
+ if (submenu._node) {
1286
+ submenu._node.focus();
1287
+ }
1286
1288
  resumeEvents();
1287
1289
  return;
1288
1290
  }
@@ -5838,6 +5838,12 @@ declare class BMDragSession implements EventHandlerObject {
5838
5838
  */
5839
5839
  readonly transferKind?: BMDragTransferKind | null | undefined;
5840
5840
 
5841
+ /**
5842
+ * Set to `YES` after this drag session finishes.
5843
+ *
5844
+ */
5845
+ private _finished: boolean;
5846
+
5841
5847
  /**
5842
5848
  * Sets up the drag previews and indicator and appropriate event handlers and starts tracking
5843
5849
  * a drag originating from the event with which this drag session was initialized.
@@ -5902,6 +5908,22 @@ declare class BMDragSession implements EventHandlerObject {
5902
5908
  private _setDropTarget(target?: BMView | null | undefined): void;
5903
5909
 
5904
5910
 
5911
+ /**
5912
+ * Causes this drag session to request a new drop action from its delegate if no
5913
+ * drop session is currently active, then set it as the current drop action.
5914
+ *
5915
+ */
5916
+ invalidateDropAction(): void;
5917
+
5918
+
5919
+ /**
5920
+ * Causes this drag session to request a new drop action from its delegate if the specified drop session
5921
+ * is the currently active one, then set it as the current action for the this session.
5922
+ *
5923
+ */
5924
+ private _invalidateDropActionForDropSession(): void;
5925
+
5926
+
5905
5927
  /**
5906
5928
  * Updates the drop action displayed by this drag session, based on the current
5907
5929
  * source and target drop actions.
@@ -5997,6 +6019,15 @@ declare class BMDropSession {
5997
6019
  */
5998
6020
  readonly dropAction: BMDropSessionAction;
5999
6021
 
6022
+ /**
6023
+ * Causes this drop session to request a new drop action from its delegate if it
6024
+ * is the current active drop session for the current drag session, then set it as the current action
6025
+ * for the drag session.
6026
+ *
6027
+ */
6028
+ invalidateDropAction(): void;
6029
+
6030
+
6000
6031
  /**
6001
6032
  * An array of drop previews that can be used to customize the drop animation. This property is only
6002
6033
  * initialized at the end of accepted drop sessions if the delegate object implemented the