jsbox-cview 1.6.4 → 1.6.6
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/components/dynamic-itemsize-section-matrix.ts +363 -0
- package/components/oc-webview.ts +50 -0
- package/dist/components/alert/input-alert.js +1 -2
- package/dist/components/alert/login-alert.js +1 -2
- package/dist/components/alert/plain-alert.js +1 -2
- package/dist/components/custom-navigation-bar.js +7 -1
- package/dist/components/dialogs/form-dialog.js +1 -2
- package/dist/components/dialogs/list-dialog.js +1 -2
- package/dist/components/dialogs/text-dialog.js +1 -2
- package/dist/components/dynamic-contextmenu-view.js +5 -1
- package/dist/components/dynamic-itemsize-matrix.js +17 -15
- package/dist/components/dynamic-itemsize-section-matrix.js +293 -0
- package/dist/components/dynamic-preference-listview.js +25 -16
- package/dist/components/dynamic-rowheight-list.js +10 -3
- package/dist/components/enhanced-imageview.js +1 -1
- package/dist/components/flowlayout.js +10 -13
- package/dist/components/image-pager.js +6 -1
- package/dist/components/oc-webview.js +37 -0
- package/dist/components/page-control.js +2 -13
- package/dist/components/pageviewer-titlebar.js +7 -13
- package/dist/components/pageviewer.js +4 -1
- package/dist/components/refresh-button.js +3 -4
- package/dist/components/rotating-view.js +10 -2
- package/dist/components/searchbar.js +8 -1
- package/dist/components/single-views.js +11 -4
- package/dist/components/spinners/loading-dual-ring.js +3 -12
- package/dist/components/spinners/loading-wedges.js +3 -12
- package/dist/components/spinners/spinner-androidstyle.js +7 -1
- package/dist/components/static-preference-listview.js +13 -10
- package/dist/components/symbol-button.js +8 -1
- package/dist/components/tabbar.js +8 -1
- package/dist/controller/pageviewer-controller.js +4 -1
- package/dist/controller/presented-page-controller.js +7 -9
- package/dist/controller/splitview-controller.js +23 -11
- package/dist/controller/tabbar-controller.js +13 -14
- package/dist/index.js +1 -0
- package/dist/test/dialog-sheet.js +3 -12
- package/dist/test/dynamic-itemsize-section-matrix.js +138 -0
- package/dist/test/form-dialog.js +3 -12
- package/dist/test/oc-webview.js +195 -0
- package/dist/test/refresh-button.js +3 -12
- package/dist/utils/l10n.js +1 -2
- package/dist/utils/path.js +8 -9
- package/dist/utils/rect.js +8 -9
- package/dist/utils/uitools.js +6 -6
- package/index.ts +1 -0
- package/package.json +4 -3
- package/test/dynamic-itemsize-section-matrix.ts +142 -0
- package/test/oc-webview.ts +197 -0
- package/tsconfig.json +1 -1
|
@@ -25,7 +25,12 @@ class RotatingView extends base_1.Base {
|
|
|
25
25
|
*/
|
|
26
26
|
constructor({ props, layout, events = {}, }) {
|
|
27
27
|
super();
|
|
28
|
-
this._props =
|
|
28
|
+
this._props = {
|
|
29
|
+
contentMode: 1,
|
|
30
|
+
rps: 0.5,
|
|
31
|
+
clockwise: true,
|
|
32
|
+
...props,
|
|
33
|
+
};
|
|
29
34
|
this._rotatingFlag = false;
|
|
30
35
|
if (this._props.cview) {
|
|
31
36
|
this._innerView = this._props.cview;
|
|
@@ -45,7 +50,10 @@ class RotatingView extends base_1.Base {
|
|
|
45
50
|
this._defineView = () => {
|
|
46
51
|
return {
|
|
47
52
|
type: "view",
|
|
48
|
-
props:
|
|
53
|
+
props: {
|
|
54
|
+
...this._props,
|
|
55
|
+
id: this.id,
|
|
56
|
+
},
|
|
49
57
|
layout,
|
|
50
58
|
events: {
|
|
51
59
|
ready: (sender) => {
|
|
@@ -39,7 +39,14 @@ class SearchBar extends base_1.Base {
|
|
|
39
39
|
*/
|
|
40
40
|
constructor({ props, layout, events = {}, }) {
|
|
41
41
|
super();
|
|
42
|
-
this._props =
|
|
42
|
+
this._props = {
|
|
43
|
+
placeholder: (0, l10n_1.l10n)("SEARCH"),
|
|
44
|
+
cancelText: (0, l10n_1.l10n)("CANCEL"),
|
|
45
|
+
tintColor: $color("systemLink"),
|
|
46
|
+
bgcolor: colors_1.searchBarBgcolor,
|
|
47
|
+
style: 0,
|
|
48
|
+
...props,
|
|
49
|
+
};
|
|
43
50
|
const cancelButtonWidth = (0, uitools_1.getTextWidth)(this._props.cancelText, {
|
|
44
51
|
inset: 20,
|
|
45
52
|
});
|
|
@@ -16,7 +16,10 @@ class SingleView extends base_1.Base {
|
|
|
16
16
|
this._defineView = () => {
|
|
17
17
|
return {
|
|
18
18
|
type: this._type,
|
|
19
|
-
props:
|
|
19
|
+
props: {
|
|
20
|
+
...this._props,
|
|
21
|
+
id: this.id,
|
|
22
|
+
},
|
|
20
23
|
layout: this._layout,
|
|
21
24
|
events: this._events,
|
|
22
25
|
views: this._views,
|
|
@@ -29,7 +32,7 @@ class ClearView extends SingleView {
|
|
|
29
32
|
constructor({ props, layout = $layout.fill, events, views, }) {
|
|
30
33
|
super({
|
|
31
34
|
type: "view",
|
|
32
|
-
props:
|
|
35
|
+
props: { ...props },
|
|
33
36
|
layout,
|
|
34
37
|
events,
|
|
35
38
|
views,
|
|
@@ -41,7 +44,7 @@ class ContentView extends SingleView {
|
|
|
41
44
|
constructor({ props, layout = $layout.fillSafeArea, events = {}, views, }) {
|
|
42
45
|
super({
|
|
43
46
|
type: "view",
|
|
44
|
-
props:
|
|
47
|
+
props: { bgcolor: $color("primarySurface"), ...props },
|
|
45
48
|
layout,
|
|
46
49
|
events,
|
|
47
50
|
views,
|
|
@@ -59,7 +62,11 @@ class MaskView extends SingleView {
|
|
|
59
62
|
constructor({ props, layout = $layout.fill, events, views, }) {
|
|
60
63
|
super({
|
|
61
64
|
type: "view",
|
|
62
|
-
props:
|
|
65
|
+
props: {
|
|
66
|
+
bgcolor: $rgba(0, 0, 0, 0.2),
|
|
67
|
+
...props,
|
|
68
|
+
userInteractionEnabled: true,
|
|
69
|
+
},
|
|
63
70
|
layout,
|
|
64
71
|
events,
|
|
65
72
|
views,
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.DualRing = void 0;
|
|
13
4
|
const base_1 = require("../base");
|
|
@@ -72,15 +63,15 @@ class DualRing extends base_1.Base {
|
|
|
72
63
|
views: [canvas1.definition, canvas2.definition],
|
|
73
64
|
layout,
|
|
74
65
|
events: {
|
|
75
|
-
ready: (sender) =>
|
|
66
|
+
ready: async (sender) => {
|
|
76
67
|
while (sender.super) {
|
|
77
68
|
canvas1.startAngle += Math.PI * interval * 2;
|
|
78
69
|
canvas1.redraw();
|
|
79
70
|
canvas2.startAngle += Math.PI * interval * 2;
|
|
80
71
|
canvas2.redraw();
|
|
81
|
-
|
|
72
|
+
await $wait(interval);
|
|
82
73
|
}
|
|
83
|
-
}
|
|
74
|
+
},
|
|
84
75
|
},
|
|
85
76
|
};
|
|
86
77
|
};
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.Wedges = void 0;
|
|
13
4
|
const base_1 = require("../base");
|
|
@@ -77,7 +68,7 @@ class Wedges extends base_1.Base {
|
|
|
77
68
|
views: [canvas1.definition, canvas2.definition, canvas3.definition, canvas4.definition],
|
|
78
69
|
layout,
|
|
79
70
|
events: {
|
|
80
|
-
ready: (sender) =>
|
|
71
|
+
ready: async (sender) => {
|
|
81
72
|
while (sender.super) {
|
|
82
73
|
canvas1.startAngle += Math.PI * interval * 4;
|
|
83
74
|
canvas1.redraw();
|
|
@@ -87,9 +78,9 @@ class Wedges extends base_1.Base {
|
|
|
87
78
|
canvas3.redraw();
|
|
88
79
|
canvas4.startAngle += Math.PI * interval * 1;
|
|
89
80
|
canvas4.redraw();
|
|
90
|
-
|
|
81
|
+
await $wait(interval);
|
|
91
82
|
}
|
|
92
|
-
}
|
|
83
|
+
},
|
|
93
84
|
},
|
|
94
85
|
};
|
|
95
86
|
};
|
|
@@ -18,7 +18,13 @@ class AndroidStyleSpinner extends base_1.Base {
|
|
|
18
18
|
*/
|
|
19
19
|
constructor({ props, layout, }) {
|
|
20
20
|
super();
|
|
21
|
-
this._props =
|
|
21
|
+
this._props = {
|
|
22
|
+
weight: 2,
|
|
23
|
+
diameter: 24,
|
|
24
|
+
color: $color("gray"),
|
|
25
|
+
bgcolor: $color("clear"),
|
|
26
|
+
...props,
|
|
27
|
+
};
|
|
22
28
|
this._defineView = () => {
|
|
23
29
|
const weight = this._props.weight;
|
|
24
30
|
const color = this._props.color;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PreferenceListView = exports.
|
|
3
|
+
exports.PreferenceListView = exports.excludedTypes = exports.selectableTypes = void 0;
|
|
4
|
+
exports.dateToString = dateToString;
|
|
4
5
|
const base_1 = require("./base");
|
|
5
6
|
const uitools_1 = require("../utils/uitools");
|
|
6
7
|
exports.selectableTypes = [
|
|
@@ -78,7 +79,6 @@ class BaseStringCell extends Cell {
|
|
|
78
79
|
this._textColor = textColor;
|
|
79
80
|
}
|
|
80
81
|
_defineValueView() {
|
|
81
|
-
var _a;
|
|
82
82
|
return {
|
|
83
83
|
type: "view",
|
|
84
84
|
props: {},
|
|
@@ -105,7 +105,7 @@ class BaseStringCell extends Cell {
|
|
|
105
105
|
type: "label",
|
|
106
106
|
props: {
|
|
107
107
|
id: "label",
|
|
108
|
-
text:
|
|
108
|
+
text: this._handleText(this._value)?.toString(),
|
|
109
109
|
align: $align.right,
|
|
110
110
|
font: $font(17),
|
|
111
111
|
textColor: this._textColor,
|
|
@@ -483,7 +483,6 @@ function dateToString(mode, date) {
|
|
|
483
483
|
return `${year}-${month}-${day} ${hours}:${minutes}`;
|
|
484
484
|
}
|
|
485
485
|
}
|
|
486
|
-
exports.dateToString = dateToString;
|
|
487
486
|
class DateCell extends Cell {
|
|
488
487
|
constructor(props, values) {
|
|
489
488
|
super(props, values);
|
|
@@ -642,13 +641,12 @@ class LinkCell extends Cell {
|
|
|
642
641
|
}
|
|
643
642
|
class SymbolActionCell extends Cell {
|
|
644
643
|
constructor(props, values) {
|
|
645
|
-
var _a, _b, _c;
|
|
646
644
|
super(props, values);
|
|
647
645
|
this._type = "symbol-action";
|
|
648
646
|
this._symbol = props.symbol || "";
|
|
649
|
-
this._tintColor =
|
|
650
|
-
this._contentMode =
|
|
651
|
-
this._symbolSize =
|
|
647
|
+
this._tintColor = props.tintColor ?? $color("primaryText");
|
|
648
|
+
this._contentMode = props.contentMode ?? 1;
|
|
649
|
+
this._symbolSize = props.symbolSize ?? $size(24, 24);
|
|
652
650
|
}
|
|
653
651
|
_defineValueView() {
|
|
654
652
|
return {
|
|
@@ -845,10 +843,15 @@ class PreferenceListView extends base_1.Base {
|
|
|
845
843
|
this._defineView = () => {
|
|
846
844
|
return {
|
|
847
845
|
type: "list",
|
|
848
|
-
props:
|
|
846
|
+
props: {
|
|
847
|
+
style: 2,
|
|
848
|
+
...this._props,
|
|
849
|
+
id: this.id,
|
|
850
|
+
data: this._cells.map((section) => ({
|
|
849
851
|
title: section.title,
|
|
850
852
|
rows: section.rows.map((cell) => cell.definition),
|
|
851
|
-
}))
|
|
853
|
+
})),
|
|
854
|
+
},
|
|
852
855
|
layout: this._layout,
|
|
853
856
|
events: {
|
|
854
857
|
didSelect: (sender, indexPath, data) => {
|
|
@@ -18,7 +18,14 @@ const base_1 = require("./base");
|
|
|
18
18
|
class SymbolButton extends base_1.Base {
|
|
19
19
|
constructor({ props, layout, events = {}, }) {
|
|
20
20
|
super();
|
|
21
|
-
this._props =
|
|
21
|
+
this._props = {
|
|
22
|
+
enabled: true,
|
|
23
|
+
contentMode: 1,
|
|
24
|
+
insets: $insets(12.5, 12.5, 12.5, 12.5),
|
|
25
|
+
tintColor: $color("primaryText"),
|
|
26
|
+
hidden: false,
|
|
27
|
+
...props,
|
|
28
|
+
};
|
|
22
29
|
this._layout = layout;
|
|
23
30
|
this._defineView = () => {
|
|
24
31
|
const props = this._props.menu
|
|
@@ -168,7 +168,14 @@ class ImageCell extends base_1.Base {
|
|
|
168
168
|
class TabBar extends base_1.Base {
|
|
169
169
|
constructor({ props, events = {}, }) {
|
|
170
170
|
super();
|
|
171
|
-
this._props =
|
|
171
|
+
this._props = {
|
|
172
|
+
height: 50,
|
|
173
|
+
index: 0,
|
|
174
|
+
selectedSegmentTintColor: $color("systemLink"),
|
|
175
|
+
defaultSegmentTintColor: colors_1.footBarDefaultSegmentColor,
|
|
176
|
+
//bgcolor: $color("secondarySurface"),
|
|
177
|
+
...props,
|
|
178
|
+
};
|
|
172
179
|
this._index = this._props.index;
|
|
173
180
|
this._events = events;
|
|
174
181
|
this._cells = this._defineCells();
|
|
@@ -51,7 +51,10 @@ class PageViewerController extends base_controller_1.BaseController {
|
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
53
|
this.cviews.navbar = new custom_navigation_bar_1.CustomNavigationBar({
|
|
54
|
-
props:
|
|
54
|
+
props: {
|
|
55
|
+
...this._props.navBarProps,
|
|
56
|
+
titleView: this.cviews.titlebar,
|
|
57
|
+
},
|
|
55
58
|
});
|
|
56
59
|
this.rootView.views = [this.cviews.navbar, this.cviews.pageviewer];
|
|
57
60
|
}
|
|
@@ -26,24 +26,22 @@ const sheet_1 = require("../components/sheet");
|
|
|
26
26
|
*/
|
|
27
27
|
class PresentedPageController extends base_controller_1.BaseController {
|
|
28
28
|
constructor({ props, layout, events, } = {}) {
|
|
29
|
-
var _a, _b;
|
|
30
29
|
super({
|
|
31
30
|
props: {
|
|
32
|
-
id: props
|
|
33
|
-
bgcolor: props
|
|
31
|
+
id: props?.id,
|
|
32
|
+
bgcolor: props?.bgcolor,
|
|
34
33
|
},
|
|
35
34
|
layout,
|
|
36
35
|
events,
|
|
37
36
|
});
|
|
38
37
|
this._sheet = new sheet_1.Sheet({
|
|
39
|
-
presentMode:
|
|
40
|
-
animated:
|
|
41
|
-
interactiveDismissalDisabled:
|
|
42
|
-
bgcolor:
|
|
38
|
+
presentMode: props?.presentMode ?? 1,
|
|
39
|
+
animated: props?.animated ?? true,
|
|
40
|
+
interactiveDismissalDisabled: props?.interactiveDismissalDisabled || false,
|
|
41
|
+
bgcolor: props?.bgcolor || $color("secondarySurface"),
|
|
43
42
|
cview: this.rootView,
|
|
44
43
|
dismissalHandler: () => {
|
|
45
|
-
|
|
46
|
-
(_a = events === null || events === void 0 ? void 0 : events.dismissed) === null || _a === void 0 ? void 0 : _a.call(events, this);
|
|
44
|
+
events?.dismissed?.(this);
|
|
47
45
|
this.remove();
|
|
48
46
|
},
|
|
49
47
|
});
|
|
@@ -8,7 +8,10 @@ const cvid_1 = require("../utils/cvid");
|
|
|
8
8
|
class SecondaryView extends base_1.Base {
|
|
9
9
|
constructor({ props, layout, views = [], }) {
|
|
10
10
|
super();
|
|
11
|
-
this._props =
|
|
11
|
+
this._props = {
|
|
12
|
+
bgcolor: $color("groupedBackground", "secondarySurface"),
|
|
13
|
+
...props,
|
|
14
|
+
};
|
|
12
15
|
this._layouts = {
|
|
13
16
|
hidden: (make, view) => {
|
|
14
17
|
make.top.bottom.inset(0);
|
|
@@ -37,7 +40,10 @@ class SecondaryView extends base_1.Base {
|
|
|
37
40
|
this._defineView = () => {
|
|
38
41
|
return {
|
|
39
42
|
type: "view",
|
|
40
|
-
props:
|
|
43
|
+
props: {
|
|
44
|
+
...this._props,
|
|
45
|
+
id: this.id,
|
|
46
|
+
},
|
|
41
47
|
layout,
|
|
42
48
|
views: [...views, this.line.definition],
|
|
43
49
|
};
|
|
@@ -65,7 +71,7 @@ class SecondaryView extends base_1.Base {
|
|
|
65
71
|
class MaskView extends base_1.Base {
|
|
66
72
|
constructor({ props, layout = $layout.fill, }) {
|
|
67
73
|
super();
|
|
68
|
-
this._props =
|
|
74
|
+
this._props = { bgcolor: $color("clear"), ...props };
|
|
69
75
|
this._shown = false;
|
|
70
76
|
this._dismissEvent = () => {
|
|
71
77
|
if (!this._shown)
|
|
@@ -76,7 +82,11 @@ class MaskView extends base_1.Base {
|
|
|
76
82
|
this._defineView = () => {
|
|
77
83
|
return {
|
|
78
84
|
type: "view",
|
|
79
|
-
props:
|
|
85
|
+
props: {
|
|
86
|
+
...this._props,
|
|
87
|
+
hidden: true,
|
|
88
|
+
id: this.id,
|
|
89
|
+
},
|
|
80
90
|
layout,
|
|
81
91
|
events: {
|
|
82
92
|
ready: (sender) => this._addGesture(sender, this._dismissEvent),
|
|
@@ -140,21 +150,23 @@ class SplitViewController extends base_controller_1.BaseController {
|
|
|
140
150
|
bgcolor: props.bgcolor,
|
|
141
151
|
},
|
|
142
152
|
layout,
|
|
143
|
-
events:
|
|
144
|
-
|
|
153
|
+
events: {
|
|
154
|
+
...events,
|
|
155
|
+
didAppear: (sender) => {
|
|
145
156
|
if (this._sideBarShown) {
|
|
146
157
|
this._secondaryController.appear();
|
|
147
158
|
}
|
|
148
159
|
else {
|
|
149
160
|
this._primaryController.appear();
|
|
150
161
|
}
|
|
151
|
-
|
|
152
|
-
},
|
|
153
|
-
|
|
162
|
+
events?.didAppear?.(this);
|
|
163
|
+
},
|
|
164
|
+
didDisappear: () => {
|
|
154
165
|
this._primaryController.disappear();
|
|
155
166
|
this._secondaryController.disappear();
|
|
156
|
-
|
|
157
|
-
}
|
|
167
|
+
events?.didDisappear?.(this);
|
|
168
|
+
},
|
|
169
|
+
},
|
|
158
170
|
});
|
|
159
171
|
this._sideBarShown = false;
|
|
160
172
|
this._canShowSidebar = true;
|
|
@@ -27,15 +27,17 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
27
27
|
bgcolor: props.bgcolor,
|
|
28
28
|
},
|
|
29
29
|
layout,
|
|
30
|
-
events:
|
|
31
|
-
|
|
30
|
+
events: {
|
|
31
|
+
...events,
|
|
32
|
+
didAppear: () => {
|
|
32
33
|
this._props.items[this.index].controller.appear();
|
|
33
|
-
|
|
34
|
-
},
|
|
35
|
-
|
|
34
|
+
events.didAppear?.(this);
|
|
35
|
+
},
|
|
36
|
+
didDisappear: () => {
|
|
36
37
|
this._props.items[this.index].controller.disappear();
|
|
37
|
-
|
|
38
|
-
}
|
|
38
|
+
events.didDisappear?.(this);
|
|
39
|
+
},
|
|
40
|
+
},
|
|
39
41
|
});
|
|
40
42
|
this._props = {
|
|
41
43
|
items: props.items,
|
|
@@ -49,15 +51,13 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
49
51
|
},
|
|
50
52
|
events: {
|
|
51
53
|
changed: (cview, index) => {
|
|
52
|
-
var _a, _b;
|
|
53
54
|
this.index = index;
|
|
54
|
-
|
|
55
|
+
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
55
56
|
this._props.items[index].controller.appear();
|
|
56
|
-
|
|
57
|
+
events.changed?.(this, index);
|
|
57
58
|
},
|
|
58
59
|
doubleTapped: (cview, index) => {
|
|
59
|
-
|
|
60
|
-
(_a = events.doubleTapped) === null || _a === void 0 ? void 0 : _a.call(events, this, index);
|
|
60
|
+
events.doubleTapped?.(this, index);
|
|
61
61
|
},
|
|
62
62
|
},
|
|
63
63
|
});
|
|
@@ -81,7 +81,6 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
81
81
|
this.rootView.views = [this.cviews.pageContentView, this.cviews.tabbar];
|
|
82
82
|
}
|
|
83
83
|
set index(num) {
|
|
84
|
-
var _a;
|
|
85
84
|
if (this._props.index === num)
|
|
86
85
|
return;
|
|
87
86
|
this.cviews.tabbar.index = num;
|
|
@@ -89,7 +88,7 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
89
88
|
n.view.hidden = i !== num;
|
|
90
89
|
});
|
|
91
90
|
this._props.index = num;
|
|
92
|
-
|
|
91
|
+
this._props.items.find((item) => item.controller.status === 2)?.controller.disappear();
|
|
93
92
|
this._props.items[num].controller.appear();
|
|
94
93
|
}
|
|
95
94
|
get index() {
|
package/dist/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./components/base"), exports);
|
|
|
18
18
|
__exportStar(require("./components/custom-navigation-bar"), exports);
|
|
19
19
|
__exportStar(require("./components/dynamic-contextmenu-view"), exports);
|
|
20
20
|
__exportStar(require("./components/dynamic-itemsize-matrix"), exports);
|
|
21
|
+
__exportStar(require("./components/dynamic-itemsize-section-matrix"), exports);
|
|
21
22
|
__exportStar(require("./components/dynamic-preference-listview"), exports);
|
|
22
23
|
__exportStar(require("./components/dynamic-rowheight-list"), exports);
|
|
23
24
|
__exportStar(require("./components/enhanced-imageview"), exports);
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
const dialog_sheet_1 = require("../components/dialogs/dialog-sheet");
|
|
13
4
|
const single_views_1 = require("../components/single-views");
|
|
@@ -26,7 +17,7 @@ $ui.render({
|
|
|
26
17
|
},
|
|
27
18
|
layout: $layout.center,
|
|
28
19
|
events: {
|
|
29
|
-
tapped: () =>
|
|
20
|
+
tapped: async () => {
|
|
30
21
|
const sheet = new dialog_sheet_1.DialogSheet({
|
|
31
22
|
title: "Dialog Sheet",
|
|
32
23
|
cview,
|
|
@@ -41,8 +32,8 @@ $ui.render({
|
|
|
41
32
|
},
|
|
42
33
|
doneButtonTitle: "完成",
|
|
43
34
|
});
|
|
44
|
-
|
|
45
|
-
}
|
|
35
|
+
await sheet.present();
|
|
36
|
+
},
|
|
46
37
|
},
|
|
47
38
|
},
|
|
48
39
|
],
|
|
@@ -0,0 +1,138 @@
|
|
|
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
|
+
});
|