pb-sxp-ui 1.1.0 → 1.1.2

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.
@@ -2,6 +2,7 @@ import { CSSProperties, FC } from 'react';
2
2
  interface IProps {
3
3
  imageUrl?: string;
4
4
  style?: CSSProperties;
5
+ duration?: number;
5
6
  }
6
7
  declare const FingerSwipeTip: FC<IProps>;
7
8
  export default FingerSwipeTip;
@@ -1,19 +1,19 @@
1
1
  import React, { useEffect, useMemo, useState } from 'react';
2
2
  import { useIconLink } from '../useIconLink';
3
3
  import { useEditor } from '../../../../core/hooks';
4
- const FingerSwipeTip = ({ imageUrl, style }) => {
4
+ const FingerSwipeTip = ({ imageUrl, style, duration = 2000 }) => {
5
5
  const [show, setShow] = useState(true);
6
6
  const { schema: { sxpPageConf } } = useEditor();
7
7
  useEffect(() => {
8
8
  setTimeout(() => {
9
9
  setShow(false);
10
- }, 2000);
10
+ }, duration);
11
11
  }, []);
12
12
  const FINGER_SWIPE_ICON = useIconLink('/pb_static/finger-swipe-tip.29dc3a48a3c746c906ea..png');
13
13
  const animationCls = useMemo(() => {
14
14
  return show ? 'pb-fadeIn' : 'pb-fadeOut';
15
15
  }, [show]);
16
- return (React.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: style },
16
+ return (React.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: Object.assign(Object.assign({}, style), { animationDuration: `${duration / 1000}s` }) },
17
17
  React.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON, alt: 'finger swiper' })));
18
18
  };
19
19
  export default FingerSwipeTip;
