wargerm 0.7.46 → 0.7.48

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.
@@ -5,6 +5,8 @@ declare type propsType = {
5
5
  height: number | string;
6
6
  width: number | string;
7
7
  };
8
+ onPlayerClose?: <T, S>(index: T, urls: S) => void;
9
+ onChange?: (urls: string[]) => void;
8
10
  layouts?: Array<any>;
9
11
  layoutIndex?: number;
10
12
  config?: Record<any, any>;
package/dist/index.esm.js CHANGED
@@ -8983,6 +8983,8 @@ function VideoPlayer$1(_ref, ref) {
8983
8983
  layoutIndex = _ref$layoutIndex === void 0 ? 0 : _ref$layoutIndex,
8984
8984
  _ref$url = _ref.url,
8985
8985
  url = _ref$url === void 0 ? [] : _ref$url,
8986
+ onPlayerClose = _ref.onPlayerClose,
8987
+ onChange = _ref.onChange,
8986
8988
  _ref$layouts = _ref.layouts,
8987
8989
  layouts = _ref$layouts === void 0 ? basicLayouts : _ref$layouts;
8988
8990
  var allLayouts = layouts;
@@ -9000,6 +9002,9 @@ function VideoPlayer$1(_ref, ref) {
9000
9002
  useEffect(function () {
9001
9003
  setUrls(url);
9002
9004
  }, [url]);
9005
+ useEffect(function () {
9006
+ onChange && onChange(urls);
9007
+ }, [urls]);
9003
9008
  useEffect(function () {
9004
9009
  setCurrentLayoutIndex(layoutIndex);
9005
9010
  }, [layoutIndex]);
@@ -9018,6 +9023,12 @@ function VideoPlayer$1(_ref, ref) {
9018
9023
  players = _useState8[0],
9019
9024
  setPlayers = _useState8[1];
9020
9025
 
9026
+ var handleCloseAll = function handleCloseAll() {
9027
+ setPlayers([]);
9028
+ setUrls([]);
9029
+ setCurrentPlayerIndex(0);
9030
+ };
9031
+
9021
9032
  var renderDom = useMemo(function () {
9022
9033
  var arr = new Array(allLayouts[currentLayoutIndex].span).fill(0);
9023
9034
  return arr.map(function (item, index) {
@@ -9039,6 +9050,7 @@ function VideoPlayer$1(_ref, ref) {
9039
9050
 
9040
9051
  arr.splice(index, 1, '');
9041
9052
  setUrls(arr);
9053
+ onPlayerClose && onPlayerClose(index, arr);
9042
9054
  }
9043
9055
  }, /*#__PURE__*/React.createElement(CloseOutlined, null))), /*#__PURE__*/React.createElement(Xgplay$1, {
9044
9056
  setRef: function setRef(ref) {
@@ -9119,6 +9131,7 @@ function VideoPlayer$1(_ref, ref) {
9119
9131
  currentLayoutIndex: currentLayoutIndex,
9120
9132
  currentPlayerIndex: currentPlayerIndex,
9121
9133
  urls: urls,
9134
+ handleCloseAll: handleCloseAll,
9122
9135
  loadCamera: loadCamera
9123
9136
  };
9124
9137
  });
package/dist/index.js CHANGED
@@ -9027,6 +9027,8 @@ function VideoPlayer$1(_ref, ref) {
9027
9027
  layoutIndex = _ref$layoutIndex === void 0 ? 0 : _ref$layoutIndex,
9028
9028
  _ref$url = _ref.url,
9029
9029
  url = _ref$url === void 0 ? [] : _ref$url,
9030
+ onPlayerClose = _ref.onPlayerClose,
9031
+ onChange = _ref.onChange,
9030
9032
  _ref$layouts = _ref.layouts,
9031
9033
  layouts = _ref$layouts === void 0 ? basicLayouts : _ref$layouts;
9032
9034
  var allLayouts = layouts;
@@ -9044,6 +9046,9 @@ function VideoPlayer$1(_ref, ref) {
9044
9046
  React.useEffect(function () {
9045
9047
  setUrls(url);
9046
9048
  }, [url]);
9049
+ React.useEffect(function () {
9050
+ onChange && onChange(urls);
9051
+ }, [urls]);
9047
9052
  React.useEffect(function () {
9048
9053
  setCurrentLayoutIndex(layoutIndex);
9049
9054
  }, [layoutIndex]);
@@ -9062,6 +9067,12 @@ function VideoPlayer$1(_ref, ref) {
9062
9067
  players = _useState8[0],
9063
9068
  setPlayers = _useState8[1];
9064
9069
 
9070
+ var handleCloseAll = function handleCloseAll() {
9071
+ setPlayers([]);
9072
+ setUrls([]);
9073
+ setCurrentPlayerIndex(0);
9074
+ };
9075
+
9065
9076
  var renderDom = React.useMemo(function () {
9066
9077
  var arr = new Array(allLayouts[currentLayoutIndex].span).fill(0);
9067
9078
  return arr.map(function (item, index) {
@@ -9083,6 +9094,7 @@ function VideoPlayer$1(_ref, ref) {
9083
9094
 
9084
9095
  arr.splice(index, 1, '');
9085
9096
  setUrls(arr);
9097
+ onPlayerClose && onPlayerClose(index, arr);
9086
9098
  }
9087
9099
  }, /*#__PURE__*/React__default['default'].createElement(icons.CloseOutlined, null))), /*#__PURE__*/React__default['default'].createElement(Xgplay$1, {
9088
9100
  setRef: function setRef(ref) {
@@ -9163,6 +9175,7 @@ function VideoPlayer$1(_ref, ref) {
9163
9175
  currentLayoutIndex: currentLayoutIndex,
9164
9176
  currentPlayerIndex: currentPlayerIndex,
9165
9177
  urls: urls,
9178
+ handleCloseAll: handleCloseAll,
9166
9179
  loadCamera: loadCamera
9167
9180
  };
9168
9181
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.7.46",
4
+ "version": "0.7.48",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",