pixuireactcomponents 1.1.8 → 1.1.9

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/README.md CHANGED
@@ -1,3 +1,8 @@
1
1
  # 组件库
2
+
2
3
  本组件库目前分为2大类:ui组件和工具组件。分别参见目录ui/和目录tools。
3
- 具体组件说明,参见对应类别目录下的md文档
4
+ 具体组件说明,参见对应类别目录下的md文档
5
+
6
+ # 文档
7
+
8
+ 组件详情请查看https://iwiki.woa.com/pages/viewpage.action?pageId=548726653
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "pixuireactcomponents",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "description": "pixui react components",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
8
8
  },
9
- "author": "nepdai",
9
+ "author": "hardenzheng",
10
10
  "license": "ISC"
11
11
  }
@@ -35,18 +35,8 @@ export interface OutlineTextProps {
35
35
  alignByGeometry?: boolean;
36
36
  horizontalOverflow?: HorizontalWrapMode;
37
37
  verticalOverflow?: VerticalWrapMode;
38
- color: {
39
- r: number;
40
- g: number;
41
- b: number;
42
- a: number;
43
- };
44
- outlineColor: {
45
- r: number;
46
- g: number;
47
- b: number;
48
- a: number;
49
- };
38
+ color: string;
39
+ outlineColor: string;
50
40
  outlineDistance: {
51
41
  x: number;
52
42
  y: number;
@@ -67,18 +57,8 @@ export declare class OutlineText extends Component<OutlineTextProps, OutlineText
67
57
  alignByGeometry: boolean;
68
58
  horizontalOverflow: HorizontalWrapMode;
69
59
  verticalOverflow: VerticalWrapMode;
70
- color: {
71
- r: number;
72
- g: number;
73
- b: number;
74
- a: number;
75
- };
76
- outlineColor: {
77
- r: number;
78
- g: number;
79
- b: number;
80
- a: number;
81
- };
60
+ color: string;
61
+ outlineColor: string;
82
62
  outlineDistance: {
83
63
  x: number;
84
64
  y: number;
@@ -86,6 +66,7 @@ export declare class OutlineText extends Component<OutlineTextProps, OutlineText
86
66
  };
87
67
  componentDidUpdate(): void;
88
68
  OnLoad: (e: any) => void;
69
+ colorRgb(colorStr: any): any;
89
70
  updateOutlineText(): void;
90
71
  render(): h.JSX.Element;
91
72
  }
@@ -83,6 +83,38 @@ var OutlineText = /** @class */ (function (_super) {
83
83
  console.log('componentDidUpdate');
84
84
  this.updateOutlineText();
85
85
  };
86
+ OutlineText.prototype.colorRgb = function (colorStr) {
87
+ //十六进制颜色值的正则表达式
88
+ var reg = /^#([0-9a-fA-f]{0,}|)$/;
89
+ var matchRes = colorStr.toString().toLowerCase().match(reg);
90
+ var transColor = '';
91
+ if (matchRes.length > 0)
92
+ transColor = matchRes[matchRes.length - 1];
93
+ // eslint-disable-next-line @typescript-eslint/no-array-constructor
94
+ var colorList = new Array();
95
+ while (transColor != '') {
96
+ var hex = '0x' + transColor.substring(0, 2);
97
+ colorList.push(parseInt(hex, 16));
98
+ transColor = transColor.substring(2, transColor.length);
99
+ }
100
+ var r, g, b, a = 1;
101
+ for (var i = 0; i < colorList.length; i++) {
102
+ if (i == 0 && colorList[i] != null && colorList[i] != undefined) {
103
+ r = colorList[i] / 255;
104
+ }
105
+ if (i == 1 && colorList[i] != null && colorList[i] != undefined) {
106
+ g = colorList[i] / 255;
107
+ }
108
+ if (i == 2 && colorList[i] != null && colorList[i] != undefined) {
109
+ b = colorList[i] / 255;
110
+ }
111
+ if (i == 3 && colorList[i] != null && colorList[i] != undefined) {
112
+ a = colorList[i] / 255;
113
+ }
114
+ }
115
+ var CS = window.require('csharp');
116
+ return CS.UnityEngine.Color(r, g, b, a);
117
+ };
86
118
  OutlineText.prototype.updateOutlineText = function () {
87
119
  var CS = window.require('csharp');
88
120
  this.text.text = this.props.text;
@@ -94,13 +126,13 @@ var OutlineText = /** @class */ (function (_super) {
94
126
  this.text.alignByGeometry = this.props.alignByGeometry;
95
127
  this.text.horizontalOverflow = this.props.horizontalOverflow;
96
128
  this.text.verticalOverflow = this.props.verticalOverflow;
97
- this.text.color = CS.UnityEngine.Color(this.props.color.r, this.props.color.g, this.props.color.b, this.props.color.a);
98
- this.outline.effectColor = new CS.UnityEngine.Color(this.props.outlineColor.r, this.props.outlineColor.g, this.props.outlineColor.b, this.props.outlineColor.a);
129
+ this.text.color = this.colorRgb(this.props.color);
130
+ this.outline.effectColor = this.colorRgb(this.props.outlineColor);
99
131
  this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
100
132
  };
101
133
  OutlineText.prototype.render = function () {
102
134
  return (h("div", { style: this.props.style },
103
- h("pixslot", { style: { width: '100%', heigth: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad })));
135
+ h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
104
136
  };
105
137
  OutlineText.defaultProps = {
106
138
  style: defaultStyle,
@@ -113,18 +145,8 @@ var OutlineText = /** @class */ (function (_super) {
113
145
  alignByGeometry: false,
114
146
  horizontalOverflow: HorizontalWrapMode.Wrap,
115
147
  verticalOverflow: VerticalWrapMode.Truncate,
116
- color: {
117
- r: 1,
118
- g: 1,
119
- b: 1,
120
- a: 1
121
- },
122
- outlineColor: {
123
- r: 0,
124
- g: 0,
125
- b: 0,
126
- a: 1
127
- },
148
+ color: '#FFFFFF',
149
+ outlineColor: '#000000',
128
150
  outlineDistance: {
129
151
  x: 1,
130
152
  y: -1