jsbox-cview 1.5.21 → 1.5.23
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/components/alert/input-alert.ts +5 -7
- package/components/alert/login-alert.ts +7 -7
- package/components/alert/plain-alert.ts +3 -3
- package/components/alert/uialert.ts +14 -6
- package/components/base.ts +12 -8
- package/components/custom-navigation-bar.ts +106 -88
- package/components/dialogs/dialog-sheet.ts +12 -8
- package/components/dialogs/form-dialog.ts +29 -16
- package/components/dialogs/list-dialog.ts +26 -20
- package/components/dialogs/text-dialog.ts +13 -8
- package/components/dynamic-contextmenu-view.ts +57 -25
- package/components/dynamic-itemsize-matrix.ts +45 -40
- package/components/dynamic-preference-listview.ts +135 -117
- package/components/dynamic-rowheight-list.ts +32 -20
- package/components/enhanced-imageview.ts +37 -28
- package/components/flowlayout.ts +61 -42
- package/components/image-pager.ts +33 -29
- package/components/page-control.ts +15 -11
- package/components/pageviewer-titlebar.ts +29 -22
- package/components/pageviewer.ts +33 -23
- package/components/refresh-button.ts +8 -8
- package/components/rotating-view.ts +24 -20
- package/components/searchbar.ts +113 -65
- package/components/sheet.ts +23 -17
- package/components/single-views.ts +228 -72
- package/components/spinners/loading-dual-ring.ts +21 -15
- package/components/spinners/loading-wedges.ts +24 -18
- package/components/spinners/spinner-androidstyle.ts +58 -47
- package/components/static-preference-listview.ts +197 -151
- package/components/symbol-button.ts +23 -22
- package/components/tabbar.ts +80 -64
- package/controller/base-controller.ts +42 -35
- package/controller/controller-router.ts +4 -4
- package/controller/pageviewer-controller.ts +41 -27
- package/controller/presented-page-controller.ts +27 -15
- package/controller/splitview-controller.ts +77 -44
- package/controller/tabbar-controller.ts +33 -23
- package/dist/components/alert/input-alert.js +3 -3
- package/dist/components/alert/login-alert.js +5 -5
- package/dist/components/alert/plain-alert.js +1 -1
- package/dist/components/alert/uialert.js +4 -4
- package/dist/components/base.js +2 -1
- package/dist/components/custom-navigation-bar.js +61 -59
- package/dist/components/dialogs/dialog-sheet.js +5 -5
- package/dist/components/dialogs/form-dialog.js +2 -2
- package/dist/components/dialogs/list-dialog.js +15 -15
- package/dist/components/dialogs/text-dialog.js +6 -6
- package/dist/components/dynamic-contextmenu-view.js +11 -8
- package/dist/components/dynamic-itemsize-matrix.js +15 -13
- package/dist/components/dynamic-preference-listview.js +95 -90
- package/dist/components/dynamic-rowheight-list.js +7 -6
- package/dist/components/enhanced-imageview.js +18 -16
- package/dist/components/flowlayout.js +15 -14
- package/dist/components/image-pager.js +22 -21
- package/dist/components/page-control.js +2 -2
- package/dist/components/pageviewer-titlebar.js +20 -17
- package/dist/components/pageviewer.js +13 -12
- package/dist/components/refresh-button.js +5 -5
- package/dist/components/rotating-view.js +11 -11
- package/dist/components/searchbar.js +53 -41
- package/dist/components/sheet.js +4 -4
- package/dist/components/single-views.js +68 -68
- package/dist/components/spinners/loading-dual-ring.js +10 -10
- package/dist/components/spinners/loading-wedges.js +15 -15
- package/dist/components/spinners/spinner-androidstyle.js +45 -43
- package/dist/components/static-preference-listview.js +101 -102
- package/dist/components/symbol-button.js +14 -13
- package/dist/components/tabbar.js +54 -50
- package/dist/controller/base-controller.js +17 -14
- package/dist/controller/pageviewer-controller.js +13 -11
- package/dist/controller/presented-page-controller.js +6 -4
- package/dist/controller/splitview-controller.js +48 -31
- package/dist/controller/tabbar-controller.js +13 -12
- package/dist/test/custom-navigation-bar.js +11 -9
- package/dist/test/dynamic-contextmenu-view.js +16 -14
- package/dist/test/dynamic-itemsize-matrix.js +18 -17
- package/dist/test/dynamic-preference-listview.js +29 -29
- package/dist/test/flowlayout.js +33 -27
- package/dist/test/form-dialog.js +15 -13
- package/dist/test/pageviewer-controller.js +10 -7
- package/dist/test/pageviewer-titlebar.js +3 -3
- package/dist/test/pageviewer.js +16 -7
- package/dist/test/refresh-button.js +4 -4
- package/dist/test/searchbar.js +7 -7
- package/dist/test/splitview-controller.js +14 -11
- package/dist/test/static-preference-listview.js +29 -30
- package/dist/test/tabbar-controller.js +15 -12
- package/dist/utils/colors.js +1 -2
- package/dist/utils/l10n.js +28 -28
- package/dist/utils/path.js +2 -2
- package/dist/utils/rect.js +30 -8
- package/dist/utils/uitools.js +29 -19
- package/index.ts +43 -43
- package/package.json +2 -2
- package/test/custom-navigation-bar.ts +28 -28
- package/test/dynamic-contextmenu-view.ts +23 -21
- package/test/dynamic-itemsize-matrix.ts +27 -22
- package/test/dynamic-preference-listview.ts +35 -35
- package/test/flowlayout.ts +43 -33
- package/test/form-dialog.ts +44 -43
- package/test/pageviewer-controller.ts +13 -11
- package/test/pageviewer-titlebar.ts +4 -5
- package/test/pageviewer.ts +17 -8
- package/test/refresh-button.ts +5 -5
- package/test/searchbar.ts +8 -8
- package/test/splitview-controller.ts +31 -30
- package/test/static-preference-listview.ts +35 -34
- package/test/tabbar-controller.ts +32 -29
- package/utils/colors.ts +7 -8
- package/utils/cvid.ts +1 -2
- package/utils/l10n.ts +32 -32
- package/utils/path.ts +9 -9
- package/utils/rect.ts +31 -8
- package/utils/uitools.ts +30 -22
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
UIAlertActionStyle,
|
|
3
3
|
UIAlertControllerStyle,
|
|
4
4
|
UIAlertAction,
|
|
5
|
-
UIAlertController
|
|
5
|
+
UIAlertController,
|
|
6
6
|
} from "./uialert";
|
|
7
7
|
|
|
8
8
|
import { l10n } from "../../utils/l10n";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 显示一个输入框提示
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @param title 标题
|
|
14
14
|
* @param message 内容
|
|
15
15
|
* @param text 输入框默认文字
|
|
@@ -27,7 +27,7 @@ export function inputAlert({
|
|
|
27
27
|
type = 0,
|
|
28
28
|
secure = false,
|
|
29
29
|
cancelText = l10n("CANCEL"),
|
|
30
|
-
confirmText = l10n("OK")
|
|
30
|
+
confirmText = l10n("OK"),
|
|
31
31
|
}: {
|
|
32
32
|
title?: string;
|
|
33
33
|
message?: string;
|
|
@@ -54,8 +54,8 @@ export function inputAlert({
|
|
|
54
54
|
const input = alertVC.getText(0);
|
|
55
55
|
const isValid = input.length > 0;
|
|
56
56
|
return isValid;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
alertVC.addAction(
|
|
@@ -75,5 +75,3 @@ export function inputAlert({
|
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
UIAlertActionStyle,
|
|
3
3
|
UIAlertControllerStyle,
|
|
4
4
|
UIAlertAction,
|
|
5
|
-
UIAlertController
|
|
5
|
+
UIAlertController,
|
|
6
6
|
} from "./uialert";
|
|
7
7
|
|
|
8
8
|
import { l10n } from "../../utils/l10n";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 显示一个登录输入框提示
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @param title 标题
|
|
14
14
|
* @param message 内容
|
|
15
15
|
* @param placeholder1 输入框1的占位符
|
|
@@ -23,7 +23,7 @@ export function loginAlert({
|
|
|
23
23
|
placeholder1 = "",
|
|
24
24
|
placeholder2 = "",
|
|
25
25
|
cancelText = l10n("CANCEL"),
|
|
26
|
-
confirmText = l10n("OK")
|
|
26
|
+
confirmText = l10n("OK"),
|
|
27
27
|
}: {
|
|
28
28
|
title?: string;
|
|
29
29
|
message?: string;
|
|
@@ -40,7 +40,7 @@ export function loginAlert({
|
|
|
40
40
|
);
|
|
41
41
|
|
|
42
42
|
alertVC.addTextField({
|
|
43
|
-
placeholder: placeholder1
|
|
43
|
+
placeholder: placeholder1,
|
|
44
44
|
});
|
|
45
45
|
|
|
46
46
|
alertVC.addTextField({
|
|
@@ -52,8 +52,8 @@ export function loginAlert({
|
|
|
52
52
|
const password = alertVC.getText(1);
|
|
53
53
|
const isValid = username.length > 0 && password.length > 0;
|
|
54
54
|
return isValid;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
57
|
});
|
|
58
58
|
|
|
59
59
|
alertVC.addAction(
|
|
@@ -69,7 +69,7 @@ export function loginAlert({
|
|
|
69
69
|
const password = alertVC.getText(1);
|
|
70
70
|
resolve({
|
|
71
71
|
username,
|
|
72
|
-
password
|
|
72
|
+
password,
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
function cancelEvent() {
|
|
@@ -2,14 +2,14 @@ import {
|
|
|
2
2
|
UIAlertActionStyle,
|
|
3
3
|
UIAlertControllerStyle,
|
|
4
4
|
UIAlertAction,
|
|
5
|
-
UIAlertController
|
|
5
|
+
UIAlertController,
|
|
6
6
|
} from "./uialert";
|
|
7
7
|
|
|
8
8
|
import { l10n } from "../../utils/l10n";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* 显示一个文字提示
|
|
12
|
-
*
|
|
12
|
+
*
|
|
13
13
|
* @param title 标题
|
|
14
14
|
* @param message 内容
|
|
15
15
|
* @param cancelText 取消按钮文字
|
|
@@ -20,7 +20,7 @@ export function plainAlert({
|
|
|
20
20
|
title = "",
|
|
21
21
|
message = "",
|
|
22
22
|
cancelText = l10n("CANCEL"),
|
|
23
|
-
confirmText = l10n("OK")
|
|
23
|
+
confirmText = l10n("OK"),
|
|
24
24
|
}: {
|
|
25
25
|
title?: string;
|
|
26
26
|
message?: string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export const UIAlertActionStyle = {
|
|
2
2
|
Default: 0,
|
|
3
3
|
Cancel: 1,
|
|
4
|
-
Destructive: 2
|
|
4
|
+
Destructive: 2,
|
|
5
5
|
};
|
|
6
6
|
|
|
7
7
|
export const UIAlertControllerStyle = {
|
|
8
8
|
ActionSheet: 0,
|
|
9
|
-
Alert: 1
|
|
9
|
+
Alert: 1,
|
|
10
10
|
};
|
|
11
11
|
|
|
12
12
|
export class UIAlertAction {
|
|
@@ -14,7 +14,11 @@ export class UIAlertAction {
|
|
|
14
14
|
style: number;
|
|
15
15
|
instance: any;
|
|
16
16
|
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
title: string,
|
|
19
|
+
style = UIAlertActionStyle.Default,
|
|
20
|
+
handler: Function
|
|
21
|
+
) {
|
|
18
22
|
this.title = title;
|
|
19
23
|
this.style = style;
|
|
20
24
|
this.instance = $objc("UIAlertAction").$actionWithTitle_style_handler(
|
|
@@ -37,7 +41,11 @@ export class UIAlertController {
|
|
|
37
41
|
message: string;
|
|
38
42
|
style: number;
|
|
39
43
|
instance: any;
|
|
40
|
-
constructor(
|
|
44
|
+
constructor(
|
|
45
|
+
title: string,
|
|
46
|
+
message: string,
|
|
47
|
+
style = UIAlertControllerStyle.ActionSheet
|
|
48
|
+
) {
|
|
41
49
|
this.title = title;
|
|
42
50
|
this.message = message;
|
|
43
51
|
this.style = style;
|
|
@@ -88,8 +96,8 @@ export class UIAlertController {
|
|
|
88
96
|
} else {
|
|
89
97
|
return true;
|
|
90
98
|
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
99
|
+
},
|
|
100
|
+
},
|
|
93
101
|
})
|
|
94
102
|
);
|
|
95
103
|
}
|
package/components/base.ts
CHANGED
|
@@ -1,28 +1,32 @@
|
|
|
1
|
-
import { cvid } from
|
|
1
|
+
import { cvid } from "../utils/cvid";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
5
|
* 组件 Base 基类,用于创建自定义组件。CView 的所有子类都应该继承自 Base。
|
|
6
|
-
*
|
|
6
|
+
*
|
|
7
7
|
* ## 属性
|
|
8
8
|
* - id: string 组件的唯一 id
|
|
9
9
|
* - view: T 通过自动创建的唯一 id 进行查找,获得对应的 UIView 对象
|
|
10
10
|
* - definition: R 获得对应的 view 的定义
|
|
11
|
-
*
|
|
11
|
+
*
|
|
12
12
|
* ## 方法
|
|
13
|
-
* - add(view: UiTypes.AllViewOptions | Base<any, any>): void 添加子 view
|
|
14
|
-
*
|
|
13
|
+
* - add(view: UiTypes.AllViewOptions | Base<any, any>): void 添加子 view。
|
|
14
|
+
* 其中 `view` 参数可以是 CView,或 view 的定义
|
|
15
|
+
*
|
|
15
16
|
* ## 说明
|
|
16
17
|
* 视图是 CView 框架的重点,其名称的含义为“组件化视图”。设计目的是:
|
|
17
18
|
* - 通过组件化的方式,将JSBox view的定义和实例绑定,使用起来更加方便
|
|
18
19
|
* - 可以便利地创建自定义组件
|
|
19
20
|
*/
|
|
20
|
-
export abstract class Base<
|
|
21
|
+
export abstract class Base<
|
|
22
|
+
T extends AllUIView,
|
|
23
|
+
R extends UiTypes.AllViewOptions
|
|
24
|
+
> {
|
|
21
25
|
readonly id: string;
|
|
22
26
|
private _view?: T;
|
|
23
27
|
abstract _defineView: () => R;
|
|
24
28
|
_layout?: (make: MASConstraintMaker, view: T) => void;
|
|
25
|
-
|
|
29
|
+
|
|
26
30
|
constructor() {
|
|
27
31
|
this.id = cvid.newId;
|
|
28
32
|
}
|