wargerm 0.7.31 → 0.7.33

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/dist/index.js CHANGED
@@ -5360,7 +5360,7 @@ var Index$b = function Index(_ref) {
5360
5360
  }, none || '暂无数据');
5361
5361
  };
5362
5362
 
5363
- var _excluded$f = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
5363
+ var _excluded$f = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem", "noMove"];
5364
5364
 
5365
5365
  SwiperCore__default['default'].use([SwiperCore.Pagination, SwiperCore.Navigation, SwiperCore.Autoplay, SwiperCore.Virtual]);
5366
5366
  var Index$c = /*#__PURE__*/React.forwardRef(function (props, ref) {
@@ -5371,6 +5371,7 @@ var Index$c = /*#__PURE__*/React.forwardRef(function (props, ref) {
5371
5371
  rowKey = props.rowKey,
5372
5372
  onSwiperChange = props.onSwiperChange,
5373
5373
  renderItem = props.renderItem,
5374
+ noMove = props.noMove,
5374
5375
  extraProps = _objectWithoutProperties(props, _excluded$f);
5375
5376
 
5376
5377
  var _useState = React.useState(null),
@@ -5416,7 +5417,7 @@ var Index$c = /*#__PURE__*/React.forwardRef(function (props, ref) {
5416
5417
  height: '100%'
5417
5418
  },
5418
5419
  onClick: function onClick(event) {
5419
- if (controlledSwiper) {
5420
+ if (controlledSwiper && !noMove) {
5420
5421
  if (controlledSwiper.clickedIndex - slidesPerView > data.length) {
5421
5422
  controlledSwiper.slideNext();
5422
5423
  } else {
@@ -6128,6 +6129,7 @@ function DialogModel(props, ref) {
6128
6129
  _props$className = props.className,
6129
6130
  className = _props$className === void 0 ? 'default-dialog' : _props$className,
6130
6131
  wrapClassName = props.wrapClassName,
6132
+ fullScreenStyle = props.fullScreenStyle,
6131
6133
  style = props.style;
6132
6134
 
6133
6135
  var _useState = React.useState(open),
@@ -6147,13 +6149,8 @@ function DialogModel(props, ref) {
6147
6149
 
6148
6150
  var _useState7 = React.useState(false),
6149
6151
  _useState8 = _slicedToArray(_useState7, 2),
6150
- hasVisit = _useState8[0],
6151
- setHasVisit = _useState8[1];
6152
-
6153
- var _useState9 = React.useState(false),
6154
- _useState10 = _slicedToArray(_useState9, 2),
6155
- isDesChild = _useState10[0],
6156
- setIsDesChild = _useState10[1];
6152
+ isDesChild = _useState8[0],
6153
+ setIsDesChild = _useState8[1];
6157
6154
 
6158
6155
  var containerRef = React.useRef();
6159
6156
  var ltRef = React.useRef();
@@ -6180,11 +6177,12 @@ function DialogModel(props, ref) {
6180
6177
  }, /*#__PURE__*/React__default['default'].createElement("div", {
6181
6178
  ref: containerRef,
6182
6179
  className: classnames__default['default']((_classNames = {}, _defineProperty(_classNames, className, true), _defineProperty(_classNames, 'model_container', true), _defineProperty(_classNames, "animate__animated", true), _defineProperty(_classNames, flag ? 'animate__bounceInDown' : 'animate__fadeOutRightBig', true), _classNames)),
6183
- style: _objectSpread2({
6180
+ style: _objectSpread2(_objectSpread2({
6184
6181
  opacity: modelShowAync ? 1 : 0,
6185
6182
  width: typeof width == 'number' ? width + 'px' : width,
6183
+ // transition: "width,height,left,top ease-in-out 0.3s",
6186
6184
  pointerEvents: 'all'
6187
- }, style)
6185
+ }, style), fullScreenStyle)
6188
6186
  }, /*#__PURE__*/React__default['default'].createElement("div", {
6189
6187
  className: 'model_wrap'
6190
6188
  }, isResize && /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement("div", {
@@ -6211,14 +6209,14 @@ function DialogModel(props, ref) {
6211
6209
  opacity: modelShowAync ? 0.6 : 0
6212
6210
  }
6213
6211
  })), document.body);
6214
- }, [modelShowAync, modelShow, props, isDesChild]);
6212
+ }, [modelShowAync, modelShow, props, isDesChild, fullScreenStyle]);
6215
6213
  React.useEffect(function () {
6216
6214
  var containerEl = containerRef.current;
6217
6215
  var containerElWidth = containerEl.offsetWidth;
6218
6216
  var containerElHeight = containerEl.offsetHeight;
6219
6217
  containerEl.style.left = "calc(50% - ".concat(containerElWidth / 2, "px)");
6220
6218
  containerEl.style.top = "calc(50% - ".concat(containerElHeight / 2, "px)");
6221
- }, [modelShow]);
6219
+ }, [modelShow, fullScreenStyle]);
6222
6220
  React.useEffect(function () {
6223
6221
  var containerEl = containerRef.current;
6224
6222
  var rEl = rRef.current;
@@ -6294,20 +6292,14 @@ function DialogModel(props, ref) {
6294
6292
  };
6295
6293
  }, [open]);
6296
6294
  React.useEffect(function () {
6297
- if (modelShow) {
6298
- setHasVisit(true);
6299
- }
6300
-
6301
- if (destroyOnClose && hasVisit) {
6302
- if (!modelShow) {
6303
- setIsDesChild(true);
6304
- } else {
6305
- setIsDesChild(false);
6306
- }
6295
+ if (destroyOnClose) {
6296
+ setIsDesChild(!modelShow);
6297
+ } else {
6298
+ setIsDesChild(false);
6307
6299
  }
6308
6300
 
6309
6301
  !modelShow && typeof closeCb === 'function' && closeCb();
6310
- }, [modelShow, hasVisit, destroyOnClose]);
6302
+ }, [modelShow, destroyOnClose]);
6311
6303
  return renderChildren;
6312
6304
  }
6313
6305
 
@@ -6331,6 +6323,9 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
6331
6323
  }
6332
6324
 
6333
6325
  _this = _super.call.apply(_super, [this].concat(args));
6326
+ _this.state = {
6327
+ isFullScreen: false
6328
+ };
6334
6329
 
6335
6330
  _this.renderFooter = function () {
6336
6331
  var _this$props = _this.props,
@@ -6367,19 +6362,61 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
6367
6362
  onClose = _this$props2.onClose,
6368
6363
  closeCb = _this$props2.closeCb,
6369
6364
  renderClose = _this$props2.renderClose,
6370
- isDrag = _this$props2.isDrag;
6365
+ isDrag = _this$props2.isDrag,
6366
+ showFullscreen = _this$props2.showFullscreen,
6367
+ renderMin = _this$props2.renderMin,
6368
+ renderFullScreen = _this$props2.renderFullScreen;
6369
+
6370
+ var onMouseDown = function onMouseDown(eventDown) {
6371
+ if (!isDrag) return;
6372
+ if (!_this.containerRef.current) return;
6373
+ var containerEl = _this.containerRef.current.containerRef;
6374
+ var left = containerEl.offsetLeft;
6375
+ var top = containerEl.offsetTop;
6376
+ console.log(left, top);
6377
+ var downX = eventDown.clientX;
6378
+ var downY = eventDown.clientY;
6379
+
6380
+ document.onmousemove = function (eventMove) {
6381
+ eventMove.stopPropagation();
6382
+ eventMove.preventDefault();
6383
+ var moveX = eventMove.clientX - downX;
6384
+ var moveY = eventMove.clientY - downY;
6385
+ containerEl.style.left = "".concat(left + moveX, "px");
6386
+ containerEl.style.top = "".concat(top + moveY, "px");
6387
+ };
6388
+ };
6389
+
6390
+ var onMouseUp = function onMouseUp(event) {
6391
+ document.onmousemove = null;
6392
+ };
6393
+
6371
6394
  return /*#__PURE__*/React__default['default'].createElement("div", {
6372
6395
  className: "model-header"
6373
6396
  }, /*#__PURE__*/React__default['default'].createElement("div", {
6374
6397
  ref: _this.titleRef,
6398
+ onMouseDown: onMouseDown,
6399
+ onMouseUp: onMouseUp,
6375
6400
  className: "model-title ".concat(isDrag ? 'move' : '')
6376
6401
  }, title), /*#__PURE__*/React__default['default'].createElement("div", {
6377
- className: "model-closeIcon",
6402
+ style: {
6403
+ display: 'flex',
6404
+ alignItems: 'center'
6405
+ },
6406
+ className: "model-closeIcon"
6407
+ }, showFullscreen && /*#__PURE__*/React__default['default'].createElement("span", {
6408
+ className: 'mr5 cp',
6409
+ onClick: function onClick() {
6410
+ _this.setState({
6411
+ isFullScreen: !_this.state.isFullScreen
6412
+ });
6413
+ }
6414
+ }, _this.state.isFullScreen ? renderMin || /*#__PURE__*/React__default['default'].createElement(icons.MinusOutlined, null) : renderFullScreen || /*#__PURE__*/React__default['default'].createElement(icons.FullscreenOutlined, null)), /*#__PURE__*/React__default['default'].createElement("span", {
6378
6415
  onClick: function onClick() {
6379
6416
  onClose && onClose();
6380
6417
  closeCb && closeCb();
6381
6418
  }
6382
- }, renderClose ? renderClose : /*#__PURE__*/React__default['default'].createElement(icons.CloseCircleOutlined, null)));
6419
+ }, renderClose ? renderClose : /*#__PURE__*/React__default['default'].createElement(icons.CloseCircleOutlined, null))));
6383
6420
  };
