bm-core-ui 2.11.0 → 2.11.1
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
CHANGED
|
@@ -13920,6 +13920,51 @@ export class BMWindow extends BMView {
|
|
|
13920
13920
|
initWithFrame(frame: BMRect, {toolbar, modal}?: {toolbar?: boolean | null | undefined, modal?: boolean | null | undefined}): BMWindow;
|
|
13921
13921
|
|
|
13922
13922
|
|
|
13923
|
+
/**
|
|
13924
|
+
* Starts a drag event from the specified `mousedown` or `touchstart` event that moves this window.
|
|
13925
|
+
* When this method is invoked, further mouse and touch events will be blocked until the drag finishes.
|
|
13926
|
+
*
|
|
13927
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
13928
|
+
* this method has no effect.
|
|
13929
|
+
* @param event The `mousedown` or `touchstart` event from which to begin
|
|
13930
|
+
* the window movement.
|
|
13931
|
+
*
|
|
13932
|
+
*/
|
|
13933
|
+
performDragWithEvent(event: MouseEvent | TouchEvent): void;
|
|
13934
|
+
|
|
13935
|
+
|
|
13936
|
+
/**
|
|
13937
|
+
* Starts a drag event from the specified `mousedown` event that will move this window.
|
|
13938
|
+
* When this method is invoked, further mouse events will be blocked until the drag finishes.
|
|
13939
|
+
*
|
|
13940
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
13941
|
+
* this method has no effect.
|
|
13942
|
+
* @param event The `mousedown` event from which to begin the window movement.
|
|
13943
|
+
*
|
|
13944
|
+
*/
|
|
13945
|
+
performDragWithMouseEvent(event: MouseEvent | TouchEvent): void;
|
|
13946
|
+
|
|
13947
|
+
|
|
13948
|
+
/**
|
|
13949
|
+
* The identifier of the touch point that is tracked during a drag operation. `undefined`
|
|
13950
|
+
* when not tracking a drag.
|
|
13951
|
+
*
|
|
13952
|
+
*/
|
|
13953
|
+
private _touchDragPoint: string;
|
|
13954
|
+
|
|
13955
|
+
/**
|
|
13956
|
+
* Starts a drag event from the specified `touchstart` event that will move this window.
|
|
13957
|
+
* When this method is invoked, further touch events will be blocked until the drag finishes.
|
|
13958
|
+
*
|
|
13959
|
+
*
|
|
13960
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
13961
|
+
* this method has no effect.
|
|
13962
|
+
* @param event The `touchstart` event from which to begin the window movement.
|
|
13963
|
+
*
|
|
13964
|
+
*/
|
|
13965
|
+
performDragWithTouchEvent(event: MouseEvent | TouchEvent): void;
|
|
13966
|
+
|
|
13967
|
+
|
|
13923
13968
|
/**
|
|
13924
13969
|
* Invoked on non-modal windows when the viewport resizes.
|
|
13925
13970
|
* @param event The event that triggered this action.
|
|
@@ -4594,7 +4594,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4594
4594
|
* }
|
|
4595
4595
|
*/
|
|
4596
4596
|
setLayout: function (layout, options) {
|
|
4597
|
-
// If there is an in-progress animated update, schedule this call for
|
|
4597
|
+
// If there is an in-progress animated update, schedule this call for when that update finishes
|
|
4598
4598
|
if (this.isUpdatingData) {
|
|
4599
4599
|
var self = this;
|
|
4600
4600
|
this.registerDataCompletionCallback(function () {
|
|
@@ -4625,7 +4625,8 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4625
4625
|
BMAnimationContextBeginStatic();
|
|
4626
4626
|
|
|
4627
4627
|
let resolveLayoutUpdate;
|
|
4628
|
-
|
|
4628
|
+
const dataUpdatePromise = new Promise($1 => resolveLayoutUpdate = $1);
|
|
4629
|
+
this._dataUpdatePromise = dataUpdatePromise;
|
|
4629
4630
|
|
|
4630
4631
|
// Discard the cached attribute pages
|
|
4631
4632
|
this.attributeCache = {};
|
|
@@ -4916,16 +4917,19 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
4916
4917
|
|
|
4917
4918
|
self._applyOverflows();
|
|
4918
4919
|
|
|
4919
|
-
|
|
4920
|
-
self.
|
|
4920
|
+
// Restore collection invoke the data completion callbacks unless another animation is in progress
|
|
4921
|
+
if (self._dataUpdatePromise == dataUpdatePromise) {
|
|
4922
|
+
self._collectionEnabled = YES;
|
|
4923
|
+
self.isUpdatingData = NO;
|
|
4924
|
+
|
|
4925
|
+
self._executeDataCompletionCallbacks();
|
|
4926
|
+
}
|
|
4927
|
+
|
|
4928
|
+
// If the delegate animation options contains a complete handler, invoke it here
|
|
4929
|
+
if (delegateOptions.complete) delegateOptions.complete();
|
|
4921
4930
|
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
// If the delegate animation options contains a complete handler, invoke it here
|
|
4925
|
-
if (delegateOptions.complete) delegateOptions.complete();
|
|
4926
|
-
|
|
4927
|
-
// Run the completion handler if it was specified
|
|
4928
|
-
if (options && options.completionHandler) options.completionHandler();
|
|
4931
|
+
// Run the completion handler if it was specified
|
|
4932
|
+
if (options && options.completionHandler) options.completionHandler();
|
|
4929
4933
|
|
|
4930
4934
|
resolveLayoutUpdate();
|
|
4931
4935
|
};
|
|
@@ -5152,7 +5156,8 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5152
5156
|
var self = this;
|
|
5153
5157
|
|
|
5154
5158
|
let resolveUpdateData;
|
|
5155
|
-
|
|
5159
|
+
const dataUpdatePromise = new Promise(function (resolve, reject) {resolveUpdateData = resolve});
|
|
5160
|
+
this._dataUpdatePromise = dataUpdatePromise;
|
|
5156
5161
|
|
|
5157
5162
|
// Update the selection index paths
|
|
5158
5163
|
this._updateSelectionIndexPaths();
|
|
@@ -5567,11 +5572,10 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5567
5572
|
}
|
|
5568
5573
|
animationComplete = YES;
|
|
5569
5574
|
|
|
5570
|
-
// Apply the new size now
|
|
5571
|
-
if (
|
|
5575
|
+
// Apply the new size now, unless another animation is in progress
|
|
5576
|
+
if (self._dataUpdatePromise == dataUpdatePromise) {
|
|
5577
|
+
const contentSize = self.layout.contentSize();
|
|
5572
5578
|
self._contentWrapper.css({width: contentSize.width + 'px'});
|
|
5573
|
-
}
|
|
5574
|
-
if (!contentSizeHeightApplied) {
|
|
5575
5579
|
self._contentWrapper.css({height: contentSize.height + 'px'});
|
|
5576
5580
|
}
|
|
5577
5581
|
|
|
@@ -5596,17 +5600,21 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
5596
5600
|
deletedCells[i].recycle();
|
|
5597
5601
|
}
|
|
5598
5602
|
|
|
5599
|
-
|
|
5600
|
-
self.
|
|
5603
|
+
// If another update is not in progress, re-enable scrolling and collection
|
|
5604
|
+
if (self._dataUpdatePromise == dataUpdatePromise) {
|
|
5605
|
+
self._applyOverflows();
|
|
5606
|
+
self._container[0].style.pointerEvents = 'inherit';//.css({'pointer-events': 'inherit'});
|
|
5607
|
+
|
|
5608
|
+
if (self.scrollView) self.scrollView.scrollingEnabled = YES;
|
|
5601
5609
|
|
|
5602
|
-
|
|
5603
|
-
|
|
5604
|
-
self._collectionEnabled = YES;
|
|
5605
|
-
|
|
5606
|
-
// Set the updating flag back to NO
|
|
5607
|
-
self.isUpdatingData = NO;
|
|
5610
|
+
self._collectionEnabled = YES;
|
|
5608
5611
|
|
|
5609
|
-
|
|
5612
|
+
// Set the updating flag back to NO
|
|
5613
|
+
self.isUpdatingData = NO;
|
|
5614
|
+
|
|
5615
|
+
// Only execute data completion callbacks after all pending updates have finished
|
|
5616
|
+
self._executeDataCompletionCallbacks();
|
|
5617
|
+
}
|
|
5610
5618
|
|
|
5611
5619
|
if (options && options.completionHandler) options.completionHandler();
|
|
5612
5620
|
if (delegateOptions.complete) delegateOptions.complete.apply(this, arguments);
|
|
@@ -1075,6 +1075,147 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
1075
1075
|
return this;
|
|
1076
1076
|
},
|
|
1077
1077
|
|
|
1078
|
+
/**
|
|
1079
|
+
* Starts a drag event from the specified `mousedown` or `touchstart` event that moves this window.
|
|
1080
|
+
* When this method is invoked, further mouse and touch events will be blocked until the drag finishes.
|
|
1081
|
+
*
|
|
1082
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
1083
|
+
* this method has no effect.
|
|
1084
|
+
* @param event <MouseEvent | TouchEvent> The `mousedown` or `touchstart` event from which to begin
|
|
1085
|
+
* the window movement.
|
|
1086
|
+
*/
|
|
1087
|
+
performDragWithEvent(event) {
|
|
1088
|
+
if (event.type == 'mousedown') {
|
|
1089
|
+
this.performDragWithMouseEvent(event);
|
|
1090
|
+
}
|
|
1091
|
+
else if (event.type == 'touchstart') {
|
|
1092
|
+
this.performDragWithTouchEvent(event);
|
|
1093
|
+
}
|
|
1094
|
+
},
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Starts a drag event from the specified `mousedown` event that will move this window.
|
|
1098
|
+
* When this method is invoked, further mouse events will be blocked until the drag finishes.
|
|
1099
|
+
*
|
|
1100
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
1101
|
+
* this method has no effect.
|
|
1102
|
+
* @param event <MouseEvent | TouchEvent> The `mousedown` event from which to begin the window movement.
|
|
1103
|
+
*/
|
|
1104
|
+
performDragWithMouseEvent(event) {
|
|
1105
|
+
// Full screen and modal windows cannot be moved
|
|
1106
|
+
if (this._fullScreen) return;
|
|
1107
|
+
|
|
1108
|
+
this._dragged = YES;
|
|
1109
|
+
|
|
1110
|
+
this._position = BMPointMake(this.node.offsetLeft, this.node.offsetTop);
|
|
1111
|
+
let lastPosition = BMPointMake(event.clientX, event.clientY);
|
|
1112
|
+
|
|
1113
|
+
let mouseMoveEventListener = event => {
|
|
1114
|
+
let position = BMPointMake(event.clientX, event.clientY);
|
|
1115
|
+
const newPosition = BMPointMake(this._position.x + position.x - lastPosition.x, this._position.y + position.y - lastPosition.y);
|
|
1116
|
+
|
|
1117
|
+
// Check if the window can move
|
|
1118
|
+
let canMove = YES;
|
|
1119
|
+
if (this.delegate && this.delegate.windowShouldMove) {
|
|
1120
|
+
canMove = this.delegate.windowShouldMove(this, newPosition);
|
|
1121
|
+
}
|
|
1122
|
+
if (!canMove) return;
|
|
1123
|
+
|
|
1124
|
+
this.leftConstraint.constant = this._position.x + position.x - lastPosition.x;
|
|
1125
|
+
this.topConstraint.constant = this._position.y + position.y - lastPosition.y;
|
|
1126
|
+
this._position = newPosition;
|
|
1127
|
+
lastPosition = position;
|
|
1128
|
+
this.layout();
|
|
1129
|
+
event.preventDefault();
|
|
1130
|
+
};
|
|
1131
|
+
|
|
1132
|
+
let mouseUpEventListener = event => {
|
|
1133
|
+
window.removeEventListener('mousemove', mouseMoveEventListener, YES);
|
|
1134
|
+
window.removeEventListener('mouseup', mouseUpEventListener, YES);
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
window.addEventListener('mousemove', mouseMoveEventListener, YES);
|
|
1138
|
+
window.addEventListener('mouseup', mouseUpEventListener, YES);
|
|
1139
|
+
|
|
1140
|
+
event.preventDefault();
|
|
1141
|
+
},
|
|
1142
|
+
|
|
1143
|
+
/**
|
|
1144
|
+
* The identifier of the touch point that is tracked during a drag operation. `undefined`
|
|
1145
|
+
* when not tracking a drag.
|
|
1146
|
+
*/
|
|
1147
|
+
_touchDragPoint: undefined, // <String>
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Starts a drag event from the specified `touchstart` event that will move this window.
|
|
1151
|
+
* When this method is invoked, further touch events will be blocked until the drag finishes.
|
|
1152
|
+
*
|
|
1153
|
+
*
|
|
1154
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
1155
|
+
* this method has no effect.
|
|
1156
|
+
* @param event <MouseEvent | TouchEvent> The `touchstart` event from which to begin the window movement.
|
|
1157
|
+
*/
|
|
1158
|
+
performDragWithTouchEvent(event) {
|
|
1159
|
+
// If there is already a drag in progress, don't process this new event
|
|
1160
|
+
if (typeof this._touchDragPoint !== 'undefined') {
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
|
|
1164
|
+
// Full screen windows cannot be moved
|
|
1165
|
+
if (this._fullScreen) return;
|
|
1166
|
+
|
|
1167
|
+
// Only use the first touch point
|
|
1168
|
+
this._touchDragPoint = event.changedTouches[0].identifier;
|
|
1169
|
+
this._dragged = YES;
|
|
1170
|
+
|
|
1171
|
+
this._position = BMPointMake(this.node.offsetLeft, this.node.offsetTop);
|
|
1172
|
+
let lastPosition = BMPointMake(event.changedTouches[0].clientX, event.changedTouches[0].clientY);
|
|
1173
|
+
|
|
1174
|
+
let mouseMoveEventListener = event => {
|
|
1175
|
+
// Look for the actively tracked touch point
|
|
1176
|
+
let touch;
|
|
1177
|
+
for (let changedTouch of event.changedTouches) {
|
|
1178
|
+
if (changedTouch.identifier == this._touchDragPoint) {
|
|
1179
|
+
touch = changedTouch;
|
|
1180
|
+
break;
|
|
1181
|
+
}
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
// If the actively tracked touch point did not move, do not process this event
|
|
1185
|
+
if (!touch) return;
|
|
1186
|
+
|
|
1187
|
+
let position = BMPointMake(touch.clientX, touch.clientY);
|
|
1188
|
+
const newPosition = BMPointMake(this._position.x + position.x - lastPosition.x, this._position.y + position.y - lastPosition.y);
|
|
1189
|
+
|
|
1190
|
+
// Check if the window can move
|
|
1191
|
+
let canMove = YES;
|
|
1192
|
+
if (this.delegate && this.delegate.windowShouldMove) {
|
|
1193
|
+
canMove = this.delegate.windowShouldMove(this, newPosition);
|
|
1194
|
+
}
|
|
1195
|
+
if (!canMove) return;
|
|
1196
|
+
|
|
1197
|
+
this.leftConstraint.constant = this._position.x + position.x - lastPosition.x;
|
|
1198
|
+
this.topConstraint.constant = this._position.y + position.y - lastPosition.y;
|
|
1199
|
+
this._position = newPosition;
|
|
1200
|
+
lastPosition = position;
|
|
1201
|
+
this.layout();
|
|
1202
|
+
event.preventDefault();
|
|
1203
|
+
};
|
|
1204
|
+
|
|
1205
|
+
let mouseUpEventListener = event => {
|
|
1206
|
+
this._touchDragPoint = undefined;
|
|
1207
|
+
window.removeEventListener('touchmove', mouseMoveEventListener);
|
|
1208
|
+
window.removeEventListener('touchend', mouseUpEventListener);
|
|
1209
|
+
window.removeEventListener('touchcancel', mouseUpEventListener);
|
|
1210
|
+
}
|
|
1211
|
+
|
|
1212
|
+
window.addEventListener('touchmove', mouseMoveEventListener);
|
|
1213
|
+
window.addEventListener('touchend', mouseUpEventListener);
|
|
1214
|
+
window.removeEventListener('touchcancel', mouseUpEventListener);
|
|
1215
|
+
|
|
1216
|
+
event.preventDefault();
|
|
1217
|
+
},
|
|
1218
|
+
|
|
1078
1219
|
// @override - BMView
|
|
1079
1220
|
colorSchemeDidChange(scheme) {
|
|
1080
1221
|
BMView.prototype.colorSchemeDidChange.apply(this, arguments);
|
|
@@ -13920,6 +13920,51 @@ declare class BMWindow extends BMView {
|
|
|
13920
13920
|
initWithFrame(frame: BMRect, {toolbar, modal}?: {toolbar?: boolean | null | undefined, modal?: boolean | null | undefined}): BMWindow;
|
|
13921
13921
|
|
|
13922
13922
|
|
|
13923
|
+
/**
|
|
13924
|
+
* Starts a drag event from the specified `mousedown` or `touchstart` event that moves this window.
|
|
13925
|
+
* When this method is invoked, further mouse and touch events will be blocked until the drag finishes.
|
|
13926
|
+
*
|
|
13927
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
13928
|
+
* this method has no effect.
|
|
13929
|
+
* @param event The `mousedown` or `touchstart` event from which to begin
|
|
13930
|
+
* the window movement.
|
|
13931
|
+
*
|
|
13932
|
+
*/
|
|
13933
|
+
performDragWithEvent(event: MouseEvent | TouchEvent): void;
|
|
13934
|
+
|
|
13935
|
+
|
|
13936
|
+
/**
|
|
13937
|
+
* Starts a drag event from the specified `mousedown` event that will move this window.
|
|
13938
|
+
* When this method is invoked, further mouse events will be blocked until the drag finishes.
|
|
13939
|
+
*
|
|
13940
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
13941
|
+
* this method has no effect.
|
|
13942
|
+
* @param event The `mousedown` event from which to begin the window movement.
|
|
13943
|
+
*
|
|
13944
|
+
*/
|
|
13945
|
+
performDragWithMouseEvent(event: MouseEvent | TouchEvent): void;
|
|
13946
|
+
|
|
13947
|
+
|
|
13948
|
+
/**
|
|
13949
|
+
* The identifier of the touch point that is tracked during a drag operation. `undefined`
|
|
13950
|
+
* when not tracking a drag.
|
|
13951
|
+
*
|
|
13952
|
+
*/
|
|
13953
|
+
private _touchDragPoint: string;
|
|
13954
|
+
|
|
13955
|
+
/**
|
|
13956
|
+
* Starts a drag event from the specified `touchstart` event that will move this window.
|
|
13957
|
+
* When this method is invoked, further touch events will be blocked until the drag finishes.
|
|
13958
|
+
*
|
|
13959
|
+
*
|
|
13960
|
+
* If there is already a drag operation in progress or if this window is full screen or a modal window,
|
|
13961
|
+
* this method has no effect.
|
|
13962
|
+
* @param event The `touchstart` event from which to begin the window movement.
|
|
13963
|
+
*
|
|
13964
|
+
*/
|
|
13965
|
+
performDragWithTouchEvent(event: MouseEvent | TouchEvent): void;
|
|
13966
|
+
|
|
13967
|
+
|
|
13923
13968
|
/**
|
|
13924
13969
|
* Invoked on non-modal windows when the viewport resizes.
|
|
13925
13970
|
* @param event The event that triggered this action.
|