pixuireactcomponents 1.3.24 → 1.3.26
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/index.d.ts +1 -1
- package/lib/check/{util.jsx → util.js} +33 -39
- package/lib/preact-router/match/src/index.js +16 -7
- package/package.json +1 -1
- package/src/components/react/app/bulletscreen/BulletItemAnimation.d.ts +2 -2
- package/src/components/react/app/bulletscreen/{BulletItemAnimation.jsx → BulletItemAnimation.js} +7 -8
- package/src/components/react/app/bulletscreen/BulletScreenAnimation.d.ts +2 -2
- package/src/components/react/app/bulletscreen/{BulletScreenAnimation.jsx → BulletScreenAnimation.js} +8 -11
- package/src/components/react/app/button/{Button.jsx → Button.js} +6 -8
- package/src/components/react/app/carousel/Carousel.d.ts +1 -1
- package/src/components/react/app/carousel/{Carousel.jsx → Carousel.js} +29 -70
- package/src/components/react/app/checkBox/{CheckBox.jsx → CheckBox.js} +1 -1
- package/src/components/react/app/dropdown/{Dropdown.jsx → Dropdown.js} +5 -9
- package/src/components/react/app/imageViewer/{imageViewer.jsx → imageViewer.js} +7 -11
- package/src/components/react/app/slider/Slider.d.ts +55 -21
- package/src/components/react/app/slider/{Slider.jsx → Slider.js} +152 -96
- package/src/components/react/app/togglegroup/{ToggleGroup.jsx → ToggleGroup.js} +16 -18
- package/src/components/react/base/gradient/{GradientText.jsx → GradientText.js} +1 -1
- package/src/components/react/base/outlinetext/{OutlineText.jsx → OutlineText.js} +2 -3
- package/src/components/react/base/pixVideo/PixPlaceHolder.d.ts +2 -2
- package/src/components/react/base/pixVideo/{PixPlaceHolder.jsx → PixPlaceHolder.js} +3 -5
- package/src/sample/Images.d.ts +0 -31
- package/src/sample/Images.js +0 -60
- package/src/sample/OutlineText/OutlineDemo.d.ts +0 -20
- package/src/sample/OutlineText/OutlineDemo.jsx +0 -60
- package/src/sample/bulletscreen/BulletDemo.d.ts +0 -12
- package/src/sample/bulletscreen/BulletDemo.jsx +0 -83
- package/src/sample/button/ButtonDemo.d.ts +0 -4
- package/src/sample/button/ButtonDemo.jsx +0 -30
- package/src/sample/carousel/carouselDemo.d.ts +0 -1
- package/src/sample/carousel/carouselDemo.jsx +0 -107
- package/src/sample/checkBox/checkBoxDemo.d.ts +0 -1
- package/src/sample/checkBox/checkBoxDemo.jsx +0 -23
- package/src/sample/dropdown/DropdownDemo.d.ts +0 -6
- package/src/sample/dropdown/DropdownDemo.jsx +0 -65
- package/src/sample/dropdown/MoneyDropdownOption.d.ts +0 -6
- package/src/sample/dropdown/MoneyDropdownOption.jsx +0 -57
- package/src/sample/dropdown/MoneyDropdownSpreadMain.d.ts +0 -5
- package/src/sample/dropdown/MoneyDropdownSpreadMain.jsx +0 -50
- package/src/sample/dropdown/MoneyDropdownUnspreadMain.d.ts +0 -5
- package/src/sample/dropdown/MoneyDropdownUnspreadMain.jsx +0 -50
- package/src/sample/gradient/GradientDemo.d.ts +0 -16
- package/src/sample/gradient/GradientDemo.jsx +0 -53
- package/src/sample/imageViewer/Images.d.ts +0 -4
- package/src/sample/imageViewer/Images.jsx +0 -6
- package/src/sample/imageViewer/imageViewerDemo.d.ts +0 -10
- package/src/sample/imageViewer/imageViewerDemo.jsx +0 -70
- package/src/sample/slider/SliderDemo.d.ts +0 -10
- package/src/sample/slider/SliderDemo.jsx +0 -117
- package/src/sample/togglegroup/ToggleGroupDemo.d.ts +0 -4
- package/src/sample/togglegroup/ToggleGroupDemo.jsx +0 -64
- package/tsconfig.json +0 -55
- /package/lib/check/{main.jsx → main.js} +0 -0
- /package/lib/pi_component/tinyList/{tinyList.jsx → tinyList.js} +0 -0
- /package/src/components/react/app/dropdown/{DropdownOptionUI.jsx → DropdownOptionUI.js} +0 -0
- /package/src/components/react/app/dropdown/{DropdownSpreadMainUI.jsx → DropdownSpreadMainUI.js} +0 -0
- /package/src/components/react/app/dropdown/{DropdownUnspreadMainUI.jsx → DropdownUnspreadMainUI.js} +0 -0
- /package/src/components/react/base/pixVideo/{PixVideo.jsx → PixVideo.js} +0 -0
- /package/src/components/tools/{Logger.jsx → Logger.js} +0 -0
|
@@ -24,6 +24,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
24
24
|
};
|
|
25
25
|
return __assign.apply(this, arguments);
|
|
26
26
|
};
|
|
27
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
28
|
+
var t = {};
|
|
29
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
30
|
+
t[p] = s[p];
|
|
31
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
32
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
33
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
34
|
+
t[p[i]] = s[p[i]];
|
|
35
|
+
}
|
|
36
|
+
return t;
|
|
37
|
+
};
|
|
27
38
|
import { Component, createRef, h } from 'preact';
|
|
28
39
|
var rowCenterCenter = {
|
|
29
40
|
display: 'flex',
|
|
@@ -37,54 +48,46 @@ var rowBetweenCenter = {
|
|
|
37
48
|
justifyContent: 'space-between',
|
|
38
49
|
alignItems: 'center'
|
|
39
50
|
};
|
|
40
|
-
var
|
|
41
|
-
var outerStyle;
|
|
42
|
-
var innerStyle;
|
|
43
|
-
var dotStyle;
|
|
44
|
-
var dotWrapperStyle;
|
|
45
|
-
var incButtonStyle;
|
|
46
|
-
var decButtonStyle;
|
|
47
|
-
var withButtonStyle;
|
|
48
|
-
var lastX = undefined; // 上一次位置的横坐标
|
|
49
|
-
var count = 0; // 拖动条距离最左端的位置 [0, this.props.wrapperWidth]
|
|
50
|
-
var rect = undefined; // 滑动区域
|
|
51
|
-
var Slider = /** @class */ (function (_super) {
|
|
51
|
+
export var Slider = /** @class */ (function (_super) {
|
|
52
52
|
__extends(Slider, _super);
|
|
53
53
|
function Slider(props) {
|
|
54
54
|
var _this = _super.call(this, props) || this;
|
|
55
|
+
_this.lastX = undefined; // 上一次位置的横坐标
|
|
56
|
+
_this.count = 0; // 拖动条距离最左端的位置 [0, this.props.wrapperWidth]
|
|
57
|
+
_this.rect = undefined; // 滑动区域
|
|
55
58
|
_this.discrete = Math.round(_this.props.discrete == null ? 0 : _this.props.discrete);
|
|
56
59
|
_this.refWrapper = createRef();
|
|
60
|
+
//====================================================================================================
|
|
61
|
+
//事件相关
|
|
57
62
|
_this.onDragStart = function (event) {
|
|
58
63
|
console.log('【Slider】DragStart event.clientX--' + event.clientX + '-----percent----' + _this.state.percent + '-----currentX----' + (_this.state.percent / 10000 * _this.props.wrapperWidth));
|
|
59
|
-
lastX = event.clentX;
|
|
60
|
-
count = _this.state.percent / 10000 * _this.props.wrapperWidth;
|
|
64
|
+
_this.lastX = event.clentX;
|
|
65
|
+
_this.count = _this.state.percent / 10000 * _this.props.wrapperWidth;
|
|
66
|
+
_this.setState({
|
|
67
|
+
onDraging: true,
|
|
68
|
+
});
|
|
61
69
|
if (_this.props.onDragStart) {
|
|
62
70
|
_this.props.onDragStart();
|
|
63
71
|
}
|
|
64
72
|
};
|
|
65
73
|
_this.onDrag = function (event) {
|
|
66
|
-
if (event.clientX < rect.left - 50 || event.clientX > rect.right + 50)
|
|
74
|
+
if (event.clientX < _this.rect.left - 50 || event.clientX > _this.rect.right + 50)
|
|
67
75
|
return;
|
|
68
|
-
if (lastX == undefined) {
|
|
69
|
-
lastX = event.clientX;
|
|
76
|
+
if (_this.lastX == undefined) {
|
|
77
|
+
_this.lastX = event.clientX;
|
|
70
78
|
return;
|
|
71
79
|
}
|
|
72
|
-
var move = Number(event.clientX) - Number(lastX);
|
|
73
|
-
count += move;
|
|
74
|
-
count = Math.min(_this.props.wrapperWidth, count);
|
|
75
|
-
count = Math.max(0, count);
|
|
76
|
-
var newPercent = count / _this.props.wrapperWidth * 10000;
|
|
77
|
-
if (_this.props.isDiscrete == true
|
|
78
|
-
newPercent = count / _this.props.wrapperWidth * _this.props.maxDiscrete;
|
|
80
|
+
var move = Number(event.clientX) - Number(_this.lastX);
|
|
81
|
+
_this.count += move;
|
|
82
|
+
_this.count = Math.min(_this.props.wrapperWidth, _this.count);
|
|
83
|
+
_this.count = Math.max(0, _this.count);
|
|
84
|
+
var newPercent = _this.count / _this.props.wrapperWidth * 10000;
|
|
85
|
+
if (_this.props.isDiscrete == true) {
|
|
86
|
+
newPercent = _this.count / _this.props.wrapperWidth * _this.props.maxDiscrete;
|
|
79
87
|
_this.discrete = Math.round(newPercent);
|
|
80
|
-
// this.setState({
|
|
81
|
-
// discrete: Math.round(newPercent),
|
|
82
|
-
// })
|
|
83
88
|
if (_this.props.rangeControl) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
if (_this.props.startRange != null)
|
|
87
|
-
_this.discrete = Math.max(_this.discrete, _this.props.startRange);
|
|
89
|
+
_this.discrete = Math.min(_this.discrete, _this.props.endRange);
|
|
90
|
+
_this.discrete = Math.max(_this.discrete, _this.props.startRange);
|
|
88
91
|
}
|
|
89
92
|
newPercent = _this.discrete * (10000 / _this.props.maxDiscrete);
|
|
90
93
|
}
|
|
@@ -95,14 +98,15 @@ var Slider = /** @class */ (function (_super) {
|
|
|
95
98
|
if (_this.props.onDrag)
|
|
96
99
|
_this.props.onDrag(_this.props.isDiscrete ? _this.discrete : newPercent);
|
|
97
100
|
});
|
|
98
|
-
lastX = event.clientX;
|
|
101
|
+
_this.lastX = event.clientX;
|
|
99
102
|
};
|
|
100
103
|
_this.onDragEnd = function (event) {
|
|
101
|
-
lastX = undefined;
|
|
102
|
-
if (_this.props.isDiscrete == true
|
|
104
|
+
_this.lastX = undefined;
|
|
105
|
+
if (_this.props.isDiscrete == true) {
|
|
103
106
|
//console.log("OnDragEnd -----discrete----"+this.state.discrete)
|
|
104
107
|
_this.setState({
|
|
105
108
|
percent: _this.discrete * (10000 / _this.props.maxDiscrete),
|
|
109
|
+
onDraging: false
|
|
106
110
|
}, function () {
|
|
107
111
|
console.log('【Slider】DragEnd event.clientX--' + event.clientX + '-----percent----' + _this.state.percent + '-----discrete----' + _this.discrete + '-----currentX----' + (_this.state.percent / 10000 * _this.props.wrapperWidth));
|
|
108
112
|
if (_this.props.onDragEnd) {
|
|
@@ -112,22 +116,26 @@ var Slider = /** @class */ (function (_super) {
|
|
|
112
116
|
}
|
|
113
117
|
else {
|
|
114
118
|
console.log('【Slider】DragEnd event.clientX--' + event.clientX + '-----percent----' + _this.state.percent + '-----currentX----' + (_this.state.percent / 10000 * _this.props.wrapperWidth));
|
|
115
|
-
|
|
116
|
-
_this.
|
|
117
|
-
|
|
119
|
+
_this.setState({
|
|
120
|
+
percent: _this.count / _this.props.wrapperWidth * 10000,
|
|
121
|
+
onDraging: false
|
|
122
|
+
}, function () {
|
|
123
|
+
if (_this.props.onDragEnd) {
|
|
124
|
+
_this.props.onDragEnd(_this.props.isDiscrete ? _this.discrete : _this.state.percent);
|
|
125
|
+
}
|
|
126
|
+
});
|
|
118
127
|
}
|
|
119
128
|
};
|
|
120
129
|
_this.onDecClick = function () {
|
|
121
130
|
//离散的情况
|
|
122
|
-
if (_this.props.isDiscrete
|
|
131
|
+
if (_this.props.isDiscrete) {
|
|
123
132
|
if (_this.discrete >= 1) {
|
|
124
133
|
_this.discrete -= 1;
|
|
125
|
-
if (_this.props.rangeControl
|
|
134
|
+
if (_this.props.rangeControl) {
|
|
126
135
|
_this.discrete = Math.max(_this.discrete, _this.props.startRange);
|
|
127
136
|
}
|
|
128
137
|
var newPercent = _this.discrete * (10000 / _this.props.maxDiscrete);
|
|
129
138
|
_this.setState({
|
|
130
|
-
//discrete: this.state.discrete - 1,
|
|
131
139
|
percent: newPercent
|
|
132
140
|
}, function () {
|
|
133
141
|
if (_this.props.onDecClick) {
|
|
@@ -151,10 +159,10 @@ var Slider = /** @class */ (function (_super) {
|
|
|
151
159
|
};
|
|
152
160
|
_this.onIncClick = function () {
|
|
153
161
|
//离散的情况
|
|
154
|
-
if (_this.props.isDiscrete
|
|
162
|
+
if (_this.props.isDiscrete) {
|
|
155
163
|
if (_this.discrete < _this.props.maxDiscrete) {
|
|
156
164
|
_this.discrete += 1;
|
|
157
|
-
if (_this.props.rangeControl
|
|
165
|
+
if (_this.props.rangeControl) {
|
|
158
166
|
_this.discrete = Math.max(_this.discrete, _this.props.startRange);
|
|
159
167
|
}
|
|
160
168
|
var newPercent = _this.discrete * (10000 / _this.props.maxDiscrete);
|
|
@@ -181,11 +189,14 @@ var Slider = /** @class */ (function (_super) {
|
|
|
181
189
|
}
|
|
182
190
|
}
|
|
183
191
|
};
|
|
184
|
-
|
|
185
|
-
|
|
192
|
+
//====================================================================================================
|
|
193
|
+
//样式相关
|
|
194
|
+
_this.wrapperStyle = function () {
|
|
195
|
+
var wrapperStyle = __assign({ width: _this.props.wrapperWidth + 'px', height: _this.props.wrapperHeight + 'px' }, rowCenterCenter);
|
|
196
|
+
return wrapperStyle;
|
|
186
197
|
};
|
|
187
|
-
_this.
|
|
188
|
-
outerStyle = {
|
|
198
|
+
_this.outerStyle = function () {
|
|
199
|
+
var outerStyle = {
|
|
189
200
|
width: '100%',
|
|
190
201
|
height: _this.props.height + 'px',
|
|
191
202
|
backgroundImage: "url(".concat(_this.props.outerBg, ")"),
|
|
@@ -195,11 +206,11 @@ var Slider = /** @class */ (function (_super) {
|
|
|
195
206
|
justifyContent: 'start',
|
|
196
207
|
alignItems: 'center'
|
|
197
208
|
};
|
|
209
|
+
return outerStyle;
|
|
198
210
|
};
|
|
199
|
-
_this.
|
|
200
|
-
var
|
|
201
|
-
|
|
202
|
-
width: innerWidth,
|
|
211
|
+
_this.innerStyle = function () {
|
|
212
|
+
var innerStyle = {
|
|
213
|
+
// width: innerWidth,
|
|
203
214
|
height: (_this.props.innerHeight != null) ? _this.props.innerHeight + 'px' : '100%',
|
|
204
215
|
backgroundImage: "url(".concat(_this.props.innerBg, ")"),
|
|
205
216
|
backgroundSize: '100% 100%',
|
|
@@ -208,88 +219,133 @@ var Slider = /** @class */ (function (_super) {
|
|
|
208
219
|
justifyContent: 'start',
|
|
209
220
|
alignItems: 'center'
|
|
210
221
|
};
|
|
222
|
+
return innerStyle;
|
|
211
223
|
};
|
|
212
|
-
_this.
|
|
213
|
-
dotWrapperStyle = __assign({ position: 'absolute', width: _this.props.dotWrapperWidth + 'px', height: _this.props.dotWrapperHeight + 'px',
|
|
214
|
-
//marginTop: (this.props.height - this.props.dotWrapperHeight) / 2 + "px",
|
|
215
|
-
marginLeft: (_this.props.wrapperWidth * _this.state.percent / 10000 - _this.props.dotWrapperWidth / 2) + 'px' }, rowCenterCenter
|
|
224
|
+
_this.dotWrapperStyle = function () {
|
|
225
|
+
var dotWrapperStyle = __assign({ position: 'absolute', width: _this.props.dotWrapperWidth + 'px', height: _this.props.dotWrapperHeight + 'px' }, rowCenterCenter
|
|
216
226
|
// backgroundColor: '#FF000066'
|
|
217
227
|
);
|
|
228
|
+
return dotWrapperStyle;
|
|
218
229
|
};
|
|
219
|
-
_this.
|
|
220
|
-
dotStyle = {
|
|
230
|
+
_this.dotStyle = function () {
|
|
231
|
+
var dotStyle = {
|
|
221
232
|
width: _this.props.dotWidth + 'px',
|
|
222
233
|
height: _this.props.dotHeight + 'px',
|
|
223
234
|
};
|
|
235
|
+
return dotStyle;
|
|
224
236
|
};
|
|
225
|
-
_this.
|
|
226
|
-
incButtonStyle = {
|
|
237
|
+
_this.incButtonStyle = function () {
|
|
238
|
+
var incButtonStyle = {
|
|
227
239
|
width: _this.props.incButtonWidth + 'px',
|
|
228
240
|
height: _this.props.incButtonHeight + 'px',
|
|
229
241
|
//marginLeft:this.props.incButtonLeft+"px",
|
|
230
242
|
//backgroundImage: `url(${this.props.incButtonBg})`,
|
|
231
243
|
};
|
|
244
|
+
return incButtonStyle;
|
|
232
245
|
};
|
|
233
|
-
_this.
|
|
234
|
-
decButtonStyle = {
|
|
246
|
+
_this.decButtonStyle = function () {
|
|
247
|
+
var decButtonStyle = {
|
|
235
248
|
width: _this.props.decButtonWidth + 'px',
|
|
236
249
|
height: _this.props.decButtonHeight + 'px',
|
|
237
250
|
//marginRight:this.props.decButtonRight+"px",
|
|
238
251
|
//backgroundImage: `url(${this.props.decButtonBg})`,
|
|
239
252
|
};
|
|
253
|
+
return decButtonStyle;
|
|
240
254
|
};
|
|
241
|
-
_this.
|
|
242
|
-
withButtonStyle = __assign({ minWidth: _this.props.overallWidth + 'px' }, rowBetweenCenter);
|
|
255
|
+
_this.withButtonStyle = function () {
|
|
256
|
+
var withButtonStyle = __assign({ minWidth: _this.props.overallWidth + 'px' }, rowBetweenCenter);
|
|
257
|
+
return withButtonStyle;
|
|
243
258
|
};
|
|
244
259
|
_this.state = {
|
|
245
|
-
percent:
|
|
246
|
-
|
|
260
|
+
percent: props.isDiscrete ? _this.props.discrete * (10000 / _this.props.maxDiscrete) : Math.floor(_this.props.percent),
|
|
261
|
+
onDraging: false,
|
|
262
|
+
wrapperStyle: _this.wrapperStyle(),
|
|
263
|
+
outerStyle: _this.outerStyle(),
|
|
264
|
+
innerStyle: _this.innerStyle(),
|
|
265
|
+
dotStyle: _this.dotStyle(),
|
|
266
|
+
dotWrapperStyle: _this.dotWrapperStyle(),
|
|
267
|
+
incButtonStyle: _this.incButtonStyle(),
|
|
268
|
+
decButtonStyle: _this.decButtonStyle(),
|
|
269
|
+
withButtonStyle: _this.withButtonStyle(),
|
|
247
270
|
};
|
|
248
|
-
_this.computeWrapperStyle();
|
|
249
|
-
_this.computeOuterStyle();
|
|
250
271
|
return _this;
|
|
251
272
|
}
|
|
273
|
+
//====================================================================================================
|
|
274
|
+
//生命周期相关
|
|
252
275
|
Slider.prototype.componentDidMount = function () {
|
|
253
|
-
rect = this.refWrapper.current.getBoundingClientRect();
|
|
276
|
+
this.rect = this.refWrapper.current.getBoundingClientRect();
|
|
254
277
|
};
|
|
255
278
|
Slider.prototype.componentWillReceiveProps = function (nextProps) {
|
|
256
|
-
if (
|
|
279
|
+
if (JSON.stringify(this.props) === JSON.stringify(nextProps))
|
|
257
280
|
return;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
281
|
+
//用于标识位置的props和其他样式相关的props分开比较
|
|
282
|
+
var _a = this.props, percent = _a.percent, discrete = _a.discrete, styleProps = __rest(_a, ["percent", "discrete"]);
|
|
283
|
+
var nextPercent = nextProps.percent, nextDiscrete = nextProps.discrete, nextstyleProps = __rest(nextProps, ["percent", "discrete"]);
|
|
284
|
+
//拖动状态时,忽略外部传入的percent值,优先用户拖动
|
|
285
|
+
var shouldUpdatePercent = !(this.state.onDraging) &&
|
|
286
|
+
!(percent == nextPercent && discrete == nextDiscrete);
|
|
287
|
+
console.log('检查shouldUpdatePercent', shouldUpdatePercent);
|
|
288
|
+
if (shouldUpdatePercent) {
|
|
289
|
+
//如果从外部传入percent/discrete,则组件可根据新props来更新滑动条位置
|
|
290
|
+
//离散情况
|
|
291
|
+
if (this.props.isDiscrete == true) {
|
|
292
|
+
this.discrete = nextProps.discrete;
|
|
293
|
+
this.setState({
|
|
294
|
+
percent: this.discrete * (10000 / this.props.maxDiscrete)
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
//连续情况
|
|
298
|
+
else {
|
|
299
|
+
this.setState({
|
|
300
|
+
percent: nextProps.percent,
|
|
301
|
+
});
|
|
302
|
+
}
|
|
264
303
|
}
|
|
265
|
-
|
|
304
|
+
//如果slider传入样式相关props有更改
|
|
305
|
+
if (JSON.stringify(styleProps) !== JSON.stringify(nextstyleProps)) {
|
|
266
306
|
this.setState({
|
|
267
|
-
|
|
307
|
+
wrapperStyle: this.wrapperStyle(),
|
|
308
|
+
outerStyle: this.outerStyle(),
|
|
309
|
+
innerStyle: this.innerStyle(),
|
|
310
|
+
dotStyle: this.dotStyle(),
|
|
311
|
+
dotWrapperStyle: this.dotWrapperStyle(),
|
|
312
|
+
incButtonStyle: this.incButtonStyle(),
|
|
313
|
+
decButtonStyle: this.decButtonStyle(),
|
|
314
|
+
withButtonStyle: this.withButtonStyle(),
|
|
268
315
|
});
|
|
269
316
|
}
|
|
270
317
|
};
|
|
271
318
|
Slider.prototype.render = function () {
|
|
272
|
-
this.computeInnerStyle();
|
|
273
|
-
this.computeDotWrapperStyle();
|
|
274
|
-
this.computeDotStyle();
|
|
275
|
-
this.computeIncButtonStyle();
|
|
276
|
-
this.computeDecButtonStyle();
|
|
277
|
-
this.computeWithButtonStyle();
|
|
278
319
|
var hasDot = this.props.hasDot === undefined || this.props.hasDot === true;
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
320
|
+
var innerWidth = Math.floor(this.state.percent / 100) + '%';
|
|
321
|
+
var dotWrapperMarginLeft = (this.props.wrapperWidth * this.state.percent / 10000 - this.props.dotWrapperWidth / 2) + 'px';
|
|
322
|
+
return (h("div", { style: this.props.hasIncDecButton ? this.state.withButtonStyle : {} },
|
|
323
|
+
this.props.hasIncDecButton && h("img", { src: this.props.decButtonBg, style: this.state.decButtonStyle, onClick: this.onDecClick }),
|
|
324
|
+
h("div", { ref: this.refWrapper, style: this.state.wrapperStyle },
|
|
325
|
+
h("div", { style: this.state.outerStyle },
|
|
326
|
+
h("div", { style: __assign(__assign({}, this.state.innerStyle), { width: innerWidth }) },
|
|
327
|
+
h("div", { style: __assign(__assign({}, this.state.dotWrapperStyle), { marginLeft: dotWrapperMarginLeft }), draggable: true, onDragStart: this.onDragStart, onDrag: this.onDrag, onDragEnd: this.onDragEnd }, hasDot && h("img", { src: this.props.dotBg, style: this.state.dotStyle }))))),
|
|
328
|
+
this.props.hasIncDecButton && h("img", { src: this.props.incButtonBg, style: this.state.incButtonStyle, onClick: this.onIncClick })));
|
|
329
|
+
};
|
|
330
|
+
Slider.defaultProps = {
|
|
331
|
+
percent: 0,
|
|
332
|
+
wrapperHeight: 34,
|
|
333
|
+
wrapperWidth: 376,
|
|
334
|
+
height: 5,
|
|
335
|
+
dotWidth: 26,
|
|
336
|
+
dotHeight: 27,
|
|
337
|
+
dotWrapperWidth: 56,
|
|
338
|
+
dotWrapperHeight: 57,
|
|
339
|
+
onDragStart: null,
|
|
340
|
+
onDrag: null,
|
|
341
|
+
onDragEnd: null,
|
|
342
|
+
isDiscrete: true,
|
|
343
|
+
discrete: 0,
|
|
344
|
+
maxDiscrete: 100,
|
|
345
|
+
hasIncDecButton: false,
|
|
346
|
+
overallWidth: 500,
|
|
347
|
+
rangeControl: false,
|
|
348
|
+
hasDot: true,
|
|
292
349
|
};
|
|
293
350
|
return Slider;
|
|
294
351
|
}(Component));
|
|
295
|
-
export { Slider };
|
|
@@ -25,7 +25,7 @@ var ToggleGroup = /** @class */ (function (_super) {
|
|
|
25
25
|
_this.items = [];
|
|
26
26
|
_this.refreshAll = true;
|
|
27
27
|
_this.GenerateToggleItem = function (toggleItem, togglePic, index, refreshAll) {
|
|
28
|
-
return (
|
|
28
|
+
return (h(Toggle, { toggleItem: toggleItem, togglePic: togglePic, index: index, checkSelected: _this.checkSelected, refreshAll: refreshAll }));
|
|
29
29
|
};
|
|
30
30
|
_this.checkSelected = function (index) {
|
|
31
31
|
if (_this.isMultiOption)
|
|
@@ -65,7 +65,7 @@ var ToggleGroup = /** @class */ (function (_super) {
|
|
|
65
65
|
for (var i = 0; i < this.toggleArray.length; i++) {
|
|
66
66
|
this.items.push(this.GenerateToggleItem(this.toggleArray[i], this.togglePic, i, this.refreshAll));
|
|
67
67
|
}
|
|
68
|
-
return
|
|
68
|
+
return h("div", { style: { flexDirection: 'row' } }, this.items);
|
|
69
69
|
};
|
|
70
70
|
return ToggleGroup;
|
|
71
71
|
}(Component));
|
|
@@ -94,22 +94,20 @@ var Toggle = /** @class */ (function (_super) {
|
|
|
94
94
|
return;
|
|
95
95
|
}
|
|
96
96
|
this.refreshAll = props.refreshAll;
|
|
97
|
-
return (
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
<div style={{ width: '50px' }}></div>
|
|
112
|
-
</div>);
|
|
97
|
+
return (h("div", { style: { alignItems: 'flex-end', flexDirection: 'row' } },
|
|
98
|
+
h("div", { style: {
|
|
99
|
+
width: '36px',
|
|
100
|
+
height: '36px',
|
|
101
|
+
backgroundSize: 'contain',
|
|
102
|
+
backgroundImage: "url(".concat(this.state.isSelected ? this.selectedPic : this.notSelectedPic, ")"),
|
|
103
|
+
}, onClick: function () {
|
|
104
|
+
_this.state.isSelected ? _this.notSelectedFun() : _this.selectedFun();
|
|
105
|
+
_this.setState({ isSelected: !_this.state.isSelected });
|
|
106
|
+
_this.checkSelected(_this.index);
|
|
107
|
+
} }),
|
|
108
|
+
h("div", null,
|
|
109
|
+
h("text", null, "".concat(this.toggleText))),
|
|
110
|
+
h("div", { style: { width: '50px' } })));
|
|
113
111
|
};
|
|
114
112
|
return Toggle;
|
|
115
113
|
}(Component));
|
|
@@ -293,7 +293,7 @@ var GradientText = /** @class */ (function (_super) {
|
|
|
293
293
|
GradientText.prototype.render = function (props) {
|
|
294
294
|
var style = !props.style ? { width: '200px', height: '200px', backgroundColor: '#FF00FFFF' } : props.style;
|
|
295
295
|
this.printLog('OnRender');
|
|
296
|
-
return (
|
|
296
|
+
return (h("pixslot", { style: style, src: 'pixui://method:placeholder', onLoad: this.onLoad.bind(this) }));
|
|
297
297
|
};
|
|
298
298
|
return GradientText;
|
|
299
299
|
}(Component));
|
|
@@ -130,9 +130,8 @@ export var OutlineText = /** @class */ (function (_super) {
|
|
|
130
130
|
this.outline.effectDistance = new CS.UnityEngine.Vector2(this.props.outlineDistance.x, this.props.outlineDistance.y);
|
|
131
131
|
};
|
|
132
132
|
OutlineText.prototype.render = function () {
|
|
133
|
-
return (
|
|
134
|
-
|
|
135
|
-
</div>);
|
|
133
|
+
return (h("div", { style: this.props.style },
|
|
134
|
+
h("pixslot", { style: { width: '100%', height: '100%' }, src: 'pixui://method:placeholder', onLoad: this.OnLoad.bind(this) })));
|
|
136
135
|
};
|
|
137
136
|
OutlineText.defaultProps = {
|
|
138
137
|
style: defaultStyle,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Component } from 'preact';
|
|
1
|
+
import { Component, h } from 'preact';
|
|
2
2
|
export interface PixPlaceHolderProps {
|
|
3
3
|
/** 每次 src 属性被修改时会派发onload事件 */
|
|
4
4
|
onload?: (e: any) => any;
|
|
@@ -27,5 +27,5 @@ export declare class PixPlaceHolder<T extends PixPlaceHolderProps> extends Compo
|
|
|
27
27
|
onAttach(attachment: any, windowId: any, handle: any): void;
|
|
28
28
|
onLoad(e: PixPlaceHolderLoadEvent, ...rest: any[]): void;
|
|
29
29
|
onError(...args: any[]): void;
|
|
30
|
-
render():
|
|
30
|
+
render(): h.JSX.Element;
|
|
31
31
|
}
|
|
@@ -22,7 +22,7 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
22
22
|
}
|
|
23
23
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
24
24
|
};
|
|
25
|
-
import { Component } from 'preact';
|
|
25
|
+
import { Component, h } from 'preact';
|
|
26
26
|
var PixPlaceHolder = /** @class */ (function (_super) {
|
|
27
27
|
__extends(PixPlaceHolder, _super);
|
|
28
28
|
function PixPlaceHolder() {
|
|
@@ -90,11 +90,9 @@ var PixPlaceHolder = /** @class */ (function (_super) {
|
|
|
90
90
|
var _this = this;
|
|
91
91
|
var className = ['pixui-placeholder', this.props.className].filter(function (c) { return !!c; }).join(' ');
|
|
92
92
|
var style = this.props.style ? this.props.style : {};
|
|
93
|
-
return (
|
|
93
|
+
return (h("pixslot", { className: className, onLoad: this.onLoad.bind(this), src: "pixui://method:placeholder", ref: function (ref) {
|
|
94
94
|
_this.dom = ref;
|
|
95
|
-
}
|
|
96
|
-
{this.props.children}
|
|
97
|
-
</pixslot>);
|
|
95
|
+
}, onerror: this.onError, style: style }, this.props.children));
|
|
98
96
|
};
|
|
99
97
|
return PixPlaceHolder;
|
|
100
98
|
}(Component));
|
package/src/sample/Images.d.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
export declare const Images: {
|
|
2
|
-
bg1: any;
|
|
3
|
-
bg2: any;
|
|
4
|
-
btn_close: any;
|
|
5
|
-
changtai_button: any;
|
|
6
|
-
checkbox0: any;
|
|
7
|
-
checkbox1: any;
|
|
8
|
-
data_arrow_down: any;
|
|
9
|
-
data_arrow_up: any;
|
|
10
|
-
dot: any;
|
|
11
|
-
inner: any;
|
|
12
|
-
item_reddot: any;
|
|
13
|
-
loading: any;
|
|
14
|
-
money_dropdown: any;
|
|
15
|
-
money_dropdownall: any;
|
|
16
|
-
outer: any;
|
|
17
|
-
slapface_samplepic1: any;
|
|
18
|
-
slapface_samplepic2: any;
|
|
19
|
-
slapface_samplepic3: any;
|
|
20
|
-
slapface_samplepic4: any;
|
|
21
|
-
slapface_samplepic5: any;
|
|
22
|
-
slapface_samplepic6: any;
|
|
23
|
-
tabs_bg: any;
|
|
24
|
-
tab_choosed: any;
|
|
25
|
-
video_pause: any;
|
|
26
|
-
video_play: any;
|
|
27
|
-
video_reload: any;
|
|
28
|
-
xuanfu_button: any;
|
|
29
|
-
yaxia_button: any;
|
|
30
|
-
zwt: any;
|
|
31
|
-
};
|
package/src/sample/Images.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import bg1 from "./asset/bg1.png";
|
|
2
|
-
import bg2 from "./asset/bg2.png";
|
|
3
|
-
import btn_close from "./asset/btn_close.png";
|
|
4
|
-
import changtai_button from "./asset/changtai_button.jpg";
|
|
5
|
-
import checkbox0 from "./asset/checkbox0.png";
|
|
6
|
-
import checkbox1 from "./asset/checkbox1.png";
|
|
7
|
-
import data_arrow_down from "./asset/data_arrow_down.png";
|
|
8
|
-
import data_arrow_up from "./asset/data_arrow_up.png";
|
|
9
|
-
import dot from "./asset/dot.png";
|
|
10
|
-
import inner from "./asset/inner.png";
|
|
11
|
-
import item_reddot from "./asset/item_reddot.png";
|
|
12
|
-
import loading from "./asset/loading.png";
|
|
13
|
-
import money_dropdown from "./asset/money_dropdown.png";
|
|
14
|
-
import money_dropdownall from "./asset/money_dropdownall.png";
|
|
15
|
-
import outer from "./asset/outer.png";
|
|
16
|
-
import slapface_samplepic1 from "./asset/slapface_samplepic1.png";
|
|
17
|
-
import slapface_samplepic2 from "./asset/slapface_samplepic2.png";
|
|
18
|
-
import slapface_samplepic3 from "./asset/slapface_samplepic3.png";
|
|
19
|
-
import slapface_samplepic4 from "./asset/slapface_samplepic4.png";
|
|
20
|
-
import slapface_samplepic5 from "./asset/slapface_samplepic5.png";
|
|
21
|
-
import slapface_samplepic6 from "./asset/slapface_samplepic6.png";
|
|
22
|
-
import tabs_bg from "./asset/tabs_bg.png";
|
|
23
|
-
import tab_choosed from "./asset/tab_choosed.png";
|
|
24
|
-
import video_pause from "./asset/video_pause.png";
|
|
25
|
-
import video_play from "./asset/video_play.png";
|
|
26
|
-
import video_reload from "./asset/video_reload.png";
|
|
27
|
-
import xuanfu_button from "./asset/xuanfu_button.jpg";
|
|
28
|
-
import yaxia_button from "./asset/yaxia_button.jpg";
|
|
29
|
-
import zwt from "./asset/zwt.png";
|
|
30
|
-
export var Images = {
|
|
31
|
-
bg1: bg1,
|
|
32
|
-
bg2: bg2,
|
|
33
|
-
btn_close: btn_close,
|
|
34
|
-
changtai_button: changtai_button,
|
|
35
|
-
checkbox0: checkbox0,
|
|
36
|
-
checkbox1: checkbox1,
|
|
37
|
-
data_arrow_down: data_arrow_down,
|
|
38
|
-
data_arrow_up: data_arrow_up,
|
|
39
|
-
dot: dot,
|
|
40
|
-
inner: inner,
|
|
41
|
-
item_reddot: item_reddot,
|
|
42
|
-
loading: loading,
|
|
43
|
-
money_dropdown: money_dropdown,
|
|
44
|
-
money_dropdownall: money_dropdownall,
|
|
45
|
-
outer: outer,
|
|
46
|
-
slapface_samplepic1: slapface_samplepic1,
|
|
47
|
-
slapface_samplepic2: slapface_samplepic2,
|
|
48
|
-
slapface_samplepic3: slapface_samplepic3,
|
|
49
|
-
slapface_samplepic4: slapface_samplepic4,
|
|
50
|
-
slapface_samplepic5: slapface_samplepic5,
|
|
51
|
-
slapface_samplepic6: slapface_samplepic6,
|
|
52
|
-
tabs_bg: tabs_bg,
|
|
53
|
-
tab_choosed: tab_choosed,
|
|
54
|
-
video_pause: video_pause,
|
|
55
|
-
video_play: video_play,
|
|
56
|
-
video_reload: video_reload,
|
|
57
|
-
xuanfu_button: xuanfu_button,
|
|
58
|
-
yaxia_button: yaxia_button,
|
|
59
|
-
zwt: zwt,
|
|
60
|
-
};
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Component, CSSProperties } from 'preact';
|
|
2
|
-
interface DemoProps {
|
|
3
|
-
style?: CSSProperties;
|
|
4
|
-
outlineColor?: {
|
|
5
|
-
r: number;
|
|
6
|
-
g: number;
|
|
7
|
-
b: number;
|
|
8
|
-
a: number;
|
|
9
|
-
};
|
|
10
|
-
outlineDistance?: {
|
|
11
|
-
x: number;
|
|
12
|
-
y: number;
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
export declare class OutlineDemo extends Component<DemoProps, DemoProps> {
|
|
16
|
-
constructor(param: any);
|
|
17
|
-
onClickButton(): void;
|
|
18
|
-
render(): any;
|
|
19
|
-
}
|
|
20
|
-
export {};
|