@teamix/pro 1.5.35 → 1.5.37

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/es/index.d.ts CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
30
30
  export * from './utils';
31
31
  export * from './timeline';
32
32
  export * from './image';
33
- declare const version = "1.5.35";
33
+ declare const version = "1.5.37";
34
34
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
package/es/index.js CHANGED
@@ -37,7 +37,7 @@ export * from './sidebar';
37
37
  export * from './utils';
38
38
  export * from './timeline';
39
39
  export * from './image';
40
- var version = '1.5.35';
40
+ var version = '1.5.37';
41
41
  // By TeamixTest
42
42
  window.postMessage({
43
43
  source: 'teamix-test-devtools',
@@ -15,7 +15,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
15
15
  * 渲染列的逻辑函数
16
16
  */
17
17
  import React from 'react';
18
- import { getTargetValue } from '@teamix/utils';
18
+ import { getTargetValue, _ } from '@teamix/utils';
19
19
  import { ProActionGroup } from '../../../actions';
20
20
  import ProField from '../../../field';
21
21
  /**
@@ -190,13 +190,18 @@ var processBuriedPoint = function processBuriedPoint() {
190
190
  };
191
191
  var equalColumns = function equalColumns(prevProps, nextProps) {
192
192
  var preValue = prevProps.value;
193
- var nextValue = nextProps.value;
193
+ var nextValue = nextProps.value,
194
+ item = nextProps.item;
194
195
  // columns 强制更新参数
195
- if (nextProps === null || nextProps === void 0 ? void 0 : nextProps.forcedUpdate) {
196
+ if (item === null || item === void 0 ? void 0 : item.forcedUpdate) {
196
197
  return false;
197
198
  }
198
- // 操作列的时候强制刷新
199
- if (preValue === false && nextValue === false) {
199
+ // 操作列的时候强制刷新 || 当 value 值拿不到的时候
200
+ if (preValue === false && nextValue === false || nextValue === undefined) {
201
+ return false;
202
+ }
203
+ // 如果不是 string 类型,全部刷新
204
+ if (!_.isString(nextValue)) {
200
205
  return false;
201
206
  }
202
207
  if (preValue === nextValue) {
@@ -130,7 +130,7 @@ var Layout = function Layout(props) {
130
130
  }
131
131
  }, [
132
132
  //todo: 重复render 问题都在这里
133
- dataFilter, mainAction, dataFilterFormRef, afterDataFilter]);
133
+ dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection]);
134
134
  // 区域组合渲染
135
135
  var renderLayout = function renderLayout() {
136
136
  if (header && mainAction) {
package/es/table/index.js CHANGED
@@ -422,9 +422,9 @@ var ProTable = function ProTable(props) {
422
422
  if (showSkeleton && result) {
423
423
  result.disabled = true;
424
424
  }
425
- return _objectSpread(_objectSpread({
425
+ return _objectSpread({
426
426
  _primaryKey: props.primaryKey
427
- }, record), result);
427
+ }, result);
428
428
  },
429
429
  titleProps: function titleProps() {
430
430
  var result = {};
@@ -437,7 +437,7 @@ var ProTable = function ProTable(props) {
437
437
  return result;
438
438
  },
439
439
  onChange: onChangeRowSelection
440
- }), primaryKey);
440
+ }), data !== null && data !== void 0 ? data : propsDataSource, primaryKey);
441
441
  var rowSelection = useRowSelection ? rowSelectionHook.rowSelection : propsRowSelection;
442
442
  var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
443
443
  useEffect(function () {
@@ -836,7 +836,7 @@ var ProTable = function ProTable(props) {
836
836
  var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$g = _actionRef$current6.getFilterRules) === null || _actionRef$current6$g === void 0 ? void 0 : _actionRef$current6$g.call(_actionRef$current6)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
837
837
  // 格式化后的请求参数
838
838
  var requestData = {};
839
- var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params);
839
+ var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3))), params);
840
840
  if (typeof formatParams === 'string') {
841
841
  requestData = getTargetValue(formatParams, {
842
842
  params: preParams
@@ -949,7 +949,7 @@ var ProTable = function ProTable(props) {
949
949
  return true;
950
950
  } : undefined,
951
951
  onFilter: function onFilter(values) {
952
- var _actionRef$current7, _actionRef$current7$c;
952
+ var _actionRef$current7, _actionRef$current7$c, _request8;
953
953
  // 全屏状态,判断全屏表单onFilter是否禁用
954
954
  if (fullscreenState && !filterEnableRef.current.fullscreen) {
955
955
  filterEnableRef.current.fullscreen = true;
@@ -970,17 +970,17 @@ var ProTable = function ProTable(props) {
970
970
  // 搜索变化时,暂时先清空选择
971
971
  (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
972
972
  setCurrentPage(1);
973
- _request(_defineProperty({}, targetPageKey, 1), false, values);
973
+ _request((_request8 = {}, _defineProperty(_request8, targetPageKey, 1), _defineProperty(_request8, targetPageSizeKey, pageSize), _request8), false, values);
974
974
  },
975
975
  onReset: function onReset(values) {
976
- var _dataFilterFormRef$cu3;
976
+ var _dataFilterFormRef$cu3, _request9;
977
977
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
978
978
  (_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
979
979
  setCurrentPage(1);
980
- _request(_defineProperty({}, targetPageKey, 1), false, values);
980
+ _request((_request9 = {}, _defineProperty(_request9, targetPageKey, 1), _defineProperty(_request9, targetPageSizeKey, pageSize), _request9), false, values);
981
981
  }
982
982
  });
983
- }, [propsDataFilter, fullscreenState, filterEnableRef, actionRef]);
983
+ }, [propsDataFilter, fullscreenState, filterEnableRef, actionRef, pageSize]);
984
984
  var isLoading = useMemo(function () {
985
985
  if (!customRequest) {
986
986
  return showLoading && !showSkeleton && (getData.loading || props.loading);
@@ -24,6 +24,8 @@ declare type TDataService = {
24
24
  };
25
25
  export declare type responsivePaginationType = 'mini' | 'small' | 'simple' | 'normal';
26
26
  export declare type ProTableColumnProps = {
27
+ /** 是否强制刷新 */
28
+ forcedUpdate?: boolean;
27
29
  /** 是否开启了自动计算宽度 */
28
30
  isAutoWidth?: boolean;
29
31
  /** 自动计算宽度时的被挤占的情况 */
@@ -61,7 +61,6 @@ export function genAutoWidthColumns(columns, ref, data, size, useRowSelection, a
61
61
  finalColumns.push(column);
62
62
  return;
63
63
  }
64
- ;
65
64
  if ((column === null || column === void 0 ? void 0 : column.columnFilters) === false) {
66
65
  finalColumns.push(column);
67
66
  return;
@@ -100,7 +99,8 @@ export function genAutoWidthColumns(columns, ref, data, size, useRowSelection, a
100
99
  return;
101
100
  }
102
101
  // @ts-ignore
103
- var titleWidth = _.get(childNodes, '[index]?.children[0].scrollWidth', 0);
102
+ var titleWidth = _.get(childNodes[index], "children[0].scrollWidth", 0);
103
+ // const titleWidth = childNodes[index]?.children[0].scrollWidth
104
104
  // @ts-ignore
105
105
  if (fixedWidthTypeList[finalType]) {
106
106
  // console.log(
@@ -9,5 +9,5 @@ declare type FixedColumnProps = ColumnProps & {
9
9
  */
10
10
  export default function genProColumnToColumn(columns: ProTableColumnProps[],
11
11
  /** 是否渲染骨架屏 */
12
- showSkeleton: boolean, actionRef: React.MutableRefObject<ProTableActionType | undefined>, context?: any, dataTeamixSpm?: string, bindUrl?: ProTableProps['bindUrl'], bindUrlProps?: ProTableProps['bindUrlProps'], forcedUpdate?: boolean): FixedColumnProps[];
12
+ showSkeleton: boolean, actionRef: React.MutableRefObject<ProTableActionType | undefined>, context?: any, dataTeamixSpm?: string, bindUrl?: ProTableProps['bindUrl'], bindUrlProps?: ProTableProps['bindUrlProps']): FixedColumnProps[];
13
13
  export {};
@@ -21,9 +21,6 @@ showSkeleton, actionRef) {
21
21
  dataTeamixSpm = arguments.length > 4 ? arguments[4] : undefined;
22
22
  var bindUrl = arguments.length > 5 ? arguments[5] : undefined;
23
23
  var bindUrlProps = arguments.length > 6 ? arguments[6] : undefined;
24
- var
25
- // 是否强制刷新
26
- forcedUpdate = arguments.length > 7 ? arguments[7] : undefined;
27
24
  return columns.map(function (columnProps) {
28
25
  var filters = columnProps.filters,
29
26
  dataIndex = columnProps.dataIndex,
@@ -72,8 +69,7 @@ showSkeleton, actionRef) {
72
69
  record: record,
73
70
  actionRef: actionRef,
74
71
  context: context,
75
- dataTeamixSpm: dataTeamixSpm,
76
- forcedUpdate: forcedUpdate
72
+ dataTeamixSpm: dataTeamixSpm
77
73
  });
78
74
  // return renderCell(
79
75
  // value,
@@ -1,3 +1,26 @@
1
- import { rowSelectionType, innerRowSelectionType } from '../typing';
2
- declare function useTableSelection(config?: rowSelectionType, primaryKey?: string): innerRowSelectionType;
1
+ import { innerRowSelectionType } from '../typing';
2
+ declare function useTableSelection(config: ({
3
+ getProps?: ((record: any, index: number) => any) | undefined;
4
+ onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
5
+ onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
6
+ onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
7
+ selectedRowKeys?: any[] | undefined;
8
+ selectedRecords?: any[] | undefined;
9
+ mode?: "multiple" | "single" | undefined;
10
+ titleProps?: (() => any) | undefined;
11
+ columnProps?: (() => any) | undefined;
12
+ titleAddons?: (() => any) | undefined;
13
+ defaultSelectedRowKeys?: any[] | undefined;
14
+ defaultSelectedRecords?: any[] | undefined;
15
+ } & {
16
+ getProps?: ((record: any, index: number) => void) | undefined;
17
+ onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
18
+ onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
19
+ onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
20
+ selectedRowKeys?: any[] | undefined;
21
+ mode?: "multiple" | "single" | undefined;
22
+ titleProps?: (() => any) | undefined;
23
+ columnProps?: (() => any) | undefined;
24
+ titleAddons?: (() => any) | undefined;
25
+ }) | undefined, records: any, primaryKey?: string): innerRowSelectionType;
3
26
  export default useTableSelection;
@@ -1,4 +1,4 @@
1
- var _excluded = ["primaryKey"];
1
+ var _excluded = ["primaryKey", "_primaryKey"];
2
2
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
4
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -24,7 +24,8 @@ import { Balloon, Checkbox } from '@alicloudfe/components';
24
24
  var Tooltip = Balloon.Tooltip;
25
25
  function useTableSelection() {
26
26
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
27
- var primaryKey = arguments.length > 1 ? arguments[1] : undefined;
27
+ var records = arguments.length > 1 ? arguments[1] : undefined;
28
+ var primaryKey = arguments.length > 2 ? arguments[2] : undefined;
28
29
  var _config$defaultSelect = config.defaultSelectedRecords,
29
30
  defaultSelectedRecords = _config$defaultSelect === void 0 ? [] : _config$defaultSelect,
30
31
  _config$defaultSelect2 = config.defaultSelectedRowKeys,
@@ -72,18 +73,21 @@ function useTableSelection() {
72
73
  config.onChange(value, records);
73
74
  }
74
75
  }
75
- var renderCheckBox = function renderCheckBox(props) {
76
+ var renderCheckBox = function renderCheckBox(props, record) {
76
77
  var primaryKey = props.primaryKey,
78
+ _primaryKey = props._primaryKey,
77
79
  others = _objectWithoutProperties(props, _excluded);
78
80
  return /*#__PURE__*/React.createElement(Checkbox, _objectSpread({
79
81
  checked: selectedRowKeys.includes(primaryKey),
80
82
  onChange: function onChange(checked) {
83
+ var _config$onSelect;
84
+ config === null || config === void 0 ? void 0 : (_config$onSelect = config.onSelect) === null || _config$onSelect === void 0 ? void 0 : _config$onSelect.call(config, checked, record, records);
81
85
  if (checked) {
82
- _onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [props]);
86
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [record]);
83
87
  } else {
84
88
  _onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedRowKeys.filter(function (item) {
85
89
  return item !== primaryKey;
86
- }), [props]);
90
+ }), [record]);
87
91
  }
88
92
  }
89
93
  }, others));
