wargerm 0.2.44 → 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;
package/dist/index.esm.js CHANGED
@@ -7889,7 +7889,7 @@ var WForm = function WForm(props, ref) {
7889
7889
 
7890
7890
  var WForm$1 = /*#__PURE__*/React.forwardRef(WForm);
7891
7891
 
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"];
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"];
7893
7893
  function Table(_ref) {
7894
7894
  var _formSearchRef$curren3, _classnames2;
7895
7895
 
@@ -7919,6 +7919,7 @@ function Table(_ref) {
7919
7919
  _ref$frameBoxDirectio = _ref.frameBoxDirection,
7920
7920
  frameBoxDirection = _ref$frameBoxDirectio === void 0 ? 'out' : _ref$frameBoxDirectio,
7921
7921
  formRef = _ref.formRef,
7922
+ none = _ref.none,
7922
7923
  props = _objectWithoutProperties(_ref, _excluded$7);
7923
7924
 
7924
7925
  var _useState = useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
@@ -8365,7 +8366,7 @@ function Table(_ref) {
8365
8366
  style: _objectSpread2({
8366
8367
  height: (style === null || style === void 0 ? void 0 : style.height) ? "calc(".concat(style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
8367
8368
  }, tbodyStyle)
8368
- }, dataSource.map(function (record, index) {
8369
+ }, dataSource.length > 0 ? dataSource.map(function (record, index) {
8369
8370
  var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
8370
8371
  return frameBoxTable ? /*#__PURE__*/React.createElement(FrameBox, {
8371
8372
  key: key,
@@ -8374,7 +8375,15 @@ function Table(_ref) {
8374
8375
  width: '100%'
8375
8376
  }
8376
8377
  }, renderTr(record, index, key)) : renderTr(record, index, key);
8377
- })), _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({
8378
8387
  style: {
8379
8388
  textAlign: 'right',
8380
8389
  marginTop: '10px'
@@ -8572,7 +8581,7 @@ var Index$8 = function Index(props) {
8572
8581
 
8573
8582
  Index$8.defaultProps = {};
8574
8583
 
8575
- var _excluded$a = ["list", "render", "partSize"];
8584
+ var _excluded$a = ["list", "render", "none", "partSize"];
8576
8585
 
8577
8586
  function AutoScroll(props) {
8578
8587
  var inner1 = useRef();
@@ -8654,83 +8663,90 @@ function AutoScroll(props) {
8654
8663
  var Index$9 = function Index(_ref) {
8655
8664
  var list = _ref.list,
8656
8665
  render = _ref.render,
8666
+ none = _ref.none,
8657
8667
  _ref$partSize = _ref.partSize,
8658
8668
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8659
8669
  otherProps = _objectWithoutProperties(_ref, _excluded$a);
8660
8670
 
8661
- {
8662
- var _useState = useState([]),
8663
- _useState2 = _slicedToArray(_useState, 2),
8664
- partA = _useState2[0],
8665
- setPatrA = _useState2[1];
8671
+ var _useState = useState([]),
8672
+ _useState2 = _slicedToArray(_useState, 2),
8673
+ partA = _useState2[0],
8674
+ setPatrA = _useState2[1];
8666
8675
 
8667
- var _useState3 = useState([]),
8668
- _useState4 = _slicedToArray(_useState3, 2),
8669
- partB = _useState4[0],
8670
- setPatrB = _useState4[1]; // partA在items中的开始索引
8676
+ var _useState3 = useState([]),
8677
+ _useState4 = _slicedToArray(_useState3, 2),
8678
+ partB = _useState4[0],
8679
+ setPatrB = _useState4[1]; // partA在items中的开始索引
8671
8680
 
8672
8681
 
8673
- var _useState5 = useState(0),
8674
- _useState6 = _slicedToArray(_useState5, 2),
8675
- partAStartIndex = _useState6[0],
8676
- 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中的开始索引
8677
8686
 
8678
8687
 
8679
- var _useState7 = useState(partSize),
8680
- _useState8 = _slicedToArray(_useState7, 2),
8681
- partBStartIndex = _useState8[0],
8682
- setPartBStartIndex = _useState8[1];
8688
+ var _useState7 = useState(partSize),
8689
+ _useState8 = _slicedToArray(_useState7, 2),
8690
+ partBStartIndex = _useState8[0],
8691
+ setPartBStartIndex = _useState8[1];
8683
8692
 
8684
- var autoRef = useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8693
+ var autoRef = useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8685
8694
 
8686
- var handleHalf = function handleHalf() {
8687
- setPartAStartIndex((partBStartIndex + partSize) % list.length);
8688
- }; // 当滚动归位时,修改partBStartIndex
8695
+ var handleHalf = function handleHalf() {
8696
+ setPartAStartIndex((partBStartIndex + partSize) % list.length);
8697
+ }; // 当滚动归位时,修改partBStartIndex
8689
8698
 
8690
8699
 
8691
- var handleComplete = function handleComplete() {
8692
- setPartBStartIndex((partAStartIndex + partSize) % list.length);
8693
- };
8700
+ var handleComplete = function handleComplete() {
8701
+ setPartBStartIndex((partAStartIndex + partSize) % list.length);
8702
+ };
8694
8703
 
8695
- useEffect(function () {
8696
- // partA中的数据
8697
- if (list.length > partSize) {
8698
- setPatrA(list);
8699
- } else {
8700
- setPatrA(list);
8701
- } // partB中的数据
8704
+ useEffect(function () {
8705
+ // partA中的数据
8706
+ if (list.length > partSize) {
8707
+ setPatrA(list);
8708
+ } else {
8709
+ setPatrA(list);
8710
+ } // partB中的数据
8702
8711
 
8703
8712
 
8704
- if (list.length > partSize) {
8705
- setPatrB(list);
8706
- } else {
8707
- setPatrB([]);
8708
- }
8713
+ if (list.length > partSize) {
8714
+ setPatrB(list);
8715
+ } else {
8716
+ setPatrB([]);
8717
+ }
8709
8718
 
8710
- setTimeout(function () {
8711
- //手动触发执行滚动
8712
- if (autoRef.current) {
8713
- autoRef.current.tryScroll();
8714
- }
8715
- }, 0);
8716
- }, [list]);
8717
- useEffect(function () {
8718
- setPartBStartIndex(partAStartIndex + partSize);
8719
- }, []);
8720
- return /*#__PURE__*/React.createElement(AutoScroll, _objectSpread2({
8721
- cref: autoRef,
8722
- complete: function complete() {
8723
- return handleComplete;
8724
- },
8725
- half: function half() {
8726
- return handleHalf;
8719
+ setTimeout(function () {
8720
+ //手动触发执行滚动
8721
+ if (autoRef.current) {
8722
+ autoRef.current.tryScroll();
8727
8723
  }
8728
- }, otherProps), partA && partA.map(function (item, index) {
8729
- return render(item, index);
8730
- }), partB && partB.map(function (item, index) {
8731
- return render(item, index);
8732
- }));
8733
- }
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 || '暂无数据');
8734
8750
  };
8735
8751
 
8736
8752
  var _excluded$b = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
package/dist/index.js CHANGED
@@ -7923,7 +7923,7 @@ var WForm = function WForm(props, ref) {
7923
7923
 
7924
7924
  var WForm$1 = /*#__PURE__*/React__default['default'].forwardRef(WForm);
7925
7925
 
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"];
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"];
7927
7927
  function Table(_ref) {
7928
7928
  var _formSearchRef$curren3, _classnames2;
7929
7929
 
@@ -7953,6 +7953,7 @@ function Table(_ref) {
7953
7953
  _ref$frameBoxDirectio = _ref.frameBoxDirection,
7954
7954
  frameBoxDirection = _ref$frameBoxDirectio === void 0 ? 'out' : _ref$frameBoxDirectio,
7955
7955
  formRef = _ref.formRef,
7956
+ none = _ref.none,
7956
7957
  props = _objectWithoutProperties(_ref, _excluded$7);
7957
7958
 
7958
7959
  var _useState = React.useState(_toConsumableArray((rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.selectedRowKeys) || [])),
@@ -8399,7 +8400,7 @@ function Table(_ref) {
8399
8400
  style: _objectSpread2({
8400
8401
  height: (style === null || style === void 0 ? void 0 : style.height) ? "calc(".concat(style.height, " - ").concat(52 + (pagination === false ? 0 : 42), "px)") : '200px'
8401
8402
  }, tbodyStyle)
8402
- }, dataSource.map(function (record, index) {
8403
+ }, dataSource.length > 0 ? dataSource.map(function (record, index) {
8403
8404
  var key = typeof rowKey === 'function' ? record[rowKey(record)] : record[rowKey];
8404
8405
  return frameBoxTable ? /*#__PURE__*/React__default['default'].createElement(FrameBox, {
8405
8406
  key: key,
@@ -8408,7 +8409,15 @@ function Table(_ref) {
8408
8409
  width: '100%'
8409
8410
  }
8410
8411
  }, renderTr(record, index, key)) : renderTr(record, index, key);
8411
- })), _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({
8412
8421
  style: {
8413
8422
  textAlign: 'right',
8414
8423
  marginTop: '10px'
@@ -8606,7 +8615,7 @@ var Index$8 = function Index(props) {
8606
8615
 
8607
8616
  Index$8.defaultProps = {};
8608
8617
 
8609
- var _excluded$a = ["list", "render", "partSize"];
8618
+ var _excluded$a = ["list", "render", "none", "partSize"];
8610
8619
 
8611
8620
  function AutoScroll(props) {
8612
8621
  var inner1 = React.useRef();
@@ -8688,83 +8697,90 @@ function AutoScroll(props) {
8688
8697
  var Index$9 = function Index(_ref) {
8689
8698
  var list = _ref.list,
8690
8699
  render = _ref.render,
8700
+ none = _ref.none,
8691
8701
  _ref$partSize = _ref.partSize,
8692
8702
  partSize = _ref$partSize === void 0 ? 4 : _ref$partSize,
8693
8703
  otherProps = _objectWithoutProperties(_ref, _excluded$a);
8694
8704
 
8695
- {
8696
- var _useState = React.useState([]),
8697
- _useState2 = _slicedToArray(_useState, 2),
8698
- partA = _useState2[0],
8699
- setPatrA = _useState2[1];
8705
+ var _useState = React.useState([]),
8706
+ _useState2 = _slicedToArray(_useState, 2),
8707
+ partA = _useState2[0],
8708
+ setPatrA = _useState2[1];
8700
8709
 
8701
- var _useState3 = React.useState([]),
8702
- _useState4 = _slicedToArray(_useState3, 2),
8703
- partB = _useState4[0],
8704
- 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中的开始索引
8705
8714
 
8706
8715
 
8707
- var _useState5 = React.useState(0),
8708
- _useState6 = _slicedToArray(_useState5, 2),
8709
- partAStartIndex = _useState6[0],
8710
- 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中的开始索引
8711
8720
 
8712
8721
 
8713
- var _useState7 = React.useState(partSize),
8714
- _useState8 = _slicedToArray(_useState7, 2),
8715
- partBStartIndex = _useState8[0],
8716
- setPartBStartIndex = _useState8[1];
8722
+ var _useState7 = React.useState(partSize),
8723
+ _useState8 = _slicedToArray(_useState7, 2),
8724
+ partBStartIndex = _useState8[0],
8725
+ setPartBStartIndex = _useState8[1];
8717
8726
 
8718
- var autoRef = React.useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8727
+ var autoRef = React.useRef(); // 当滚动至一半的位置时,修改partAStartIndex
8719
8728
 
8720
- var handleHalf = function handleHalf() {
8721
- setPartAStartIndex((partBStartIndex + partSize) % list.length);
8722
- }; // 当滚动归位时,修改partBStartIndex
8729
+ var handleHalf = function handleHalf() {
8730
+ setPartAStartIndex((partBStartIndex + partSize) % list.length);
8731
+ }; // 当滚动归位时,修改partBStartIndex
8723
8732
 
8724
8733
 
8725
- var handleComplete = function handleComplete() {
8726
- setPartBStartIndex((partAStartIndex + partSize) % list.length);
8727
- };
8734
+ var handleComplete = function handleComplete() {
8735
+ setPartBStartIndex((partAStartIndex + partSize) % list.length);
8736
+ };
8728
8737
 
8729
- React.useEffect(function () {
8730
- // partA中的数据
8731
- if (list.length > partSize) {
8732
- setPatrA(list);
8733
- } else {
8734
- setPatrA(list);
8735
- } // partB中的数据
8738
+ React.useEffect(function () {
8739
+ // partA中的数据
8740
+ if (list.length > partSize) {
8741
+ setPatrA(list);
8742
+ } else {
8743
+ setPatrA(list);
8744
+ } // partB中的数据
8736
8745
 
8737
8746
 
8738
- if (list.length > partSize) {
8739
- setPatrB(list);
8740
- } else {
8741
- setPatrB([]);
8742
- }
8747
+ if (list.length > partSize) {
8748
+ setPatrB(list);
8749
+ } else {
8750
+ setPatrB([]);
8751
+ }
8743
8752
 
8744
- setTimeout(function () {
8745
- //手动触发执行滚动
8746
- if (autoRef.current) {
8747
- autoRef.current.tryScroll();
8748
- }
8749
- }, 0);
8750
- }, [list]);
8751
- React.useEffect(function () {
8752
- setPartBStartIndex(partAStartIndex + partSize);
8753
- }, []);
8754
- return /*#__PURE__*/React__default['default'].createElement(AutoScroll, _objectSpread2({
8755
- cref: autoRef,
8756
- complete: function complete() {
8757
- return handleComplete;
8758
- },
8759
- half: function half() {
8760
- return handleHalf;
8753
+ setTimeout(function () {
8754
+ //手动触发执行滚动
8755
+ if (autoRef.current) {
8756
+ autoRef.current.tryScroll();
8761
8757
  }
8762
- }, otherProps), partA && partA.map(function (item, index) {
8763
- return render(item, index);
8764
- }), partB && partB.map(function (item, index) {
8765
- return render(item, index);
8766
- }));
8767
- }
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 || '暂无数据');
8768
8784
  };
8769
8785
 
8770
8786
  var _excluded$b = ["data", "onClick", "slidesPerView", "rowKey", "onSwiperChange", "renderItem"];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.2.44",
4
+ "version": "0.3.1",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",