pixuireactcomponents 1.1.20 → 1.1.22
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/package.json
CHANGED
|
@@ -51,6 +51,9 @@ export function Carousel(props) {
|
|
|
51
51
|
}, [children]);
|
|
52
52
|
var isLastCarouseItem = function () { return showIndex === carouselItems.length - 1; };
|
|
53
53
|
var isFirstCarouseLastItem = function () { return showIndex === 0; };
|
|
54
|
+
useEffect(function () {
|
|
55
|
+
setNextInterval();
|
|
56
|
+
}, [autoplay]);
|
|
54
57
|
useEffect(function () {
|
|
55
58
|
//每次跳转前判断打开动画,否则动画关闭以后不会调用handleTransitionEnd
|
|
56
59
|
if (!isLastCarouseItem() && !isFirstCarouseLastItem()) {
|
|
@@ -62,8 +65,8 @@ export function Carousel(props) {
|
|
|
62
65
|
handleNextRef.current = handleNext;
|
|
63
66
|
});
|
|
64
67
|
var setNextInterval = function () {
|
|
68
|
+
clearInterval(nextInterval.current);
|
|
65
69
|
if (autoplay) {
|
|
66
|
-
clearInterval(nextInterval.current);
|
|
67
70
|
nextInterval.current = setInterval(function () {
|
|
68
71
|
handleNextRef.current();
|
|
69
72
|
}, duration);
|
|
@@ -179,7 +182,7 @@ export function Carousel(props) {
|
|
|
179
182
|
onclickEvent(showIndex - 1);
|
|
180
183
|
}
|
|
181
184
|
};
|
|
182
|
-
return (h("div", { style: { flexDirection: 'column'
|
|
185
|
+
return (h("div", { style: { flexDirection: 'column' } },
|
|
183
186
|
h("div", { style: __assign(__assign({ position: 'relative' }, itemBoxStyle), { overflow: 'hidden', flexShrink: 0 }) },
|
|
184
187
|
h("div", { style: {
|
|
185
188
|
display: 'flex',
|
|
@@ -25,7 +25,6 @@ var __assign = (this && this.__assign) || function () {
|
|
|
25
25
|
return __assign.apply(this, arguments);
|
|
26
26
|
};
|
|
27
27
|
import { h, Component } from "preact";
|
|
28
|
-
// @ts-ignore
|
|
29
28
|
import SlapfaceLess from "./less/Slapface.less";
|
|
30
29
|
//默认配置项
|
|
31
30
|
var settingsitems = {
|
|
@@ -80,7 +79,7 @@ var nodeList = /** @class */ (function () {
|
|
|
80
79
|
nodeList.prototype.CheckReady = function () {
|
|
81
80
|
var cur = this.head;
|
|
82
81
|
while (cur.next != null) {
|
|
83
|
-
if (
|
|
82
|
+
if (this.groupArr[cur.next.index].isLoadDone) {
|
|
84
83
|
cur = cur.next;
|
|
85
84
|
}
|
|
86
85
|
else {
|
|
@@ -104,7 +103,7 @@ var Slapface = /** @class */ (function (_super) {
|
|
|
104
103
|
_this.LoadGroup = _this.props.LoadGroup;
|
|
105
104
|
_this.jumpButton = _this.props.jumpButton ? _this.props.jumpButton : jumpButton;
|
|
106
105
|
_this.settingsitems = _this.props.settingsitems ? _this.props.settingsitems : settingsitems;
|
|
107
|
-
_this.btn_closeButton = _this.props.btn_closeButton;
|
|
106
|
+
_this.btn_closeButton = _this.props.btn_closeButton ? _this.props.btn_closeButton : '';
|
|
108
107
|
_this.pic_loading = _this.props.pic_loading;
|
|
109
108
|
_this.actDisplay = "flex";
|
|
110
109
|
return _this;
|
|
@@ -130,7 +129,7 @@ var Group = /** @class */ (function (_super) {
|
|
|
130
129
|
var _this = _super.call(this, props) || this;
|
|
131
130
|
var emptyGroup = [
|
|
132
131
|
{
|
|
133
|
-
isLoadDone:
|
|
132
|
+
isLoadDone: false,
|
|
134
133
|
picture: "",
|
|
135
134
|
width: 0,
|
|
136
135
|
height: 0
|
|
@@ -138,7 +137,8 @@ var Group = /** @class */ (function (_super) {
|
|
|
138
137
|
];
|
|
139
138
|
_this.groupArr = emptyGroup.concat(_this.props.LoadGroup);
|
|
140
139
|
_this.groupIndexList = new nodeList(_this.groupArr);
|
|
141
|
-
_this.loadDisplay = "
|
|
140
|
+
_this.loadDisplay = "hidden";
|
|
141
|
+
_this.elseDisplay = "visible";
|
|
142
142
|
_this.state = {
|
|
143
143
|
curIndex: _this.groupIndexList.CheckReady()
|
|
144
144
|
};
|
|
@@ -157,16 +157,18 @@ var Group = /** @class */ (function (_super) {
|
|
|
157
157
|
var _this = this;
|
|
158
158
|
var curIndex = this.state.curIndex;
|
|
159
159
|
setTimeout(function () {
|
|
160
|
-
if (_this.groupArr[curIndex].isLoadDone) {
|
|
161
|
-
_this.groupArr[curIndex].isLoadDone =
|
|
160
|
+
if (!_this.groupArr[curIndex].isLoadDone) {
|
|
161
|
+
_this.groupArr[curIndex].isLoadDone = true;
|
|
162
162
|
_this.closeClick();
|
|
163
163
|
}
|
|
164
164
|
}, 1000);
|
|
165
165
|
};
|
|
166
166
|
Group.prototype.closeClick = function (e) {
|
|
167
|
+
var _this = this;
|
|
167
168
|
e === null || e === void 0 ? void 0 : e.stopPropagation();
|
|
168
169
|
var nextIndex = this.groupIndexList.CheckReady();
|
|
169
|
-
|
|
170
|
+
setTimeout(function () { _this.loadDisplay = "visible"; }, 1000);
|
|
171
|
+
this.elseDisplay = "hidden";
|
|
170
172
|
if (nextIndex != -1) {
|
|
171
173
|
if (this.props.settingsitems.ani_switch_type == 2) {
|
|
172
174
|
this.picBack.className = SlapfaceLess.groupBack;
|
|
@@ -186,14 +188,15 @@ var Group = /** @class */ (function (_super) {
|
|
|
186
188
|
h("div", { onClick: function () { if (_this.props.settingsitems.is_mask == false)
|
|
187
189
|
return; _this.closeClick(); }, style: { position: "absolute", width: "100%", height: "100%" } }),
|
|
188
190
|
h("div", null,
|
|
189
|
-
h("img", { src: this.groupArr[this.state.curIndex].picture, style: { width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height }, onLoad: function () { var curIndex = _this.state.curIndex; if (_this.groupArr[curIndex].isLoadDone) {
|
|
190
|
-
_this.groupArr[curIndex].isLoadDone =
|
|
191
|
+
h("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: function () { var curIndex = _this.state.curIndex; if (!_this.groupArr[curIndex].isLoadDone) {
|
|
192
|
+
_this.groupArr[curIndex].isLoadDone = true;
|
|
191
193
|
_this.loadDisplay = "hidden";
|
|
194
|
+
_this.elseDisplay = "visible";
|
|
192
195
|
_this.forceUpdate();
|
|
193
196
|
} } }),
|
|
194
|
-
h("div", { className: SlapfaceLess.loading_anim,
|
|
195
|
-
h(CloseButton, { btn_closeButton: this.props.btn_closeButton, onClick: function (e) { _this.closeClick(e); } }),
|
|
196
|
-
h(JumpButton, { jumpButton: this.props.jumpButton }))));
|
|
197
|
+
h("div", { ref: function (div) { _this.loadPic = div; }, className: SlapfaceLess.loading_anim, style: { backgroundImage: "url(".concat(this.props.pic_loading, ")"), width: this.groupArr[this.state.curIndex].width, height: this.groupArr[this.state.curIndex].height, position: "absolute", visibility: this.loadDisplay } }, " "),
|
|
198
|
+
h(CloseButton, { btn_closeButton: this.props.btn_closeButton, elseDisplay: this.elseDisplay, onClick: function (e) { _this.closeClick(e); } }),
|
|
199
|
+
h(JumpButton, { elseDisplay: this.elseDisplay, jumpButton: this.props.jumpButton }))));
|
|
197
200
|
};
|
|
198
201
|
return Group;
|
|
199
202
|
}(Component));
|
|
@@ -203,7 +206,7 @@ var CloseButton = /** @class */ (function (_super) {
|
|
|
203
206
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
204
207
|
}
|
|
205
208
|
CloseButton.prototype.render = function () {
|
|
206
|
-
return (h("button", { className: SlapfaceLess.closeButton, style: { backgroundImage: "url(".concat(this.props.btn_closeButton, ")") }, onClick: this.props.onClick }));
|
|
209
|
+
return (h("button", { className: SlapfaceLess.closeButton, style: { visibility: this.props.elseDisplay, backgroundImage: "url(".concat(this.props.btn_closeButton, ")") }, onClick: this.props.onClick }));
|
|
207
210
|
};
|
|
208
211
|
return CloseButton;
|
|
209
212
|
}(Component));
|
|
@@ -214,7 +217,7 @@ var JumpButton = /** @class */ (function (_super) {
|
|
|
214
217
|
}
|
|
215
218
|
JumpButton.prototype.render = function () {
|
|
216
219
|
var _this = this;
|
|
217
|
-
return (h("div", { className: SlapfaceLess.jumpButton, onMouseDown: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_yaxia; }, onMouseUp: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; }, onMouseOver: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; }, onMouseOut: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_changtai; } },
|
|
220
|
+
return (h("div", { className: SlapfaceLess.jumpButton, style: { visibility: this.props.elseDisplay }, onMouseDown: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_yaxia; }, onMouseUp: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; }, onMouseOver: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_xuanfu; }, onMouseOut: function () { _this.jumpbtnImg.src = _this.props.jumpButton.pic_changtai; } },
|
|
218
221
|
h("img", { ref: function (img) { _this.jumpbtnImg = img; }, src: this.props.jumpButton.pic_changtai })));
|
|
219
222
|
};
|
|
220
223
|
return JumpButton;
|
|
@@ -9,19 +9,7 @@
|
|
|
9
9
|
flex-direction: column;
|
|
10
10
|
position: relative;
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
height : 76px;
|
|
14
|
-
width:244px;
|
|
15
|
-
position: relative;
|
|
16
|
-
/* left:12px;
|
|
17
|
-
top:0px; */
|
|
18
|
-
font-size: 44px;
|
|
19
|
-
color:white;
|
|
20
|
-
background-color: rgb(180, 180, 180);
|
|
21
|
-
z-index: 999;
|
|
22
|
-
text-align: center;
|
|
23
|
-
float:left;
|
|
24
|
-
}
|
|
12
|
+
|
|
25
13
|
.closeButton{
|
|
26
14
|
width:36px;
|
|
27
15
|
height:36px;
|
|
@@ -44,6 +32,15 @@
|
|
|
44
32
|
}
|
|
45
33
|
}
|
|
46
34
|
|
|
35
|
+
@keyframes zoomReverse{
|
|
36
|
+
from{
|
|
37
|
+
transform: scale(0)
|
|
38
|
+
}
|
|
39
|
+
to{
|
|
40
|
+
transform: scale(0);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
47
44
|
.groupBack{
|
|
48
45
|
animation-name:zoom;
|
|
49
46
|
animation-timing-function:ease-in-out;
|
|
@@ -51,6 +48,13 @@
|
|
|
51
48
|
animation-duration: 1s;
|
|
52
49
|
}
|
|
53
50
|
|
|
51
|
+
.groupBackReverse{
|
|
52
|
+
animation-name:zoomReverse;
|
|
53
|
+
animation-timing-function:'';
|
|
54
|
+
animation-iteration-count:'';
|
|
55
|
+
animation-duration:'';
|
|
56
|
+
}
|
|
57
|
+
|
|
54
58
|
.isShowToday{
|
|
55
59
|
width:36px;
|
|
56
60
|
height:31px;
|
|
@@ -59,17 +63,7 @@
|
|
|
59
63
|
right:0px;
|
|
60
64
|
bottom:0px;
|
|
61
65
|
}
|
|
62
|
-
|
|
63
|
-
position: absolute;
|
|
64
|
-
color:red;
|
|
65
|
-
left:0px;
|
|
66
|
-
top:0px;
|
|
67
|
-
}
|
|
68
|
-
.groupFrame{
|
|
69
|
-
position:absolute;
|
|
70
|
-
right:0%;
|
|
71
|
-
bottom:0%;
|
|
72
|
-
}
|
|
66
|
+
|
|
73
67
|
.jumpButton{
|
|
74
68
|
position: absolute;
|
|
75
69
|
right:50%;
|
|
@@ -104,4 +98,28 @@
|
|
|
104
98
|
// background:url(images/coupon-logo.gif) no-repeat;
|
|
105
99
|
height:100px;background-color:#fff;
|
|
106
100
|
opacity:0.6;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@keyframes rotate_by_myself{
|
|
104
|
+
from {
|
|
105
|
+
transform: rotate(0deg);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
50% {
|
|
109
|
+
transform: rotate(180deg);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
to {
|
|
113
|
+
transform: rotate(360deg);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
.loading_anim{
|
|
118
|
+
animation-name: rotate_by_myself;
|
|
119
|
+
animation-duration: 1.5s;
|
|
120
|
+
animation-timing-function: linear;
|
|
121
|
+
animation-iteration-count: infinite;
|
|
122
|
+
background-position: center;
|
|
123
|
+
background-repeat: no-repeat;
|
|
124
|
+
background-size: 50%;
|
|
107
125
|
}
|