wargerm 0.5.0 → 0.5.3

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.
@@ -20,5 +20,5 @@ declare type Props = {
20
20
  sliderTabs?: IsliderTabs;
21
21
  style?: Record<string, string>;
22
22
  };
23
- declare const _default: React.ForwardRefExoticComponent<Props & React.RefAttributes<any>>;
23
+ declare const _default: React.MemoExoticComponent<React.ForwardRefExoticComponent<Props & React.RefAttributes<any>>>;
24
24
  export default _default;
package/dist/index.esm.js CHANGED
@@ -8317,12 +8317,14 @@ function Table(_ref) {
8317
8317
  case 7:
8318
8318
  res = _context.sent;
8319
8319
  setLoading(false);
8320
- onLoad && onLoad(res.data, res);
8321
- setDataSource(res.data);
8322
- setTotal(res.total || 0);
8320
+ onLoad && onLoad(res === null || res === void 0 ? void 0 : res.data, res);
8321
+ setDataSource((res === null || res === void 0 ? void 0 : res.data) || []);
8322
+ setTotal((res === null || res === void 0 ? void 0 : res.total) || 0);
8323
8323
  setpaginationParams(function (c) {
8324
+ var _res$data;
8325
+
8324
8326
  return _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8325
- total: res.total || res.data.length
8327
+ total: (res === null || res === void 0 ? void 0 : res.total) || (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.length) || 0
8326
8328
  }, pagination), requestParams);
8327
8329
  });
8328
8330
  _context.next = 16;
@@ -8330,13 +8332,15 @@ function Table(_ref) {
8330
8332
 
8331
8333
  case 15:
8332
8334
  setpaginationParams(function (c) {
8335
+ var _tableList$slice;
8336
+
8333
8337
  var obj = _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8334
- total: tableList && tableList.length || 0
8338
+ total: (tableList === null || tableList === void 0 ? void 0 : tableList.length) || 0
8335
8339
  }, pagination), pageParams);
8336
8340
 
8337
8341
  var current = obj.current,
8338
8342
  pageSize = obj.pageSize;
8339
- setDataSource(tableList ? (tableList === null || tableList === void 0 ? void 0 : tableList.slice((current - 1) * pageSize, current * pageSize)) || [] : []);
8343
+ setDataSource((tableList === null || tableList === void 0 ? void 0 : (_tableList$slice = tableList.slice) === null || _tableList$slice === void 0 ? void 0 : _tableList$slice.call(tableList, (current - 1) * pageSize, current * pageSize)) || []);
8340
8344
  return obj;
8341
8345
  });
8342
8346
 
@@ -9557,6 +9561,7 @@ var Index$c = function Index(_ref, ref) {
9557
9561
  className: "sliderTabs ".concat(sliderTabs.direction == 'left' ? "left ".concat(sliderTabs.className || '') : "right ".concat(sliderTabs.className || ''))
9558
9562
  }, (sliderTabs === null || sliderTabs === void 0 ? void 0 : sliderTabs.renderTab) ? sliderTabs === null || sliderTabs === void 0 ? void 0 : sliderTabs.renderTab : sliderTabs === null || sliderTabs === void 0 ? void 0 : (_sliderTabs$tabs = sliderTabs.tabs) === null || _sliderTabs$tabs === void 0 ? void 0 : _sliderTabs$tabs.map(function (item, index) {
9559
9563
  return /*#__PURE__*/React.createElement("div", {
9564
+ key: index,
9560
9565
  className: "tab ".concat(index == activeTab ? "active ".concat(sliderTabs.activeTabClassName || '') : '', " ").concat(sliderTabs.tabClassName || '')
9561
9566
  }, /*#__PURE__*/React.createElement("span", {
9562
9567
  onClick: function onClick() {
@@ -9567,7 +9572,7 @@ var Index$c = function Index(_ref, ref) {
9567
9572
  }))));
9568
9573
  };
9569
9574
 
9570
- var index$2 = /*#__PURE__*/forwardRef(Index$c);
9575
+ var index$2 = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(Index$c));
9571
9576
 
