@zat-design/sisyphus-react 3.6.7-beta.3 → 3.6.7-beta.5

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.
@@ -199,7 +199,7 @@ function ProTable(props) {
199
199
  }, [curColumns, handleResize]);
200
200
  var handleColumnConfig = /*#__PURE__*/function () {
201
201
  var _ref5 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(checkList) {
202
- var newColumns, _columnConfig$onColum;
202
+ var newColumns, _columnConfig$onColum, catchColumns;
203
203
  return _regeneratorRuntime().wrap(function _callee$(_context) {
204
204
  while (1) switch (_context.prev = _context.next) {
205
205
  case 0:
@@ -212,14 +212,22 @@ function ProTable(props) {
212
212
  });
213
213
  }
214
214
  if (!isObject(columnConfig)) {
215
- _context.next = 5;
215
+ _context.next = 6;
216
216
  break;
217
217
  }
218
- _context.next = 5;
219
- return columnConfig === null || columnConfig === void 0 ? void 0 : (_columnConfig$onColum = columnConfig.onColumnChange) === null || _columnConfig$onColum === void 0 ? void 0 : _columnConfig$onColum.call(columnConfig, newColumns);
220
- case 5:
221
- setCurColumns(newColumns);
218
+ catchColumns = _defineProperty({}, pathKey, {
219
+ columns: newColumns.map(function (item) {
220
+ return {
221
+ dataIndex: item.dataIndex,
222
+ width: Math.round(Number(item.width))
223
+ };
224
+ })
225
+ });
226
+ _context.next = 6;
227
+ return columnConfig === null || columnConfig === void 0 ? void 0 : (_columnConfig$onColum = columnConfig.onColumnOk) === null || _columnConfig$onColum === void 0 ? void 0 : _columnConfig$onColum.call(columnConfig, catchColumns, newColumns);
222
228
  case 6:
229
+ setCurColumns(newColumns);
230
+ case 7:
223
231
  case "end":
224
232
  return _context.stop();
225
233
  }
@@ -44,7 +44,9 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
44
44
  quickConfig?: boolean;
45
45
  resizeColumn?: boolean;
46
46
  sortRow?: boolean | 'drag' | 'move';
47
- columnConfig?: boolean;
47
+ columnConfig?: boolean | {
48
+ onColumnOk: (columns: ProTableColumn[]) => Promise<void>;
49
+ };
48
50
  cacheTime?: number | boolean;
49
51
  sortColumnText?: string;
50
52
  storage?: 'localStorage' | 'sessionStorage';
@@ -203,7 +203,7 @@ function ProTable(props) {
203
203
  }, [curColumns, handleResize]);
204
204
  var handleColumnConfig = /*#__PURE__*/function () {
205
205
  var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(checkList) {
206
- var newColumns, _columnConfig$onColum;
206
+ var newColumns, _columnConfig$onColum, catchColumns;
207
207
  return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
208
208
  while (1) switch (_context.prev = _context.next) {
209
209
  case 0:
@@ -216,14 +216,22 @@ function ProTable(props) {
216
216
  });
217
217
  }
218
218
  if (!(0, _lodash.isObject)(columnConfig)) {
219
- _context.next = 5;
219
+ _context.next = 6;
220
220
  break;
221
221
  }
222
- _context.next = 5;
223
- return columnConfig === null || columnConfig === void 0 ? void 0 : (_columnConfig$onColum = columnConfig.onColumnChange) === null || _columnConfig$onColum === void 0 ? void 0 : _columnConfig$onColum.call(columnConfig, newColumns);
224
- case 5:
225
- setCurColumns(newColumns);
222
+ catchColumns = (0, _defineProperty2.default)({}, pathKey, {
223
+ columns: newColumns.map(function (item) {
224
+ return {
225
+ dataIndex: item.dataIndex,
226
+ width: Math.round(Number(item.width))
227
+ };
228
+ })
229
+ });
230
+ _context.next = 6;
231
+ return columnConfig === null || columnConfig === void 0 ? void 0 : (_columnConfig$onColum = columnConfig.onColumnOk) === null || _columnConfig$onColum === void 0 ? void 0 : _columnConfig$onColum.call(columnConfig, catchColumns, newColumns);
226
232
  case 6:
233
+ setCurColumns(newColumns);
234
+ case 7:
227
235
  case "end":
228
236
  return _context.stop();
229
237
  }
@@ -44,7 +44,9 @@ export interface ProTableProps<T = any> extends Omit<TableProps<any>, 'summary'
44
44
  quickConfig?: boolean;
45
45
  resizeColumn?: boolean;
46
46
  sortRow?: boolean | 'drag' | 'move';
47
- columnConfig?: boolean;
47
+ columnConfig?: boolean | {
48
+ onColumnOk: (columns: ProTableColumn[]) => Promise<void>;
49
+ };
48
50
  cacheTime?: number | boolean;
49
51
  sortColumnText?: string;
50
52
  storage?: 'localStorage' | 'sessionStorage';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.6.7-beta.3",
3
+ "version": "3.6.7-beta.5",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",