jsbox-cview 1.6.6 → 1.6.8
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/README.md +4 -0
- package/dist/components/alert/input-alert.d.ts +22 -0
- package/dist/components/alert/login-alert.d.ts +21 -0
- package/dist/components/alert/plain-alert.d.ts +15 -0
- package/dist/components/alert/uialert.d.ts +29 -0
- package/{components/base.ts → dist/components/base.d.ts} +9 -28
- package/dist/components/custom-navigation-bar.d.ts +117 -0
- package/dist/components/dialogs/dialog-sheet.d.ts +46 -0
- package/dist/components/dialogs/dialog-sheet.js +4 -2
- package/dist/components/dialogs/form-dialog.d.ts +15 -0
- package/dist/components/dialogs/list-dialog.d.ts +23 -0
- package/dist/components/dialogs/list-dialog.js +1 -1
- package/dist/components/dialogs/text-dialog.d.ts +13 -0
- package/dist/components/dynamic-contextmenu-view.d.ts +40 -0
- package/dist/components/dynamic-itemsize-matrix.d.ts +79 -0
- package/dist/components/dynamic-itemsize-matrix.js +1 -0
- package/dist/components/dynamic-itemsize-section-matrix.d.ts +115 -0
- package/dist/components/dynamic-preference-listview.d.ts +63 -0
- package/dist/components/dynamic-rowheight-list.d.ts +38 -0
- package/dist/components/enhanced-imageview.d.ts +41 -0
- package/dist/components/flowlayout.d.ts +63 -0
- package/dist/components/image-pager.d.ts +49 -0
- package/dist/components/oc-webview.d.ts +64 -0
- package/dist/components/page-control.d.ts +45 -0
- package/dist/components/pageviewer-titlebar.d.ts +48 -0
- package/dist/components/pageviewer.d.ts +41 -0
- package/dist/components/pageviewer.js +12 -3
- package/dist/components/refresh-button.d.ts +25 -0
- package/dist/components/rotating-view.d.ts +45 -0
- package/dist/components/searchbar.d.ts +118 -0
- package/dist/components/sheet.d.ts +42 -0
- package/dist/components/single-views.d.ts +289 -0
- package/dist/components/spinners/loading-dual-ring.d.ts +18 -0
- package/dist/components/spinners/loading-wedges.d.ts +15 -0
- package/dist/components/spinners/spinner-androidstyle.d.ts +30 -0
- package/dist/components/static-preference-listview.d.ts +389 -0
- package/dist/components/symbol-button.d.ts +39 -0
- package/dist/components/tabbar.d.ts +140 -0
- package/dist/controller/base-controller.d.ts +108 -0
- package/dist/controller/base-controller.js +10 -25
- package/dist/controller/controller-router.d.ts +48 -0
- package/dist/controller/controller-router.js +2 -1
- package/dist/controller/controller-status.d.ts +16 -0
- package/dist/controller/controller-status.js +19 -0
- package/dist/controller/pageviewer-controller.d.ts +38 -0
- package/dist/controller/pageviewer-controller.js +32 -3
- package/dist/controller/presented-page-controller.d.ts +41 -0
- package/dist/controller/splitview-controller.d.ts +90 -0
- package/dist/controller/splitview-controller.js +5 -0
- package/dist/controller/tabbar-controller.d.ts +49 -0
- package/dist/controller/tabbar-controller.js +2 -3
- package/{index.ts → dist/index.d.ts} +2 -0
- package/dist/index.js +2 -0
- package/dist/utils/colors.d.ts +7 -0
- package/dist/utils/cvid.d.ts +11 -0
- package/dist/utils/l10n.d.ts +1 -0
- package/dist/utils/path.d.ts +8 -0
- package/dist/utils/rect.d.ts +38 -0
- package/dist/utils/uitools.d.ts +75 -0
- package/package.json +20 -6
- package/.prettierignore +0 -6
- package/.prettierrc +0 -3
- package/components/alert/input-alert.ts +0 -64
- package/components/alert/login-alert.ts +0 -66
- package/components/alert/plain-alert.ts +0 -39
- package/components/alert/uialert.ts +0 -107
- package/components/custom-navigation-bar.ts +0 -579
- package/components/dialogs/dialog-sheet.ts +0 -111
- package/components/dialogs/form-dialog.ts +0 -63
- package/components/dialogs/list-dialog.ts +0 -119
- package/components/dialogs/text-dialog.ts +0 -44
- package/components/dynamic-contextmenu-view.ts +0 -115
- package/components/dynamic-itemsize-matrix.ts +0 -206
- package/components/dynamic-itemsize-section-matrix.ts +0 -363
- package/components/dynamic-preference-listview.ts +0 -684
- package/components/dynamic-rowheight-list.ts +0 -77
- package/components/enhanced-imageview.ts +0 -132
- package/components/flowlayout.ts +0 -248
- package/components/image-pager.ts +0 -180
- package/components/oc-webview.ts +0 -177
- package/components/page-control.ts +0 -93
- package/components/pageviewer-titlebar.ts +0 -166
- package/components/pageviewer.ts +0 -125
- package/components/refresh-button.ts +0 -83
- package/components/rotating-view.ts +0 -133
- package/components/searchbar.ts +0 -398
- package/components/sheet.ts +0 -104
- package/components/single-views.ts +0 -956
- package/components/spinners/loading-dual-ring.ts +0 -97
- package/components/spinners/loading-wedges.ts +0 -106
- package/components/spinners/spinner-androidstyle.ts +0 -269
- package/components/static-preference-listview.ts +0 -1282
- package/components/symbol-button.ts +0 -108
- package/components/tabbar.ts +0 -453
- package/controller/base-controller.ts +0 -214
- package/controller/controller-router.ts +0 -73
- package/controller/pageviewer-controller.ts +0 -93
- package/controller/presented-page-controller.ts +0 -76
- package/controller/splitview-controller.ts +0 -359
- package/controller/tabbar-controller.ts +0 -131
- package/dist/test/custom-navigation-bar.js +0 -40
- package/dist/test/dialog-sheet.js +0 -40
- package/dist/test/dynamic-contextmenu-view.js +0 -66
- package/dist/test/dynamic-itemsize-matrix.js +0 -74
- package/dist/test/dynamic-itemsize-section-matrix.js +0 -138
- package/dist/test/dynamic-preference-listview.js +0 -150
- package/dist/test/flowlayout.js +0 -76
- package/dist/test/form-dialog.js +0 -51
- package/dist/test/oc-webview.js +0 -195
- package/dist/test/pageviewer-controller.js +0 -20
- package/dist/test/pageviewer-titlebar.js +0 -18
- package/dist/test/pageviewer.js +0 -32
- package/dist/test/refresh-button.js +0 -26
- package/dist/test/searchbar.js +0 -36
- package/dist/test/splitview-controller.js +0 -41
- package/dist/test/static-preference-listview.js +0 -143
- package/dist/test/tabbar-controller.js +0 -48
- package/test/custom-navigation-bar.ts +0 -40
- package/test/dialog-sheet.ts +0 -40
- package/test/dynamic-contextmenu-view.ts +0 -67
- package/test/dynamic-itemsize-matrix.ts +0 -74
- package/test/dynamic-itemsize-section-matrix.ts +0 -142
- package/test/dynamic-preference-listview.ts +0 -151
- package/test/flowlayout.ts +0 -79
- package/test/form-dialog.ts +0 -48
- package/test/oc-webview.ts +0 -197
- package/test/pageviewer-controller.ts +0 -21
- package/test/pageviewer-titlebar.ts +0 -18
- package/test/pageviewer.ts +0 -31
- package/test/refresh-button.ts +0 -26
- package/test/searchbar.ts +0 -38
- package/test/splitview-controller.ts +0 -42
- package/test/static-preference-listview.ts +0 -142
- package/test/tabbar-controller.ts +0 -49
- package/tsconfig.json +0 -122
- package/utils/colors.ts +0 -17
- package/utils/cvid.ts +0 -32
- package/utils/l10n.ts +0 -42
- package/utils/path.ts +0 -97
- package/utils/rect.ts +0 -90
- package/utils/uitools.ts +0 -122
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 立即获得window size
|
|
3
|
+
*/
|
|
4
|
+
export declare function getWindowSize(): JBSize;
|
|
5
|
+
/**
|
|
6
|
+
* 获取单行字符串应有的宽度
|
|
7
|
+
* 默认额外添加3 inset
|
|
8
|
+
*/
|
|
9
|
+
export declare function getTextWidth(text: string, { font, inset }?: {
|
|
10
|
+
font?: UIFont | undefined;
|
|
11
|
+
inset?: number | undefined;
|
|
12
|
+
}): number;
|
|
13
|
+
/**
|
|
14
|
+
* 获取字符串指定宽度后应有的高度
|
|
15
|
+
* 默认额外添加3 inset
|
|
16
|
+
*/
|
|
17
|
+
export declare function getTextHeight(text: string, { width, font, inset, lineSpacing }?: {
|
|
18
|
+
width?: number | undefined;
|
|
19
|
+
font?: UIFont | undefined;
|
|
20
|
+
inset?: number | undefined;
|
|
21
|
+
lineSpacing?: number | undefined;
|
|
22
|
+
}): number;
|
|
23
|
+
/**
|
|
24
|
+
* 计算某个view在某个上级view(若不指定则为UIWindow)上的绝对frame
|
|
25
|
+
* 此方法不考虑旋转变形等特殊情况
|
|
26
|
+
*/
|
|
27
|
+
export declare function absoluteFrame(view: AllUIView, endView?: AllUIView): JBRect;
|
|
28
|
+
export declare const layerCommonOptions: {
|
|
29
|
+
none: {
|
|
30
|
+
cornerRadius: number;
|
|
31
|
+
shadowRadius: number;
|
|
32
|
+
shadowOpacity: number;
|
|
33
|
+
shadowOffset: JBSize;
|
|
34
|
+
shadowColor: UIColor;
|
|
35
|
+
};
|
|
36
|
+
roundedShadow: {
|
|
37
|
+
cornerRadius: number;
|
|
38
|
+
shadowRadius: number;
|
|
39
|
+
shadowOpacity: number;
|
|
40
|
+
shadowOffset: JBSize;
|
|
41
|
+
shadowColor: UIColor;
|
|
42
|
+
};
|
|
43
|
+
textShadow: {
|
|
44
|
+
cornerRadius: number;
|
|
45
|
+
shadowRadius: number;
|
|
46
|
+
shadowOpacity: number;
|
|
47
|
+
shadowOffset: JBSize;
|
|
48
|
+
shadowColor: UIColor;
|
|
49
|
+
};
|
|
50
|
+
circleViewShadow: {
|
|
51
|
+
cornerRadius: number;
|
|
52
|
+
shadowRadius: number;
|
|
53
|
+
shadowOpacity: number;
|
|
54
|
+
shadowOffset: JBSize;
|
|
55
|
+
shadowColor: UIColor;
|
|
56
|
+
};
|
|
57
|
+
toastShadows: {
|
|
58
|
+
cornerRadius: number;
|
|
59
|
+
shadowRadius: number;
|
|
60
|
+
shadowOpacity: number;
|
|
61
|
+
shadowOffset: JBSize;
|
|
62
|
+
shadowColor: UIColor;
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
/**
|
|
66
|
+
* 在layout中使用
|
|
67
|
+
* 所应用的view不可以指定radius和clipTobounds,否则无效
|
|
68
|
+
*/
|
|
69
|
+
export declare function setLayer(view: AllUIView, { cornerRadius, shadowRadius, shadowOpacity, shadowOffset, shadowColor, }?: {
|
|
70
|
+
cornerRadius?: number | undefined;
|
|
71
|
+
shadowRadius?: number | undefined;
|
|
72
|
+
shadowOpacity?: number | undefined;
|
|
73
|
+
shadowOffset?: JBSize | undefined;
|
|
74
|
+
shadowColor?: UIColor | undefined;
|
|
75
|
+
}): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsbox-cview",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.8",
|
|
4
4
|
"description": "为 JSBox 设计的微型框架",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -9,18 +9,32 @@
|
|
|
9
9
|
"homepage": "https://github.com/Gandum2077/JSBox-CView",
|
|
10
10
|
"bugs": "https://github.com/Gandum2077/JSBox-CView/issues",
|
|
11
11
|
"main": "dist/index.js",
|
|
12
|
+
"types": "dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist/index.js",
|
|
15
|
+
"dist/index.d.ts",
|
|
16
|
+
"dist/components",
|
|
17
|
+
"dist/controller",
|
|
18
|
+
"dist/utils",
|
|
19
|
+
"README.md",
|
|
20
|
+
"LICENSE"
|
|
21
|
+
],
|
|
12
22
|
"scripts": {
|
|
13
|
-
"build:debug": "tsc && npx browserify ${npm_config_entry:-./dist/index.js} > test.js",
|
|
14
|
-
"build": "tsc",
|
|
15
|
-
"format": "prettier --write ."
|
|
23
|
+
"build:debug": "tsc --outDir ./dist-debug && npx browserify ${npm_config_entry:-./dist-debug/index.js} > test.js",
|
|
24
|
+
"build": "tsc -p tsconfig.build.json",
|
|
25
|
+
"format": "prettier --write .",
|
|
26
|
+
"prepack": "npm run build"
|
|
16
27
|
},
|
|
17
28
|
"keywords": [],
|
|
18
29
|
"author": "Gandum2077",
|
|
19
30
|
"license": "MIT",
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"jsbox-types": "^2.0.3"
|
|
33
|
+
},
|
|
20
34
|
"devDependencies": {
|
|
21
35
|
"@types/node": "^20.11.17",
|
|
22
36
|
"browserify": "^17.0.1",
|
|
23
|
-
"
|
|
24
|
-
"
|
|
37
|
+
"prettier": "^3.8.1",
|
|
38
|
+
"typescript": "^6.0.3"
|
|
25
39
|
}
|
|
26
40
|
}
|
package/.prettierignore
DELETED
package/.prettierrc
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { UIAlertActionStyle, UIAlertControllerStyle, UIAlertAction, UIAlertController } from "./uialert";
|
|
2
|
-
|
|
3
|
-
import { l10n } from "../../utils/l10n";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 显示一个输入框提示
|
|
7
|
-
*
|
|
8
|
-
* @param title 标题
|
|
9
|
-
* @param message 内容
|
|
10
|
-
* @param text 输入框默认文字
|
|
11
|
-
* @param placeholder 输入框占位符
|
|
12
|
-
* @param type 输入框类型
|
|
13
|
-
* @param secure 是否安全输入
|
|
14
|
-
* @param cancelText 取消按钮文字
|
|
15
|
-
* @param confirmText 确认按钮文字
|
|
16
|
-
*/
|
|
17
|
-
export function inputAlert({
|
|
18
|
-
title = "",
|
|
19
|
-
message = "",
|
|
20
|
-
text = "",
|
|
21
|
-
placeholder,
|
|
22
|
-
type = 0,
|
|
23
|
-
secure = false,
|
|
24
|
-
cancelText = l10n("CANCEL"),
|
|
25
|
-
confirmText = l10n("OK"),
|
|
26
|
-
}: {
|
|
27
|
-
title?: string;
|
|
28
|
-
message?: string;
|
|
29
|
-
text?: string;
|
|
30
|
-
placeholder?: string;
|
|
31
|
-
type?: number;
|
|
32
|
-
secure?: boolean;
|
|
33
|
-
cancelText?: string;
|
|
34
|
-
confirmText?: string;
|
|
35
|
-
}): Promise<string> {
|
|
36
|
-
return new Promise((resolve, reject) => {
|
|
37
|
-
const alertVC = new UIAlertController(title, message, UIAlertControllerStyle.Alert);
|
|
38
|
-
alertVC.addTextField({
|
|
39
|
-
placeholder,
|
|
40
|
-
text,
|
|
41
|
-
type,
|
|
42
|
-
secure,
|
|
43
|
-
events: {
|
|
44
|
-
shouldReturn: () => {
|
|
45
|
-
const input = alertVC.getText(0);
|
|
46
|
-
const isValid = input.length > 0;
|
|
47
|
-
return isValid;
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
alertVC.addAction(new UIAlertAction(cancelText, UIAlertActionStyle.Destructive, cancelEvent));
|
|
53
|
-
alertVC.addAction(new UIAlertAction(confirmText, UIAlertActionStyle.Default, confirmEvent));
|
|
54
|
-
alertVC.present();
|
|
55
|
-
|
|
56
|
-
function confirmEvent() {
|
|
57
|
-
const input: string = alertVC.getText(0);
|
|
58
|
-
resolve(input);
|
|
59
|
-
}
|
|
60
|
-
function cancelEvent() {
|
|
61
|
-
reject("cancel");
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { UIAlertActionStyle, UIAlertControllerStyle, UIAlertAction, UIAlertController } from "./uialert";
|
|
2
|
-
|
|
3
|
-
import { l10n } from "../../utils/l10n";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 显示一个登录输入框提示
|
|
7
|
-
*
|
|
8
|
-
* @param title 标题
|
|
9
|
-
* @param message 内容
|
|
10
|
-
* @param placeholder1 输入框1的占位符
|
|
11
|
-
* @param placeholder2 输入框2的占位符
|
|
12
|
-
* @param cancelText 取消按钮文字
|
|
13
|
-
* @param confirmText 确认按钮文字
|
|
14
|
-
*/
|
|
15
|
-
export function loginAlert({
|
|
16
|
-
title = "",
|
|
17
|
-
message = "",
|
|
18
|
-
placeholder1 = "",
|
|
19
|
-
placeholder2 = "",
|
|
20
|
-
cancelText = l10n("CANCEL"),
|
|
21
|
-
confirmText = l10n("OK"),
|
|
22
|
-
}: {
|
|
23
|
-
title?: string;
|
|
24
|
-
message?: string;
|
|
25
|
-
placeholder1?: string;
|
|
26
|
-
placeholder2?: string;
|
|
27
|
-
cancelText?: string;
|
|
28
|
-
confirmText?: string;
|
|
29
|
-
} = {}): Promise<{ username: string; password: string }> {
|
|
30
|
-
return new Promise((resolve, reject) => {
|
|
31
|
-
const alertVC = new UIAlertController(title, message, UIAlertControllerStyle.Alert);
|
|
32
|
-
|
|
33
|
-
alertVC.addTextField({
|
|
34
|
-
placeholder: placeholder1,
|
|
35
|
-
});
|
|
36
|
-
|
|
37
|
-
alertVC.addTextField({
|
|
38
|
-
placeholder: placeholder2,
|
|
39
|
-
secure: true,
|
|
40
|
-
events: {
|
|
41
|
-
shouldReturn: () => {
|
|
42
|
-
const username = alertVC.getText(0);
|
|
43
|
-
const password = alertVC.getText(1);
|
|
44
|
-
const isValid = username.length > 0 && password.length > 0;
|
|
45
|
-
return isValid;
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
alertVC.addAction(new UIAlertAction(cancelText, UIAlertActionStyle.Destructive, cancelEvent));
|
|
51
|
-
alertVC.addAction(new UIAlertAction(confirmText, UIAlertActionStyle.Default, confirmEvent));
|
|
52
|
-
alertVC.present();
|
|
53
|
-
|
|
54
|
-
function confirmEvent() {
|
|
55
|
-
const username = alertVC.getText(0);
|
|
56
|
-
const password = alertVC.getText(1);
|
|
57
|
-
resolve({
|
|
58
|
-
username,
|
|
59
|
-
password,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
function cancelEvent() {
|
|
63
|
-
reject("cancel");
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { UIAlertActionStyle, UIAlertControllerStyle, UIAlertAction, UIAlertController } from "./uialert";
|
|
2
|
-
|
|
3
|
-
import { l10n } from "../../utils/l10n";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 显示一个文字提示
|
|
7
|
-
*
|
|
8
|
-
* @param title 标题
|
|
9
|
-
* @param message 内容
|
|
10
|
-
* @param cancelText 取消按钮文字
|
|
11
|
-
* @param confirmText 确认按钮文字
|
|
12
|
-
* @returns Promise
|
|
13
|
-
*/
|
|
14
|
-
export function plainAlert({
|
|
15
|
-
title = "",
|
|
16
|
-
message = "",
|
|
17
|
-
cancelText = l10n("CANCEL"),
|
|
18
|
-
confirmText = l10n("OK"),
|
|
19
|
-
}: {
|
|
20
|
-
title?: string;
|
|
21
|
-
message?: string;
|
|
22
|
-
cancelText?: string;
|
|
23
|
-
confirmText?: string;
|
|
24
|
-
} = {}): Promise<string> {
|
|
25
|
-
return new Promise((resolve, reject) => {
|
|
26
|
-
const alertVC = new UIAlertController(title, message, UIAlertControllerStyle.Alert);
|
|
27
|
-
|
|
28
|
-
alertVC.addAction(new UIAlertAction(cancelText, UIAlertActionStyle.Destructive, cancelEvent));
|
|
29
|
-
alertVC.addAction(new UIAlertAction(confirmText, UIAlertActionStyle.Default, confirmEvent));
|
|
30
|
-
alertVC.present();
|
|
31
|
-
|
|
32
|
-
function confirmEvent() {
|
|
33
|
-
resolve("ok");
|
|
34
|
-
}
|
|
35
|
-
function cancelEvent() {
|
|
36
|
-
reject("cancel");
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
export const UIAlertActionStyle = {
|
|
2
|
-
Default: 0,
|
|
3
|
-
Cancel: 1,
|
|
4
|
-
Destructive: 2,
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
export const UIAlertControllerStyle = {
|
|
8
|
-
ActionSheet: 0,
|
|
9
|
-
Alert: 1,
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export class UIAlertAction {
|
|
13
|
-
title: string;
|
|
14
|
-
style: number;
|
|
15
|
-
instance: any;
|
|
16
|
-
|
|
17
|
-
constructor(title: string, style = UIAlertActionStyle.Default, handler: Function) {
|
|
18
|
-
this.title = title;
|
|
19
|
-
this.style = style;
|
|
20
|
-
this.instance = $objc("UIAlertAction").$actionWithTitle_style_handler(
|
|
21
|
-
title,
|
|
22
|
-
style,
|
|
23
|
-
$block("void, UIAlertAction *", () => {
|
|
24
|
-
if (handler) {
|
|
25
|
-
handler(this);
|
|
26
|
-
}
|
|
27
|
-
}),
|
|
28
|
-
);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
/**
|
|
33
|
-
* Alert的基础类
|
|
34
|
-
*/
|
|
35
|
-
export class UIAlertController {
|
|
36
|
-
title: string;
|
|
37
|
-
message: string;
|
|
38
|
-
style: number;
|
|
39
|
-
instance: any;
|
|
40
|
-
constructor(title: string, message: string, style = UIAlertControllerStyle.ActionSheet) {
|
|
41
|
-
this.title = title;
|
|
42
|
-
this.message = message;
|
|
43
|
-
this.style = style;
|
|
44
|
-
this.instance = $objc("UIAlertController").$alertControllerWithTitle_message_preferredStyle(title, message, style);
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
addAction(action: UIAlertAction) {
|
|
48
|
-
this.instance.$addAction(action.instance);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
addTextField(options: any) {
|
|
52
|
-
this.instance.$addTextFieldWithConfigurationHandler(
|
|
53
|
-
$block("void, UITextField *", (textField: any) => {
|
|
54
|
-
textField.$setClearButtonMode(1);
|
|
55
|
-
|
|
56
|
-
if (options.type) {
|
|
57
|
-
textField.$setKeyboardType(options.type);
|
|
58
|
-
}
|
|
59
|
-
if (options.placeholder) {
|
|
60
|
-
textField.$setPlaceholder(options.placeholder);
|
|
61
|
-
}
|
|
62
|
-
if (options.text) {
|
|
63
|
-
textField.$setText(options.text);
|
|
64
|
-
}
|
|
65
|
-
if (options.textColor) {
|
|
66
|
-
textField.$setTextColor(options.textColor.ocValue());
|
|
67
|
-
}
|
|
68
|
-
if (options.font) {
|
|
69
|
-
textField.$setFont(options.font.ocValue());
|
|
70
|
-
}
|
|
71
|
-
if (options.align) {
|
|
72
|
-
textField.$setTextAlignment(options.align);
|
|
73
|
-
}
|
|
74
|
-
if (options.secure) {
|
|
75
|
-
textField.$setSecureTextEntry(true);
|
|
76
|
-
}
|
|
77
|
-
if (options.events) {
|
|
78
|
-
const events = options.events;
|
|
79
|
-
textField.$setDelegate(
|
|
80
|
-
$delegate({
|
|
81
|
-
type: "UITextFieldDelegate",
|
|
82
|
-
events: {
|
|
83
|
-
"textFieldShouldReturn:": (textField: any) => {
|
|
84
|
-
if (events.shouldReturn) {
|
|
85
|
-
return events.shouldReturn();
|
|
86
|
-
} else {
|
|
87
|
-
return true;
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
},
|
|
91
|
-
}),
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
}),
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
getText(index: number) {
|
|
99
|
-
const textField = this.instance.$textFields().$objectAtIndex(index);
|
|
100
|
-
const text = textField.$text();
|
|
101
|
-
return text.jsValue();
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
present() {
|
|
105
|
-
this.instance.$show();
|
|
106
|
-
}
|
|
107
|
-
}
|