@@ -221,20 +221,23 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
221
221
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
222
222
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
223
223
  return () => {
224
- var _a, _b, _c, _d, _e, _f, _g, _h;
224
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
225
+ const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
226
+ if (!isPause)
227
+ handlePause();
225
228
  if (hls)
226
229
  hls === null || hls === void 0 ? void 0 : hls.destroy();
227
230
  setIsLoadFinish(false);
228
- (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedmetadata);
229
- (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadeddata', handLoadeddata);
230
- (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('play', handleStartPlay);
231
- (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('playing', handlePlaying);
232
- (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('pause', handlePause);
233
- (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('ended', handlePlay);
234
- (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('canplay', handlePlay);
235
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('waiting', handleWaiting);
231
+ (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadedmetadata', handleLoadedmetadata);
232
+ (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
233
+ (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handleStartPlay);
234
+ (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('playing', handlePlaying);
235
+ (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('pause', handlePause);
236
+ (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('ended', handlePlay);
237
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('canplay', handlePlay);
238
+ (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('waiting', handleWaiting);
236
239
  };
237
- }, [isActive, videoId, rec]);
240
+ }, [isActive, videoId, rec, handlePause]);
238
241
  useEffect(() => {
239
242
  var _a, _b;
240
243
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
@@ -39,6 +39,7 @@ export interface ISxpPageRenderProps {
39
39
  videoPlayIcon?: string;
40
40
  isShowMute?: boolean;
41
41
  bottomInfoDist?: number;
42
+ swiperTipAniDur?: number;
42
43
  };
43
44
  descStyle?: CSSProperties;
44
45
  tipText?: {
@@ -398,7 +398,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
398
398
  React.createElement(Tagbar, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
399
399
  top: minusHeight
400
400
  } }),
401
- isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` } })) : null,
401
+ isShowFingerTip ? (React.createElement(FingerSwipeTip, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` }, duration: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swiperTipAniDur })) : null,
402
402
  React.createElement(Swiper, { style: {
403
403
  marginTop: tagHeight
404
404
  }, ref: swiperRef, onSlideChange: () => {
@@ -2,6 +2,7 @@ import { CSSProperties, FC } from 'react';
2
2
  interface IProps {
3
3
  imageUrl?: string;
4
4
  style?: CSSProperties;
5
+ duration?: number;
5
6
  }
6
7
  declare const FingerSwipeTip: FC<IProps>;
7
8
  export default FingerSwipeTip;
@@ -4,19 +4,19 @@ const tslib_1 = require("tslib");
4
4
  const react_1 = tslib_1.__importStar(require("react"));
5
5
  const useIconLink_1 = require("../useIconLink");
6
6
  const hooks_1 = require("../../../../core/hooks");
7
- const FingerSwipeTip = ({ imageUrl, style }) => {
7
+ const FingerSwipeTip = ({ imageUrl, style, duration = 2000 }) => {
8
8
  const [show, setShow] = (0, react_1.useState)(true);
9
9
  const { schema: { sxpPageConf } } = (0, hooks_1.useEditor)();
10
10
  (0, react_1.useEffect)(() => {
11
11
  setTimeout(() => {
12
12
  setShow(false);
13
- }, 2000);
13
+ }, duration);
14
14
  }, []);
15
15
  const FINGER_SWIPE_ICON = (0, useIconLink_1.useIconLink)('/pb_static/finger-swipe-tip.29dc3a48a3c746c906ea..png');
16
16
  const animationCls = (0, react_1.useMemo)(() => {
17
17
  return show ? 'pb-fadeIn' : 'pb-fadeOut';
18
18
  }, [show]);
19
- return (react_1.default.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: style },
19
+ return (react_1.default.createElement("div", { hidden: !show, className: `pb-finger-wrap ${animationCls}`, style: Object.assign(Object.assign({}, style), { animationDuration: `${duration / 1000}s` }) },
20
20
  react_1.default.createElement("img", { src: imageUrl || FINGER_SWIPE_ICON, alt: 'finger swiper' })));
21
21
  };
22
22
  exports.default = FingerSwipeTip;
@@ -224,20 +224,23 @@ const VideoWidget = ({ rec, index, height, data, muted, activeIndex, videoPostCo
224
224
  (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.addEventListener('canplay', handlePlay);
225
225
  (_k = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _k === void 0 ? void 0 : _k.addEventListener('waiting', handleWaiting);
226
226
  return () => {
227
- var _a, _b, _c, _d, _e, _f, _g, _h;
227
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
228
+ const isPause = (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.paused;
229
+ if (!isPause)
230
+ handlePause();
228
231
  if (hls)
229
232
  hls === null || hls === void 0 ? void 0 : hls.destroy();
230
233
  setIsLoadFinish(false);
231
- (_a = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _a === void 0 ? void 0 : _a.removeEventListener('loadedmetadata', handleLoadedmetadata);
232
- (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadeddata', handLoadeddata);
233
- (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('play', handleStartPlay);
234
- (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('playing', handlePlaying);
235
- (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('pause', handlePause);
236
- (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('ended', handlePlay);
237
- (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('canplay', handlePlay);
238
- (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('waiting', handleWaiting);
234
+ (_b = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _b === void 0 ? void 0 : _b.removeEventListener('loadedmetadata', handleLoadedmetadata);
235
+ (_c = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _c === void 0 ? void 0 : _c.removeEventListener('loadeddata', handLoadeddata);
236
+ (_d = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _d === void 0 ? void 0 : _d.removeEventListener('play', handleStartPlay);
237
+ (_e = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _e === void 0 ? void 0 : _e.removeEventListener('playing', handlePlaying);
238
+ (_f = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _f === void 0 ? void 0 : _f.removeEventListener('pause', handlePause);
239
+ (_g = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _g === void 0 ? void 0 : _g.removeEventListener('ended', handlePlay);
240
+ (_h = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _h === void 0 ? void 0 : _h.removeEventListener('canplay', handlePlay);
241
+ (_j = videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) === null || _j === void 0 ? void 0 : _j.removeEventListener('waiting', handleWaiting);
239
242
  };
240
- }, [isActive, videoId, rec]);
243
+ }, [isActive, videoId, rec, handlePause]);
241
244
  (0, react_1.useEffect)(() => {
242
245
  var _a, _b;
243
246
  if (!(videoRef === null || videoRef === void 0 ? void 0 : videoRef.current) || !isLoadFinish)
@@ -39,6 +39,7 @@ export interface ISxpPageRenderProps {
39
39
  videoPlayIcon?: string;
40
40
  isShowMute?: boolean;
41
41
  bottomInfoDist?: number;
42
+ swiperTipAniDur?: number;
42
43
  };
43
44
  descStyle?: CSSProperties;
44
45
  tipText?: {
@@ -401,7 +401,7 @@ const SxpPageRender = ({ globalConfig, descStyle, containerHeight = window.inner
401
401
  react_1.default.createElement(Tagbar_1.default, { tagList: tagList, setActiveIndex: setActiveIndex, style: {
402
402
  top: minusHeight
403
403
  } }),
404
- isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` } })) : null,
404
+ isShowFingerTip ? (react_1.default.createElement(FingerSwipeTip_1.default, { imageUrl: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipIcon, style: { top: `${50 - ((_a = globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swipeTipOffset) !== null && _a !== void 0 ? _a : 0)}%` }, duration: globalConfig === null || globalConfig === void 0 ? void 0 : globalConfig.swiperTipAniDur })) : null,
405
405
  react_1.default.createElement(react_2.Swiper, { style: {
406
406
  marginTop: tagHeight
407
407
  }, ref: swiperRef, onSlideChange: () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pb-sxp-ui",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "React enterprise-class UI components",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",