wargerm 0.2.41 → 0.3.1

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,7 @@ declare type IProps = {
5
5
  style?: CSSProperties;
6
6
  className?: string;
7
7
  render: (record: any, index: number) => ReactNode;
8
+ none?: ReactNode;
8
9
  };
9
10
  declare const Index: FC<IProps>;
10
11
  export default Index;
@@ -102,8 +102,9 @@ declare type Props = {
102
102
  search?: Isearch | false;
103
103
  frameBoxTable?: boolean;
104
104
  frameBoxDirection?: 'in' | 'out';
105
+ none?: ReactNode;
105
106
  };
106
- declare function Table({ columns, dataSource: tableList, request, onLoad, params, onSubmit, rowKey, onRow, className, rowClassName, rowSelection, style, tbodyStyle, thStyle, border, scroll, pagination, search, frameBoxTable, frameBoxDirection, formRef, ...props }: Props): JSX.Element;
107
+ declare function Table({ columns, dataSource: tableList, request, onLoad, params, onSubmit, rowKey, onRow, className, rowClassName, rowSelection, style, tbodyStyle, thStyle, border, scroll, pagination, search, frameBoxTable, frameBoxDirection, formRef, none, ...props }: Props): JSX.Element;
107
108
  declare namespace Table {
108
109
  var defaultProps: {
109
110
  rowKey: string;
@@ -19,6 +19,7 @@ export default class WebsocketHeart {
19
19
  websocketOnmessage: (e: any) => void;
20
20
  websocketOnclose: (e: string) => void;
21
21
  send: (text: any) => void;
22
+ close: () => void;
22
23
  reconnect: () => void;
23
24
  heartCheckFun: () => void;
24
25
  }
package/dist/index.css CHANGED
@@ -1602,7 +1602,7 @@ button.swiper-pagination-bullet {
1602
1602
  border-image-slice: 63 124 63 124;
1603
1603
  border-image-width: 63px 124px 63px 124px;
1604
1604
  border-image-repeat: stretch stretch;
1605
- min-width: 400px;
1605
+ min-width: 200px;
1606
1606
  min-height: 100px;
1607
1607
  }
1608
1608
  .card-container .container-in {
@@ -1674,6 +1674,7 @@ button.swiper-pagination-bullet {
1674
1674
  }
1675
1675
  .card-container .container-in .container-in-border .body {
1676
1676
  flex: 1;
1677
+ overflow: hidden;
1677
1678
  }
1678
1679
  .model_container {
1679
1680
  position: absolute;
@@ -1602,7 +1602,7 @@ button.swiper-pagination-bullet {
1602
1602
  border-image-slice: 63 124 63 124;
1603
1603
  border-image-width: 63px 124px 63px 124px;
1604
1604
  border-image-repeat: stretch stretch;
1605
- min-width: 400px;
1605
+ min-width: 200px;
1606
1606
  min-height: 100px;
1607
1607
  }
1608
1608
  .card-container .container-in {
@@ -1674,6 +1674,7 @@ button.swiper-pagination-bullet {
1674
1674
  }
1675
1675
  .card-container .container-in .container-in-border .body {
1676
1676
  flex: 1;
1677
+ overflow: hidden;
1677
1678
  }
1678
1679
  .model_container {
1679
1680
  position: absolute;
package/dist/index.esm.js CHANGED
@@ -7837,6 +7837,7 @@ var WForm = function WForm(props, ref) {
7837
7837
  display: 'flex'
7838
7838
  }
7839
7839
  }, search && search.optionRender && search.optionRender(search, props.form, [/*#__PURE__*/React.createElement(WButton, {
7840
+ key: 'submit',
7840
7841
  type: "primary",
7841
7842
  style: {
7842
7843
  marginRight: '20px'
@@ -7844,6 +7845,7 @@ var WForm = function WForm(props, ref) {
7844
7845
  htmlType: "submit",
7845
7846
  icon: /*#__PURE__*/React.createElement(SearchOutlined, null)
7846
7847
  }, search && search.searchText ? search.searchText : '提交')].concat(_toConsumableArray(search.hideResetBtn ? [] : [/*#__PURE__*/React.createElement(WButton, {
7848
+ key: 'reset',
7847
7849
  type: "primary",
7848
7850
  style: {
7849
7851
  marginRight: '20px'
@@ -7851,6 +7853,7 @@ var WForm = function WForm(props, ref) {
7851
7853
  onClick: handleRest,
7852
7854
  icon: /*#__PURE__*/React.createElement(ReloadOutlined, null)
7853
7855
  }, search && search.resetText ? search.resetText : '重置')]))), !search ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WButton, {
7856
+ key: 'submit',
7854
7857
  type: "primary",
7855
7858
  style: {
7856
7859
  marginRight: '20px'
@@ -7858,6 +7861,7 @@ var WForm = function WForm(props, ref) {
7858
7861
  htmlType: "submit",
7859
7862
  icon: /*#__PURE__*/React.createElement(SearchOutlined, null)
7860
7863
  }, "\u63D0\u4EA4"), /*#__PURE__*/React.createElement(WButton, {
7864
+ key: 'reset',
7861
7865
  type: "primary",
7862
7866
  style: {
7863
7867
  marginRight: '20px'
@@ -7865,6 +7869,7 @@ var WForm = function WForm(props, ref) {
7865
7869
  icon: /*#__PURE__*/React.createElement(ReloadOutlined, null),
7866
7870
  onClick: handleRest
7867
7871
  }, "\u91CD\u7F6E")) : search && !search.optionRender ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(WButton, {
7872
+ key: 'submit',
7868
7873
  type: "primary",
7869
7874
  style: {
7870
7875
  marginRight: '20px'
@@ -7872,6 +7877,7 @@ var WForm = function WForm(props, ref) {
7872
7877
  htmlType: "submit",
7873
7878
  icon: /*#__PURE__*/React.createElement(SearchOutlined, null)
7874
7879
  }, search && search.searchText ? search.searchText : '提交'), search.hideResetBtn ? null : /*#__PURE__*/React.createElement(WButton, {
7880
+ key: 'reset',
7875
7881
  type: "primary",
7876
7882
  style: {
7877
7883
  marginRight: '20px'
@@ -7883,7 +7889,7 @@ var WForm = function WForm(props, ref) {
7883
7889
 
7884
7890
  var WForm$1 = /*#__PURE__*/React.forwardRef(WForm);
7885
7891
 
7886
- var _excluded$7 = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef"];
7892
+ var _excluded$7 = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef", "none"];
7887
7893
  function Table(_ref) {
7888
7894
  var _formSearchRef$curren3, _classnames2;
7889
7895
 
@@ -7913,6 +7919,7 @@ function Table(_ref) {
7913
7919
  _ref$frameBoxDirectio = _ref.frameBoxDirection,
7914
7920
  frameBoxDirection = _ref$frameBoxDirectio === void 0 ? 'out' : _ref$frameBoxDirectio,
7915
7921
  formRef = _ref.formRef,
7922
+ none = _ref.none,
7916
7923
  props = _objectWithoutProperties(_ref, _excluded$7);
7917
7924
 
7918
7925
  var _useState = useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
@@ -8359,7 +8366,7 @@ function Table(_ref) {
8359
8366
  style: _objectSpread2({
8360
8367
  height: (style === null || style === void 0 ? void 0 : style.height) ? "calc(".concat(style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
8361
8368
  }, tbodyStyle)
8362
- }, dataSource.map(function (record, index) {
8369
+ }, dataSource.length > 0 ? dataSource.map(function (record, index) {
8363
8370
  var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
8364
8371
  return frameBoxTable ? /*#__PURE__*/React.createElement(FrameBox, {
8365
8372
  key: key,
@@ -8368,7 +8375,15 @@ function Table(_ref) {
8368
8375
  width: '100%'
8369
8376
  }
8370
8377
  }, renderTr(record, index, key)) : renderTr(record, index, key);
8371
- })), _typeof(pagination) === 'object' && /*#__PURE__*/React.createElement(_Pagination, _objectSpread2({
8378
+ }) : /*#__PURE__*/React.createElement("div", {
8379
+ style: {
8380
+ width: '100%',
8381
+ height: '100%',
8382
+ display: 'flex',
8383
+ justifyContent: 'center',
8384
+ alignItems: 'center'
8385
+ }
8386
+ }, none || '暂无数据')), _typeof(pagination) === 'object' && /*#__PURE__*/React.createElement(_Pagination, _objectSpread2({
8372
8387
  style: {
8373
8388
  textAlign: 'right',
8374
8389
  marginTop: '10px'
@@ -8566,7 +8581,7 @@ var Index$8 = function Index(props) {
8566
8581
 
8567
8582
  Index$8.defaultProps = {};
8568
8583
 
8569
- var _excluded$a = ["list", "render", "partSize"];
8584
+ var _excluded$a = ["list", "render", "none", "partSize"];
8570
8585
 
8571
8586
  function AutoScroll(props) {
8572
8587
  var inner1 = useRef();
@@ -8648,83 +8663,90 @@ function AutoScroll(props) {
8648
8663
  var Index$9 = function Index(_ref) {
8649
8664
  var list = _ref.list,
8650
8665
  render = _ref.render,
8666
+ none = _ref.none,
8651
8667
  _ref$partSize = _ref.partSize,
8652
8668
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8653
8669
  otherProps = _objectWithoutProperties(_ref, _excluded$a);
8654
8670
 
8655
- {
8656
- var _useState = useState([]),
8657
- _useState2 = _slicedToArray(_useState, 2),
8658
- partA = _useState2[0],
8659
- setPatrA = _useState2[1];
8671
+ var _useState = useState([]),
8672
+ _useState2 = _slicedToArray(_useState, 2),
8673
+ partA = _useState2[0],
8674
+ setPatrA = _useState2[1];
8660
8675
 
8661
- var _useState3 = useState([]),
8662
- _useState4 = _slicedToArray(_useState3, 2),
8663
- partB = _useState4[0],
8664
- setPatrB = _useState4[1]; // partA在items中的开始索引
8676
+ var _useState3 = useState([]),
8677
+ _useState4 = _slicedToArray(_useState3, 2),
8678
+ partB = _useState4[0],
8679
+ setPatrB = _useState4[1]; // partA在items中的开始索引
8665
8680
 
8666
8681
 
8667
- var _useState5 = useState(0),
8668
- _useState6 = _slicedToArray(_useState5, 2),
8669
- partAStartIndex = _useState6[0],
8670
- setPartAStartIndex = _useState6[1]; // partB在items中的开始索引
8682
+ var _useState5 = useState(0),
8683
+ _useState6 = _slicedToArray(_useState5, 2),
8684
+ partAStartIndex = _useState6[0],
8685
+ setPartAStartIndex = _useState6[1]; // partB在items中的开始索引
8671
8686
 
8672
8687
 
8673
- var _useState7 = useState(partSize),
8674
- _useState8 = _slicedToArray(_useState7, 2),
8675
- partBStartIndex = _useState8[0],
8676
- setPartBStartIndex = _useState8[1];
8688
+ var _useState7 = useState(partSize),
8689
+ _useState8 = _slicedToArray(_useState7, 2),
8690
+ partBStartIndex = _useState8[0],
8691
+ setPartBStartIndex = _useState8[1];
8677
8692
 
8678
- var autoRef = useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8693
+ var autoRef = useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8679
8694
 
8680
- var handleHalf = function handleHalf() {
8681
- setPartAStartIndex((partBStartIndex + partSize) % list.length);
8682
- }; // 当滚动归位时,修改partBStartIndex
8695
+ var handleHalf = function handleHalf() {
8696
+ setPartAStartIndex((partBStartIndex + partSize) % list.length);
8697
+ }; // 当滚动归位时,修改partBStartIndex
8683
8698
 
8684
8699
 
8685
- var handleComplete = function handleComplete() {
8686
- setPartBStartIndex((partAStartIndex + partSize) % list.length);
8687
- };
8700
+ var handleComplete = function handleComplete() {
8701
+ setPartBStartIndex((partAStartIndex + partSize) % list.length);
8702
+ };
8688
8703
 
8689
- useEffect(function () {
8690
- // partA中的数据
8691
- if (list.length > partSize) {
8692
- setPatrA(list);
8693
- } else {
8694
- setPatrA(list);
8695
- } // partB中的数据
8704
+ useEffect(function () {
8705
+ // partA中的数据
8706
+ if (list.length > partSize) {
8707
+ setPatrA(list);
8708
+ } else {
8709
+ setPatrA(list);
8710
+ } // partB中的数据
8696
8711
 
8697
8712
 
8698
- if (list.length > partSize) {
8699
- setPatrB(list);
8700
- } else {
8701
- setPatrB([]);
8702
- }
8713
+ if (list.length > partSize) {
8714
+ setPatrB(list);
8715
+ } else {
8716
+ setPatrB([]);
8717
+ }
8703
8718
 
8704
- setTimeout(function () {
8705
- //手动触发执行滚动
8706
- if (autoRef.current) {
8707
- autoRef.current.tryScroll();
8708
- }
8709
- }, 0);
8710
- }, [list]);
8711
- useEffect(function () {
8712
- setPartBStartIndex(partAStartIndex + partSize);
8713
- }, []);
8714
- return /*#__PURE__*/React.createElement(AutoScroll, _objectSpread2({
8715
- cref: autoRef,
8716
- complete: function complete() {
8717
- return handleComplete;
8718
- },
8719
- half: function half() {
8720
- return handleHalf;
8719
+ setTimeout(function () {
8720
+ //手动触发执行滚动
8721
+ if (autoRef.current) {
8722
+ autoRef.current.tryScroll();
8721
8723
  }
8722
- }, otherProps), partA && partA.map(function (item, index) {
8723
- return render(item, index);
8724
- }), partB && partB.map(function (item, index) {
8725
- return render(item, index);
8726
- }));
8727
- }
8724
+ }, 0);
8725
+ }, [list]);
8726
+ useEffect(function () {
8727
+ setPartBStartIndex(partAStartIndex + partSize);
8728
+ }, []);
8729
+ return list.length > 0 ? /*#__PURE__*/React.createElement(AutoScroll, _objectSpread2({
8730
+ cref: autoRef,
8731
+ complete: function complete() {
8732
+ return handleComplete;
8733
+ },
8734
+ half: function half() {
8735
+ return handleHalf;
8736
+ }
8737
+ }, otherProps), partA && partA.map(function (item, index) {
8738
+ return render(item, index);
8739
+ }), partB && partB.map(function (item, index) {
8740
+ return render(item, index);
8741
+ })) : /*#__PURE__*/React.createElement("div", {
8742
+ style: {
8743
+ width: '100%',
8744
+ height: '100%',
8745
+ display: 'flex',
8746
+ justifyContent: 'center',
8747
+ alignItems: 'center'
8748
+ }
8749
+ }, none || '暂无数据');
8728
8750
  };
8729
8751
 
8730
8752
  var _excluded$b = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
@@ -10412,9 +10434,9 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
10412
10434
  };
10413
10435
 
10414
10436
  this.websocketOnmessage = function (e) {
10415
- console.log('-----接收消息-------', e); // const data = e.data //解析对象
10437
+ // console.log('-----接收消息-------', e);
10438
+ // const data = e.data //解析对象
10416
10439
  // To handle
10417
-
10418
10440
  _this.onmessageCB(e); //心跳检测重置
10419
10441
 
10420
10442
 
@@ -10440,6 +10462,12 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
10440
10462
  }
10441
10463
  };
10442
10464
 
10465
+ this.close = function () {
10466
+ _this.websock.close();
10467
+
10468
+ _this.lockReconnect = true;
10469
+ };
10470
+
10443
10471
  this.reconnect = function () {
10444
10472
  var that = _this;
10445
10473
  if (that.lockReconnect) return;
package/dist/index.js CHANGED
@@ -7871,6 +7871,7 @@ var WForm = function WForm(props, ref) {
7871
7871
  display: 'flex'
7872
7872
  }
7873
7873
  }, search && search.optionRender && search.optionRender(search, props.form, [/*#__PURE__*/React__default['default'].createElement(WButton, {
7874
+ key: 'submit',
7874
7875
  type: "primary",
7875
7876
  style: {
7876
7877
  marginRight: '20px'
@@ -7878,6 +7879,7 @@ var WForm = function WForm(props, ref) {
7878
7879
  htmlType: "submit",
7879
7880
  icon: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null)
7880
7881
  }, search && search.searchText ? search.searchText : '提交')].concat(_toConsumableArray(search.hideResetBtn ? [] : [/*#__PURE__*/React__default['default'].createElement(WButton, {
7882
+ key: 'reset',
7881
7883
  type: "primary",
7882
7884
  style: {
7883
7885
  marginRight: '20px'
@@ -7885,6 +7887,7 @@ var WForm = function WForm(props, ref) {
7885
7887
  onClick: handleRest,
7886
7888
  icon: /*#__PURE__*/React__default['default'].createElement(icons.ReloadOutlined, null)
7887
7889
  }, search && search.resetText ? search.resetText : '重置')]))), !search ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(WButton, {
7890
+ key: 'submit',
7888
7891
  type: "primary",
7889
7892
  style: {
7890
7893
  marginRight: '20px'
@@ -7892,6 +7895,7 @@ var WForm = function WForm(props, ref) {
7892
7895
  htmlType: "submit",
7893
7896
  icon: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null)
7894
7897
  }, "\u63D0\u4EA4"), /*#__PURE__*/React__default['default'].createElement(WButton, {
7898
+ key: 'reset',
7895
7899
  type: "primary",
7896
7900
  style: {
7897
7901
  marginRight: '20px'
@@ -7899,6 +7903,7 @@ var WForm = function WForm(props, ref) {
7899
7903
  icon: /*#__PURE__*/React__default['default'].createElement(icons.ReloadOutlined, null),
7900
7904
  onClick: handleRest
7901
7905
  }, "\u91CD\u7F6E")) : search && !search.optionRender ? /*#__PURE__*/React__default['default'].createElement(React__default['default'].Fragment, null, /*#__PURE__*/React__default['default'].createElement(WButton, {
7906
+ key: 'submit',
7902
7907
  type: "primary",
7903
7908
  style: {
7904
7909
  marginRight: '20px'
@@ -7906,6 +7911,7 @@ var WForm = function WForm(props, ref) {
7906
7911
  htmlType: "submit",
7907
7912
  icon: /*#__PURE__*/React__default['default'].createElement(icons.SearchOutlined, null)
7908
7913
  }, search && search.searchText ? search.searchText : '提交'), search.hideResetBtn ? null : /*#__PURE__*/React__default['default'].createElement(WButton, {
7914
+ key: 'reset',
7909
7915
  type: "primary",
7910
7916
  style: {
7911
7917
  marginRight: '20px'
@@ -7917,7 +7923,7 @@ var WForm = function WForm(props, ref) {
7917
7923
 
7918
7924
  var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
7919
7925
 
7920
- var _excluded$7 = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef"];
7926
+ var _excluded$7 = ["columns", "dataSource", "request", "onLoad", "params", "onSubmit", "rowKey", "onRow", "className", "rowClassName", "rowSelection", "style", "tbodyStyle", "thStyle", "border", "scroll", "pagination", "search", "frameBoxTable", "frameBoxDirection", "formRef", "none"];
7921
7927
  function Table(_ref) {
7922
7928
  var _formSearchRef$curren3, _classnames2;
7923
7929
 
@@ -7947,6 +7953,7 @@ function Table(_ref) {
7947
7953
  _ref$frameBoxDirectio = _ref.frameBoxDirection,
7948
7954
  frameBoxDirection = _ref$frameBoxDirectio === void 0 ? 'out' : _ref$frameBoxDirectio,
7949
7955
  formRef = _ref.formRef,
7956
+ none = _ref.none,
7950
7957
  props = _objectWithoutProperties(_ref, _excluded$7);
7951
7958
 
7952
7959
  var _useState = React.useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
@@ -8393,7 +8400,7 @@ function Table(_ref) {
8393
8400
  style: _objectSpread2({
8394
8401
  height: (style === null || style === void 0 ? void 0 : style.height) ? "calc(".concat(style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
8395
8402
  }, tbodyStyle)
8396
- }, dataSource.map(function (record, index) {
8403
+ }, dataSource.length > 0 ? dataSource.map(function (record, index) {
8397
8404
  var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
8398
8405
  return frameBoxTable ? /*#__PURE__*/React__default['default'].createElement(FrameBox, {
8399
8406
  key: key,
@@ -8402,7 +8409,15 @@ function Table(_ref) {
8402
8409
  width: '100%'
8403
8410
  }
8404
8411
  }, renderTr(record, index, key)) : renderTr(record, index, key);
8405
- })), _typeof(pagination) === 'object' && /*#__PURE__*/React__default['default'].createElement(_Pagination__default['default'], _objectSpread2({
8412
+ }) : /*#__PURE__*/React__default['default'].createElement("div", {
8413
+ style: {
8414
+ width: '100%',
8415
+ height: '100%',
8416
+ display: 'flex',
8417
+ justifyContent: 'center',
8418
+ alignItems: 'center'
8419
+ }
8420
+ }, none || '暂无数据')), _typeof(pagination) === 'object' && /*#__PURE__*/React__default['default'].createElement(_Pagination__default['default'], _objectSpread2({
8406
8421
  style: {
8407
8422
  textAlign: 'right',
8408
8423
  marginTop: '10px'
@@ -8600,7 +8615,7 @@ var Index$8 = function Index(props) {
8600
8615
 
8601
8616
  Index$8.defaultProps = {};
8602
8617
 
8603
- var _excluded$a = ["list", "render", "partSize"];
8618
+ var _excluded$a = ["list", "render", "none", "partSize"];
8604
8619
 
8605
8620
  function AutoScroll(props) {
8606
8621
  var inner1 = React.useRef();
@@ -8682,83 +8697,90 @@ function AutoScroll(props) {
8682
8697
  var Index$9 = function Index(_ref) {
8683
8698
  var list = _ref.list,
8684
8699
  render = _ref.render,
8700
+ none = _ref.none,
8685
8701
  _ref$partSize = _ref.partSize,
8686
8702
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8687
8703
  otherProps = _objectWithoutProperties(_ref, _excluded$a);
8688
8704
 
8689
- {
8690
- var _useState = React.useState([]),
8691
- _useState2 = _slicedToArray(_useState, 2),
8692
- partA = _useState2[0],
8693
- setPatrA = _useState2[1];
8705
+ var _useState = React.useState([]),
8706
+ _useState2 = _slicedToArray(_useState, 2),
8707
+ partA = _useState2[0],
8708
+ setPatrA = _useState2[1];
8694
8709
 
8695
- var _useState3 = React.useState([]),
8696
- _useState4 = _slicedToArray(_useState3, 2),
8697
- partB = _useState4[0],
8698
- setPatrB = _useState4[1]; // partA在items中的开始索引
8710
+ var _useState3 = React.useState([]),
8711
+ _useState4 = _slicedToArray(_useState3, 2),
8712
+ partB = _useState4[0],
8713
+ setPatrB = _useState4[1]; // partA在items中的开始索引
8699
8714
 
8700
8715
 
8701
- var _useState5 = React.useState(0),
8702
- _useState6 = _slicedToArray(_useState5, 2),
8703
- partAStartIndex = _useState6[0],
8704
- setPartAStartIndex = _useState6[1]; // partB在items中的开始索引
8716
+ var _useState5 = React.useState(0),
8717
+ _useState6 = _slicedToArray(_useState5, 2),
8718
+ partAStartIndex = _useState6[0],
8719
+ setPartAStartIndex = _useState6[1]; // partB在items中的开始索引
8705
8720
 
8706
8721
 
8707
- var _useState7 = React.useState(partSize),
8708
- _useState8 = _slicedToArray(_useState7, 2),
8709
- partBStartIndex = _useState8[0],
8710
- setPartBStartIndex = _useState8[1];
8722
+ var _useState7 = React.useState(partSize),
8723
+ _useState8 = _slicedToArray(_useState7, 2),
8724
+ partBStartIndex = _useState8[0],
8725
+ setPartBStartIndex = _useState8[1];
8711
8726
 
8712
- var autoRef = React.useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8727
+ var autoRef = React.useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8713
8728
 
8714
- var handleHalf = function handleHalf() {
8715
- setPartAStartIndex((partBStartIndex + partSize) % list.length);
8716
- }; // 当滚动归位时,修改partBStartIndex
8729
+ var handleHalf = function handleHalf() {
8730
+ setPartAStartIndex((partBStartIndex + partSize) % list.length);
8731
+ }; // 当滚动归位时,修改partBStartIndex
8717
8732
 
8718
8733
 
8719
- var handleComplete = function handleComplete() {
8720
- setPartBStartIndex((partAStartIndex + partSize) % list.length);
8721
- };
8734
+ var handleComplete = function handleComplete() {
8735
+ setPartBStartIndex((partAStartIndex + partSize) % list.length);
8736
+ };
8722
8737
 
8723
- React.useEffect(function () {
8724
- // partA中的数据
8725
- if (list.length > partSize) {
8726
- setPatrA(list);
8727
- } else {
8728
- setPatrA(list);
8729
- } // partB中的数据
8738
+ React.useEffect(function () {
8739
+ // partA中的数据
8740
+ if (list.length > partSize) {
8741
+ setPatrA(list);
8742
+ } else {
8743
+ setPatrA(list);
8744
+ } // partB中的数据
8730
8745
 
8731
8746
 
8732
- if (list.length > partSize) {
8733
- setPatrB(list);
8734
- } else {
8735
- setPatrB([]);
8736
- }
8747
+ if (list.length > partSize) {
8748
+ setPatrB(list);
8749
+ } else {
8750
+ setPatrB([]);
8751
+ }
8737
8752
 
8738
- setTimeout(function () {
8739
- //手动触发执行滚动
8740
- if (autoRef.current) {
8741
- autoRef.current.tryScroll();
8742
- }
8743
- }, 0);
8744
- }, [list]);
8745
- React.useEffect(function () {
8746
- setPartBStartIndex(partAStartIndex + partSize);
8747
- }, []);
8748
- return /*#__PURE__*/React__default['default'].createElement(AutoScroll, _objectSpread2({
8749
- cref: autoRef,
8750
- complete: function complete() {
8751
- return handleComplete;
8752
- },
8753
- half: function half() {
8754
- return handleHalf;
8753
+ setTimeout(function () {
8754
+ //手动触发执行滚动
8755
+ if (autoRef.current) {
8756
+ autoRef.current.tryScroll();
8755
8757
  }
8756
- }, otherProps), partA && partA.map(function (item, index) {
8757
- return render(item, index);
8758
- }), partB && partB.map(function (item, index) {
8759
- return render(item, index);
8760
- }));
8761
- }
8758
+ }, 0);
8759
+ }, [list]);
8760
+ React.useEffect(function () {
8761
+ setPartBStartIndex(partAStartIndex + partSize);
8762
+ }, []);
8763
+ return list.length > 0 ? /*#__PURE__*/React__default['default'].createElement(AutoScroll, _objectSpread2({
8764
+ cref: autoRef,
8765
+ complete: function complete() {
8766
+ return handleComplete;
8767
+ },
8768
+ half: function half() {
8769
+ return handleHalf;
8770
+ }
8771
+ }, otherProps), partA && partA.map(function (item, index) {
8772
+ return render(item, index);
8773
+ }), partB && partB.map(function (item, index) {
8774
+ return render(item, index);
8775
+ })) : /*#__PURE__*/React__default['default'].createElement("div", {
8776
+ style: {
8777
+ width: '100%',
8778
+ height: '100%',
8779
+ display: 'flex',
8780
+ justifyContent: 'center',
8781
+ alignItems: 'center'
8782
+ }
8783
+ }, none || '暂无数据');
8762
8784
  };
8763
8785
 
8764
8786
  var _excluded$b = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
@@ -10446,9 +10468,9 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
10446
10468
  };
10447
10469
 
10448
10470
  this.websocketOnmessage = function (e) {
10449
- console.log('-----接收消息-------', e); // const data = e.data //解析对象
10471
+ // console.log('-----接收消息-------', e);
10472
+ // const data = e.data //解析对象
10450
10473
  // To handle
10451
-
10452
10474
  _this.onmessageCB(e); //心跳检测重置
10453
10475
 
10454
10476
 
@@ -10474,6 +10496,12 @@ var WebsocketHeart = /*#__PURE__*/_createClass(function WebsocketHeart(_ref) {
10474
10496
  }
10475
10497
  };
10476
10498
 
10499
+ this.close = function () {
10500
+ _this.websock.close();
10501
+
10502
+ _this.lockReconnect = true;
10503
+ };
10504
+
10477
10505
  this.reconnect = function () {
10478
10506
  var that = _this;
10479
10507
  if (that.lockReconnect) return;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.2.41",
4
+ "version": "0.3.1",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",