@@ -94,6 +98,9 @@ function useTableSelection() {
94
98
  // console.log('propResult', propResult, selectedRowKeys);
95
99
  var resultProps = _objectSpread(_objectSpread({}, record), propResult);
96
100
  var primaryKey = record === null || record === void 0 ? void 0 : record[resultProps === null || resultProps === void 0 ? void 0 : resultProps['_primaryKey']];
101
+ if ((config === null || config === void 0 ? void 0 : config.mode) === 'single') {
102
+ return resultProps;
103
+ }
97
104
  return _objectSpread(_objectSpread({}, resultProps), {}, {
98
105
  isPreview: true,
99
106
  renderPreview: function renderPreview() {
@@ -101,13 +108,13 @@ function useTableSelection() {
101
108
  return /*#__PURE__*/React.createElement(Tooltip, {
102
109
  trigger: renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
103
110
  primaryKey: primaryKey
104
- })),
111
+ }), record),
105
112
  align: "t"
106
113
  }, propResult.disabledTooltip);
107
114
  }
108
115
  return renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
109
116
  primaryKey: primaryKey
110
- }));
117
+ }), record);
111
118
  }
112
119
  });
113
120
  };
package/lib/index.d.ts CHANGED
@@ -30,5 +30,5 @@ export * from './sidebar';
30
30
  export * from './utils';
