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.
Files changed (104) hide show
  1. package/index.d.ts +15 -0
  2. package/index.js +16 -20
  3. package/package.json +9 -9
  4. package/tools/EventDispatcherJs.d.ts +10 -0
  5. package/tools/EventDispatcherJs.js +71 -0
  6. package/tools/Logger.d.ts +6 -0
  7. package/tools/Logger.js +138 -0
  8. package/ui/components/button/Button.d.ts +5 -0
  9. package/ui/components/button/Button.js +37 -0
  10. package/ui/components/carousel/Carousel.d.ts +5 -0
  11. package/ui/components/carousel/Carousel.js +219 -0
  12. package/ui/components/dropdown/Dropdown.d.ts +30 -0
  13. package/ui/components/dropdown/Dropdown.js +92 -0
  14. package/ui/components/dropdown/DropdownOptionUI.d.ts +11 -0
  15. package/ui/components/dropdown/DropdownOptionUI.js +28 -0
  16. package/ui/components/dropdown/DropdownSpreadMainUI.d.ts +9 -0
  17. package/ui/components/dropdown/DropdownSpreadMainUI.js +27 -0
  18. package/ui/components/dropdown/DropdownUnspreadMainUI.d.ts +9 -0
  19. package/ui/components/dropdown/DropdownUnspreadMainUI.js +27 -0
  20. package/ui/components/gradient/GradientText.d.ts +63 -0
  21. package/ui/components/gradient/{GradientText.tsx → GradientText.js} +174 -183
  22. package/ui/components/outlinetext/OutlineText.d.ts +94 -0
  23. package/ui/components/outlinetext/OutlineText.js +168 -0
  24. package/ui/components/progress/Progress.d.ts +34 -0
  25. package/ui/components/progress/Progress.js +142 -0
  26. package/ui/components/slapface/Slapface.d.ts +12 -0
  27. package/ui/components/slapface/Slapface.js +235 -0
  28. package/ui/components/slider/Slider.d.ts +57 -0
  29. package/ui/components/slider/Slider.js +289 -0
  30. package/ui/components/tab/Tab.d.ts +6 -0
  31. package/ui/components/tab/Tab.js +27 -0
  32. package/ui/components/tab/Tabs.d.ts +12 -0
  33. package/ui/components/tab/Tabs.js +54 -0
  34. package/cmdAfterTsBuild.js +0 -8
  35. package/tools/EventDispatcherJs.tsx +0 -74
  36. package/tools/Logger.tsx +0 -161
  37. package/tools/img/logger.png +0 -0
  38. package/tsconfig.json +0 -45
  39. package/ui/components/bulletscreen/BulletItemAnimation.tsx +0 -117
  40. package/ui/components/bulletscreen/BulletScreenAnimation.tsx +0 -278
  41. package/ui/components/bulletscreen/bullet.less +0 -17
  42. package/ui/components/button/Button.tsx +0 -18
  43. package/ui/components/carousel/Carousel.tsx +0 -279
  44. package/ui/components/checkBox/CheckBox.tsx +0 -40
  45. package/ui/components/dropdown/Dropdown.tsx +0 -126
  46. package/ui/components/dropdown/DropdownOptionUI.tsx +0 -14
  47. package/ui/components/dropdown/DropdownSpreadMainUI.tsx +0 -11
  48. package/ui/components/dropdown/DropdownUnspreadMainUI.tsx +0 -11
  49. package/ui/components/outlinetext/OutlineText.tsx +0 -184
  50. package/ui/components/progress/Progress.tsx +0 -174
  51. package/ui/components/slapface/Slapface.tsx +0 -284
  52. package/ui/components/slider/Slider.tsx +0 -366
  53. package/ui/components/tab/Tab.tsx +0 -12
  54. package/ui/components/tab/Tabs.tsx +0 -56
  55. package/ui/components/togglegroup/ToggleGroup.tsx +0 -105
  56. package/ui/components/videoplayer/VideoPlayer.tsx +0 -200
  57. package/ui/components/waterfallcomponent/WaterfallComponent.jsx +0 -687
  58. package/ui/components/waterfallcomponent/less/WaterfallComponent.less +0 -13
  59. package/ui/sample/Images.tsx +0 -60
  60. package/ui/sample/OutlineText/OutlineDemo.tsx +0 -61
  61. package/ui/sample/Slapface/SlapfaceDemo.tsx +0 -30
  62. package/ui/sample/asset/btn_close.png +0 -0
  63. package/ui/sample/asset/changtai_button.jpg +0 -0
  64. package/ui/sample/asset/checkbox0.png +0 -0
  65. package/ui/sample/asset/checkbox1.png +0 -0
  66. package/ui/sample/asset/data_arrow_down.png +0 -0
  67. package/ui/sample/asset/data_arrow_up.png +0 -0
  68. package/ui/sample/asset/dot.png +0 -0
  69. package/ui/sample/asset/inner.png +0 -0
  70. package/ui/sample/asset/item_reddot.png +0 -0
  71. package/ui/sample/asset/loading.png +0 -0
  72. package/ui/sample/asset/money_dropdown.png +0 -0
  73. package/ui/sample/asset/money_dropdownall.png +0 -0
  74. package/ui/sample/asset/outer.png +0 -0
  75. package/ui/sample/asset/slapface_samplepic1.png +0 -0
  76. package/ui/sample/asset/slapface_samplepic2.png +0 -0
  77. package/ui/sample/asset/slapface_samplepic3.png +0 -0
  78. package/ui/sample/asset/slapface_samplepic4.png +0 -0
  79. package/ui/sample/asset/slapface_samplepic5.png +0 -0
  80. package/ui/sample/asset/slapface_samplepic6.png +0 -0
  81. package/ui/sample/asset/tab_choosed.png +0 -0
  82. package/ui/sample/asset/tabs_bg.png +0 -0
  83. package/ui/sample/asset/video_pause.png +0 -0
  84. package/ui/sample/asset/video_play.png +0 -0
  85. package/ui/sample/asset/video_reload.png +0 -0
  86. package/ui/sample/asset/xuanfu_button.jpg +0 -0
  87. package/ui/sample/asset/yaxia_button.jpg +0 -0
  88. package/ui/sample/bulletscreen/BulletDemo.tsx +0 -84
  89. package/ui/sample/button/ButtonDemo.tsx +0 -19
  90. package/ui/sample/carousel/carouselDemo.tsx +0 -52
  91. package/ui/sample/checkBox/checkBoxDemo.tsx +0 -7
  92. package/ui/sample/dropdown/DropdownDemo.tsx +0 -65
  93. package/ui/sample/dropdown/MoneyDropdownOption.tsx +0 -50
  94. package/ui/sample/dropdown/MoneyDropdownSpreadMain.tsx +0 -42
  95. package/ui/sample/dropdown/MoneyDropdownUnspreadMain.tsx +0 -44
  96. package/ui/sample/gradient/GradientDemo.tsx +0 -51
  97. package/ui/sample/less/video.less +0 -144
  98. package/ui/sample/progress/ProgressDemo.tsx +0 -74
  99. package/ui/sample/slider/SliderDemo.tsx +0 -116
  100. package/ui/sample/tab/TabDemo.tsx +0 -67
  101. package/ui/sample/tab/TopTab.tsx +0 -74
  102. package/ui/sample/togglegroup/ToggleGroupDemo.tsx +0 -35
  103. package/ui/sample/videoplayer/VideoPlayerDemo.tsx +0 -57
  104. package/ui/sample/waterfallcomponent/WaterfallComponentDemo.jsx +0 -137
