bm-core-ui 2.11.9-beta.2 → 2.12.0-beta.3
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 +8 -1
- package/build/BMCollectionView/BMCollectionView.js +1 -1
- package/build/BMView/BMLayoutConstraint_v2.5.js +14 -59
- package/build/BMView/BMView_v2.5.js +13 -3
- package/build/BMWindow/BMToolWindow.js +29 -1
- package/build/BMWindow/BMWindow.js +4 -8
- package/lib/@types/BMCoreUI.min.d.ts +8 -1
- package/lib/BMCoreUI.min.js +1 -1
- package/package.json +1 -1
package/build/@types/index.d.ts
CHANGED
|
@@ -4585,9 +4585,10 @@ export class BMView {
|
|
|
4585
4585
|
* and handle key presses. Subclasses that override this method should invoke the base implementation to allow
|
|
4586
4586
|
* keyboard shortcuts to be handled correctly.
|
|
4587
4587
|
* @param event The event that triggered this action.
|
|
4588
|
+
* @return `YES` if a keyboard shortcut was handled, `NO` or `undefined` otherwise.
|
|
4588
4589
|
*
|
|
4589
4590
|
*/
|
|
4590
|
-
keyPressedWithEvent(event: KeyboardEvent):
|
|
4591
|
+
keyPressedWithEvent(event: KeyboardEvent): boolean | null | undefined;
|
|
4591
4592
|
|
|
4592
4593
|
|
|
4593
4594
|
/**
|
|
@@ -14327,6 +14328,12 @@ export class BMToolWindow extends BMWindow {
|
|
|
14327
14328
|
*/
|
|
14328
14329
|
opensAutomatically: boolean;
|
|
14329
14330
|
|
|
14331
|
+
/**
|
|
14332
|
+
* The window to which this tool window is associated.
|
|
14333
|
+
*
|
|
14334
|
+
*/
|
|
14335
|
+
private _parentWindow: BMWindow;
|
|
14336
|
+
|
|
14330
14337
|
/**
|
|
14331
14338
|
* Initializes this tool window with the given frame and associates it with the given window.
|
|
14332
14339
|
* @param frame The window's frame.
|
|
@@ -2682,7 +2682,7 @@ BMCollectionView.prototype = BMExtend(BM_COLLECTION_VIEW_USE_BMVIEW_SUBCLASS ? O
|
|
|
2682
2682
|
|
|
2683
2683
|
cellEventCanDoubleClick = NO;
|
|
2684
2684
|
if (self.delegate && self.delegate.collectionViewCanDoubleClickCell) {
|
|
2685
|
-
cellEventCanDoubleClick = self.delegate.collectionViewCanDoubleClickCell(self, cell);
|
|
2685
|
+
cellEventCanDoubleClick = self.delegate.collectionViewCanDoubleClickCell(self, cell, {withEvent: event});
|
|
2686
2686
|
}
|
|
2687
2687
|
|
|
2688
2688
|
if (cellEventCanDoubleClick) cellEventDoubleClickTimeout = window.setTimeout(function () {
|
|
@@ -541,10 +541,12 @@ BMLayoutConstraint.prototype = {
|
|
|
541
541
|
if (this._solver) {
|
|
542
542
|
if (this._constraint) {
|
|
543
543
|
try {
|
|
544
|
-
if (this._solver.hasConstraint(this._constraint))
|
|
544
|
+
if (this._solver.hasConstraint(this._constraint)) {
|
|
545
|
+
this._solver.removeConstraint(this._constraint);
|
|
546
|
+
}
|
|
545
547
|
}
|
|
546
548
|
catch (layoutError) {
|
|
547
|
-
this.
|
|
549
|
+
this._constraint = undefined;
|
|
548
550
|
this._sourceView.rootView._invalidatedConstraints = YES;
|
|
549
551
|
this._sourceView.needsLayout = YES;
|
|
550
552
|
}
|
|
@@ -556,7 +558,7 @@ BMLayoutConstraint.prototype = {
|
|
|
556
558
|
this._solver.addConstraint(this._cassowaryConstraint);
|
|
557
559
|
}
|
|
558
560
|
catch (layoutError) {
|
|
559
|
-
this.
|
|
561
|
+
this._constraint = undefined;
|
|
560
562
|
this._sourceView.rootView._invalidatedConstraints = YES;
|
|
561
563
|
this._sourceView.needsLayout = YES;
|
|
562
564
|
}
|
|
@@ -605,22 +607,12 @@ BMLayoutConstraint.prototype = {
|
|
|
605
607
|
return this._constant;
|
|
606
608
|
},
|
|
607
609
|
set constant(constant) {
|
|
608
|
-
if (constant == this._constant)
|
|
609
|
-
|
|
610
|
-
return this._updateConfiguration();
|
|
611
|
-
|
|
612
|
-
// When changing the constant, update the attached solver, if there is one
|
|
613
|
-
if (this._solver) {
|
|
614
|
-
if (this._constraint) {
|
|
615
|
-
this._solver.removeConstraint(this._constraint);
|
|
616
|
-
this._constraint = undefined;
|
|
617
|
-
}
|
|
618
|
-
this._solver.addConstraint(this._cassowaryConstraint);
|
|
610
|
+
if (constant == this._constant) {
|
|
611
|
+
return;
|
|
619
612
|
}
|
|
620
613
|
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
}
|
|
614
|
+
this._constant = constant;
|
|
615
|
+
this._updateConfiguration();
|
|
624
616
|
},
|
|
625
617
|
|
|
626
618
|
/**
|
|
@@ -694,15 +686,7 @@ BMLayoutConstraint.prototype = {
|
|
|
694
686
|
* Returns this constraint's constant for the currently active size class.
|
|
695
687
|
*/
|
|
696
688
|
get activeConstant() { // <Number or String>
|
|
697
|
-
// TODO:
|
|
698
689
|
return this._configuration.constant;
|
|
699
|
-
let sizeClassHash = this._sourceView.sizeClass._hashString;
|
|
700
|
-
|
|
701
|
-
if ('constant' in this._variations[sizeClassHash]) {
|
|
702
|
-
return this._variations[sizeClassHash].constant;
|
|
703
|
-
}
|
|
704
|
-
|
|
705
|
-
return this._constant;
|
|
706
690
|
},
|
|
707
691
|
|
|
708
692
|
/**
|
|
@@ -716,12 +700,7 @@ BMLayoutConstraint.prototype = {
|
|
|
716
700
|
set priority(priority) {
|
|
717
701
|
if (this._priority != priority) {
|
|
718
702
|
this._priority = priority;
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
this._sourceView.needsLayout = YES;
|
|
722
|
-
|
|
723
|
-
if (this._targetView) this._targetView.needsLayout = YES;
|
|
724
|
-
this._sourceView.rootView._invalidatedConstraints = YES;
|
|
703
|
+
this._updateConfiguration();
|
|
725
704
|
}
|
|
726
705
|
},
|
|
727
706
|
|
|
@@ -798,13 +777,6 @@ BMLayoutConstraint.prototype = {
|
|
|
798
777
|
get activePriority() { // <Number>
|
|
799
778
|
// TODO:
|
|
800
779
|
return this._configuration.priority;
|
|
801
|
-
let sizeClassHash = this._sourceView.sizeClass._hashString;
|
|
802
|
-
|
|
803
|
-
if ('priority' in this._variations[sizeClassHash]) {
|
|
804
|
-
return this._variations[sizeClassHash].priority;
|
|
805
|
-
}
|
|
806
|
-
|
|
807
|
-
return this._priority;
|
|
808
780
|
},
|
|
809
781
|
|
|
810
782
|
/**
|
|
@@ -855,19 +827,7 @@ BMLayoutConstraint.prototype = {
|
|
|
855
827
|
set isActive(active) {
|
|
856
828
|
if (active != this._isActive) {
|
|
857
829
|
this._isActive = active;
|
|
858
|
-
|
|
859
|
-
this._sourceView._checkConstraints();
|
|
860
|
-
this._sourceView.needsLayout = YES;
|
|
861
|
-
this._sourceView.rootView._invalidatedConstraints = YES;
|
|
862
|
-
|
|
863
|
-
if (this._targetView) {
|
|
864
|
-
if (this._targetView.rootView != this._sourceView.rootView) {
|
|
865
|
-
throw new Error('[BMCoreUI] Incorrectly attempting to activate a layout constraint that affects two views that do not share a common ancestor.');
|
|
866
|
-
}
|
|
867
|
-
|
|
868
|
-
this._targetView._checkConstraints();
|
|
869
|
-
this._targetView.needsLayout = YES;
|
|
870
|
-
}
|
|
830
|
+
this._updateConfiguration();
|
|
871
831
|
}
|
|
872
832
|
},
|
|
873
833
|
|
|
@@ -942,13 +902,6 @@ BMLayoutConstraint.prototype = {
|
|
|
942
902
|
*/
|
|
943
903
|
get affectsLayout() { // <Boolean>
|
|
944
904
|
return this._configuration.isActive;
|
|
945
|
-
let sizeClassHash = this._sourceView.sizeClass._hashString;
|
|
946
|
-
|
|
947
|
-
if ('isActive' in this._variations[sizeClassHash]) {
|
|
948
|
-
return this._variations[sizeClassHash].isActive;
|
|
949
|
-
}
|
|
950
|
-
|
|
951
|
-
return this._isActive;
|
|
952
905
|
},
|
|
953
906
|
|
|
954
907
|
/**
|
|
@@ -1048,7 +1001,9 @@ BMLayoutConstraint.prototype = {
|
|
|
1048
1001
|
* generated by this layout constraint.
|
|
1049
1002
|
*/
|
|
1050
1003
|
get _cassowaryConstraint() {
|
|
1051
|
-
if (this._constraint)
|
|
1004
|
+
if (this._constraint) {
|
|
1005
|
+
return this._constraint;
|
|
1006
|
+
}
|
|
1052
1007
|
|
|
1053
1008
|
var expression = this._cassowaryExpression;
|
|
1054
1009
|
|
|
@@ -2276,7 +2276,9 @@ BMView.prototype = BMExtend(BMView.prototype, {
|
|
|
2276
2276
|
* @param shortcut <BMKeyboardShortcut> The keyboard shortcut to register.
|
|
2277
2277
|
*/
|
|
2278
2278
|
registerKeyboardShortcut(shortcut) {
|
|
2279
|
-
if (!Object.keys(this._keyboardShortcuts).length)
|
|
2279
|
+
if (!Object.keys(this._keyboardShortcuts).length) {
|
|
2280
|
+
this._enableKeyboardShortcuts();
|
|
2281
|
+
}
|
|
2280
2282
|
|
|
2281
2283
|
if (!this._keyboardShortcuts[shortcut.keyCode]) {
|
|
2282
2284
|
this._keyboardShortcuts[shortcut.keyCode] = [];
|
|
@@ -2306,7 +2308,9 @@ BMView.prototype = BMExtend(BMView.prototype, {
|
|
|
2306
2308
|
}
|
|
2307
2309
|
}
|
|
2308
2310
|
|
|
2309
|
-
if (!Object.keys(this._keyboardShortcuts).length)
|
|
2311
|
+
if (!Object.keys(this._keyboardShortcuts).length) {
|
|
2312
|
+
this._disableKeyboardShortcuts();
|
|
2313
|
+
}
|
|
2310
2314
|
},
|
|
2311
2315
|
|
|
2312
2316
|
/**
|
|
@@ -2314,9 +2318,12 @@ BMView.prototype = BMExtend(BMView.prototype, {
|
|
|
2314
2318
|
* and handle key presses. Subclasses that override this method should invoke the base implementation to allow
|
|
2315
2319
|
* keyboard shortcuts to be handled correctly.
|
|
2316
2320
|
* @param event <KeyboardEvent> The event that triggered this action.
|
|
2321
|
+
* @return <Boolean, nullable> `YES` if a keyboard shortcut was handled, `NO` or `undefined` otherwise.
|
|
2317
2322
|
*/
|
|
2318
2323
|
keyPressedWithEvent(event) {
|
|
2319
|
-
if (!this._keyboardShortcuts[event.code]) return;
|
|
2324
|
+
if (!this._keyboardShortcuts[event.code]) return NO;
|
|
2325
|
+
|
|
2326
|
+
let shortcutHandled = NO;
|
|
2320
2327
|
|
|
2321
2328
|
// Check if a shortcut key has been pressed.
|
|
2322
2329
|
for (const shortcut of this._keyboardShortcuts[event.code]) {
|
|
@@ -2331,8 +2338,11 @@ BMView.prototype = BMExtend(BMView.prototype, {
|
|
|
2331
2338
|
if (bitmap == shortcut._modifierBitmap) {
|
|
2332
2339
|
if (shortcut.preventsDefault) event.preventDefault();
|
|
2333
2340
|
shortcut.target[shortcut.action](event, {forKeyboardShortcut: shortcut});
|
|
2341
|
+
shortcutHandled = YES;
|
|
2334
2342
|
}
|
|
2335
2343
|
}
|
|
2344
|
+
|
|
2345
|
+
return shortcutHandled;
|
|
2336
2346
|
},
|
|
2337
2347
|
|
|
2338
2348
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// @ts-check
|
|
2
2
|
|
|
3
|
+
import { BMView } from '../BMView/BMView_v2.5';
|
|
3
4
|
import {YES, NO, BMExtend} from '../Core/BMCoreUI'
|
|
4
5
|
import {BMWindow} from './BMWindow'
|
|
5
6
|
|
|
@@ -25,6 +26,11 @@ BMToolWindow.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
25
26
|
*/
|
|
26
27
|
opensAutomatically: YES, // <Boolean>
|
|
27
28
|
|
|
29
|
+
/**
|
|
30
|
+
* The window to which this tool window is associated.
|
|
31
|
+
*/
|
|
32
|
+
_parentWindow: undefined, // <BMWindow>
|
|
33
|
+
|
|
28
34
|
/**
|
|
29
35
|
* Initializes this tool window with the given frame and associates it with the given window.
|
|
30
36
|
* @param frame <BMRect> The window's frame.
|
|
@@ -41,8 +47,14 @@ BMToolWindow.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
41
47
|
this.node.classList.add('BMToolWindow');
|
|
42
48
|
window._toolWindows.push(this);
|
|
43
49
|
|
|
50
|
+
this._parentWindow = window;
|
|
51
|
+
|
|
44
52
|
// If the window is the key window, make this tool window visible
|
|
45
|
-
if (BMWindow._keyWindow == window)
|
|
53
|
+
if (BMWindow._keyWindow == window) {
|
|
54
|
+
this.bringToFrontAnimated(YES);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
this._enableKeyboardShortcuts();
|
|
46
58
|
|
|
47
59
|
return this;
|
|
48
60
|
},
|
|
@@ -53,6 +65,22 @@ BMToolWindow.prototype = BMExtend(Object.create(BMWindow.prototype), {
|
|
|
53
65
|
|
|
54
66
|
resignKeyWindow() {
|
|
55
67
|
// This operation is a no-op for tool windows
|
|
68
|
+
},
|
|
69
|
+
|
|
70
|
+
keyPressedWithEvent(event, args) {
|
|
71
|
+
const handled = BMView.prototype.keyPressedWithEvent.apply(this, [event, args]);
|
|
72
|
+
|
|
73
|
+
if (!handled) {
|
|
74
|
+
this._parentWindow?.keyPressedWithEvent(event, args);
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
|
|
78
|
+
release() {
|
|
79
|
+
const index = this._parentWindow._toolWindows.indexOf(this);
|
|
80
|
+
if (index != -1) {
|
|
81
|
+
this._parentWindow._toolWindows.splice(index, -1);
|
|
82
|
+
}
|
|
83
|
+
BMWindow.prototype.release.call(this);
|
|
56
84
|
}
|
|
57
85
|
});
|
|
58
86
|
|
|
@@ -1918,9 +1918,6 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
1918
1918
|
|
|
1919
1919
|
animated = (animated === undefined ? YES : animated);
|
|
1920
1920
|
|
|
1921
|
-
//__BMVelocityAnimate(this._blocker, 'stop');
|
|
1922
|
-
//__BMVelocityAnimate(this._window, 'stop');
|
|
1923
|
-
|
|
1924
1921
|
var self = this;
|
|
1925
1922
|
|
|
1926
1923
|
this._blocker.style.pointerEvents = 'none';
|
|
@@ -1931,8 +1928,11 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
1931
1928
|
}
|
|
1932
1929
|
this._visible = NO;
|
|
1933
1930
|
|
|
1931
|
+
// Dismiss all associated tool windows if they are visible
|
|
1934
1932
|
for (let window of this._toolWindows) {
|
|
1935
|
-
window.
|
|
1933
|
+
if (window._visible) {
|
|
1934
|
+
window.dismissAnimated(animated);
|
|
1935
|
+
}
|
|
1936
1936
|
}
|
|
1937
1937
|
|
|
1938
1938
|
if (animated) {
|
|
@@ -1941,10 +1941,6 @@ BMWindow.prototype = BMExtend(Object.create(BMView.prototype), {
|
|
|
1941
1941
|
duration: _BMWindowAnimationDurationDefault,
|
|
1942
1942
|
easing: _BMWindowAnimationEasingDefault,
|
|
1943
1943
|
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
1944
|
complete: function () {
|
|
1949
1945
|
self.windowDidClose();
|
|
1950
1946
|
if (self.delegate && self.delegate.windowDidClose) {
|
|
@@ -4585,9 +4585,10 @@ declare class BMView {
|
|
|
4585
4585
|
* and handle key presses. Subclasses that override this method should invoke the base implementation to allow
|
|
4586
4586
|
* keyboard shortcuts to be handled correctly.
|
|
4587
4587
|
* @param event The event that triggered this action.
|
|
4588
|
+
* @return `YES` if a keyboard shortcut was handled, `NO` or `undefined` otherwise.
|
|
4588
4589
|
*
|
|
4589
4590
|
*/
|
|
4590
|
-
keyPressedWithEvent(event: KeyboardEvent):
|
|
4591
|
+
keyPressedWithEvent(event: KeyboardEvent): boolean | null | undefined;
|
|
4591
4592
|
|
|
4592
4593
|
|
|
4593
4594
|
/**
|
|
@@ -14327,6 +14328,12 @@ declare class BMToolWindow extends BMWindow {
|
|
|
14327
14328
|
*/
|
|
14328
14329
|
opensAutomatically: boolean;
|
|
14329
14330
|
|
|
14331
|
+
/**
|
|
14332
|
+
* The window to which this tool window is associated.
|
|
14333
|
+
*
|
|
14334
|
+
*/
|
|
14335
|
+
private _parentWindow: BMWindow;
|
|
14336
|
+
|
|
14330
14337
|
/**
|
|
14331
14338
|
* Initializes this tool window with the given frame and associates it with the given window.
|
|
14332
14339
|
* @param frame The window's frame.
|