@zat-design/sisyphus-react 3.10.3-beta.4 → 3.10.4-beta.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.
- package/es/ProEditTable/components/RenderField/index.js +2 -2
- package/es/ProEditTable/index.js +0 -2
- package/es/ProEditTable/propsType.d.ts +0 -1
- package/es/ProEditTable/utils/index.js +0 -71
- package/lib/ProEditTable/components/RenderField/index.js +2 -2
- package/lib/ProEditTable/index.js +0 -2
- package/lib/ProEditTable/propsType.d.ts +0 -1
- package/lib/ProEditTable/utils/index.js +0 -71
- package/package.json +3 -3
@@ -588,7 +588,7 @@ var RenderField = function RenderField(_ref) {
|
|
588
588
|
}
|
589
589
|
FormItem = TargetComponent ? _jsx(_Form.Item, _objectSpread(_objectSpread({
|
590
590
|
validateFirst: true
|
591
|
-
}, omit(_formItemProps, ['render', '
|
591
|
+
}, omit(_formItemProps, ['render', 'key', 'width', 'hiddenNames', 'name', 'onCell', _fieldProps.shouldUpdate ? 'shouldUpdate' : null])), {}, {
|
592
592
|
className: _className,
|
593
593
|
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
|
594
594
|
children: FieldComponent
|
@@ -598,7 +598,7 @@ var RenderField = function RenderField(_ref) {
|
|
598
598
|
if (type === 'FormList') {
|
599
599
|
FormItem = _jsx(_Form.List, _objectSpread(_objectSpread({
|
600
600
|
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
|
601
|
-
}, omit(_formItemProps, ['render', '
|
601
|
+
}, omit(_formItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
602
602
|
children: function children(fields, operation, meta) {
|
603
603
|
return _jsx(TargetComponent, _objectSpread(_objectSpread({}, componentProps), {}, {
|
604
604
|
otherProps: otherProps,
|
package/es/ProEditTable/index.js
CHANGED
@@ -112,7 +112,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
112
112
|
selectedRows = state.selectedRows,
|
113
113
|
page = state.page;
|
114
114
|
var virtualRowName = getNamePath(isArray(name) ? name : [name], virtualKey);
|
115
|
-
var cacheMap = useRef({});
|
116
115
|
// 样式处理
|
117
116
|
var _className = classnames({
|
118
117
|
'pro-edit-table': true,
|
@@ -207,7 +206,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
207
206
|
isView: isView,
|
208
207
|
viewEmpty: viewEmpty,
|
209
208
|
disabled: disabled,
|
210
|
-
cacheMap: cacheMap,
|
211
209
|
cellNamePath: cellNamePath,
|
212
210
|
forceUpdate: forceUpdate,
|
213
211
|
insertType: insertType,
|
@@ -98,7 +98,6 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
|
|
98
98
|
labelRequired?: boolean;
|
99
99
|
name?: NamePath;
|
100
100
|
names?: NamePath[];
|
101
|
-
cache?: boolean;
|
102
101
|
isEditable?: boolean | RequiredFn<T>;
|
103
102
|
valueType?: ProFormValueType | ((text?: any, record?: any, options?: OptionsProps) => ProFormValueType);
|
104
103
|
tooltip?: string | ({
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
2
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
3
2
|
import "antd/es/tooltip/style";
|
4
3
|
import _Tooltip from "antd/es/tooltip";
|
@@ -201,13 +200,10 @@ export var transformColumns = function transformColumns() {
|
|
201
200
|
virtualKey = config.virtualKey,
|
202
201
|
requiredAlign = config.requiredAlign,
|
203
202
|
isView = config.isView,
|
204
|
-
cacheMap = config.cacheMap,
|
205
203
|
setState = config.setState,
|
206
204
|
page = config.page;
|
207
205
|
var isCell = mode === 'cell';
|
208
206
|
var _columns = cloneDeepFilterNode(columns);
|
209
|
-
// 你的函数代码
|
210
|
-
var _cacheMap = _objectSpread({}, cacheMap.current);
|
211
207
|
var pageNum = tools.calc(page.pageNum, '-', 1);
|
212
208
|
var firstIndex = tools.calc(pageNum, '*', page.pageSize);
|
213
209
|
_columns.forEach(function (item, index) {
|
@@ -280,26 +276,6 @@ export var transformColumns = function transformColumns() {
|
|
280
276
|
if (item.className) {
|
281
277
|
item.className = _toConsumableArray(new Set(item.className.split(' '))).join(' ');
|
282
278
|
}
|
283
|
-
// 当列表配置cache,接口请求静态数据会做数据缓存
|
284
|
-
if (item.cache) {
|
285
|
-
var _item$fieldProps3;
|
286
|
-
// 初始化加载ProSelect,缓存当前useRequest
|
287
|
-
if (item.type === 'ProSelect') {
|
288
|
-
var _cacheMap$item$dataIn, _cacheMap$item$dataIn2;
|
289
|
-
if (!(_cacheMap === null || _cacheMap === void 0 ? void 0 : (_cacheMap$item$dataIn = _cacheMap[item.dataIndex]) === null || _cacheMap$item$dataIn === void 0 ? void 0 : (_cacheMap$item$dataIn2 = _cacheMap$item$dataIn.dataSource) === null || _cacheMap$item$dataIn2 === void 0 ? void 0 : _cacheMap$item$dataIn2.length)) {
|
290
|
-
var _item$fieldProps, _item$fieldProps2;
|
291
|
-
_cacheMap[item.dataIndex] = {
|
292
|
-
useRequest: (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : _item$fieldProps.useRequest,
|
293
|
-
dataSource: [],
|
294
|
-
transformResponse: (_item$fieldProps2 = item.fieldProps) === null || _item$fieldProps2 === void 0 ? void 0 : _item$fieldProps2.transformResponse
|
295
|
-
};
|
296
|
-
} else {
|
297
|
-
var _cacheMap$item$dataIn3;
|
298
|
-
item.fieldProps.dataSource = (_cacheMap$item$dataIn3 = _cacheMap[item.dataIndex]) === null || _cacheMap$item$dataIn3 === void 0 ? void 0 : _cacheMap$item$dataIn3.dataSource;
|
299
|
-
}
|
300
|
-
}
|
301
|
-
(_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
|
302
|
-
}
|
303
279
|
var _render = function _render(text, record, index) {
|
304
280
|
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
305
281
|
var namePath = isArray(name) ? name : [name];
|
@@ -390,53 +366,6 @@ export var transformColumns = function transformColumns() {
|
|
390
366
|
}));
|
391
367
|
actionColumn && _columns.push(actionColumn);
|
392
368
|
}
|
393
|
-
// cacheMap 用来存储缓存值,若有值后不再请求
|
394
|
-
if (JSON.stringify(cacheMap.current) === '{}') {
|
395
|
-
Promise.all(Object.entries(_cacheMap).map(/*#__PURE__*/function () {
|
396
|
-
var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
|
397
|
-
var _item, key, value, _ref5, service, option;
|
398
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
399
|
-
while (1) switch (_context2.prev = _context2.next) {
|
400
|
-
case 0:
|
401
|
-
_item = _slicedToArray(item, 2), key = _item[0], value = _item[1];
|
402
|
-
_ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
|
403
|
-
if (!service) {
|
404
|
-
_context2.next = 8;
|
405
|
-
break;
|
406
|
-
}
|
407
|
-
_context2.t0 = key;
|
408
|
-
_context2.next = 6;
|
409
|
-
return service(_objectSpread({}, option === null || option === void 0 ? void 0 : option.defaultParams));
|
410
|
-
case 6:
|
411
|
-
_context2.t1 = _context2.sent;
|
412
|
-
return _context2.abrupt("return", [_context2.t0, _context2.t1]);
|
413
|
-
case 8:
|
414
|
-
return _context2.abrupt("return", [key, {}]);
|
415
|
-
case 9:
|
416
|
-
case "end":
|
417
|
-
return _context2.stop();
|
418
|
-
}
|
419
|
-
}, _callee2);
|
420
|
-
}));
|
421
|
-
return function (_x3) {
|
422
|
-
return _ref4.apply(this, arguments);
|
423
|
-
};
|
424
|
-
}())).then(function (res) {
|
425
|
-
res.forEach(function (item) {
|
426
|
-
var _item2 = _slicedToArray(item, 2),
|
427
|
-
key = _item2[0],
|
428
|
-
value = _item2[1];
|
429
|
-
var transformResponse = _cacheMap[key].transformResponse;
|
430
|
-
_cacheMap[key].dataSource = (transformResponse ? transformResponse(value) : value === null || value === void 0 ? void 0 : value.data) || [];
|
431
|
-
});
|
432
|
-
cacheMap.current = _cacheMap;
|
433
|
-
if (JSON.stringify(cacheMap.current) !== '{}') {
|
434
|
-
setState({
|
435
|
-
forceUpdate: {}
|
436
|
-
});
|
437
|
-
}
|
438
|
-
});
|
439
|
-
}
|
440
369
|
// 渲染操作列
|
441
370
|
return _columns;
|
442
371
|
};
|
@@ -595,7 +595,7 @@ var RenderField = function RenderField(_ref) {
|
|
595
595
|
}
|
596
596
|
FormItem = TargetComponent ? (0, _jsxRuntime.jsx)(_antd.Form.Item, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
597
597
|
validateFirst: true
|
598
|
-
}, (0, _lodash.omit)(_formItemProps, ['render', '
|
598
|
+
}, (0, _lodash.omit)(_formItemProps, ['render', 'key', 'width', 'hiddenNames', 'name', 'onCell', _fieldProps.shouldUpdate ? 'shouldUpdate' : null])), {}, {
|
599
599
|
className: _className,
|
600
600
|
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName,
|
601
601
|
children: FieldComponent
|
@@ -605,7 +605,7 @@ var RenderField = function RenderField(_ref) {
|
|
605
605
|
if (type === 'FormList') {
|
606
606
|
FormItem = (0, _jsxRuntime.jsx)(_antd.Form.List, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
607
607
|
name: formNamePath ? cellName.slice((formNamePath === null || formNamePath === void 0 ? void 0 : formNamePath.length) - 1) : cellName
|
608
|
-
}, (0, _lodash.omit)(_formItemProps, ['render', '
|
608
|
+
}, (0, _lodash.omit)(_formItemProps, ['render', 'key', 'width', 'hiddenNames', 'name'])), {}, {
|
609
609
|
children: function children(fields, operation, meta) {
|
610
610
|
return (0, _jsxRuntime.jsx)(TargetComponent, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, componentProps), {}, {
|
611
611
|
otherProps: otherProps,
|
@@ -115,7 +115,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
115
115
|
selectedRows = state.selectedRows,
|
116
116
|
page = state.page;
|
117
117
|
var virtualRowName = (0, _tools.getNamePath)((0, _lodash.isArray)(name) ? name : [name], virtualKey);
|
118
|
-
var cacheMap = (0, _react.useRef)({});
|
119
118
|
// 样式处理
|
120
119
|
var _className = (0, _classnames.default)({
|
121
120
|
'pro-edit-table': true,
|
@@ -210,7 +209,6 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
210
209
|
isView: isView,
|
211
210
|
viewEmpty: viewEmpty,
|
212
211
|
disabled: disabled,
|
213
|
-
cacheMap: cacheMap,
|
214
212
|
cellNamePath: cellNamePath,
|
215
213
|
forceUpdate: forceUpdate,
|
216
214
|
insertType: insertType,
|
@@ -98,7 +98,6 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
|
|
98
98
|
labelRequired?: boolean;
|
99
99
|
name?: NamePath;
|
100
100
|
names?: NamePath[];
|
101
|
-
cache?: boolean;
|
102
101
|
isEditable?: boolean | RequiredFn<T>;
|
103
102
|
valueType?: ProFormValueType | ((text?: any, record?: any, options?: OptionsProps) => ProFormValueType);
|
104
103
|
tooltip?: string | ({
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
6
6
|
});
|
7
7
|
exports.transformColumns = void 0;
|
8
|
-
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
8
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
10
9
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
11
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
@@ -205,13 +204,10 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
205
204
|
virtualKey = config.virtualKey,
|
206
205
|
requiredAlign = config.requiredAlign,
|
207
206
|
isView = config.isView,
|
208
|
-
cacheMap = config.cacheMap,
|
209
207
|
setState = config.setState,
|
210
208
|
page = config.page;
|
211
209
|
var isCell = mode === 'cell';
|
212
210
|
var _columns = (0, _tools.cloneDeepFilterNode)(columns);
|
213
|
-
// 你的函数代码
|
214
|
-
var _cacheMap = (0, _objectSpread2.default)({}, cacheMap.current);
|
215
211
|
var pageNum = _utils.tools.calc(page.pageNum, '-', 1);
|
216
212
|
var firstIndex = _utils.tools.calc(pageNum, '*', page.pageSize);
|
217
213
|
_columns.forEach(function (item, index) {
|
@@ -284,26 +280,6 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
284
280
|
if (item.className) {
|
285
281
|
item.className = (0, _toConsumableArray2.default)(new Set(item.className.split(' '))).join(' ');
|
286
282
|
}
|
287
|
-
// 当列表配置cache,接口请求静态数据会做数据缓存
|
288
|
-
if (item.cache) {
|
289
|
-
var _item$fieldProps3;
|
290
|
-
// 初始化加载ProSelect,缓存当前useRequest
|
291
|
-
if (item.type === 'ProSelect') {
|
292
|
-
var _cacheMap$item$dataIn, _cacheMap$item$dataIn2;
|
293
|
-
if (!(_cacheMap === null || _cacheMap === void 0 ? void 0 : (_cacheMap$item$dataIn = _cacheMap[item.dataIndex]) === null || _cacheMap$item$dataIn === void 0 ? void 0 : (_cacheMap$item$dataIn2 = _cacheMap$item$dataIn.dataSource) === null || _cacheMap$item$dataIn2 === void 0 ? void 0 : _cacheMap$item$dataIn2.length)) {
|
294
|
-
var _item$fieldProps, _item$fieldProps2;
|
295
|
-
_cacheMap[item.dataIndex] = {
|
296
|
-
useRequest: (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : _item$fieldProps.useRequest,
|
297
|
-
dataSource: [],
|
298
|
-
transformResponse: (_item$fieldProps2 = item.fieldProps) === null || _item$fieldProps2 === void 0 ? void 0 : _item$fieldProps2.transformResponse
|
299
|
-
};
|
300
|
-
} else {
|
301
|
-
var _cacheMap$item$dataIn3;
|
302
|
-
item.fieldProps.dataSource = (_cacheMap$item$dataIn3 = _cacheMap[item.dataIndex]) === null || _cacheMap$item$dataIn3 === void 0 ? void 0 : _cacheMap$item$dataIn3.dataSource;
|
303
|
-
}
|
304
|
-
}
|
305
|
-
(_item$fieldProps3 = item.fieldProps) === null || _item$fieldProps3 === void 0 ? true : delete _item$fieldProps3.useRequest;
|
306
|
-
}
|
307
283
|
var _render = function _render(text, record, index) {
|
308
284
|
var isEditing = !virtualKey || editingKeys.includes(record.rowKey) || record.addFlag;
|
309
285
|
var namePath = (0, _lodash.isArray)(name) ? name : [name];
|
@@ -394,53 +370,6 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
394
370
|
}));
|
395
371
|
actionColumn && _columns.push(actionColumn);
|
396
372
|
}
|
397
|
-
// cacheMap 用来存储缓存值,若有值后不再请求
|
398
|
-
if (JSON.stringify(cacheMap.current) === '{}') {
|
399
|
-
Promise.all(Object.entries(_cacheMap).map(/*#__PURE__*/function () {
|
400
|
-
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(item) {
|
401
|
-
var _item, key, value, _ref5, service, option;
|
402
|
-
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
403
|
-
while (1) switch (_context2.prev = _context2.next) {
|
404
|
-
case 0:
|
405
|
-
_item = (0, _slicedToArray2.default)(item, 2), key = _item[0], value = _item[1];
|
406
|
-
_ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
|
407
|
-
if (!service) {
|
408
|
-
_context2.next = 8;
|
409
|
-
break;
|
410
|
-
}
|
411
|
-
_context2.t0 = key;
|
412
|
-
_context2.next = 6;
|
413
|
-
return service((0, _objectSpread2.default)({}, option === null || option === void 0 ? void 0 : option.defaultParams));
|
414
|
-
case 6:
|
415
|
-
_context2.t1 = _context2.sent;
|
416
|
-
return _context2.abrupt("return", [_context2.t0, _context2.t1]);
|
417
|
-
case 8:
|
418
|
-
return _context2.abrupt("return", [key, {}]);
|
419
|
-
case 9:
|
420
|
-
case "end":
|
421
|
-
return _context2.stop();
|
422
|
-
}
|
423
|
-
}, _callee2);
|
424
|
-
}));
|
425
|
-
return function (_x3) {
|
426
|
-
return _ref4.apply(this, arguments);
|
427
|
-
};
|
428
|
-
}())).then(function (res) {
|
429
|
-
res.forEach(function (item) {
|
430
|
-
var _item2 = (0, _slicedToArray2.default)(item, 2),
|
431
|
-
key = _item2[0],
|
432
|
-
value = _item2[1];
|
433
|
-
var transformResponse = _cacheMap[key].transformResponse;
|
434
|
-
_cacheMap[key].dataSource = (transformResponse ? transformResponse(value) : value === null || value === void 0 ? void 0 : value.data) || [];
|
435
|
-
});
|
436
|
-
cacheMap.current = _cacheMap;
|
437
|
-
if (JSON.stringify(cacheMap.current) !== '{}') {
|
438
|
-
setState({
|
439
|
-
forceUpdate: {}
|
440
|
-
});
|
441
|
-
}
|
442
|
-
});
|
443
|
-
}
|
444
373
|
// 渲染操作列
|
445
374
|
return _columns;
|
446
375
|
};
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
3
|
-
"version": "3.10.
|
3
|
+
"version": "3.10.4-beta.1",
|
4
4
|
"license": "Apache-2.0",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"module": "es/index.js",
|
@@ -61,8 +61,8 @@
|
|
61
61
|
"@dnd-kit/utilities": "^3.2.1",
|
62
62
|
"@pansy/react-watermark": "^3.1.13",
|
63
63
|
"@zat-design/utils": "1.1.37",
|
64
|
-
"ahooks": "3.
|
65
|
-
"antd": "4.24.
|
64
|
+
"ahooks": "3.8.4",
|
65
|
+
"antd": "4.24.12",
|
66
66
|
"big.js": "^6.2.1",
|
67
67
|
"classnames": "^2.3.1",
|
68
68
|
"lodash": "^4.17.21",
|