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
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
import { DynamicPreferenceListView } from "../components/dynamic-preference-listview";
|
|
2
|
-
import { PreferenceSection } from "../components/static-preference-listview";
|
|
3
|
-
|
|
4
|
-
const sections: PreferenceSection[] = [
|
|
5
|
-
{
|
|
6
|
-
title: "Section 1",
|
|
7
|
-
rows: [
|
|
8
|
-
{
|
|
9
|
-
type: "string",
|
|
10
|
-
title: "string",
|
|
11
|
-
key: "string",
|
|
12
|
-
value: "测试一号测试二号测试三号测试四号测试五号测试六号",
|
|
13
|
-
},
|
|
14
|
-
{
|
|
15
|
-
type: "number",
|
|
16
|
-
title: "number",
|
|
17
|
-
key: "number",
|
|
18
|
-
value: 1111.1,
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
type: "integer",
|
|
22
|
-
title: "integer",
|
|
23
|
-
key: "integer",
|
|
24
|
-
value: 1111,
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
type: "stepper",
|
|
28
|
-
title: "stepper",
|
|
29
|
-
key: "stepper",
|
|
30
|
-
value: 2,
|
|
31
|
-
min: 2,
|
|
32
|
-
max: 5,
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
title: "Section 2",
|
|
38
|
-
rows: [
|
|
39
|
-
{
|
|
40
|
-
type: "boolean",
|
|
41
|
-
title: "boolean",
|
|
42
|
-
key: "boolean",
|
|
43
|
-
value: true,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
type: "slider",
|
|
47
|
-
title: "slider",
|
|
48
|
-
key: "slider",
|
|
49
|
-
value: 1,
|
|
50
|
-
decimal: 0,
|
|
51
|
-
min: 0,
|
|
52
|
-
max: 2,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
type: "list",
|
|
56
|
-
title: "list",
|
|
57
|
-
key: "list",
|
|
58
|
-
items: ["测试一号", "测试bbb"],
|
|
59
|
-
value: 0,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
type: "tab",
|
|
63
|
-
title: "tab",
|
|
64
|
-
key: "tab",
|
|
65
|
-
items: ["测试aaa", "测试bbb"],
|
|
66
|
-
value: 0,
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
type: "date",
|
|
70
|
-
title: "date",
|
|
71
|
-
key: "date",
|
|
72
|
-
mode: 1,
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
title: "Section 3",
|
|
78
|
-
rows: [
|
|
79
|
-
{
|
|
80
|
-
type: "info",
|
|
81
|
-
title: "info",
|
|
82
|
-
value: "this is info",
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: "link",
|
|
86
|
-
title: "link",
|
|
87
|
-
value: "https://apple.com",
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
type: "symbol-action",
|
|
91
|
-
title: "种类1",
|
|
92
|
-
symbol: "checkmark",
|
|
93
|
-
tintColor: $color("systemLink"),
|
|
94
|
-
titleColor: $color("systemLink"),
|
|
95
|
-
value: () => console.info(0),
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
type: "action",
|
|
99
|
-
title: "action",
|
|
100
|
-
value: () => console.info(0),
|
|
101
|
-
},
|
|
102
|
-
],
|
|
103
|
-
},
|
|
104
|
-
];
|
|
105
|
-
const v = new DynamicPreferenceListView({
|
|
106
|
-
props: {
|
|
107
|
-
data: [],
|
|
108
|
-
//symbolSizeForSymbolAction: $size(40, 40)
|
|
109
|
-
},
|
|
110
|
-
sections: sections,
|
|
111
|
-
layout: $layout.fill,
|
|
112
|
-
events: {
|
|
113
|
-
changed: (values: any) => {
|
|
114
|
-
console.info(values);
|
|
115
|
-
console.info(values.date);
|
|
116
|
-
},
|
|
117
|
-
},
|
|
118
|
-
});
|
|
119
|
-
|
|
120
|
-
$ui.render({
|
|
121
|
-
props: {
|
|
122
|
-
title: "",
|
|
123
|
-
navButtons: [
|
|
124
|
-
{
|
|
125
|
-
symbol: "plus",
|
|
126
|
-
handler: () => {
|
|
127
|
-
sections.push({
|
|
128
|
-
title: "Section " + (sections.length + 1),
|
|
129
|
-
rows: [
|
|
130
|
-
{
|
|
131
|
-
type: "interactive-info",
|
|
132
|
-
title: "interactive-info",
|
|
133
|
-
key: "interactive-info",
|
|
134
|
-
value: "测试一号测试二号测试三号测试四号测试五号测试六号",
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
type: "interactive-info",
|
|
138
|
-
title: "interactive-info2",
|
|
139
|
-
key: "interactive-info2",
|
|
140
|
-
value: "测试一号测试二号测试三号测试四号测试五号测试六号",
|
|
141
|
-
copyable: true,
|
|
142
|
-
},
|
|
143
|
-
],
|
|
144
|
-
});
|
|
145
|
-
v.sections = sections;
|
|
146
|
-
},
|
|
147
|
-
},
|
|
148
|
-
],
|
|
149
|
-
},
|
|
150
|
-
views: [v.definition],
|
|
151
|
-
});
|
package/test/flowlayout.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { Flowlayout } from "../components/flowlayout";
|
|
2
|
-
import { Label } from "../components/single-views";
|
|
3
|
-
|
|
4
|
-
class FlowlayoutItem extends Label {
|
|
5
|
-
private _text: string;
|
|
6
|
-
constructor(text: string) {
|
|
7
|
-
super({
|
|
8
|
-
props: {
|
|
9
|
-
text: text,
|
|
10
|
-
borderWidth: 1,
|
|
11
|
-
},
|
|
12
|
-
layout: $layout.fill,
|
|
13
|
-
});
|
|
14
|
-
this._text = text;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
itemWidth() {
|
|
18
|
-
return this._text.length * 10;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const flowlayout = new Flowlayout({
|
|
23
|
-
props: {
|
|
24
|
-
items: [new FlowlayoutItem("Hello"), new FlowlayoutItem("World"), new FlowlayoutItem("Flowlayout")],
|
|
25
|
-
spacing: 10,
|
|
26
|
-
itemHeight: 30,
|
|
27
|
-
fixedRows: 2,
|
|
28
|
-
fixedHeight: true,
|
|
29
|
-
menu: {
|
|
30
|
-
items: [
|
|
31
|
-
{
|
|
32
|
-
symbol: "plus",
|
|
33
|
-
handler: (sender) => console.log("here"),
|
|
34
|
-
},
|
|
35
|
-
],
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
layout: (make, view) => {
|
|
39
|
-
make.left.right.inset(10);
|
|
40
|
-
make.top.inset(100);
|
|
41
|
-
make.height.equalTo(70);
|
|
42
|
-
},
|
|
43
|
-
events: {
|
|
44
|
-
didSelect: (sender, index, item) => {
|
|
45
|
-
$ui.alert(item.view.text);
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
$ui.render({
|
|
51
|
-
props: {
|
|
52
|
-
navButtons: [
|
|
53
|
-
{
|
|
54
|
-
symbol: "plus",
|
|
55
|
-
handler: () => {
|
|
56
|
-
flowlayout.items = [
|
|
57
|
-
new FlowlayoutItem("Hello"),
|
|
58
|
-
new FlowlayoutItem("World"),
|
|
59
|
-
new FlowlayoutItem("Flowlayout"),
|
|
60
|
-
new FlowlayoutItem("New Item"),
|
|
61
|
-
new FlowlayoutItem("Hello"),
|
|
62
|
-
new FlowlayoutItem("World"),
|
|
63
|
-
new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayout"),
|
|
64
|
-
new FlowlayoutItem("New Item"),
|
|
65
|
-
new FlowlayoutItem("Hello"),
|
|
66
|
-
new FlowlayoutItem("World"),
|
|
67
|
-
new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"),
|
|
68
|
-
new FlowlayoutItem("New Item"),
|
|
69
|
-
new FlowlayoutItem("Hello"),
|
|
70
|
-
new FlowlayoutItem("World"),
|
|
71
|
-
new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"),
|
|
72
|
-
new FlowlayoutItem("New Item"),
|
|
73
|
-
];
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
],
|
|
77
|
-
},
|
|
78
|
-
views: [flowlayout.definition],
|
|
79
|
-
});
|
package/test/form-dialog.ts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { formDialog } from "../components/dialogs/form-dialog";
|
|
2
|
-
|
|
3
|
-
$ui.render({
|
|
4
|
-
views: [
|
|
5
|
-
{
|
|
6
|
-
type: "button",
|
|
7
|
-
props: {
|
|
8
|
-
title: "Show Form Dialog",
|
|
9
|
-
},
|
|
10
|
-
layout: $layout.center,
|
|
11
|
-
events: {
|
|
12
|
-
tapped: async () => {
|
|
13
|
-
const values = await formDialog({
|
|
14
|
-
sections: [
|
|
15
|
-
{
|
|
16
|
-
title: "Section 1",
|
|
17
|
-
rows: [
|
|
18
|
-
{
|
|
19
|
-
type: "boolean",
|
|
20
|
-
title: "Switch",
|
|
21
|
-
key: "switch",
|
|
22
|
-
value: true,
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
type: "string",
|
|
26
|
-
title: "String",
|
|
27
|
-
key: "string",
|
|
28
|
-
value: "Hello, World!",
|
|
29
|
-
},
|
|
30
|
-
],
|
|
31
|
-
},
|
|
32
|
-
],
|
|
33
|
-
title: "Form Dialog",
|
|
34
|
-
checkHandler: (values) => {
|
|
35
|
-
console.log(values);
|
|
36
|
-
if (values.switch) return true;
|
|
37
|
-
else return false;
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
$ui.alert({
|
|
41
|
-
title: "Values",
|
|
42
|
-
message: JSON.stringify(values, null, 2),
|
|
43
|
-
});
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
],
|
|
48
|
-
});
|
package/test/oc-webview.ts
DELETED
|
@@ -1,197 +0,0 @@
|
|
|
1
|
-
import { OCWebView } from "../components/oc-webview";
|
|
2
|
-
|
|
3
|
-
const initialURL = "https://www.example.com";
|
|
4
|
-
|
|
5
|
-
const normalizeURL = (value: string) => {
|
|
6
|
-
const url = value.trim();
|
|
7
|
-
if (!url) return initialURL;
|
|
8
|
-
if (/^[a-z][a-z\d+\-.]*:\/\//i.test(url)) return url;
|
|
9
|
-
return `https://${url}`;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const currentURL = (sender: any) => {
|
|
13
|
-
const nsurl = sender.invoke("URL");
|
|
14
|
-
return nsurl ? nsurl.invoke("absoluteString").rawValue() : "";
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const currentTitle = (sender: any) => {
|
|
18
|
-
const title = sender.invoke("title");
|
|
19
|
-
return title ? title.rawValue() : "";
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const syncAddress = (sender: any) => {
|
|
23
|
-
const input = $("oc-webview-url") as UIInputView | undefined;
|
|
24
|
-
if (!input) return;
|
|
25
|
-
const url = currentURL(sender);
|
|
26
|
-
if (url) input.text = url;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const logState = (event: string, sender: any, error?: NSError | null) => {
|
|
30
|
-
const url = currentURL(sender);
|
|
31
|
-
const title = currentTitle(sender);
|
|
32
|
-
const message = error ? ` error=${error.localizedDescription}` : "";
|
|
33
|
-
console.log(`[${event}] url=${url} title=${title}${message}`);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const localStorageScript = `
|
|
37
|
-
(() => {
|
|
38
|
-
const data = {};
|
|
39
|
-
for (let i = 0; i < localStorage.length; i++) {
|
|
40
|
-
const key = localStorage.key(i);
|
|
41
|
-
if (key !== null) data[key] = localStorage.getItem(key);
|
|
42
|
-
}
|
|
43
|
-
return JSON.stringify(data);
|
|
44
|
-
})()
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
const webView = new OCWebView({
|
|
48
|
-
props: {
|
|
49
|
-
url: initialURL,
|
|
50
|
-
},
|
|
51
|
-
layout: (make, view) => {
|
|
52
|
-
make.top.equalTo($("oc-webview-toolbar").bottom);
|
|
53
|
-
make.left.right.bottom.inset(0);
|
|
54
|
-
},
|
|
55
|
-
events: {
|
|
56
|
-
didStart: (sender) => {
|
|
57
|
-
syncAddress(sender);
|
|
58
|
-
logState("didStart", sender);
|
|
59
|
-
},
|
|
60
|
-
didFinish: async (sender) => {
|
|
61
|
-
syncAddress(sender);
|
|
62
|
-
logState("didFinish", sender);
|
|
63
|
-
try {
|
|
64
|
-
const localStorage = await webView.exec<string>(localStorageScript);
|
|
65
|
-
console.log(`[localStorage] ${localStorage || "{}"}`);
|
|
66
|
-
} catch (error: any) {
|
|
67
|
-
console.log(`[localStorage] error=${error?.localizedDescription || error}`);
|
|
68
|
-
}
|
|
69
|
-
},
|
|
70
|
-
didFail: (sender, error) => {
|
|
71
|
-
syncAddress(sender);
|
|
72
|
-
logState("didFail", sender, error);
|
|
73
|
-
},
|
|
74
|
-
},
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
const loadURL = (value: string) => {
|
|
78
|
-
const url = normalizeURL(value);
|
|
79
|
-
const input = $("oc-webview-url") as UIInputView | undefined;
|
|
80
|
-
if (input) input.text = url;
|
|
81
|
-
const nsurl = $objc("NSURL").invoke("URLWithString:", url);
|
|
82
|
-
const request = $objc("NSURLRequest").invoke("requestWithURL:", nsurl);
|
|
83
|
-
webView.webView.invoke("loadRequest:", request);
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
$ui.render({
|
|
87
|
-
views: [
|
|
88
|
-
{
|
|
89
|
-
type: "view",
|
|
90
|
-
props: {
|
|
91
|
-
id: "oc-webview-toolbar",
|
|
92
|
-
},
|
|
93
|
-
layout: (make, view) => {
|
|
94
|
-
make.top.equalTo(view.super.safeAreaTop);
|
|
95
|
-
make.left.right.inset(0);
|
|
96
|
-
make.height.equalTo(88);
|
|
97
|
-
},
|
|
98
|
-
views: [
|
|
99
|
-
{
|
|
100
|
-
type: "input",
|
|
101
|
-
props: {
|
|
102
|
-
id: "oc-webview-url",
|
|
103
|
-
text: initialURL,
|
|
104
|
-
type: $kbType.url,
|
|
105
|
-
bgcolor: $color("secondarySurface"),
|
|
106
|
-
radius: 8,
|
|
107
|
-
placeholder: "输入网址后回车",
|
|
108
|
-
},
|
|
109
|
-
layout: (make, view) => {
|
|
110
|
-
make.top.inset(12);
|
|
111
|
-
make.left.right.inset(12);
|
|
112
|
-
make.height.equalTo(36);
|
|
113
|
-
},
|
|
114
|
-
events: {
|
|
115
|
-
returned: (sender) => {
|
|
116
|
-
loadURL(sender.text);
|
|
117
|
-
},
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
type: "view",
|
|
122
|
-
props: {},
|
|
123
|
-
layout: (make, view) => {
|
|
124
|
-
make.top.equalTo(view.prev.bottom).offset(8);
|
|
125
|
-
make.left.right.bottom.inset(12);
|
|
126
|
-
},
|
|
127
|
-
views: [
|
|
128
|
-
{
|
|
129
|
-
type: "button",
|
|
130
|
-
props: {
|
|
131
|
-
title: "后退",
|
|
132
|
-
},
|
|
133
|
-
layout: (make, view) => {
|
|
134
|
-
make.left.top.bottom.inset(0);
|
|
135
|
-
make.width.equalTo(72);
|
|
136
|
-
},
|
|
137
|
-
events: {
|
|
138
|
-
tapped: () => {
|
|
139
|
-
webView.goBack();
|
|
140
|
-
},
|
|
141
|
-
},
|
|
142
|
-
},
|
|
143
|
-
{
|
|
144
|
-
type: "button",
|
|
145
|
-
props: {
|
|
146
|
-
title: "前进",
|
|
147
|
-
},
|
|
148
|
-
layout: (make, view) => {
|
|
149
|
-
make.left.equalTo(view.prev.right).offset(8);
|
|
150
|
-
make.top.bottom.equalTo(view.prev);
|
|
151
|
-
make.width.equalTo(72);
|
|
152
|
-
},
|
|
153
|
-
events: {
|
|
154
|
-
tapped: () => {
|
|
155
|
-
webView.goForward();
|
|
156
|
-
},
|
|
157
|
-
},
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
type: "button",
|
|
161
|
-
props: {
|
|
162
|
-
title: "刷新",
|
|
163
|
-
},
|
|
164
|
-
layout: (make, view) => {
|
|
165
|
-
make.left.equalTo(view.prev.right).offset(8);
|
|
166
|
-
make.top.bottom.equalTo(view.prev);
|
|
167
|
-
make.width.equalTo(72);
|
|
168
|
-
},
|
|
169
|
-
events: {
|
|
170
|
-
tapped: () => {
|
|
171
|
-
webView.reload();
|
|
172
|
-
},
|
|
173
|
-
},
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
type: "button",
|
|
177
|
-
props: {
|
|
178
|
-
title: "分享",
|
|
179
|
-
},
|
|
180
|
-
layout: (make, view) => {
|
|
181
|
-
make.left.equalTo(view.prev.right).offset(8);
|
|
182
|
-
make.top.bottom.equalTo(view.prev);
|
|
183
|
-
make.width.equalTo(72);
|
|
184
|
-
},
|
|
185
|
-
events: {
|
|
186
|
-
tapped: () => {
|
|
187
|
-
$share.sheet(currentURL(webView.webView) || initialURL);
|
|
188
|
-
},
|
|
189
|
-
},
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
},
|
|
193
|
-
],
|
|
194
|
-
},
|
|
195
|
-
webView.definition,
|
|
196
|
-
],
|
|
197
|
-
});
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { PageViewerController } from "../controller/pageviewer-controller";
|
|
2
|
-
import { BaseController } from "../controller/base-controller";
|
|
3
|
-
|
|
4
|
-
const items = [
|
|
5
|
-
{
|
|
6
|
-
controller: new BaseController({ props: { bgcolor: $color("red") } }),
|
|
7
|
-
title: "Page 1",
|
|
8
|
-
},
|
|
9
|
-
{
|
|
10
|
-
controller: new BaseController({ props: { bgcolor: $color("yellow") } }),
|
|
11
|
-
title: "Page 2",
|
|
12
|
-
},
|
|
13
|
-
];
|
|
14
|
-
|
|
15
|
-
const pageViewerController = new PageViewerController({
|
|
16
|
-
props: {
|
|
17
|
-
items,
|
|
18
|
-
},
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
pageViewerController.uirender({});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { PageViewerTitleBar } from "../components/pageviewer-titlebar";
|
|
2
|
-
|
|
3
|
-
const pageViewerTitleBar = new PageViewerTitleBar({
|
|
4
|
-
props: {
|
|
5
|
-
items: ["Page 1", "Page 2", "Page 3"],
|
|
6
|
-
index: 0,
|
|
7
|
-
},
|
|
8
|
-
layout: (make, view) => {
|
|
9
|
-
make.left.right.inset(0);
|
|
10
|
-
make.top.equalTo(view.super.safeAreaTop);
|
|
11
|
-
make.height.equalTo(44);
|
|
12
|
-
},
|
|
13
|
-
events: {},
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
$ui.render({
|
|
17
|
-
views: [pageViewerTitleBar.definition],
|
|
18
|
-
});
|
package/test/pageviewer.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { PageViewer } from "../components/pageviewer";
|
|
2
|
-
import { ContentView } from "../components/single-views";
|
|
3
|
-
const pageViewer = new PageViewer({
|
|
4
|
-
props: {
|
|
5
|
-
page: 0,
|
|
6
|
-
cviews: [
|
|
7
|
-
new ContentView({
|
|
8
|
-
props: { bgcolor: $color("red") },
|
|
9
|
-
layout: $layout.fill,
|
|
10
|
-
}),
|
|
11
|
-
new ContentView({
|
|
12
|
-
props: { bgcolor: $color("green") },
|
|
13
|
-
layout: $layout.fill,
|
|
14
|
-
}),
|
|
15
|
-
new ContentView({
|
|
16
|
-
props: { bgcolor: $color("blue") },
|
|
17
|
-
layout: $layout.fill,
|
|
18
|
-
}),
|
|
19
|
-
],
|
|
20
|
-
},
|
|
21
|
-
layout: $layout.fill,
|
|
22
|
-
events: {
|
|
23
|
-
floatPageChanged: (cview, floatPage) => {
|
|
24
|
-
console.log(floatPage);
|
|
25
|
-
},
|
|
26
|
-
},
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
$ui.render({
|
|
30
|
-
views: [pageViewer.definition],
|
|
31
|
-
});
|
package/test/refresh-button.ts
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { RefreshButton } from "../components/refresh-button";
|
|
2
|
-
|
|
3
|
-
const refreshButton = new RefreshButton({
|
|
4
|
-
props: {
|
|
5
|
-
tintColor: $color("primaryText"),
|
|
6
|
-
enabled: true,
|
|
7
|
-
hidden: false,
|
|
8
|
-
},
|
|
9
|
-
layout: (make, view) => {
|
|
10
|
-
make.width.equalTo(50);
|
|
11
|
-
make.height.equalTo(50);
|
|
12
|
-
make.top.inset(100);
|
|
13
|
-
make.centerX.equalTo(view.super);
|
|
14
|
-
},
|
|
15
|
-
events: {
|
|
16
|
-
tapped: async () => {
|
|
17
|
-
refreshButton.loading = true;
|
|
18
|
-
await $wait(2);
|
|
19
|
-
refreshButton.loading = false;
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
$ui.render({
|
|
25
|
-
views: [refreshButton.definition],
|
|
26
|
-
});
|
package/test/searchbar.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { SearchBar } from "../components/searchbar";
|
|
2
|
-
|
|
3
|
-
const s0 = new SearchBar({
|
|
4
|
-
props: {
|
|
5
|
-
style: 0,
|
|
6
|
-
},
|
|
7
|
-
layout: (make, view) => {
|
|
8
|
-
make.centerX.equalTo(view.super);
|
|
9
|
-
make.size.equalTo($size(300, 44));
|
|
10
|
-
make.top.equalTo(view.super).inset(50);
|
|
11
|
-
},
|
|
12
|
-
});
|
|
13
|
-
|
|
14
|
-
const s1 = new SearchBar({
|
|
15
|
-
props: {
|
|
16
|
-
style: 1,
|
|
17
|
-
},
|
|
18
|
-
layout: (make, view) => {
|
|
19
|
-
make.centerX.equalTo(view.super);
|
|
20
|
-
make.size.equalTo($size(300, 44));
|
|
21
|
-
make.top.equalTo(view.super).inset(125);
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
const s2 = new SearchBar({
|
|
26
|
-
props: {
|
|
27
|
-
style: 2,
|
|
28
|
-
},
|
|
29
|
-
layout: (make, view) => {
|
|
30
|
-
make.centerX.equalTo(view.super);
|
|
31
|
-
make.size.equalTo($size(300, 44));
|
|
32
|
-
make.top.equalTo(view.super).inset(200);
|
|
33
|
-
},
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
$ui.render({
|
|
37
|
-
views: [s0.definition, s1.definition, s2.definition],
|
|
38
|
-
});
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { SplitViewController } from "../controller/splitview-controller";
|
|
2
|
-
import { BaseController } from "../controller/base-controller";
|
|
3
|
-
|
|
4
|
-
const items = [
|
|
5
|
-
{
|
|
6
|
-
controller: new BaseController({
|
|
7
|
-
props: { bgcolor: $color("red") },
|
|
8
|
-
events: {
|
|
9
|
-
didAppear: () => {
|
|
10
|
-
console.log("Page 1 did appear");
|
|
11
|
-
},
|
|
12
|
-
didDisappear: () => {
|
|
13
|
-
console.log("Page 1 did disappear");
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
}),
|
|
17
|
-
bgcolor: $color("red"),
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
controller: new BaseController({
|
|
21
|
-
props: { bgcolor: $color("yellow") },
|
|
22
|
-
events: {
|
|
23
|
-
didAppear: () => {
|
|
24
|
-
console.log("Page 2 did appear");
|
|
25
|
-
},
|
|
26
|
-
didDisappear: () => {
|
|
27
|
-
console.log("Page 2 did disappear");
|
|
28
|
-
},
|
|
29
|
-
},
|
|
30
|
-
}),
|
|
31
|
-
bgcolor: $color("green"),
|
|
32
|
-
},
|
|
33
|
-
];
|
|
34
|
-
|
|
35
|
-
const pageViewerController = new SplitViewController({
|
|
36
|
-
props: {
|
|
37
|
-
items,
|
|
38
|
-
},
|
|
39
|
-
events: {},
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
pageViewerController.uirender();
|