wargerm 0.4.22 → 0.4.23
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/components/Video/example/VideoDemo/demo1.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo2.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo3.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo4.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo5.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo6.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo7.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo8.d.ts +3 -0
- package/dist/components/Video/example/VideoDemo/demo9.d.ts +3 -0
- package/dist/components/Video/index.d.ts +35 -0
- package/dist/index.css +9 -9
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.css +9 -9
- package/dist/index.esm.js +252 -180
- package/dist/index.js +251 -179
- package/package.json +1 -1
- package/dist/components/VirtualList/index.d.ts +0 -35
- package/dist/global.d.ts +0 -1
package/dist/index.js
CHANGED
@@ -55,6 +55,7 @@ var ProTable = require('@ant-design/pro-table');
|
|
55
55
|
var Player = require('xgplayer');
|
56
56
|
var FlvPlayer = require('xgplayer-flv.js');
|
57
57
|
var HlsJsPlayer = require('xgplayer-hls.js');
|
58
|
+
var lodash = require('lodash');
|
58
59
|
|
59
60
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
60
61
|
|
@@ -8757,166 +8758,7 @@ var Index$8 = function Index(props) {
|
|
8757
8758
|
|
8758
8759
|
Index$8.defaultProps = {};
|
8759
8760
|
|
8760
|
-
var _excluded$a = ["
|
8761
|
-
|
8762
|
-
var _sizeProp, _positionProp;
|
8763
|
-
var DIRECTION;
|
8764
|
-
|
8765
|
-
(function (DIRECTION) {
|
8766
|
-
DIRECTION["HORIZONTAL"] = "horizontal";
|
8767
|
-
DIRECTION["VERTICAL"] = "vertical";
|
8768
|
-
})(DIRECTION || (DIRECTION = {}));
|
8769
|
-
|
8770
|
-
var STYLE_WRAPPER = {
|
8771
|
-
overflow: 'auto',
|
8772
|
-
willChange: 'transform',
|
8773
|
-
WebkitOverflowScrolling: 'touch'
|
8774
|
-
};
|
8775
|
-
var STYLE_INNER = {
|
8776
|
-
position: 'relative',
|
8777
|
-
minWidth: '100%',
|
8778
|
-
minHeight: '100%'
|
8779
|
-
};
|
8780
|
-
var sizeProp = (_sizeProp = {}, _defineProperty(_sizeProp, DIRECTION.VERTICAL, 'height'), _defineProperty(_sizeProp, DIRECTION.HORIZONTAL, 'width'), _sizeProp);
|
8781
|
-
var positionProp = (_positionProp = {}, _defineProperty(_positionProp, DIRECTION.VERTICAL, 'top'), _defineProperty(_positionProp, DIRECTION.HORIZONTAL, 'left'), _positionProp);
|
8782
|
-
|
8783
|
-
var VirtualList = function VirtualList(props) {
|
8784
|
-
var width = props.width,
|
8785
|
-
height = props.height,
|
8786
|
-
itemCount = props.itemCount,
|
8787
|
-
itemSize = props.itemSize,
|
8788
|
-
renderItem = props.renderItem,
|
8789
|
-
_props$style = props.style,
|
8790
|
-
style = _props$style === void 0 ? {} : _props$style,
|
8791
|
-
onScroll = props.onScroll,
|
8792
|
-
scrollOffset = props.scrollOffset,
|
8793
|
-
_props$overscanCount = props.overscanCount,
|
8794
|
-
overscanCount = _props$overscanCount === void 0 ? 3 : _props$overscanCount,
|
8795
|
-
_props$scrollDirectio = props.scrollDirection,
|
8796
|
-
scrollDirection = _props$scrollDirectio === void 0 ? DIRECTION.VERTICAL : _props$scrollDirectio,
|
8797
|
-
otherProps = _objectWithoutProperties(props, _excluded$a);
|
8798
|
-
|
8799
|
-
var rootNode = React.useRef(null);
|
8800
|
-
|
8801
|
-
var _useState = React.useState(scrollOffset || 0),
|
8802
|
-
_useState2 = _slicedToArray(_useState, 2),
|
8803
|
-
offset = _useState2[0],
|
8804
|
-
setOffset = _useState2[1];
|
8805
|
-
|
8806
|
-
var _useState3 = React.useState({}),
|
8807
|
-
_useState4 = _slicedToArray(_useState3, 1),
|
8808
|
-
styleCache = _useState4[0];
|
8809
|
-
|
8810
|
-
var _useState5 = React.useState(false),
|
8811
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
8812
|
-
isMount = _useState6[0],
|
8813
|
-
setMount = _useState6[1];
|
8814
|
-
|
8815
|
-
React.useEffect(function () {
|
8816
|
-
var _rootNode$current;
|
8817
|
-
|
8818
|
-
if (!isMount) setMount(true); // 强制更新一次,供 getVisibleRange 方法获取 DOM 挂载后 containerSize
|
8819
|
-
|
8820
|
-
if (scrollOffset) scrollTo(scrollOffset);
|
8821
|
-
(_rootNode$current = rootNode.current) === null || _rootNode$current === void 0 ? void 0 : _rootNode$current.addEventListener('scroll', handleScroll, {
|
8822
|
-
passive: true // 用于优化浏览器页面滚动的性能
|
8823
|
-
|
8824
|
-
});
|
8825
|
-
return function () {
|
8826
|
-
var _rootNode$current2;
|
8827
|
-
|
8828
|
-
(_rootNode$current2 = rootNode.current) === null || _rootNode$current2 === void 0 ? void 0 : _rootNode$current2.removeEventListener('scroll', handleScroll);
|
8829
|
-
};
|
8830
|
-
}, []);
|
8831
|
-
|
8832
|
-
var handleScroll = function handleScroll(event) {
|
8833
|
-
var _rootNode$current3 = rootNode.current,
|
8834
|
-
_rootNode$current3$sc = _rootNode$current3.scrollTop,
|
8835
|
-
scrollTop = _rootNode$current3$sc === void 0 ? 0 : _rootNode$current3$sc,
|
8836
|
-
_rootNode$current3$sc2 = _rootNode$current3.scrollLeft,
|
8837
|
-
scrollLeft = _rootNode$current3$sc2 === void 0 ? 0 : _rootNode$current3$sc2;
|
8838
|
-
var newOffset = scrollDirection === DIRECTION.VERTICAL ? scrollTop : scrollLeft;
|
8839
|
-
|
8840
|
-
if (newOffset < 0 || newOffset === offset || event.target !== rootNode.current) {
|
8841
|
-
return;
|
8842
|
-
}
|
8843
|
-
|
8844
|
-
setOffset(newOffset);
|
8845
|
-
|
8846
|
-
if (typeof onScroll === 'function') {
|
8847
|
-
onScroll(offset, event);
|
8848
|
-
}
|
8849
|
-
};
|
8850
|
-
|
8851
|
-
var scrollTo = function scrollTo(value) {
|
8852
|
-
if (scrollDirection === DIRECTION.VERTICAL) {
|
8853
|
-
rootNode.current.scrollTop = value;
|
8854
|
-
} else {
|
8855
|
-
rootNode.current.scrollLeft = value;
|
8856
|
-
}
|
8857
|
-
};
|
8858
|
-
|
8859
|
-
var getVisibleRange = function getVisibleRange() {
|
8860
|
-
var _ref = rootNode.current || {},
|
8861
|
-
_ref$clientHeight = _ref.clientHeight,
|
8862
|
-
clientHeight = _ref$clientHeight === void 0 ? 0 : _ref$clientHeight,
|
8863
|
-
_ref$clientWidth = _ref.clientWidth,
|
8864
|
-
clientWidth = _ref$clientWidth === void 0 ? 0 : _ref$clientWidth;
|
8865
|
-
|
8866
|
-
var containerSize = scrollDirection === DIRECTION.VERTICAL ? clientHeight : clientWidth;
|
8867
|
-
var start = Math.floor(offset / itemSize - 1); // start --> 向下取整 (索引是从0开始,所以 - 1)
|
8868
|
-
|
8869
|
-
var stop = Math.ceil((offset + containerSize) / itemSize - 1); // stop --> 向上取整
|
8870
|
-
|
8871
|
-
return {
|
8872
|
-
start: Math.max(0, start - overscanCount),
|
8873
|
-
stop: Math.min(stop + overscanCount, itemCount - 1)
|
8874
|
-
};
|
8875
|
-
};
|
8876
|
-
|
8877
|
-
var getStyle = function getStyle(index) {
|
8878
|
-
var _styleCache$index;
|
8879
|
-
|
8880
|
-
var style = styleCache[index];
|
8881
|
-
if (style) return style;
|
8882
|
-
return styleCache[index] = (_styleCache$index = {
|
8883
|
-
position: 'absolute',
|
8884
|
-
top: 0,
|
8885
|
-
left: 0,
|
8886
|
-
width: '100%'
|
8887
|
-
}, _defineProperty(_styleCache$index, sizeProp[scrollDirection], props.itemSize), _defineProperty(_styleCache$index, positionProp[scrollDirection], props.itemSize * index), _styleCache$index);
|
8888
|
-
};
|
8889
|
-
|
8890
|
-
var wrapperStyle = _objectSpread2(_objectSpread2(_objectSpread2({}, STYLE_WRAPPER), style), {}, {
|
8891
|
-
height: height,
|
8892
|
-
width: width
|
8893
|
-
});
|
8894
|
-
|
8895
|
-
var innerStyle = _objectSpread2(_objectSpread2({}, STYLE_INNER), {}, _defineProperty({}, sizeProp[scrollDirection], itemCount * itemSize));
|
8896
|
-
|
8897
|
-
var items = [];
|
8898
|
-
|
8899
|
-
var _getVisibleRange = getVisibleRange(),
|
8900
|
-
start = _getVisibleRange.start,
|
8901
|
-
stop = _getVisibleRange.stop;
|
8902
|
-
|
8903
|
-
for (var index = start; index <= stop; index++) {
|
8904
|
-
items.push(renderItem({
|
8905
|
-
index: index,
|
8906
|
-
style: getStyle(index)
|
8907
|
-
}));
|
8908
|
-
}
|
8909
|
-
|
8910
|
-
return /*#__PURE__*/React__default['default'].createElement("div", _objectSpread2(_objectSpread2({
|
8911
|
-
ref: rootNode
|
8912
|
-
}, otherProps), {}, {
|
8913
|
-
style: wrapperStyle
|
8914
|
-
}), /*#__PURE__*/React__default['default'].createElement("div", {
|
8915
|
-
style: innerStyle
|
8916
|
-
}, items));
|
8917
|
-
};
|
8918
|
-
|
8919
|
-
var _excluded$b = ["list", "render", "none", "partSize"];
|
8761
|
+
var _excluded$a = ["list", "render", "none", "partSize"];
|
8920
8762
|
|
8921
8763
|
function AutoScroll(props) {
|
8922
8764
|
var inner1 = React.useRef();
|
@@ -9001,7 +8843,7 @@ var Index$9 = function Index(_ref) {
|
|
9001
8843
|
none = _ref.none,
|
9002
8844
|
_ref$partSize = _ref.partSize,
|
9003
8845
|
partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
|
9004
|
-
otherProps = _objectWithoutProperties(_ref, _excluded$
|
8846
|
+
otherProps = _objectWithoutProperties(_ref, _excluded$a);
|
9005
8847
|
|
9006
8848
|
var _useState = React.useState([]),
|
9007
8849
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -9084,7 +8926,7 @@ var Index$9 = function Index(_ref) {
|
|
9084
8926
|
}, none || '暂无数据');
|
9085
8927
|
};
|
9086
8928
|
|
9087
|
-
var _excluded$
|
8929
|
+
var _excluded$b = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
|
9088
8930
|
|
9089
8931
|
SwiperCore__default['default'].use([SwiperCore.Pagination, SwiperCore.Navigation, SwiperCore.Autoplay, SwiperCore.Virtual]);
|
9090
8932
|
|
@@ -9096,7 +8938,7 @@ var Index$a = function Index(props) {
|
|
9096
8938
|
rowKey = props.rowKey,
|
9097
8939
|
onSwiperChange = props.onSwiperChange,
|
9098
8940
|
renderItem = props.renderItem,
|
9099
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
8941
|
+
extraProps = _objectWithoutProperties(props, _excluded$b);
|
9100
8942
|
|
9101
8943
|
var _useState = React.useState(null),
|
9102
8944
|
_useState2 = _slicedToArray(_useState, 2),
|
@@ -9747,7 +9589,7 @@ function createBrowserHistory(props) {
|
|
9747
9589
|
return history;
|
9748
9590
|
}
|
9749
9591
|
|
9750
|
-
var _excluded$
|
9592
|
+
var _excluded$c = ["routes", "className"];
|
9751
9593
|
var history = createBrowserHistory();
|
9752
9594
|
|
9753
9595
|
function itemRender(route, params, routes, paths) {
|
@@ -9765,7 +9607,7 @@ function itemRender(route, params, routes, paths) {
|
|
9765
9607
|
var Index$b = function Index(_ref) {
|
9766
9608
|
var routes = _ref.routes,
|
9767
9609
|
className = _ref.className,
|
9768
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
9610
|
+
props = _objectWithoutProperties(_ref, _excluded$c);
|
9769
9611
|
|
9770
9612
|
return /*#__PURE__*/React__default['default'].createElement(_Breadcrumb__default['default'], _objectSpread2({
|
9771
9613
|
className: className || 'default',
|
@@ -9775,7 +9617,7 @@ var Index$b = function Index(_ref) {
|
|
9775
9617
|
}, props));
|
9776
9618
|
};
|
9777
9619
|
|
9778
|
-
var _excluded$
|
9620
|
+
var _excluded$d = ["title", "className", "headerTail", "headerCenter", "sliderTabs"];
|
9779
9621
|
|
9780
9622
|
var Index$c = function Index(_ref, ref) {
|
9781
9623
|
var _classNames;
|
@@ -9786,7 +9628,7 @@ var Index$c = function Index(_ref, ref) {
|
|
9786
9628
|
headerTail = _ref.headerTail,
|
9787
9629
|
headerCenter = _ref.headerCenter,
|
9788
9630
|
sliderTabs = _ref.sliderTabs,
|
9789
|
-
props = _objectWithoutProperties(_ref, _excluded$
|
9631
|
+
props = _objectWithoutProperties(_ref, _excluded$d);
|
9790
9632
|
|
9791
9633
|
React.useImperativeHandle(ref, function () {
|
9792
9634
|
return {
|
@@ -10028,7 +9870,7 @@ function DialogModel(props, ref) {
|
|
10028
9870
|
|
10029
9871
|
var Dialog = /*#__PURE__*/React__default['default'].forwardRef(DialogModel);
|
10030
9872
|
|
10031
|
-
var _excluded$
|
9873
|
+
var _excluded$e = ["visible", "width", "closeCb", "onClose", "className", "style"],
|
10032
9874
|
_excluded2$3 = ["visible"];
|
10033
9875
|
|
10034
9876
|
var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
@@ -10145,7 +9987,7 @@ var Modal = /*#__PURE__*/function (_React$PureComponent) {
|
|
10145
9987
|
onClose = _this$props4.onClose,
|
10146
9988
|
className = _this$props4.className,
|
10147
9989
|
style = _this$props4.style,
|
10148
|
-
other = _objectWithoutProperties(_this$props4, _excluded$
|
9990
|
+
other = _objectWithoutProperties(_this$props4, _excluded$e);
|
10149
9991
|
|
10150
9992
|
return /*#__PURE__*/React__default['default'].createElement(Dialog, _objectSpread2({
|
10151
9993
|
ref: this.containerRef,
|
@@ -10328,7 +10170,7 @@ function DialogModel$1(props) {
|
|
10328
10170
|
return renderChildren;
|
10329
10171
|
}
|
10330
10172
|
|
10331
|
-
var _excluded$
|
10173
|
+
var _excluded$f = ["visible"];
|
10332
10174
|
|
10333
10175
|
var Modal$1 = /*#__PURE__*/function (_React$PureComponent) {
|
10334
10176
|
_inherits(Modal, _React$PureComponent);
|
@@ -10468,7 +10310,7 @@ Modal$1.show = function (config) {
|
|
10468
10310
|
manager.setShow = setShow;
|
10469
10311
|
|
10470
10312
|
var visible = props.visible,
|
10471
|
-
trueProps = _objectWithoutProperties(props, _excluded$
|
10313
|
+
trueProps = _objectWithoutProperties(props, _excluded$f);
|
10472
10314
|
|
10473
10315
|
React.useEffect(function () {
|
10474
10316
|
manager.mounted = true;
|
@@ -10492,7 +10334,7 @@ Modal$1.hidden = function () {
|
|
10492
10334
|
ModalContainer[modelSysbol] && ModalContainer[modelSysbol].hidden();
|
10493
10335
|
};
|
10494
10336
|
|
10495
|
-
var _excluded$
|
10337
|
+
var _excluded$g = ["columns", "extraColumns", "search", "visible", "setVisible", "disabled", "submitMethod", "onSubmitSuccess", "title", "record", "onFormChange"];
|
10496
10338
|
|
10497
10339
|
var ModalForm = function ModalForm(props, ref) {
|
10498
10340
|
var columns = props.columns,
|
@@ -10506,7 +10348,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10506
10348
|
title = props.title,
|
10507
10349
|
record = props.record,
|
10508
10350
|
onFormChange = props.onFormChange,
|
10509
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
10351
|
+
extraProps = _objectWithoutProperties(props, _excluded$g);
|
10510
10352
|
|
10511
10353
|
var formRef = React.useRef(null);
|
10512
10354
|
|
@@ -10637,7 +10479,7 @@ var ModalForm = function ModalForm(props, ref) {
|
|
10637
10479
|
|
10638
10480
|
var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
|
10639
10481
|
|
10640
|
-
var _excluded$
|
10482
|
+
var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
|
10641
10483
|
|
10642
10484
|
var TabelCard = function TabelCard(props, ref) {
|
10643
10485
|
var columns = props.columns,
|
@@ -10654,7 +10496,7 @@ var TabelCard = function TabelCard(props, ref) {
|
|
10654
10496
|
optionColumnConfig = props.optionColumnConfig,
|
10655
10497
|
pagination = props.pagination,
|
10656
10498
|
noBordered = props.noBordered,
|
10657
|
-
extraProps = _objectWithoutProperties(props, _excluded$
|
10499
|
+
extraProps = _objectWithoutProperties(props, _excluded$h);
|
10658
10500
|
|
10659
10501
|
var actionRef = React.useRef();
|
10660
10502
|
var modalFormRef = React.useRef(null);
|
@@ -11369,12 +11211,12 @@ function Xgplay(_ref, fRef) {
|
|
11369
11211
|
}
|
11370
11212
|
|
11371
11213
|
return function () {
|
11372
|
-
var _playerRef$current
|
11214
|
+
var _playerRef$current;
|
11373
11215
|
|
11374
|
-
(_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 :
|
11216
|
+
(_playerRef$current = playerRef.current) === null || _playerRef$current === void 0 ? void 0 : _playerRef$current.destroy(true);
|
11375
11217
|
setRef(null);
|
11376
11218
|
};
|
11377
|
-
});
|
11219
|
+
}, []);
|
11378
11220
|
React.useImperativeHandle(fRef, function () {
|
11379
11221
|
return {
|
11380
11222
|
player: playerRef.current
|
@@ -11579,6 +11421,236 @@ function VideoPlayer(_ref, ref) {
|
|
11579
11421
|
|
11580
11422
|
var index$3 = /*#__PURE__*/React.forwardRef(VideoPlayer);
|
11581
11423
|
|
11424
|
+
var _excluded$i = ["id", "videoUrls", "definitionList", "isLoop", "muted", "currentIndex", "setCurrentIndex", "className", "style", "visible", "autoplay", "videoInit", "enableMemory", "lastPlayTimeHideDelay"];
|
11425
|
+
|
11426
|
+
var DEFAULT_PLAY_BACK_RATE = [0.5, 0.75, 1, 1.5, 2]; // 默认记忆提示文字展示时长(s)
|
11427
|
+
|
11428
|
+
var DEFAULT_LAST_PLAY_TIME_DELAY = 5; // 默认音量大小
|
11429
|
+
|
11430
|
+
var DEFAULT_VOLUME = 0.6;
|
11431
|
+
var index$4 = (function (_ref) {
|
11432
|
+
var id = _ref.id,
|
11433
|
+
_ref$videoUrls = _ref.videoUrls,
|
11434
|
+
videoUrls = _ref$videoUrls === void 0 ? [] : _ref$videoUrls,
|
11435
|
+
_ref$definitionList = _ref.definitionList,
|
11436
|
+
definitionList = _ref$definitionList === void 0 ? [] : _ref$definitionList,
|
11437
|
+
_ref$isLoop = _ref.isLoop,
|
11438
|
+
isLoop = _ref$isLoop === void 0 ? true : _ref$isLoop,
|
11439
|
+
_ref$muted = _ref.muted,
|
11440
|
+
muted = _ref$muted === void 0 ? false : _ref$muted,
|
11441
|
+
parentIndex = _ref.currentIndex,
|
11442
|
+
setParentIndex = _ref.setCurrentIndex,
|
11443
|
+
className = _ref.className,
|
11444
|
+
style = _ref.style,
|
11445
|
+
_ref$visible = _ref.visible,
|
11446
|
+
visible = _ref$visible === void 0 ? true : _ref$visible,
|
11447
|
+
_ref$autoplay = _ref.autoplay,
|
11448
|
+
autoplay = _ref$autoplay === void 0 ? false : _ref$autoplay,
|
11449
|
+
_ref$videoInit = _ref.videoInit,
|
11450
|
+
videoInit = _ref$videoInit === void 0 ? true : _ref$videoInit,
|
11451
|
+
_ref$enableMemory = _ref.enableMemory,
|
11452
|
+
enableMemory = _ref$enableMemory === void 0 ? false : _ref$enableMemory,
|
11453
|
+
_ref$lastPlayTimeHide = _ref.lastPlayTimeHideDelay,
|
11454
|
+
lastPlayTimeHideDelay = _ref$lastPlayTimeHide === void 0 ? DEFAULT_LAST_PLAY_TIME_DELAY : _ref$lastPlayTimeHide,
|
11455
|
+
props = _objectWithoutProperties(_ref, _excluded$i);
|
11456
|
+
|
11457
|
+
var player = React.useRef();
|
11458
|
+
var currentPlayerIndex = React.useRef(0); // 内置的 index 状态管理
|
11459
|
+
|
11460
|
+
var _useState = React.useState(0),
|
11461
|
+
_useState2 = _slicedToArray(_useState, 2),
|
11462
|
+
videoIndex = _useState2[0],
|
11463
|
+
setVideoIndex = _useState2[1];
|
11464
|
+
|
11465
|
+
var currentIndex = React.useMemo(function () {
|
11466
|
+
return parentIndex !== null && parentIndex !== void 0 ? parentIndex : videoIndex;
|
11467
|
+
}, [parentIndex, videoIndex]);
|
11468
|
+
var setCurrentIndex = React.useMemo(function () {
|
11469
|
+
return setParentIndex !== null && setParentIndex !== void 0 ? setParentIndex : setVideoIndex;
|
11470
|
+
}, [setParentIndex, setVideoIndex]);
|
11471
|
+
var config = React.useRef(_objectSpread2({
|
11472
|
+
url: videoUrls[0],
|
11473
|
+
playbackRate: DEFAULT_PLAY_BACK_RATE,
|
11474
|
+
playNext: {
|
11475
|
+
urlList: videoUrls.slice(1)
|
11476
|
+
},
|
11477
|
+
volume: muted ? 0 : DEFAULT_VOLUME,
|
11478
|
+
autoplay: autoplay,
|
11479
|
+
videoInit: videoInit,
|
11480
|
+
lastPlayTimeHideDelay: lastPlayTimeHideDelay
|
11481
|
+
}, props));
|
11482
|
+
/** 设置当前播放 index */
|
11483
|
+
|
11484
|
+
var handleSetCurrentIndex = React.useCallback(function (currentIdx) {
|
11485
|
+
var newIdx = currentIdx !== null && currentIdx !== void 0 ? currentIdx : currentPlayerIndex.current + 1;
|
11486
|
+
|
11487
|
+
if (newIdx >= videoUrls.length) {
|
11488
|
+
if (isLoop) {
|
11489
|
+
// 允许循环则播放起始视频
|
11490
|
+
newIdx = 0;
|
11491
|
+
} else if (player.current && player.current.video) {
|
11492
|
+
// 不允许循环则进度条快进到最后
|
11493
|
+
player.current.currentTime = player.current.video.duration;
|
11494
|
+
return;
|
11495
|
+
}
|
11496
|
+
}
|
11497
|
+
|
11498
|
+
setCurrentIndex(newIdx);
|
11499
|
+
}, [isLoop, setCurrentIndex, videoUrls.length]);
|
11500
|
+
/** 播放下一个 */
|
11501
|
+
|
11502
|
+
var handlePlayNext = React.useCallback(function (currentIdx) {
|
11503
|
+
if (!player.current) {
|
11504
|
+
return;
|
11505
|
+
}
|
11506
|
+
|
11507
|
+
player.current.src = videoUrls[currentIdx];
|
11508
|
+
player.current.emit('playerNext', currentIdx);
|
11509
|
+
player.current.play();
|
11510
|
+
currentPlayerIndex.current = currentIdx;
|
11511
|
+
|
11512
|
+
if (isLoop) {
|
11513
|
+
// 防止 next 按钮消失
|
11514
|
+
player.current.currentVideoIndex = -videoUrls.length;
|
11515
|
+
}
|
11516
|
+
}, [videoUrls, isLoop]);
|
11517
|
+
/** 重置视频 */
|
11518
|
+
|
11519
|
+
var handleReset = React.useCallback(function () {
|
11520
|
+
if (!player.current) {
|
11521
|
+
return;
|
11522
|
+
}
|
11523
|
+
|
11524
|
+
setCurrentIndex(0);
|
11525
|
+
currentPlayerIndex.current = -1;
|
11526
|
+
player.current.destroy();
|
11527
|
+
player.current = undefined;
|
11528
|
+
}, [setCurrentIndex]);
|
11529
|
+
/** 弹窗中的视频关闭以后重置 */
|
11530
|
+
|
11531
|
+
React.useEffect(function () {
|
11532
|
+
if (!visible) {
|
11533
|
+
handleReset();
|
11534
|
+
}
|
11535
|
+
}, [handleReset, visible]);
|
11536
|
+
/** 当 currentIndex 改变以后自动播放下一个 */
|
11537
|
+
|
11538
|
+
React.useEffect(function () {
|
11539
|
+
if (!player.current || !visible) {
|
11540
|
+
return;
|
11541
|
+
}
|
11542
|
+
|
11543
|
+
handlePlayNext(currentIndex !== null && currentIndex !== void 0 ? currentIndex : currentPlayerIndex.current);
|
11544
|
+
}, [currentIndex, handlePlayNext, visible]);
|
11545
|
+
/** 播放器初始化并绑定事件 */
|
11546
|
+
|
11547
|
+
React.useEffect(function () {
|
11548
|
+
if (!visible || lodash.isEmpty(videoUrls) || player.current) {
|
11549
|
+
return;
|
11550
|
+
}
|
11551
|
+
|
11552
|
+
player.current = new Player__default['default'](config.current);
|
11553
|
+
player.current.currentVideoIndex = -videoUrls.length;
|
11554
|
+
player.current.on('ended', function () {
|
11555
|
+
// 如果是循环或有其他视频未播放完,继续播放下一个
|
11556
|
+
if (isLoop || !isLoop && currentPlayerIndex.current < videoUrls.length - 1) {
|
11557
|
+
handleSetCurrentIndex();
|
11558
|
+
setTimeout(function () {
|
11559
|
+
var _player$current;
|
11560
|
+
|
11561
|
+
return (_player$current = player.current) === null || _player$current === void 0 ? void 0 : _player$current.play();
|
11562
|
+
});
|
11563
|
+
} else {
|
11564
|
+
var _player$current2;
|
11565
|
+
|
11566
|
+
(_player$current2 = player.current) === null || _player$current2 === void 0 ? void 0 : _player$current2.pause();
|
11567
|
+
}
|
11568
|
+
}); // 播放记忆缓存
|
11569
|
+
|
11570
|
+
if (enableMemory) {
|
11571
|
+
var videoPlayedTimeObj = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}');
|
11572
|
+
player.current.on('timeupdate', function () {
|
11573
|
+
var _player$current3;
|
11574
|
+
|
11575
|
+
if (currentPlayerIndex.current === -1) {
|
11576
|
+
return;
|
11577
|
+
}
|
11578
|
+
|
11579
|
+
localStorage.setItem('videoPlayedTime', JSON.stringify(_objectSpread2(_objectSpread2({}, videoPlayedTimeObj), {}, _defineProperty({}, id, {
|
11580
|
+
lastPlayTime: (_player$current3 = player.current) === null || _player$current3 === void 0 ? void 0 : _player$current3.currentTime,
|
11581
|
+
videoIndex: currentPlayerIndex.current
|
11582
|
+
}))));
|
11583
|
+
});
|
11584
|
+
}
|
11585
|
+
|
11586
|
+
player.current.on('playNextBtnClick', function () {
|
11587
|
+
if (!isLoop && player.current) {
|
11588
|
+
// 防止 next 按钮消失
|
11589
|
+
player.current.currentVideoIndex = videoUrls.length - 2;
|
11590
|
+
}
|
11591
|
+
|
11592
|
+
handleSetCurrentIndex();
|
11593
|
+
});
|
11594
|
+
}, [autoplay, enableMemory, handleSetCurrentIndex, id, isLoop, videoUrls, videoUrls.length, visible]);
|
11595
|
+
/** 读取缓存的播放记忆并跳转 */
|
11596
|
+
|
11597
|
+
React.useEffect(function () {
|
11598
|
+
if (enableMemory && visible) {
|
11599
|
+
var _JSON$parse;
|
11600
|
+
|
11601
|
+
var _ref2 = ((_JSON$parse = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse === void 0 ? void 0 : _JSON$parse[id]) || {},
|
11602
|
+
lastPlayTime = _ref2.lastPlayTime,
|
11603
|
+
_videoIndex = _ref2.videoIndex;
|
11604
|
+
|
11605
|
+
setTimeout(function () {
|
11606
|
+
handleSetCurrentIndex(_videoIndex);
|
11607
|
+
setTimeout(function () {
|
11608
|
+
if (player.current) {
|
11609
|
+
player.current.currentTime = lastPlayTime;
|
11610
|
+
}
|
11611
|
+
});
|
11612
|
+
});
|
11613
|
+
}
|
11614
|
+
}, [visible, enableMemory, handleSetCurrentIndex, id]);
|
11615
|
+
/** 加载清晰度配置 */
|
11616
|
+
|
11617
|
+
React.useEffect(function () {
|
11618
|
+
if (!lodash.isEmpty(definitionList[currentIndex]) && player.current) {
|
11619
|
+
player.current.emit('resourceReady', definitionList[currentIndex]);
|
11620
|
+
}
|
11621
|
+
}, [currentIndex, definitionList]);
|
11622
|
+
var getRef = React.useCallback(function (ref) {
|
11623
|
+
if (ref && visible) {
|
11624
|
+
var newConfig = _objectSpread2(_objectSpread2({}, config.current), {}, {
|
11625
|
+
el: ref,
|
11626
|
+
url: videoUrls[0],
|
11627
|
+
playNext: {
|
11628
|
+
urlList: videoUrls.slice(1)
|
11629
|
+
}
|
11630
|
+
});
|
11631
|
+
|
11632
|
+
if (enableMemory) {
|
11633
|
+
var _JSON$parse2;
|
11634
|
+
|
11635
|
+
var _ref3 = ((_JSON$parse2 = JSON.parse(localStorage.getItem('videoPlayedTime') || '{}')) === null || _JSON$parse2 === void 0 ? void 0 : _JSON$parse2[id]) || {},
|
11636
|
+
lastPlayTime = _ref3.lastPlayTime;
|
11637
|
+
|
11638
|
+
Object.assign(newConfig, {
|
11639
|
+
lastPlayTime: lastPlayTime,
|
11640
|
+
lastPlayTimeHideDelay: lastPlayTimeHideDelay
|
11641
|
+
});
|
11642
|
+
}
|
11643
|
+
|
11644
|
+
config.current = newConfig;
|
11645
|
+
}
|
11646
|
+
}, [visible, id, videoUrls, lastPlayTimeHideDelay, enableMemory]);
|
11647
|
+
return /*#__PURE__*/React__default['default'].createElement("div", {
|
11648
|
+
className: className,
|
11649
|
+
ref: getRef,
|
11650
|
+
style: style
|
11651
|
+
});
|
11652
|
+
});
|
11653
|
+
|
11582
11654
|
exports.AutoScroll = Index$9;
|
11583
11655
|
exports.Breadcrumb = Index$b;
|
11584
11656
|
exports.Button = WButton;
|
@@ -11602,8 +11674,8 @@ exports.Switch = WSwitch;
|
|
11602
11674
|
exports.TabelCard = index$2;
|
11603
11675
|
exports.Table = Table;
|
11604
11676
|
exports.TreeSelect = Index$6;
|
11677
|
+
exports.Video = index$4;
|
11605
11678
|
exports.VideoPlayer = index$3;
|
11606
|
-
exports.VirtualList = VirtualList;
|
11607
11679
|
exports.WDatePicker = Index$5;
|
11608
11680
|
exports.WForm = WForm$1;
|
11609
11681
|
exports.WebsocketHeart = WebsocketHeart;
|
package/package.json
CHANGED
@@ -1,35 +0,0 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
export declare enum DIRECTION {
|
3
|
-
HORIZONTAL = "horizontal",
|
4
|
-
VERTICAL = "vertical"
|
5
|
-
}
|
6
|
-
export interface ItemStyle {
|
7
|
-
position: 'absolute';
|
8
|
-
top?: number;
|
9
|
-
left: number;
|
10
|
-
width: string | number;
|
11
|
-
height?: number;
|
12
|
-
marginTop?: number;
|
13
|
-
marginLeft?: number;
|
14
|
-
marginRight?: number;
|
15
|
-
marginBottom?: number;
|
16
|
-
zIndex?: number;
|
17
|
-
}
|
18
|
-
export interface IProps {
|
19
|
-
width: number | string;
|
20
|
-
height: number | string;
|
21
|
-
itemCount: number;
|
22
|
-
itemSize: number;
|
23
|
-
renderItem(itemInfo: {
|
24
|
-
index: number;
|
25
|
-
style: ItemStyle;
|
26
|
-
}): React.ReactNode;
|
27
|
-
className?: string;
|
28
|
-
style?: React.CSSProperties;
|
29
|
-
scrollDirection?: DIRECTION;
|
30
|
-
overscanCount?: number;
|
31
|
-
scrollOffset?: number;
|
32
|
-
onScroll?(offset: number, event: Event): void;
|
33
|
-
}
|
34
|
-
declare const VirtualList: React.FC<IProps>;
|
35
|
-
export default VirtualList;
|
package/dist/global.d.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
declare const HTML: any;
|