jsbox-cview 1.6.6 → 1.6.7
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 +3 -1
- 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/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 +125 -0
- package/dist/controller/base-controller.js +11 -11
- package/dist/controller/controller-router.d.ts +48 -0
- package/dist/controller/pageviewer-controller.d.ts +38 -0
- 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 +4 -0
- package/dist/controller/tabbar-controller.d.ts +49 -0
- package/dist/controller/tabbar-controller.js +0 -2
- package/{index.ts → dist/index.d.ts} +1 -0
- package/dist/index.js +1 -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
|
@@ -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
|
-
}
|