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
|
@@ -1,359 +0,0 @@
|
|
|
1
|
-
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
2
|
-
import { Base } from "../components/base";
|
|
3
|
-
import { ContentView } from "../components/single-views";
|
|
4
|
-
import { cvid } from "../utils/cvid";
|
|
5
|
-
|
|
6
|
-
class SecondaryView extends Base<UIView, UiTypes.ViewOptions> {
|
|
7
|
-
_props: UiTypes.ViewProps;
|
|
8
|
-
_layouts: {
|
|
9
|
-
hidden: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
10
|
-
shown: (make: MASConstraintMaker, view: AllUIView) => void;
|
|
11
|
-
};
|
|
12
|
-
line: ContentView;
|
|
13
|
-
_defineView: () => UiTypes.ViewOptions;
|
|
14
|
-
constructor({
|
|
15
|
-
props,
|
|
16
|
-
layout,
|
|
17
|
-
views = [],
|
|
18
|
-
}: {
|
|
19
|
-
props?: UiTypes.ViewProps;
|
|
20
|
-
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
21
|
-
views?: UiTypes.AllViewOptions[];
|
|
22
|
-
}) {
|
|
23
|
-
super();
|
|
24
|
-
this._props = {
|
|
25
|
-
bgcolor: $color("groupedBackground", "secondarySurface"),
|
|
26
|
-
...props,
|
|
27
|
-
};
|
|
28
|
-
this._layouts = {
|
|
29
|
-
hidden: (make, view) => {
|
|
30
|
-
make.top.bottom.inset(0);
|
|
31
|
-
make.right.equalTo(view.super.left);
|
|
32
|
-
make.width.greaterThanOrEqualTo(250);
|
|
33
|
-
make.width.lessThanOrEqualTo(350);
|
|
34
|
-
make.width.equalTo(view.super).dividedBy(2.5).priority(999);
|
|
35
|
-
},
|
|
36
|
-
shown: (make, view) => {
|
|
37
|
-
make.top.bottom.inset(0);
|
|
38
|
-
make.left.equalTo(view.super.left);
|
|
39
|
-
make.width.greaterThanOrEqualTo(250);
|
|
40
|
-
make.width.lessThanOrEqualTo(350);
|
|
41
|
-
make.width.equalTo(view.super).dividedBy(2.5).priority(999);
|
|
42
|
-
},
|
|
43
|
-
};
|
|
44
|
-
this.line = new ContentView({
|
|
45
|
-
props: {
|
|
46
|
-
bgcolor: $color("separatorColor"),
|
|
47
|
-
},
|
|
48
|
-
layout: (make, view) => {
|
|
49
|
-
make.top.bottom.right.inset(0);
|
|
50
|
-
make.width.equalTo(0.5);
|
|
51
|
-
},
|
|
52
|
-
});
|
|
53
|
-
this._defineView = () => {
|
|
54
|
-
return {
|
|
55
|
-
type: "view",
|
|
56
|
-
props: {
|
|
57
|
-
...this._props,
|
|
58
|
-
id: this.id,
|
|
59
|
-
},
|
|
60
|
-
layout,
|
|
61
|
-
views: [...views, this.line.definition],
|
|
62
|
-
};
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
add(view: UiTypes.AllViewOptions | Base<any, any>) {
|
|
67
|
-
super.add(view);
|
|
68
|
-
this.line.view.moveToFront();
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
show() {
|
|
72
|
-
this.view.remakeLayout(this._layouts.shown);
|
|
73
|
-
$ui.animate({
|
|
74
|
-
duration: 0.3,
|
|
75
|
-
animation: () => this.view.relayout(),
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
hide() {
|
|
80
|
-
this.view.remakeLayout(this._layouts.hidden);
|
|
81
|
-
$ui.animate({
|
|
82
|
-
duration: 0.3,
|
|
83
|
-
animation: () => this.view.relayout(),
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
class MaskView extends Base<UIView, UiTypes.ViewOptions> {
|
|
89
|
-
_props: {
|
|
90
|
-
bgcolor: UIColor;
|
|
91
|
-
dismissHandler?: () => void;
|
|
92
|
-
};
|
|
93
|
-
_shown: boolean;
|
|
94
|
-
_dismissEvent: () => void;
|
|
95
|
-
_gestureObject: any;
|
|
96
|
-
_defineView: () => UiTypes.ViewOptions;
|
|
97
|
-
constructor({
|
|
98
|
-
props,
|
|
99
|
-
layout = $layout.fill,
|
|
100
|
-
}: {
|
|
101
|
-
props: {
|
|
102
|
-
bgcolor?: UIColor;
|
|
103
|
-
dismissHandler?: () => void;
|
|
104
|
-
};
|
|
105
|
-
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
106
|
-
}) {
|
|
107
|
-
super();
|
|
108
|
-
this._props = { bgcolor: $color("clear"), ...props };
|
|
109
|
-
this._shown = false;
|
|
110
|
-
this._dismissEvent = () => {
|
|
111
|
-
if (!this._shown) return;
|
|
112
|
-
if (this._props.dismissHandler) this._props.dismissHandler();
|
|
113
|
-
};
|
|
114
|
-
this._defineView = () => {
|
|
115
|
-
return {
|
|
116
|
-
type: "view",
|
|
117
|
-
props: {
|
|
118
|
-
...this._props,
|
|
119
|
-
hidden: true,
|
|
120
|
-
id: this.id,
|
|
121
|
-
},
|
|
122
|
-
layout,
|
|
123
|
-
events: {
|
|
124
|
-
ready: (sender) => this._addGesture(sender, this._dismissEvent),
|
|
125
|
-
},
|
|
126
|
-
};
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
_addGesture(view: UIView, event: () => void) {
|
|
131
|
-
const objectId = cvid.newId;
|
|
132
|
-
$define({
|
|
133
|
-
type: objectId + ": NSObject",
|
|
134
|
-
events: {
|
|
135
|
-
swipeEvent: event,
|
|
136
|
-
tapEvent: event,
|
|
137
|
-
},
|
|
138
|
-
});
|
|
139
|
-
const object = $objc(objectId).$new();
|
|
140
|
-
$objc_retain(object); // 此步骤是必须的,否则将很快被系统释放掉,
|
|
141
|
-
// 但是必须在关闭时手动释放掉,否则再次启动可能会有问题
|
|
142
|
-
this._gestureObject = object;
|
|
143
|
-
const swipeGestureRecognizer = $objc("UISwipeGestureRecognizer")
|
|
144
|
-
.$alloc()
|
|
145
|
-
.$initWithTarget_action(object, "swipeEvent");
|
|
146
|
-
swipeGestureRecognizer.$setDirection(1 << 1); // 从右向左划动
|
|
147
|
-
const tapGestureRecognizer = $objc("UITapGestureRecognizer").$alloc().$initWithTarget_action(object, "tapEvent");
|
|
148
|
-
view.ocValue().$addGestureRecognizer(tapGestureRecognizer);
|
|
149
|
-
view.ocValue().$addGestureRecognizer(swipeGestureRecognizer);
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
releaseGestureObject() {
|
|
153
|
-
if (this._gestureObject) $objc_release(this._gestureObject);
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
show() {
|
|
157
|
-
this._shown = true;
|
|
158
|
-
this.view.moveToFront();
|
|
159
|
-
this.view.hidden = false;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
hide() {
|
|
163
|
-
this._shown = false;
|
|
164
|
-
this.view.hidden = true;
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
interface SplitViewControllerProps extends BaseControllerProps {
|
|
169
|
-
items: { controller: BaseController; bgcolor: UIColor }[];
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/** # CView SplitView Controller
|
|
173
|
-
*
|
|
174
|
-
* 实现左右分栏布局的控制器, 本身不提供除了分割线以外的视觉效果
|
|
175
|
-
*
|
|
176
|
-
* 此控制器加载后,会禁用原本的ScreenEdgePanGesture,此控制器应该作为根控制器使用
|
|
177
|
-
*
|
|
178
|
-
* @param options.props.items: { controller: Controller, bgcolor: UIColor }[]
|
|
179
|
-
* 其中第一个放在主视图上, 第二个放在次视图上
|
|
180
|
-
*
|
|
181
|
-
* @property sideBarShown: boolean = false 侧栏是否显示
|
|
182
|
-
* @property canShowSidebar: boolean = true 是否启动显示侧栏的动作
|
|
183
|
-
* (若为false,依然可以用sideBarShown来控制侧栏的显示)
|
|
184
|
-
*/
|
|
185
|
-
export class SplitViewController extends BaseController {
|
|
186
|
-
private _screenEdgePanGestureObject: any;
|
|
187
|
-
private _sideBarShown: boolean;
|
|
188
|
-
private _canShowSidebar: boolean;
|
|
189
|
-
private _primaryController: BaseController;
|
|
190
|
-
private _secondaryController: BaseController;
|
|
191
|
-
cviews: {
|
|
192
|
-
primaryView: ContentView;
|
|
193
|
-
secondaryView: SecondaryView;
|
|
194
|
-
maskView: MaskView;
|
|
195
|
-
};
|
|
196
|
-
constructor({
|
|
197
|
-
props,
|
|
198
|
-
layout,
|
|
199
|
-
events,
|
|
200
|
-
}: {
|
|
201
|
-
props: SplitViewControllerProps;
|
|
202
|
-
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
203
|
-
events?: BaseControllerEvents;
|
|
204
|
-
}) {
|
|
205
|
-
super({
|
|
206
|
-
props: {
|
|
207
|
-
id: props.id,
|
|
208
|
-
bgcolor: props.bgcolor,
|
|
209
|
-
},
|
|
210
|
-
layout,
|
|
211
|
-
events: {
|
|
212
|
-
...events,
|
|
213
|
-
didAppear: (sender) => {
|
|
214
|
-
if (this._sideBarShown) {
|
|
215
|
-
this._secondaryController.appear();
|
|
216
|
-
} else {
|
|
217
|
-
this._primaryController.appear();
|
|
218
|
-
}
|
|
219
|
-
events?.didAppear?.(this);
|
|
220
|
-
},
|
|
221
|
-
didDisappear: () => {
|
|
222
|
-
this._primaryController.disappear();
|
|
223
|
-
this._secondaryController.disappear();
|
|
224
|
-
events?.didDisappear?.(this);
|
|
225
|
-
},
|
|
226
|
-
},
|
|
227
|
-
});
|
|
228
|
-
this._sideBarShown = false;
|
|
229
|
-
this._canShowSidebar = true;
|
|
230
|
-
this._primaryController = props.items[0].controller;
|
|
231
|
-
this._secondaryController = props.items[1].controller;
|
|
232
|
-
this.cviews = {} as {
|
|
233
|
-
primaryView: ContentView;
|
|
234
|
-
secondaryView: SecondaryView;
|
|
235
|
-
maskView: MaskView;
|
|
236
|
-
};
|
|
237
|
-
this.cviews.secondaryView = new SecondaryView({
|
|
238
|
-
props: {
|
|
239
|
-
bgcolor: props.items[1].bgcolor || $color("clear"),
|
|
240
|
-
},
|
|
241
|
-
layout: (make, view) => {
|
|
242
|
-
make.top.bottom.inset(0);
|
|
243
|
-
make.right.equalTo(view.super.left);
|
|
244
|
-
make.width.equalTo(view.super).dividedBy(3);
|
|
245
|
-
},
|
|
246
|
-
views: [props.items[1].controller.rootView.definition],
|
|
247
|
-
});
|
|
248
|
-
this.cviews.maskView = new MaskView({
|
|
249
|
-
props: {
|
|
250
|
-
dismissHandler: () => (this.sideBarShown = false),
|
|
251
|
-
},
|
|
252
|
-
});
|
|
253
|
-
this.cviews.primaryView = new ContentView({
|
|
254
|
-
props: {
|
|
255
|
-
bgcolor: props.items[0].bgcolor || $color("clear"),
|
|
256
|
-
},
|
|
257
|
-
layout: (make, view) => {
|
|
258
|
-
make.top.bottom.inset(0);
|
|
259
|
-
make.left.equalTo(view.prev.right);
|
|
260
|
-
make.width.equalTo(view.super);
|
|
261
|
-
},
|
|
262
|
-
views: [props.items[0].controller.rootView.definition, this.cviews.maskView.definition],
|
|
263
|
-
});
|
|
264
|
-
this._screenEdgePanGestureObject = this._defineGestureObject(() => {
|
|
265
|
-
if (!this.sideBarShown && this._canShowSidebar) this.sideBarShown = true;
|
|
266
|
-
});
|
|
267
|
-
this.rootView.views = [this.cviews.secondaryView, this.cviews.primaryView];
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
load() {
|
|
271
|
-
super.load();
|
|
272
|
-
this._renewScreenEdgePanGesture();
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
remove() {
|
|
276
|
-
$objc_release(this._screenEdgePanGestureObject);
|
|
277
|
-
this.cviews.maskView.releaseGestureObject();
|
|
278
|
-
super.remove();
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
uirender() {
|
|
282
|
-
const props: UiTypes.RootViewPrefs = {
|
|
283
|
-
navBarHidden: true,
|
|
284
|
-
statusBarStyle: 0,
|
|
285
|
-
};
|
|
286
|
-
super.uirender(props);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
uipush() {
|
|
290
|
-
const props: UiTypes.RootViewPrefs = {
|
|
291
|
-
navBarHidden: true,
|
|
292
|
-
statusBarStyle: 0,
|
|
293
|
-
};
|
|
294
|
-
super.uipush(props);
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
_defineGestureObject(event: () => void) {
|
|
298
|
-
const objectId = cvid.newId;
|
|
299
|
-
$define({
|
|
300
|
-
type: objectId + ": NSObject",
|
|
301
|
-
events: {
|
|
302
|
-
screenEdgePanEvent: event,
|
|
303
|
-
},
|
|
304
|
-
});
|
|
305
|
-
const object = $objc(objectId).$new();
|
|
306
|
-
$objc_retain(object);
|
|
307
|
-
return object;
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
_renewScreenEdgePanGesture() {
|
|
311
|
-
const UIScreenEdgePanGestureRecognizer = $ui.controller.view.ocValue().$gestureRecognizers().$firstObject();
|
|
312
|
-
|
|
313
|
-
UIScreenEdgePanGestureRecognizer.invoke("removeTarget:action:", null, null);
|
|
314
|
-
const NewUIScreenEdgePanGestureRecognizer = $objc("UIScreenEdgePanGestureRecognizer")
|
|
315
|
-
.$alloc()
|
|
316
|
-
.$initWithTarget_action(this._screenEdgePanGestureObject, "screenEdgePanEvent");
|
|
317
|
-
NewUIScreenEdgePanGestureRecognizer.$setEdges(1 << 1);
|
|
318
|
-
this.rootView.view.ocValue().$addGestureRecognizer(NewUIScreenEdgePanGestureRecognizer);
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
_showSideBar() {
|
|
322
|
-
this.cviews.secondaryView.show();
|
|
323
|
-
this.cviews.maskView.show();
|
|
324
|
-
}
|
|
325
|
-
|
|
326
|
-
_hideSideBar() {
|
|
327
|
-
this.cviews.secondaryView.hide();
|
|
328
|
-
this.cviews.maskView.hide();
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
get sideBarShown() {
|
|
332
|
-
return this._sideBarShown;
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
set sideBarShown(bool: boolean) {
|
|
336
|
-
if (this._sideBarShown === bool) return;
|
|
337
|
-
if (bool) {
|
|
338
|
-
this._showSideBar();
|
|
339
|
-
} else {
|
|
340
|
-
this._hideSideBar();
|
|
341
|
-
}
|
|
342
|
-
this._sideBarShown = bool;
|
|
343
|
-
if (bool) {
|
|
344
|
-
this._primaryController.disappear();
|
|
345
|
-
this._secondaryController.appear();
|
|
346
|
-
} else {
|
|
347
|
-
this._primaryController.appear();
|
|
348
|
-
this._secondaryController.disappear();
|
|
349
|
-
}
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
get canShowSidebar() {
|
|
353
|
-
return this._canShowSidebar;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
set canShowSidebar(bool: boolean) {
|
|
357
|
-
this._canShowSidebar = bool;
|
|
358
|
-
}
|
|
359
|
-
}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import { BaseController, BaseControllerProps, BaseControllerEvents } from "./base-controller";
|
|
2
|
-
import { ContentView } from "../components/single-views";
|
|
3
|
-
import { TabBar } from "../components/tabbar";
|
|
4
|
-
|
|
5
|
-
interface TabBarControllerProps extends BaseControllerProps {
|
|
6
|
-
items: {
|
|
7
|
-
title?: string;
|
|
8
|
-
symbol?: string;
|
|
9
|
-
image?: UIImage;
|
|
10
|
-
tintColor?: UIColor;
|
|
11
|
-
bgcolor?: UIColor;
|
|
12
|
-
controller: BaseController;
|
|
13
|
-
}[];
|
|
14
|
-
index?: number;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
interface TabBarControllerEvents extends BaseControllerEvents {
|
|
18
|
-
changed?: (controller: TabBarController, index: number) => void;
|
|
19
|
-
doubleTapped?: (controller: TabBarController, index: number) => void;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* # CView TabBar Controller
|
|
24
|
-
*
|
|
25
|
-
* TabBarController 是一个 PagingController
|
|
26
|
-
*
|
|
27
|
-
* ## 属性
|
|
28
|
-
*
|
|
29
|
-
* - items: {title?: string,
|
|
30
|
-
* symbol?: string,
|
|
31
|
-
* image?: UIImage,
|
|
32
|
-
* tintColor?: UIColor,
|
|
33
|
-
* bgcolor?: UIColor,
|
|
34
|
-
* controller: Controller}[]
|
|
35
|
-
* - index: number = 0
|
|
36
|
-
*/
|
|
37
|
-
export class TabBarController extends BaseController {
|
|
38
|
-
_props: TabBarControllerProps;
|
|
39
|
-
cviews: {
|
|
40
|
-
tabbar: TabBar;
|
|
41
|
-
pageContentView: ContentView;
|
|
42
|
-
};
|
|
43
|
-
pages: ContentView[];
|
|
44
|
-
constructor({
|
|
45
|
-
props,
|
|
46
|
-
layout,
|
|
47
|
-
events = {},
|
|
48
|
-
}: {
|
|
49
|
-
props: TabBarControllerProps;
|
|
50
|
-
layout?: (make: MASConstraintMaker, view: UIView) => void;
|
|
51
|
-
events?: TabBarControllerEvents;
|
|
52
|
-
}) {
|
|
53
|
-
super({
|
|
54
|
-
props: {
|
|
55
|
-
id: props.id,
|
|
56
|
-
bgcolor: props.bgcolor,
|
|
57
|
-
},
|
|
58
|
-
layout,
|
|
59
|
-
events: {
|
|
60
|
-
...events,
|
|
61
|
-
didAppear: () => {
|
|
62
|
-
this._props.items[this.index].controller.appear();
|
|
63
|
-
events.didAppear?.(this);
|
|
64
|
-
},
|
|
65
|
-
didDisappear: () => {
|
|
66
|
-
this._props.items[this.index].controller.disappear();
|
|
67
|
-
events.didDisappear?.(this);
|
|
68
|
-
},
|
|
69
|
-
},
|
|
70
|
-
});
|
|
71
|
-
this._props = {
|
|
72
|
-
items: props.items,
|
|
73
|
-
index: props.index || 0,
|
|
74
|
-
};
|
|
75
|
-
this.cviews = {} as {
|
|
76
|
-
tabbar: TabBar;
|
|
77
|
-
pageContentView: ContentView;
|
|
78
|
-
};
|
|
79
|
-
this.cviews.tabbar = new TabBar({
|
|
80
|
-
props: {
|
|
81
|
-
items: this._props.items,
|
|
82
|
-
index: this._props.index,
|
|
83
|
-
},
|
|
84
|
-
events: {
|
|
85
|
-
changed: (cview, index) => {
|
|
86
|
-
this.index = index;
|
|
87
|
-
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
88
|
-
this._props.items[index].controller.appear();
|
|
89
|
-
events.changed?.(this, index);
|
|
90
|
-
},
|
|
91
|
-
doubleTapped: (cview, index) => {
|
|
92
|
-
events.doubleTapped?.(this, index);
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
});
|
|
96
|
-
|
|
97
|
-
this.pages = this._props.items.map((n, i) => {
|
|
98
|
-
return new ContentView({
|
|
99
|
-
props: {
|
|
100
|
-
bgcolor: n.bgcolor || this._props.bgcolor,
|
|
101
|
-
hidden: i !== this._props.index,
|
|
102
|
-
},
|
|
103
|
-
layout: $layout.fill,
|
|
104
|
-
views: [n.controller.rootView.definition],
|
|
105
|
-
});
|
|
106
|
-
});
|
|
107
|
-
this.cviews.pageContentView = new ContentView({
|
|
108
|
-
props: {
|
|
109
|
-
bgcolor: $color("clear"),
|
|
110
|
-
},
|
|
111
|
-
layout: $layout.fill,
|
|
112
|
-
views: this.pages.map((n) => n.definition),
|
|
113
|
-
});
|
|
114
|
-
this.rootView.views = [this.cviews.pageContentView, this.cviews.tabbar];
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
set index(num) {
|
|
118
|
-
if (this._props.index === num) return;
|
|
119
|
-
this.cviews.tabbar.index = num;
|
|
120
|
-
this.pages.forEach((n, i) => {
|
|
121
|
-
n.view.hidden = i !== num;
|
|
122
|
-
});
|
|
123
|
-
this._props.index = num;
|
|
124
|
-
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
125
|
-
this._props.items[num].controller.appear();
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
get index() {
|
|
129
|
-
return this._props.index || 0;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const custom_navigation_bar_1 = require("../components/custom-navigation-bar");
|
|
4
|
-
const navbar = new custom_navigation_bar_1.CustomNavigationBar({
|
|
5
|
-
props: {
|
|
6
|
-
title: "Custom Navigation Bar",
|
|
7
|
-
popButtonEnabled: true,
|
|
8
|
-
popButtonTitle: "Back",
|
|
9
|
-
rightBarButtonItems: [
|
|
10
|
-
{
|
|
11
|
-
symbol: "gear",
|
|
12
|
-
handler: (sender) => console.log(sender),
|
|
13
|
-
},
|
|
14
|
-
],
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
$ui.render({
|
|
18
|
-
views: [
|
|
19
|
-
{
|
|
20
|
-
type: "button",
|
|
21
|
-
props: {},
|
|
22
|
-
layout: $layout.fill,
|
|
23
|
-
events: {
|
|
24
|
-
tapped: () => {
|
|
25
|
-
$ui.push({
|
|
26
|
-
views: [navbar.definition],
|
|
27
|
-
});
|
|
28
|
-
$delay(1, () => {
|
|
29
|
-
navbar.cviews.bgview.view.alpha = 0.5;
|
|
30
|
-
navbar.cviews.separator.view.alpha = 0.5;
|
|
31
|
-
});
|
|
32
|
-
$delay(2, () => {
|
|
33
|
-
navbar.cviews.bgview.view.alpha = 0;
|
|
34
|
-
navbar.cviews.separator.view.alpha = 0;
|
|
35
|
-
});
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const dialog_sheet_1 = require("../components/dialogs/dialog-sheet");
|
|
4
|
-
const single_views_1 = require("../components/single-views");
|
|
5
|
-
const cview = new single_views_1.ContentView({
|
|
6
|
-
props: {
|
|
7
|
-
bgcolor: $color("lightGray"),
|
|
8
|
-
},
|
|
9
|
-
layout: $layout.fill,
|
|
10
|
-
});
|
|
11
|
-
$ui.render({
|
|
12
|
-
views: [
|
|
13
|
-
{
|
|
14
|
-
type: "button",
|
|
15
|
-
props: {
|
|
16
|
-
title: "Show Dialog Sheet",
|
|
17
|
-
},
|
|
18
|
-
layout: $layout.center,
|
|
19
|
-
events: {
|
|
20
|
-
tapped: async () => {
|
|
21
|
-
const sheet = new dialog_sheet_1.DialogSheet({
|
|
22
|
-
title: "Dialog Sheet",
|
|
23
|
-
cview,
|
|
24
|
-
doneHandler: () => {
|
|
25
|
-
$ui.alert("Done");
|
|
26
|
-
},
|
|
27
|
-
presentMode: 1,
|
|
28
|
-
bgcolor: $color("white"),
|
|
29
|
-
doneButtonHidden: false,
|
|
30
|
-
doneButtonValidator: () => {
|
|
31
|
-
return true;
|
|
32
|
-
},
|
|
33
|
-
doneButtonTitle: "完成",
|
|
34
|
-
});
|
|
35
|
-
await sheet.present();
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
});
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const dynamic_contextmenu_view_1 = require("../components/dynamic-contextmenu-view");
|
|
4
|
-
let menuIndex = 0;
|
|
5
|
-
const menuList = [
|
|
6
|
-
{
|
|
7
|
-
title: "菜单1",
|
|
8
|
-
items: [
|
|
9
|
-
{
|
|
10
|
-
title: "变成菜单1",
|
|
11
|
-
symbol: "plus",
|
|
12
|
-
handler: () => {
|
|
13
|
-
menuIndex = 0;
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
title: "变成菜单2",
|
|
18
|
-
symbol: "plus",
|
|
19
|
-
destructive: true,
|
|
20
|
-
handler: () => {
|
|
21
|
-
menuIndex = 1;
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
|
-
],
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
items: [
|
|
28
|
-
{
|
|
29
|
-
title: "变成菜单1",
|
|
30
|
-
handler: () => {
|
|
31
|
-
menuIndex = 0;
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
title: "变成菜单2",
|
|
36
|
-
handler: () => {
|
|
37
|
-
menuIndex = 1;
|
|
38
|
-
},
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
];
|
|
43
|
-
const view = new dynamic_contextmenu_view_1.DynamicContextMenuView({
|
|
44
|
-
generateContextMenu: (sender) => {
|
|
45
|
-
return menuList[menuIndex];
|
|
46
|
-
},
|
|
47
|
-
props: {},
|
|
48
|
-
layout: (make, view) => {
|
|
49
|
-
make.center.equalTo(view.super);
|
|
50
|
-
make.size.equalTo($size(100, 100));
|
|
51
|
-
},
|
|
52
|
-
views: [
|
|
53
|
-
{
|
|
54
|
-
type: "label",
|
|
55
|
-
props: {
|
|
56
|
-
text: "长按我",
|
|
57
|
-
textColor: $color("black"),
|
|
58
|
-
align: $align.center,
|
|
59
|
-
},
|
|
60
|
-
layout: $layout.center,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
});
|
|
64
|
-
$ui.render({
|
|
65
|
-
views: [view.definition],
|
|
66
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const dynamic_itemsize_matrix_1 = require("../components/dynamic-itemsize-matrix");
|
|
4
|
-
const matrix = new dynamic_itemsize_matrix_1.DynamicItemSizeMatrix({
|
|
5
|
-
props: {
|
|
6
|
-
spacing: 5,
|
|
7
|
-
minItemWidth: $device.isIpad ? 140 : 118,
|
|
8
|
-
maxColumns: 10,
|
|
9
|
-
template: {
|
|
10
|
-
views: [
|
|
11
|
-
{
|
|
12
|
-
type: "label",
|
|
13
|
-
props: {
|
|
14
|
-
id: "label",
|
|
15
|
-
align: $align.center,
|
|
16
|
-
font: $font(13),
|
|
17
|
-
},
|
|
18
|
-
layout: (make, view) => {
|
|
19
|
-
make.left.right.bottom.inset(0);
|
|
20
|
-
make.height.equalTo(20);
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
{
|
|
24
|
-
type: "image",
|
|
25
|
-
props: {
|
|
26
|
-
symbol: "sun.dust",
|
|
27
|
-
bgcolor: $color("backgroundColor", "secondarySurface"),
|
|
28
|
-
contentMode: $contentMode.scaleAspectFit,
|
|
29
|
-
},
|
|
30
|
-
layout: (make, view) => {
|
|
31
|
-
make.top.left.right.equalTo(0);
|
|
32
|
-
make.bottom.equalTo(view.prev.top);
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
data: [...Array(100)].map((n, i) => {
|
|
38
|
-
return {
|
|
39
|
-
label: { text: i + 1 },
|
|
40
|
-
};
|
|
41
|
-
}),
|
|
42
|
-
footer: {
|
|
43
|
-
type: "view",
|
|
44
|
-
props: {
|
|
45
|
-
height: 20,
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
layout: (make, view) => {
|
|
50
|
-
make.left.right.equalTo(view.super.safeArea);
|
|
51
|
-
make.top.bottom.equalTo(view.super);
|
|
52
|
-
},
|
|
53
|
-
events: {
|
|
54
|
-
itemHeight: (width) => width * 1.414 + 20,
|
|
55
|
-
didSelect: (sender, indexPath, data) => { },
|
|
56
|
-
didScroll: (sender) => {
|
|
57
|
-
matrix.columns;
|
|
58
|
-
console.log(sender.contentOffset.y);
|
|
59
|
-
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)));
|
|
60
|
-
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)) * matrix.columns);
|
|
61
|
-
},
|
|
62
|
-
},
|
|
63
|
-
});
|
|
64
|
-
$ui.render({
|
|
65
|
-
props: {
|
|
66
|
-
navButtons: [
|
|
67
|
-
{
|
|
68
|
-
symbol: "plus",
|
|
69
|
-
handler: () => (matrix.data = [{ label: { text: "New" } }]),
|
|
70
|
-
},
|
|
71
|
-
],
|
|
72
|
-
},
|
|
73
|
-
views: [matrix.definition],
|
|
74
|
-
});
|