jsbox-cview 1.0.0 → 1.1.0
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/dist/components/alert/input-alert.js +39 -0
- package/dist/components/alert/login-alert.js +45 -0
- package/dist/components/alert/plain-alert.js +25 -0
- package/dist/components/alert/uialert.js +89 -0
- package/dist/components/artificial-flowlayout.js +258 -0
- package/dist/components/base.js +43 -0
- package/dist/components/custom-navigation-bar.js +519 -0
- package/dist/components/dialogs/dialog-sheet.js +67 -0
- package/dist/components/dialogs/form-dialog.js +24 -0
- package/dist/components/dialogs/list-dialog.js +87 -0
- package/dist/components/dialogs/text-dialog.js +31 -0
- package/dist/components/dynamic-itemsize-matrix.js +129 -0
- package/dist/components/dynamic-preference-listview.js +557 -0
- package/dist/components/dynamic-rowheight-list.js +44 -0
- package/dist/components/enhanced-imageview.js +114 -0
- package/dist/components/image-pager.js +157 -0
- package/dist/components/page-control.js +76 -0
- package/dist/components/pageviewer-titlebar.js +143 -0
- package/dist/components/pageviewer.js +96 -0
- package/dist/components/rotating-view.js +102 -0
- package/dist/components/searchbar.js +322 -0
- package/dist/components/sheet.js +82 -0
- package/dist/components/single-views.js +429 -0
- package/dist/components/spinners/loading-double-rings.js +104 -0
- package/dist/components/spinners/loading-dual-ring.js +82 -0
- package/dist/components/spinners/loading-wedges.js +104 -0
- package/dist/components/spinners/spinner-androidstyle.js +248 -0
- package/dist/components/static-preference-listview.js +798 -0
- package/dist/components/symbol-button.js +79 -0
- package/dist/components/tabbar.js +357 -0
- package/dist/controller/base-controller.js +178 -0
- package/dist/controller/controller-router.js +68 -0
- package/dist/controller/pageviewer-controller.js +63 -0
- package/dist/controller/presented-page-controller.js +48 -0
- package/dist/controller/splitview-controller.js +252 -0
- package/dist/controller/tabbar-controller.js +74 -0
- package/dist/index.js +58 -0
- package/dist/test.js +1 -0
- package/dist/utils/colors.js +15 -0
- package/dist/utils/cvid.js +28 -0
- package/dist/utils/l10n.js +44 -0
- package/dist/utils/path.js +107 -0
- package/dist/utils/rect.js +72 -0
- package/dist/utils/uitools.js +95 -0
- package/index.ts +42 -0
- package/package.json +4 -3
- package/tsconfig.json +5 -3
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* # CView PageViewer Controller
|
|
4
|
+
*
|
|
5
|
+
* 一个可以左右滑动翻页的控制器。
|
|
6
|
+
*
|
|
7
|
+
* Props:
|
|
8
|
+
*
|
|
9
|
+
* - items: { controller: Controller, title: string }[]
|
|
10
|
+
* - navBarProps: {} 可用于 navBar 的其他属性,不包括 title 和 titleView
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.PageViewerController = void 0;
|
|
14
|
+
const base_controller_1 = require("./base-controller");
|
|
15
|
+
const pageviewer_1 = require("../components/pageviewer");
|
|
16
|
+
const pageviewer_titlebar_1 = require("../components/pageviewer-titlebar");
|
|
17
|
+
const custom_navigation_bar_1 = require("../components/custom-navigation-bar");
|
|
18
|
+
class PageViewerController extends base_controller_1.BaseController {
|
|
19
|
+
constructor({ props, layout, events = {} }) {
|
|
20
|
+
super({ props: {
|
|
21
|
+
id: props.id,
|
|
22
|
+
bgcolor: props.bgcolor
|
|
23
|
+
}, layout, events });
|
|
24
|
+
this._props = props;
|
|
25
|
+
this.cviews = {};
|
|
26
|
+
this.cviews.pageviewer = new pageviewer_1.PageViewer({
|
|
27
|
+
props: {
|
|
28
|
+
page: this._props.index,
|
|
29
|
+
cviews: this._props.items.map(n => n.controller.rootView)
|
|
30
|
+
},
|
|
31
|
+
layout: (make, view) => {
|
|
32
|
+
make.left.right.bottom.inset(0);
|
|
33
|
+
make.top.equalTo(view.prev.bottom);
|
|
34
|
+
},
|
|
35
|
+
events: {
|
|
36
|
+
floatPageChanged: (cview, floatPage) => (this.cviews.titlebar.floatedIndex = floatPage)
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
this.cviews.titlebar = new pageviewer_titlebar_1.PageViewerTitleBar({
|
|
40
|
+
props: {
|
|
41
|
+
items: this._props.items.map(n => n.title),
|
|
42
|
+
index: this._props.index
|
|
43
|
+
},
|
|
44
|
+
layout: $layout.fill,
|
|
45
|
+
events: {
|
|
46
|
+
changed: (cview, index) => this.cviews.pageviewer.scrollToPage(index)
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
this.cviews.navbar = new custom_navigation_bar_1.CustomNavigationBar({
|
|
50
|
+
props: Object.assign(Object.assign({}, this._props.navBarProps), { titleView: this.cviews.titlebar })
|
|
51
|
+
});
|
|
52
|
+
this.rootView.views = [this.cviews.navbar, this.cviews.pageviewer];
|
|
53
|
+
}
|
|
54
|
+
get index() {
|
|
55
|
+
return this._props.index || 0;
|
|
56
|
+
}
|
|
57
|
+
set index(num) {
|
|
58
|
+
this.cviews.titlebar.index = num;
|
|
59
|
+
this.cviews.pageviewer.page = num;
|
|
60
|
+
this._props.index = num;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.PageViewerController = PageViewerController;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** # CView PresentedPageController
|
|
3
|
+
*
|
|
4
|
+
* ## Props
|
|
5
|
+
*
|
|
6
|
+
* - presentMode?: number = 1
|
|
7
|
+
* - animated?: boolean = true
|
|
8
|
+
* - interactiveDismissalDisabled?: boolean = false
|
|
9
|
+
* - bgcolor?: UIColor = $color("secondarySurface")
|
|
10
|
+
*
|
|
11
|
+
* ## 专用方法
|
|
12
|
+
*
|
|
13
|
+
* - present() 在 `sheet.present()` 之后会先后执行 `load()` 和 `appear()`
|
|
14
|
+
* - dismiss()
|
|
15
|
+
*
|
|
16
|
+
* ## 布局
|
|
17
|
+
* 此控制器的 layout 必定为 `$layout.fill`,无需自行设定
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.PresentedPageController = void 0;
|
|
21
|
+
const base_controller_1 = require("./base-controller");
|
|
22
|
+
const sheet_1 = require("../components/sheet");
|
|
23
|
+
class PresentedPageController extends base_controller_1.BaseController {
|
|
24
|
+
constructor({ props, layout, events } = {}) {
|
|
25
|
+
super({ props: {
|
|
26
|
+
id: props === null || props === void 0 ? void 0 : props.id
|
|
27
|
+
}, layout, events });
|
|
28
|
+
this._sheet = new sheet_1.Sheet({
|
|
29
|
+
presentMode: (props === null || props === void 0 ? void 0 : props.presentMode) || 1,
|
|
30
|
+
animated: (props === null || props === void 0 ? void 0 : props.animated) || true,
|
|
31
|
+
interactiveDismissalDisabled: (props === null || props === void 0 ? void 0 : props.interactiveDismissalDisabled) || false,
|
|
32
|
+
bgcolor: (props === null || props === void 0 ? void 0 : props.bgcolor) || $color("secondarySurface"),
|
|
33
|
+
cview: this.rootView,
|
|
34
|
+
dismissalHandler: () => this.remove()
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
present() {
|
|
38
|
+
if (this._sheet)
|
|
39
|
+
this._sheet.present();
|
|
40
|
+
this.load();
|
|
41
|
+
this.appear();
|
|
42
|
+
}
|
|
43
|
+
dismiss() {
|
|
44
|
+
if (this._sheet)
|
|
45
|
+
this._sheet.dismiss();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
exports.PresentedPageController = PresentedPageController;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** # CView SplitView Controller
|
|
3
|
+
*
|
|
4
|
+
* 实现左右分栏布局的控制器, 本身不提供除了分割线以外的视觉效果
|
|
5
|
+
*
|
|
6
|
+
* 此控制器加载后,会禁用原本的ScreenEdgePanGesture,此控制器应该作为根控制器使用
|
|
7
|
+
*
|
|
8
|
+
* ## Props
|
|
9
|
+
*
|
|
10
|
+
* - 只写 items: { controller: Controller, bgcolor: UIColor }[] 其中第一个放在主视图上, 第二个放在次视图上
|
|
11
|
+
* - 读写 sideBarShown: boolean = false 侧栏是否显示
|
|
12
|
+
*/
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
exports.SplitViewController = void 0;
|
|
15
|
+
const base_controller_1 = require("./base-controller");
|
|
16
|
+
const base_1 = require("../components/base");
|
|
17
|
+
const single_views_1 = require("../components/single-views");
|
|
18
|
+
const cvid_1 = require("../utils/cvid");
|
|
19
|
+
class SecondaryView extends base_1.Base {
|
|
20
|
+
constructor({ props, layout, views = [] }) {
|
|
21
|
+
super();
|
|
22
|
+
this._props = Object.assign({ bgcolor: $color("groupedBackground", "secondarySurface") }, props);
|
|
23
|
+
this._layouts = {
|
|
24
|
+
hidden: (make, view) => {
|
|
25
|
+
make.top.bottom.inset(0);
|
|
26
|
+
make.right.equalTo(view.super.left);
|
|
27
|
+
make.width.greaterThanOrEqualTo(250);
|
|
28
|
+
make.width.equalTo(view.super).dividedBy(2.5).priority(999);
|
|
29
|
+
},
|
|
30
|
+
shown: (make, view) => {
|
|
31
|
+
make.top.bottom.inset(0);
|
|
32
|
+
make.left.equalTo(view.super.left);
|
|
33
|
+
make.width.greaterThanOrEqualTo(250);
|
|
34
|
+
make.width.equalTo(view.super).dividedBy(2.5).priority(999);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
this.line = new single_views_1.ContentView({
|
|
38
|
+
props: {
|
|
39
|
+
bgcolor: $color("separatorColor")
|
|
40
|
+
},
|
|
41
|
+
layout: (make, view) => {
|
|
42
|
+
make.top.bottom.right.inset(0);
|
|
43
|
+
make.width.equalTo(0.5);
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
this._defineView = () => {
|
|
47
|
+
return {
|
|
48
|
+
type: "view",
|
|
49
|
+
props: Object.assign(Object.assign({}, this._props), { id: this.id }),
|
|
50
|
+
layout,
|
|
51
|
+
views: [...views, this.line.definition]
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
add(view) {
|
|
56
|
+
super.add(view);
|
|
57
|
+
this.line.view.moveToFront();
|
|
58
|
+
}
|
|
59
|
+
show() {
|
|
60
|
+
this.view.remakeLayout(this._layouts.shown);
|
|
61
|
+
$ui.animate({
|
|
62
|
+
duration: 0.3,
|
|
63
|
+
animation: () => this.view.relayout()
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
hide() {
|
|
67
|
+
this.view.remakeLayout(this._layouts.hidden);
|
|
68
|
+
$ui.animate({
|
|
69
|
+
duration: 0.3,
|
|
70
|
+
animation: () => this.view.relayout()
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
class MaskView extends base_1.Base {
|
|
75
|
+
constructor({ props, layout = $layout.fill }) {
|
|
76
|
+
super();
|
|
77
|
+
this._props = Object.assign({ bgcolor: $color("clear") }, props);
|
|
78
|
+
this._shown = false;
|
|
79
|
+
this._dismissEvent = () => {
|
|
80
|
+
if (!this._shown)
|
|
81
|
+
return;
|
|
82
|
+
if (this._props.dismissHandler)
|
|
83
|
+
this._props.dismissHandler();
|
|
84
|
+
};
|
|
85
|
+
this._defineView = () => {
|
|
86
|
+
return {
|
|
87
|
+
type: "view",
|
|
88
|
+
props: Object.assign(Object.assign({}, this._props), { hidden: true, id: this.id }),
|
|
89
|
+
layout,
|
|
90
|
+
events: {
|
|
91
|
+
ready: sender => this._addGesture(sender, this._dismissEvent)
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
_addGesture(view, event) {
|
|
97
|
+
const objectId = cvid_1.cvid.newId;
|
|
98
|
+
$define({
|
|
99
|
+
type: objectId + ": NSObject",
|
|
100
|
+
events: {
|
|
101
|
+
swipeEvent: event,
|
|
102
|
+
tapEvent: event
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
const object = $objc(objectId).$new();
|
|
106
|
+
$objc_retain(object); // 此步骤是必须的,否则将很快被系统释放掉,但是必须在关闭时手动释放掉,否则再次启动可能会有问题
|
|
107
|
+
this._gestureObject = object;
|
|
108
|
+
const swipeGestureRecognizer = $objc("UISwipeGestureRecognizer")
|
|
109
|
+
.$alloc()
|
|
110
|
+
.$initWithTarget_action(object, "swipeEvent");
|
|
111
|
+
swipeGestureRecognizer.$setDirection(1 << 1); // 从右向左划动
|
|
112
|
+
const tapGestureRecognizer = $objc("UITapGestureRecognizer")
|
|
113
|
+
.$alloc()
|
|
114
|
+
.$initWithTarget_action(object, "tapEvent");
|
|
115
|
+
view.ocValue().$addGestureRecognizer(tapGestureRecognizer);
|
|
116
|
+
view.ocValue().$addGestureRecognizer(swipeGestureRecognizer);
|
|
117
|
+
}
|
|
118
|
+
releaseGestureObject() {
|
|
119
|
+
if (this._gestureObject)
|
|
120
|
+
$objc_release(this._gestureObject);
|
|
121
|
+
}
|
|
122
|
+
show() {
|
|
123
|
+
this._shown = true;
|
|
124
|
+
this.view.moveToFront();
|
|
125
|
+
this.view.hidden = false;
|
|
126
|
+
}
|
|
127
|
+
hide() {
|
|
128
|
+
this._shown = false;
|
|
129
|
+
this.view.hidden = true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
class SplitViewController extends base_controller_1.BaseController {
|
|
133
|
+
constructor({ props, layout, events }) {
|
|
134
|
+
super({
|
|
135
|
+
props: {
|
|
136
|
+
id: props.id,
|
|
137
|
+
bgcolor: props.bgcolor
|
|
138
|
+
}, layout, events
|
|
139
|
+
});
|
|
140
|
+
this._sideBarShown = false;
|
|
141
|
+
this.cviews = {};
|
|
142
|
+
this.cviews.secondaryView = new SecondaryView({
|
|
143
|
+
props: {
|
|
144
|
+
bgcolor: props.items[1].bgcolor || $color("clear")
|
|
145
|
+
},
|
|
146
|
+
layout: (make, view) => {
|
|
147
|
+
make.top.bottom.inset(0);
|
|
148
|
+
make.right.equalTo(view.super.left);
|
|
149
|
+
make.width.equalTo(view.super).dividedBy(3);
|
|
150
|
+
},
|
|
151
|
+
views: [
|
|
152
|
+
props.items[1].controller.rootView.definition
|
|
153
|
+
]
|
|
154
|
+
});
|
|
155
|
+
this.cviews.maskView = new MaskView({
|
|
156
|
+
props: {
|
|
157
|
+
dismissHandler: () => (this.sideBarShown = false)
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
this.cviews.primaryView = new single_views_1.ContentView({
|
|
161
|
+
props: {
|
|
162
|
+
bgcolor: props.items[0].bgcolor || $color("clear")
|
|
163
|
+
},
|
|
164
|
+
layout: (make, view) => {
|
|
165
|
+
make.top.bottom.inset(0);
|
|
166
|
+
make.left.equalTo(view.prev.right);
|
|
167
|
+
make.width.equalTo(view.super);
|
|
168
|
+
},
|
|
169
|
+
views: [
|
|
170
|
+
props.items[0].controller.rootView.definition,
|
|
171
|
+
this.cviews.maskView.definition
|
|
172
|
+
]
|
|
173
|
+
});
|
|
174
|
+
this._screenEdgePanGestureObject = this._defineGestureObject(() => {
|
|
175
|
+
if (!this.sideBarShown)
|
|
176
|
+
this.sideBarShown = true;
|
|
177
|
+
});
|
|
178
|
+
this.rootView.views = [this.cviews.secondaryView, this.cviews.primaryView];
|
|
179
|
+
}
|
|
180
|
+
load() {
|
|
181
|
+
super.load();
|
|
182
|
+
this._renewScreenEdgePanGesture();
|
|
183
|
+
}
|
|
184
|
+
remove() {
|
|
185
|
+
$objc_release(this._screenEdgePanGestureObject);
|
|
186
|
+
this.cviews.maskView.releaseGestureObject();
|
|
187
|
+
super.remove();
|
|
188
|
+
}
|
|
189
|
+
uirender() {
|
|
190
|
+
const props = {
|
|
191
|
+
navBarHidden: true,
|
|
192
|
+
statusBarStyle: 0
|
|
193
|
+
};
|
|
194
|
+
super.uirender(props);
|
|
195
|
+
}
|
|
196
|
+
uipush() {
|
|
197
|
+
const props = {
|
|
198
|
+
navBarHidden: true,
|
|
199
|
+
statusBarStyle: 0
|
|
200
|
+
};
|
|
201
|
+
super.uipush(props);
|
|
202
|
+
}
|
|
203
|
+
_defineGestureObject(event) {
|
|
204
|
+
const objectId = cvid_1.cvid.newId;
|
|
205
|
+
$define({
|
|
206
|
+
type: objectId + ": NSObject",
|
|
207
|
+
events: {
|
|
208
|
+
screenEdgePanEvent: event
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
const object = $objc(objectId).$new();
|
|
212
|
+
$objc_retain(object);
|
|
213
|
+
return object;
|
|
214
|
+
}
|
|
215
|
+
_renewScreenEdgePanGesture() {
|
|
216
|
+
const UIScreenEdgePanGestureRecognizer = $ui.controller.view
|
|
217
|
+
.ocValue()
|
|
218
|
+
.$gestureRecognizers()
|
|
219
|
+
.$firstObject();
|
|
220
|
+
UIScreenEdgePanGestureRecognizer.invoke("removeTarget:action:", null, null);
|
|
221
|
+
const NewUIScreenEdgePanGestureRecognizer = $objc("UIScreenEdgePanGestureRecognizer")
|
|
222
|
+
.$alloc()
|
|
223
|
+
.$initWithTarget_action(this._screenEdgePanGestureObject, "screenEdgePanEvent");
|
|
224
|
+
NewUIScreenEdgePanGestureRecognizer.$setEdges(1 << 1);
|
|
225
|
+
this.rootView.view
|
|
226
|
+
.ocValue()
|
|
227
|
+
.$addGestureRecognizer(NewUIScreenEdgePanGestureRecognizer);
|
|
228
|
+
}
|
|
229
|
+
_showSideBar() {
|
|
230
|
+
this.cviews.secondaryView.show();
|
|
231
|
+
this.cviews.maskView.show();
|
|
232
|
+
}
|
|
233
|
+
_hideSideBar() {
|
|
234
|
+
this.cviews.secondaryView.hide();
|
|
235
|
+
this.cviews.maskView.hide();
|
|
236
|
+
}
|
|
237
|
+
get sideBarShown() {
|
|
238
|
+
return this._sideBarShown;
|
|
239
|
+
}
|
|
240
|
+
set sideBarShown(bool) {
|
|
241
|
+
if (this._sideBarShown === bool)
|
|
242
|
+
return;
|
|
243
|
+
if (bool) {
|
|
244
|
+
this._showSideBar();
|
|
245
|
+
}
|
|
246
|
+
else {
|
|
247
|
+
this._hideSideBar();
|
|
248
|
+
}
|
|
249
|
+
this._sideBarShown = bool;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
exports.SplitViewController = SplitViewController;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TabBarController = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* # CView TabBar Controller
|
|
6
|
+
*
|
|
7
|
+
* TabBarController 是一个 PagingController
|
|
8
|
+
*
|
|
9
|
+
* ## 属性
|
|
10
|
+
*
|
|
11
|
+
* - items: {title?: string,
|
|
12
|
+
* symbol?: string,
|
|
13
|
+
* image?: UIImage,
|
|
14
|
+
* tintColor?: UIColor,
|
|
15
|
+
* bgcolor?: UIColor,
|
|
16
|
+
* controller: Controller}[]
|
|
17
|
+
* - index: number = 0
|
|
18
|
+
*/
|
|
19
|
+
const base_controller_1 = require("./base-controller");
|
|
20
|
+
const single_views_1 = require("../components/single-views");
|
|
21
|
+
const tabbar_1 = require("../components/tabbar");
|
|
22
|
+
class TabBarController extends base_controller_1.BaseController {
|
|
23
|
+
constructor({ props, layout, events = {} }) {
|
|
24
|
+
super({
|
|
25
|
+
props: {
|
|
26
|
+
id: props.id,
|
|
27
|
+
bgcolor: props.bgcolor
|
|
28
|
+
}, layout, events
|
|
29
|
+
});
|
|
30
|
+
this._props = {
|
|
31
|
+
items: props.items,
|
|
32
|
+
index: props.index || 0
|
|
33
|
+
};
|
|
34
|
+
this.cviews = {};
|
|
35
|
+
this.cviews.tabbar = new tabbar_1.TabBar({
|
|
36
|
+
props: {
|
|
37
|
+
items: this._props.items,
|
|
38
|
+
index: this._props.index
|
|
39
|
+
},
|
|
40
|
+
events: {
|
|
41
|
+
changed: (cview, index) => (this.index = index)
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
this.pages = this._props.items.map((n, i) => {
|
|
45
|
+
return new single_views_1.ContentView({
|
|
46
|
+
props: {
|
|
47
|
+
bgcolor: n.bgcolor || this._props.bgcolor,
|
|
48
|
+
hidden: i !== this._props.index
|
|
49
|
+
},
|
|
50
|
+
layout: $layout.fill,
|
|
51
|
+
views: [n.controller.rootView.definition]
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
this.cviews.pageContentView = new single_views_1.ContentView({
|
|
55
|
+
props: {
|
|
56
|
+
bgcolor: $color("clear")
|
|
57
|
+
},
|
|
58
|
+
layout: $layout.fill,
|
|
59
|
+
views: this.pages.map(n => n.definition)
|
|
60
|
+
});
|
|
61
|
+
this.rootView.views = [this.cviews.pageContentView, this.cviews.tabbar];
|
|
62
|
+
}
|
|
63
|
+
set index(num) {
|
|
64
|
+
this.cviews.tabbar.index = num;
|
|
65
|
+
this.pages.forEach((n, i) => {
|
|
66
|
+
n.view.hidden = i !== num;
|
|
67
|
+
});
|
|
68
|
+
this._props.index = num;
|
|
69
|
+
}
|
|
70
|
+
get index() {
|
|
71
|
+
return this._props.index || 0;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
exports.TabBarController = TabBarController;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./components/artificial-flowlayout"), exports);
|
|
18
|
+
__exportStar(require("./components/base"), exports);
|
|
19
|
+
__exportStar(require("./components/custom-navigation-bar"), exports);
|
|
20
|
+
__exportStar(require("./components/dynamic-itemsize-matrix"), exports);
|
|
21
|
+
__exportStar(require("./components/dynamic-preference-listview"), exports);
|
|
22
|
+
__exportStar(require("./components/dynamic-rowheight-list"), exports);
|
|
23
|
+
__exportStar(require("./components/enhanced-imageview"), exports);
|
|
24
|
+
__exportStar(require("./components/image-pager"), exports);
|
|
25
|
+
__exportStar(require("./components/page-control"), exports);
|
|
26
|
+
__exportStar(require("./components/pageviewer-titlebar"), exports);
|
|
27
|
+
__exportStar(require("./components/pageviewer"), exports);
|
|
28
|
+
__exportStar(require("./components/rotating-view"), exports);
|
|
29
|
+
__exportStar(require("./components/searchbar"), exports);
|
|
30
|
+
__exportStar(require("./components/sheet"), exports);
|
|
31
|
+
__exportStar(require("./components/single-views"), exports);
|
|
32
|
+
__exportStar(require("./components/static-preference-listview"), exports);
|
|
33
|
+
__exportStar(require("./components/symbol-button"), exports);
|
|
34
|
+
__exportStar(require("./components/tabbar"), exports);
|
|
35
|
+
__exportStar(require("./controller/base-controller"), exports);
|
|
36
|
+
__exportStar(require("./controller/controller-router"), exports);
|
|
37
|
+
__exportStar(require("./controller/pageviewer-controller"), exports);
|
|
38
|
+
__exportStar(require("./controller/presented-page-controller"), exports);
|
|
39
|
+
__exportStar(require("./controller/splitview-controller"), exports);
|
|
40
|
+
__exportStar(require("./controller/tabbar-controller"), exports);
|
|
41
|
+
__exportStar(require("./utils/colors"), exports);
|
|
42
|
+
__exportStar(require("./utils/cvid"), exports);
|
|
43
|
+
__exportStar(require("./utils/l10n"), exports);
|
|
44
|
+
__exportStar(require("./utils/path"), exports);
|
|
45
|
+
__exportStar(require("./utils/rect"), exports);
|
|
46
|
+
__exportStar(require("./utils/uitools"), exports);
|
|
47
|
+
__exportStar(require("./components/alert/input-alert"), exports);
|
|
48
|
+
__exportStar(require("./components/alert/login-alert"), exports);
|
|
49
|
+
__exportStar(require("./components/alert/plain-alert"), exports);
|
|
50
|
+
__exportStar(require("./components/alert/uialert"), exports);
|
|
51
|
+
__exportStar(require("./components/dialogs/dialog-sheet"), exports);
|
|
52
|
+
__exportStar(require("./components/dialogs/form-dialog"), exports);
|
|
53
|
+
__exportStar(require("./components/dialogs/list-dialog"), exports);
|
|
54
|
+
__exportStar(require("./components/dialogs/text-dialog"), exports);
|
|
55
|
+
__exportStar(require("./components/spinners/loading-double-rings"), exports);
|
|
56
|
+
__exportStar(require("./components/spinners/loading-dual-ring"), exports);
|
|
57
|
+
__exportStar(require("./components/spinners/loading-wedges"), exports);
|
|
58
|
+
__exportStar(require("./components/spinners/spinner-androidstyle"), exports);
|
package/dist/test.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// 自定义的语义化颜色
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.sectionHeaderColor = exports.gold = exports.searchBarBgcolor = exports.searchBarSymbolColor = exports.footBarDefaultSegmentColor = exports.sheetNavBarColor = void 0;
|
|
5
|
+
exports.sheetNavBarColor = $color("tint", $color("tertiarySurface"));
|
|
6
|
+
exports.footBarDefaultSegmentColor = $color("#b7bec6", "#6e6e6e");
|
|
7
|
+
//fixedSecondarySurface: $color("#f2f2f7", $color("secondarySurface")), // 让 secondarySurface 在light mode下可以和纯白区分
|
|
8
|
+
exports.searchBarSymbolColor = $color("#777", "#aaa");
|
|
9
|
+
exports.searchBarBgcolor = $color("backgroundColor", "secondarySurface");
|
|
10
|
+
exports.gold = $color("#ffd700");
|
|
11
|
+
exports.sectionHeaderColor = $color({
|
|
12
|
+
light: "#666666",
|
|
13
|
+
dark: "#acacac",
|
|
14
|
+
black: "#ababab"
|
|
15
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// cvid 用于生成唯一的 id
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.cvid = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* 生成指定长度的随机字符串
|
|
7
|
+
*/
|
|
8
|
+
function makeid(length) {
|
|
9
|
+
let result = "";
|
|
10
|
+
const characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
11
|
+
var charactersLength = characters.length;
|
|
12
|
+
for (let i = 0; i < length; i++) {
|
|
13
|
+
result += characters.charAt(Math.floor(Math.random() * charactersLength));
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
}
|
|
17
|
+
class CVID {
|
|
18
|
+
constructor({ prefix = "id_", startIndex = 0 } = {}) {
|
|
19
|
+
this._prefix = prefix;
|
|
20
|
+
this._index = startIndex;
|
|
21
|
+
}
|
|
22
|
+
get newId() {
|
|
23
|
+
const id = this._prefix + this._index;
|
|
24
|
+
this._index++;
|
|
25
|
+
return id;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.cvid = new CVID({ prefix: makeid(8) + "_" });
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// 用于自定义的国际化支持
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.l10n = void 0;
|
|
5
|
+
const language = $device.info.language;
|
|
6
|
+
const strings = {
|
|
7
|
+
"zh-Hans": {
|
|
8
|
+
"DUPLICATE_VALUES": "取值重复",
|
|
9
|
+
"DONE": "完成",
|
|
10
|
+
"ADD": "添加",
|
|
11
|
+
"SEARCH": "搜索",
|
|
12
|
+
"PREVIOUS": "上一步",
|
|
13
|
+
"NEXT": "下一步",
|
|
14
|
+
"REMOVE": "移除",
|
|
15
|
+
"EDIT": "编辑",
|
|
16
|
+
"FINISHED": "完成",
|
|
17
|
+
"INVALID_VALUES": "取值不合法",
|
|
18
|
+
"CANCEL": "取消",
|
|
19
|
+
"CLIPBOARD": "剪贴板",
|
|
20
|
+
"OK": "好的"
|
|
21
|
+
},
|
|
22
|
+
"en": {
|
|
23
|
+
"DUPLICATE_VALUES": "Duplicate values",
|
|
24
|
+
"DONE": "Done",
|
|
25
|
+
"ADD": "Add",
|
|
26
|
+
"SEARCH": "Search",
|
|
27
|
+
"PREVIOUS": "Previous",
|
|
28
|
+
"NEXT": "Next",
|
|
29
|
+
"REMOVE": "Remove",
|
|
30
|
+
"EDIT": "Edit",
|
|
31
|
+
"FINISHED": "Finished",
|
|
32
|
+
"INVALID_VALUES": "Invalid values",
|
|
33
|
+
"CANCEL": "Cancel",
|
|
34
|
+
"CLIPBOARD": "Clipboard",
|
|
35
|
+
"OK": "OK"
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
function l10n(key) {
|
|
39
|
+
if (!strings[language])
|
|
40
|
+
return key;
|
|
41
|
+
const value = strings[language][key];
|
|
42
|
+
return value || key;
|
|
43
|
+
}
|
|
44
|
+
exports.l10n = l10n;
|