@nativescript-community/ui-material-bottomsheet 6.0.0
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/CHANGELOG.md +1569 -0
- package/LICENSE +201 -0
- package/README.md +192 -0
- package/angular/bottomsheet.module.d.ts +10 -0
- package/angular/bottomsheet.service.d.ts +28 -0
- package/angular/bundles/nativescript-community-ui-material-bottomsheet-angular.umd.js +179 -0
- package/angular/bundles/nativescript-community-ui-material-bottomsheet-angular.umd.js.map +1 -0
- package/angular/bundles/nativescript-community-ui-material-bottomsheet-angular.umd.min.js +2 -0
- package/angular/bundles/nativescript-community-ui-material-bottomsheet-angular.umd.min.js.map +1 -0
- package/angular/esm2015/bottomsheet.module.js +26 -0
- package/angular/esm2015/bottomsheet.service.js +109 -0
- package/angular/esm2015/index.js +3 -0
- package/angular/esm2015/nativescript-community-ui-material-bottomsheet-angular.js +2 -0
- package/angular/fesm2015/nativescript-community-ui-material-bottomsheet-angular.js +135 -0
- package/angular/fesm2015/nativescript-community-ui-material-bottomsheet-angular.js.map +1 -0
- package/angular/index.d.ts +2 -0
- package/angular/nativescript-community-ui-material-bottomsheet-angular.d.ts +2 -0
- package/angular/package.json +16 -0
- package/bottomsheet-common.d.ts +35 -0
- package/bottomsheet-common.js +94 -0
- package/bottomsheet-common.js.map +1 -0
- package/bottomsheet.android.d.ts +10 -0
- package/bottomsheet.android.js +143 -0
- package/bottomsheet.android.js.map +1 -0
- package/bottomsheet.d.ts +89 -0
- package/bottomsheet.ios.d.ts +17 -0
- package/bottomsheet.ios.js +360 -0
- package/bottomsheet.ios.js.map +1 -0
- package/package.json +51 -0
- package/platforms/android/include.gradle +8 -0
- package/platforms/android/java/com/nativescript/material/bottomsheet/BottomSheetDialog.java +38 -0
- package/platforms/android/java/com/nativescript/material/bottomsheet/BottomSheetDialogFragment.java +73 -0
- package/platforms/android/ui_material_bottomsheet.aar +0 -0
- package/platforms/ios/Podfile +1 -0
- package/pnpm-lock.yaml +90 -0
- package/vue/index.d.ts +16 -0
- package/vue/index.js +51 -0
- package/vue/index.js.map +1 -0
@@ -0,0 +1,143 @@
|
|
1
|
+
import { applyMixins } from '@nativescript-community/ui-material-core';
|
2
|
+
import { Application, View, fromObject } from '@nativescript/core';
|
3
|
+
import { ViewWithBottomSheetBase } from './bottomsheet-common';
|
4
|
+
export { ViewWithBottomSheetBase } from './bottomsheet-common';
|
5
|
+
function getId(id) {
|
6
|
+
const context = Application.android.context;
|
7
|
+
return context.getResources().getIdentifier(id, 'id', context.getPackageName());
|
8
|
+
}
|
9
|
+
export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
|
10
|
+
_hideNativeBottomSheet(parent, whenClosedCallback) {
|
11
|
+
whenClosedCallback();
|
12
|
+
const manager = this._bottomSheetFragment.getFragmentManager();
|
13
|
+
if (manager) {
|
14
|
+
this._bottomSheetFragment.dismissAllowingStateLoss();
|
15
|
+
}
|
16
|
+
this._bottomSheetFragment = null;
|
17
|
+
}
|
18
|
+
_showNativeBottomSheet(parent, options) {
|
19
|
+
this._commonShowNativeBottomSheet(parent, options);
|
20
|
+
const owner = this;
|
21
|
+
const domId = this._domId;
|
22
|
+
const bottomSheetOptions = {
|
23
|
+
owner: this,
|
24
|
+
options,
|
25
|
+
shownCallback: () => {
|
26
|
+
this.bindingContext = fromObject(options.context);
|
27
|
+
this._raiseShownBottomSheetEvent();
|
28
|
+
},
|
29
|
+
dismissCallback: () => this._onDismissBottomSheetCallback()
|
30
|
+
};
|
31
|
+
const dfListener = new com.nativescript.material.bottomsheet.BottomSheetDialogFragment.BottomSheetDialogFragmentListener({
|
32
|
+
onCreateDialog(fragment, savedInstanceState) {
|
33
|
+
const theme = fragment.getTheme();
|
34
|
+
const dialogListener = new com.nativescript.material.bottomsheet.BottomSheetDialog.BottomSheetDialogListener({
|
35
|
+
onDetachedFromWindow(dialog) {
|
36
|
+
dialog.nListener = null;
|
37
|
+
},
|
38
|
+
onBackPressed(dialog) {
|
39
|
+
if (!owner) {
|
40
|
+
return false;
|
41
|
+
}
|
42
|
+
const args = {
|
43
|
+
eventName: 'activityBackPressed',
|
44
|
+
object: owner,
|
45
|
+
activity: owner._context,
|
46
|
+
cancel: false
|
47
|
+
};
|
48
|
+
Application.android.notify(args);
|
49
|
+
if (args.cancel) {
|
50
|
+
return true;
|
51
|
+
}
|
52
|
+
owner.notify(args);
|
53
|
+
if (!args.cancel) {
|
54
|
+
args.cancel = owner.onBackPressed();
|
55
|
+
}
|
56
|
+
return args.cancel;
|
57
|
+
}
|
58
|
+
});
|
59
|
+
const dialog = new com.nativescript.material.bottomsheet.BottomSheetDialog(fragment.getActivity(), theme);
|
60
|
+
dialog.setListener(dialogListener);
|
61
|
+
dialog.nListener = dialogListener;
|
62
|
+
if (bottomSheetOptions.options) {
|
63
|
+
const creationOptions = bottomSheetOptions.options;
|
64
|
+
if (creationOptions.dismissOnBackgroundTap !== undefined) {
|
65
|
+
dialog.setCanceledOnTouchOutside(creationOptions.dismissOnBackgroundTap);
|
66
|
+
}
|
67
|
+
if (creationOptions.disableDimBackground === true) {
|
68
|
+
dialog.getWindow().clearFlags(android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND);
|
69
|
+
}
|
70
|
+
}
|
71
|
+
return dialog;
|
72
|
+
},
|
73
|
+
onCreateView(fragment, inflater, container, savedInstanceState) {
|
74
|
+
owner._setupAsRootView(fragment.getActivity());
|
75
|
+
owner._isAddedToNativeVisualTree = true;
|
76
|
+
return owner.nativeViewProtected;
|
77
|
+
},
|
78
|
+
onStart(fragment) {
|
79
|
+
const color = owner.backgroundColor;
|
80
|
+
const contentViewId = getId('design_bottom_sheet');
|
81
|
+
const view = fragment.getDialog().findViewById(contentViewId);
|
82
|
+
const transparent = bottomSheetOptions.options && bottomSheetOptions.options.transparent;
|
83
|
+
if (transparent === true) {
|
84
|
+
setTimeout(() => {
|
85
|
+
view.setBackground(null);
|
86
|
+
}, 0);
|
87
|
+
}
|
88
|
+
const behavior = com.google.android.material.bottomsheet.BottomSheetBehavior.from(view);
|
89
|
+
const dismissOnDraggingDownSheet = !bottomSheetOptions.options || bottomSheetOptions.options.dismissOnDraggingDownSheet !== false;
|
90
|
+
behavior.setHideable(dismissOnDraggingDownSheet);
|
91
|
+
if (!dismissOnDraggingDownSheet) {
|
92
|
+
behavior.setState(com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED);
|
93
|
+
behavior.setPeekHeight(java.lang.Integer.MAX_VALUE);
|
94
|
+
}
|
95
|
+
const skipCollapsedState = !bottomSheetOptions.options || bottomSheetOptions.options.skipCollapsedState === true;
|
96
|
+
if (skipCollapsedState) {
|
97
|
+
behavior.setState(com.google.android.material.bottomsheet.BottomSheetBehavior.STATE_EXPANDED);
|
98
|
+
behavior.setSkipCollapsed(true);
|
99
|
+
}
|
100
|
+
if (owner && !owner.isLoaded) {
|
101
|
+
owner.callLoaded();
|
102
|
+
}
|
103
|
+
bottomSheetOptions.shownCallback();
|
104
|
+
},
|
105
|
+
onDismiss(fragment, dialog) {
|
106
|
+
const manager = fragment.getFragmentManager();
|
107
|
+
if (manager) {
|
108
|
+
bottomSheetOptions.dismissCallback();
|
109
|
+
}
|
110
|
+
if (owner && owner.isLoaded) {
|
111
|
+
owner.callUnloaded();
|
112
|
+
}
|
113
|
+
},
|
114
|
+
onDestroy(fragment) {
|
115
|
+
df.nListener = null;
|
116
|
+
if (owner) {
|
117
|
+
if (owner.isLoaded) {
|
118
|
+
owner.callUnloaded();
|
119
|
+
}
|
120
|
+
owner._isAddedToNativeVisualTree = false;
|
121
|
+
owner._tearDownUI(true);
|
122
|
+
}
|
123
|
+
}
|
124
|
+
});
|
125
|
+
const df = new com.nativescript.material.bottomsheet.BottomSheetDialogFragment();
|
126
|
+
df.setListener(dfListener);
|
127
|
+
df.nListener = dfListener;
|
128
|
+
this._bottomSheetFragment = df;
|
129
|
+
this._raiseShowingBottomSheetEvent();
|
130
|
+
df.show(parent._getRootFragmentManager(), domId.toString());
|
131
|
+
}
|
132
|
+
}
|
133
|
+
let mixinInstalled = false;
|
134
|
+
export function overrideBottomSheet() {
|
135
|
+
applyMixins(View, [ViewWithBottomSheetBase, ViewWithBottomSheet]);
|
136
|
+
}
|
137
|
+
export function install() {
|
138
|
+
if (!mixinInstalled) {
|
139
|
+
mixinInstalled = true;
|
140
|
+
overrideBottomSheet();
|
141
|
+
}
|
142
|
+
}
|
143
|
+
//# sourceMappingURL=bottomsheet.android.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bottomsheet.android.js","sourceRoot":"../src/","sources":["bottomsheet.android.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AACvE,OAAO,EAAuC,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACxG,OAAO,EAAsB,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAEnF,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAS/D,SAAS,KAAK,CAAC,EAAU;IACrB,MAAM,OAAO,GAA4B,WAAW,CAAC,OAAO,CAAC,OAAO,CAAC;IACrE,OAAO,OAAO,CAAC,YAAY,EAAE,CAAC,aAAa,CAAC,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;AACpF,CAAC;AAED,MAAM,OAAO,mBAAoB,SAAQ,uBAAuB;IAElD,sBAAsB,CAAC,MAAY,EAAE,kBAA8B;QAEzE,kBAAkB,EAAE,CAAC;QACrB,MAAM,OAAO,GAAG,IAAI,CAAC,oBAAoB,CAAC,kBAAkB,EAAE,CAAC;QAC/D,IAAI,OAAO,EAAE;YACT,IAAI,CAAC,oBAAoB,CAAC,wBAAwB,EAAE,CAAC;SACxD;QAED,IAAI,CAAC,oBAAoB,GAAG,IAAI,CAAC;IACrC,CAAC;IAES,sBAAsB,CAAC,MAAY,EAAE,OAA2B;QACtE,IAAI,CAAC,4BAA4B,CAAC,M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,CAAC,CAAC;AACtE,CAAC;AACD,MAAM,UAAU,OAAO;IACnB,IAAI,CAAC,cAAc,EAAE;QACjB,cAAc,GAAG,IAAI,CAAC;QAEtB,mBAAmB,EAAE,CAAC;KACzB;AACL,CAAC"}
|
package/bottomsheet.d.ts
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
|
2
|
+
/**
|
3
|
+
* Material BottomSheet component
|
4
|
+
* @module @nativescript-community/ui-material-bottomsheet
|
5
|
+
*/
|
6
|
+
|
7
|
+
import { View, ViewBase } from '@nativescript/core';
|
8
|
+
import { BottomSheetOptions } from './bottomsheet-common';
|
9
|
+
|
10
|
+
export { BottomSheetOptions };
|
11
|
+
|
12
|
+
export declare abstract class ViewWithBottomSheetBase extends View {
|
13
|
+
// used when triggering the closing of the bottomsheet
|
14
|
+
/**
|
15
|
+
* @hidden
|
16
|
+
*/
|
17
|
+
protected _closeBottomSheetCallback: Function;
|
18
|
+
|
19
|
+
// used when the bottomSheet is dismissed
|
20
|
+
/**
|
21
|
+
* @hidden
|
22
|
+
*/
|
23
|
+
public _onDismissBottomSheetCallback: Function;
|
24
|
+
|
25
|
+
/**
|
26
|
+
* @hidden
|
27
|
+
*/
|
28
|
+
_bottomSheetFragment: any; // com.google.android.material.bottomsheet.BottomSheetDialogFragment
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @hidden
|
32
|
+
*/
|
33
|
+
protected abstract _hideNativeBottomSheet(parent: any, whenClosedCallback: any): void;
|
34
|
+
|
35
|
+
/**
|
36
|
+
* @hidden
|
37
|
+
*/
|
38
|
+
protected _bottomSheetContext: any;
|
39
|
+
|
40
|
+
/**
|
41
|
+
* @hidden
|
42
|
+
*/
|
43
|
+
_raiseShownBottomSheetEvent(): void;
|
44
|
+
|
45
|
+
/**
|
46
|
+
* @hidden
|
47
|
+
*/
|
48
|
+
public _bottomSheetClosed(): void;
|
49
|
+
|
50
|
+
/**
|
51
|
+
* @hidden
|
52
|
+
*/
|
53
|
+
protected abstract _showNativeBottomSheet(parent: View, options: BottomSheetOptions): void;
|
54
|
+
|
55
|
+
/**
|
56
|
+
* @hidden
|
57
|
+
*/
|
58
|
+
protected _commonShowNativeBottomSheet(parent: View, options: BottomSheetOptions): void;
|
59
|
+
|
60
|
+
/**
|
61
|
+
* @hidden
|
62
|
+
*/
|
63
|
+
protected _raiseShowingBottomSheetEvent(): void;
|
64
|
+
|
65
|
+
|
66
|
+
/**
|
67
|
+
* closes the current BottomSheet
|
68
|
+
*
|
69
|
+
* @param args anything you want as a result of the `showBottomSheet` Promise
|
70
|
+
*/
|
71
|
+
public closeBottomSheet(...args: any): void;
|
72
|
+
|
73
|
+
|
74
|
+
/**
|
75
|
+
* shows a modal BottomSheet
|
76
|
+
*
|
77
|
+
* @param {BottomSheetOptions} options
|
78
|
+
* @returns {View} view - the view shown in the BottomSheet
|
79
|
+
*/
|
80
|
+
public showBottomSheet(options: BottomSheetOptions): ViewBase;
|
81
|
+
}
|
82
|
+
export function install(): void;
|
83
|
+
|
84
|
+
declare module '@nativescript/core/ui/core/view' {
|
85
|
+
interface View {
|
86
|
+
closeBottomSheet(...args: any): void;
|
87
|
+
showBottomSheet(options: BottomSheetOptions): ViewBase;
|
88
|
+
}
|
89
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
import { View } from '@nativescript/core';
|
2
|
+
import { BottomSheetOptions } from './bottomsheet';
|
3
|
+
import { ViewWithBottomSheetBase } from './bottomsheet-common';
|
4
|
+
export { ViewWithBottomSheetBase } from './bottomsheet-common';
|
5
|
+
declare class IMDCBottomSheetControllerDelegateImpl extends NSObject implements MDCBottomSheetControllerDelegate {
|
6
|
+
static new(): IMDCBottomSheetControllerDelegateImpl;
|
7
|
+
_owner: WeakRef<ViewWithBottomSheet>;
|
8
|
+
}
|
9
|
+
export declare class ViewWithBottomSheet extends ViewWithBottomSheetBase {
|
10
|
+
bottomSheetControllerDelegate: IMDCBottomSheetControllerDelegateImpl;
|
11
|
+
bottomSheetController: MDCBottomSheetController;
|
12
|
+
protected _showNativeBottomSheet(parent: View, options: BottomSheetOptions): void;
|
13
|
+
_bottomSheetClosed(): void;
|
14
|
+
protected _hideNativeBottomSheet(parent: View, whenClosedCallback: () => void): void;
|
15
|
+
}
|
16
|
+
export declare function overrideBottomSheet(): void;
|
17
|
+
export declare function install(): void;
|
@@ -0,0 +1,360 @@
|
|
1
|
+
import { Application, IOSHelper, Page, Screen, Trace, Utils, View, fromObject } from '@nativescript/core';
|
2
|
+
import { applyMixins } from '@nativescript-community/ui-material-core';
|
3
|
+
import { ViewWithBottomSheetBase } from './bottomsheet-common';
|
4
|
+
export { ViewWithBottomSheetBase } from './bottomsheet-common';
|
5
|
+
const majorVersion = Utils.ios.MajorVersion;
|
6
|
+
var MDCBottomSheetControllerDelegateImpl = /** @class */ (function (_super) {
|
7
|
+
__extends(MDCBottomSheetControllerDelegateImpl, _super);
|
8
|
+
function MDCBottomSheetControllerDelegateImpl() {
|
9
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
10
|
+
}
|
11
|
+
MDCBottomSheetControllerDelegateImpl.initWithOwner = function (owner) {
|
12
|
+
var delegate = MDCBottomSheetControllerDelegateImpl.new();
|
13
|
+
delegate._owner = new WeakRef(owner);
|
14
|
+
return delegate;
|
15
|
+
};
|
16
|
+
MDCBottomSheetControllerDelegateImpl.prototype.bottomSheetControllerDidDismissBottomSheet = function (controller) {
|
17
|
+
// called when clicked on background
|
18
|
+
var owner = this._owner.get();
|
19
|
+
if (owner) {
|
20
|
+
owner._onDismissBottomSheetCallback && owner._onDismissBottomSheetCallback();
|
21
|
+
if (owner && owner.isLoaded) {
|
22
|
+
owner.callUnloaded();
|
23
|
+
}
|
24
|
+
}
|
25
|
+
};
|
26
|
+
MDCBottomSheetControllerDelegateImpl.prototype.bottomSheetControllerStateChangedState = function (controller, state) {
|
27
|
+
// called when swiped
|
28
|
+
if (state === MDCSheetState.Closed) {
|
29
|
+
var owner = this._owner.get();
|
30
|
+
if (owner) {
|
31
|
+
owner._onDismissBottomSheetCallback && owner._onDismissBottomSheetCallback();
|
32
|
+
if (owner && owner.isLoaded) {
|
33
|
+
owner.callUnloaded();
|
34
|
+
}
|
35
|
+
}
|
36
|
+
}
|
37
|
+
};
|
38
|
+
MDCBottomSheetControllerDelegateImpl.ObjCProtocols = [MDCBottomSheetControllerDelegate];
|
39
|
+
return MDCBottomSheetControllerDelegateImpl;
|
40
|
+
}(NSObject));
|
41
|
+
function initLayoutGuide(controller) {
|
42
|
+
const rootView = controller.view;
|
43
|
+
const layoutGuide = UILayoutGuide.alloc().init();
|
44
|
+
rootView.addLayoutGuide(layoutGuide);
|
45
|
+
NSLayoutConstraint.activateConstraints([
|
46
|
+
layoutGuide.topAnchor.constraintEqualToAnchor(controller.topLayoutGuide.bottomAnchor),
|
47
|
+
layoutGuide.bottomAnchor.constraintEqualToAnchor(controller.bottomLayoutGuide.topAnchor),
|
48
|
+
layoutGuide.leadingAnchor.constraintEqualToAnchor(rootView.leadingAnchor),
|
49
|
+
layoutGuide.trailingAnchor.constraintEqualToAnchor(rootView.trailingAnchor)
|
50
|
+
]);
|
51
|
+
return layoutGuide;
|
52
|
+
}
|
53
|
+
function layoutView(controller, owner) {
|
54
|
+
let layoutGuide = controller.view.safeAreaLayoutGuide;
|
55
|
+
if (!layoutGuide) {
|
56
|
+
Trace.write(`safeAreaLayoutGuide during layout of ${owner}. Creating fallback constraints, but layout might be wrong.`, Trace.categories.Layout, Trace.messageType.error);
|
57
|
+
layoutGuide = initLayoutGuide(controller);
|
58
|
+
}
|
59
|
+
const safeArea = layoutGuide.layoutFrame;
|
60
|
+
let position = IOSHelper.getPositionFromFrame(safeArea);
|
61
|
+
const safeAreaSize = safeArea.size;
|
62
|
+
const hasChildViewControllers = controller.childViewControllers.count > 0;
|
63
|
+
if (hasChildViewControllers) {
|
64
|
+
const fullscreen = controller.view.frame;
|
65
|
+
position = IOSHelper.getPositionFromFrame(fullscreen);
|
66
|
+
}
|
67
|
+
const safeAreaWidth = Utils.layout.round(Utils.layout.toDevicePixels(safeAreaSize.width));
|
68
|
+
const safeAreaHeight = Utils.layout.round(Utils.layout.toDevicePixels(safeAreaSize.height));
|
69
|
+
const widthSpec = Utils.layout.makeMeasureSpec(safeAreaWidth, Utils.layout.EXACTLY);
|
70
|
+
const heightSpec = Utils.layout.makeMeasureSpec(safeAreaHeight, Utils.layout.UNSPECIFIED);
|
71
|
+
owner._cachedFrame = null;
|
72
|
+
View.measureChild(null, owner, widthSpec, heightSpec);
|
73
|
+
const marginTop = owner.effectiveMarginTop;
|
74
|
+
const marginBottom = owner.effectiveMarginBottom;
|
75
|
+
const marginLeft = owner.effectiveMarginLeft + position.left;
|
76
|
+
const marginRight = owner.effectiveMarginRight;
|
77
|
+
const top = marginTop + position.top;
|
78
|
+
const width = Screen.mainScreen.widthPixels;
|
79
|
+
const height = owner.getMeasuredHeight();
|
80
|
+
View.layoutChild(null, owner, marginLeft, top, width - marginLeft - marginRight, position.top + height + marginBottom);
|
81
|
+
const effectiveWidth = width;
|
82
|
+
let effectiveHeight = height + top + marginBottom;
|
83
|
+
if (controller.ignoreTopSafeArea || controller.ignoreBottomSafeArea) {
|
84
|
+
const frame = CGRectMake(Utils.layout.toDeviceIndependentPixels(marginLeft), Utils.layout.toDeviceIndependentPixels(top), Utils.layout.toDeviceIndependentPixels(width), Utils.layout.toDeviceIndependentPixels(height));
|
85
|
+
const availableSpace = getAvailableSpaceFromParent(owner, frame);
|
86
|
+
const startPos = IOSHelper.getPositionFromFrame(frame);
|
87
|
+
const fullscreenPosition = IOSHelper.getPositionFromFrame(availableSpace.fullscreen);
|
88
|
+
const safeAreaPosition = IOSHelper.getPositionFromFrame(availableSpace.safeArea);
|
89
|
+
const adjustedPosition = startPos;
|
90
|
+
const orientation = UIDevice.currentDevice.orientation;
|
91
|
+
const isLandscape = Application.orientation() === 'landscape';
|
92
|
+
owner.iosIgnoreSafeArea = true;
|
93
|
+
if (controller.ignoreTopSafeArea) {
|
94
|
+
const key = 'top';
|
95
|
+
const oppositeKey = 'bottom';
|
96
|
+
const delta = safeAreaPosition[key] - fullscreenPosition[key];
|
97
|
+
effectiveHeight -= delta;
|
98
|
+
adjustedPosition[oppositeKey] -= delta;
|
99
|
+
adjustedPosition[key] -= delta;
|
100
|
+
}
|
101
|
+
if (controller.ignoreBottomSafeArea) {
|
102
|
+
const key = 'bottom';
|
103
|
+
const delta = fullscreenPosition[key] - safeAreaPosition[key];
|
104
|
+
effectiveHeight -= delta;
|
105
|
+
}
|
106
|
+
if (orientation === 4 || orientation === 3) {
|
107
|
+
const key = 'left';
|
108
|
+
const oppositeKey = 'right';
|
109
|
+
const delta = fullscreenPosition[key] - safeAreaPosition[key];
|
110
|
+
adjustedPosition[oppositeKey] += Utils.layout.toDevicePixels(delta);
|
111
|
+
}
|
112
|
+
owner.nativeViewProtected.frame = CGRectMake(Utils.layout.toDeviceIndependentPixels(adjustedPosition.left), Utils.layout.toDeviceIndependentPixels(adjustedPosition.top), Utils.layout.toDeviceIndependentPixels(adjustedPosition.right - adjustedPosition.left), Utils.layout.toDeviceIndependentPixels(adjustedPosition.bottom - adjustedPosition.top));
|
113
|
+
}
|
114
|
+
controller.preferredContentSize = CGSizeMake(Utils.layout.toDeviceIndependentPixels(effectiveWidth), Utils.layout.toDeviceIndependentPixels(effectiveHeight));
|
115
|
+
if (owner.parent) {
|
116
|
+
owner.parent._layoutParent();
|
117
|
+
}
|
118
|
+
}
|
119
|
+
function getAvailableSpaceFromParent(view, frame) {
|
120
|
+
if (!view) {
|
121
|
+
return null;
|
122
|
+
}
|
123
|
+
let scrollView = null;
|
124
|
+
let viewControllerView = null;
|
125
|
+
if (view.viewController) {
|
126
|
+
viewControllerView = view.viewController.view;
|
127
|
+
}
|
128
|
+
else {
|
129
|
+
let parent = view.parent;
|
130
|
+
while (parent && !parent.viewController && !(parent.nativeViewProtected instanceof UIScrollView)) {
|
131
|
+
parent = parent.parent;
|
132
|
+
}
|
133
|
+
if (parent.nativeViewProtected instanceof UIScrollView) {
|
134
|
+
scrollView = parent.nativeViewProtected;
|
135
|
+
}
|
136
|
+
else if (parent.viewController) {
|
137
|
+
viewControllerView = parent.viewController.view;
|
138
|
+
}
|
139
|
+
}
|
140
|
+
let fullscreen = null;
|
141
|
+
let safeArea = null;
|
142
|
+
if (viewControllerView) {
|
143
|
+
safeArea = viewControllerView.safeAreaLayoutGuide.layoutFrame;
|
144
|
+
fullscreen = viewControllerView.frame;
|
145
|
+
}
|
146
|
+
else if (scrollView) {
|
147
|
+
const insets = scrollView.safeAreaInsets;
|
148
|
+
safeArea = CGRectMake(insets.left, insets.top, scrollView.contentSize.width - insets.left - insets.right, scrollView.contentSize.height - insets.top - insets.bottom);
|
149
|
+
fullscreen = CGRectMake(0, 0, scrollView.contentSize.width, scrollView.contentSize.height);
|
150
|
+
}
|
151
|
+
return { safeArea, fullscreen };
|
152
|
+
}
|
153
|
+
var UILayoutViewController = /** @class */ (function (_super) {
|
154
|
+
__extends(UILayoutViewController, _super);
|
155
|
+
function UILayoutViewController() {
|
156
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
157
|
+
}
|
158
|
+
UILayoutViewController.initWithOwner = function (owner) {
|
159
|
+
var delegate = UILayoutViewController.new();
|
160
|
+
delegate.owner = new WeakRef(owner);
|
161
|
+
return delegate;
|
162
|
+
};
|
163
|
+
UILayoutViewController.prototype.viewDidLoad = function () {
|
164
|
+
_super.prototype.viewDidLoad.call(this);
|
165
|
+
var owner = this.owner.get();
|
166
|
+
if (!owner) {
|
167
|
+
return;
|
168
|
+
}
|
169
|
+
if (!owner.parent) {
|
170
|
+
owner.callLoaded();
|
171
|
+
}
|
172
|
+
// Unify translucent and opaque bars layout
|
173
|
+
this.edgesForExtendedLayout = UIRectEdge.All;
|
174
|
+
this.extendedLayoutIncludesOpaqueBars = true;
|
175
|
+
};
|
176
|
+
UILayoutViewController.prototype.viewWillLayoutSubviews = function () {
|
177
|
+
_super.prototype.viewWillLayoutSubviews.call(this);
|
178
|
+
var owner = this.owner.get();
|
179
|
+
if (owner) {
|
180
|
+
owner.iosOverflowSafeArea = true;
|
181
|
+
IOSHelper.updateConstraints(this, owner);
|
182
|
+
}
|
183
|
+
};
|
184
|
+
UILayoutViewController.prototype.viewDidLayoutSubviews = function () {
|
185
|
+
_super.prototype.viewDidLayoutSubviews.call(this);
|
186
|
+
var owner = this.owner.get();
|
187
|
+
if (owner) {
|
188
|
+
layoutView(this, owner);
|
189
|
+
// if (majorVersion >= 11) {
|
190
|
+
// // Handle nested UILayoutViewController safe area application.
|
191
|
+
// // Currently, UILayoutViewController can be nested only in a TabView.
|
192
|
+
// // The TabView itself is handled by the OS, so we check the TabView's parent (usually a Page, but can be a Layout).
|
193
|
+
// const tabViewItem = owner.parent;
|
194
|
+
// const tabView = tabViewItem && tabViewItem.parent;
|
195
|
+
// let parent = tabView && tabView.parent;
|
196
|
+
// // Handle Angular scenario where TabView is in a ProxyViewContainer
|
197
|
+
// // It is possible to wrap components in ProxyViewContainers indefinitely
|
198
|
+
// // Not using instanceof ProxyViewContainer to avoid circular dependency
|
199
|
+
// // TODO: Try moving UILayoutViewController out of view module
|
200
|
+
// while (parent && !parent.nativeViewProtected) {
|
201
|
+
// parent = parent.parent;
|
202
|
+
// }
|
203
|
+
// const additionalInsets = { top: 0, left: 0, bottom: 0, right: 0 };
|
204
|
+
// if (parent) {
|
205
|
+
// const parentPageInsetsTop = parent.nativeViewProtected.safeAreaInsets.top;
|
206
|
+
// const currentInsetsTop = this.view.safeAreaInsets.top;
|
207
|
+
// const additionalInsetsTop = Math.max(parentPageInsetsTop - currentInsetsTop, 0);
|
208
|
+
// const parentPageInsetsBottom = parent.nativeViewProtected.safeAreaInsets.bottom;
|
209
|
+
// const currentInsetsBottom = this.view.safeAreaInsets.bottom;
|
210
|
+
// const additionalInsetsBottom = Math.max(parentPageInsetsBottom - currentInsetsBottom, 0);
|
211
|
+
// if (additionalInsetsTop > 0 || additionalInsetsBottom > 0) {
|
212
|
+
// additionalInsets.top = additionalInsetsTop;
|
213
|
+
// additionalInsets.bottom = additionalInsetsBottom;
|
214
|
+
// }
|
215
|
+
// }
|
216
|
+
// const insets = new UIEdgeInsets(additionalInsets);
|
217
|
+
// this.additionalSafeAreaInsets = insets;
|
218
|
+
// console.log('additionalSafeAreaInsets', insets.left, insets.bottom, insets.right, insets.top);
|
219
|
+
// }
|
220
|
+
}
|
221
|
+
};
|
222
|
+
UILayoutViewController.prototype.viewWillAppear = function (animated) {
|
223
|
+
_super.prototype.viewWillAppear.call(this, animated);
|
224
|
+
var owner = this.owner.get();
|
225
|
+
if (!owner) {
|
226
|
+
return;
|
227
|
+
}
|
228
|
+
IOSHelper.updateAutoAdjustScrollInsets(this, owner);
|
229
|
+
// if (!owner.parent) {
|
230
|
+
// owner.callLoaded();
|
231
|
+
// console.log('callLoaded done');
|
232
|
+
// }
|
233
|
+
};
|
234
|
+
UILayoutViewController.prototype.viewDidDisappear = function (animated) {
|
235
|
+
_super.prototype.viewDidDisappear.call(this, animated);
|
236
|
+
// let s not call callUnloaded here in case
|
237
|
+
// another modal / sheet is shown on top
|
238
|
+
// will be called on dismiss
|
239
|
+
// const owner = this.owner.get();
|
240
|
+
// if (owner && !owner.parent) {
|
241
|
+
// owner.callUnloaded();
|
242
|
+
// }
|
243
|
+
};
|
244
|
+
// Mind implementation for other controllers
|
245
|
+
UILayoutViewController.prototype.traitCollectionDidChange = function (previousTraitCollection) {
|
246
|
+
_super.prototype.traitCollectionDidChange.call(this, previousTraitCollection);
|
247
|
+
if (majorVersion >= 13) {
|
248
|
+
var owner = this.owner.get();
|
249
|
+
if (owner &&
|
250
|
+
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection &&
|
251
|
+
this.traitCollection.hasDifferentColorAppearanceComparedToTraitCollection(previousTraitCollection)) {
|
252
|
+
owner.notify({ eventName: 'traitCollectionColorAppearanceChanged', object: owner });
|
253
|
+
}
|
254
|
+
}
|
255
|
+
};
|
256
|
+
return UILayoutViewController;
|
257
|
+
}(UIViewController));
|
258
|
+
export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
|
259
|
+
_showNativeBottomSheet(parent, options) {
|
260
|
+
options.context = options.context || {};
|
261
|
+
const parentWithController = IOSHelper.getParentWithViewController(parent);
|
262
|
+
if (!parentWithController) {
|
263
|
+
Trace.write(`Could not find parent with viewController for ${parent} while showing bottom sheet view.`, Trace.categories.ViewHierarchy, Trace.messageType.error);
|
264
|
+
return;
|
265
|
+
}
|
266
|
+
const parentController = parentWithController.viewController;
|
267
|
+
if (parentController.presentedViewController) {
|
268
|
+
Trace.write('Parent is already presenting view controller. Close the current bottom sheet page before showing another one!', Trace.categories.ViewHierarchy, Trace.messageType.error);
|
269
|
+
return;
|
270
|
+
}
|
271
|
+
if (!parentController.view || !parentController.view.window) {
|
272
|
+
Trace.write('Parent page is not part of the window hierarchy.', Trace.categories.ViewHierarchy, Trace.messageType.error);
|
273
|
+
return;
|
274
|
+
}
|
275
|
+
this._setupAsRootView({});
|
276
|
+
this._commonShowNativeBottomSheet(parentWithController, options);
|
277
|
+
let controller = this.viewController;
|
278
|
+
if (!controller) {
|
279
|
+
const nativeView = this.ios || this.nativeViewProtected;
|
280
|
+
controller = UILayoutViewController.initWithOwner(this);
|
281
|
+
if (options.ignoreBottomSafeArea !== undefined) {
|
282
|
+
controller.ignoreBottomSafeArea = options.ignoreBottomSafeArea;
|
283
|
+
}
|
284
|
+
else {
|
285
|
+
controller.ignoreBottomSafeArea = false;
|
286
|
+
}
|
287
|
+
if (options.ignoreTopSafeArea !== undefined) {
|
288
|
+
controller.ignoreTopSafeArea = options.ignoreTopSafeArea;
|
289
|
+
}
|
290
|
+
else {
|
291
|
+
controller.ignoreTopSafeArea = true;
|
292
|
+
}
|
293
|
+
if (nativeView instanceof UIView) {
|
294
|
+
controller.view.addSubview(nativeView);
|
295
|
+
}
|
296
|
+
this.viewController = controller;
|
297
|
+
}
|
298
|
+
this._raiseShowingBottomSheetEvent();
|
299
|
+
const bottomSheet = (this.bottomSheetController = MDCBottomSheetController.alloc().initWithContentViewController(controller));
|
300
|
+
this.bottomSheetControllerDelegate = bottomSheet.delegate = MDCBottomSheetControllerDelegateImpl.initWithOwner(this);
|
301
|
+
bottomSheet.isScrimAccessibilityElement = true;
|
302
|
+
bottomSheet.scrimAccessibilityLabel = 'close';
|
303
|
+
bottomSheet.dismissOnBackgroundTap = options.dismissOnBackgroundTap !== false;
|
304
|
+
bottomSheet.dismissOnDraggingDownSheet = options.dismissOnDraggingDownSheet !== false;
|
305
|
+
if (options.trackingScrollView) {
|
306
|
+
const scrollView = this.getViewById(options.trackingScrollView);
|
307
|
+
if (scrollView && scrollView.nativeViewProtected instanceof UIScrollView) {
|
308
|
+
bottomSheet.trackingScrollView = scrollView.nativeViewProtected;
|
309
|
+
}
|
310
|
+
}
|
311
|
+
controller.nsAnimated = true;
|
312
|
+
parentController.presentViewControllerAnimatedCompletion(bottomSheet, true, null);
|
313
|
+
if (options.transparent === true) {
|
314
|
+
controller.view.backgroundColor = UIColor.clearColor;
|
315
|
+
controller.view['elevation'] = 0;
|
316
|
+
}
|
317
|
+
else if (!(this instanceof Page)) {
|
318
|
+
controller.view.backgroundColor = majorVersion <= 12 && !UIColor.systemBackgroundColor ? UIColor.whiteColor : UIColor.systemBackgroundColor;
|
319
|
+
}
|
320
|
+
const transitionCoordinator = bottomSheet.transitionCoordinator;
|
321
|
+
if (transitionCoordinator) {
|
322
|
+
UIViewControllerTransitionCoordinator.prototype.animateAlongsideTransitionCompletion.call(transitionCoordinator, null, () => {
|
323
|
+
this.bindingContext = fromObject(options.context);
|
324
|
+
this._raiseShownBottomSheetEvent();
|
325
|
+
});
|
326
|
+
}
|
327
|
+
else {
|
328
|
+
this.bindingContext = fromObject(options.context);
|
329
|
+
this._raiseShownBottomSheetEvent();
|
330
|
+
}
|
331
|
+
}
|
332
|
+
_bottomSheetClosed() {
|
333
|
+
if (this.bottomSheetController) {
|
334
|
+
this.bottomSheetController.delegate = null;
|
335
|
+
this.bottomSheetController = null;
|
336
|
+
}
|
337
|
+
this.bottomSheetControllerDelegate = null;
|
338
|
+
}
|
339
|
+
_hideNativeBottomSheet(parent, whenClosedCallback) {
|
340
|
+
const parentWithController = IOSHelper.getParentWithViewController(parent);
|
341
|
+
if (!parent || !parentWithController) {
|
342
|
+
Trace.error('Trying to hide bottom-sheet view but no parent with viewController specified.');
|
343
|
+
return;
|
344
|
+
}
|
345
|
+
const parentController = parentWithController.viewController;
|
346
|
+
const animated = this.viewController.nsAnimated;
|
347
|
+
parentController.dismissViewControllerAnimatedCompletion(animated, whenClosedCallback);
|
348
|
+
}
|
349
|
+
}
|
350
|
+
let mixinInstalled = false;
|
351
|
+
export function overrideBottomSheet() {
|
352
|
+
applyMixins(View, [ViewWithBottomSheetBase, ViewWithBottomSheet]);
|
353
|
+
}
|
354
|
+
export function install() {
|
355
|
+
if (!mixinInstalled) {
|
356
|
+
mixinInstalled = true;
|
357
|
+
overrideBottomSheet();
|
358
|
+
}
|
359
|
+
}
|
360
|
+
//# sourceMappingURL=bottomsheet.ios.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"bottomsheet.ios.js","sourceRoot":"../src/","sources":["bottomsheet.ios.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAG1G,OAAO,EAAE,WAAW,EAAE,MAAM,0CAA0C,CAAC;AAEvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,MAAM,YAAY,GAAG,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyC5C,SAAS,eAAe,CAAC,UAA4B;IACjD,MAAM,QAAQ,GAAG,UAAU,CAAC,IAAI,CAAC;IACjC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