6384
6421
 
6385
6422
  _this.renderContent = function () {
@@ -6393,33 +6430,15 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
6393
6430
  }
6394
6431
 
6395
6432
  _createClass(Modal, [{
6396
- key: "componentDidMount",
6397
- value: function componentDidMount() {
6398
- var isDrag = this.props.isDrag;
6399
- if (!isDrag) return;
6400
- var tltleEl = this.titleRef.current;
6401
- var containerEl = this.containerRef.current.containerRef;
6402
-
6403
- tltleEl.onmousedown = function (eventDown) {
6404
- var left = containerEl.offsetLeft;
6405
- var top = containerEl.offsetTop;
6406
- console.log(left, top);
6407
- var downX = eventDown.clientX;
6408
- var downY = eventDown.clientY;
6409
-
6410
- document.onmousemove = function (eventMove) {
6411
- eventMove.stopPropagation();
6412
- eventMove.preventDefault();
6413
- var moveX = eventMove.clientX - downX;
6414
- var moveY = eventMove.clientY - downY;
6415
- containerEl.style.left = "".concat(left + moveX, "px");
6416
- containerEl.style.top = "".concat(top + moveY, "px");
6417
- };
6418
- };
6433
+ key: "componentDidUpdate",
6434
+ value: function componentDidUpdate(prevProps, prevState, snapshot) {
6435
+ var open = prevProps.open;
6419
6436
 
6420
- document.onmouseup = function (eventMove) {
6421
- document.onmousemove = null;
6422
- };
6437
+ if (!open) {
6438
+ this.setState({
6439
+ isFullScreen: false
6440
+ });
6441
+ }
6423
6442
  }
6424
6443
  }, {
6425
6444
  key: "render",
@@ -6444,6 +6463,12 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
6444
6463
  className: className,
6445
6464
  isDrag: isDrag,
6446
6465
  wrapClassName: wrapClassName,
6466
+ fullScreenStyle: this.state.isFullScreen ? {
6467
+ width: '100%',
6468
+ height: '100%',
6469
+ left: 0,
6470
+ top: 0
6471
+ } : {},
6447
6472
  style: style
6448
6473
  }, other), this.renderTop(), /*#__PURE__*/React__default['default'].createElement("div", {
6449
6474
  className: "model-content"
@@ -7603,22 +7628,32 @@ var TabelCard = function TabelCard(props, ref) {
7603
7628
  actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : _actionRef$current6.reload(true);
7604
7629
  };
7605
7630
 
7631
+ var onKeyUpSubmit = function onKeyUpSubmit(values) {
7632
+ if (values.keyCode === 13) {
7633
+ var _searchFormRef$curren, _searchFormRef$curren2, _actionRef$current7;
7634
+
7635
+ (searchFormConfig === null || searchFormConfig === void 0 ? void 0 : searchFormConfig.handleSubmit) && searchFormConfig.handleSubmit((_searchFormRef$curren = searchFormRef.current) === null || _searchFormRef$curren === void 0 ? void 0 : _searchFormRef$curren.getFormValues());
7636
+ formSearchRef.current = (_searchFormRef$curren2 = searchFormRef.current) === null || _searchFormRef$curren2 === void 0 ? void 0 : _searchFormRef$curren2.getFormValues();
7637
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
7638
+ }
7639
+ };
7640
+
7606
7641
  var onReset = function onReset(values) {
7607
- var _actionRef$current7;
7642
+ var _actionRef$current8;
7608
7643
 
7609
7644
  (searchFormConfig === null || searchFormConfig === void 0 ? void 0 : searchFormConfig.onReset) && searchFormConfig.onReset();
7610
7645
  formSearchRef.current = _objectSpread2({}, values);
7611
- actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : _actionRef$current7.reload(true);
7646
+ actionRef === null || actionRef === void 0 ? void 0 : (_actionRef$current8 = actionRef.current) === null || _actionRef$current8 === void 0 ? void 0 : _actionRef$current8.reload(true);
7612
7647
  };
7613
7648
 
7614
7649
  React.useEffect(function () {
7615
- var _searchFormRef$curren, _searchFormRef$curren2;
7650
+ var _searchFormRef$curren3, _searchFormRef$curren4;
7616
7651
 
7617
- if ((_searchFormRef$curren = searchFormRef.current) === null || _searchFormRef$curren === void 0 ? void 0 : (_searchFormRef$curren2 = _searchFormRef$curren.form) === null || _searchFormRef$curren2 === void 0 ? void 0 : _searchFormRef$curren2.getFieldsValue) {
7618
- var _searchFormRef$curren3;
7652
+ if ((_searchFormRef$curren3 = searchFormRef.current) === null || _searchFormRef$curren3 === void 0 ? void 0 : (_searchFormRef$curren4 = _searchFormRef$curren3.form) === null || _searchFormRef$curren4 === void 0 ? void 0 : _searchFormRef$curren4.getFieldsValue) {
7653
+ var _searchFormRef$curren5;
7619
7654
 
7620
7655
  var obj = // filterObj(searchFormRef.current?.form?.getFieldsValue()) || {};
7621
- filterObj((_searchFormRef$curren3 = searchFormRef.current) === null || _searchFormRef$curren3 === void 0 ? void 0 : _searchFormRef$curren3.handleSearch(true)) || {};
7656
+ filterObj((_searchFormRef$curren5 = searchFormRef.current) === null || _searchFormRef$curren5 === void 0 ? void 0 : _searchFormRef$curren5.handleSearch(true)) || {};
7622
7657
  (columns || []).filter(function (c) {
7623
7658
  return c.notInitialValueInSearch;
7624
7659
  }).forEach(function (item) {
@@ -7764,6 +7799,7 @@ var TabelCard = function TabelCard(props, ref) {
7764
7799
  }),
7765
7800
  onSubmit: onSubmit,
7766
7801
  onReset: onReset,
7802
+ onKeyUp: onKeyUpSubmit,
7767
7803
  columns: formSearchColumn.reduce(function (pre, column) {
7768
7804
  if (column.type == 'group') {
7769
7805
  return [].concat(_toConsumableArray(pre), _toConsumableArray(column.children));
@@ -11528,14 +11564,14 @@ function DhPlayer(_ref, ref) {
11528
11564
 
11529
11565
  var index$7 = /*#__PURE__*/React.forwardRef(DhPlayer);
11530
11566
 
11531
- var _excluded$m = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "visible", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
11567
+ var _excluded$m = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "open", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
11532
11568
 
11533
11569
  var DEFAULT_PLAY_BACK_RATE = [0.5, 0.75, 1, 1.5, 2]; // 默认记忆提示文字展示时长(s)
11534
11570
 
11535
11571
  var DEFAULT_LAST_PLAY_TIME_DELAY = 5; // 默认音量大小
11536
11572
 
11537
11573
  var DEFAULT_VOLUME = 0.6;
11538
- var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11574
+ var index$8 = (function (_ref) {
11539
11575
  var id = _ref.id,
11540
11576
  _ref$videoUrls = _ref.videoUrls,
11541
11577
  videoUrls = _ref$videoUrls === void 0 ? [] : _ref$videoUrls,
@@ -11549,8 +11585,8 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11549
11585
  setParentIndex = _ref.setCurrentIndex,
11550
11586
  className = _ref.className,
11551
11587
  style = _ref.style,
11552
- _ref$visible = _ref.visible,
11553
- visible = _ref$visible === void 0 ? true : _ref$visible,
11588
+ _ref$open = _ref.open,
11589
+ open = _ref$open === void 0 ? true : _ref$open,
11554
11590
  _ref$autoplay = _ref.autoplay,
11555
11591
  autoplay = _ref$autoplay === void 0 ? false : _ref$autoplay,
11556
11592
  _ref$videoInit = _ref.videoInit,
@@ -11562,26 +11598,19 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11562
11598
  props = _objectWithoutProperties(_ref, _excluded$m);
11563
11599
 
11564
11600
  var player = React.useRef();
11565
-
11566
- var _useState = React.useState(true),
11567
- _useState2 = _slicedToArray(_useState, 2),
11568
- firstRender = _useState2[0],
11569
- setFirstRender = _useState2[1];
11570
-
11571
- var _useState3 = React.useState(false),
11572
- _useState4 = _slicedToArray(_useState3, 2),
11573
- ready = _useState4[0],
11574
- setReady = _useState4[1];
11575
-
11576
11601
  var currentPlayerIndex = React.useRef(0); // 内置的 index 状态管理
11577
11602
 
11578
- var _useState5 = React.useState(0),
11579
- _useState6 = _slicedToArray(_useState5, 2),
11580
- videoIndex = _useState6[0],
11581
- setVideoIndex = _useState6[1];
11582
-
11583
- var currentIndex = parentIndex !== null && parentIndex !== void 0 ? parentIndex : videoIndex;
11584
- var setCurrentIndex = setParentIndex !== null && setParentIndex !== void 0 ? setParentIndex : setVideoIndex;
11603
+ var _useState = React.useState(0),
11604
+ _useState2 = _slicedToArray(_useState, 2),
11605
+ videoIndex = _useState2[0],
11606
+ setVideoIndex = _useState2[1];
11607
+
11608
+ var currentIndex = React.useMemo(function () {
11609
+ return parentIndex !== null && parentIndex !== void 0 ? parentIndex : videoIndex;
11610
+ }, [parentIndex, videoIndex]);
11611
+ var setCurrentIndex = React.useMemo(function () {
11612
+ return setParentIndex !== null && setParentIndex !== void 0 ? setParentIndex : setVideoIndex;
11613
+ }, [setParentIndex, setVideoIndex]);
11585
11614
  var config = React.useRef(_objectSpread2({
11586
11615
  url: videoUrls[0],
11587
11616
  playbackRate: DEFAULT_PLAY_BACK_RATE,
@@ -11595,52 +11624,25 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11595
11624
  }, props));
11596
11625
  /** 设置当前播放 index */
11597
11626
 
11598
- var handleSetCurrentIndex = React.useCallback(function (_ref2) {
11599
- var currentIdx = _ref2.currentIdx,
11600
- videoUrls = _ref2.videoUrls;
11627
+ var handleSetCurrentIndex = React.useCallback(function (currentIdx) {
11601
11628
  var newIdx = currentIdx !== null && currentIdx !== void 0 ? currentIdx : currentPlayerIndex.current + 1;
11602
11629
 
11603
11630
  if (newIdx >= videoUrls.length) {
11604
- newIdx = 0;
11631
+ if (isLoop) {
11632
+ // 允许循环则播放起始视频
11633
+ newIdx = 0;
11634
+ } else if (player.current && player.current.video) {
11635
+ // 不允许循环则进度条快进到最后
11636
+ player.current.currentTime = player.current.video.duration;
11637
+ return;
11638
+ }
11605
11639
  }
11606
11640
 
11607
11641
  setCurrentIndex(newIdx);
11608
- }, [setCurrentIndex]);
11609
- /** 结束事件 */
11610
-
11611
- var onEnd = React.useCallback(function (isLoop, videoUrls) {
11612
- return function () {
11613
- // 如果是循环或有其他视频未播放完,继续播放下一个
11614
- if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
11615
- setTimeout(function () {
11616
- var _player$current;
11617
-
11618
- return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
11619
- });
11620
- }
11621
-
11622
- handleSetCurrentIndex({
11623
- videoUrls: videoUrls
11624
- });
11625
- };
11626
- }, [handleSetCurrentIndex]);
11627
- /** 点击下一个事件 */
11628
-
11629
- var onPlayNextBtnClick = React.useCallback(function (videoUrls) {
11630
- return function () {
11631
- if (player.current) {
11632
- // 防止 next 按钮消失
11633
- player.current.currentVideoIndex = videoUrls.length - 2;
11634
- }
11635
-
11636
- handleSetCurrentIndex({
11637
- videoUrls: videoUrls
11638
- });
11639
- };
11640
- }, [handleSetCurrentIndex]);
11642
+ }, [isLoop, setCurrentIndex, videoUrls.length]);
11641
11643
  /** 播放下一个 */
11642
11644
 
11643
- var handlePlayNext = React.useCallback(function (currentIdx, isLoop) {
11645
+ var handlePlayNext = React.useCallback(function (currentIdx) {
11644
11646
  if (!player.current) {
11645
11647
  return;
11646
11648
  }
@@ -11654,7 +11656,7 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11654
11656
  // 防止 next 按钮消失
11655
11657
  player.current.currentVideoIndex = -videoUrls.length;
11656
11658
  }
11657
- }, [videoUrls]);
11659
+ }, [videoUrls, isLoop]);
11658
11660
  /** 重置视频 */
11659
11661
 
11660
11662
  var handleReset = React.useCallback(function () {
@@ -11670,47 +11672,47 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11670
11672
  /** 弹窗中的视频关闭以后重置 */
11671
11673
 
11672
11674
  React.useEffect(function () {
11673
- if (!visible) {
11675
+ if (!open) {
11674
11676
  handleReset();
11675
11677
  }
11676
- }, [handleReset, visible]);
11678
+ }, [handleReset, open]);
11677
11679
  /** 当 currentIndex 改变以后自动播放下一个 */
11678
11680
 
11679
11681
  React.useEffect(function () {
11680
- if (!player.current || !visible) {
11682
+ if (!player.current || !open) {
11681
11683
  return;
11682
11684
  }
11683
11685
 
11684
- handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current, isLoop);
11685
- }, [currentIndex, handlePlayNext, isLoop, visible]);
11686
+ handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current);
11687
+ }, [currentIndex, handlePlayNext, open]);
11686
11688
  /** 播放器初始化并绑定事件 */
11687
11689
 
11688
11690
  React.useEffect(function () {
11689
- var _player$current4;
11690
-
11691
- if (!visible || lodashEs.isEmpty(videoUrls) || player.current) {
11691
+ if (!open || lodashEs.isEmpty(videoUrls) || player.current) {
11692
11692
  return;
11693
11693
  }
11694
11694
 
11695
- var newConfig = _objectSpread2(_objectSpread2({}, config.current), {}, {
11696
- muted: muted,
11697
- volume: muted ? 0 : DEFAULT_VOLUME,
11698
- autoplay: autoplay,
11699
- videoInit: videoInit
11700
- });
11695
+ player.current = new Player__default['default'](config.current);
11696
+ player.current.currentVideoIndex = -videoUrls.length;
11697
+ player.current.on('ended', function () {
11698
+ // 如果是循环或有其他视频未播放完,继续播放下一个
11699
+ if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
11700
+ handleSetCurrentIndex();
11701
+ setTimeout(function () {
11702
+ var _player$current;
11701
11703
 
11702
- setReady(false);
11703
- setFirstRender(false); // @ts-ignore
11704
+ return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
11705
+ });
11706
+ } else {
11707
+ var _player$current2;
11704
11708
 
11705
- player.current = new Player__default['default'](newConfig);
11706
- player.current.currentVideoIndex = -videoUrls.length;
11707
- player.current.on('ended', onEnd(isLoop, videoUrls)); // 播放记忆缓存
11709
+ (_player$current2 = player.current) === null || _player$current2 === void 0 ? void 0 : _player$current2.pause();
11710
+ }
11711
+ }); // 播放记忆缓存
11708
11712
 
11709
11713
  if (enableMemory) {
11710
- var _player$current2;
11711
-
11712
11714
  var videoPlayedTimeObj = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}');
11713
- (_player$current2 = player.current) === null || _player$current2 === void 0 ? void 0 : _player$current2.on('timeupdate', function () {
11715
+ player.current.on('timeupdate', function () {
11714
11716
  var _player$current3;
11715
11717
 
11716
11718
  if (currentPlayerIndex.current === -1) {
@@ -11724,23 +11726,27 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11724
11726
  });
11725
11727
  }
11726
11728
 
11727
- (_player$current4 = player.current) === null || _player$current4 === void 0 ? void 0 : _player$current4.on('playNextBtnClick', onPlayNextBtnClick(videoUrls));
11728
- }, [ready, autoplay, enableMemory, handleSetCurrentIndex, id, isLoop, videoUrls, videoUrls.length, visible, muted, videoInit, onEnd, onPlayNextBtnClick]);
11729
+ player.current.on('playNextBtnClick', function () {
11730
+ if (!isLoop && player.current) {
11731
+ // 防止 next 按钮消失
11732
+ player.current.currentVideoIndex = videoUrls.length - 2;
11733
+ }
11734
+
11735
+ handleSetCurrentIndex();
11736
+ });
11737
+ }, [autoplay, enableMemory, handleSetCurrentIndex, id, isLoop, videoUrls, videoUrls.length, open]);
11729
11738
  /** 读取缓存的播放记忆并跳转 */
11730
11739
 
11731
11740
  React.useEffect(function () {
11732
- if (enableMemory && visible) {
11741
+ if (enableMemory && open) {
11733
11742
  var _JSON$parse;
11734
11743
 
11735
- var _ref3 = ((_JSON$parse = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse[id]) || {},
11736
- lastPlayTime = _ref3.lastPlayTime,
11737
- _videoIndex = _ref3.videoIndex;
11744
+ var _ref2 = ((_JSON$parse = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse[id]) || {},
11745
+ lastPlayTime = _ref2.lastPlayTime,
11746
+ _videoIndex = _ref2.videoIndex;
11738
11747
 
11739
11748
  setTimeout(function () {
11740
- handleSetCurrentIndex({
11741
- currentIdx: _videoIndex,
11742
- videoUrls: videoUrls
11743
- });
11749
+ handleSetCurrentIndex(_videoIndex);
11744
11750
  setTimeout(function () {
11745
11751
  if (player.current) {
11746
11752
  player.current.currentTime = lastPlayTime;
@@ -11748,7 +11754,7 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11748
11754
  });
11749
11755
  });
11750
11756
  }
11751
- }, [visible, enableMemory, handleSetCurrentIndex, id, videoUrls]);
11757
+ }, [open, enableMemory, handleSetCurrentIndex, id]);
11752
11758
  /** 加载清晰度配置 */
11753
11759
 
11754
11760
  React.useEffect(function () {
@@ -11756,23 +11762,10 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11756
11762
  player.current.emit('resourceReady', definitionList[currentIndex]);
11757
11763
  }
11758
11764
  }, [currentIndex, definitionList]);
11759
- React.useEffect(function () {
11760
- var _player$current5, _player$current6, _player$current7;
11761
-
11762
- if (firstRender) {
11763
- return;
11764
- }
11765
-
11766
- (_player$current5 = player.current) === null || _player$current5 === void 0 ? void 0 : _player$current5.off('ended', onEnd(isLoop, videoUrls));
11767
- (_player$current6 = player.current) === null || _player$current6 === void 0 ? void 0 : _player$current6.off('playNextBtnClick', onPlayNextBtnClick(videoUrls));
11768
- (_player$current7 = player.current) === null || _player$current7 === void 0 ? void 0 : _player$current7.destroy();
11769
- player.current = undefined;
11770
- setReady(true); // eslint-disable-next-line react-hooks/exhaustive-deps
11771
- }, [muted, isLoop, videoUrls, autoplay, videoInit, onEnd, onPlayNextBtnClick]);
11772
- var getRef = React.useCallback(function (r) {
11773
- if (r && visible) {
11765
+ var getRef = React.useCallback(function (ref) {
11766
+ if (ref && open) {
11774
11767
  var newConfig = _objectSpread2(_objectSpread2({}, config.current), {}, {
11775
- el: r,
11768
+ el: ref,
11776
11769
  url: videoUrls[0],
11777
11770
  playNext: {
11778
11771
  urlList: videoUrls.slice(1)
@@ -11782,8 +11775,8 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11782
11775
  if (enableMemory) {
11783
11776
  var _JSON$parse2;
11784
11777
 
11785
- var _ref4 = ((_JSON$parse2 = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2[id]) || {},
11786
- lastPlayTime = _ref4.lastPlayTime;
11778
+ var _ref3 = ((_JSON$parse2 = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2[id]) || {},
11779
+ lastPlayTime = _ref3.lastPlayTime;
11787
11780
 
11788
11781
  Object.assign(newConfig, {
11789
11782
  lastPlayTime: lastPlayTime,
@@ -11793,15 +11786,7 @@ var index$8 = /*#__PURE__*/React.forwardRef(function (_ref, playerRef) {
11793
11786
 
11794
11787
  config.current = newConfig;
11795
11788
  }
11796
-
11797
- if (playerRef) {
11798
- if (typeof playerRef === 'function') {
11799
- playerRef(player.current);
11800
- } else {
11801
- playerRef.current = player.current;
11802
- }
11803
- }
11804
- }, [visible, playerRef, videoUrls, enableMemory, id, lastPlayTimeHideDelay]);
11789
+ }, [open, id, videoUrls, lastPlayTimeHideDelay, enableMemory]);
11805
11790
  return /*#__PURE__*/React__default['default'].createElement("div", {
11806
11791
  className: className,
11807
11792
  ref: getRef,