@zat-design/sisyphus-react 3.4.10-beta.6 → 3.4.10-beta.8
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.css +4 -0
- package/dist/less.esm.css +4 -0
- package/es/ProEditTable/components/DndWrapper/index.d.ts +1 -1
- package/es/ProEditTable/components/DndWrapper/index.js +4 -4
- package/es/ProEditTable/index.js +5 -5
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/Group/style/index.less +1 -1
- package/es/ProForm/components/combination/Group/utils.d.ts +1 -1
- package/es/ProForm/components/combination/Group/utils.js +21 -3
- package/es/ProForm/utils/useDeepCompareMemo.d.ts +1 -1
- package/es/ProForm/utils/useDeepCompareMemo.js +2 -1
- package/es/ProTree/components/ProTreeSelect/index.js +2 -2
- package/lib/ProEditTable/components/DndWrapper/index.d.ts +1 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +4 -4
- package/lib/ProEditTable/index.js +5 -5
- package/lib/ProForm/components/combination/Group/index.js +1 -1
- package/lib/ProForm/components/combination/Group/style/index.less +1 -1
- package/lib/ProForm/components/combination/Group/utils.d.ts +1 -1
- package/lib/ProForm/components/combination/Group/utils.js +22 -4
- package/lib/ProForm/utils/useDeepCompareMemo.d.ts +1 -1
- package/lib/ProForm/utils/useDeepCompareMemo.js +2 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +2 -2
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -2437,6 +2437,10 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2437
2437
|
}
|
|
2438
2438
|
.pro-group {
|
|
2439
2439
|
width: unset !important;
|
|
2440
|
+
display: -webkit-box;
|
|
2441
|
+
display: -webkit-flex;
|
|
2442
|
+
display: -ms-flexbox;
|
|
2443
|
+
display: flex;
|
|
2440
2444
|
}
|
|
2441
2445
|
.pro-group.pro-group-diy-width .ant-space .ant-space-item,
|
|
2442
2446
|
.pro-group.pro-group-width-auto .ant-space .ant-space-item {
|
package/dist/less.esm.css
CHANGED
|
@@ -2437,6 +2437,10 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2437
2437
|
}
|
|
2438
2438
|
.pro-group {
|
|
2439
2439
|
width: unset !important;
|
|
2440
|
+
display: -webkit-box;
|
|
2441
|
+
display: -webkit-flex;
|
|
2442
|
+
display: -ms-flexbox;
|
|
2443
|
+
display: flex;
|
|
2440
2444
|
}
|
|
2441
2445
|
.pro-group.pro-group-diy-width .ant-space .ant-space-item,
|
|
2442
2446
|
.pro-group.pro-group-width-auto .ant-space .ant-space-item {
|
|
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
3
3
|
'data-row-key': string;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
-
|
|
5
|
+
isHideCheckBox?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const Row: FC<RowProps>;
|
|
8
8
|
declare const DndWrapper: ({ draggable, value, onChange, disabled, children }: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["disabled", "
|
|
3
|
+
var _excluded = ["disabled", "isHideCheckBox", "children"];
|
|
4
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
5
|
import React from 'react';
|
|
6
6
|
import { DndContext } from '@dnd-kit/core';
|
|
@@ -9,7 +9,7 @@ import { CSS } from '@dnd-kit/utilities';
|
|
|
9
9
|
import ProIcon from '../../../ProIcon';
|
|
10
10
|
export var Row = function Row(props) {
|
|
11
11
|
var disabled = props.disabled,
|
|
12
|
-
|
|
12
|
+
isHideCheckBox = props.isHideCheckBox,
|
|
13
13
|
children = props.children,
|
|
14
14
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
15
15
|
var data = useSortable({
|
|
@@ -43,7 +43,7 @@ export var Row = function Row(props) {
|
|
|
43
43
|
renderIndex = _ref.renderIndex;
|
|
44
44
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
45
45
|
children: _jsxs("span", {
|
|
46
|
-
className: "drag-wrapper".concat(
|
|
46
|
+
className: "drag-wrapper".concat(isHideCheckBox ? ' no-check' : ''),
|
|
47
47
|
children: [_jsx(ProIcon, _objectSpread({
|
|
48
48
|
className: "drag-icon",
|
|
49
49
|
style: {
|
|
@@ -52,7 +52,7 @@ export var Row = function Row(props) {
|
|
|
52
52
|
},
|
|
53
53
|
type: "drag",
|
|
54
54
|
size: 20
|
|
55
|
-
}, listeners)),
|
|
55
|
+
}, listeners)), isHideCheckBox ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
56
56
|
})
|
|
57
57
|
});
|
|
58
58
|
}
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -188,8 +188,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
188
188
|
return (addBtnConfig === null || addBtnConfig === void 0 ? void 0 : addBtnConfig.show) === false;
|
|
189
189
|
}
|
|
190
190
|
}, [toolbarProps]);
|
|
191
|
-
//
|
|
192
|
-
var
|
|
191
|
+
// 是否隐藏勾选框
|
|
192
|
+
var isHideCheckBox = isForbiddenBtn('mulDelete');
|
|
193
193
|
// 复选框
|
|
194
194
|
var _rowSelection = _objectSpread({
|
|
195
195
|
fixed: true,
|
|
@@ -209,7 +209,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
209
209
|
}
|
|
210
210
|
return {};
|
|
211
211
|
},
|
|
212
|
-
hideSelectAll:
|
|
212
|
+
hideSelectAll: isHideCheckBox
|
|
213
213
|
}, rowSelection);
|
|
214
214
|
// 分页变更
|
|
215
215
|
var handlePageChange = useCallback(function (current, pageSize) {
|
|
@@ -246,7 +246,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
246
246
|
* @returns rowSelection
|
|
247
247
|
*/
|
|
248
248
|
var renderRowSelection = function renderRowSelection() {
|
|
249
|
-
if (disabled || isView) {
|
|
249
|
+
if (disabled || isView || isHideCheckBox) {
|
|
250
250
|
return null;
|
|
251
251
|
}
|
|
252
252
|
return _rowSelection;
|
|
@@ -330,7 +330,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
330
330
|
onRow: function onRow() {
|
|
331
331
|
return {
|
|
332
332
|
disabled: disabled || virtualKey && !!editingKeys.length,
|
|
333
|
-
|
|
333
|
+
isHideCheckBox: isHideCheckBox,
|
|
334
334
|
onClick: function onClick() {}
|
|
335
335
|
};
|
|
336
336
|
}
|
|
@@ -7,7 +7,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import { omit } from 'lodash';
|
|
9
9
|
import classnames from 'classnames';
|
|
10
|
-
import { insertSeparator,
|
|
10
|
+
import { insertSeparator, useTransformColumns } from './utils';
|
|
11
11
|
import ProForm from '../../../../ProForm';
|
|
12
12
|
import ComRender from './component/ComRender';
|
|
13
13
|
/**
|
|
@@ -41,7 +41,7 @@ var Group = function Group(props) {
|
|
|
41
41
|
_option.current[index] = option;
|
|
42
42
|
onChange(_value, _option.current);
|
|
43
43
|
};
|
|
44
|
-
var columnsProps =
|
|
44
|
+
var columnsProps = useTransformColumns({
|
|
45
45
|
columns: children,
|
|
46
46
|
name: name,
|
|
47
47
|
names: names,
|
|
@@ -59,5 +59,5 @@ interface ColumnsTransformerParams {
|
|
|
59
59
|
groupProps: GroupProps;
|
|
60
60
|
}
|
|
61
61
|
/** 转换columns */
|
|
62
|
-
export declare const
|
|
62
|
+
export declare const useTransformColumns: (params: ColumnsTransformerParams) => any[];
|
|
63
63
|
export {};
|
|
@@ -4,6 +4,7 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
|
4
4
|
import "antd/es/button/style";
|
|
5
5
|
import _Button from "antd/es/button";
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { useRef } from 'react';
|
|
7
8
|
import { isFunction } from 'lodash';
|
|
8
9
|
import valueTypeMap from '../../../utils/valueType';
|
|
9
10
|
import { useDeepCompareMemo } from '../../../utils/useDeepCompareMemo';
|
|
@@ -153,7 +154,7 @@ var valueFromEventWrapper = function valueFromEventWrapper(column, args) {
|
|
|
153
154
|
return getValueMiddleware(newValue, list);
|
|
154
155
|
};
|
|
155
156
|
/** 转换columns */
|
|
156
|
-
export var
|
|
157
|
+
export var useTransformColumns = function useTransformColumns(params) {
|
|
157
158
|
var form = params.form,
|
|
158
159
|
columns = params.columns,
|
|
159
160
|
name = params.name,
|
|
@@ -163,6 +164,7 @@ export var transformColumns = function transformColumns(params) {
|
|
|
163
164
|
value = params.value,
|
|
164
165
|
internalChange = params.onChange,
|
|
165
166
|
groupProps = params.groupProps;
|
|
167
|
+
var timerRef = useRef([]);
|
|
166
168
|
return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
|
|
167
169
|
var type = column.type,
|
|
168
170
|
valueType = column.valueType,
|
|
@@ -172,7 +174,8 @@ export var transformColumns = function transformColumns(params) {
|
|
|
172
174
|
normalize = column.normalize,
|
|
173
175
|
disabled = column.disabled,
|
|
174
176
|
show = column.show,
|
|
175
|
-
component = column.component
|
|
177
|
+
component = column.component,
|
|
178
|
+
clearNotShow = column.clearNotShow;
|
|
176
179
|
var _ref = fieldProps || {},
|
|
177
180
|
mode = _ref.mode,
|
|
178
181
|
onChange = _ref.onChange,
|
|
@@ -180,7 +183,22 @@ export var transformColumns = function transformColumns(params) {
|
|
|
180
183
|
comDisabled = _ref.disabled;
|
|
181
184
|
var _disabled = disabled || comDisabled;
|
|
182
185
|
var columnName = names ? names[index] : [].concat(name, index);
|
|
186
|
+
// 响应式字段改变后的回调
|
|
187
|
+
var changedCallback = function changedCallback(lastDependency, current) {
|
|
188
|
+
// 清值防抖 多次刷新时以最后一次为准
|
|
189
|
+
if (clearNotShow !== false && names) {
|
|
190
|
+
if ((current === null || current === void 0 ? void 0 : current.show) === false) {
|
|
191
|
+
clearInterval(timerRef.current[index]);
|
|
192
|
+
timerRef.current[index] = setTimeout(function () {
|
|
193
|
+
form.resetFields([columnName]);
|
|
194
|
+
}, 200);
|
|
195
|
+
} else {
|
|
196
|
+
clearInterval(timerRef.current[index]);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
183
200
|
// 响应式字段
|
|
201
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
184
202
|
var reactiveProps = useDeepCompareMemo(function () {
|
|
185
203
|
return getReactiveProps({
|
|
186
204
|
form: form,
|
|
@@ -193,7 +211,7 @@ export var transformColumns = function transformColumns(params) {
|
|
|
193
211
|
fieldProps: fieldProps,
|
|
194
212
|
name: columnName
|
|
195
213
|
});
|
|
196
|
-
}, [value, show, fieldProps, _disabled, columnName, type]);
|
|
214
|
+
}, changedCallback, [value, show, fieldProps, _disabled, columnName, type]);
|
|
197
215
|
if (reactiveProps.show === false) {
|
|
198
216
|
return [];
|
|
199
217
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** 深度比较依赖变化memo */
|
|
2
|
-
export declare const useDeepCompareMemo: (fun: () => any, depList: any[]) => any;
|
|
2
|
+
export declare const useDeepCompareMemo: (fun: () => any, changedCb: (last: any, current: any) => void, depList: any[]) => any;
|
|
@@ -2,11 +2,12 @@ import { useRef } from 'react';
|
|
|
2
2
|
import { isEqualWith } from 'lodash';
|
|
3
3
|
import { customEqualForFun } from '.';
|
|
4
4
|
/** 深度比较依赖变化memo */
|
|
5
|
-
export var useDeepCompareMemo = function useDeepCompareMemo(fun, depList) {
|
|
5
|
+
export var useDeepCompareMemo = function useDeepCompareMemo(fun, changedCb, depList) {
|
|
6
6
|
var lastDependency = useRef(); // 上一次的依赖
|
|
7
7
|
var lastRes = useRef(); // 上一次的结果
|
|
8
8
|
if (!isEqualWith(depList, lastDependency.current, customEqualForFun)) {
|
|
9
9
|
var res = fun();
|
|
10
|
+
changedCb === null || changedCb === void 0 ? void 0 : changedCb(lastRes.current, res);
|
|
10
11
|
lastRes.current = res;
|
|
11
12
|
}
|
|
12
13
|
lastDependency.current = depList;
|
|
@@ -424,7 +424,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
424
424
|
var nodeChangeEvent = function nodeChangeEvent(e) {
|
|
425
425
|
var el = e.target;
|
|
426
426
|
var classStr = el.className;
|
|
427
|
-
if (classStr && !treeCheckable) {
|
|
427
|
+
if (classStr && !treeCheckable && typeof classStr === 'string') {
|
|
428
428
|
var _classStr$split = classStr.split(' '),
|
|
429
429
|
_classStr$split2 = _slicedToArray(_classStr$split, 1),
|
|
430
430
|
valStr = _classStr$split2[0];
|
|
@@ -474,7 +474,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
474
474
|
onChange: handleChange,
|
|
475
475
|
dropdownStyle: _objectSpread({
|
|
476
476
|
maxHeight: 320,
|
|
477
|
-
|
|
477
|
+
paddingTop: '0px',
|
|
478
478
|
maxWidth: '580px'
|
|
479
479
|
}, dropdownStyle),
|
|
480
480
|
listHeight: listHeight || 320,
|
|
@@ -2,7 +2,7 @@ import React, { FC } from 'react';
|
|
|
2
2
|
interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
3
3
|
'data-row-key': string;
|
|
4
4
|
disabled?: boolean;
|
|
5
|
-
|
|
5
|
+
isHideCheckBox?: boolean;
|
|
6
6
|
}
|
|
7
7
|
export declare const Row: FC<RowProps>;
|
|
8
8
|
declare const DndWrapper: ({ draggable, value, onChange, disabled, children }: {
|
|
@@ -13,10 +13,10 @@ var _core = require("@dnd-kit/core");
|
|
|
13
13
|
var _sortable = require("@dnd-kit/sortable");
|
|
14
14
|
var _utilities = require("@dnd-kit/utilities");
|
|
15
15
|
var _ProIcon = _interopRequireDefault(require("../../../ProIcon"));
|
|
16
|
-
var _excluded = ["disabled", "
|
|
16
|
+
var _excluded = ["disabled", "isHideCheckBox", "children"];
|
|
17
17
|
var Row = exports.Row = function Row(props) {
|
|
18
18
|
var disabled = props.disabled,
|
|
19
|
-
|
|
19
|
+
isHideCheckBox = props.isHideCheckBox,
|
|
20
20
|
children = props.children,
|
|
21
21
|
restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
|
|
22
22
|
var data = (0, _sortable.useSortable)({
|
|
@@ -50,7 +50,7 @@ var Row = exports.Row = function Row(props) {
|
|
|
50
50
|
renderIndex = _ref.renderIndex;
|
|
51
51
|
return /*#__PURE__*/_react.default.cloneElement(child, {
|
|
52
52
|
children: (0, _jsxRuntime.jsxs)("span", {
|
|
53
|
-
className: "drag-wrapper".concat(
|
|
53
|
+
className: "drag-wrapper".concat(isHideCheckBox ? ' no-check' : ''),
|
|
54
54
|
children: [(0, _jsxRuntime.jsx)(_ProIcon.default, (0, _objectSpread2.default)({
|
|
55
55
|
className: "drag-icon",
|
|
56
56
|
style: {
|
|
@@ -59,7 +59,7 @@ var Row = exports.Row = function Row(props) {
|
|
|
59
59
|
},
|
|
60
60
|
type: "drag",
|
|
61
61
|
size: 20
|
|
62
|
-
}, listeners)),
|
|
62
|
+
}, listeners)), isHideCheckBox ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
63
63
|
})
|
|
64
64
|
});
|
|
65
65
|
}
|
|
@@ -191,8 +191,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
191
191
|
return (addBtnConfig === null || addBtnConfig === void 0 ? void 0 : addBtnConfig.show) === false;
|
|
192
192
|
}
|
|
193
193
|
}, [toolbarProps]);
|
|
194
|
-
//
|
|
195
|
-
var
|
|
194
|
+
// 是否隐藏勾选框
|
|
195
|
+
var isHideCheckBox = isForbiddenBtn('mulDelete');
|
|
196
196
|
// 复选框
|
|
197
197
|
var _rowSelection = (0, _objectSpread2.default)({
|
|
198
198
|
fixed: true,
|
|
@@ -212,7 +212,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
212
212
|
}
|
|
213
213
|
return {};
|
|
214
214
|
},
|
|
215
|
-
hideSelectAll:
|
|
215
|
+
hideSelectAll: isHideCheckBox
|
|
216
216
|
}, rowSelection);
|
|
217
217
|
// 分页变更
|
|
218
218
|
var handlePageChange = (0, _react.useCallback)(function (current, pageSize) {
|
|
@@ -249,7 +249,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
249
249
|
* @returns rowSelection
|
|
250
250
|
*/
|
|
251
251
|
var renderRowSelection = function renderRowSelection() {
|
|
252
|
-
if (disabled || isView) {
|
|
252
|
+
if (disabled || isView || isHideCheckBox) {
|
|
253
253
|
return null;
|
|
254
254
|
}
|
|
255
255
|
return _rowSelection;
|
|
@@ -333,7 +333,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
333
333
|
onRow: function onRow() {
|
|
334
334
|
return {
|
|
335
335
|
disabled: disabled || virtualKey && !!editingKeys.length,
|
|
336
|
-
|
|
336
|
+
isHideCheckBox: isHideCheckBox,
|
|
337
337
|
onClick: function onClick() {}
|
|
338
338
|
};
|
|
339
339
|
}
|
|
@@ -47,7 +47,7 @@ var Group = function Group(props) {
|
|
|
47
47
|
_option.current[index] = option;
|
|
48
48
|
onChange(_value, _option.current);
|
|
49
49
|
};
|
|
50
|
-
var columnsProps = (0, _utils.
|
|
50
|
+
var columnsProps = (0, _utils.useTransformColumns)({
|
|
51
51
|
columns: children,
|
|
52
52
|
name: name,
|
|
53
53
|
names: names,
|
|
@@ -59,5 +59,5 @@ interface ColumnsTransformerParams {
|
|
|
59
59
|
groupProps: GroupProps;
|
|
60
60
|
}
|
|
61
61
|
/** 转换columns */
|
|
62
|
-
export declare const
|
|
62
|
+
export declare const useTransformColumns: (params: ColumnsTransformerParams) => any[];
|
|
63
63
|
export {};
|
|
@@ -5,11 +5,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.defaultGetValueFromEvent = defaultGetValueFromEvent;
|
|
8
|
-
exports.
|
|
8
|
+
exports.useTransformColumns = exports.transformNamesString = exports.isUpperCase = exports.insertSeparator = exports.getValueTypeTrans = exports.getValueMiddleware = exports.getReactiveProps = void 0;
|
|
9
9
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
10
10
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
11
11
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
12
12
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
13
|
+
var _react = require("react");
|
|
13
14
|
var _lodash = require("lodash");
|
|
14
15
|
var _antd = require("antd");
|
|
15
16
|
var _valueType = _interopRequireDefault(require("../../../utils/valueType"));
|
|
@@ -160,7 +161,7 @@ var valueFromEventWrapper = function valueFromEventWrapper(column, args) {
|
|
|
160
161
|
return getValueMiddleware(newValue, list);
|
|
161
162
|
};
|
|
162
163
|
/** 转换columns */
|
|
163
|
-
var
|
|
164
|
+
var useTransformColumns = exports.useTransformColumns = function useTransformColumns(params) {
|
|
164
165
|
var form = params.form,
|
|
165
166
|
columns = params.columns,
|
|
166
167
|
name = params.name,
|
|
@@ -170,6 +171,7 @@ var transformColumns = exports.transformColumns = function transformColumns(para
|
|
|
170
171
|
value = params.value,
|
|
171
172
|
internalChange = params.onChange,
|
|
172
173
|
groupProps = params.groupProps;
|
|
174
|
+
var timerRef = (0, _react.useRef)([]);
|
|
173
175
|
return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
|
|
174
176
|
var type = column.type,
|
|
175
177
|
valueType = column.valueType,
|
|
@@ -179,7 +181,8 @@ var transformColumns = exports.transformColumns = function transformColumns(para
|
|
|
179
181
|
normalize = column.normalize,
|
|
180
182
|
disabled = column.disabled,
|
|
181
183
|
show = column.show,
|
|
182
|
-
component = column.component
|
|
184
|
+
component = column.component,
|
|
185
|
+
clearNotShow = column.clearNotShow;
|
|
183
186
|
var _ref = fieldProps || {},
|
|
184
187
|
mode = _ref.mode,
|
|
185
188
|
onChange = _ref.onChange,
|
|
@@ -187,7 +190,22 @@ var transformColumns = exports.transformColumns = function transformColumns(para
|
|
|
187
190
|
comDisabled = _ref.disabled;
|
|
188
191
|
var _disabled = disabled || comDisabled;
|
|
189
192
|
var columnName = names ? names[index] : [].concat(name, index);
|
|
193
|
+
// 响应式字段改变后的回调
|
|
194
|
+
var changedCallback = function changedCallback(lastDependency, current) {
|
|
195
|
+
// 清值防抖 多次刷新时以最后一次为准
|
|
196
|
+
if (clearNotShow !== false && names) {
|
|
197
|
+
if ((current === null || current === void 0 ? void 0 : current.show) === false) {
|
|
198
|
+
clearInterval(timerRef.current[index]);
|
|
199
|
+
timerRef.current[index] = setTimeout(function () {
|
|
200
|
+
form.resetFields([columnName]);
|
|
201
|
+
}, 200);
|
|
202
|
+
} else {
|
|
203
|
+
clearInterval(timerRef.current[index]);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
};
|
|
190
207
|
// 响应式字段
|
|
208
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
191
209
|
var reactiveProps = (0, _useDeepCompareMemo.useDeepCompareMemo)(function () {
|
|
192
210
|
return getReactiveProps({
|
|
193
211
|
form: form,
|
|
@@ -200,7 +218,7 @@ var transformColumns = exports.transformColumns = function transformColumns(para
|
|
|
200
218
|
fieldProps: fieldProps,
|
|
201
219
|
name: columnName
|
|
202
220
|
});
|
|
203
|
-
}, [value, show, fieldProps, _disabled, columnName, type]);
|
|
221
|
+
}, changedCallback, [value, show, fieldProps, _disabled, columnName, type]);
|
|
204
222
|
if (reactiveProps.show === false) {
|
|
205
223
|
return [];
|
|
206
224
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** 深度比较依赖变化memo */
|
|
2
|
-
export declare const useDeepCompareMemo: (fun: () => any, depList: any[]) => any;
|
|
2
|
+
export declare const useDeepCompareMemo: (fun: () => any, changedCb: (last: any, current: any) => void, depList: any[]) => any;
|
|
@@ -8,11 +8,12 @@ var _react = require("react");
|
|
|
8
8
|
var _lodash = require("lodash");
|
|
9
9
|
var _ = require(".");
|
|
10
10
|
/** 深度比较依赖变化memo */
|
|
11
|
-
var useDeepCompareMemo = exports.useDeepCompareMemo = function useDeepCompareMemo(fun, depList) {
|
|
11
|
+
var useDeepCompareMemo = exports.useDeepCompareMemo = function useDeepCompareMemo(fun, changedCb, depList) {
|
|
12
12
|
var lastDependency = (0, _react.useRef)(); // 上一次的依赖
|
|
13
13
|
var lastRes = (0, _react.useRef)(); // 上一次的结果
|
|
14
14
|
if (!(0, _lodash.isEqualWith)(depList, lastDependency.current, _.customEqualForFun)) {
|
|
15
15
|
var res = fun();
|
|
16
|
+
changedCb === null || changedCb === void 0 ? void 0 : changedCb(lastRes.current, res);
|
|
16
17
|
lastRes.current = res;
|
|
17
18
|
}
|
|
18
19
|
lastDependency.current = depList;
|
|
@@ -426,7 +426,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
426
426
|
var nodeChangeEvent = function nodeChangeEvent(e) {
|
|
427
427
|
var el = e.target;
|
|
428
428
|
var classStr = el.className;
|
|
429
|
-
if (classStr && !treeCheckable) {
|
|
429
|
+
if (classStr && !treeCheckable && typeof classStr === 'string') {
|
|
430
430
|
var _classStr$split = classStr.split(' '),
|
|
431
431
|
_classStr$split2 = (0, _slicedToArray2.default)(_classStr$split, 1),
|
|
432
432
|
valStr = _classStr$split2[0];
|
|
@@ -476,7 +476,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
476
476
|
onChange: handleChange,
|
|
477
477
|
dropdownStyle: (0, _objectSpread2.default)({
|
|
478
478
|
maxHeight: 320,
|
|
479
|
-
|
|
479
|
+
paddingTop: '0px',
|
|
480
480
|
maxWidth: '580px'
|
|
481
481
|
}, dropdownStyle),
|
|
482
482
|
listHeight: listHeight || 320,
|