jsbox-cview 1.6.6 → 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.
Files changed (136) hide show
  1. package/README.md +4 -0
  2. package/dist/components/alert/input-alert.d.ts +22 -0
  3. package/dist/components/alert/login-alert.d.ts +21 -0
  4. package/dist/components/alert/plain-alert.d.ts +15 -0
  5. package/dist/components/alert/uialert.d.ts +29 -0
  6. package/{components/base.ts → dist/components/base.d.ts} +9 -28
  7. package/dist/components/custom-navigation-bar.d.ts +117 -0
  8. package/dist/components/dialogs/dialog-sheet.d.ts +46 -0
  9. package/dist/components/dialogs/dialog-sheet.js +3 -1
  10. package/dist/components/dialogs/form-dialog.d.ts +15 -0
  11. package/dist/components/dialogs/list-dialog.d.ts +23 -0
  12. package/dist/components/dialogs/list-dialog.js +1 -1
  13. package/dist/components/dialogs/text-dialog.d.ts +13 -0
  14. package/dist/components/dynamic-contextmenu-view.d.ts +40 -0
  15. package/dist/components/dynamic-itemsize-matrix.d.ts +79 -0
  16. package/dist/components/dynamic-itemsize-matrix.js +1 -0
  17. package/dist/components/dynamic-itemsize-section-matrix.d.ts +115 -0
  18. package/dist/components/dynamic-preference-listview.d.ts +63 -0
  19. package/dist/components/dynamic-rowheight-list.d.ts +38 -0
  20. package/dist/components/enhanced-imageview.d.ts +41 -0
  21. package/dist/components/flowlayout.d.ts +63 -0
  22. package/dist/components/image-pager.d.ts +49 -0
  23. package/dist/components/oc-webview.d.ts +64 -0
  24. package/dist/components/page-control.d.ts +45 -0
  25. package/dist/components/pageviewer-titlebar.d.ts +48 -0
  26. package/dist/components/pageviewer.d.ts +41 -0
  27. package/dist/components/refresh-button.d.ts +25 -0
  28. package/dist/components/rotating-view.d.ts +45 -0
  29. package/dist/components/searchbar.d.ts +118 -0
  30. package/dist/components/sheet.d.ts +42 -0
  31. package/dist/components/single-views.d.ts +289 -0
  32. package/dist/components/spinners/loading-dual-ring.d.ts +18 -0
  33. package/dist/components/spinners/loading-wedges.d.ts +15 -0
  34. package/dist/components/spinners/spinner-androidstyle.d.ts +30 -0
  35. package/dist/components/static-preference-listview.d.ts +389 -0
  36. package/dist/components/symbol-button.d.ts +39 -0
  37. package/dist/components/tabbar.d.ts +140 -0
  38. package/dist/controller/base-controller.d.ts +125 -0
  39. package/dist/controller/base-controller.js +11 -11
  40. package/dist/controller/controller-router.d.ts +48 -0
  41. package/dist/controller/pageviewer-controller.d.ts +38 -0
  42. package/dist/controller/presented-page-controller.d.ts +41 -0
  43. package/dist/controller/splitview-controller.d.ts +90 -0
  44. package/dist/controller/splitview-controller.js +4 -0
  45. package/dist/controller/tabbar-controller.d.ts +49 -0
  46. package/dist/controller/tabbar-controller.js +0 -2
  47. package/{index.ts → dist/index.d.ts} +1 -0
  48. package/dist/index.js +1 -0
  49. package/dist/utils/colors.d.ts +7 -0
  50. package/dist/utils/cvid.d.ts +11 -0
  51. package/dist/utils/l10n.d.ts +1 -0
  52. package/dist/utils/path.d.ts +8 -0
  53. package/dist/utils/rect.d.ts +38 -0
  54. package/dist/utils/uitools.d.ts +75 -0
  55. package/package.json +20 -6
  56. package/.prettierignore +0 -6
  57. package/.prettierrc +0 -3
  58. package/components/alert/input-alert.ts +0 -64
  59. package/components/alert/login-alert.ts +0 -66
  60. package/components/alert/plain-alert.ts +0 -39
  61. package/components/alert/uialert.ts +0 -107
  62. package/components/custom-navigation-bar.ts +0 -579
  63. package/components/dialogs/dialog-sheet.ts +0 -111
  64. package/components/dialogs/form-dialog.ts +0 -63
  65. package/components/dialogs/list-dialog.ts +0 -119
  66. package/components/dialogs/text-dialog.ts +0 -44
  67. package/components/dynamic-contextmenu-view.ts +0 -115
  68. package/components/dynamic-itemsize-matrix.ts +0 -206
  69. package/components/dynamic-itemsize-section-matrix.ts +0 -363
  70. package/components/dynamic-preference-listview.ts +0 -684
  71. package/components/dynamic-rowheight-list.ts +0 -77
  72. package/components/enhanced-imageview.ts +0 -132
  73. package/components/flowlayout.ts +0 -248
  74. package/components/image-pager.ts +0 -180
  75. package/components/oc-webview.ts +0 -177
  76. package/components/page-control.ts +0 -93
  77. package/components/pageviewer-titlebar.ts +0 -166
  78. package/components/pageviewer.ts +0 -125
  79. package/components/refresh-button.ts +0 -83
  80. package/components/rotating-view.ts +0 -133
  81. package/components/searchbar.ts +0 -398
  82. package/components/sheet.ts +0 -104
  83. package/components/single-views.ts +0 -956
  84. package/components/spinners/loading-dual-ring.ts +0 -97
  85. package/components/spinners/loading-wedges.ts +0 -106
  86. package/components/spinners/spinner-androidstyle.ts +0 -269
  87. package/components/static-preference-listview.ts +0 -1282
  88. package/components/symbol-button.ts +0 -108
  89. package/components/tabbar.ts +0 -453
  90. package/controller/base-controller.ts +0 -214
  91. package/controller/controller-router.ts +0 -73
  92. package/controller/pageviewer-controller.ts +0 -93
  93. package/controller/presented-page-controller.ts +0 -76
  94. package/controller/splitview-controller.ts +0 -359
  95. package/controller/tabbar-controller.ts +0 -131
  96. package/dist/test/custom-navigation-bar.js +0 -40
  97. package/dist/test/dialog-sheet.js +0 -40
  98. package/dist/test/dynamic-contextmenu-view.js +0 -66
  99. package/dist/test/dynamic-itemsize-matrix.js +0 -74
  100. package/dist/test/dynamic-itemsize-section-matrix.js +0 -138
  101. package/dist/test/dynamic-preference-listview.js +0 -150
  102. package/dist/test/flowlayout.js +0 -76
  103. package/dist/test/form-dialog.js +0 -51
  104. package/dist/test/oc-webview.js +0 -195
  105. package/dist/test/pageviewer-controller.js +0 -20
  106. package/dist/test/pageviewer-titlebar.js +0 -18
  107. package/dist/test/pageviewer.js +0 -32
  108. package/dist/test/refresh-button.js +0 -26
  109. package/dist/test/searchbar.js +0 -36
  110. package/dist/test/splitview-controller.js +0 -41
  111. package/dist/test/static-preference-listview.js +0 -143
  112. package/dist/test/tabbar-controller.js +0 -48
  113. package/test/custom-navigation-bar.ts +0 -40
  114. package/test/dialog-sheet.ts +0 -40
  115. package/test/dynamic-contextmenu-view.ts +0 -67
  116. package/test/dynamic-itemsize-matrix.ts +0 -74
  117. package/test/dynamic-itemsize-section-matrix.ts +0 -142
  118. package/test/dynamic-preference-listview.ts +0 -151
  119. package/test/flowlayout.ts +0 -79
  120. package/test/form-dialog.ts +0 -48
  121. package/test/oc-webview.ts +0 -197
  122. package/test/pageviewer-controller.ts +0 -21
  123. package/test/pageviewer-titlebar.ts +0 -18
  124. package/test/pageviewer.ts +0 -31
  125. package/test/refresh-button.ts +0 -26
  126. package/test/searchbar.ts +0 -38
  127. package/test/splitview-controller.ts +0 -42
  128. package/test/static-preference-listview.ts +0 -142
  129. package/test/tabbar-controller.ts +0 -49
  130. package/tsconfig.json +0 -122
  131. package/utils/colors.ts +0 -17
  132. package/utils/cvid.ts +0 -32
  133. package/utils/l10n.ts +0 -42
  134. package/utils/path.ts +0 -97
  135. package/utils/rect.ts +0 -90
  136. package/utils/uitools.ts +0 -122
