bm-core-ui 2.11.9-beta.2 → 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.
Files changed (62) hide show
  1. package/README.md +1 -1
  2. package/build/@types/index.d.ts +2268 -71
  3. package/build/BMCollectionView/BMCollectionView.js +1070 -235
  4. package/build/BMCollectionView/BMCollectionViewFlowLayout.js +11 -4
  5. package/build/BMCollectionView/BMCollectionViewLayout.js +19 -0
  6. package/build/BMCoreUI.css +213 -44
  7. package/build/BMView/BMDragSession.js +1243 -0
  8. package/build/BMView/BMDragSessionActions.js +121 -0
  9. package/build/BMView/BMDragSessionPreview.js +1650 -0
  10. package/build/BMView/BMLayoutConstraint_v2.5.js +14 -59
  11. package/build/BMView/BMMenu.js +50 -20
  12. package/build/BMView/BMView_v2.5.js +34 -3
  13. package/build/BMWindow/BMPopover/BMPopover.js +35 -20
  14. package/build/BMWindow/BMToolWindow.js +29 -1
  15. package/build/BMWindow/BMWindow.js +128 -65
  16. package/build/images/AlignBottom.png +0 -0
  17. package/build/images/AlignCenterX.png +0 -0
  18. package/build/images/AlignCenterY.png +0 -0
  19. package/build/images/AlignLeading.png +0 -0
  20. package/build/images/AlignTop.png +0 -0
  21. package/build/images/AlignTrailing.png +0 -0
  22. package/build/images/AllConstraints.png +0 -0
  23. package/build/images/BottomConstraint.png +0 -0
  24. package/build/images/CenterXConstraint.png +0 -0
  25. package/build/images/CenterYConstraint.png +0 -0
  26. package/build/images/CoreUI2.png +0 -0
  27. package/build/images/CoreUI2@2x.png +0 -0
  28. package/build/images/Desktop.png +0 -0
  29. package/build/images/DesktopMini.png +0 -0
  30. package/build/images/EqualHeight.png +0 -0
  31. package/build/images/EqualHorizontalSpacing.png +0 -0
  32. package/build/images/EqualHorizontalSpacingInSuperview.png +0 -0
  33. package/build/images/EqualVerticalSpacing.png +0 -0
  34. package/build/images/EqualVerticalSpacingInSuperview.png +0 -0
  35. package/build/images/EqualWidth.png +0 -0
  36. package/build/images/HeightConstraint.png +0 -0
  37. package/build/images/InactiveConstraints.png +0 -0
  38. package/build/images/Layout.png +0 -0
  39. package/build/images/LayoutVariables.png +0 -0
  40. package/build/images/LeftConstraint.png +0 -0
  41. package/build/images/OwnConstraints.png +0 -0
  42. package/build/images/Phone.png +0 -0
  43. package/build/images/PhoneLandscape.png +0 -0
  44. package/build/images/PhoneLandscapeMini.png +0 -0
  45. package/build/images/PhoneMini.png +0 -0
  46. package/build/images/PhonePortrait.png +0 -0
  47. package/build/images/PhonePortraitMini.png +0 -0
  48. package/build/images/Properties.png +0 -0
  49. package/build/images/RightConstraint.png +0 -0
  50. package/build/images/SubviewConstraints.png +0 -0
  51. package/build/images/Tablet.png +0 -0
  52. package/build/images/TabletLandscape.png +0 -0
  53. package/build/images/TabletLandscapeMini.png +0 -0
  54. package/build/images/TabletMini.png +0 -0
  55. package/build/images/TabletPortrait.png +0 -0
  56. package/build/images/TabletPortraitMini.png +0 -0
  57. package/build/images/TopConstraint.png +0 -0
  58. package/build/images/WidthConstraint.png +0 -0
  59. package/build/index.js +4 -0
  60. package/lib/@types/BMCoreUI.min.d.ts +2268 -71
  61. package/lib/BMCoreUI.min.js +1 -1
  62. package/package.json +3 -3
@@ -3,7 +3,7 @@
3
3
  import {YES, NO, BMExtend, BMCopyProperties} from '../Core/BMCoreUI'