9572
9577
  var controlShow = function controlShow(f1, f2, value, timer) {
9573
9578
  f1(value);
@@ -10555,7 +10560,7 @@ var ModalForm = function ModalForm(props, ref) {
10555
10560
 
10556
10561
  var ModalForm$1 = /*#__PURE__*/React.forwardRef(ModalForm);
10557
10562
 
10558
- var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
10563
+ var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
10559
10564
 
10560
10565
  var TabelCard = function TabelCard(props, ref) {
10561
10566
  var columns = props.columns,
@@ -10564,6 +10569,7 @@ var TabelCard = function TabelCard(props, ref) {
10564
10569
  modalFormSearch = props.modalFormSearch,
10565
10570
  search = props.search,
10566
10571
  tableAction = props.tableAction,
10572
+ fliterAction = props.fliterAction,
10567
10573
  renderTableBar = props.renderTableBar,
10568
10574
  className = props.className,
10569
10575
  style = props.style,
@@ -10768,10 +10774,13 @@ var TabelCard = function TabelCard(props, ref) {
10768
10774
 
10769
10775
  var tableActionDom = function tableActionDom(record, index) {
10770
10776
  var showMoreNum = (optionColumnConfig === null || optionColumnConfig === void 0 ? void 0 : optionColumnConfig.showMoreNum) || 0;
10777
+ var tableActionList = (tableAction === null || tableAction === void 0 ? void 0 : tableAction.filter(function (v) {
10778
+ return fliterAction ? fliterAction(record, v) : true;
10779
+ })) || [];
10771
10780
 
10772
- if (tableAction && showMoreNum > 0 && showMoreNum < tableAction.length) {
10773
- var tableAction1 = tableAction.slice(0, showMoreNum);
10774
- var tableAction2 = tableAction.slice(showMoreNum);
10781
+ if (tableAction && showMoreNum > 0 && showMoreNum < tableActionList.length) {
10782
+ var tableAction1 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(0, showMoreNum);
10783
+ var tableAction2 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(showMoreNum);
10775
10784
  var menu = /*#__PURE__*/React.createElement(_Menu, null, tableAction2.map(function (item, i) {
10776
10785
  var _actionHandler$item$t2;
10777
10786
 
@@ -10823,7 +10832,7 @@ var TabelCard = function TabelCard(props, ref) {
10823
10832
  key: "more"
10824
10833
  }, /*#__PURE__*/React.createElement(EllipsisOutlined, null)))]);
10825
10834
  } else {
10826
- return tableAction === null || tableAction === void 0 ? void 0 : tableAction.map(function (item, i) {
10835
+ return tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.map(function (item, i) {
10827
10836
  var _actionHandler$item$t6;
10828
10837
 
10829
10838
  var btn = actionConfig[item.type];
package/dist/index.js CHANGED
@@ -8376,12 +8376,14 @@ function Table(_ref) {
8376
8376
  case 7:
8377
8377
  res = _context.sent;
8378
8378
  setLoading(false);
8379
- onLoad && onLoad(res.data, res);
8380
- setDataSource(res.data);
8381
- setTotal(res.total || 0);
8379
+ onLoad && onLoad(res === null || res === void 0 ? void 0 : res.data, res);
8380
+ setDataSource((res === null || res === void 0 ? void 0 : res.data) || []);
8381
+ setTotal((res === null || res === void 0 ? void 0 : res.total) || 0);
8382
8382
  setpaginationParams(function (c) {
8383
+ var _res$data;
8384
+
8383
8385
  return _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8384
- total: res.total || res.data.length
8386
+ total: (res === null || res === void 0 ? void 0 : res.total) || (res === null || res === void 0 ? void 0 : (_res$data = res.data) === null || _res$data === void 0 ? void 0 : _res$data.length) || 0
8385
8387
  }, pagination), requestParams);
8386
8388
  });
8387
8389
  _context.next = 16;
@@ -8389,13 +8391,15 @@ function Table(_ref) {
8389
8391
 
8390
8392
  case 15:
8391
8393
  setpaginationParams(function (c) {
8394
+ var _tableList$slice;
8395
+
8392
8396
  var obj = _objectSpread2(_objectSpread2(_objectSpread2({}, c), {}, {
8393
- total: tableList && tableList.length || 0
8397
+ total: (tableList === null || tableList === void 0 ? void 0 : tableList.length) || 0
8394
8398
  }, pagination), pageParams);
8395
8399
 
8396
8400
  var current = obj.current,
8397
8401
  pageSize = obj.pageSize;
8398
- setDataSource(tableList ? (tableList === null || tableList === void 0 ? void 0 : tableList.slice((current - 1) * pageSize, current * pageSize)) || [] : []);
8402
+ setDataSource((tableList === null || tableList === void 0 ? void 0 : (_tableList$slice = tableList.slice) === null || _tableList$slice === void 0 ? void 0 : _tableList$slice.call(tableList, (current - 1) * pageSize, current * pageSize)) || []);
8399
8403
  return obj;
8400
8404
  });
8401
8405
 
@@ -9616,6 +9620,7 @@ var Index$c = function Index(_ref, ref) {
9616
9620
  className: "sliderTabs ".concat(sliderTabs.direction == 'left' ? "left ".concat(sliderTabs.className || '') : "right ".concat(sliderTabs.className || ''))
9617
9621
  }, (sliderTabs === null || sliderTabs === void 0 ? void 0 : sliderTabs.renderTab) ? sliderTabs === null || sliderTabs === void 0 ? void 0 : sliderTabs.renderTab : sliderTabs === null || sliderTabs === void 0 ? void 0 : (_sliderTabs$tabs = sliderTabs.tabs) === null || _sliderTabs$tabs === void 0 ? void 0 : _sliderTabs$tabs.map(function (item, index) {
9618
9622
  return /*#__PURE__*/React__default['default'].createElement("div", {
9623
+ key: index,
9619
9624
  className: "tab ".concat(index == activeTab ? "active ".concat(sliderTabs.activeTabClassName || '') : '', " ").concat(sliderTabs.tabClassName || '')
9620
9625
  }, /*#__PURE__*/React__default['default'].createElement("span", {
9621
9626
  onClick: function onClick() {
@@ -9626,7 +9631,7 @@ var Index$c = function Index(_ref, ref) {
9626
9631
  }))));
9627
9632
  };
9628
9633
 
9629
- var index$2 = /*#__PURE__*/React.forwardRef(Index$c);
9634
+ var index$2 = /*#__PURE__*/React.memo( /*#__PURE__*/React.forwardRef(Index$c));
9630
9635
 
9631
9636
  var controlShow = function controlShow(f1, f2, value, timer) {
9632
9637
  f1(value);
@@ -10614,7 +10619,7 @@ var ModalForm = function ModalForm(props, ref) {
10614
10619
 
10615
10620
  var ModalForm$1 = /*#__PURE__*/React__default['default'].forwardRef(ModalForm);
10616
10621
 
10617
- var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
10622
+ var _excluded$h = ["columns", "extraColumns", "request", "modalFormSearch", "search", "tableAction", "fliterAction", "renderTableBar", "className", "style", "onFormChange", "modalConfig", "optionColumnConfig", "pagination", "noBordered"];
10618
10623
 
10619
10624
  var TabelCard = function TabelCard(props, ref) {
10620
10625
  var columns = props.columns,
@@ -10623,6 +10628,7 @@ var TabelCard = function TabelCard(props, ref) {
10623
10628
  modalFormSearch = props.modalFormSearch,
10624
10629
  search = props.search,
10625
10630
  tableAction = props.tableAction,
10631
+ fliterAction = props.fliterAction,
10626
10632
  renderTableBar = props.renderTableBar,
10627
10633
  className = props.className,
10628
10634
  style = props.style,
@@ -10827,10 +10833,13 @@ var TabelCard = function TabelCard(props, ref) {
10827
10833
 
10828
10834
  var tableActionDom = function tableActionDom(record, index) {
10829
10835
  var showMoreNum = (optionColumnConfig === null || optionColumnConfig === void 0 ? void 0 : optionColumnConfig.showMoreNum) || 0;
10836
+ var tableActionList = (tableAction === null || tableAction === void 0 ? void 0 : tableAction.filter(function (v) {
10837
+ return fliterAction ? fliterAction(record, v) : true;
10838
+ })) || [];
10830
10839
 
10831
- if (tableAction && showMoreNum > 0 && showMoreNum < tableAction.length) {
10832
- var tableAction1 = tableAction.slice(0, showMoreNum);
10833
- var tableAction2 = tableAction.slice(showMoreNum);
10840
+ if (tableAction && showMoreNum > 0 && showMoreNum < tableActionList.length) {
10841
+ var tableAction1 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(0, showMoreNum);
10842
+ var tableAction2 = tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.slice(showMoreNum);
10834
10843
  var menu = /*#__PURE__*/React__default['default'].createElement(_Menu__default['default'], null, tableAction2.map(function (item, i) {
10835
10844
  var _actionHandler$item$t2;
10836
10845
 
@@ -10882,7 +10891,7 @@ var TabelCard = function TabelCard(props, ref) {
10882
10891
  key: "more"
10883
10892
  }, /*#__PURE__*/React__default['default'].createElement(icons.EllipsisOutlined, null)))]);
10884
10893
  } else {
10885
- return tableAction === null || tableAction === void 0 ? void 0 : tableAction.map(function (item, i) {
10894
+ return tableActionList === null || tableActionList === void 0 ? void 0 : tableActionList.map(function (item, i) {
10886
10895
  var _actionHandler$item$t6;
10887
10896
 
10888
10897
  var btn = actionConfig[item.type];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "private": false,
3
3
  "name": "wargerm",
4
- "version": "0.5.0",
4
+ "version": "0.5.3",
5
5
  "scripts": {
6
6
  "dev": "dumi dev",
7
7
  "docs:build": "dumi build",