jsbox-cview 1.2.2 → 1.2.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.
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
import { Base } from "./base";
|
|
55
|
-
import { ContentView, Label, Button } from "./single-views";
|
|
55
|
+
import { ContentView, Label, Button, Blur } from "./single-views";
|
|
56
56
|
import { SymbolButton } from "./symbol-button";
|
|
57
57
|
import { getTextWidth } from "../utils/uitools";
|
|
58
58
|
|
|
@@ -122,6 +122,8 @@ interface NavigationBarCViews {
|
|
|
122
122
|
titleViewWrapper?: ContentView | Label;
|
|
123
123
|
contentView?: ContentView;
|
|
124
124
|
toolViewWrapper?: ContentView;
|
|
125
|
+
bgview?: ContentView | Blur;
|
|
126
|
+
separator?: ContentView;
|
|
125
127
|
}
|
|
126
128
|
|
|
127
129
|
export class CustomNavigationBar extends Base<UIView | UIBlurView, UiTypes.ViewOptions | UiTypes.BlurOptions> {
|
|
@@ -318,19 +320,41 @@ export class CustomNavigationBar extends Base<UIView | UIBlurView, UiTypes.ViewO
|
|
|
318
320
|
},
|
|
319
321
|
views: this._props.toolView && [this._props.toolView.definition]
|
|
320
322
|
});
|
|
321
|
-
|
|
323
|
+
if (this._props.bgcolor) {
|
|
324
|
+
this.cviews.bgview = new ContentView({
|
|
325
|
+
props: {
|
|
326
|
+
bgcolor: this._props.bgcolor
|
|
327
|
+
},
|
|
328
|
+
layout: $layout.fill
|
|
329
|
+
});
|
|
330
|
+
} else {
|
|
331
|
+
this.cviews.bgview = new Blur({
|
|
332
|
+
props: {
|
|
333
|
+
style: 10
|
|
334
|
+
},
|
|
335
|
+
layout: $layout.fill
|
|
336
|
+
});
|
|
337
|
+
}
|
|
338
|
+
this.cviews.separator = new ContentView({
|
|
339
|
+
props: {
|
|
340
|
+
bgcolor: $color("separatorColor")
|
|
341
|
+
},
|
|
342
|
+
layout: (make, view) => {
|
|
343
|
+
make.bottom.left.right.inset(0);
|
|
344
|
+
make.height.equalTo(0.5);
|
|
345
|
+
}
|
|
346
|
+
});
|
|
322
347
|
return {
|
|
323
|
-
type:
|
|
348
|
+
type: "view",
|
|
324
349
|
props: {
|
|
325
350
|
id: this.id,
|
|
326
|
-
style: this._props.bgcolor ? undefined : 10,
|
|
327
|
-
bgcolor: this._props.bgcolor
|
|
328
351
|
},
|
|
329
352
|
layout: navBarLayouts[this._props.style],
|
|
330
353
|
events: {
|
|
331
354
|
ready: () => (this.style = this.style)
|
|
332
355
|
},
|
|
333
356
|
views: [
|
|
357
|
+
this.cviews.bgview.definition,
|
|
334
358
|
{
|
|
335
359
|
type: "view",
|
|
336
360
|
props: {},
|
|
@@ -340,16 +364,7 @@ export class CustomNavigationBar extends Base<UIView | UIBlurView, UiTypes.ViewO
|
|
|
340
364
|
this.cviews.toolViewWrapper.definition
|
|
341
365
|
]
|
|
342
366
|
},
|
|
343
|
-
|
|
344
|
-
type: "view",
|
|
345
|
-
props: {
|
|
346
|
-
bgcolor: $color("separatorColor")
|
|
347
|
-
},
|
|
348
|
-
layout: (make, view) => {
|
|
349
|
-
make.bottom.left.right.inset(0);
|
|
350
|
-
make.height.equalTo(0.5);
|
|
351
|
-
}
|
|
352
|
-
}
|
|
367
|
+
this.cviews.separator.definition
|
|
353
368
|
]
|
|
354
369
|
};
|
|
355
370
|
}
|
|
@@ -256,18 +256,42 @@ class CustomNavigationBar extends base_1.Base {
|
|
|
256
256
|
},
|
|
257
257
|
views: this._props.toolView && [this._props.toolView.definition]
|
|
258
258
|
});
|
|
259
|
+
if (this._props.bgcolor) {
|
|
260
|
+
this.cviews.bgview = new single_views_1.ContentView({
|
|
261
|
+
props: {
|
|
262
|
+
bgcolor: this._props.bgcolor
|
|
263
|
+
},
|
|
264
|
+
layout: $layout.fill
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
else {
|
|
268
|
+
this.cviews.bgview = new single_views_1.Blur({
|
|
269
|
+
props: {
|
|
270
|
+
style: 10
|
|
271
|
+
},
|
|
272
|
+
layout: $layout.fill
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
this.cviews.separator = new single_views_1.ContentView({
|
|
276
|
+
props: {
|
|
277
|
+
bgcolor: $color("separatorColor")
|
|
278
|
+
},
|
|
279
|
+
layout: (make, view) => {
|
|
280
|
+
make.bottom.left.right.inset(0);
|
|
281
|
+
make.height.equalTo(0.5);
|
|
282
|
+
}
|
|
283
|
+
});
|
|
259
284
|
return {
|
|
260
|
-
type:
|
|
285
|
+
type: "view",
|
|
261
286
|
props: {
|
|
262
287
|
id: this.id,
|
|
263
|
-
style: this._props.bgcolor ? undefined : 10,
|
|
264
|
-
bgcolor: this._props.bgcolor
|
|
265
288
|
},
|
|
266
289
|
layout: navBarLayouts[this._props.style],
|
|
267
290
|
events: {
|
|
268
291
|
ready: () => (this.style = this.style)
|
|
269
292
|
},
|
|
270
293
|
views: [
|
|
294
|
+
this.cviews.bgview.definition,
|
|
271
295
|
{
|
|
272
296
|
type: "view",
|
|
273
297
|
props: {},
|
|
@@ -277,16 +301,7 @@ class CustomNavigationBar extends base_1.Base {
|
|
|
277
301
|
this.cviews.toolViewWrapper.definition
|
|
278
302
|
]
|
|
279
303
|
},
|
|
280
|
-
|
|
281
|
-
type: "view",
|
|
282
|
-
props: {
|
|
283
|
-
bgcolor: $color("separatorColor")
|
|
284
|
-
},
|
|
285
|
-
layout: (make, view) => {
|
|
286
|
-
make.bottom.left.right.inset(0);
|
|
287
|
-
make.height.equalTo(0.5);
|
|
288
|
-
}
|
|
289
|
-
}
|
|
304
|
+
this.cviews.separator.definition
|
|
290
305
|
]
|
|
291
306
|
};
|
|
292
307
|
};
|
|
@@ -6,6 +6,11 @@ const navbar = new custom_navigation_bar_1.CustomNavigationBar({
|
|
|
6
6
|
title: "Custom Navigation Bar",
|
|
7
7
|
popButtonEnabled: true,
|
|
8
8
|
popButtonTitle: "Back",
|
|
9
|
+
rightBarButtonItems: [
|
|
10
|
+
{
|
|
11
|
+
symbol: "gear",
|
|
12
|
+
}
|
|
13
|
+
]
|
|
9
14
|
}
|
|
10
15
|
});
|
|
11
16
|
$ui.render({
|
|
@@ -18,6 +23,14 @@ $ui.render({
|
|
|
18
23
|
$ui.push({
|
|
19
24
|
views: [navbar.definition]
|
|
20
25
|
});
|
|
26
|
+
$delay(1, () => {
|
|
27
|
+
navbar.cviews.bgview.view.alpha = 0.5;
|
|
28
|
+
navbar.cviews.separator.view.alpha = 0.5;
|
|
29
|
+
});
|
|
30
|
+
$delay(2, () => {
|
|
31
|
+
navbar.cviews.bgview.view.alpha = 0;
|
|
32
|
+
navbar.cviews.separator.view.alpha = 0;
|
|
33
|
+
});
|
|
21
34
|
}
|
|
22
35
|
}
|
|
23
36
|
}]
|
package/package.json
CHANGED
|
@@ -5,6 +5,11 @@ const navbar = new CustomNavigationBar({
|
|
|
5
5
|
title: "Custom Navigation Bar",
|
|
6
6
|
popButtonEnabled: true,
|
|
7
7
|
popButtonTitle: "Back",
|
|
8
|
+
rightBarButtonItems: [
|
|
9
|
+
{
|
|
10
|
+
symbol: "gear",
|
|
11
|
+
}
|
|
12
|
+
]
|
|
8
13
|
}
|
|
9
14
|
})
|
|
10
15
|
|
|
@@ -20,6 +25,14 @@ $ui.render({
|
|
|
20
25
|
$ui.push({
|
|
21
26
|
views: [navbar.definition]
|
|
22
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
|
+
})
|
|
23
36
|
}
|
|
24
37
|
}
|
|
25
38
|
}]
|