31
31
  export * from './timeline';
32
32
  export * from './image';
33
- declare const version = "1.5.35";
33
+ declare const version = "1.5.37";
34
34
  export { version, ProAction, ProCard, ProField, ProForm, ProInfo, ProPageContainer, ProPageHeader, ProSkeleton, ProTable, ProSidebar, ProTimeline, TeamixIcon, ProImage, hooks, nocode, templates, utils, };
package/lib/index.js CHANGED
@@ -299,7 +299,7 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
299
299
  if (!((_window = window) === null || _window === void 0 ? void 0 : _window.TEAMIXPRO_WITHOUT_ICON)) {
300
300
  _icon.default.setConfig(_utils.default.getTeamixIconConfig());
301
301
  }
302
- var version = '1.5.35';
302
+ var version = '1.5.37';
303
303
  // By TeamixTest
304
304
  exports.version = version;
305
305
  window.postMessage({
@@ -194,13 +194,18 @@ var processBuriedPoint = function processBuriedPoint() {
194
194
  };
195
195
  var equalColumns = function equalColumns(prevProps, nextProps) {
196
196
  var preValue = prevProps.value;
197
- var nextValue = nextProps.value;
197
+ var nextValue = nextProps.value,
198
+ item = nextProps.item;
198
199
  // columns 强制更新参数
199
- if (nextProps === null || nextProps === void 0 ? void 0 : nextProps.forcedUpdate) {
200
+ if (item === null || item === void 0 ? void 0 : item.forcedUpdate) {
200
201
  return false;
201
202
  }
202
- // 操作列的时候强制刷新
203
- if (preValue === false && nextValue === false) {
203
+ // 操作列的时候强制刷新 || 当 value 值拿不到的时候
204
+ if (preValue === false && nextValue === false || nextValue === undefined) {
205
+ return false;
206
+ }
207
+ // 如果不是 string 类型,全部刷新
208
+ if (!_utils._.isString(nextValue)) {
204
209
  return false;
205
210
  }
206
211
  if (preValue === nextValue) {
@@ -139,7 +139,7 @@ var Layout = function Layout(props) {
139
139
  }
140
140
  }, [
141
141
  //todo: 重复render 问题都在这里
142
- dataFilter, mainAction, dataFilterFormRef, afterDataFilter]);
142
+ dataFilter, mainAction, dataFilterFormRef, afterDataFilter, rowSelection]);
143
143
  // 区域组合渲染
144
144
  var renderLayout = function renderLayout() {
145
145
  if (header && mainAction) {
@@ -443,9 +443,9 @@ var ProTable = function ProTable(props) {
443
443
  if (showSkeleton && result) {
444
444
  result.disabled = true;
445
445
  }
446
- return _objectSpread(_objectSpread({
446
+ return _objectSpread({
447
447
  _primaryKey: props.primaryKey
448
- }, record), result);
448
+ }, result);
449
449
  },
450
450
  titleProps: function titleProps() {
451
451
  var result = {};
@@ -458,7 +458,7 @@ var ProTable = function ProTable(props) {
458
458
  return result;
459
459
  },
460
460
  onChange: onChangeRowSelection
461
- }), primaryKey);
461
+ }), data !== null && data !== void 0 ? data : propsDataSource, primaryKey);
462
462
  var rowSelection = useRowSelection ? rowSelectionHook.rowSelection : propsRowSelection;
