jsbox-cview 1.6.5 → 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/input-alert.js +1 -2
- package/dist/components/alert/login-alert.d.ts +21 -0
- package/dist/components/alert/login-alert.js +1 -2
- package/dist/components/alert/plain-alert.d.ts +15 -0
- package/dist/components/alert/plain-alert.js +1 -2
- 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/custom-navigation-bar.js +7 -1
- 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/form-dialog.js +1 -2
- package/dist/components/dialogs/list-dialog.d.ts +23 -0
- package/dist/components/dialogs/list-dialog.js +2 -3
- package/dist/components/dialogs/text-dialog.d.ts +13 -0
- package/dist/components/dialogs/text-dialog.js +1 -2
- package/dist/components/dynamic-contextmenu-view.d.ts +40 -0
- package/dist/components/dynamic-contextmenu-view.js +5 -1
- package/dist/components/dynamic-itemsize-matrix.d.ts +79 -0
- package/dist/components/dynamic-itemsize-matrix.js +18 -15
- package/dist/components/dynamic-itemsize-section-matrix.d.ts +115 -0
- package/dist/components/dynamic-itemsize-section-matrix.js +293 -0
- package/dist/components/dynamic-preference-listview.d.ts +63 -0
- package/dist/components/dynamic-preference-listview.js +25 -16
- package/dist/components/dynamic-rowheight-list.d.ts +38 -0
- package/dist/components/dynamic-rowheight-list.js +10 -3
- package/dist/components/enhanced-imageview.d.ts +41 -0
- package/dist/components/enhanced-imageview.js +1 -1
- package/dist/components/flowlayout.d.ts +63 -0
- package/dist/components/flowlayout.js +10 -13
- package/dist/components/image-pager.d.ts +49 -0
- package/dist/components/image-pager.js +6 -1
- package/dist/components/oc-webview.d.ts +64 -0
- package/dist/components/oc-webview.js +13 -5
- package/dist/components/page-control.d.ts +45 -0
- package/dist/components/page-control.js +2 -13
- package/dist/components/pageviewer-titlebar.d.ts +48 -0
- package/dist/components/pageviewer-titlebar.js +7 -13
- package/dist/components/pageviewer.d.ts +41 -0
- package/dist/components/pageviewer.js +4 -1
- package/dist/components/refresh-button.d.ts +25 -0
- package/dist/components/refresh-button.js +3 -4
- package/dist/components/rotating-view.d.ts +45 -0
- package/dist/components/rotating-view.js +10 -2
- package/dist/components/searchbar.d.ts +118 -0
- package/dist/components/searchbar.js +8 -1
- package/dist/components/sheet.d.ts +42 -0
- package/dist/components/single-views.d.ts +289 -0
- package/dist/components/single-views.js +11 -4
- 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/spinners/spinner-androidstyle.js +7 -1
- package/dist/components/static-preference-listview.d.ts +389 -0
- package/dist/components/static-preference-listview.js +13 -10
- package/dist/components/symbol-button.d.ts +39 -0
- package/dist/components/symbol-button.js +8 -1
- package/dist/components/tabbar.d.ts +140 -0
- package/dist/components/tabbar.js +8 -1
- 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/pageviewer-controller.js +4 -1
- package/dist/controller/presented-page-controller.d.ts +41 -0
- package/dist/controller/presented-page-controller.js +7 -9
- package/dist/controller/splitview-controller.d.ts +90 -0
- package/dist/controller/splitview-controller.js +27 -11
- package/dist/controller/tabbar-controller.d.ts +49 -0
- package/dist/controller/tabbar-controller.js +12 -15
- 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/l10n.js +1 -2
- package/dist/utils/path.d.ts +8 -0
- package/dist/utils/path.js +8 -9
- package/dist/utils/rect.d.ts +38 -0
- package/dist/utils/rect.js +8 -9
- package/dist/utils/uitools.d.ts +75 -0
- package/dist/utils/uitools.js +6 -6
- package/package.json +20 -5
- 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-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-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-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,125 @@
|
|
|
1
|
+
import { Base } from "../components/base";
|
|
2
|
+
import { ContentView } from "../components/single-views";
|
|
3
|
+
/**
|
|
4
|
+
* status
|
|
5
|
+
* - created = 0 被创建,未被加载
|
|
6
|
+
* - loaded = 1 被加载,显示状态未知
|
|
7
|
+
* - appeared= 2 处于可显示状态
|
|
8
|
+
* - disappeared = 3 处于不显示状态
|
|
9
|
+
* - removed = 4 根视图被移除
|
|
10
|
+
* 其中只有 2 和 3 可以相互转化,其他不可以
|
|
11
|
+
*/
|
|
12
|
+
export declare const controllerStatus: {
|
|
13
|
+
created: number;
|
|
14
|
+
loaded: number;
|
|
15
|
+
appeared: number;
|
|
16
|
+
disappeared: number;
|
|
17
|
+
removed: number;
|
|
18
|
+
};
|
|
19
|
+
export declare class ControllerRootView extends ContentView {
|
|
20
|
+
constructor({ props, layout, events, }: {
|
|
21
|
+
props: {
|
|
22
|
+
bgcolor: UIColor;
|
|
23
|
+
};
|
|
24
|
+
layout: (make: MASConstraintMaker, view: UIView) => void;
|
|
25
|
+
events: {
|
|
26
|
+
ready: (sender: UIView) => void;
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
set views(views: UiTypes.AllViewOptions[] | Base<any, any>[]);
|
|
30
|
+
}
|
|
31
|
+
export interface BaseControllerProps {
|
|
32
|
+
id?: string;
|
|
33
|
+
bgcolor?: UIColor;
|
|
34
|
+
}
|
|
35
|
+
export interface BaseControllerEvents {
|
|
36
|
+
didCreate?: (controller: BaseController) => void;
|
|
37
|
+
didLoad?: (controller: BaseController) => void;
|
|
38
|
+
didAppear?: (controller: BaseController) => void;
|
|
39
|
+
didDisappear?: (controller: BaseController) => void;
|
|
40
|
+
didRemove?: (controller: BaseController) => void;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* # CView Base Controller
|
|
44
|
+
*
|
|
45
|
+
* Cview 控件尽量保持非侵入性和功能专注。而控制器负责控件之间的关联和数据更新。
|
|
46
|
+
* 另外,控制器可以实现一些常用的页面构建形式,比如底部Tab分页,左侧滑动分页,弹出式页面等。
|
|
47
|
+
*
|
|
48
|
+
* ## 属性
|
|
49
|
+
*
|
|
50
|
+
* - id?: string 可以指定 id,如不指定,会自动赋值全局唯一 id
|
|
51
|
+
* - 只写 bgcolor?: UIColor = $color("primarySurface") rootView 的 bgcolor
|
|
52
|
+
* - 只读 cviews: {}
|
|
53
|
+
* - 只读 rootView
|
|
54
|
+
* - 只读 status
|
|
55
|
+
* - created = 0 被创建,未被加载
|
|
56
|
+
* - loaded = 1 被加载,显示状态未知
|
|
57
|
+
* - appearing = 2 处于可显示状态
|
|
58
|
+
* - disappearing = 3 处于不显示状态
|
|
59
|
+
* - removed = 4 根视图被移除
|
|
60
|
+
*
|
|
61
|
+
* ## 事件
|
|
62
|
+
*
|
|
63
|
+
* 5 个生命周期节点:创建、加载、显示、隐藏、销毁。后面四个具有生命周期事件。
|
|
64
|
+
*
|
|
65
|
+
* 创建阶段没有对应事件,此阶段适合为 rootView 添加子 view,
|
|
66
|
+
* 不能涉及对 UIView 的任何操作,因为此时 rootView 还未加载。
|
|
67
|
+
*
|
|
68
|
+
* 生命周期事件:
|
|
69
|
+
*
|
|
70
|
+
* 1. didLoad: controller => void 在 rootView 被加载之后执行
|
|
71
|
+
* - 可以在 rootView 的 ready 事件中自动执行,也可以手动执行加快速度
|
|
72
|
+
* - 也可以在这个节点为 rootView 添加子 view
|
|
73
|
+
* - 这个节点可以对 UIView 进行操作了
|
|
74
|
+
* - 可以向 Model 层请求初始数据
|
|
75
|
+
* 2. didAppear: controller => void 在 rootView 显现的时候执行
|
|
76
|
+
* - 向 Model 层请求刷新数据
|
|
77
|
+
* 3. didDisappear: controller => void 在 rootView 不可见的时候执行
|
|
78
|
+
* - 如果是持续执行的刷新行为,可以在此处转为暂停
|
|
79
|
+
* 4. didRemove: controller => void 在 rootView 被移除的时候执行
|
|
80
|
+
* - 应该在此节点释放自定义的 objc
|
|
81
|
+
* - 数据持久化
|
|
82
|
+
*
|
|
83
|
+
* ## 方法
|
|
84
|
+
*
|
|
85
|
+
* 加载方法:
|
|
86
|
+
*
|
|
87
|
+
* 1. uirender(props) 此方法只能使用一次,对应的 Controller 将成为顶级 Controller
|
|
88
|
+
* 2. uipush(props)
|
|
89
|
+
* 3. 直接让 rootView.definition 包含在其他 View 的 views 参数中
|
|
90
|
+
*
|
|
91
|
+
* 生命周期管理:
|
|
92
|
+
*
|
|
93
|
+
* 1. load() 会在 rootView 的 ready 事件中自动调用,也可以手动调用,以加速运行
|
|
94
|
+
* 2. appear()
|
|
95
|
+
* 3. disappear()
|
|
96
|
+
* 4. remove() 用来移除 Router 中的当前 Controller,**请注意此方法和 rootView 的移除无关**,
|
|
97
|
+
* 如果通过 uirender 和 uipush,可以在销毁时自动执行 remove()
|
|
98
|
+
*
|
|
99
|
+
* ## 其他
|
|
100
|
+
*
|
|
101
|
+
* - rootView 可以直接通过 rootView.views 设置其_views 属性,
|
|
102
|
+
* 其中元素可以为 view 定义也可以为 cview
|
|
103
|
+
*/
|
|
104
|
+
export declare class BaseController {
|
|
105
|
+
protected _props: BaseControllerProps;
|
|
106
|
+
protected _events: BaseControllerEvents;
|
|
107
|
+
readonly id: string;
|
|
108
|
+
private _status;
|
|
109
|
+
cviews: {
|
|
110
|
+
[key: string]: Base<any, any>;
|
|
111
|
+
};
|
|
112
|
+
readonly rootView: ControllerRootView;
|
|
113
|
+
constructor({ props, layout, events, }?: {
|
|
114
|
+
props?: BaseControllerProps;
|
|
115
|
+
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
116
|
+
events?: BaseControllerEvents;
|
|
117
|
+
});
|
|
118
|
+
load(): void;
|
|
119
|
+
appear(): void;
|
|
120
|
+
disappear(): void;
|
|
121
|
+
remove(): void;
|
|
122
|
+
uirender(props: UiTypes.RootViewPrefs): void;
|
|
123
|
+
uipush(props: UiTypes.RootViewPrefs): void;
|
|
124
|
+
get status(): number;
|
|
125
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.BaseController = exports.ControllerRootView = void 0;
|
|
3
|
+
exports.BaseController = exports.ControllerRootView = exports.controllerStatus = void 0;
|
|
4
4
|
const base_1 = require("../components/base");
|
|
5
5
|
const single_views_1 = require("../components/single-views");
|
|
6
6
|
const cvid_1 = require("../utils/cvid");
|
|
@@ -14,7 +14,7 @@ const controller_router_1 = require("./controller-router");
|
|
|
14
14
|
* - removed = 4 根视图被移除
|
|
15
15
|
* 其中只有 2 和 3 可以相互转化,其他不可以
|
|
16
16
|
*/
|
|
17
|
-
|
|
17
|
+
exports.controllerStatus = {
|
|
18
18
|
created: 0,
|
|
19
19
|
loaded: 1,
|
|
20
20
|
appeared: 2,
|
|
@@ -102,7 +102,7 @@ class BaseController {
|
|
|
102
102
|
this._props = props || {};
|
|
103
103
|
this._events = events;
|
|
104
104
|
this.id = this._props.id || cvid_1.cvid.newId;
|
|
105
|
-
this._status = controllerStatus.created; // status使用额外的get来使其只读
|
|
105
|
+
this._status = exports.controllerStatus.created; // status使用额外的get来使其只读
|
|
106
106
|
this.rootView = new ControllerRootView({
|
|
107
107
|
props: {
|
|
108
108
|
bgcolor: this._props.bgcolor || $color("primarySurface"),
|
|
@@ -116,38 +116,38 @@ class BaseController {
|
|
|
116
116
|
}
|
|
117
117
|
load() {
|
|
118
118
|
// 只有status为created才可以运行
|
|
119
|
-
if (this._status !== controllerStatus.created)
|
|
119
|
+
if (this._status !== exports.controllerStatus.created)
|
|
120
120
|
return;
|
|
121
|
-
this._status = controllerStatus.loaded;
|
|
121
|
+
this._status = exports.controllerStatus.loaded;
|
|
122
122
|
if (this._events.didLoad)
|
|
123
123
|
this._events.didLoad(this);
|
|
124
124
|
controller_router_1.router.add(this);
|
|
125
125
|
}
|
|
126
126
|
appear() {
|
|
127
127
|
// 只有status为loaded或者disappeared,才可以运行
|
|
128
|
-
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.disappeared)
|
|
128
|
+
if (this._status !== exports.controllerStatus.loaded && this._status !== exports.controllerStatus.disappeared)
|
|
129
129
|
return;
|
|
130
130
|
if (this._events.didAppear)
|
|
131
131
|
this._events.didAppear(this);
|
|
132
|
-
this._status = controllerStatus.appeared;
|
|
132
|
+
this._status = exports.controllerStatus.appeared;
|
|
133
133
|
}
|
|
134
134
|
disappear() {
|
|
135
135
|
// 只有status为loaded或者appeared,才可以运行
|
|
136
|
-
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.appeared)
|
|
136
|
+
if (this._status !== exports.controllerStatus.loaded && this._status !== exports.controllerStatus.appeared)
|
|
137
137
|
return;
|
|
138
138
|
if (this._events.didDisappear)
|
|
139
139
|
this._events.didDisappear(this);
|
|
140
|
-
this._status = controllerStatus.disappeared;
|
|
140
|
+
this._status = exports.controllerStatus.disappeared;
|
|
141
141
|
}
|
|
142
142
|
// 此方法不能用于移除rootView,其作用是将控制器从Router中移除,并触发didRemove事件
|
|
143
143
|
remove() {
|
|
144
144
|
// 如果已经移除,不可以再次运行
|
|
145
|
-
if (this._status === controllerStatus.removed)
|
|
145
|
+
if (this._status === exports.controllerStatus.removed)
|
|
146
146
|
return;
|
|
147
147
|
if (this._events.didRemove)
|
|
148
148
|
this._events.didRemove(this);
|
|
149
149
|
controller_router_1.router.delete(this);
|
|
150
|
-
this._status = controllerStatus.removed;
|
|
150
|
+
this._status = exports.controllerStatus.removed;
|
|
151
151
|
}
|
|
152
152
|
uirender(props) {
|
|
153
153
|
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 {};
|
|
@@ -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 {};
|
|
@@ -51,7 +51,10 @@ class PageViewerController extends base_controller_1.BaseController {
|
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
53
|
this.cviews.navbar = new custom_navigation_bar_1.CustomNavigationBar({
|
|
54
|
-
props:
|
|
54
|
+
props: {
|
|
55
|
+
...this._props.navBarProps,
|
|
56
|
+
titleView: this.cviews.titlebar,
|
|
57
|
+
},
|
|
55
58
|
});
|
|
56
59
|
this.rootView.views = [this.cviews.navbar, this.cviews.pageviewer];
|
|
57
60
|
}
|
|
@@ -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 {};
|
|
@@ -26,24 +26,22 @@ const sheet_1 = require("../components/sheet");
|
|
|
26
26
|
*/
|
|
27
27
|
class PresentedPageController extends base_controller_1.BaseController {
|
|
28
28
|
constructor({ props, layout, events, } = {}) {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
super({
|
|
31
30
|
props: {
|
|
32
|
-
id: props
|
|
33
|
-
bgcolor: props
|
|
31
|
+
id: props?.id,
|
|
32
|
+
bgcolor: props?.bgcolor,
|
|
34
33
|
},
|
|
35
34
|
layout,
|
|
36
35
|
events,
|
|
37
36
|
});
|
|
38
37
|
this._sheet = new sheet_1.Sheet({
|
|
39
|
-
presentMode:
|
|
40
|
-
animated:
|
|
41
|
-
interactiveDismissalDisabled:
|
|
42
|
-
bgcolor:
|
|
38
|
+
presentMode: props?.presentMode ?? 1,
|
|
39
|
+
animated: props?.animated ?? true,
|
|
40
|
+
interactiveDismissalDisabled: props?.interactiveDismissalDisabled || false,
|
|
41
|
+
bgcolor: props?.bgcolor || $color("secondarySurface"),
|
|
43
42
|
cview: this.rootView,
|
|
44
43
|
dismissalHandler: () => {
|
|
45
|
-
|
|
46
|
-
(_a = events === null || events === void 0 ? void 0 : events.dismissed) === null || _a === void 0 ? void 0 : _a.call(events, this);
|
|
44
|
+
events?.dismissed?.(this);
|
|
47
45
|
this.remove();
|
|
48
46
|
},
|
|
49
47
|
});
|
|
@@ -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 {};
|
|
@@ -8,7 +8,10 @@ const cvid_1 = require("../utils/cvid");
|
|
|
8
8
|
class SecondaryView extends base_1.Base {
|
|
9
9
|
constructor({ props, layout, views = [], }) {
|
|
10
10
|
super();
|
|
11
|
-
this._props =
|
|
11
|
+
this._props = {
|
|
12
|
+
bgcolor: $color("groupedBackground", "secondarySurface"),
|
|
13
|
+
...props,
|
|
14
|
+
};
|
|
12
15
|
this._layouts = {
|
|
13
16
|
hidden: (make, view) => {
|
|
14
17
|
make.top.bottom.inset(0);
|
|
@@ -37,7 +40,10 @@ class SecondaryView extends base_1.Base {
|
|
|
37
40
|
this._defineView = () => {
|
|
38
41
|
return {
|
|
39
42
|
type: "view",
|
|
40
|
-
props:
|
|
43
|
+
props: {
|
|
44
|
+
...this._props,
|
|
45
|
+
id: this.id,
|
|
46
|
+
},
|
|
41
47
|
layout,
|
|
42
48
|
views: [...views, this.line.definition],
|
|
43
49
|
};
|
|
@@ -65,7 +71,7 @@ class SecondaryView extends base_1.Base {
|
|
|
65
71
|
class MaskView extends base_1.Base {
|
|
66
72
|
constructor({ props, layout = $layout.fill, }) {
|
|
67
73
|
super();
|
|
68
|
-
this._props =
|
|
74
|
+
this._props = { bgcolor: $color("clear"), ...props };
|
|
69
75
|
this._shown = false;
|
|
70
76
|
this._dismissEvent = () => {
|
|
71
77
|
if (!this._shown)
|
|
@@ -76,7 +82,11 @@ class MaskView extends base_1.Base {
|
|
|
76
82
|
this._defineView = () => {
|
|
77
83
|
return {
|
|
78
84
|
type: "view",
|
|
79
|
-
props:
|
|
85
|
+
props: {
|
|
86
|
+
...this._props,
|
|
87
|
+
hidden: true,
|
|
88
|
+
id: this.id,
|
|
89
|
+
},
|
|
80
90
|
layout,
|
|
81
91
|
events: {
|
|
82
92
|
ready: (sender) => this._addGesture(sender, this._dismissEvent),
|
|
@@ -140,21 +150,23 @@ class SplitViewController extends base_controller_1.BaseController {
|
|
|
140
150
|
bgcolor: props.bgcolor,
|
|
141
151
|
},
|
|
142
152
|
layout,
|
|
143
|
-
events:
|
|
144
|
-
|
|
153
|
+
events: {
|
|
154
|
+
...events,
|
|
155
|
+
didAppear: (sender) => {
|
|
145
156
|
if (this._sideBarShown) {
|
|
146
157
|
this._secondaryController.appear();
|
|
147
158
|
}
|
|
148
159
|
else {
|
|
149
160
|
this._primaryController.appear();
|
|
150
161
|
}
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
162
|
+
events?.didAppear?.(this);
|
|
163
|
+
},
|
|
164
|
+
didDisappear: () => {
|
|
154
165
|
this._primaryController.disappear();
|
|
155
166
|
this._secondaryController.disappear();
|
|
156
|
-
|
|
157
|
-
}
|
|
167
|
+
events?.didDisappear?.(this);
|
|
168
|
+
},
|
|
169
|
+
},
|
|
158
170
|
});
|
|
159
171
|
this._sideBarShown = false;
|
|
160
172
|
this._canShowSidebar = true;
|
|
@@ -195,10 +207,14 @@ class SplitViewController extends base_controller_1.BaseController {
|
|
|
195
207
|
this.rootView.views = [this.cviews.secondaryView, this.cviews.primaryView];
|
|
196
208
|
}
|
|
197
209
|
load() {
|
|
210
|
+
if (this.status !== base_controller_1.controllerStatus.created)
|
|
211
|
+
return;
|
|
198
212
|
super.load();
|
|
199
213
|
this._renewScreenEdgePanGesture();
|
|
200
214
|
}
|
|
201
215
|
remove() {
|
|
216
|
+
if (this.status === base_controller_1.controllerStatus.removed)
|
|
217
|
+
return;
|
|
202
218
|
$objc_release(this._screenEdgePanGestureObject);
|
|
203
219
|
this.cviews.maskView.releaseGestureObject();
|
|
204
220
|
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 {};
|
|
@@ -27,15 +27,17 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
27
27
|
bgcolor: props.bgcolor,
|
|
28
28
|
},
|
|
29
29
|
layout,
|
|
30
|
-
events:
|
|
31
|
-
|
|
30
|
+
events: {
|
|
31
|
+
...events,
|
|
32
|
+
didAppear: () => {
|
|
32
33
|
this._props.items[this.index].controller.appear();
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
34
|
+
events.didAppear?.(this);
|
|
35
|
+
},
|
|
36
|
+
didDisappear: () => {
|
|
36
37
|
this._props.items[this.index].controller.disappear();
|
|
37
|
-
|
|
38
|
-
}
|
|
38
|
+
events.didDisappear?.(this);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
39
41
|
});
|
|
40
42
|
this._props = {
|
|
41
43
|
items: props.items,
|
|
@@ -49,15 +51,11 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
49
51
|
},
|
|
50
52
|
events: {
|
|
51
53
|
changed: (cview, index) => {
|
|
52
|
-
var _a, _b;
|
|
53
54
|
this.index = index;
|
|
54
|
-
(
|
|
55
|
-
this._props.items[index].controller.appear();
|
|
56
|
-
(_b = events.changed) === null || _b === void 0 ? void 0 : _b.call(events, this, index);
|
|
55
|
+
events.changed?.(this, index);
|
|
57
56
|
},
|
|
58
57
|
doubleTapped: (cview, index) => {
|
|
59
|
-
|
|
60
|
-
(_a = events.doubleTapped) === null || _a === void 0 ? void 0 : _a.call(events, this, index);
|
|
58
|
+
events.doubleTapped?.(this, index);
|
|
61
59
|
},
|
|
62
60
|
},
|
|
63
61
|
});
|
|
@@ -81,7 +79,6 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
81
79
|
this.rootView.views = [this.cviews.pageContentView, this.cviews.tabbar];
|
|
82
80
|
}
|
|
83
81
|
set index(num) {
|
|
84
|
-
var _a;
|
|
85
82
|
if (this._props.index === num)
|
|
86
83
|
return;
|
|
87
84
|
this.cviews.tabbar.index = num;
|
|
@@ -89,7 +86,7 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
89
86
|
n.view.hidden = i !== num;
|
|
90
87
|
});
|
|
91
88
|
this._props.index = num;
|
|
92
|
-
|
|
89
|
+
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
93
90
|
this._props.items[num].controller.appear();
|
|
94
91
|
}
|
|
95
92
|
get index() {
|
|
@@ -1,7 +1,9 @@
|
|
|
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";
|
|
4
5
|
export * from "./components/dynamic-itemsize-matrix";
|
|
6
|
+
export * from "./components/dynamic-itemsize-section-matrix";
|
|
5
7
|
export * from "./components/dynamic-preference-listview";
|
|
6
8
|
export * from "./components/dynamic-rowheight-list";
|
|
7
9
|
export * from "./components/enhanced-imageview";
|