4
4
  import {BMPointMake} from '../Core/BMPoint'
5
5
  import {BMRectMake, BMRectMakeWithNodeFrame, BMRectMakeWithOrigin} from '../Core/BMRect'
6
- import {BMAnimateWithBlock, BMAnimationContextGetCurrent, BMAnimationContextEnableWebAnimations, __BMVelocityAnimate, BMHook} from '../Core/BMAnimationContext'
6
+ import {BMAnimateWithBlock, BMAnimationContextGetCurrent, BMAnimationContextEnableWebAnimations, __BMVelocityAnimate, BMHook, BMAnimationContextBeginStatic, BMAnimationApply, BMAnimationBeginWithDuration, BMAnimationContextAddCompletionHandler} from '../Core/BMAnimationContext'
7
7
  import {BMView, BMViewColorScheme} from '../BMView/BMView_v2.5'
8
8
  import {BMLayoutOrientation} from '../BMView/BMLayoutSizeClass'
9
9
  import { BMSizeMake } from '../Core/BMSize'
@@ -746,16 +746,30 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
746
746
  set frame(frame) {
747
747
  if (this._fullScreen) return;
748
748
 
749
+ const currentFrame = this._frame ?? frame;
750
+
749
751
  frame = frame.integralRect;
750
752
 
751
753
  this._frame = frame.copy();
752
754
 
753
- BMCopyProperties(this._window.style, {
754
- left: frame.origin.x + 'px',
755
- top: frame.origin.y + 'px',
756
- width: frame.size.width + 'px',
757
- height: frame.size.height + 'px'
758
- });
755
+ let context = BMAnimationContextGetCurrent();
756
+ if (context) {
757
+ const controller = context.controllerForObject(this, {node: this._window});
758
+ controller.registerBuiltInPropertiesWithDictionary({
759
+ left: [frame.origin.x + 'px', currentFrame.origin.x + 'px'],
760
+ top: [frame.origin.y + 'px', currentFrame.origin.y + 'px'],
761
+ width: [frame.size.width + 'px', currentFrame.size.width + 'px'],
762
+ height: [frame.size.height + 'px', currentFrame.size.height + 'px']
763
+ });
764
+ }
765
+ else {
766
+ BMCopyProperties(this._window.style, {
767
+ left: frame.origin.x + 'px',
768
+ top: frame.origin.y + 'px',
769
+ width: frame.size.width + 'px',
770
+ height: frame.size.height + 'px'
771
+ });
772
+ }
759
773
 
760
774
  switch (this.frameHorizontalPositionLayoutAttribute) {
761
775
  case BMLayoutAttribute.Left:
@@ -849,6 +863,26 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
849
863
  return this._toolbar;
850
864
  },
851
865
 
866
+ /**
867
+ * Defined for non-modal windows. The drag handle used to resize the window.
868
+ */
869
+ _dragHandle: undefined, // <DOMNode>
870
+
871
+ /**
872
+ * Controls whether the window resize handle appears.
873
+ */
874
+ _resizable: YES, // <Boolean>
875
+
876
+ get resizable() {
877
+ return this._resizable;
878
+ },
879
+ set resizable(resizable) {
880
+ if (this._dragHandle) {
881
+ this._dragHandle.style.display = resizable ? 'block' : 'none';
882
+ }
883
+ this._resizable = resizable;
884
+ },
885
+
852
886
  /**
853
887
  * The window overlay.
854
888
  */
@@ -1069,7 +1103,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1069
1103
  this.widthConstraint.isActive = YES;
1070
1104
  this.heightConstraint.isActive = YES;
1071
1105
 
1072
- if (!modal && withToolbar) {
1106
+ if (!modal) {
1073
1107
  // In non-modal mode, allow the toolbar to move the window
1074
1108
  this.maxLeftConstraint = this.left.greaterThanOrEqualTo(0);
1075
1109
  this.maxTopConstraint = this.top.greaterThanOrEqualTo(0);
@@ -1086,7 +1120,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1086
1120
  window.addEventListener('resize', this._boundViewportDidResize = this._viewportDidResize.bind(this));
1087
1121
 
1088
1122
  // Initialize dragging touch events for the toolbar
1089
- this._toolbar.addEventListener('mousedown', event => {
1123
+ this._toolbar?.addEventListener('mousedown', event => {
1090
1124
  // Don't process events originating from children of the toolbar
1091
1125
  if (event.target != this._toolbar) return;
1092
1126
 
@@ -1130,7 +1164,7 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1130
1164
 
1131
1165
  let touchDragPoint;
1132
1166
 
1133
- this._toolbar.addEventListener('touchstart', /** @type {TouchEvent} */ event => {
1167
+ this._toolbar?.addEventListener('touchstart', /** @type {TouchEvent} */ event => {
1134
1168
  // If there is already a drag in progress, don't process this new event
1135
1169
  if (typeof touchDragPoint !== 'undefined') {
1136
1170
  return;
@@ -1194,11 +1228,11 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1194
1228
  event.preventDefault();
1195
1229
  });
1196
1230
 
1197
- this._toolbar.addEventListener('dbclick', event => {
1231
+ this._toolbar?.addEventListener('dbclick', event => {
1198
1232
  this.minimizeAnimated(YES);
1199
1233
  });
1200
1234
 
1201
- this._toolbar.addEventListener('wheel', /** @param {WheelEvent} event */ event => {
1235
+ this._toolbar?.addEventListener('wheel', /** @param {WheelEvent} event */ event => {
1202
1236
  // Scrolling on the toolbar should enter showcase
1203
1237
  if (event.deltaY > 0) {
1204
1238
  // Allow the delegate to suppress this behaviour
@@ -1918,9 +1952,6 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1918
1952
 
1919
1953
  animated = (animated === undefined ? YES : animated);
1920
1954
 
1921
- //__BMVelocityAnimate(this._blocker, 'stop');
1922
- //__BMVelocityAnimate(this._window, 'stop');
1923
-
1924
1955
  var self = this;
1925
1956
 
1926
1957
  this._blocker.style.pointerEvents = 'none';
@@ -1931,8 +1962,11 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1931
1962
  }
1932
1963
  this._visible = NO;
1933
1964
 
1965
+ // Dismiss all associated tool windows if they are visible
1934
1966
  for (let window of this._toolWindows) {
1935
- window.dismissAnimated(animated);
1967
+ if (window._visible) {
1968
+ window.dismissAnimated(animated);
1969
+ }
1936
1970
  }
1937
1971
 
1938
1972
  if (animated) {
@@ -1941,10 +1975,6 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
1941
1975
  duration: _BMWindowAnimationDurationDefault,
1942
1976
  easing: _BMWindowAnimationEasingDefault,
1943
1977
  display: 'none',
1944
- /*progress: function (elements, complete) {
1945
- self._blocker.style.webkitBackdropFilter = 'blur(' + ((1 - complete) * 15).toFixed(2) + 'px)';
1946
- self._blocker.style.backdropFilter = 'blur(' + ((1 - complete) * 15).toFixed(2) + 'px)';
1947
- },*/
1948
1978
  complete: function () {
1949
1979
  self.windowDidClose();
1950
1980
  if (self.delegate && self.delegate.windowDidClose) {
@@ -2195,7 +2225,15 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
2195
2225
  duration: _BMWindowAnimationDurationDefault,
2196
2226
  easing: _BMWindowAnimationEasingDefault,
2197
2227
  display: 'block'
2198
- }, YES);
2228
+ }, YES)?.then(() => {
2229
+ BMHook(this._window, {
2230
+ opacity: 1,
2231
+ translateX: '0px',
2232
+ translateY: '0px',
2233
+ scaleX: 1,
2234
+ scaleY: 1
2235
+ });
2236
+ });
2199
2237
 
2200
2238
  const title = animationNode.querySelector('span');
2201
2239
  __BMVelocityAnimate(title, {translateX: ['30px', '0px']}, {duration: _BMWindowAnimationDurationDefault, easing: _BMWindowAnimationEasingDefault}, YES);
@@ -2242,30 +2280,48 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
2242
2280
 
2243
2281
  var self = this;
2244
2282
 
2283
+ BMAnimationContextBeginStatic();
2284
+
2245
2285
  this.widthConstraint.constant = window.innerWidth;
2246
2286
  this.heightConstraint.constant = window.innerHeight;
2247
2287
  this.leftConstraint.constant = 0;
2248
2288
  this.topConstraint.constant = 0;
2289
+
2290
+ BMAnimationApply();
2249
2291
 
2250
2292
  if (animated) {
2251
- BMAnimateWithBlock(() => {
2252
- let controller = BMAnimationContextGetCurrent().controllerForObject(this, {node: this.node});
2253
- controller.registerBuiltInPropertiesWithDictionary({left: '0px', top: '0px', width: window.innerWidth + 'px', height: window.innerHeight + 'px'});
2293
+ const completionHandler = function () {
2294
+ if (self.delegate && self.delegate.windowDidEnterFullScreen) self.delegate.windowDidEnterFullScreen(self);
2295
+ if (args && args.completionHandler) args.completionHandler();
2296
+
2297
+ self._window.classList.add('BMFullScreenWindow');
2298
+ };
2299
+
2300
+ // If an animation context is already started, reuse it
2301
+ let contextStarted = NO;
2302
+ if (!BMAnimationContextGetCurrent()) {
2303
+ contextStarted = YES;
2304
+ BMAnimationBeginWithDuration(300, {duration: 300, easing: 'easeInOutQuart',
2305
+ complete: completionHandler
2306
+ });
2307
+ }
2308
+ else {
2309
+ BMAnimationContextAddCompletionHandler(completionHandler);
2310
+ }
2254
2311
 
2255
- const frame = this.frame.copy();
2256
- this.layout();
2312
+ let controller = BMAnimationContextGetCurrent().controllerForObject(this, {node: this.node});
2257
2313
 
2258
- // When the window contains elements whose intrinsic size must be measured, upon finishing the layout, the window will continue to keep its
2259
- // temporary frame used for measuring, so it has to be reset prior to the animation starting
2260
- BMCopyProperties(this.node.style, {left: frame.origin.x + 'px', top: frame.origin.y + 'px', width: frame.size.width + 'px', height: frame.size.height + 'px'})
2261
- }, {duration: 300, easing: 'easeInOutQuart',
2262
- complete: function () {
2263
- if (self.delegate && self.delegate.windowDidEnterFullScreen) self.delegate.windowDidEnterFullScreen(self);
2264
- if (args && args.completionHandler) args.completionHandler();
2265
-
2266
- self._window.classList.add('BMFullScreenWindow');
2267
- }
2268
- });
2314
+ const frame = this.frame.copy();
2315
+ this.layout();
2316
+ controller.registerBuiltInPropertiesWithDictionary({left: '0px', top: '0px', width: window.innerWidth + 'px', height: window.innerHeight + 'px'});
2317
+
2318
+ // When the window contains elements whose intrinsic size must be measured, upon finishing the layout, the window will continue to keep its
2319
+ // temporary frame used for measuring, so it has to be reset prior to the animation starting
2320
+ BMCopyProperties(this.node.style, {left: frame.origin.x + 'px', top: frame.origin.y + 'px', width: frame.size.width + 'px', height: frame.size.height + 'px'})
2321
+
2322
+ if (contextStarted) {
2323
+ BMAnimationApply();
2324
+ }
2269
2325
  }
2270
2326
  else {
2271
2327
  self._window.classList.add('BMFullScreenWindow');
@@ -2300,44 +2356,51 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
2300
2356
 
2301
2357
  var self = this;
2302
2358
 
2359
+ BMAnimationContextBeginStatic();
2360
+
2303
2361
  this.widthConstraint.constant = this.frame.width;
2304
2362
  this.heightConstraint.constant = this.frame.height;
2305
2363
  this.leftConstraint.constant = this.frame.left;
2306
2364
  this.topConstraint.constant = this.frame.top;
2365
+
2366
+ BMAnimationApply();
2307
2367
 
2308
2368
  if (animated) {
2309
2369
  self._window.classList.remove('BMFullScreenWindow');
2310
2370
  var frame = self.frame;
2311
2371
  BMCopyProperties(self._window.style, {left: '0px', top: '0px', width: window.innerWidth + 'px', height: window.innerHeight + 'px'});
2312
- /*__BMVelocityAnimate(this._window, {left: frame.origin.x + 'px', top: frame.origin.y + 'px', width: frame.size.width + 'px', height: frame.size.height + 'px'}, {
2313
- duration: 300,
2314
- easing: 'easeInOutQuart',
2315
- complete: function () {
2316
- if (self.delegate && self.delegate.windowDidExitFullScreen) self.delegate.windowDidExitFullScreen(self);
2317
- if (args && args.completionHandler) args.completionHandler();
2318
-
2319
- self.frame = self.frame;
2320
- }
2321
- });*/
2322
2372
 
2323
- BMAnimateWithBlock(() => {
2324
- let controller = BMAnimationContextGetCurrent().controllerForObject(this, {node: this.node});
2325
- controller.registerBuiltInProperty('left', {withValue: frame.origin.x + 'px'});
2326
- controller.registerBuiltInProperty('top', {withValue: frame.origin.y + 'px'});
2327
- controller.registerBuiltInProperty('width', {withValue: frame.size.width + 'px'});
2328
- controller.registerBuiltInProperty('height', {withValue: frame.size.height + 'px'});
2329
- this._fullScreen = NO;
2330
- this.layout();
2331
- BMCopyProperties(self._window.style, {left: '0px', top: '0px', width: window.innerWidth + 'px', height: window.innerHeight + 'px'});
2332
- }, {
2333
- duration: 300, easing: 'easeInOutQuart',
2334
- complete: function () {
2335
- if (self.delegate && self.delegate.windowDidExitFullScreen) self.delegate.windowDidExitFullScreen(self);
2336
- if (args && args.completionHandler) args.completionHandler();
2337
-
2338
- self.frame = self.frame;
2339
- }
2340
- });
2373
+ const completionHandler = function () {
2374
+ if (self.delegate && self.delegate.windowDidExitFullScreen) self.delegate.windowDidExitFullScreen(self);
2375
+ if (args && args.completionHandler) args.completionHandler();
2376
+
2377
+ self.frame = self.frame;
2378
+ };
2379
+
2380
+ // If an animation context is already started, reuse it
2381
+ let contextStarted = NO;
2382
+ if (!BMAnimationContextGetCurrent()) {
2383
+ contextStarted = YES;
2384
+ BMAnimationBeginWithDuration(300, {duration: 300, easing: 'easeInOutQuart',
2385
+ complete: completionHandler
2386
+ });
2387
+ }
2388
+ else {
2389
+ BMAnimationContextAddCompletionHandler(completionHandler);
2390
+ }
2391
+
2392
+ this._fullScreen = NO;
2393
+ this.layout();
2394
+ let controller = BMAnimationContextGetCurrent().controllerForObject(this, {node: this.node});
2395
+ controller.registerBuiltInProperty('left', {withValue: frame.origin.x + 'px'});
2396
+ controller.registerBuiltInProperty('top', {withValue: frame.origin.y + 'px'});
2397
+ controller.registerBuiltInProperty('width', {withValue: frame.size.width + 'px'});
2398
+ controller.registerBuiltInProperty('height', {withValue: frame.size.height + 'px'});
2399
+ BMCopyProperties(self._window.style, {left: '0px', top: '0px', width: window.innerWidth + 'px', height: window.innerHeight + 'px'});
2400
+
2401
+ if (contextStarted) {
2402
+ BMAnimationApply();
2403
+ }
2341
2404
  }
2342
2405
  else {
2343
2406
  self._window.classList.remove('BMFullScreenWindow');
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/build/index.js CHANGED
@@ -9,6 +9,10 @@ export * from './Core/BMIndexPath'
9
9
  export * from './Core/BMKeyPath'
10
10
  export * from './Core/BMColor'
11
11
 
12
+ export * from './BMView/BMDragSession';
13
+ export {BMDragPreview} from './BMView/BMDragSessionPreview';
14
+ export {BMDragSessionActionKind, BMDropSessionActionKind} from './BMView/BMDragSessionActions';
15
+
12
16
  export * from './BMView/BMLayoutSizeClass'
13
17
  export * from './BMView/BMViewport'
14
18
  export * from './BMView/BMLayoutConstraint_v2.5'