jsbox-cview 1.6.2 → 1.6.3
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/dialogs/dialog-sheet.ts +23 -1
- package/dist/components/custom-navigation-bar.js +2 -7
- package/dist/components/dialogs/dialog-sheet.js +19 -4
- package/dist/components/dialogs/list-dialog.js +2 -5
- package/dist/components/dynamic-contextmenu-view.js +5 -5
- package/dist/components/dynamic-itemsize-matrix.js +3 -5
- package/dist/components/dynamic-preference-listview.js +3 -7
- package/dist/components/pageviewer-titlebar.js +4 -13
- package/dist/components/rotating-view.js +1 -3
- package/dist/components/searchbar.js +2 -8
- package/dist/components/sheet.js +1 -3
- package/dist/components/spinners/loading-dual-ring.js +1 -1
- package/dist/components/spinners/loading-wedges.js +3 -13
- package/dist/components/static-preference-listview.js +2 -8
- package/dist/components/tabbar.js +4 -12
- package/dist/controller/base-controller.js +2 -4
- package/dist/controller/splitview-controller.js +4 -14
- package/dist/controller/tabbar-controller.js +2 -4
- package/dist/test/dialog-sheet.js +49 -0
- package/dist/test/dynamic-itemsize-matrix.js +1 -2
- package/dist/test/flowlayout.js +1 -5
- package/dist/utils/path.js +1 -4
- package/package.json +2 -2
- package/test/dialog-sheet.ts +40 -0
|
@@ -14,6 +14,8 @@ import { Base } from "../base";
|
|
|
14
14
|
* @param presentMode 显示模式
|
|
15
15
|
* @param bgcolor 背景颜色
|
|
16
16
|
* @param doneButtonHidden 是否隐藏完成按钮, 默认为false,如果隐藏则需要自行实现完成逻辑
|
|
17
|
+
* @param doneButtonValidator 完成按钮验证器,返回true则执行完成逻辑,返回false则不执行
|
|
18
|
+
* @param doneButtonTitle 完成按钮标题,默认为"完成"
|
|
17
19
|
*/
|
|
18
20
|
export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions> {
|
|
19
21
|
_props: {
|
|
@@ -23,6 +25,8 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
|
|
|
23
25
|
presentMode?: number;
|
|
24
26
|
bgcolor?: UIColor;
|
|
25
27
|
doneButtonHidden?: boolean;
|
|
28
|
+
doneButtonValidator?: () => boolean;
|
|
29
|
+
doneButtonTitle?: string;
|
|
26
30
|
};
|
|
27
31
|
_done: boolean;
|
|
28
32
|
private _navbar?: CustomNavigationBar;
|
|
@@ -36,6 +40,8 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
|
|
|
36
40
|
presentMode?: number;
|
|
37
41
|
bgcolor?: UIColor;
|
|
38
42
|
doneButtonHidden?: boolean;
|
|
43
|
+
doneButtonValidator?: () => boolean;
|
|
44
|
+
doneButtonTitle?: string;
|
|
39
45
|
}) {
|
|
40
46
|
super({
|
|
41
47
|
presentMode: props.presentMode || ($device.isIpad ? 2 : 1),
|
|
@@ -58,7 +64,23 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
|
|
|
58
64
|
props: {
|
|
59
65
|
title: this._props.title,
|
|
60
66
|
leftBarButtonItems: [{ symbol: "xmark", handler: () => this.dismiss() }],
|
|
61
|
-
rightBarButtonItems: this._props.doneButtonHidden
|
|
67
|
+
rightBarButtonItems: this._props.doneButtonHidden
|
|
68
|
+
? []
|
|
69
|
+
: [
|
|
70
|
+
{
|
|
71
|
+
title: this._props.doneButtonTitle || l10n("DONE"),
|
|
72
|
+
handler: () => {
|
|
73
|
+
if (this._props.doneButtonValidator) {
|
|
74
|
+
if (this._props.doneButtonValidator()) {
|
|
75
|
+
this.done();
|
|
76
|
+
} else {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
this.done();
|
|
81
|
+
},
|
|
82
|
+
},
|
|
83
|
+
],
|
|
62
84
|
},
|
|
63
85
|
});
|
|
64
86
|
this._props.cview._layout = (make, view) => {
|
|
@@ -102,9 +102,7 @@ class CustomNavigationBar extends base_1.Base {
|
|
|
102
102
|
// leftItemView
|
|
103
103
|
let leftInset = 0;
|
|
104
104
|
if (this._props.popButtonEnabled) {
|
|
105
|
-
const titleWidth = this._props.popButtonTitle
|
|
106
|
-
? (0, uitools_1.getTextWidth)(this._props.popButtonTitle)
|
|
107
|
-
: 0;
|
|
105
|
+
const titleWidth = this._props.popButtonTitle ? (0, uitools_1.getTextWidth)(this._props.popButtonTitle) : 0;
|
|
108
106
|
leftInset = titleWidth + 35;
|
|
109
107
|
const views = [];
|
|
110
108
|
const chevronOptions = {
|
|
@@ -298,10 +296,7 @@ class CustomNavigationBar extends base_1.Base {
|
|
|
298
296
|
type: "view",
|
|
299
297
|
props: {},
|
|
300
298
|
layout: $layout.fillSafeArea,
|
|
301
|
-
views: [
|
|
302
|
-
this.cviews.contentView.definition,
|
|
303
|
-
this.cviews.toolViewWrapper.definition,
|
|
304
|
-
],
|
|
299
|
+
views: [this.cviews.contentView.definition, this.cviews.toolViewWrapper.definition],
|
|
305
300
|
},
|
|
306
301
|
this.cviews.separator.definition,
|
|
307
302
|
],
|
|
@@ -14,6 +14,8 @@ const single_views_1 = require("../single-views");
|
|
|
14
14
|
* @param presentMode 显示模式
|
|
15
15
|
* @param bgcolor 背景颜色
|
|
16
16
|
* @param doneButtonHidden 是否隐藏完成按钮, 默认为false,如果隐藏则需要自行实现完成逻辑
|
|
17
|
+
* @param doneButtonValidator 完成按钮验证器,返回true则执行完成逻辑,返回false则不执行
|
|
18
|
+
* @param doneButtonTitle 完成按钮标题,默认为"完成"
|
|
17
19
|
*/
|
|
18
20
|
class DialogSheet extends sheet_1.Sheet {
|
|
19
21
|
constructor(props) {
|
|
@@ -36,12 +38,25 @@ class DialogSheet extends sheet_1.Sheet {
|
|
|
36
38
|
this._navbar = new custom_navigation_bar_1.CustomNavigationBar({
|
|
37
39
|
props: {
|
|
38
40
|
title: this._props.title,
|
|
39
|
-
leftBarButtonItems: [
|
|
40
|
-
{ symbol: "xmark", handler: () => this.dismiss() },
|
|
41
|
-
],
|
|
41
|
+
leftBarButtonItems: [{ symbol: "xmark", handler: () => this.dismiss() }],
|
|
42
42
|
rightBarButtonItems: this._props.doneButtonHidden
|
|
43
43
|
? []
|
|
44
|
-
: [
|
|
44
|
+
: [
|
|
45
|
+
{
|
|
46
|
+
title: this._props.doneButtonTitle || (0, l10n_1.l10n)("DONE"),
|
|
47
|
+
handler: () => {
|
|
48
|
+
if (this._props.doneButtonValidator) {
|
|
49
|
+
if (this._props.doneButtonValidator()) {
|
|
50
|
+
this.done();
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
this.done();
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
],
|
|
45
60
|
},
|
|
46
61
|
});
|
|
47
62
|
this._props.cview._layout = (make, view) => {
|
|
@@ -57,8 +57,7 @@ function listDialog({ items, multiSelectEnabled, value, values = [], title, }) {
|
|
|
57
57
|
didSelect: (sender, indexPath) => {
|
|
58
58
|
const data = sender.data;
|
|
59
59
|
if (multiSelectEnabled) {
|
|
60
|
-
data[indexPath.item].image.hidden =
|
|
61
|
-
!data[indexPath.item].image.hidden;
|
|
60
|
+
data[indexPath.item].image.hidden = !data[indexPath.item].image.hidden;
|
|
62
61
|
}
|
|
63
62
|
else {
|
|
64
63
|
data.forEach((n, i) => {
|
|
@@ -74,9 +73,7 @@ function listDialog({ items, multiSelectEnabled, value, values = [], title, }) {
|
|
|
74
73
|
bgcolor: $color("insetGroupedBackground"),
|
|
75
74
|
cview: listView,
|
|
76
75
|
doneHandler: () => {
|
|
77
|
-
const filtered = listView.view.data
|
|
78
|
-
.map((n, i) => (n.image.hidden ? -1 : i))
|
|
79
|
-
.filter((n) => n !== -1);
|
|
76
|
+
const filtered = listView.view.data.map((n, i) => (n.image.hidden ? -1 : i)).filter((n) => n !== -1);
|
|
80
77
|
if (multiSelectEnabled)
|
|
81
78
|
return filtered;
|
|
82
79
|
else
|
|
@@ -48,7 +48,7 @@ class DynamicContextMenuView extends base_1.Base {
|
|
|
48
48
|
},
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
createContextMenuConfiguration({ title, items
|
|
51
|
+
createContextMenuConfiguration({ title, items }) {
|
|
52
52
|
return $objc("UIContextMenuConfiguration").$configurationWithIdentifier_previewProvider_actionProvider(null, null, $block("UIMenu *, NSArray *", () => {
|
|
53
53
|
const actions = items.map((item) => {
|
|
54
54
|
const action = $objc("UIAction").$actionWithTitle_image_identifier_handler(item.title, item.symbol || null, null, $block("void, UIAction *", () => item.handler()));
|
|
@@ -56,15 +56,15 @@ class DynamicContextMenuView extends base_1.Base {
|
|
|
56
56
|
action.$setAttributes(1 << 1);
|
|
57
57
|
return action;
|
|
58
58
|
});
|
|
59
|
-
return title
|
|
59
|
+
return title
|
|
60
|
+
? $objc("UIMenu").$menuWithTitle_children(title, actions)
|
|
61
|
+
: $objc("UIMenu").$menuWithChildren(actions);
|
|
60
62
|
}));
|
|
61
63
|
}
|
|
62
64
|
createRuntimeView() {
|
|
63
65
|
this.defineOCClass();
|
|
64
66
|
const view = $objc(this._ocClassName).invoke("alloc.init");
|
|
65
|
-
const interaction = $objc("UIContextMenuInteraction")
|
|
66
|
-
.invoke("alloc")
|
|
67
|
-
.invoke("initWithDelegate", view);
|
|
67
|
+
const interaction = $objc("UIContextMenuInteraction").invoke("alloc").invoke("initWithDelegate", view);
|
|
68
68
|
view.$addInteraction(interaction);
|
|
69
69
|
return view;
|
|
70
70
|
}
|
|
@@ -21,10 +21,8 @@ function _getColumnsAndItemSizeWidth(containerWidth, minItemWidth, maxColumns, s
|
|
|
21
21
|
itemSizeWidth: containerWidth - 2 * spacing,
|
|
22
22
|
};
|
|
23
23
|
}
|
|
24
|
-
const columns = Math.max(Math.min(Math.floor((containerWidth - spacing) / (minItemWidth + spacing)), maxColumns), 1
|
|
25
|
-
);
|
|
26
|
-
const itemSizeWidth = Math.max(Math.floor((containerWidth - spacing * (columns + 1)) / columns), minItemWidth // 最小宽度
|
|
27
|
-
);
|
|
24
|
+
const columns = Math.max(Math.min(Math.floor((containerWidth - spacing) / (minItemWidth + spacing)), maxColumns), 1);
|
|
25
|
+
const itemSizeWidth = Math.max(Math.floor((containerWidth - spacing * (columns + 1)) / columns), minItemWidth);
|
|
28
26
|
return {
|
|
29
27
|
columns,
|
|
30
28
|
itemSizeWidth,
|
|
@@ -125,7 +123,7 @@ class DynamicItemSizeMatrix extends base_1.Base {
|
|
|
125
123
|
}
|
|
126
124
|
heightToWidth(width) {
|
|
127
125
|
const { columns, itemSizeWidth } = _getColumnsAndItemSizeWidth(width, this._props.minItemWidth, this._props.maxColumns, this._props.spacing);
|
|
128
|
-
const rows = Math.ceil(this._props.data.length / columns);
|
|
126
|
+
const rows = this._props.data ? Math.ceil(this._props.data.length / columns) : 0;
|
|
129
127
|
const itemSizeHeight = this._events.itemHeight
|
|
130
128
|
? this._events.itemHeight(itemSizeWidth)
|
|
131
129
|
: this._props.fixedItemHeight;
|
|
@@ -126,8 +126,7 @@ class DynamicPreferenceListView extends base_1.Base {
|
|
|
126
126
|
events: {
|
|
127
127
|
changed: (sender) => {
|
|
128
128
|
const { section, row } = sender.info;
|
|
129
|
-
this._sections[section].rows[row].value =
|
|
130
|
-
sender.value;
|
|
129
|
+
this._sections[section].rows[row].value = sender.value;
|
|
131
130
|
const label = sender.next;
|
|
132
131
|
label.text = sender.value.toString();
|
|
133
132
|
if (events.changed)
|
|
@@ -180,8 +179,7 @@ class DynamicPreferenceListView extends base_1.Base {
|
|
|
180
179
|
var _a;
|
|
181
180
|
const { section, row } = sender.info;
|
|
182
181
|
const options = this._sections[section].rows[row];
|
|
183
|
-
this._sections[section].rows[row].value =
|
|
184
|
-
this._handleSliderValue(sender.value * ((_a = options.max) !== null && _a !== void 0 ? _a : 1), options.decimal, options.min, options.max);
|
|
182
|
+
this._sections[section].rows[row].value = this._handleSliderValue(sender.value * ((_a = options.max) !== null && _a !== void 0 ? _a : 1), options.decimal, options.min, options.max);
|
|
185
183
|
if (events.changed)
|
|
186
184
|
events.changed(this.values);
|
|
187
185
|
},
|
|
@@ -602,9 +600,7 @@ class DynamicPreferenceListView extends base_1.Base {
|
|
|
602
600
|
break;
|
|
603
601
|
}
|
|
604
602
|
case "action": {
|
|
605
|
-
data.title.textColor = n.destructive
|
|
606
|
-
? $color("red")
|
|
607
|
-
: $color("systemLink");
|
|
603
|
+
data.title.textColor = n.destructive ? $color("red") : $color("systemLink");
|
|
608
604
|
break;
|
|
609
605
|
}
|
|
610
606
|
default:
|
|
@@ -41,16 +41,13 @@ class PageViewerTitleBar extends base_1.Base {
|
|
|
41
41
|
this._props = Object.assign({ index: 0, selectedItemColor: $color("systemLink"), defaultItemColor: $color("secondaryText") }, props);
|
|
42
42
|
const { changed } = events, restEvents = __rest(events, ["changed"]);
|
|
43
43
|
this._floatedIndex = this._props.index;
|
|
44
|
-
this._lineStartLocationPercentage =
|
|
45
|
-
this._floatedIndex / this._props.items.length;
|
|
44
|
+
this._lineStartLocationPercentage = this._floatedIndex / this._props.items.length;
|
|
46
45
|
this.labels = this._props.items.map((n, i) => {
|
|
47
46
|
return new single_views_1.Label({
|
|
48
47
|
props: {
|
|
49
48
|
text: n,
|
|
50
49
|
font: $font("bold", 17),
|
|
51
|
-
textColor: i === this.index
|
|
52
|
-
? this._props.selectedItemColor
|
|
53
|
-
: this._props.defaultItemColor,
|
|
50
|
+
textColor: i === this.index ? this._props.selectedItemColor : this._props.defaultItemColor,
|
|
54
51
|
align: $align.center,
|
|
55
52
|
userInteractionEnabled: true,
|
|
56
53
|
},
|
|
@@ -79,9 +76,7 @@ class PageViewerTitleBar extends base_1.Base {
|
|
|
79
76
|
},
|
|
80
77
|
layout: (make, view) => {
|
|
81
78
|
make.left.bottom.inset(0);
|
|
82
|
-
make.width
|
|
83
|
-
.equalTo(view.super)
|
|
84
|
-
.multipliedBy(this._floatedIndex / this._props.items.length);
|
|
79
|
+
make.width.equalTo(view.super).multipliedBy(this._floatedIndex / this._props.items.length);
|
|
85
80
|
},
|
|
86
81
|
});
|
|
87
82
|
this.line = new single_views_1.ContentView({
|
|
@@ -103,11 +98,7 @@ class PageViewerTitleBar extends base_1.Base {
|
|
|
103
98
|
},
|
|
104
99
|
layout,
|
|
105
100
|
events: restEvents,
|
|
106
|
-
views: [
|
|
107
|
-
this.stack.definition,
|
|
108
|
-
this.placeholderView.definition,
|
|
109
|
-
this.line.definition,
|
|
110
|
-
],
|
|
101
|
+
views: [this.stack.definition, this.placeholderView.definition, this.line.definition],
|
|
111
102
|
};
|
|
112
103
|
};
|
|
113
104
|
}
|
|
@@ -35,9 +35,7 @@ class RotatingView extends base_1.Base {
|
|
|
35
35
|
throw new Error("image is required");
|
|
36
36
|
this._innerView = new single_views_1.Image({
|
|
37
37
|
props: {
|
|
38
|
-
image: this._props.tintColor
|
|
39
|
-
? this._props.image.alwaysTemplate
|
|
40
|
-
: this._props.image,
|
|
38
|
+
image: this._props.tintColor ? this._props.image.alwaysTemplate : this._props.image,
|
|
41
39
|
tintColor: this._props.tintColor,
|
|
42
40
|
contentMode: this._props.contentMode,
|
|
43
41
|
},
|
|
@@ -150,11 +150,7 @@ class SearchBar extends base_1.Base {
|
|
|
150
150
|
clipsToBounds: true,
|
|
151
151
|
},
|
|
152
152
|
layout,
|
|
153
|
-
views: [
|
|
154
|
-
this.cviews.bgview.definition,
|
|
155
|
-
this.cviews.iconInput.definition,
|
|
156
|
-
this.cviews.cancelButton.definition,
|
|
157
|
-
],
|
|
153
|
+
views: [this.cviews.bgview.definition, this.cviews.iconInput.definition, this.cviews.cancelButton.definition],
|
|
158
154
|
};
|
|
159
155
|
};
|
|
160
156
|
}
|
|
@@ -313,9 +309,7 @@ class SearchBar extends base_1.Base {
|
|
|
313
309
|
const IconInputLayoutInputing = (make, view) => {
|
|
314
310
|
make.center.equalTo(view.super);
|
|
315
311
|
make.top.bottom.inset(0);
|
|
316
|
-
make.width
|
|
317
|
-
.equalTo(Math.max(textWidth, placeholderWidth) + 50)
|
|
318
|
-
.priority(999);
|
|
312
|
+
make.width.equalTo(Math.max(textWidth, placeholderWidth) + 50).priority(999);
|
|
319
313
|
make.width.lessThanOrEqualTo(view.super).priority(1000);
|
|
320
314
|
};
|
|
321
315
|
this.cviews.iconInput.view.remakeLayout(IconInputLayoutInputing);
|
package/dist/components/sheet.js
CHANGED
|
@@ -70,9 +70,7 @@ class Sheet {
|
|
|
70
70
|
}
|
|
71
71
|
present() {
|
|
72
72
|
this._create();
|
|
73
|
-
$ui.controller
|
|
74
|
-
.ocValue()
|
|
75
|
-
.invoke("presentModalViewController:animated", this._PSViewController, this._animated);
|
|
73
|
+
$ui.controller.ocValue().invoke("presentModalViewController:animated", this._PSViewController, this._animated);
|
|
76
74
|
}
|
|
77
75
|
dismiss() {
|
|
78
76
|
this._PSViewController.invoke("dismissModalViewControllerAnimated", this._animated);
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.DualRing = void 0;
|
|
13
13
|
const base_1 = require("../base");
|
|
14
14
|
class CanvasComponet extends base_1.Base {
|
|
15
|
-
constructor({ tintColor, startAngle
|
|
15
|
+
constructor({ tintColor, startAngle }) {
|
|
16
16
|
super();
|
|
17
17
|
this._tintColor = tintColor;
|
|
18
18
|
this.startAngle = startAngle;
|
|
@@ -12,7 +12,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.Wedges = void 0;
|
|
13
13
|
const base_1 = require("../base");
|
|
14
14
|
class CanvasComponet extends base_1.Base {
|
|
15
|
-
constructor({ tintColor, startAngle
|
|
15
|
+
constructor({ tintColor, startAngle }) {
|
|
16
16
|
super();
|
|
17
17
|
this._tintColor = tintColor;
|
|
18
18
|
this.startAngle = startAngle;
|
|
@@ -49,12 +49,7 @@ class Wedges extends base_1.Base {
|
|
|
49
49
|
* @param colors 饼图颜色(必须是4个颜色)
|
|
50
50
|
* @param layout 布局
|
|
51
51
|
*/
|
|
52
|
-
constructor({ colors = [
|
|
53
|
-
$color("#f5542e"),
|
|
54
|
-
$color("#f2c327"),
|
|
55
|
-
$color("#008b6e"),
|
|
56
|
-
$color("#00aede"),
|
|
57
|
-
], layout, }) {
|
|
52
|
+
constructor({ colors = [$color("#f5542e"), $color("#f2c327"), $color("#008b6e"), $color("#00aede")], layout, }) {
|
|
58
53
|
super();
|
|
59
54
|
const interval = 1 / 60;
|
|
60
55
|
this._defineView = () => {
|
|
@@ -79,12 +74,7 @@ class Wedges extends base_1.Base {
|
|
|
79
74
|
props: {
|
|
80
75
|
id: this.id,
|
|
81
76
|
},
|
|
82
|
-
views: [
|
|
83
|
-
canvas1.definition,
|
|
84
|
-
canvas2.definition,
|
|
85
|
-
canvas3.definition,
|
|
86
|
-
canvas4.definition,
|
|
87
|
-
],
|
|
77
|
+
views: [canvas1.definition, canvas2.definition, canvas3.definition, canvas4.definition],
|
|
88
78
|
layout,
|
|
89
79
|
events: {
|
|
90
80
|
ready: (sender) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,13 +15,7 @@ exports.selectableTypes = [
|
|
|
15
15
|
"symbol-action",
|
|
16
16
|
"action",
|
|
17
17
|
];
|
|
18
|
-
exports.excludedTypes = [
|
|
19
|
-
"info",
|
|
20
|
-
"interactive-info",
|
|
21
|
-
"link",
|
|
22
|
-
"symbol-action",
|
|
23
|
-
"action",
|
|
24
|
-
];
|
|
18
|
+
exports.excludedTypes = ["info", "interactive-info", "link", "symbol-action", "action"];
|
|
25
19
|
class Cell extends base_1.Base {
|
|
26
20
|
constructor({ key, title, value, titleColor = $color("primaryText"), changedEvent, }, values) {
|
|
27
21
|
super();
|
|
@@ -297,7 +291,7 @@ class SliderCell extends Cell {
|
|
|
297
291
|
constructor(props, values) {
|
|
298
292
|
super(props, values);
|
|
299
293
|
this._type = "slider";
|
|
300
|
-
const { decimal = 1, min = 0, max = 1, minColor = $color("systemLink"), maxColor, thumbColor
|
|
294
|
+
const { decimal = 1, min = 0, max = 1, minColor = $color("systemLink"), maxColor, thumbColor } = props;
|
|
301
295
|
this._decimal = decimal;
|
|
302
296
|
this._min = min;
|
|
303
297
|
this._max = max;
|
|
@@ -64,9 +64,7 @@ class ImageLabelCell extends base_1.Base {
|
|
|
64
64
|
}
|
|
65
65
|
set selected(selected) {
|
|
66
66
|
this._props.selected = selected;
|
|
67
|
-
const color = selected
|
|
68
|
-
? this._props.selectedSegmentTintColor
|
|
69
|
-
: this._props.defaultSegmentTintColor;
|
|
67
|
+
const color = selected ? this._props.selectedSegmentTintColor : this._props.defaultSegmentTintColor;
|
|
70
68
|
this.view.get("image").tintColor = color;
|
|
71
69
|
const label = this.view.get("label");
|
|
72
70
|
label.textColor = color;
|
|
@@ -130,9 +128,7 @@ class ImageCell extends base_1.Base {
|
|
|
130
128
|
}
|
|
131
129
|
set selected(selected) {
|
|
132
130
|
this._props.selected = selected;
|
|
133
|
-
const color = selected
|
|
134
|
-
? this._props.selectedSegmentTintColor
|
|
135
|
-
: this._props.defaultSegmentTintColor;
|
|
131
|
+
const color = selected ? this._props.selectedSegmentTintColor : this._props.defaultSegmentTintColor;
|
|
136
132
|
this.view.get("image").tintColor = color;
|
|
137
133
|
}
|
|
138
134
|
get selected() {
|
|
@@ -212,9 +208,7 @@ class TabBar extends base_1.Base {
|
|
|
212
208
|
},
|
|
213
209
|
layout: (make, view) => {
|
|
214
210
|
make.left.right.bottom.inset(0);
|
|
215
|
-
make.top
|
|
216
|
-
.equalTo(view.super.safeAreaBottom)
|
|
217
|
-
.inset(-this._props.height);
|
|
211
|
+
make.top.equalTo(view.super.safeAreaBottom).inset(-this._props.height);
|
|
218
212
|
},
|
|
219
213
|
views: [line, stack],
|
|
220
214
|
events: {
|
|
@@ -240,9 +234,7 @@ class TabBar extends base_1.Base {
|
|
|
240
234
|
},
|
|
241
235
|
layout: (make, view) => {
|
|
242
236
|
make.left.right.bottom.inset(0);
|
|
243
|
-
make.top
|
|
244
|
-
.equalTo(view.super.safeAreaBottom)
|
|
245
|
-
.inset(-this._props.height);
|
|
237
|
+
make.top.equalTo(view.super.safeAreaBottom).inset(-this._props.height);
|
|
246
238
|
},
|
|
247
239
|
views: [line, stack],
|
|
248
240
|
events: {
|
|
@@ -125,8 +125,7 @@ class BaseController {
|
|
|
125
125
|
}
|
|
126
126
|
appear() {
|
|
127
127
|
// 只有status为loaded或者disappeared,才可以运行
|
|
128
|
-
if (this._status !== controllerStatus.loaded &&
|
|
129
|
-
this._status !== controllerStatus.disappeared)
|
|
128
|
+
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.disappeared)
|
|
130
129
|
return;
|
|
131
130
|
if (this._events.didAppear)
|
|
132
131
|
this._events.didAppear(this);
|
|
@@ -134,8 +133,7 @@ class BaseController {
|
|
|
134
133
|
}
|
|
135
134
|
disappear() {
|
|
136
135
|
// 只有status为loaded或者appeared,才可以运行
|
|
137
|
-
if (this._status !== controllerStatus.loaded &&
|
|
138
|
-
this._status !== controllerStatus.appeared)
|
|
136
|
+
if (this._status !== controllerStatus.loaded && this._status !== controllerStatus.appeared)
|
|
139
137
|
return;
|
|
140
138
|
if (this._events.didDisappear)
|
|
141
139
|
this._events.didDisappear(this);
|
|
@@ -101,9 +101,7 @@ class MaskView extends base_1.Base {
|
|
|
101
101
|
.$alloc()
|
|
102
102
|
.$initWithTarget_action(object, "swipeEvent");
|
|
103
103
|
swipeGestureRecognizer.$setDirection(1 << 1); // 从右向左划动
|
|
104
|
-
const tapGestureRecognizer = $objc("UITapGestureRecognizer")
|
|
105
|
-
.$alloc()
|
|
106
|
-
.$initWithTarget_action(object, "tapEvent");
|
|
104
|
+
const tapGestureRecognizer = $objc("UITapGestureRecognizer").$alloc().$initWithTarget_action(object, "tapEvent");
|
|
107
105
|
view.ocValue().$addGestureRecognizer(tapGestureRecognizer);
|
|
108
106
|
view.ocValue().$addGestureRecognizer(swipeGestureRecognizer);
|
|
109
107
|
}
|
|
@@ -188,10 +186,7 @@ class SplitViewController extends base_controller_1.BaseController {
|
|
|
188
186
|
make.left.equalTo(view.prev.right);
|
|
189
187
|
make.width.equalTo(view.super);
|
|
190
188
|
},
|
|
191
|
-
views: [
|
|
192
|
-
props.items[0].controller.rootView.definition,
|
|
193
|
-
this.cviews.maskView.definition,
|
|
194
|
-
],
|
|
189
|
+
views: [props.items[0].controller.rootView.definition, this.cviews.maskView.definition],
|
|
195
190
|
});
|
|
196
191
|
this._screenEdgePanGestureObject = this._defineGestureObject(() => {
|
|
197
192
|
if (!this.sideBarShown && this._canShowSidebar)
|
|
@@ -235,18 +230,13 @@ class SplitViewController extends base_controller_1.BaseController {
|
|
|
235
230
|
return object;
|
|
236
231
|
}
|
|
237
232
|
_renewScreenEdgePanGesture() {
|
|
238
|
-
const UIScreenEdgePanGestureRecognizer = $ui.controller.view
|
|
239
|
-
.ocValue()
|
|
240
|
-
.$gestureRecognizers()
|
|
241
|
-
.$firstObject();
|
|
233
|
+
const UIScreenEdgePanGestureRecognizer = $ui.controller.view.ocValue().$gestureRecognizers().$firstObject();
|
|
242
234
|
UIScreenEdgePanGestureRecognizer.invoke("removeTarget:action:", null, null);
|
|
243
235
|
const NewUIScreenEdgePanGestureRecognizer = $objc("UIScreenEdgePanGestureRecognizer")
|
|
244
236
|
.$alloc()
|
|
245
237
|
.$initWithTarget_action(this._screenEdgePanGestureObject, "screenEdgePanEvent");
|
|
246
238
|
NewUIScreenEdgePanGestureRecognizer.$setEdges(1 << 1);
|
|
247
|
-
this.rootView.view
|
|
248
|
-
.ocValue()
|
|
249
|
-
.$addGestureRecognizer(NewUIScreenEdgePanGestureRecognizer);
|
|
239
|
+
this.rootView.view.ocValue().$addGestureRecognizer(NewUIScreenEdgePanGestureRecognizer);
|
|
250
240
|
}
|
|
251
241
|
_showSideBar() {
|
|
252
242
|
this.cviews.secondaryView.show();
|
|
@@ -51,8 +51,7 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
51
51
|
changed: (cview, index) => {
|
|
52
52
|
var _a, _b;
|
|
53
53
|
this.index = index;
|
|
54
|
-
(_a = this._props.items
|
|
55
|
-
.find((item) => item.controller.status === 2)) === null || _a === void 0 ? void 0 : _a.controller.disappear();
|
|
54
|
+
(_a = this._props.items.find((item) => item.controller.status === 2)) === null || _a === void 0 ? void 0 : _a.controller.disappear();
|
|
56
55
|
this._props.items[index].controller.appear();
|
|
57
56
|
(_b = events.changed) === null || _b === void 0 ? void 0 : _b.call(events, this, index);
|
|
58
57
|
},
|
|
@@ -90,8 +89,7 @@ class TabBarController extends base_controller_1.BaseController {
|
|
|
90
89
|
n.view.hidden = i !== num;
|
|
91
90
|
});
|
|
92
91
|
this._props.index = num;
|
|
93
|
-
(_a = this._props.items
|
|
94
|
-
.find((item) => item.controller.status === 2)) === null || _a === void 0 ? void 0 : _a.controller.disappear();
|
|
92
|
+
(_a = this._props.items.find((item) => item.controller.status === 2)) === null || _a === void 0 ? void 0 : _a.controller.disappear();
|
|
95
93
|
this._props.items[num].controller.appear();
|
|
96
94
|
}
|
|
97
95
|
get index() {
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const dialog_sheet_1 = require("../components/dialogs/dialog-sheet");
|
|
13
|
+
const single_views_1 = require("../components/single-views");
|
|
14
|
+
const cview = new single_views_1.ContentView({
|
|
15
|
+
props: {
|
|
16
|
+
bgcolor: $color("lightGray"),
|
|
17
|
+
},
|
|
18
|
+
layout: $layout.fill,
|
|
19
|
+
});
|
|
20
|
+
$ui.render({
|
|
21
|
+
views: [
|
|
22
|
+
{
|
|
23
|
+
type: "button",
|
|
24
|
+
props: {
|
|
25
|
+
title: "Show Dialog Sheet",
|
|
26
|
+
},
|
|
27
|
+
layout: $layout.center,
|
|
28
|
+
events: {
|
|
29
|
+
tapped: () => __awaiter(void 0, void 0, void 0, function* () {
|
|
30
|
+
const sheet = new dialog_sheet_1.DialogSheet({
|
|
31
|
+
title: "Dialog Sheet",
|
|
32
|
+
cview,
|
|
33
|
+
doneHandler: () => {
|
|
34
|
+
$ui.alert("Done");
|
|
35
|
+
},
|
|
36
|
+
presentMode: 1,
|
|
37
|
+
bgcolor: $color("white"),
|
|
38
|
+
doneButtonHidden: false,
|
|
39
|
+
doneButtonValidator: () => {
|
|
40
|
+
return true;
|
|
41
|
+
},
|
|
42
|
+
doneButtonTitle: "完成",
|
|
43
|
+
});
|
|
44
|
+
yield sheet.present();
|
|
45
|
+
}),
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
});
|
|
@@ -57,8 +57,7 @@ const matrix = new dynamic_itemsize_matrix_1.DynamicItemSizeMatrix({
|
|
|
57
57
|
matrix.columns;
|
|
58
58
|
console.log(sender.contentOffset.y);
|
|
59
59
|
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)));
|
|
60
|
-
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)) *
|
|
61
|
-
matrix.columns);
|
|
60
|
+
console.log(Math.ceil(sender.contentOffset.y / (matrix.itemSize.height + 5)) * matrix.columns);
|
|
62
61
|
},
|
|
63
62
|
},
|
|
64
63
|
});
|
package/dist/test/flowlayout.js
CHANGED
|
@@ -19,11 +19,7 @@ class FlowlayoutItem extends single_views_1.Label {
|
|
|
19
19
|
}
|
|
20
20
|
const flowlayout = new flowlayout_1.Flowlayout({
|
|
21
21
|
props: {
|
|
22
|
-
items: [
|
|
23
|
-
new FlowlayoutItem("Hello"),
|
|
24
|
-
new FlowlayoutItem("World"),
|
|
25
|
-
new FlowlayoutItem("Flowlayout"),
|
|
26
|
-
],
|
|
22
|
+
items: [new FlowlayoutItem("Hello"), new FlowlayoutItem("World"), new FlowlayoutItem("Flowlayout")],
|
|
27
23
|
spacing: 10,
|
|
28
24
|
itemHeight: 30,
|
|
29
25
|
fixedRows: 2,
|
package/dist/utils/path.js
CHANGED
|
@@ -34,10 +34,7 @@ function split(path) {
|
|
|
34
34
|
return [protocol + "/", remainingPath.slice(1)];
|
|
35
35
|
}
|
|
36
36
|
else {
|
|
37
|
-
return [
|
|
38
|
-
protocol + remainingPath.slice(0, lastIndex),
|
|
39
|
-
remainingPath.slice(lastIndex + 1),
|
|
40
|
-
];
|
|
37
|
+
return [protocol + remainingPath.slice(0, lastIndex), remainingPath.slice(lastIndex + 1)];
|
|
41
38
|
}
|
|
42
39
|
}
|
|
43
40
|
exports.split = split;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jsbox-cview",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "为 JSBox 设计的微型框架",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"@types/node": "^20.11.17",
|
|
21
21
|
"browserify": "^17.0.1",
|
|
22
|
-
"jsbox-types": "^2.0.
|
|
22
|
+
"jsbox-types": "^2.0.3",
|
|
23
23
|
"prettier": "^3.8.1"
|
|
24
24
|
}
|
|
25
25
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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
|
+
});
|