@zat-design/sisyphus-react 3.5.5-beta.11 → 3.5.5-beta.13
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/index.js
CHANGED
|
@@ -15,7 +15,7 @@ var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type",
|
|
|
15
15
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
17
17
|
import { get, isArray, isBoolean } from 'lodash';
|
|
18
|
-
import { useLocalStorageState, useSetState } from 'ahooks';
|
|
18
|
+
import { useDeepCompareEffect, useLocalStorageState, useSetState } from 'ahooks';
|
|
19
19
|
import classnames from 'classnames';
|
|
20
20
|
import { transformColumns } from './utils';
|
|
21
21
|
import { getRandom, getNamePath } from './utils/tools';
|
|
@@ -76,6 +76,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
76
76
|
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled; // formFieldProps?.disabled可能是函数??
|
|
77
77
|
}
|
|
78
78
|
var tableRef = useRef(null);
|
|
79
|
+
var valueChangeRef = useRef(null);
|
|
80
|
+
valueChangeRef.current = 0;
|
|
79
81
|
var _React$useContext = React.useContext(_ConfigProvider.ConfigContext),
|
|
80
82
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
81
83
|
var prefixCls = getPrefixCls();
|
|
@@ -266,24 +268,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
266
268
|
}
|
|
267
269
|
return null;
|
|
268
270
|
};
|
|
271
|
+
useDeepCompareEffect(function () {
|
|
272
|
+
valueChangeRef.current += 1;
|
|
273
|
+
// 在这里根据需要计算新的数组
|
|
274
|
+
}, [value, config.name]);
|
|
269
275
|
var _columns = useMemo(function () {
|
|
270
276
|
return transformColumns(columns, config);
|
|
271
|
-
}, [
|
|
272
|
-
// const setColumns = async () => {
|
|
273
|
-
// const nextColumns = transformColumns(columns, config);
|
|
274
|
-
// setState({
|
|
275
|
-
// _columns: nextColumns,
|
|
276
|
-
// });
|
|
277
|
-
// };
|
|
278
|
-
// useDebounceEffect(
|
|
279
|
-
// () => {
|
|
280
|
-
// setColumns();
|
|
281
|
-
// },
|
|
282
|
-
// [value, cellNamePath, forceUpdate, editingKeys, disabled, actionProps, columns, page], // columns更新修复外部表单无法控制内部表单的问题
|
|
283
|
-
// {
|
|
284
|
-
// wait: 60,
|
|
285
|
-
// },
|
|
286
|
-
// );
|
|
277
|
+
}, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
|
|
287
278
|
useEffect(function () {
|
|
288
279
|
var isAllHasKey = value.every(function (item) {
|
|
289
280
|
return item.rowKey;
|
|
@@ -203,6 +203,7 @@ export var transformColumns = function transformColumns() {
|
|
|
203
203
|
cacheMap = config.cacheMap,
|
|
204
204
|
setState = config.setState,
|
|
205
205
|
page = config.page;
|
|
206
|
+
console.log(123);
|
|
206
207
|
var isCell = mode === 'cell';
|
|
207
208
|
var _columns = _toConsumableArray(columns);
|
|
208
209
|
var _cacheMap = _objectSpread({}, cacheMap.current);
|
|
@@ -256,6 +257,7 @@ export var transformColumns = function transformColumns() {
|
|
|
256
257
|
var columnName = (item === null || item === void 0 ? void 0 : item.name) || dataIndex || key;
|
|
257
258
|
item.dataIndex = columnName;
|
|
258
259
|
item.key = columnName;
|
|
260
|
+
// item.shouldCellUpdate = item.shouldCellUpdate || ((record, perRecord) => !isEqual(record, perRecord));
|
|
259
261
|
var required = isBoolean(item.required) ? item.required : false;
|
|
260
262
|
if (typeof item.required === 'function') {
|
|
261
263
|
var namePath = getNamePath(name, virtualKey);
|
|
@@ -77,6 +77,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
77
77
|
disabled = (formFieldProps === null || formFieldProps === void 0 ? void 0 : formFieldProps.disabled) || disabled; // formFieldProps?.disabled可能是函数??
|
|
78
78
|
}
|
|
79
79
|
var tableRef = (0, _react.useRef)(null);
|
|
80
|
+
var valueChangeRef = (0, _react.useRef)(null);
|
|
81
|
+
valueChangeRef.current = 0;
|
|
80
82
|
var _React$useContext = _react.default.useContext(_antd.ConfigProvider.ConfigContext),
|
|
81
83
|
getPrefixCls = _React$useContext.getPrefixCls;
|
|
82
84
|
var prefixCls = getPrefixCls();
|
|
@@ -267,24 +269,13 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
267
269
|
}
|
|
268
270
|
return null;
|
|
269
271
|
};
|
|
272
|
+
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
273
|
+
valueChangeRef.current += 1;
|
|
274
|
+
// 在这里根据需要计算新的数组
|
|
275
|
+
}, [value, config.name]);
|
|
270
276
|
var _columns = (0, _react.useMemo)(function () {
|
|
271
277
|
return (0, _utils.transformColumns)(columns, config);
|
|
272
|
-
}, [
|
|
273
|
-
// const setColumns = async () => {
|
|
274
|
-
// const nextColumns = transformColumns(columns, config);
|
|
275
|
-
// setState({
|
|
276
|
-
// _columns: nextColumns,
|
|
277
|
-
// });
|
|
278
|
-
// };
|
|
279
|
-
// useDebounceEffect(
|
|
280
|
-
// () => {
|
|
281
|
-
// setColumns();
|
|
282
|
-
// },
|
|
283
|
-
// [value, cellNamePath, forceUpdate, editingKeys, disabled, actionProps, columns, page], // columns更新修复外部表单无法控制内部表单的问题
|
|
284
|
-
// {
|
|
285
|
-
// wait: 60,
|
|
286
|
-
// },
|
|
287
|
-
// );
|
|
278
|
+
}, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
|
|
288
279
|
(0, _react.useEffect)(function () {
|
|
289
280
|
var isAllHasKey = value.every(function (item) {
|
|
290
281
|
return item.rowKey;
|
|
@@ -207,6 +207,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
207
207
|
cacheMap = config.cacheMap,
|
|
208
208
|
setState = config.setState,
|
|
209
209
|
page = config.page;
|
|
210
|
+
console.log(123);
|
|
210
211
|
var isCell = mode === 'cell';
|
|
211
212
|
var _columns = (0, _toConsumableArray2.default)(columns);
|
|
212
213
|
var _cacheMap = (0, _objectSpread2.default)({}, cacheMap.current);
|
|
@@ -260,6 +261,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
260
261
|
var columnName = (item === null || item === void 0 ? void 0 : item.name) || dataIndex || key;
|
|
261
262
|
item.dataIndex = columnName;
|
|
262
263
|
item.key = columnName;
|
|
264
|
+
// item.shouldCellUpdate = item.shouldCellUpdate || ((record, perRecord) => !isEqual(record, perRecord));
|
|
263
265
|
var required = (0, _lodash.isBoolean)(item.required) ? item.required : false;
|
|
264
266
|
if (typeof item.required === 'function') {
|
|
265
267
|
var namePath = (0, _tools.getNamePath)(name, virtualKey);
|