@bit-sun/business-component 3.1.6 → 3.1.7

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/index.esm.js CHANGED
@@ -4650,11 +4650,27 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
4650
4650
  });
4651
4651
  };
4652
4652
  var onChangeCheckAll = function onChangeCheckAll(e) {
4653
+ // 允许用户自定义 全选操作逻辑
4654
+ if (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.onCheckAll) {
4655
+ modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.onCheckAll(e, {
4656
+ items: items,
4657
+ itemsTotal: itemsTotal,
4658
+ tablePagination: tablePagination,
4659
+ onCheckAllData: onCheckAllData,
4660
+ setSelectedRowKeys: setSelectedRowKeys,
4661
+ setPopValue: setPopValue,
4662
+ setSelectedRows: setSelectedRows,
4663
+ setIndeterminate: setIndeterminate,
4664
+ setCheckedAll: setCheckedAll
4665
+ });
4666
+ return;
4667
+ }
4653
4668
  if (e.target.checked) {
4654
4669
  // 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
4655
4670
  // 如果超过100条 就默认查出所有数据
4656
- if (items.length < itemsTotal) {
4657
- var totalPage = Math.ceil(itemsTotal / (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize));
4671
+ if (items.length < itemsTotal || items.length === itemsTotal && itemsTotal == 0) {
4672
+ var totalCount = (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total) || itemsTotal; // 兼容有查询条件的情况 首次加载是没有所有数据的,默认给加载后端返回的总条数
4673
+ var totalPage = Math.ceil(totalCount / (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize));
4658
4674
  var allPageSize = totalPage * (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize);
4659
4675
  onCheckAllData(allPageSize);
4660
4676
  } else {
@@ -5080,7 +5096,7 @@ var SearchSelect = /*#__PURE__*/forwardRef(function (props, ref) {
5080
5096
  }
5081
5097
  };
5082
5098
  }
5083
- }), selectMode ? ( /*#__PURE__*/React$1.createElement("div", {
5099
+ }), selectMode && !(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.isHiddenCheckAll) ? ( /*#__PURE__*/React$1.createElement("div", {
5084
5100
  className: 'select_list_selectAll'
5085
5101
  }, /*#__PURE__*/React$1.createElement(Checkbox, {
5086
5102
  indeterminate: indeterminate,
package/dist/index.js CHANGED
@@ -4673,11 +4673,27 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
4673
4673
  });
4674
4674
  };
4675
4675
  var onChangeCheckAll = function onChangeCheckAll(e) {
4676
+ // 允许用户自定义 全选操作逻辑
4677
+ if (modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.onCheckAll) {
4678
+ modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.onCheckAll(e, {
4679
+ items: items,
4680
+ itemsTotal: itemsTotal,
4681
+ tablePagination: tablePagination,
4682
+ onCheckAllData: onCheckAllData,
4683
+ setSelectedRowKeys: setSelectedRowKeys,
4684
+ setPopValue: setPopValue,
4685
+ setSelectedRows: setSelectedRows,
4686
+ setIndeterminate: setIndeterminate,
4687
+ setCheckedAll: setCheckedAll
4688
+ });
4689
+ return;
4690
+ }
4676
4691
  if (e.target.checked) {
4677
4692
  // 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
4678
4693
  // 如果超过100条 就默认查出所有数据
4679
- if (items.length < itemsTotal) {
4680
- var totalPage = Math.ceil(itemsTotal / (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize));
4694
+ if (items.length < itemsTotal || items.length === itemsTotal && itemsTotal == 0) {
4695
+ var totalCount = (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.total) || itemsTotal; // 兼容有查询条件的情况 首次加载是没有所有数据的,默认给加载后端返回的总条数
4696
+ var totalPage = Math.ceil(totalCount / (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize));
4681
4697
  var allPageSize = totalPage * (tablePagination === null || tablePagination === void 0 ? void 0 : tablePagination.pageSize);
4682
4698
  onCheckAllData(allPageSize);
4683
4699
  } else {
@@ -5103,7 +5119,7 @@ var SearchSelect = /*#__PURE__*/React$1.forwardRef(function (props, ref) {
5103
5119
  }
5104
5120
  };
5105
5121
  }
5106
- }), selectMode ? ( /*#__PURE__*/React__default['default'].createElement("div", {
5122
+ }), selectMode && !(modalTableProps === null || modalTableProps === void 0 ? void 0 : modalTableProps.isHiddenCheckAll) ? ( /*#__PURE__*/React__default['default'].createElement("div", {
5107
5123
  className: 'select_list_selectAll'
5108
5124
  }, /*#__PURE__*/React__default['default'].createElement(antd.Checkbox, {
5109
5125
  indeterminate: indeterminate,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bit-sun/business-component",
3
- "version": "3.1.6",
3
+ "version": "3.1.7",
4
4
  "scripts": {
5
5
  "start": "dumi dev",
6
6
  "docs:build": "dumi build",
@@ -563,11 +563,18 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
563
563
  }
564
564
 
565
565
  const onChangeCheckAll = (e) => {
566
+ // 允许用户自定义 全选操作逻辑
567
+ if(modalTableProps?.onCheckAll) {
568
+ modalTableProps?.onCheckAll(e,{items,itemsTotal,tablePagination,onCheckAllData,setSelectedRowKeys,setPopValue,setSelectedRows,setIndeterminate,setCheckedAll})
569
+ return;
570
+ }
571
+
566
572
  if (e.target.checked) {
567
573
  // 如果下拉框有所有数据就处理选中所有【items.length === itemsTotal】(最多可选100条)
568
574
  // 如果超过100条 就默认查出所有数据
569
- if (items.length < itemsTotal) {
570
- const totalPage = Math.ceil(itemsTotal / tablePagination?.pageSize);
575
+ if ((items.length < itemsTotal) || (items.length === itemsTotal && itemsTotal == 0)) {
576
+ const totalCount = tablePagination?.total || itemsTotal // 兼容有查询条件的情况 首次加载是没有所有数据的,默认给加载后端返回的总条数
577
+ const totalPage = Math.ceil(totalCount / tablePagination?.pageSize);
571
578
  const allPageSize = totalPage * tablePagination?.pageSize;
572
579
  onCheckAllData(allPageSize)
573
580
  } else {
@@ -1009,7 +1016,7 @@ const SearchSelect = forwardRef((props: any, ref: any) => {
1009
1016
  };
1010
1017
  }}
1011
1018
  />
1012
- {selectMode ? (
1019
+ {(selectMode && !modalTableProps?.isHiddenCheckAll) ? (
1013
1020
  <div className={'select_list_selectAll'}>
1014
1021
  <Checkbox
1015
1022
  indeterminate={indeterminate}