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,26 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const refresh_button_1 = require("../components/refresh-button");
|
|
4
|
-
const refreshButton = new refresh_button_1.RefreshButton({
|
|
5
|
-
props: {
|
|
6
|
-
tintColor: $color("primaryText"),
|
|
7
|
-
enabled: true,
|
|
8
|
-
hidden: false,
|
|
9
|
-
},
|
|
10
|
-
layout: (make, view) => {
|
|
11
|
-
make.width.equalTo(50);
|
|
12
|
-
make.height.equalTo(50);
|
|
13
|
-
make.top.inset(100);
|
|
14
|
-
make.centerX.equalTo(view.super);
|
|
15
|
-
},
|
|
16
|
-
events: {
|
|
17
|
-
tapped: async () => {
|
|
18
|
-
refreshButton.loading = true;
|
|
19
|
-
await $wait(2);
|
|
20
|
-
refreshButton.loading = false;
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
});
|
|
24
|
-
$ui.render({
|
|
25
|
-
views: [refreshButton.definition],
|
|
26
|
-
});
|
package/dist/test/searchbar.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const searchbar_1 = require("../components/searchbar");
|
|
4
|
-
const s0 = new searchbar_1.SearchBar({
|
|
5
|
-
props: {
|
|
6
|
-
style: 0,
|
|
7
|
-
},
|
|
8
|
-
layout: (make, view) => {
|
|
9
|
-
make.centerX.equalTo(view.super);
|
|
10
|
-
make.size.equalTo($size(300, 44));
|
|
11
|
-
make.top.equalTo(view.super).inset(50);
|
|
12
|
-
},
|
|
13
|
-
});
|
|
14
|
-
const s1 = new searchbar_1.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
|
-
const s2 = new searchbar_1.SearchBar({
|
|
25
|
-
props: {
|
|
26
|
-
style: 2,
|
|
27
|
-
},
|
|
28
|
-
layout: (make, view) => {
|
|
29
|
-
make.centerX.equalTo(view.super);
|
|
30
|
-
make.size.equalTo($size(300, 44));
|
|
31
|
-
make.top.equalTo(view.super).inset(200);
|
|
32
|
-
},
|
|
33
|
-
});
|
|
34
|
-
$ui.render({
|
|
35
|
-
views: [s0.definition, s1.definition, s2.definition],
|
|
36
|
-
});
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const splitview_controller_1 = require("../controller/splitview-controller");
|
|
4
|
-
const base_controller_1 = require("../controller/base-controller");
|
|
5
|
-
const items = [
|
|
6
|
-
{
|
|
7
|
-
controller: new base_controller_1.BaseController({
|
|
8
|
-
props: { bgcolor: $color("red") },
|
|
9
|
-
events: {
|
|
10
|
-
didAppear: () => {
|
|
11
|
-
console.log("Page 1 did appear");
|
|
12
|
-
},
|
|
13
|
-
didDisappear: () => {
|
|
14
|
-
console.log("Page 1 did disappear");
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}),
|
|
18
|
-
bgcolor: $color("red"),
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
controller: new base_controller_1.BaseController({
|
|
22
|
-
props: { bgcolor: $color("yellow") },
|
|
23
|
-
events: {
|
|
24
|
-
didAppear: () => {
|
|
25
|
-
console.log("Page 2 did appear");
|
|
26
|
-
},
|
|
27
|
-
didDisappear: () => {
|
|
28
|
-
console.log("Page 2 did disappear");
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
bgcolor: $color("green"),
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
const pageViewerController = new splitview_controller_1.SplitViewController({
|
|
36
|
-
props: {
|
|
37
|
-
items,
|
|
38
|
-
},
|
|
39
|
-
events: {},
|
|
40
|
-
});
|
|
41
|
-
pageViewerController.uirender();
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const static_preference_listview_1 = require("../components/static-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: 100,
|
|
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
|
-
//value: new Date()
|
|
73
|
-
mode: 1,
|
|
74
|
-
},
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
title: "Section 3",
|
|
79
|
-
rows: [
|
|
80
|
-
{
|
|
81
|
-
type: "info",
|
|
82
|
-
title: "info",
|
|
83
|
-
value: "this is info",
|
|
84
|
-
},
|
|
85
|
-
{
|
|
86
|
-
type: "link",
|
|
87
|
-
title: "link",
|
|
88
|
-
value: "https://apple.com",
|
|
89
|
-
},
|
|
90
|
-
{
|
|
91
|
-
type: "symbol-action",
|
|
92
|
-
title: "种类1",
|
|
93
|
-
symbol: "checkmark",
|
|
94
|
-
tintColor: $color("systemLink"),
|
|
95
|
-
titleColor: $color("systemLink"),
|
|
96
|
-
value: () => console.info(0),
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
type: "action",
|
|
100
|
-
title: "action",
|
|
101
|
-
value: () => console.info(0),
|
|
102
|
-
},
|
|
103
|
-
],
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
title: "Section 4",
|
|
107
|
-
rows: [
|
|
108
|
-
{
|
|
109
|
-
type: "interactive-info",
|
|
110
|
-
title: "interactive-info",
|
|
111
|
-
key: "interactive-info",
|
|
112
|
-
value: "测试一号测试二号测试三号测试四号测试五号测试六号",
|
|
113
|
-
},
|
|
114
|
-
{
|
|
115
|
-
type: "interactive-info",
|
|
116
|
-
title: "interactive-info2",
|
|
117
|
-
key: "interactive-info2",
|
|
118
|
-
value: "测试一号测试二号测试三号测试四号测试五号测试六号",
|
|
119
|
-
copyable: true,
|
|
120
|
-
},
|
|
121
|
-
],
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
const v = new static_preference_listview_1.PreferenceListView({
|
|
125
|
-
props: { data: [] },
|
|
126
|
-
sections: sections,
|
|
127
|
-
layout: $layout.fill,
|
|
128
|
-
events: {
|
|
129
|
-
changed: (values) => console.info(values),
|
|
130
|
-
},
|
|
131
|
-
});
|
|
132
|
-
$ui.render({
|
|
133
|
-
props: {
|
|
134
|
-
title: "",
|
|
135
|
-
navButtons: [
|
|
136
|
-
{
|
|
137
|
-
symbol: "plus",
|
|
138
|
-
handler: () => { },
|
|
139
|
-
},
|
|
140
|
-
],
|
|
141
|
-
},
|
|
142
|
-
views: [v.definition],
|
|
143
|
-
});
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tabbar_controller_1 = require("../controller/tabbar-controller");
|
|
4
|
-
const base_controller_1 = require("../controller/base-controller");
|
|
5
|
-
const items = [
|
|
6
|
-
{
|
|
7
|
-
controller: new base_controller_1.BaseController({
|
|
8
|
-
props: { bgcolor: $color("red") },
|
|
9
|
-
events: {
|
|
10
|
-
didAppear: () => {
|
|
11
|
-
console.log("Page 1 did appear");
|
|
12
|
-
},
|
|
13
|
-
didDisappear: () => {
|
|
14
|
-
console.log("Page 1 did disappear");
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
}),
|
|
18
|
-
title: "Page 1",
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
controller: new base_controller_1.BaseController({
|
|
22
|
-
props: { bgcolor: $color("yellow") },
|
|
23
|
-
events: {
|
|
24
|
-
didAppear: () => {
|
|
25
|
-
console.log("Page 2 did appear");
|
|
26
|
-
},
|
|
27
|
-
didDisappear: () => {
|
|
28
|
-
console.log("Page 2 did disappear");
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
}),
|
|
32
|
-
title: "Page 2",
|
|
33
|
-
},
|
|
34
|
-
];
|
|
35
|
-
const pageViewerController = new tabbar_controller_1.TabBarController({
|
|
36
|
-
props: {
|
|
37
|
-
items,
|
|
38
|
-
},
|
|
39
|
-
events: {
|
|
40
|
-
changed: (sender, index) => {
|
|
41
|
-
console.log(`Index changed to ${index}`);
|
|
42
|
-
},
|
|
43
|
-
doubleTapped: (sender, index) => {
|
|
44
|
-
console.log(`Double tapped on index ${index}`);
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
pageViewerController.uirender({});
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { CustomNavigationBar } from "../components/custom-navigation-bar";
|
|
2
|
-
|
|
3
|
-
const navbar = new CustomNavigationBar({
|
|
4
|
-
props: {
|
|
5
|
-
title: "Custom Navigation Bar",
|
|
6
|
-
popButtonEnabled: true,
|
|
7
|
-
popButtonTitle: "Back",
|
|
8
|
-
rightBarButtonItems: [
|
|
9
|
-
{
|
|
10
|
-
symbol: "gear",
|
|
11
|
-
handler: (sender) => console.log(sender),
|
|
12
|
-
},
|
|
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
|
-
});
|
package/test/dialog-sheet.ts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { DialogSheet } from "../components/dialogs/dialog-sheet";
|
|
2
|
-
import { ContentView } from "../components/single-views";
|
|
3
|
-
|
|
4
|
-
const cview = new ContentView({
|
|
5
|
-
props: {
|
|
6
|
-
bgcolor: $color("lightGray"),
|
|
7
|
-
},
|
|
8
|
-
layout: $layout.fill,
|
|
9
|
-
});
|
|
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 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,67 +0,0 @@
|
|
|
1
|
-
import { DynamicContextMenuView } from "../components/dynamic-contextmenu-view";
|
|
2
|
-
|
|
3
|
-
let menuIndex = 0;
|
|
4
|
-
const menuList = [
|
|
5
|
-
{
|
|
6
|
-
title: "菜单1",
|
|
7
|
-
items: [
|
|
8
|
-
{
|
|
9
|
-
title: "变成菜单1",
|
|
10
|
-
symbol: "plus",
|
|
11
|
-
handler: () => {
|
|
12
|
-
menuIndex = 0;
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
{
|
|
16
|
-
title: "变成菜单2",
|
|
17
|
-
symbol: "plus",
|
|
18
|
-
destructive: true,
|
|
19
|
-
handler: () => {
|
|
20
|
-
menuIndex = 1;
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
|
-
],
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
items: [
|
|
27
|
-
{
|
|
28
|
-
title: "变成菜单1",
|
|
29
|
-
handler: () => {
|
|
30
|
-
menuIndex = 0;
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
{
|
|
34
|
-
title: "变成菜单2",
|
|
35
|
-
handler: () => {
|
|
36
|
-
menuIndex = 1;
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
],
|
|
40
|
-
},
|
|
41
|
-
];
|
|
42
|
-
|
|
43
|
-
const view = new 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
|
-
|
|
65
|
-
$ui.render({
|
|
66
|
-
views: [view.definition],
|
|
67
|
-
});
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { DynamicItemSizeMatrix } from "../components/dynamic-itemsize-matrix";
|
|
2
|
-
|
|
3
|
-
const matrix = new DynamicItemSizeMatrix({
|
|
4
|
-
props: {
|
|
5
|
-
spacing: 5,
|
|
6
|
-
minItemWidth: $device.isIpad ? 140 : 118,
|
|
7
|
-
maxColumns: 10,
|
|
8
|
-
template: {
|
|
9
|
-
views: [
|
|
10
|
-
{
|
|
11
|
-
type: "label",
|
|
12
|
-
props: {
|
|
13
|
-
id: "label",
|
|
14
|
-
align: $align.center,
|
|
15
|
-
font: $font(13),
|
|
16
|
-
},
|
|
17
|
-
layout: (make, view) => {
|
|
18
|
-
make.left.right.bottom.inset(0);
|
|
19
|
-
make.height.equalTo(20);
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
type: "image",
|
|
24
|
-
props: {
|
|
25
|
-
symbol: "sun.dust",
|
|
26
|
-
bgcolor: $color("backgroundColor", "secondarySurface"),
|
|
27
|
-
contentMode: $contentMode.scaleAspectFit,
|
|
28
|
-
},
|
|
29
|
-
layout: (make, view) => {
|
|
30
|
-
make.top.left.right.equalTo(0);
|
|
31
|
-
make.bottom.equalTo(view.prev.top);
|
|
32
|
-
},
|
|
33
|
-
},
|
|
34
|
-
],
|
|
35
|
-
},
|
|
36
|
-
data: [...Array(100)].map((n, i) => {
|
|
37
|
-
return {
|
|
38
|
-
label: { text: i + 1 },
|
|
39
|
-
};
|
|
40
|
-
}),
|
|
41
|
-
footer: {
|
|
42
|
-
type: "view",
|
|
43
|
-
props: {
|
|
44
|
-
height: 20,
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
},
|
|
48
|
-
layout: (make, view) => {
|
|
49
|
-
make.left.right.equalTo(view.super.safeArea);
|
|
50
|
-
make.top.bottom.equalTo(view.super);
|
|
51
|
-
},
|
|
52
|
-
events: {
|
|
53
|
-
itemHeight: (width) => width * 1.414 + 20,
|
|
54
|
-
didSelect: (sender, indexPath, data) => {},
|
|
55
|
-
didScroll: (sender) => {
|
|
56
|
-
matrix.columns;
|
|
57
|
-
console.log(sender.contentOffset.y);
|
|
58
|
-
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)));
|
|
59
|
-
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)) * matrix.columns);
|
|
60
|
-
},
|
|
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
|
-
});
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
DynamicItemSizeSectionMatrix,
|
|
3
|
-
DynamicItemSizeSectionMatrixSection,
|
|
4
|
-
} from "../components/dynamic-itemsize-section-matrix";
|
|
5
|
-
|
|
6
|
-
const makeItem = (sectionName: string, index: number) => {
|
|
7
|
-
return {
|
|
8
|
-
symbol: { symbol: index % 2 === 0 ? "sparkles" : "square.grid.2x2" },
|
|
9
|
-
title: { text: `${sectionName} ${index}` },
|
|
10
|
-
subtitle: { text: `Item index ${index}` },
|
|
11
|
-
badge: { text: `${index}` },
|
|
12
|
-
};
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const sections: DynamicItemSizeSectionMatrixSection[] = [
|
|
16
|
-
{
|
|
17
|
-
title: "Pinned",
|
|
18
|
-
items: [makeItem("Pinned", 1), makeItem("Pinned", 2), makeItem("Pinned", 3)],
|
|
19
|
-
},
|
|
20
|
-
{
|
|
21
|
-
title: "Long Section Title To Verify The Custom Title Cell Uses Dynamic Height\nLine 2\nLine 3",
|
|
22
|
-
items: [makeItem("Recent", 1), makeItem("Recent", 2), makeItem("Recent", 3), makeItem("Recent", 4)],
|
|
23
|
-
},
|
|
24
|
-
{
|
|
25
|
-
title: "",
|
|
26
|
-
items: [makeItem("Untitled", 1), makeItem("Untitled", 2)],
|
|
27
|
-
},
|
|
28
|
-
];
|
|
29
|
-
|
|
30
|
-
const matrix = new DynamicItemSizeSectionMatrix({
|
|
31
|
-
props: {
|
|
32
|
-
spacing: 8,
|
|
33
|
-
minItemWidth: $device.isIpad ? 180 : 142,
|
|
34
|
-
maxColumns: $device.isIpad ? 4 : 2,
|
|
35
|
-
data: sections,
|
|
36
|
-
template: {
|
|
37
|
-
views: [
|
|
38
|
-
{
|
|
39
|
-
type: "view",
|
|
40
|
-
props: {
|
|
41
|
-
bgcolor: $color("yellow"),
|
|
42
|
-
cornerRadius: 8,
|
|
43
|
-
},
|
|
44
|
-
layout: $layout.fill,
|
|
45
|
-
views: [
|
|
46
|
-
{
|
|
47
|
-
type: "image",
|
|
48
|
-
props: {
|
|
49
|
-
id: "symbol",
|
|
50
|
-
contentMode: $contentMode.scaleAspectFit,
|
|
51
|
-
tintColor: $color("tint"),
|
|
52
|
-
},
|
|
53
|
-
layout: (make, view) => {
|
|
54
|
-
make.left.top.inset(12);
|
|
55
|
-
make.size.equalTo($size(32, 32));
|
|
56
|
-
},
|
|
57
|
-
},
|
|
58
|
-
{
|
|
59
|
-
type: "label",
|
|
60
|
-
props: {
|
|
61
|
-
id: "badge",
|
|
62
|
-
align: $align.center,
|
|
63
|
-
font: $font(12),
|
|
64
|
-
textColor: $color("white"),
|
|
65
|
-
bgcolor: $color("tint"),
|
|
66
|
-
cornerRadius: 10,
|
|
67
|
-
},
|
|
68
|
-
layout: (make, view) => {
|
|
69
|
-
make.top.right.inset(12);
|
|
70
|
-
make.size.equalTo($size(28, 20));
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
{
|
|
74
|
-
type: "label",
|
|
75
|
-
props: {
|
|
76
|
-
id: "title",
|
|
77
|
-
font: $font("bold", 15),
|
|
78
|
-
textColor: $color("primaryText"),
|
|
79
|
-
},
|
|
80
|
-
layout: (make, view) => {
|
|
81
|
-
make.left.right.inset(12);
|
|
82
|
-
make.top.equalTo(view.prev.prev.bottom).offset(10);
|
|
83
|
-
make.height.equalTo(20);
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
type: "label",
|
|
88
|
-
props: {
|
|
89
|
-
id: "subtitle",
|
|
90
|
-
font: $font(12),
|
|
91
|
-
textColor: $color("secondaryText"),
|
|
92
|
-
},
|
|
93
|
-
layout: (make, view) => {
|
|
94
|
-
make.left.right.inset(12);
|
|
95
|
-
make.top.equalTo(view.prev.bottom).offset(4);
|
|
96
|
-
make.bottom.inset(12);
|
|
97
|
-
},
|
|
98
|
-
},
|
|
99
|
-
],
|
|
100
|
-
},
|
|
101
|
-
],
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
layout: $layout.fill,
|
|
105
|
-
events: {
|
|
106
|
-
itemHeight: (width) => Math.max(112, width * 0.72),
|
|
107
|
-
didSelect: (sender, indexPath, data) => {
|
|
108
|
-
const section = matrix.data[indexPath.section];
|
|
109
|
-
const title = (data.title as { text: string }).text;
|
|
110
|
-
$ui.toast(`${section.title || "Untitled"} / ${title}`);
|
|
111
|
-
},
|
|
112
|
-
didLongPress: (sender, indexPath, data) => {
|
|
113
|
-
const title = (data.title as { text: string }).text;
|
|
114
|
-
$ui.alert(`Long pressed ${title}`);
|
|
115
|
-
},
|
|
116
|
-
},
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
$ui.render({
|
|
120
|
-
props: {
|
|
121
|
-
navButtons: [
|
|
122
|
-
{
|
|
123
|
-
symbol: "plus",
|
|
124
|
-
handler: () => {
|
|
125
|
-
const nextIndex = matrix.data[0].items.length + 1;
|
|
126
|
-
matrix.insert({
|
|
127
|
-
indexPath: $indexPath(0, matrix.data[0].items.length),
|
|
128
|
-
value: makeItem("Pinned", nextIndex),
|
|
129
|
-
});
|
|
130
|
-
},
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
symbol: "trash",
|
|
134
|
-
handler: () => {
|
|
135
|
-
if (matrix.data[0].items.length === 0) return;
|
|
136
|
-
matrix.delete($indexPath(0, matrix.data[0].items.length - 1));
|
|
137
|
-
},
|
|
138
|
-
},
|
|
139
|
-
],
|
|
140
|
-
},
|
|
141
|
-
views: [matrix.definition],
|
|
142
|
-
});
|