jsbox-cview 1.1.0 → 1.1.2

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.
@@ -97,7 +97,7 @@ export interface NavigationBarProps {
97
97
  }
98
98
 
99
99
  interface BarButtonItem {
100
- cview?: Base<AllUIView, UiTypes.AllViewOptions>;
100
+ cview?: Base<any, any>;
101
101
  width?: number;
102
102
  title?: string;
103
103
  symbol?: string;
@@ -28,6 +28,7 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
28
28
  bgcolor?: UIColor;
29
29
  }
30
30
  _done: boolean;
31
+ private _navbar?: CustomNavigationBar;
31
32
  resolve?: (value: any) => void;
32
33
  reject?: (reason: any) => void;
33
34
 
@@ -55,7 +56,7 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
55
56
  this._dismissalHandler = () => {
56
57
  if (!this._done && this.reject) this.reject("cancel");
57
58
  };
58
- const _navbar = new CustomNavigationBar({
59
+ this._navbar = new CustomNavigationBar({
59
60
  props: {
60
61
  title: this._props.title,
61
62
  leftBarButtonItems: [
@@ -73,7 +74,7 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
73
74
  };
74
75
  this._cview = new ContentView({
75
76
  props: { bgcolor: $color("clear") },
76
- views: [_navbar.definition, this._props.cview.definition]
77
+ views: [this._navbar.definition, this._props.cview.definition]
77
78
  });
78
79
  super.present();
79
80
  }
@@ -84,4 +85,13 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
84
85
  this.resolve(this._props.doneHandler());
85
86
  this.dismiss();
86
87
  }
88
+
89
+ get title() {
90
+ return this._props.title;
91
+ }
92
+
93
+ set title(title: string) {
94
+ this._props.title = title;
95
+ if (this._navbar) this._navbar.title = title;
96
+ }
87
97
  }
@@ -15,11 +15,11 @@
15
15
 
16
16
  import { Base } from "./base";
17
17
 
18
- interface CunstomProps extends UiTypes.ButtonProps {
18
+ interface SymbolButtonProps extends UiTypes.ButtonProps {
19
19
  insets: JBInsets
20
20
  }
21
21
 
22
- interface CunstomPropsOptional extends UiTypes.ButtonProps {
22
+ interface SymbolButtonPropsOptional extends UiTypes.ButtonProps {
23
23
  insets?: JBInsets
24
24
  }
25
25
  /**
@@ -33,17 +33,15 @@ interface CunstomPropsOptional extends UiTypes.ButtonProps {
33
33
  * - tapped
34
34
  */
35
35
  export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
36
- _props: CunstomProps
37
- _layout: (make: MASConstraintMaker, view: UIButtonView) => void
38
- _events: UiTypes.BaseViewEvents<UIButtonView>
36
+ _props: SymbolButtonProps
39
37
  _defineView: () => UiTypes.ButtonOptions;
40
38
  constructor({
41
39
  props,
42
40
  layout,
43
41
  events = {}
44
42
  }: {
45
- props: CunstomPropsOptional;
46
- layout: (make: MASConstraintMaker, view: UIButtonView) => void;
43
+ props: SymbolButtonPropsOptional;
44
+ layout?: (make: MASConstraintMaker, view: UIButtonView) => void;
47
45
  events?: UiTypes.BaseViewEvents<UIButtonView>;
48
46
  }) {
49
47
  super();
@@ -52,8 +50,6 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
52
50
  tintColor: $color("primaryText"),
53
51
  ...props
54
52
  };
55
- this._layout = layout;
56
- this._events = events;
57
53
  this._defineView = () => {
58
54
  return {
59
55
  type: "button",
@@ -80,10 +76,8 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
80
76
  }
81
77
  }
82
78
  ],
83
- layout: this._layout,
84
- events: {
85
- ...this._events
86
- }
79
+ layout,
80
+ events
87
81
  };
88
82
  }
89
83
  }
@@ -35,7 +35,7 @@ class DialogSheet extends sheet_1.Sheet {
35
35
  if (!this._done && this.reject)
36
36
  this.reject("cancel");
37
37
  };
38
- const _navbar = new custom_navigation_bar_1.CustomNavigationBar({
38
+ this._navbar = new custom_navigation_bar_1.CustomNavigationBar({
39
39
  props: {
40
40
  title: this._props.title,
41
41
  leftBarButtonItems: [
@@ -53,7 +53,7 @@ class DialogSheet extends sheet_1.Sheet {
53
53
  };
54
54
  this._cview = new single_views_1.ContentView({
55
55
  props: { bgcolor: $color("clear") },
56
- views: [_navbar.definition, this._props.cview.definition]
56
+ views: [this._navbar.definition, this._props.cview.definition]
57
57
  });
58
58
  super.present();
59
59
  }
@@ -63,5 +63,13 @@ class DialogSheet extends sheet_1.Sheet {
63
63
  this.resolve(this._props.doneHandler());
64
64
  this.dismiss();
65
65
  }
66
+ get title() {
67
+ return this._props.title;
68
+ }
69
+ set title(title) {
70
+ this._props.title = title;
71
+ if (this._navbar)
72
+ this._navbar.title = title;
73
+ }
66
74
  }
67
75
  exports.DialogSheet = DialogSheet;
@@ -30,8 +30,6 @@ class SymbolButton extends base_1.Base {
30
30
  constructor({ props, layout, events = {} }) {
31
31
  super();
32
32
  this._props = Object.assign({ insets: $insets(12.5, 12.5, 12.5, 12.5), tintColor: $color("primaryText") }, props);
33
- this._layout = layout;
34
- this._events = events;
35
33
  this._defineView = () => {
36
34
  return {
37
35
  type: "button",
@@ -58,8 +56,8 @@ class SymbolButton extends base_1.Base {
58
56
  }
59
57
  }
60
58
  ],
61
- layout: this._layout,
62
- events: Object.assign({}, this._events)
59
+ layout,
60
+ events
63
61
  };
64
62
  };
65
63
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsbox-cview",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "为 JSBox 设计的微型框架",
5
5
  "repository": {
6
6
  "type": "git",