pixuireactcomponents 1.2.2 → 1.2.31
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 +15 -0
- package/index.js +16 -20
- package/package.json +9 -9
- package/tools/EventDispatcherJs.d.ts +10 -0
- package/tools/EventDispatcherJs.js +71 -0
- package/tools/Logger.d.ts +6 -0
- package/tools/Logger.js +138 -0
- package/ui/components/button/Button.d.ts +5 -0
- package/ui/components/button/Button.js +37 -0
- package/ui/components/carousel/Carousel.d.ts +5 -0
- package/ui/components/carousel/Carousel.js +219 -0
- package/ui/components/dropdown/Dropdown.d.ts +30 -0
- package/ui/components/dropdown/Dropdown.js +92 -0
- package/ui/components/dropdown/DropdownOptionUI.d.ts +11 -0
- package/ui/components/dropdown/DropdownOptionUI.js +28 -0
- package/ui/components/dropdown/DropdownSpreadMainUI.d.ts +9 -0
- package/ui/components/dropdown/DropdownSpreadMainUI.js +27 -0
- package/ui/components/dropdown/DropdownUnspreadMainUI.d.ts +9 -0
- package/ui/components/dropdown/DropdownUnspreadMainUI.js +27 -0
- package/ui/components/gradient/GradientText.d.ts +63 -0
- package/ui/components/gradient/{GradientText.tsx → GradientText.js} +174 -183
- package/ui/components/outlinetext/OutlineText.d.ts +94 -0
- package/ui/components/outlinetext/OutlineText.js +168 -0
- package/ui/components/progress/Progress.d.ts +34 -0
- package/ui/components/progress/Progress.js +142 -0
- package/ui/components/slapface/Slapface.d.ts +12 -0
- package/ui/components/slapface/Slapface.js +235 -0
- package/ui/components/slider/Slider.d.ts +57 -0
- package/ui/components/slider/Slider.js +289 -0
- package/ui/components/tab/Tab.d.ts +6 -0
- package/ui/components/tab/Tab.js +27 -0
- package/ui/components/tab/Tabs.d.ts +12 -0
- package/ui/components/tab/Tabs.js +54 -0
- package/cmdAfterTsBuild.js +0 -8
- package/tools/EventDispatcherJs.tsx +0 -74
- package/tools/Logger.tsx +0 -161
- package/tools/img/logger.png +0 -0
- package/tsconfig.json +0 -45
- package/ui/components/bulletscreen/BulletItemAnimation.tsx +0 -117
- package/ui/components/bulletscreen/BulletScreenAnimation.tsx +0 -278
- package/ui/components/bulletscreen/bullet.less +0 -17
- package/ui/components/button/Button.tsx +0 -18
- package/ui/components/carousel/Carousel.tsx +0 -279
- package/ui/components/checkBox/CheckBox.tsx +0 -40
- package/ui/components/dropdown/Dropdown.tsx +0 -126
- package/ui/components/dropdown/DropdownOptionUI.tsx +0 -14
- package/ui/components/dropdown/DropdownSpreadMainUI.tsx +0 -11
- package/ui/components/dropdown/DropdownUnspreadMainUI.tsx +0 -11
- package/ui/components/outlinetext/OutlineText.tsx +0 -184
- package/ui/components/progress/Progress.tsx +0 -174
- package/ui/components/slapface/Slapface.tsx +0 -284
- package/ui/components/slider/Slider.tsx +0 -366
- package/ui/components/tab/Tab.tsx +0 -12
- package/ui/components/tab/Tabs.tsx +0 -56
- package/ui/components/togglegroup/ToggleGroup.tsx +0 -105
- package/ui/components/videoplayer/VideoPlayer.tsx +0 -200
- package/ui/components/waterfallcomponent/WaterfallComponent.jsx +0 -687
- package/ui/components/waterfallcomponent/less/WaterfallComponent.less +0 -13
- package/ui/sample/Images.tsx +0 -60
- package/ui/sample/OutlineText/OutlineDemo.tsx +0 -61
- package/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
- package/ui/sample/asset/btn_close.png +0 -0
- package/ui/sample/asset/changtai_button.jpg +0 -0
- package/ui/sample/asset/checkbox0.png +0 -0
- package/ui/sample/asset/checkbox1.png +0 -0
- package/ui/sample/asset/data_arrow_down.png +0 -0
- package/ui/sample/asset/data_arrow_up.png +0 -0
- package/ui/sample/asset/dot.png +0 -0
- package/ui/sample/asset/inner.png +0 -0
- package/ui/sample/asset/item_reddot.png +0 -0
- package/ui/sample/asset/loading.png +0 -0
- package/ui/sample/asset/money_dropdown.png +0 -0
- package/ui/sample/asset/money_dropdownall.png +0 -0
- package/ui/sample/asset/outer.png +0 -0
- package/ui/sample/asset/slapface_samplepic1.png +0 -0
- package/ui/sample/asset/slapface_samplepic2.png +0 -0
- package/ui/sample/asset/slapface_samplepic3.png +0 -0
- package/ui/sample/asset/slapface_samplepic4.png +0 -0
- package/ui/sample/asset/slapface_samplepic5.png +0 -0
- package/ui/sample/asset/slapface_samplepic6.png +0 -0
- package/ui/sample/asset/tab_choosed.png +0 -0
- package/ui/sample/asset/tabs_bg.png +0 -0
- package/ui/sample/asset/video_pause.png +0 -0
- package/ui/sample/asset/video_play.png +0 -0
- package/ui/sample/asset/video_reload.png +0 -0
- package/ui/sample/asset/xuanfu_button.jpg +0 -0
- package/ui/sample/asset/yaxia_button.jpg +0 -0
- package/ui/sample/bulletscreen/BulletDemo.tsx +0 -84
- package/ui/sample/button/ButtonDemo.tsx +0 -19
- package/ui/sample/carousel/carouselDemo.tsx +0 -52
- package/ui/sample/checkBox/checkBoxDemo.tsx +0 -7
- package/ui/sample/dropdown/DropdownDemo.tsx +0 -65
- package/ui/sample/dropdown/MoneyDropdownOption.tsx +0 -50
- package/ui/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -42
- package/ui/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -44
- package/ui/sample/gradient/GradientDemo.tsx +0 -51
- package/ui/sample/less/video.less +0 -144
- package/ui/sample/progress/ProgressDemo.tsx +0 -74
- package/ui/sample/slider/SliderDemo.tsx +0 -116
- package/ui/sample/tab/TabDemo.tsx +0 -67
- package/ui/sample/tab/TopTab.tsx +0 -74
- package/ui/sample/togglegroup/ToggleGroupDemo.tsx +0 -35
- package/ui/sample/videoplayer/VideoPlayerDemo.tsx +0 -57
- package/ui/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -137
|
@@ -1,200 +0,0 @@
|
|
|
1
|
-
import { Component, createRef, CSSProperties } from 'preact';
|
|
2
|
-
import { Images } from '../../sample/Images';
|
|
3
|
-
import videoLess from './../../sample/less/video.less';
|
|
4
|
-
|
|
5
|
-
const videoWrapperStyle: CSSProperties = {
|
|
6
|
-
width: '100%',
|
|
7
|
-
height: '100%',
|
|
8
|
-
// backgroundColor: '#FFF00066'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const screenClickerStyle: CSSProperties = {
|
|
12
|
-
position: 'absolute',
|
|
13
|
-
width: '100%',
|
|
14
|
-
height: '100%',
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
const loadingContainerStyle: CSSProperties = {
|
|
18
|
-
position: 'absolute',
|
|
19
|
-
width: '100%',
|
|
20
|
-
height: '100%',
|
|
21
|
-
backgroundColor: 'rgba(0, 0, 0)',
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const controllerBarStyle: CSSProperties = {
|
|
25
|
-
position: 'absolute',
|
|
26
|
-
bottom: '0px',
|
|
27
|
-
height: '80px',
|
|
28
|
-
width: '100%',
|
|
29
|
-
backgroundColor: 'rgba(0, 0, 0, 0.7)'
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const playIconStyle: CSSProperties = {
|
|
33
|
-
width: '48px',
|
|
34
|
-
height: '48px',
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const reloadIconStyle: CSSProperties = {
|
|
38
|
-
width: '34px',
|
|
39
|
-
height: '34px',
|
|
40
|
-
marginLeft: '40px',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
export interface VideoPlayerProps {
|
|
44
|
-
playUrl: string;
|
|
45
|
-
onPlaying: Function | null;
|
|
46
|
-
onError: Function | null;
|
|
47
|
-
onNetworkFailed: Function | null;
|
|
48
|
-
onEnded: Function | null;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// 4个视频播放态
|
|
52
|
-
enum VideoStatus {
|
|
53
|
-
Loading, LoadError, Playing, Pause
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
export class VideoPlayer extends Component<
|
|
57
|
-
{
|
|
58
|
-
config: VideoPlayerProps;
|
|
59
|
-
},
|
|
60
|
-
{
|
|
61
|
-
showLoadingBar: boolean;
|
|
62
|
-
showBottomBar: boolean;
|
|
63
|
-
videoStatus: VideoStatus;
|
|
64
|
-
}>{
|
|
65
|
-
private refVideo: any = createRef()
|
|
66
|
-
private hideTopBottomBarTimer: any = null
|
|
67
|
-
|
|
68
|
-
constructor(props) {
|
|
69
|
-
super(props);
|
|
70
|
-
|
|
71
|
-
this.state = {
|
|
72
|
-
showLoadingBar: true,
|
|
73
|
-
showBottomBar: false,
|
|
74
|
-
videoStatus: VideoStatus.Loading
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
componentWillUnmount() {
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
onplaying = () => {
|
|
82
|
-
// 加载第一帧画面
|
|
83
|
-
console.warn('----------first frame');
|
|
84
|
-
this.setState({
|
|
85
|
-
showLoadingBar: false,
|
|
86
|
-
videoStatus: VideoStatus.Playing
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
onerror = () => {
|
|
91
|
-
console.warn('----------onerror');
|
|
92
|
-
// 播放错误,比如给一个无法播放的url
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
onnetworkfailed = () => {
|
|
96
|
-
console.warn('----------onnetworkfailed');
|
|
97
|
-
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
onended = () => {
|
|
101
|
-
// 视频播放结束
|
|
102
|
-
console.warn('-----------end');
|
|
103
|
-
this.refVideo.current.load();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
onScreenClick = () => {
|
|
107
|
-
if (this.state.showBottomBar) { // 当前已显示bottomBar
|
|
108
|
-
this.clearHideBottomBarTimer();
|
|
109
|
-
this.setState({
|
|
110
|
-
showBottomBar: false
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
else { // 当前未显示bottomBar
|
|
114
|
-
this.setState({
|
|
115
|
-
showBottomBar: true
|
|
116
|
-
}, this.setHideBottomBarTimer);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
// 3秒钟自动隐藏TopBar BottomBar
|
|
121
|
-
setHideBottomBarTimer = () => {
|
|
122
|
-
this.clearHideBottomBarTimer();
|
|
123
|
-
|
|
124
|
-
let outThis = this;
|
|
125
|
-
this.hideTopBottomBarTimer = setTimeout(function () {
|
|
126
|
-
outThis.setState({
|
|
127
|
-
showBottomBar: false
|
|
128
|
-
});
|
|
129
|
-
}, 3000);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
// 清理3秒隐藏TopBar BottomBar的计时器
|
|
133
|
-
clearHideBottomBarTimer = () => {
|
|
134
|
-
if (this.hideTopBottomBarTimer != null) {
|
|
135
|
-
clearTimeout(this.hideTopBottomBarTimer);
|
|
136
|
-
this.hideTopBottomBarTimer = null;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
switchPlayState = () => {
|
|
141
|
-
if (this.state.videoStatus == VideoStatus.Playing) {
|
|
142
|
-
this.onPause();
|
|
143
|
-
}
|
|
144
|
-
else if (this.state.videoStatus == VideoStatus.Pause) {
|
|
145
|
-
this.onPlay();
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
onPause = () => {
|
|
150
|
-
this.refVideo.current.pause();
|
|
151
|
-
this.setState({
|
|
152
|
-
videoStatus: VideoStatus.Pause
|
|
153
|
-
});
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
onPlay = () => {
|
|
157
|
-
this.refVideo.current.play();
|
|
158
|
-
|
|
159
|
-
this.setState({
|
|
160
|
-
videoStatus: VideoStatus.Playing
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
reloadVideo = () => {
|
|
165
|
-
this.refVideo.current.load();
|
|
166
|
-
this.setState({
|
|
167
|
-
videoStatus: VideoStatus.Loading,
|
|
168
|
-
showLoadingBar: true,
|
|
169
|
-
showBottomBar: false
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
render() {
|
|
174
|
-
let playIconUrl = this.state.videoStatus == VideoStatus.Playing ? Images.video_pause : Images.video_play;
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
return (
|
|
178
|
-
<div style={videoWrapperStyle}>
|
|
179
|
-
<video ref={this.refVideo} src={this.props.config.playUrl} object-fit="no" autoPlay="autoplay" muted
|
|
180
|
-
style={{ width: '100%', height: '100%' }}
|
|
181
|
-
onplaying={this.onplaying} onerror={this.onerror}
|
|
182
|
-
onnetworkfailed={this.onnetworkfailed} onended={this.onended}>
|
|
183
|
-
</video>
|
|
184
|
-
<div style={screenClickerStyle} onClick={this.onScreenClick}></div>
|
|
185
|
-
{this.state.showLoadingBar ?
|
|
186
|
-
<div style={loadingContainerStyle} className={videoLess.row_center_center}>
|
|
187
|
-
<img src={Images.loading} style={{ witdh: '42px', height: '42px' }} className={videoLess.loading_anim} />
|
|
188
|
-
</div> : null
|
|
189
|
-
}
|
|
190
|
-
{this.state.showBottomBar ?
|
|
191
|
-
<div style={controllerBarStyle}>
|
|
192
|
-
<div style={{ height: '100%', marginLeft: '40px', flexGrow: 2 }} className={videoLess.row_start_center}>
|
|
193
|
-
<img src={playIconUrl} style={playIconStyle} onClick={this.switchPlayState} />
|
|
194
|
-
<img src={Images.video_reload} style={reloadIconStyle} onClick={this.reloadVideo} />
|
|
195
|
-
</div>
|
|
196
|
-
</div> : null}
|
|
197
|
-
</div>
|
|
198
|
-
);
|
|
199
|
-
}
|
|
200
|
-
}
|