@@ -1,174 +0,0 @@
1
- import { Component, createRef, CSSProperties, h } from 'preact';
2
-
3
- const row_center_center: CSSProperties = {
4
- display: 'flex',
5
- flexDirection: 'row',
6
- justifyContent: 'center',
7
- alignItems: 'center'
8
- };
9
-
10
- export interface ProgressProps {
11
- percent: number; // 0-100,表示0%-100%
12
- wrapperWidth: number;
13
- wrapperHeight: number;
14
- height: number;
15
- dotWidth: number;
16
- dotHeight: number;
17
- dotWrapperWidth: number;
18
- dotWrapperHeight: number;
19
-
20
- outerBg: string;
21
- innerBg: string;
22
- dotBg: string;
23
- onDragStart: Function | null;
24
- onDrag: Function | null;
25
- onDragEnd: Function | null; // 拖动结束的事件
26
- }
27
-
28
- let wrapperStyle: CSSProperties;
29
- let outerStyle: CSSProperties;
30
- let innerStyle: CSSProperties;
31
- let dotStyle: CSSProperties;
32
- let dotWrapperStyle: CSSProperties;
33
-
34
- let lastX = undefined;// 上一次位置的横坐标
35
- let count = 0; // 拖动条距离最左端的位置 [0, this.props.wrapperWidth]
36
- let rect: any = undefined; // 滑动区域
37
-
38
- export class Progress extends Component<
39
- ProgressProps,
40
- {
41
- percent: number;
42
- }>{
43
-
44
- private refWrapper: any = createRef()
45
-
46
-
47
- constructor(props) {
48
- super(props);
49
-
50
- this.state = {
51
- percent: Math.floor(this.props.percent)
52
- };
53
-
54
- this.computeWrapperStyle();
55
- this.computeOuterStyle();
56
- }
57
-
58
- componentDidMount() {
59
- rect = this.refWrapper.current.getBoundingClientRect();
60
- }
61
-
62
- componentWillReceiveProps(nextProps) {
63
- if (nextProps.percent == this.props.percent) return;
64
- this.setState({
65
- percent: nextProps.percent
66
- });
67
- }
68
-
69
- onDragStart = (event) => {
70
- console.log('【Progress】DragStart event.clientX--' + event.clientX + '-----percent----' + this.state.percent + '-----currentX----' + (this.state.percent / 100 * this.props.wrapperWidth));
71
- lastX = event.clentX;
72
-
73
- count = this.state.percent / 100 * this.props.wrapperWidth;
74
-
75
- if (this.props.onDragStart) {
76
- this.props.onDragStart();
77
- }
78
- }
79
-
80
- onDrag = (event) => {
81
- if (event.clientX < rect.left || event.clientX > rect.right) return;
82
-
83
- if (lastX == undefined) {
84
- lastX = event.clientX;
85
- return;
86
- }
87
-
88
- let move = Number(event.clientX) - Number(lastX);
89
- count += move;
90
- count = Math.min(this.props.wrapperWidth, count);
91
- count = Math.max(0, count);
92
-
93
- let newPercent = count / this.props.wrapperWidth * 100;
94
- this.setState({
95
- percent: newPercent
96
- }, () => {
97
- if (this.props.onDrag) this.props.onDrag(newPercent);
98
- });
99
- lastX = event.clientX;
100
- }
101
-
102
- onDragEnd = (event) => {
103
- lastX = undefined;
104
- console.log('【Progress】DragEnd event.clientX--' + event.clientX + '-----percent----' + this.state.percent + '-----currentX----' + (this.state.percent / 100 * this.props.wrapperWidth));
105
- if (this.props.onDragEnd) {
106
- this.props.onDragEnd(this.state.percent);
107
- }
108
- }
109
-
110
- computeWrapperStyle = () => {
111
- wrapperStyle = {
112
- width: this.props.wrapperWidth + 'px',
113
- height: this.props.wrapperHeight + 'px',
114
- ...row_center_center
115
- };
116
- }
117
-
118
- computeOuterStyle = () => {
119
- outerStyle = {
120
- width: '100%',
121
- height: this.props.height + 'px',
122
- backgroundImage: `url(${this.props.outerBg})`,
123
- backgroundSize: '100% 100%'
124
- };
125
- }
126
-
127
- computeInnerStyle = () => {
128
- let _width = Math.floor(this.state.percent) + '%';
129
- innerStyle = {
130
- width: _width,
131
- height: '100%',
132
- backgroundImage: `url(${this.props.innerBg})`,
133
- backgroundSize: '100% 100%'
134
- };
135
- }
136
-
137
- computeDotWrapperStyle = () => {
138
- dotWrapperStyle = {
139
- position: 'absolute',
140
- width: this.props.dotWrapperWidth + 'px',
141
- height: this.props.dotWrapperHeight + 'px',
142
- marginTop: (this.props.height - this.props.dotWrapperHeight) / 2 + 'px',
143
- marginLeft: (this.props.wrapperWidth * this.state.percent / 100 - this.props.dotWrapperWidth / 2) + 'px',
144
- ...row_center_center
145
- // backgroundColor: '#FF000066'
146
- };
147
- }
148
-
149
- computeDotStyle = () => {
150
- dotStyle = {
151
- width: this.props.dotWidth + 'px',
152
- height: this.props.dotHeight + 'px',
153
- };
154
- }
155
-
156
- render() {
157
- this.computeInnerStyle();
158
- this.computeDotWrapperStyle();
159
- this.computeDotStyle();
160
-
161
- return (
162
- <div ref={this.refWrapper} style={wrapperStyle}>
163
- <div style={outerStyle}>
164
- <div style={innerStyle}>
165
- <div style={dotWrapperStyle} draggable={true}
166
- onDragStart={this.onDragStart} onDrag={this.onDrag} onDragEnd={this.onDragEnd}>
167
- <img src={this.props.dotBg} style={dotStyle} />
168
- </div>
169
- </div>
170
- </div>
171
- </div>
172
- );
173
- }
174
- }
@@ -1,284 +0,0 @@
1
- import { h, Component, CSSProperties } from "preact";
2
-
3
- //@ts-ignore
4
- import SlapfaceLess from "./less/Slapface.less";
5
- // import { Images } from 'src/pixUIReactComponents/ui/sample/Images';
6
-
7
- interface SettingsItems {
8
- readonly ani_switch_type: number,
9
- readonly is_mask: boolean
10
- }
11
-
12
- //默认配置项
13
- const settingsitems: SettingsItems = {
14
- ani_switch_type: 1,
15
- is_mask: false
16
- }
17
-
18
- //默认无跳转按钮
19
- let jumpButton = {
20
- pic_changtai : '',
21
- pic_yaxia : '',
22
- pic_xuanfu : ''
23
- }
24
-
25
- interface SlapfaceNodeInfo {
26
- index: number,
27
- next: SlapfaceNodeInfo
28
- }
29
-
30
- class slapfaceNode implements SlapfaceNodeInfo {
31
- public index;
32
- public next;
33
- constructor(par_index?) {
34
- if (par_index == undefined) this.index = -1;
35
- else this.index = par_index;
36
- this.next = null;
37
- }
38
- }
39
-
40
- interface SlapfaceNodeListInfo {
41
- head: slapfaceNode,
42
- tail: slapfaceNode,
43
- groupArr: groupInfo[],
44
- size: number,
45
- Add(index: number, next: slapfaceNode): slapfaceNode,
46
- DeleteNext(curParam: slapfaceNode): void,
47
- CheckReady(): number
48
- }
49
-
50
- class slapfaceNodeList implements SlapfaceNodeListInfo {
51
- public head;
52
- public tail;
53
- public groupArr;
54
- public size;
55
-
56
- constructor(groupArr?: groupInfo[]) {
57
- this.head = new slapfaceNode();
58
- let cur = this.head;
59
- this.size = 0;
60
-
61
- if (groupArr) {
62
- for (let i = 0; i < groupArr.length; i++) {
63
- cur.next = new slapfaceNode(i);
64
- cur = cur.next;
65
- }
66
- this.groupArr = groupArr;
67
- this.size += groupArr.length;
68
- }
69
- this.tail = cur;
70
- }
71
-
72
- public Add(index: number, next: slapfaceNode): slapfaceNode {
73
- this.tail.next = new slapfaceNode(index);
74
- this.tail = this.tail.next;
75
- ++this.size;
76
- return this.tail;
77
- }
78
-
79
- public DeleteNext(curParam: slapfaceNode): void {
80
- if (curParam.next == null) return;
81
- else {
82
- curParam.next = curParam.next.next;
83
- }
84
- --this.size;
85
- }
86
-
87
- public CheckReady(): number {
88
- let cur: slapfaceNode = this.head;
89
- while (cur.next != null) {
90
- if (this.groupArr[cur.next.index].isLoadDone) {
91
- cur = cur.next;
92
- }
93
- else {
94
- let retIndex = cur.next.index;
95
- this.DeleteNext(cur);
96
- return retIndex;
97
- }
98
- }
99
- return -1;
100
- }
101
- }
102
-
103
- interface groupInfo {
104
- //用于判断是否拍脸图是否已经加载
105
- isLoadDone: boolean,
106
- picture: string,
107
- width: number,
108
- height: number
109
- }
110
-
111
- interface SlapfaceInfo {
112
- LoadGroup: groupInfo[];
113
- jumpButton : object;
114
- settingsitems : SettingsItems;
115
- btn_closeButton : string;
116
- pic_loading : string
117
- }
118
-
119
- export class Slapface extends Component<any, any>
120
- {
121
- private LoadGroup;
122
- private jumpButton;
123
- private settingsitems;
124
- private btn_closeButton;
125
- private pic_loading;
126
- private actDisplay;
127
-
128
- public closeAct = ()=>{
129
- this.actDisplay = "none"
130
- this.forceUpdate()
131
- }
132
-
133
- constructor(props) {
134
- super(props)
135
- this.LoadGroup = this.props.LoadGroup;
136
- for(let i = 0;i<this.LoadGroup.length;i++)
137
- {
138
- this.LoadGroup[i].isLoadDone = false;
139
- }
140
- this.jumpButton = this.props.jumpButton? this.props.jumpButton : jumpButton
141
- this.settingsitems = this.props.settingsitems? this.props.settingsitems : settingsitems
142
- this.btn_closeButton = this.props.btn_closeButton? this.props.btn_closeButton : ''
143
- this.pic_loading = this.props.pic_loading
144
- this.actDisplay = "flex"
145
- }
146
-
147
- render() {
148
- let slapfaceinfo: SlapfaceInfo = {
149
- LoadGroup: this.LoadGroup,
150
- jumpButton: this.jumpButton,
151
- settingsitems : this.settingsitems,
152
- btn_closeButton : this.btn_closeButton,
153
- pic_loading : this.pic_loading
154
- }
155
-
156
- return (
157
- <div style ={{display:this.actDisplay,width:"100%",height:"100%"}}>
158
- <div style={{ width: '100%', height: '100%', backgroundColor: "rgba(0,0,0,0.5)" }}>
159
- {<Group {...slapfaceinfo} closeAct = {this.closeAct}/>}
160
- </div>
161
- </div>
162
- )
163
-
164
- }
165
- }
166
-
167
- class Group extends Component<any, any>
168
- {
169
- constructor(props) {
170
- super(props);
171
- let emptyGroup: groupInfo[] = [
172
- {
173
- isLoadDone: false,
174
- picture: "",
175
- width: 0,
176
- height: 0
177
- }
178
- ]
179
- this.groupArr = emptyGroup.concat(this.props.LoadGroup);
180
- this.groupIndexList = new slapfaceNodeList(this.groupArr);
181
- this.loadDisplay = "hidden";
182
- this.elseDisplay = "visible";
183
- this.firstFrameDisplay = "none";
184
-
185
- this.state = {
186
- curIndex: this.groupIndexList.CheckReady()
187
- }
188
- }
189
-
190
- private groupIndexList: slapfaceNodeList;
191
- private groupArr: groupInfo[];
192
- private picBack;
193
- private loadDisplay;
194
- private elseDisplay;
195
- private firstFrameDisplay;
196
- private loadPic;
197
-
198
- componentDidMount(){
199
- // if(this.picBack.style.display == 'none'){
200
- // setTimeout(()=>{this.picBack.style.display = 'flex';
201
- // this.closeClick()},300)
202
- // }
203
- this.loadDisplay = "hidden"
204
- if(this.firstFrameDisplay == "none"){
205
- setTimeout(()=>{this.firstFrameDisplay = 'flex';
206
- this.closeClick()},300)
207
- }
208
- }
209
-
210
- componentDidUpdate(){
211
- let curIndex = this.state.curIndex;
212
- setTimeout(() => {
213
- if(!this.groupArr[curIndex].isLoadDone){
214
- this.groupArr[curIndex].isLoadDone = true;
215
- this.closeClick()
216
- }
217
- }, 1000);
218
- }
219
-
220
- closeClick(e?: Event) {
221
- e?.stopPropagation()
222
- let nextIndex = this.groupIndexList.CheckReady();
223
- // setTimeout(() => {
224
- // this.loadDisplay = "visible"
225
- // }, 50);
226
- this.loadDisplay = "visible"
227
- this.elseDisplay = "hidden"
228
- if (nextIndex != -1) {
229
- if (this.props.settingsitems.ani_switch_type == 2) {
230
- this.picBack.className = SlapfaceLess.groupBack
231
- }
232
- this.setState(
233
- { curIndex: nextIndex }
234
- )
235
- }
236
- else {
237
- this.props.closeAct()
238
- }
239
- }
240
- render() {
241
-
242
- if (this.state.curIndex == -1) {
243
- this.setState(
244
- { curIndex: this.groupIndexList.CheckReady() }
245
- )
246
- }
247
-
248
- return (<div style={{ width: '100%', height: '100%', alignItems: 'center', justifyContent: 'center', position: 'absolute'}}>
249
- <div onClick={() => { if (this.props.settingsitems.is_mask == false) return; this.closeClick() }} style={{ position: "absolute", width: "100%", height: "100%" }}></div>
250
- <div ref={(div)=>{this.picBack = div}} onAnimationEnd={() => {setTimeout(()=>{this.picBack.className = SlapfaceLess.groupBackReverse},0)}}>
251
- <img src = {this.groupArr[this.state.curIndex].picture} style ={{visibility:this.elseDisplay,width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height}} onLoad = {()=>{let curIndex = this.state.curIndex;if(!this.groupArr[curIndex].isLoadDone) {this.groupArr[curIndex].isLoadDone = true;this.loadDisplay = "hidden";this.elseDisplay = "visible";this.forceUpdate()}}}></img>
252
- <CloseButton firstFrameDisplay = {this.firstFrameDisplay} btn_closeButton = {this.props.btn_closeButton} elseDisplay = {this.elseDisplay} onClick={(e: Event) => { this.closeClick(e);}} />
253
- <JumpButton firstFrameDisplay = {this.firstFrameDisplay} elseDisplay = {this.elseDisplay} jumpButton = {this.props.jumpButton}/>
254
- </div>
255
- <div ref={(div)=>{this.loadPic = div}} className={SlapfaceLess.loading_anim} style ={{backgroundImage: `url(${this.props.pic_loading})`,width:"300px", height: "300px",position:"absolute",visibility : this.loadDisplay}}> </div>
256
- </div>);
257
- }
258
-
259
- }
260
-
261
- class CloseButton extends Component<any, any>
262
- {
263
- render() {
264
- return (
265
- <button className={SlapfaceLess.closeButton} style={{display:this.props.firstFrameDisplay,visibility : this.props.elseDisplay,backgroundSize:"contain",backgroundImage: `url(${this.props.btn_closeButton})` }} onClick={this.props.onClick}></button>
266
- )
267
- }
268
- }
269
-
270
- class JumpButton extends Component<any, any>
271
- {
272
- private jumpbtnImg
273
- render() {
274
- return (
275
- <div className= {SlapfaceLess.jumpButton} style ={{display:this.props.firstFrameDisplay,visibility : this.props.elseDisplay}}
276
- onMouseDown={() => {(this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_yaxia;}}
277
- onMouseUp={() => { (this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_xuanfu }}
278
- onMouseOver={() => { (this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_xuanfu; }}
279
- onMouseOut={() => { (this.jumpbtnImg as HTMLImageElement).src = this.props.jumpButton.pic_changtai; }}>
280
- <img ref = {(img)=>{this.jumpbtnImg = img}} src={this.props.jumpButton.pic_changtai}></img>
281
- </div>
282
- )
283
- }
284
- }