pixuireactcomponents 1.5.28 → 1.5.30
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
|
@@ -35,20 +35,27 @@ export var DropDown = function (props) {
|
|
|
35
35
|
var elementStyleOrClass = getElementStyleOrClass();
|
|
36
36
|
var _a = useState(false), spread = _a[0], setSpread = _a[1];
|
|
37
37
|
var dropdownRef = useRef(null);
|
|
38
|
+
var dropdownContentRef = useRef(null);
|
|
38
39
|
useEffect(function () {
|
|
39
40
|
onSpread && onSpread(spread);
|
|
40
41
|
}, [spread]);
|
|
41
42
|
useEffect(function () {
|
|
42
43
|
var handleClickOutside = function (event) {
|
|
43
44
|
// console.log('handleClickOutside, ', event.clientX, event.clientY)
|
|
44
|
-
if (dropdownRef.current) {
|
|
45
|
+
if (dropdownRef.current && dropdownContentRef.current) {
|
|
45
46
|
var dropDownRect = dropdownRef.current.getBoundingClientRect();
|
|
47
|
+
var contentRect = dropdownContentRef.current.getBoundingClientRect();
|
|
46
48
|
// console.log('dropDownRect', dropDownRect, 'isOutside', event.clientX < dropDownRect.left, 'isOutside', event.clientX > dropDownRect.right, 'isOutside', event.clientY < dropDownRect.top, 'isOutside', event.clientY > dropDownRect.bottom)
|
|
47
|
-
|
|
49
|
+
// console.log('contentRect', contentRect, 'isOutside', event.clientX < contentRect.left, 'isOutside', event.clientX > contentRect.right, 'isOutside', event.clientY < contentRect.top, 'isOutside', event.clientY > contentRect.bottom)
|
|
50
|
+
var isOutsideDropdown = event.clientX < dropDownRect.left ||
|
|
48
51
|
event.clientX > dropDownRect.right ||
|
|
49
52
|
event.clientY < dropDownRect.top ||
|
|
50
53
|
event.clientY > dropDownRect.bottom;
|
|
51
|
-
|
|
54
|
+
var isOutsideContent = event.clientX < contentRect.left ||
|
|
55
|
+
event.clientX > contentRect.right ||
|
|
56
|
+
event.clientY < contentRect.top ||
|
|
57
|
+
event.clientY > contentRect.bottom;
|
|
58
|
+
if (isOutsideDropdown && isOutsideContent) {
|
|
52
59
|
setSpread(false);
|
|
53
60
|
}
|
|
54
61
|
}
|
|
@@ -87,7 +94,7 @@ export var DropDown = function (props) {
|
|
|
87
94
|
overlayRender,
|
|
88
95
|
spread && (
|
|
89
96
|
//在下方展开
|
|
90
|
-
h("div", { className: typeof elementStyleOrClass.dropdownBg === 'string' ? elementStyleOrClass.dropdownBg : '', style: __assign({ flexDirection: 'column', overflow: 'scroll' }, (typeof elementStyleOrClass.dropdownBg === 'object' ? elementStyleOrClass.dropdownBg : undefined)) }, options.map(function (option, index) {
|
|
97
|
+
h("div", { ref: dropdownContentRef, className: typeof elementStyleOrClass.dropdownBg === 'string' ? elementStyleOrClass.dropdownBg : '', style: __assign({ flexDirection: 'column', overflow: 'scroll' }, (typeof elementStyleOrClass.dropdownBg === 'object' ? elementStyleOrClass.dropdownBg : undefined)) }, options.map(function (option, index) {
|
|
91
98
|
return (h("div", null, optionRender(option)));
|
|
92
99
|
})))));
|
|
93
100
|
};
|
|
@@ -88,7 +88,7 @@ var videoLog = function () {
|
|
|
88
88
|
};
|
|
89
89
|
export var VideoPlayer = function (props) {
|
|
90
90
|
var rootId = props.rootId, rootClassName = props.rootClassName, _a = props.playUrl, playUrl = _a === void 0 ? '' : _a, _b = props.autoPlay, autoPlay = _b === void 0 ? true : _b, playEvent = props.playEvent, iconElement = props.iconElement, _c = props.hideSliderDuration, hideSliderDuration = _c === void 0 ? 3000 : _c, sliderElement = props.sliderElement, videoDuration = props.videoDuration, compRef = props.compRef;
|
|
91
|
-
var isStreaming = !playUrl.endsWith('.mp4');
|
|
91
|
+
var isStreaming = !playUrl.split('?')[0].endsWith('.mp4');
|
|
92
92
|
var refVideo = useRef(null);
|
|
93
93
|
var _d = useState(VideoStatus.Loading), videoStatus = _d[0], setVideoStatus = _d[1];
|
|
94
94
|
var _e = useState(0), currentTime = _e[0], setCurrentTime = _e[1];
|
|
@@ -133,26 +133,27 @@ export var VideoPlayer = function (props) {
|
|
|
133
133
|
updatePlayTimeFunRef.current = updatePlayTime;
|
|
134
134
|
});
|
|
135
135
|
useEffect(function () {
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
updatePlayTimeFunRef.current
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
// 如果是直播流则不需要处理进度条
|
|
137
|
+
if (!isStreaming) {
|
|
138
|
+
updatePlayTimeFunRef.current = updatePlayTime;
|
|
139
|
+
var interval_1 = setInterval(function () {
|
|
140
|
+
updatePlayTimeFunRef.current();
|
|
141
|
+
}, 1000);
|
|
142
|
+
var playTime = refVideo.current.currentTime;
|
|
143
|
+
var currentSeconds = Math.floor(playTime / 1000 + 0.5);
|
|
144
|
+
var duration = getDuration();
|
|
145
|
+
if (duration == undefined) {
|
|
146
|
+
console.error('该版本的pixui不支持自动获取视频时长,请手动传入videoDuration');
|
|
147
|
+
}
|
|
148
|
+
var totalSeconds = Math.floor(duration / 1000 + 0.5);
|
|
149
|
+
setCurrentTime(currentSeconds);
|
|
150
|
+
setTotalTime(totalSeconds);
|
|
151
|
+
return function () {
|
|
152
|
+
clearInterval(interval_1);
|
|
153
|
+
clearInterval(sliderTimmer.current);
|
|
154
|
+
};
|
|
147
155
|
}
|
|
148
|
-
|
|
149
|
-
setCurrentTime(currentSeconds);
|
|
150
|
-
setTotalTime(totalSeconds);
|
|
151
|
-
return function () {
|
|
152
|
-
clearInterval(interval);
|
|
153
|
-
clearInterval(sliderTimmer.current);
|
|
154
|
-
};
|
|
155
|
-
}, []);
|
|
156
|
+
}, [playUrl]);
|
|
156
157
|
// 开始拖就长显Bar
|
|
157
158
|
var onSliderDragStart = function () {
|
|
158
159
|
videoLog('onDragStart-----------------');
|