jsbox-cview 1.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/LICENSE +21 -0
- package/README.md +19 -0
- package/components/alert/input-alert.ts +73 -0
- package/components/alert/login-alert.ts +75 -0
- package/components/alert/plain-alert.ts +49 -0
- package/components/alert/uialert.ts +110 -0
- package/components/artificial-flowlayout.ts +321 -0
- package/components/base.ts +47 -0
- package/components/custom-navigation-bar.ts +570 -0
- package/components/dialogs/dialog-sheet.ts +87 -0
- package/components/dialogs/form-dialog.ts +23 -0
- package/components/dialogs/list-dialog.ts +87 -0
- package/components/dialogs/text-dialog.ts +34 -0
- package/components/dynamic-itemsize-matrix.ts +190 -0
- package/components/dynamic-preference-listview.ts +691 -0
- package/components/dynamic-rowheight-list.ts +62 -0
- package/components/enhanced-imageview.ts +128 -0
- package/components/image-pager.ts +177 -0
- package/components/page-control.ts +91 -0
- package/components/pageviewer-titlebar.ts +170 -0
- package/components/pageviewer.ts +124 -0
- package/components/rotating-view.ts +126 -0
- package/components/searchbar.ts +373 -0
- package/components/sheet.ts +113 -0
- package/components/single-views.ts +828 -0
- package/components/spinners/loading-double-rings.ts +121 -0
- package/components/spinners/loading-dual-ring.ts +90 -0
- package/components/spinners/loading-wedges.ts +112 -0
- package/components/spinners/spinner-androidstyle.ts +264 -0
- package/components/static-preference-listview.ts +991 -0
- package/components/symbol-button.ts +105 -0
- package/components/tabbar.ts +451 -0
- package/controller/base-controller.ts +216 -0
- package/controller/controller-router.ts +74 -0
- package/controller/pageviewer-controller.ts +86 -0
- package/controller/presented-page-controller.ts +57 -0
- package/controller/splitview-controller.ts +323 -0
- package/controller/tabbar-controller.ts +99 -0
- package/package.json +23 -0
- package/test.ts +0 -0
- package/tsconfig.json +121 -0
- package/utils/colors.ts +13 -0
- package/utils/cvid.ts +34 -0
- package/utils/l10n.ts +42 -0
- package/utils/path.ts +100 -0
- package/utils/rect.ts +67 -0
- package/utils/uitools.ts +117 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* # cview Sheet
|
|
3
|
+
*
|
|
4
|
+
* 创建新的 UIViewController,主要用于 formSheet 和 pageSheet
|
|
5
|
+
*
|
|
6
|
+
* ## 参数:
|
|
7
|
+
* - presentMode: number, default: 1, pageSheet: 1, formSheet: 2
|
|
8
|
+
* - animated: boolean = true 是否启用动画效果
|
|
9
|
+
* - interactiveDismissalDisabled: boolean = false 是否禁用下拉退出
|
|
10
|
+
* - bgcolor: $color $color("secondarySurface")
|
|
11
|
+
* - cview: Cview
|
|
12
|
+
* - dismissalHandler: function 退出时的回调
|
|
13
|
+
*
|
|
14
|
+
* ## 方法:
|
|
15
|
+
* - present()
|
|
16
|
+
* - dismiss()
|
|
17
|
+
*
|
|
18
|
+
*/
|
|
19
|
+
import {cvid} from "../utils/cvid";
|
|
20
|
+
import {Base} from "./base";
|
|
21
|
+
|
|
22
|
+
const UIModalPresentationStyle = {
|
|
23
|
+
automatic: -2,
|
|
24
|
+
pageSheet: 1,
|
|
25
|
+
formSheet: 2,
|
|
26
|
+
fullScreen: 0,
|
|
27
|
+
currentContext: 3,
|
|
28
|
+
custom: 4,
|
|
29
|
+
overFullScreen: 5,
|
|
30
|
+
overCurrentContext: 6,
|
|
31
|
+
popover: 7,
|
|
32
|
+
none: -1
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export class Sheet<T extends Base<U, R>, U extends AllUIView, R extends UiTypes.AllViewOptions> {
|
|
36
|
+
id: string;
|
|
37
|
+
_animated: boolean;
|
|
38
|
+
_presentMode: number;
|
|
39
|
+
_interactiveDismissalDisabled: boolean;
|
|
40
|
+
_bgcolor: UIColor;
|
|
41
|
+
_cview?: T;
|
|
42
|
+
_dismissalHandler?: () => void;
|
|
43
|
+
_PSViewController: any;
|
|
44
|
+
_PSViewControllerView: any;
|
|
45
|
+
|
|
46
|
+
constructor({
|
|
47
|
+
presentMode = UIModalPresentationStyle.pageSheet,
|
|
48
|
+
animated = true,
|
|
49
|
+
interactiveDismissalDisabled = false,
|
|
50
|
+
bgcolor = $color("secondarySurface"),
|
|
51
|
+
cview,
|
|
52
|
+
dismissalHandler
|
|
53
|
+
}: {
|
|
54
|
+
presentMode?: number;
|
|
55
|
+
animated?: boolean;
|
|
56
|
+
interactiveDismissalDisabled?: boolean;
|
|
57
|
+
bgcolor?: UIColor;
|
|
58
|
+
cview?: T;
|
|
59
|
+
dismissalHandler?: () => void;
|
|
60
|
+
}) {
|
|
61
|
+
this._animated = animated;
|
|
62
|
+
this._presentMode = presentMode;
|
|
63
|
+
this._interactiveDismissalDisabled = interactiveDismissalDisabled;
|
|
64
|
+
this._bgcolor = bgcolor;
|
|
65
|
+
this._cview = cview;
|
|
66
|
+
this._dismissalHandler = dismissalHandler;
|
|
67
|
+
this.id = cvid.newId;
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
_create() {
|
|
72
|
+
this._define();
|
|
73
|
+
this._PSViewController = $objc(this.id).invoke("alloc.init");
|
|
74
|
+
this._PSViewControllerView = this._PSViewController.$view();
|
|
75
|
+
this._PSViewControllerView.$setBackgroundColor(this._bgcolor);
|
|
76
|
+
this._PSViewController.$setModalPresentationStyle(this._presentMode);
|
|
77
|
+
if (this._interactiveDismissalDisabled)
|
|
78
|
+
this._PSViewController.$setModalInPresentation(true);
|
|
79
|
+
if (this._cview) this._add(this._cview);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
_define() {
|
|
83
|
+
$define({
|
|
84
|
+
type: this.id + ": UIViewController",
|
|
85
|
+
events: {
|
|
86
|
+
"viewDidDisappear:": () => {
|
|
87
|
+
if (this._dismissalHandler) this._dismissalHandler();
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
_add(cview: T) {
|
|
94
|
+
const definition = cview.definition
|
|
95
|
+
definition.layout = $layout.fill
|
|
96
|
+
this._PSViewControllerView.jsValue().add(definition);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
present() {
|
|
100
|
+
this._create()
|
|
101
|
+
$ui.controller
|
|
102
|
+
.ocValue()
|
|
103
|
+
.invoke(
|
|
104
|
+
"presentModalViewController:animated",
|
|
105
|
+
this._PSViewController,
|
|
106
|
+
this._animated
|
|
107
|
+
);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
dismiss() {
|
|
111
|
+
this._PSViewController.invoke("dismissModalViewControllerAnimated", true);
|
|
112
|
+
}
|
|
113
|
+
}
|