463
463
  var selectedCount = (rowSelection === null || rowSelection === void 0 ? void 0 : (_rowSelection$selecte = rowSelection.selectedRowKeys) === null || _rowSelection$selecte === void 0 ? void 0 : _rowSelection$selecte.length) || 0;
464
464
  (0, _react.useEffect)(function () {
@@ -857,7 +857,7 @@ var ProTable = function ProTable(props) {
857
857
  var columnsFilterParams = (_actionRef$current$ge = (_actionRef$current6 = actionRef.current) === null || _actionRef$current6 === void 0 ? void 0 : (_actionRef$current6$g = _actionRef$current6.getFilterRules) === null || _actionRef$current6$g === void 0 ? void 0 : _actionRef$current6$g.call(_actionRef$current6)) !== null && _actionRef$current$ge !== void 0 ? _actionRef$current$ge : {};
858
858
  // 格式化后的请求参数
859
859
  var requestData = {};
860
- var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread((_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3), dataFilterParams), propsParams), sortParams), columnsFilterParams)), params);
860
+ var preParams = _objectSpread(_objectSpread({}, !showPagination ? _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams) : _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, dataFilterParams), propsParams), sortParams), columnsFilterParams), {}, (_objectSpread3 = {}, _defineProperty(_objectSpread3, targetPageKey, currentPage), _defineProperty(_objectSpread3, targetPageSizeKey, pageSize), _objectSpread3))), params);
861
861
  if (typeof formatParams === 'string') {
862
862
  requestData = (0, _utils.getTargetValue)(formatParams, {
863
863
  params: preParams
@@ -970,7 +970,7 @@ var ProTable = function ProTable(props) {
970
970
  return true;
971
971
  } : undefined,
972
972
  onFilter: function onFilter(values) {
973
- var _actionRef$current7, _actionRef$current7$c;
973
+ var _actionRef$current7, _actionRef$current7$c, _request8;
974
974
  // 全屏状态,判断全屏表单onFilter是否禁用
975
975
  if (fullscreenState && !filterEnableRef.current.fullscreen) {
976
976
  filterEnableRef.current.fullscreen = true;
@@ -991,17 +991,17 @@ var ProTable = function ProTable(props) {
991
991
  // 搜索变化时,暂时先清空选择
992
992
  (_actionRef$current7 = actionRef.current) === null || _actionRef$current7 === void 0 ? void 0 : (_actionRef$current7$c = _actionRef$current7.clearRowSelection) === null || _actionRef$current7$c === void 0 ? void 0 : _actionRef$current7$c.call(_actionRef$current7);
993
993
  setCurrentPage(1);
994
- _request(_defineProperty({}, targetPageKey, 1), false, values);
994
+ _request((_request8 = {}, _defineProperty(_request8, targetPageKey, 1), _defineProperty(_request8, targetPageSizeKey, pageSize), _request8), false, values);
995
995
  },
996
996
  onReset: function onReset(values) {
997
- var _dataFilterFormRef$cu3;
997
+ var _dataFilterFormRef$cu3, _request9;
998
998
  (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset) && (propsDataFilter === null || propsDataFilter === void 0 ? void 0 : propsDataFilter.onReset());
999
999
  (_dataFilterFormRef$cu3 = dataFilterFormRef.current) === null || _dataFilterFormRef$cu3 === void 0 ? void 0 : _dataFilterFormRef$cu3.reset();
1000
1000
  setCurrentPage(1);
1001
- _request(_defineProperty({}, targetPageKey, 1), false, values);
1001
+ _request((_request9 = {}, _defineProperty(_request9, targetPageKey, 1), _defineProperty(_request9, targetPageSizeKey, pageSize), _request9), false, values);
1002
1002
  }
1003
1003
  });
1004
- }, [propsDataFilter, fullscreenState, filterEnableRef, actionRef]);
1004
+ }, [propsDataFilter, fullscreenState, filterEnableRef, actionRef, pageSize]);
1005
1005
  var isLoading = (0, _react.useMemo)(function () {
1006
1006
  if (!customRequest) {
1007
1007
  return showLoading && !showSkeleton && (getData.loading || props.loading);
@@ -24,6 +24,8 @@ declare type TDataService = {
24
24
  };
25
25
  export declare type responsivePaginationType = 'mini' | 'small' | 'simple' | 'normal';
26
26
  export declare type ProTableColumnProps = {
27
+ /** 是否强制刷新 */
28
+ forcedUpdate?: boolean;
27
29
  /** 是否开启了自动计算宽度 */
28
30
  isAutoWidth?: boolean;
29
31
  /** 自动计算宽度时的被挤占的情况 */
@@ -71,7 +71,6 @@ function genAutoWidthColumns(columns, ref, data, size, useRowSelection, actionCo
71
71
  finalColumns.push(column);
72
72
  return;
73
73
  }
74
- ;
75
74
  if ((column === null || column === void 0 ? void 0 : column.columnFilters) === false) {
76
75
  finalColumns.push(column);
77
76
  return;
@@ -110,7 +109,8 @@ function genAutoWidthColumns(columns, ref, data, size, useRowSelection, actionCo
110
109
  return;
111
110
  }
112
111
  // @ts-ignore
113
- var titleWidth = _utils._.get(childNodes, '[index]?.children[0].scrollWidth', 0);
112
+ var titleWidth = _utils._.get(childNodes[index], "children[0].scrollWidth", 0);
113
+ // const titleWidth = childNodes[index]?.children[0].scrollWidth
114
114
  // @ts-ignore
115
115
  if (fixedWidthTypeList[finalType]) {
116
116
  // console.log(
@@ -9,5 +9,5 @@ declare type FixedColumnProps = ColumnProps & {
9
9
  */
10
10
  export default function genProColumnToColumn(columns: ProTableColumnProps[],
11
11
  /** 是否渲染骨架屏 */
12
- showSkeleton: boolean, actionRef: React.MutableRefObject<ProTableActionType | undefined>, context?: any, dataTeamixSpm?: string, bindUrl?: ProTableProps['bindUrl'], bindUrlProps?: ProTableProps['bindUrlProps'], forcedUpdate?: boolean): FixedColumnProps[];
12
+ showSkeleton: boolean, actionRef: React.MutableRefObject<ProTableActionType | undefined>, context?: any, dataTeamixSpm?: string, bindUrl?: ProTableProps['bindUrl'], bindUrlProps?: ProTableProps['bindUrlProps']): FixedColumnProps[];
13
13
  export {};
@@ -28,9 +28,6 @@ showSkeleton, actionRef) {
28
28
  dataTeamixSpm = arguments.length > 4 ? arguments[4] : undefined;
29
29
  var bindUrl = arguments.length > 5 ? arguments[5] : undefined;
30
30
  var bindUrlProps = arguments.length > 6 ? arguments[6] : undefined;
31
- var
32
- // 是否强制刷新
33
- forcedUpdate = arguments.length > 7 ? arguments[7] : undefined;
34
31
  return columns.map(function (columnProps) {
35
32
  var filters = columnProps.filters,
36
33
  dataIndex = columnProps.dataIndex,
@@ -79,8 +76,7 @@ showSkeleton, actionRef) {
79
76
  record: record,
80
77
  actionRef: actionRef,
81
78
  context: context,
82
- dataTeamixSpm: dataTeamixSpm,
83
- forcedUpdate: forcedUpdate
79
+ dataTeamixSpm: dataTeamixSpm
84
80
  });
85
81
  // return renderCell(
86
82
  // value,
@@ -1,3 +1,26 @@
1
- import { rowSelectionType, innerRowSelectionType } from '../typing';
2
- declare function useTableSelection(config?: rowSelectionType, primaryKey?: string): innerRowSelectionType;
1
+ import { innerRowSelectionType } from '../typing';
2
+ declare function useTableSelection(config: ({
3
+ getProps?: ((record: any, index: number) => any) | undefined;
4
+ onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
5
+ onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
6
+ onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
7
+ selectedRowKeys?: any[] | undefined;
8
+ selectedRecords?: any[] | undefined;
9
+ mode?: "multiple" | "single" | undefined;
10
+ titleProps?: (() => any) | undefined;
11
+ columnProps?: (() => any) | undefined;
12
+ titleAddons?: (() => any) | undefined;
13
+ defaultSelectedRowKeys?: any[] | undefined;
14
+ defaultSelectedRecords?: any[] | undefined;
15
+ } & {
16
+ getProps?: ((record: any, index: number) => void) | undefined;
17
+ onChange?: ((selectedRowKeys: any[], records: any[]) => void) | undefined;
18
+ onSelect?: ((selected: boolean, record: any, records: any[]) => void) | undefined;
19
+ onSelectAll?: ((selected: boolean, records: any[]) => void) | undefined;
20
+ selectedRowKeys?: any[] | undefined;
21
+ mode?: "multiple" | "single" | undefined;
22
+ titleProps?: (() => any) | undefined;
23
+ columnProps?: (() => any) | undefined;
24
+ titleAddons?: (() => any) | undefined;
25
+ }) | undefined, records: any, primaryKey?: string): innerRowSelectionType;
3
26
  export default useTableSelection;
@@ -8,7 +8,7 @@ exports.default = void 0;
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
  var _utils = require("@teamix/utils");
10
10
  var _components = require("@alicloudfe/components");
11
- var _excluded = ["primaryKey"];
11
+ var _excluded = ["primaryKey", "_primaryKey"];
12
12
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
13
13
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
14
14
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
@@ -29,7 +29,8 @@ function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
29
29
  var Tooltip = _components.Balloon.Tooltip;
30
30
  function useTableSelection() {
31
31
  var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
32
- var primaryKey = arguments.length > 1 ? arguments[1] : undefined;
32
+ var records = arguments.length > 1 ? arguments[1] : undefined;
33
+ var primaryKey = arguments.length > 2 ? arguments[2] : undefined;
33
34
  var _config$defaultSelect = config.defaultSelectedRecords,
34
35
  defaultSelectedRecords = _config$defaultSelect === void 0 ? [] : _config$defaultSelect,
35
36
  _config$defaultSelect2 = config.defaultSelectedRowKeys,
@@ -77,18 +78,21 @@ function useTableSelection() {
77
78
  config.onChange(value, records);
78
79
  }
79
80
  }
80
- var renderCheckBox = function renderCheckBox(props) {
81
+ var renderCheckBox = function renderCheckBox(props, record) {
81
82
  var primaryKey = props.primaryKey,
83
+ _primaryKey = props._primaryKey,
82
84
  others = _objectWithoutProperties(props, _excluded);
83
85
  return /*#__PURE__*/_react.default.createElement(_components.Checkbox, _objectSpread({
84
86
  checked: selectedRowKeys.includes(primaryKey),
85
87
  onChange: function onChange(checked) {
88
+ var _config$onSelect;
89
+ config === null || config === void 0 ? void 0 : (_config$onSelect = config.onSelect) === null || _config$onSelect === void 0 ? void 0 : _config$onSelect.call(config, checked, record, records);
86
90
  if (checked) {
87
- _onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [props]);
91
+ _onChange === null || _onChange === void 0 ? void 0 : _onChange([].concat(_toConsumableArray(selectedRowKeys), [primaryKey]), [record]);
88
92
  } else {
89
93
  _onChange === null || _onChange === void 0 ? void 0 : _onChange(selectedRowKeys.filter(function (item) {
90
94
  return item !== primaryKey;
91
- }), [props]);
95
+ }), [record]);
92
96
  }
93
97
  }
94
98
  }, others));
@@ -99,6 +103,9 @@ function useTableSelection() {
99
103
  // console.log('propResult', propResult, selectedRowKeys);
100
104
  var resultProps = _objectSpread(_objectSpread({}, record), propResult);
101
105
  var primaryKey = record === null || record === void 0 ? void 0 : record[resultProps === null || resultProps === void 0 ? void 0 : resultProps['_primaryKey']];
106
+ if ((config === null || config === void 0 ? void 0 : config.mode) === 'single') {
107
+ return resultProps;
108
+ }
102
109
  return _objectSpread(_objectSpread({}, resultProps), {}, {
103
110
  isPreview: true,
104
111
  renderPreview: function renderPreview() {
@@ -106,13 +113,13 @@ function useTableSelection() {
106
113
  return /*#__PURE__*/_react.default.createElement(Tooltip, {
107
114
  trigger: renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
108
115
  primaryKey: primaryKey
109
- })),
116
+ }), record),
110
117
  align: "t"
111
118
  }, propResult.disabledTooltip);
112
119
  }
113
120
  return renderCheckBox(_objectSpread(_objectSpread({}, propResult), {}, {
114
121
  primaryKey: primaryKey
115
- }));
122
+ }), record);
116
123
  }
117
124
  });
118
125
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teamix/pro",
3
- "version": "1.5.35",
3
+ "version": "1.5.37",
4
4
  "description": "TeamixPro大包",
5
5
  "keywords": [
6
6
  "aliyun",