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
|
@@ -5,22 +5,7 @@ const base_1 = require("../components/base");
|
|
|
5
5
|
const single_views_1 = require("../components/single-views");
|
|
6
6
|
const cvid_1 = require("../utils/cvid");
|
|
7
7
|
const controller_router_1 = require("./controller-router");
|
|
8
|
-
|
|
9
|
-
* status
|
|
10
|
-
* - created = 0 被创建,未被加载
|
|
11
|
-
* - loaded = 1 被加载,显示状态未知
|
|
12
|
-
* - appeared= 2 处于可显示状态
|
|
13
|
-
* - disappeared = 3 处于不显示状态
|
|
14
|
-
* - removed = 4 根视图被移除
|
|
15
|
-
* 其中只有 2 和 3 可以相互转化,其他不可以
|
|
16
|
-
*/
|
|
17
|
-
const controllerStatus = {
|
|
18
|
-
created: 0,
|
|
19
|
-
loaded: 1,
|
|
20
|
-
appeared: 2,
|
|
21
|
-
disappeared: 3,
|
|
22
|
-
removed: 4,
|
|
23
|
-
};
|
|
8
|
+
const controller_status_1 = require("./controller-status");
|
|
24
9
|
class ControllerRootView extends single_views_1.ContentView {
|
|
25
10
|
constructor({ props, layout, events, }) {
|
|
26
11
|
super({ props, layout, events });
|
|
@@ -102,7 +87,7 @@ class BaseController {
|
|
|
102
87
|
this._props = props || {};
|
|
103
88
|
this._events = events;
|
|
104
89
|
this.id = this._props.id || cvid_1.cvid.newId;
|
|
105
|
-
this._status = controllerStatus.created; // status使用额外的get来使其只读
|
|
90
|
+
this._status = controller_status_1.controllerStatus.created; // status使用额外的get来使其只读
|
|
106
91
|
this.rootView = new ControllerRootView({
|
|
107
92
|
props: {
|
|
108
93
|
bgcolor: this._props.bgcolor || $color("primarySurface"),
|
|
@@ -116,38 +101,38 @@ class BaseController {
|
|
|
116
101
|
}
|
|
117
102
|
load() {
|
|
118
103
|
// 只有status为created才可以运行
|
|
119
|
-
if (this._status !== controllerStatus.created)
|
|
104
|
+
if (this._status !== controller_status_1.controllerStatus.created)
|
|
120
105
|
return;
|
|
121
|
-
this._status = controllerStatus.loaded;
|
|
106
|
+
this._status = controller_status_1.controllerStatus.loaded;
|
|
122
107
|
if (this._events.didLoad)
|
|
123
108
|
this._events.didLoad(this);
|
|
124
109
|
controller_router_1.router.add(this);
|
|
125
110
|
}
|
|
126
111
|
appear() {
|
|
127
112
|
// 只有status为loaded或者disappeared,才可以运行
|
|
128
|
-
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.disappeared)
|
|
113
|
+
if (this._status !== controller_status_1.controllerStatus.loaded && this._status !== controller_status_1.controllerStatus.disappeared)
|
|
129
114
|
return;
|
|
130
115
|
if (this._events.didAppear)
|
|
131
116
|
this._events.didAppear(this);
|
|
132
|
-
this._status = controllerStatus.appeared;
|
|
117
|
+
this._status = controller_status_1.controllerStatus.appeared;
|
|
133
118
|
}
|
|
134
119
|
disappear() {
|
|
135
120
|
// 只有status为loaded或者appeared,才可以运行
|
|
136
|
-
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.appeared)
|
|
121
|
+
if (this._status !== controller_status_1.controllerStatus.loaded && this._status !== controller_status_1.controllerStatus.appeared)
|
|
137
122
|
return;
|
|
138
123
|
if (this._events.didDisappear)
|
|
139
124
|
this._events.didDisappear(this);
|
|
140
|
-
this._status = controllerStatus.disappeared;
|
|
125
|
+
this._status = controller_status_1.controllerStatus.disappeared;
|
|
141
126
|
}
|
|
142
127
|
// 此方法不能用于移除rootView,其作用是将控制器从Router中移除,并触发didRemove事件
|
|
143
128
|
remove() {
|
|
144
129
|
// 如果已经移除,不可以再次运行
|
|
145
|
-
if (this._status === controllerStatus.removed)
|
|
130
|
+
if (this._status === controller_status_1.controllerStatus.removed)
|
|
146
131
|
return;
|
|
147
132
|
if (this._events.didRemove)
|
|
148
133
|
this._events.didRemove(this);
|
|
149
134
|
controller_router_1.router.delete(this);
|
|
150
|
-
this._status = controllerStatus.removed;
|
|
135
|
+
this._status = controller_status_1.controllerStatus.removed;
|
|
151
136
|
}
|
|
152
137
|
uirender(props) {
|
|
153
138
|
controller_router_1.router.root = this;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { BaseController } from "./base-controller";
|
|
2
|
+
/**
|
|
3
|
+
* 控制器的路由器,用于管理控制器的集合和操作。
|
|
4
|
+
*
|
|
5
|
+
* ## 属性
|
|
6
|
+
* - `root`:根控制器。
|
|
7
|
+
* - `appeared`:状态为appeared的控制器列表。
|
|
8
|
+
* - `controllerSet`:控制器集合。
|
|
9
|
+
*
|
|
10
|
+
* ## 方法
|
|
11
|
+
* - `add(controller: BaseController)`:添加控制器到路由器中。
|
|
12
|
+
* - `delete(controller: BaseController)`:从路由器中删除控制器。
|
|
13
|
+
* - `get(id: string)`:根据控制器的ID获取控制器。
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
declare class Router {
|
|
17
|
+
private _set;
|
|
18
|
+
root?: BaseController;
|
|
19
|
+
constructor();
|
|
20
|
+
/**
|
|
21
|
+
* 添加控制器到路由器中。
|
|
22
|
+
* @param controller 要添加的控制器。
|
|
23
|
+
*/
|
|
24
|
+
add(controller: BaseController): void;
|
|
25
|
+
/**
|
|
26
|
+
* 从路由器中删除控制器。
|
|
27
|
+
* @param controller 要删除的控制器。
|
|
28
|
+
*/
|
|
29
|
+
delete(controller: BaseController): void;
|
|
30
|
+
/**
|
|
31
|
+
* 根据控制器的ID获取控制器。
|
|
32
|
+
* @param id 控制器的ID。
|
|
33
|
+
* @returns 匹配的控制器,如果找不到则返回undefined。
|
|
34
|
+
*/
|
|
35
|
+
get(id: string): BaseController | undefined;
|
|
36
|
+
/**
|
|
37
|
+
* 获取状态为appeared的控制器集合。
|
|
38
|
+
* @returns 控制器集合。
|
|
39
|
+
*/
|
|
40
|
+
get appeared(): BaseController[];
|
|
41
|
+
/**
|
|
42
|
+
* 获取控制器集合。
|
|
43
|
+
* @returns 控制器集合。
|
|
44
|
+
*/
|
|
45
|
+
get controllerSet(): Set<BaseController>;
|
|
46
|
+
}
|
|
47
|
+
export declare const router: Router;
|
|
48
|
+
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.router = void 0;
|
|
4
|
+
const controller_status_1 = require("./controller-status");
|
|
4
5
|
/**
|
|
5
6
|
* 控制器的路由器,用于管理控制器的集合和操作。
|
|
6
7
|
*
|
|
@@ -52,7 +53,7 @@ class Router {
|
|
|
52
53
|
get appeared() {
|
|
53
54
|
const appearedControllers = [];
|
|
54
55
|
for (const c of this._set) {
|
|
55
|
-
if (c.status ===
|
|
56
|
+
if (c.status === controller_status_1.controllerStatus.appeared)
|
|
56
57
|
appearedControllers.push(c);
|
|
57
58
|
}
|
|
58
59
|
return appearedControllers;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* status
|
|
3
|
+
* - created = 0 被创建,未被加载
|
|
4
|
+
* - loaded = 1 被加载,显示状态未知
|
|
5
|
+
* - appeared= 2 处于可显示状态
|
|
6
|
+
* - disappeared = 3 处于不显示状态
|
|
7
|
+
* - removed = 4 根视图被移除
|
|
8
|
+
* 其中只有 2 和 3 可以相互转化,其他不可以
|
|
9
|
+
*/
|
|
10
|
+
export declare const controllerStatus: {
|
|
11
|
+
readonly created: 0;
|
|
12
|
+
readonly loaded: 1;
|
|
13
|
+
readonly appeared: 2;
|
|
14
|
+
readonly disappeared: 3;
|
|
15
|
+
readonly removed: 4;
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.controllerStatus = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* status
|
|
6
|
+
* - created = 0 被创建,未被加载
|
|
7
|
+
* - loaded = 1 被加载,显示状态未知
|
|
8
|
+
* - appeared= 2 处于可显示状态
|
|
9
|
+
* - disappeared = 3 处于不显示状态
|
|
10
|
+
* - removed = 4 根视图被移除
|
|
11
|
+
* 其中只有 2 和 3 可以相互转化,其他不可以
|
|
12
|
+
*/
|
|
13
|
+
exports.controllerStatus = {
|
|
14
|
+
created: 0,
|
|
15
|
+
loaded: 1,
|
|
16
|
+
appeared: 2,
|
|
17
|
+
disappeared: 3,
|
|
18
|
+
removed: 4,
|
|
19
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
2
|
+
import { PageViewer } from "../components/pageviewer";
|
|
3
|
+
import { PageViewerTitleBar } from "../components/pageviewer-titlebar";
|
|
4
|
+
import { CustomNavigationBar, NavigationBarProps } from "../components/custom-navigation-bar";
|
|
5
|
+
interface PageViewerControllerProps extends BaseControllerProps {
|
|
6
|
+
items: {
|
|
7
|
+
controller: BaseController;
|
|
8
|
+
title: string;
|
|
9
|
+
}[];
|
|
10
|
+
navBarProps?: Partial<NavigationBarProps>;
|
|
11
|
+
index?: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* # CView PageViewer Controller
|
|
15
|
+
*
|
|
16
|
+
* 一个可以左右滑动翻页的控制器。
|
|
17
|
+
*
|
|
18
|
+
* Props:
|
|
19
|
+
*
|
|
20
|
+
* - items: { controller: Controller, title: string }[]
|
|
21
|
+
* - navBarProps: {} 可用于 navBar 的其他属性,不包括 title 和 titleView
|
|
22
|
+
*/
|
|
23
|
+
export declare class PageViewerController extends BaseController {
|
|
24
|
+
protected _props: PageViewerControllerProps;
|
|
25
|
+
cviews: {
|
|
26
|
+
pageviewer: PageViewer;
|
|
27
|
+
titlebar: PageViewerTitleBar;
|
|
28
|
+
navbar: CustomNavigationBar;
|
|
29
|
+
};
|
|
30
|
+
constructor({ props, layout, events, }: {
|
|
31
|
+
props: PageViewerControllerProps;
|
|
32
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
33
|
+
events?: BaseControllerEvents;
|
|
34
|
+
});
|
|
35
|
+
get index(): number;
|
|
36
|
+
set index(num: number);
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -5,6 +5,7 @@ const base_controller_1 = require("./base-controller");
|
|
|
5
5
|
const pageviewer_1 = require("../components/pageviewer");
|
|
6
6
|
const pageviewer_titlebar_1 = require("../components/pageviewer-titlebar");
|
|
7
7
|
const custom_navigation_bar_1 = require("../components/custom-navigation-bar");
|
|
8
|
+
const controller_status_1 = require("./controller-status");
|
|
8
9
|
/**
|
|
9
10
|
* # CView PageViewer Controller
|
|
10
11
|
*
|
|
@@ -23,7 +24,20 @@ class PageViewerController extends base_controller_1.BaseController {
|
|
|
23
24
|
bgcolor: props.bgcolor,
|
|
24
25
|
},
|
|
25
26
|
layout,
|
|
26
|
-
events
|
|
27
|
+
events: {
|
|
28
|
+
didLoad: events.didLoad,
|
|
29
|
+
didAppear: (controller) => {
|
|
30
|
+
props.items[this.index].controller.appear();
|
|
31
|
+
events.didAppear?.(controller);
|
|
32
|
+
},
|
|
33
|
+
didDisappear: (controller) => {
|
|
34
|
+
props.items.forEach((item) => item.controller.disappear());
|
|
35
|
+
events.didDisappear?.(controller);
|
|
36
|
+
},
|
|
37
|
+
didRemove: (controller) => {
|
|
38
|
+
events.didRemove?.(controller);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
27
41
|
});
|
|
28
42
|
this._props = props;
|
|
29
43
|
this.cviews = {};
|
|
@@ -37,13 +51,28 @@ class PageViewerController extends base_controller_1.BaseController {
|
|
|
37
51
|
make.top.equalTo(view.prev.bottom);
|
|
38
52
|
},
|
|
39
53
|
events: {
|
|
40
|
-
floatPageChanged: (cview, floatPage) =>
|
|
54
|
+
floatPageChanged: (cview, floatPage) => {
|
|
55
|
+
this.cviews.titlebar.floatedIndex = floatPage;
|
|
56
|
+
},
|
|
57
|
+
changed: (cview, page) => {
|
|
58
|
+
this._props.index = page;
|
|
59
|
+
if (this.status !== controller_status_1.controllerStatus.appeared)
|
|
60
|
+
return;
|
|
61
|
+
this._props.items.forEach((item, i) => {
|
|
62
|
+
if (i === page) {
|
|
63
|
+
item.controller.appear();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
item.controller.disappear();
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
},
|
|
41
70
|
},
|
|
42
71
|
});
|
|
43
72
|
this.cviews.titlebar = new pageviewer_titlebar_1.PageViewerTitleBar({
|
|
44
73
|
props: {
|
|
45
74
|
items: this._props.items.map((n) => n.title),
|
|
46
|
-
index: this._props.index
|
|
75
|
+
index: this._props.index ?? 0,
|
|
47
76
|
},
|
|
48
77
|
layout: $layout.fill,
|
|
49
78
|
events: {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
2
|
+
interface PresentedPageControllerProps extends BaseControllerProps {
|
|
3
|
+
presentMode?: number;
|
|
4
|
+
animated?: boolean;
|
|
5
|
+
interactiveDismissalDisabled?: boolean;
|
|
6
|
+
}
|
|
7
|
+
interface PresentedPageControllerEvents extends BaseControllerEvents {
|
|
8
|
+
dismissed?: (controller: PresentedPageController) => void;
|
|
9
|
+
}
|
|
10
|
+
/** # CView PresentedPageController
|
|
11
|
+
*
|
|
12
|
+
* ## Props
|
|
13
|
+
*
|
|
14
|
+
* - presentMode?: number = 1
|
|
15
|
+
* - animated?: boolean = true
|
|
16
|
+
* - interactiveDismissalDisabled?: boolean = false
|
|
17
|
+
* - bgcolor?: UIColor = $color("secondarySurface")
|
|
18
|
+
*
|
|
19
|
+
* ## 专用事件
|
|
20
|
+
*
|
|
21
|
+
* - dismissed: function 退出时的回调
|
|
22
|
+
*
|
|
23
|
+
* ## 专用方法
|
|
24
|
+
*
|
|
25
|
+
* - present() 在 `sheet.present()` 之后会先后执行 `load()` 和 `appear()`
|
|
26
|
+
* - dismiss()
|
|
27
|
+
*
|
|
28
|
+
* ## 布局
|
|
29
|
+
* 此控制器的 layout 必定为 `$layout.fill`,无需自行设定
|
|
30
|
+
*/
|
|
31
|
+
export declare class PresentedPageController extends BaseController {
|
|
32
|
+
private _sheet;
|
|
33
|
+
constructor({ props, layout, events, }?: {
|
|
34
|
+
props?: Partial<PresentedPageControllerProps>;
|
|
35
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
36
|
+
events?: PresentedPageControllerEvents;
|
|
37
|
+
});
|
|
38
|
+
present(): void;
|
|
39
|
+
dismiss(): void;
|
|
40
|
+
}
|
|
41
|
+
export {};
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
2
|
+
import { Base } from "../components/base";
|
|
3
|
+
import { ContentView } from "../components/single-views";
|
|
4
|
+
declare class SecondaryView extends Base<UIView, UiTypes.ViewOptions> {
|
|
5
|
+
_props: UiTypes.ViewProps;
|
|
6
|
+
_layouts: {
|
|
7
|
+
hidden: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
8
|
+
shown: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
9
|
+
};
|
|
10
|
+
line: ContentView;
|
|
11
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
12
|
+
constructor({ props, layout, views, }: {
|
|
13
|
+
props?: UiTypes.ViewProps;
|
|
14
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
15
|
+
views?: UiTypes.AllViewOptions[];
|
|
16
|
+
});
|
|
17
|
+
add(view: UiTypes.AllViewOptions | Base<any, any>): void;
|
|
18
|
+
show(): void;
|
|
19
|
+
hide(): void;
|
|
20
|
+
}
|
|
21
|
+
declare class MaskView extends Base<UIView, UiTypes.ViewOptions> {
|
|
22
|
+
_props: {
|
|
23
|
+
bgcolor: UIColor;
|
|
24
|
+
dismissHandler?: () => void;
|
|
25
|
+
};
|
|
26
|
+
_shown: boolean;
|
|
27
|
+
_dismissEvent: () => void;
|
|
28
|
+
_gestureObject: any;
|
|
29
|
+
_defineView: () => UiTypes.ViewOptions;
|
|
30
|
+
constructor({ props, layout, }: {
|
|
31
|
+
props: {
|
|
32
|
+
bgcolor?: UIColor;
|
|
33
|
+
dismissHandler?: () => void;
|
|
34
|
+
};
|
|
35
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
36
|
+
});
|
|
37
|
+
_addGesture(view: UIView, event: () => void): void;
|
|
38
|
+
releaseGestureObject(): void;
|
|
39
|
+
show(): void;
|
|
40
|
+
hide(): void;
|
|
41
|
+
}
|
|
42
|
+
interface SplitViewControllerProps extends BaseControllerProps {
|
|
43
|
+
items: {
|
|
44
|
+
controller: BaseController;
|
|
45
|
+
bgcolor: UIColor;
|
|
46
|
+
}[];
|
|
47
|
+
}
|
|
48
|
+
/** # CView SplitView Controller
|
|
49
|
+
*
|
|
50
|
+
* 实现左右分栏布局的控制器, 本身不提供除了分割线以外的视觉效果
|
|
51
|
+
*
|
|
52
|
+
* 此控制器加载后,会禁用原本的ScreenEdgePanGesture,此控制器应该作为根控制器使用
|
|
53
|
+
*
|
|
54
|
+
* @param options.props.items: { controller: Controller, bgcolor: UIColor }[]
|
|
55
|
+
* 其中第一个放在主视图上, 第二个放在次视图上
|
|
56
|
+
*
|
|
57
|
+
* @property sideBarShown: boolean = false 侧栏是否显示
|
|
58
|
+
* @property canShowSidebar: boolean = true 是否启动显示侧栏的动作
|
|
59
|
+
* (若为false,依然可以用sideBarShown来控制侧栏的显示)
|
|
60
|
+
*/
|
|
61
|
+
export declare class SplitViewController extends BaseController {
|
|
62
|
+
private _screenEdgePanGestureObject;
|
|
63
|
+
private _sideBarShown;
|
|
64
|
+
private _canShowSidebar;
|
|
65
|
+
private _primaryController;
|
|
66
|
+
private _secondaryController;
|
|
67
|
+
cviews: {
|
|
68
|
+
primaryView: ContentView;
|
|
69
|
+
secondaryView: SecondaryView;
|
|
70
|
+
maskView: MaskView;
|
|
71
|
+
};
|
|
72
|
+
constructor({ props, layout, events, }: {
|
|
73
|
+
props: SplitViewControllerProps;
|
|
74
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
75
|
+
events?: BaseControllerEvents;
|
|
76
|
+
});
|
|
77
|
+
load(): void;
|
|
78
|
+
remove(): void;
|
|
79
|
+
uirender(): void;
|
|
80
|
+
uipush(): void;
|
|
81
|
+
_defineGestureObject(event: () => void): any;
|
|
82
|
+
_renewScreenEdgePanGesture(): void;
|
|
83
|
+
_showSideBar(): void;
|
|
84
|
+
_hideSideBar(): void;
|
|
85
|
+
get sideBarShown(): boolean;
|
|
86
|
+
set sideBarShown(bool: boolean);
|
|
87
|
+
get canShowSidebar(): boolean;
|
|
88
|
+
set canShowSidebar(bool: boolean);
|
|
89
|
+
}
|
|
90
|
+
export {};
|
|
@@ -5,6 +5,7 @@ const base_controller_1 = require("./base-controller");
|
|
|
5
5
|
const base_1 = require("../components/base");
|
|
6
6
|
const single_views_1 = require("../components/single-views");
|
|
7
7
|
const cvid_1 = require("../utils/cvid");
|
|
8
|
+
const controller_status_1 = require("./controller-status");
|
|
8
9
|
class SecondaryView extends base_1.Base {
|
|
9
10
|
constructor({ props, layout, views = [], }) {
|
|
10
11
|
super();
|
|
@@ -207,10 +208,14 @@ class SplitViewController extends base_controller_1.BaseController {
|
|
|
207
208
|
this.rootView.views = [this.cviews.secondaryView, this.cviews.primaryView];
|
|
208
209
|
}
|
|
209
210
|
load() {
|
|
211
|
+
if (this.status !== controller_status_1.controllerStatus.created)
|
|
212
|
+
return;
|
|
210
213
|
super.load();
|
|
211
214
|
this._renewScreenEdgePanGesture();
|
|
212
215
|
}
|
|
213
216
|
remove() {
|
|
217
|
+
if (this.status === controller_status_1.controllerStatus.removed)
|
|
218
|
+
return;
|
|
214
219
|
$objc_release(this._screenEdgePanGestureObject);
|
|
215
220
|
this.cviews.maskView.releaseGestureObject();
|
|
216
221
|
super.remove();
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
2
|
+
import { ContentView } from "../components/single-views";
|
|
3
|
+
import { TabBar } from "../components/tabbar";
|
|
4
|
+
interface TabBarControllerProps extends BaseControllerProps {
|
|
5
|
+
items: {
|
|
6
|
+
title?: string;
|
|
7
|
+
symbol?: string;
|
|
8
|
+
image?: UIImage;
|
|
9
|
+
tintColor?: UIColor;
|
|
10
|
+
bgcolor?: UIColor;
|
|
11
|
+
controller: BaseController;
|
|
12
|
+
}[];
|
|
13
|
+
index?: number;
|
|
14
|
+
}
|
|
15
|
+
interface TabBarControllerEvents extends BaseControllerEvents {
|
|
16
|
+
changed?: (controller: TabBarController, index: number) => void;
|
|
17
|
+
doubleTapped?: (controller: TabBarController, index: number) => void;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* # CView TabBar Controller
|
|
21
|
+
*
|
|
22
|
+
* TabBarController 是一个 PagingController
|
|
23
|
+
*
|
|
24
|
+
* ## 属性
|
|
25
|
+
*
|
|
26
|
+
* - items: {title?: string,
|
|
27
|
+
* symbol?: string,
|
|
28
|
+
* image?: UIImage,
|
|
29
|
+
* tintColor?: UIColor,
|
|
30
|
+
* bgcolor?: UIColor,
|
|
31
|
+
* controller: Controller}[]
|
|
32
|
+
* - index: number = 0
|
|
33
|
+
*/
|
|
34
|
+
export declare class TabBarController extends BaseController {
|
|
35
|
+
_props: TabBarControllerProps;
|
|
36
|
+
cviews: {
|
|
37
|
+
tabbar: TabBar;
|
|
38
|
+
pageContentView: ContentView;
|
|
39
|
+
};
|
|
40
|
+
pages: ContentView[];
|
|
41
|
+
constructor({ props, layout, events, }: {
|
|
42
|
+
props: TabBarControllerProps;
|
|
43
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
44
|
+
events?: TabBarControllerEvents;
|
|
45
|
+
});
|
|
46
|
+
set index(num: number);
|
|
47
|
+
get index(): number;
|
|
48
|
+
}
|
|
49
|
+
export {};
|
|
@@ -4,6 +4,7 @@ exports.TabBarController = void 0;
|
|
|
4
4
|
const base_controller_1 = require("./base-controller");
|
|
5
5
|
const single_views_1 = require("../components/single-views");
|
|
6
6
|
const tabbar_1 = require("../components/tabbar");
|
|
7
|
+
const controller_status_1 = require("./controller-status");
|
|
7
8
|
/**
|
|
8
9
|
* # CView TabBar Controller
|
|
9
10
|
*
|
|
@@ -52,8 +53,6 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
52
53
|
events: {
|
|
53
54
|
changed: (cview, index) => {
|
|
54
55
|
this.index = index;
|
|
55
|
-
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
56
|
-
this._props.items[index].controller.appear();
|
|
57
56
|
events.changed?.(this, index);
|
|
58
57
|
},
|
|
59
58
|
doubleTapped: (cview, index) => {
|
|
@@ -88,7 +87,7 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
88
87
|
n.view.hidden = i !== num;
|
|
89
88
|
});
|
|
90
89
|
this._props.index = num;
|
|
91
|
-
this._props.items.find((item) => item.controller.status ===
|
|
90
|
+
this._props.items.find((item) => item.controller.status === controller_status_1.controllerStatus.appeared)?.controller.disappear();
|
|
92
91
|
this._props.items[num].controller.appear();
|
|
93
92
|
}
|
|
94
93
|
get index() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="jsbox-types" preserve="true" />
|
|
1
2
|
export * from "./components/base";
|
|
2
3
|
export * from "./components/custom-navigation-bar";
|
|
3
4
|
export * from "./components/dynamic-contextmenu-view";
|
|
@@ -20,6 +21,7 @@ export * from "./components/single-views";
|
|
|
20
21
|
export * from "./components/static-preference-listview";
|
|
21
22
|
export * from "./components/symbol-button";
|
|
22
23
|
export * from "./components/tabbar";
|
|
24
|
+
export * from "./controller/controller-status";
|
|
23
25
|
export * from "./controller/base-controller";
|
|
24
26
|
export * from "./controller/controller-router";
|
|
25
27
|
export * from "./controller/pageviewer-controller";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
/// <reference types="jsbox-types" preserve="true" />
|
|
2
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
4
|
if (k2 === undefined) k2 = k;
|
|
4
5
|
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
@@ -36,6 +37,7 @@ __exportStar(require("./components/single-views"), exports);
|
|
|
36
37
|
__exportStar(require("./components/static-preference-listview"), exports);
|
|
37
38
|
__exportStar(require("./components/symbol-button"), exports);
|
|
38
39
|
__exportStar(require("./components/tabbar"), exports);
|
|
40
|
+
__exportStar(require("./controller/controller-status"), exports);
|
|
39
41
|
__exportStar(require("./controller/base-controller"), exports);
|
|
40
42
|
__exportStar(require("./controller/controller-router"), exports);
|
|
41
43
|
__exportStar(require("./controller/pageviewer-controller"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const sheetNavBarColor: UIColor;
|
|
2
|
+
export declare const footBarDefaultSegmentColor: UIColor;
|
|
3
|
+
export declare const searchBarSymbolColor: UIColor;
|
|
4
|
+
export declare const searchBarBgcolor: UIColor;
|
|
5
|
+
export declare const gold: UIColor;
|
|
6
|
+
export declare const sectionHeaderColor: UIColor;
|
|
7
|
+
export declare const sliderMaxColor: UIColor;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function l10n(key: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function split(path: string): [string, string];
|
|
2
|
+
export declare function dirname(path: string): string;
|
|
3
|
+
export declare function basename(path: string): string;
|
|
4
|
+
export declare function extname(path: string): string;
|
|
5
|
+
export declare function join(...args: string[]): string;
|
|
6
|
+
export declare function getCreationDate(path: string): number;
|
|
7
|
+
export declare function getModificationDate(path: string): number;
|
|
8
|
+
export declare function getFileSize(path: string): number;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* When called without arguments, return the center of the rectangle.
|
|
3
|
+
* When a Point is passed as an argument, the rectangle’s x and y values
|
|
4
|
+
* are adjusted, so that the new center of the rectangle is p.
|
|
5
|
+
*/
|
|
6
|
+
export declare function center(rect: JBRect, point?: JBPoint): JBPoint;
|
|
7
|
+
/**
|
|
8
|
+
* Return true if the given point lies within the bounds of the rectangle,
|
|
9
|
+
* false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare function containsPoint(rect: JBRect, point: JBPoint): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Return true if the given rectangle lies entirely within the bounds of
|
|
14
|
+
* this rectangle, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
export declare function containsRect(rect: JBRect, otherRect: JBRect): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Return true if this rectangle intersects with the other rectangle,
|
|
19
|
+
* false otherwise.
|
|
20
|
+
*/
|
|
21
|
+
export declare function intersects(rect: JBRect, otherRect: JBRect): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Return a $rect that corresponds to the intersection of this rectangle with
|
|
24
|
+
* the other one.
|
|
25
|
+
*/
|
|
26
|
+
export declare function intersection(rect: JBRect, otherRect: JBRect): JBRect;
|
|
27
|
+
/**
|
|
28
|
+
* Return the smallest $rect that encloses both rectangles.
|
|
29
|
+
*/
|
|
30
|
+
export declare function union(rect: JBRect, otherRect: JBRect): JBRect;
|
|
31
|
+
/**
|
|
32
|
+
* Equivalent to $rect(r.x + x, r.y + y, r.w, r.h)
|
|
33
|
+
*/
|
|
34
|
+
export declare function translate(rect: JBRect, point: JBPoint): JBRect;
|
|
35
|
+
/**
|
|
36
|
+
* Return a $rect that is adjusted by the given edge insets.
|
|
37
|
+
*/
|
|
38
|
+
export declare function inset(rect: JBRect, insets: JBInsets): JBRect;
|