@@ -1,138 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const dynamic_itemsize_section_matrix_1 = require("../components/dynamic-itemsize-section-matrix");
4
- const makeItem = (sectionName, index) => {
5
- return {
6
- symbol: { symbol: index % 2 === 0 ? "sparkles" : "square.grid.2x2" },
7
- title: { text: `${sectionName} ${index}` },
8
- subtitle: { text: `Item index ${index}` },
9
- badge: { text: `${index}` },
10
- };
11
- };
12
- const sections = [
13
- {
14
- title: "Pinned",
15
- items: [makeItem("Pinned", 1), makeItem("Pinned", 2), makeItem("Pinned", 3)],
16
- },
17
- {
18
- title: "Long Section Title To Verify The Custom Title Cell Uses Dynamic Height\nLine 2\nLine 3",
19
- items: [makeItem("Recent", 1), makeItem("Recent", 2), makeItem("Recent", 3), makeItem("Recent", 4)],
20
- },
21
- {
22
- title: "",
23
- items: [makeItem("Untitled", 1), makeItem("Untitled", 2)],
24
- },
25
- ];
26
- const matrix = new dynamic_itemsize_section_matrix_1.DynamicItemSizeSectionMatrix({
27
- props: {
28
- spacing: 8,
29
- minItemWidth: $device.isIpad ? 180 : 142,
30
- maxColumns: $device.isIpad ? 4 : 2,
31
- data: sections,
32
- template: {
33
- views: [
34
- {
35
- type: "view",
36
- props: {
37
- bgcolor: $color("yellow"),
38
- cornerRadius: 8,
39
- },
40
- layout: $layout.fill,
41
- views: [
42
- {
43
- type: "image",
44
- props: {
45
- id: "symbol",
46
- contentMode: $contentMode.scaleAspectFit,
47
- tintColor: $color("tint"),
48
- },
49
- layout: (make, view) => {
50
- make.left.top.inset(12);
51
- make.size.equalTo($size(32, 32));
52
- },
53
- },
54
- {
55
- type: "label",
56
- props: {
57
- id: "badge",
58
- align: $align.center,
59
- font: $font(12),
60
- textColor: $color("white"),
61
- bgcolor: $color("tint"),
62
- cornerRadius: 10,
63
- },
64
- layout: (make, view) => {
65
- make.top.right.inset(12);
66
- make.size.equalTo($size(28, 20));
67
- },
68
- },
69
- {
70
- type: "label",
71
- props: {
72
- id: "title",
73
- font: $font("bold", 15),
74
- textColor: $color("primaryText"),
75
- },
76
- layout: (make, view) => {
77
- make.left.right.inset(12);
78
- make.top.equalTo(view.prev.prev.bottom).offset(10);
79
- make.height.equalTo(20);
80
- },
81
- },
82
- {
83
- type: "label",
84
- props: {
85
- id: "subtitle",
86
- font: $font(12),
87
- textColor: $color("secondaryText"),
88
- },
89
- layout: (make, view) => {
90
- make.left.right.inset(12);
91
- make.top.equalTo(view.prev.bottom).offset(4);
92
- make.bottom.inset(12);
93
- },
94
- },
95
- ],
96
- },
97
- ],
98
- },
99
- },
100
- layout: $layout.fill,
101
- events: {
102
- itemHeight: (width) => Math.max(112, width * 0.72),
103
- didSelect: (sender, indexPath, data) => {
104
- const section = matrix.data[indexPath.section];
105
- const title = data.title.text;
106
- $ui.toast(`${section.title || "Untitled"} / ${title}`);
107
- },
108
- didLongPress: (sender, indexPath, data) => {
109
- const title = data.title.text;
110
- $ui.alert(`Long pressed ${title}`);
111
- },
112
- },
113
- });
114
- $ui.render({
115
- props: {
116
- navButtons: [
117
- {
118
- symbol: "plus",
119
- handler: () => {
120
- const nextIndex = matrix.data[0].items.length + 1;
121
- matrix.insert({
122
- indexPath: $indexPath(0, matrix.data[0].items.length),
123
- value: makeItem("Pinned", nextIndex),
124
- });
125
- },
126
- },
127
- {
128
- symbol: "trash",
129
- handler: () => {
130
- if (matrix.data[0].items.length === 0)
131
- return;
132
- matrix.delete($indexPath(0, matrix.data[0].items.length - 1));
133
- },
134
- },
135
- ],
136
- },
137
- views: [matrix.definition],
138
- });
@@ -1,150 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const dynamic_preference_listview_1 = require("../components/dynamic-preference-listview");
4
- const sections = [
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 dynamic_preference_listview_1.DynamicPreferenceListView({
106
- props: {
107
- data: [],
108
- //symbolSizeForSymbolAction: $size(40, 40)
109
- },
110
- sections: sections,
111
- layout: $layout.fill,
112
- events: {
113
- changed: (values) => {
114
- console.info(values);
115
- console.info(values.date);
116
- },
117
- },
118
- });
119
- $ui.render({
120
- props: {
121
- title: "",
122
- navButtons: [
123
- {
124
- symbol: "plus",
125
- handler: () => {
126
- sections.push({
127
- title: "Section " + (sections.length + 1),
128
- rows: [
129
- {
130
- type: "interactive-info",
131
- title: "interactive-info",
132
- key: "interactive-info",
133
- value: "测试一号测试二号测试三号测试四号测试五号测试六号",
134
- },
135
- {
136
- type: "interactive-info",
137
- title: "interactive-info2",
138
- key: "interactive-info2",
139
- value: "测试一号测试二号测试三号测试四号测试五号测试六号",
140
- copyable: true,
141
- },
142
- ],
143
- });
144
- v.sections = sections;
145
- },
146
- },
147
- ],
148
- },
149
- views: [v.definition],
150
- });
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const flowlayout_1 = require("../components/flowlayout");
4
- const single_views_1 = require("../components/single-views");
5
- class FlowlayoutItem extends single_views_1.Label {
6
- constructor(text) {
7
- super({
8
- props: {
9
- text: text,
10
- borderWidth: 1,
11
- },
12
- layout: $layout.fill,
13
- });
14
- this._text = text;
15
- }
16
- itemWidth() {
17
- return this._text.length * 10;
18
- }
19
- }
20
- const flowlayout = new flowlayout_1.Flowlayout({
21
- props: {
22
- items: [new FlowlayoutItem("Hello"), new FlowlayoutItem("World"), new FlowlayoutItem("Flowlayout")],
23
- spacing: 10,
24
- itemHeight: 30,
25
- fixedRows: 2,
26
- fixedHeight: true,
27
- menu: {
28
- items: [
29
- {
30
- symbol: "plus",
31
- handler: (sender) => console.log("here"),
32
- },
33
- ],
34
- },
35
- },
36
- layout: (make, view) => {
37
- make.left.right.inset(10);
38
- make.top.inset(100);
39
- make.height.equalTo(70);
40
- },
41
- events: {
42
- didSelect: (sender, index, item) => {
43
- $ui.alert(item.view.text);
44
- },
45
- },
46
- });
47
- $ui.render({
48
- props: {
49
- navButtons: [
50
- {
51
- symbol: "plus",
52
- handler: () => {
53
- flowlayout.items = [
54
- new FlowlayoutItem("Hello"),
55
- new FlowlayoutItem("World"),
56
- new FlowlayoutItem("Flowlayout"),
57
- new FlowlayoutItem("New Item"),
58
- new FlowlayoutItem("Hello"),
59
- new FlowlayoutItem("World"),
60
- new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayout"),
61
- new FlowlayoutItem("New Item"),
62
- new FlowlayoutItem("Hello"),
63
- new FlowlayoutItem("World"),
64
- new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"),
65
- new FlowlayoutItem("New Item"),
66
- new FlowlayoutItem("Hello"),
67
- new FlowlayoutItem("World"),
68
- new FlowlayoutItem("FlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayoutFlowlayout"),
69
- new FlowlayoutItem("New Item"),
70
- ];
71
- },
72
- },
73
- ],
74
- },
75
- views: [flowlayout.definition],
76
- });
@@ -1,51 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const form_dialog_1 = require("../components/dialogs/form-dialog");
4
- $ui.render({
5
- views: [
6
- {
7
- type: "button",
8
- props: {
9
- title: "Show Form Dialog",
10
- },
11
- layout: $layout.center,
12
- events: {
13
- tapped: async () => {
14
- const values = await (0, form_dialog_1.formDialog)({
15
- sections: [
16
- {
17
- title: "Section 1",
18
- rows: [
19
- {
20
- type: "boolean",
21
- title: "Switch",
22
- key: "switch",
23
- value: true,
24
- },
25
- {
26
- type: "string",
27
- title: "String",
28
- key: "string",
29
- value: "Hello, World!",
30
- },
31
- ],
32
- },
33
- ],
34
- title: "Form Dialog",
35
- checkHandler: (values) => {
36
- console.log(values);
37
- if (values.switch)
38
- return true;
39
- else
40
- return false;
41
- },
42
- });
43
- $ui.alert({
44
- title: "Values",
45
- message: JSON.stringify(values, null, 2),
46
- });
47
- },
48
- },
49
- },
50
- ],
51
- });
@@ -1,195 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const oc_webview_1 = require("../components/oc-webview");
4
- const initialURL = "https://www.example.com";
5
- const normalizeURL = (value) => {
6
- const url = value.trim();
7
- if (!url)
8
- return initialURL;
9
- if (/^[a-z][a-z\d+\-.]*:\/\//i.test(url))
10
- return url;
11
- return `https://${url}`;
12
- };
13
- const currentURL = (sender) => {
14
- const nsurl = sender.invoke("URL");
15
- return nsurl ? nsurl.invoke("absoluteString").rawValue() : "";
16
- };
17
- const currentTitle = (sender) => {
18
- const title = sender.invoke("title");
19
- return title ? title.rawValue() : "";
20
- };
21
- const syncAddress = (sender) => {
22
- const input = $("oc-webview-url");
23
- if (!input)
24
- return;
25
- const url = currentURL(sender);
26
- if (url)
27
- input.text = url;
28
- };
29
- const logState = (event, sender, error) => {
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
- const localStorageScript = `
36
- (() => {
37
- const data = {};
38
- for (let i = 0; i < localStorage.length; i++) {
39
- const key = localStorage.key(i);
40
- if (key !== null) data[key] = localStorage.getItem(key);
41
- }
42
- return JSON.stringify(data);
43
- })()
44
- `;
45
- const webView = new oc_webview_1.OCWebView({
46
- props: {
47
- url: initialURL,
48
- },
49
- layout: (make, view) => {
50
- make.top.equalTo($("oc-webview-toolbar").bottom);
51
- make.left.right.bottom.inset(0);
52
- },
53
- events: {
54
- didStart: (sender) => {
55
- syncAddress(sender);
56
- logState("didStart", sender);
57
- },
58
- didFinish: async (sender) => {
59
- syncAddress(sender);
60
- logState("didFinish", sender);
61
- try {
62
- const localStorage = await webView.exec(localStorageScript);
63
- console.log(`[localStorage] ${localStorage || "{}"}`);
64
- }
65
- catch (error) {
66
- console.log(`[localStorage] error=${error?.localizedDescription || error}`);
67
- }
68
- },
69
- didFail: (sender, error) => {
70
- syncAddress(sender);
71
- logState("didFail", sender, error);
72
- },
73
- },
74
- });
75
- const loadURL = (value) => {
76
- const url = normalizeURL(value);
77
- const input = $("oc-webview-url");
78
- if (input)
79
- input.text = url;
80
- const nsurl = $objc("NSURL").invoke("URLWithString:", url);
81
- const request = $objc("NSURLRequest").invoke("requestWithURL:", nsurl);
82
- webView.webView.invoke("loadRequest:", request);
83
- };
84
- $ui.render({
85
- views: [
86
- {
87
- type: "view",
88
- props: {
89
- id: "oc-webview-toolbar",
90
- },
91
- layout: (make, view) => {
92
- make.top.equalTo(view.super.safeAreaTop);
93
- make.left.right.inset(0);
94
- make.height.equalTo(88);
95
- },
96
- views: [
97
- {
98
- type: "input",
99
- props: {
100
- id: "oc-webview-url",
101
- text: initialURL,
102
- type: $kbType.url,
103
- bgcolor: $color("secondarySurface"),
104
- radius: 8,
105
- placeholder: "输入网址后回车",
106
- },
107
- layout: (make, view) => {
108
- make.top.inset(12);
109
- make.left.right.inset(12);
110
- make.height.equalTo(36);
111
- },
112
- events: {
113
- returned: (sender) => {
114
- loadURL(sender.text);
115
- },
116
- },
117
- },
118
- {
119
- type: "view",
120
- props: {},
121
- layout: (make, view) => {
122
- make.top.equalTo(view.prev.bottom).offset(8);
123
- make.left.right.bottom.inset(12);
124
- },
125
- views: [
126
- {
127
- type: "button",
128
- props: {
129
- title: "后退",
130
- },
131
- layout: (make, view) => {
132
- make.left.top.bottom.inset(0);
133
- make.width.equalTo(72);
134
- },
135
- events: {
136
- tapped: () => {
137
- webView.goBack();
138
- },
139
- },
140
- },
141
- {
142
- type: "button",
143
- props: {
144
- title: "前进",
145
- },
146
- layout: (make, view) => {
147
- make.left.equalTo(view.prev.right).offset(8);
148
- make.top.bottom.equalTo(view.prev);
149
- make.width.equalTo(72);
150
- },
151
- events: {
152
- tapped: () => {
153
- webView.goForward();
154
- },
155
- },
156
- },
157
- {
158
- type: "button",
159
- props: {
160
- title: "刷新",
161
- },
162
- layout: (make, view) => {
163
- make.left.equalTo(view.prev.right).offset(8);
164
- make.top.bottom.equalTo(view.prev);
165
- make.width.equalTo(72);
166
- },
167
- events: {
168
- tapped: () => {
169
- webView.reload();
170
- },
171
- },
172
- },
173
- {
174
- type: "button",
175
- props: {
176
- title: "分享",
177
- },
178
- layout: (make, view) => {
179
- make.left.equalTo(view.prev.right).offset(8);
180
- make.top.bottom.equalTo(view.prev);
181
- make.width.equalTo(72);
182
- },
183
- events: {
184
- tapped: () => {
185
- $share.sheet(currentURL(webView.webView) || initialURL);
186
- },
187
- },
188
- },
189
- ],
190
- },
191
- ],
192
- },
193
- webView.definition,
194
- ],
195
- });
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const pageviewer_controller_1 = require("../controller/pageviewer-controller");
4
- const base_controller_1 = require("../controller/base-controller");
5
- const items = [
6
- {
7
- controller: new base_controller_1.BaseController({ props: { bgcolor: $color("red") } }),
8
- title: "Page 1",
9
- },
10
- {
11
- controller: new base_controller_1.BaseController({ props: { bgcolor: $color("yellow") } }),
12
- title: "Page 2",
13
- },
14
- ];
15
- const pageViewerController = new pageviewer_controller_1.PageViewerController({
16
- props: {
17
- items,
18
- },
19
- });
20
- pageViewerController.uirender({});
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const pageviewer_titlebar_1 = require("../components/pageviewer-titlebar");
4
- const pageViewerTitleBar = new pageviewer_titlebar_1.PageViewerTitleBar({
5
- props: {
6
- items: ["Page 1", "Page 2", "Page 3"],
7
- index: 0,
8
- },
9
- layout: (make, view) => {
10
- make.left.right.inset(0);
11
- make.top.equalTo(view.super.safeAreaTop);
12
- make.height.equalTo(44);
13
- },
14
- events: {},
15
- });
16
- $ui.render({
17
- views: [pageViewerTitleBar.definition],
18
- });
@@ -1,32 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const pageviewer_1 = require("../components/pageviewer");
4
- const single_views_1 = require("../components/single-views");
5
- const pageViewer = new pageviewer_1.PageViewer({
6
- props: {
7
- page: 0,
8
- cviews: [
9
- new single_views_1.ContentView({
10
- props: { bgcolor: $color("red") },
11
- layout: $layout.fill,
12
- }),
13
- new single_views_1.ContentView({
14
- props: { bgcolor: $color("green") },
15
- layout: $layout.fill,
16
- }),
17
- new single_views_1.ContentView({
18
- props: { bgcolor: $color("blue") },
19
- layout: $layout.fill,
20
- }),
21
- ],
22
- },
23
- layout: $layout.fill,
24
- events: {
25
- floatPageChanged: (cview, floatPage) => {
26
- console.log(floatPage);
27
- },
28
- },
29
- });
30
- $ui.render({
31
- views: [pageViewer.definition],
32
- });