jsbox-cview 1.5.1 → 1.5.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.
@@ -19,7 +19,7 @@ export class DialogSheet extends Sheet<ContentView, UIView, UiTypes.ViewOptions>
19
19
  _props: {
20
20
  title: string;
21
21
  cview: Base<any, any>;
22
- doneHandler?: () => void;
22
+ doneHandler?: () => any;
23
23
  presentMode?: number;
24
24
  bgcolor?: UIColor;
25
25
  doneButtonHidden?: boolean;
@@ -1,11 +1,14 @@
1
1
  import { Base } from "./base";
2
2
 
3
- interface SymbolButtonProps extends UiTypes.ButtonProps {
4
- insets: JBInsets
5
- }
6
-
7
- interface SymbolButtonPropsOptional extends UiTypes.ButtonProps {
8
- insets?: JBInsets
3
+ interface SymbolButtonProps {
4
+ enabled: boolean;
5
+ symbol?: string;
6
+ image?: UIImage;
7
+ src?: string;
8
+ tintColor: UIColor;
9
+ contentMode: number;
10
+ insets: JBInsets;
11
+ menu?: UiTypes.ContextMenuOptions
9
12
  }
10
13
 
11
14
  /**
@@ -26,12 +29,14 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
26
29
  layout,
27
30
  events = {}
28
31
  }: {
29
- props: SymbolButtonPropsOptional;
32
+ props: Partial<SymbolButtonProps>;
30
33
  layout?: (make: MASConstraintMaker, view: UIButtonView) => void;
31
34
  events?: UiTypes.BaseViewEvents<UIButtonView>;
32
35
  }) {
33
36
  super();
34
37
  this._props = {
38
+ enabled: true,
39
+ contentMode: 1,
35
40
  insets: $insets(12.5, 12.5, 12.5, 12.5),
36
41
  tintColor: $color("primaryText"),
37
42
  ...props
@@ -44,10 +49,12 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
44
49
  bgcolor: $color("clear"),
45
50
  id: this.id,
46
51
  menu: this._props.menu,
52
+ enabled: this._props.enabled
47
53
  } : {
48
54
  radius: 0,
49
55
  bgcolor: $color("clear"),
50
- id: this.id
56
+ id: this.id,
57
+ enabled: this._props.enabled
51
58
  }
52
59
  return {
53
60
  type: "button",
@@ -61,7 +68,7 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
61
68
  image: this._props.image,
62
69
  src: this._props.src,
63
70
  tintColor: this._props.tintColor,
64
- contentMode: 1
71
+ contentMode: this._props.contentMode
65
72
  },
66
73
  layout: (make, view: UIImageView) => {
67
74
  make.edges.insets(this._props.insets);
@@ -77,17 +84,18 @@ export class SymbolButton extends Base<UIButtonView, UiTypes.ButtonOptions> {
77
84
  }
78
85
 
79
86
  set tintColor(tintColor: UIColor) {
80
- const image = this.view.get("image") as UIImageView;
81
- image.tintColor = tintColor;
87
+ (this.view.get("image") as UIImageView).tintColor = tintColor;
88
+ }
89
+
90
+ set image(image: UIImage) {
91
+ (this.view.get("image") as UIImageView).image = image;
82
92
  }
83
93
 
84
- set symbol(symbol) {
85
- this._props.symbol = symbol;
86
- const image = this.view.get("image") as UIImageView;
87
- image.symbol = symbol;
94
+ set symbol(symbol: string) {
95
+ (this.view.get("image") as UIImageView).symbol = symbol;
88
96
  }
89
97
 
90
- get symbol() {
91
- return this._props.symbol;
98
+ set src(src: string) {
99
+ (this.view.get("image") as UIImageView).src = src;
92
100
  }
93
101
  }
@@ -15,7 +15,7 @@ const base_1 = require("./base");
15
15
  class SymbolButton extends base_1.Base {
16
16
  constructor({ props, layout, events = {} }) {
17
17
  super();
18
- this._props = Object.assign({ insets: $insets(12.5, 12.5, 12.5, 12.5), tintColor: $color("primaryText") }, props);
18
+ this._props = Object.assign({ enabled: true, contentMode: 1, insets: $insets(12.5, 12.5, 12.5, 12.5), tintColor: $color("primaryText") }, props);
19
19
  this._layout = layout;
20
20
  this._defineView = () => {
21
21
  const props = this._props.menu
@@ -24,10 +24,12 @@ class SymbolButton extends base_1.Base {
24
24
  bgcolor: $color("clear"),
25
25
  id: this.id,
26
26
  menu: this._props.menu,
27
+ enabled: this._props.enabled
27
28
  } : {
28
29
  radius: 0,
29
30
  bgcolor: $color("clear"),
30
- id: this.id
31
+ id: this.id,
32
+ enabled: this._props.enabled
31
33
  };
32
34
  return {
33
35
  type: "button",
@@ -41,7 +43,7 @@ class SymbolButton extends base_1.Base {
41
43
  image: this._props.image,
42
44
  src: this._props.src,
43
45
  tintColor: this._props.tintColor,
44
- contentMode: 1
46
+ contentMode: this._props.contentMode
45
47
  },
46
48
  layout: (make, view) => {
47
49
  make.edges.insets(this._props.insets);
@@ -56,16 +58,16 @@ class SymbolButton extends base_1.Base {
56
58
  };
57
59
  }
58
60
  set tintColor(tintColor) {
59
- const image = this.view.get("image");
60
- image.tintColor = tintColor;
61
+ this.view.get("image").tintColor = tintColor;
62
+ }
63
+ set image(image) {
64
+ this.view.get("image").image = image;
61
65
  }
62
66
  set symbol(symbol) {
63
- this._props.symbol = symbol;
64
- const image = this.view.get("image");
65
- image.symbol = symbol;
67
+ this.view.get("image").symbol = symbol;
66
68
  }
67
- get symbol() {
68
- return this._props.symbol;
69
+ set src(src) {
70
+ this.view.get("image").src = src;
69
71
  }
70
72
  }
71
73
  exports.SymbolButton = SymbolButton;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jsbox-cview",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "为 JSBox 设计的微型框架",
5
5
  "repository": {
6
6
  "type": "git",