@zat-design/sisyphus-react 3.5.0 → 3.5.1-beta.11
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 +5 -1
- package/dist/less.esm.css +4 -0
- package/es/ProEditTable/components/DndWrapper/index.d.ts +3 -1
- package/es/ProEditTable/components/DndWrapper/index.js +17 -8
- package/es/ProEditTable/index.js +6 -2
- package/es/ProEditTable/propsType.d.ts +3 -0
- package/es/ProEditTable/style/index.less +1 -0
- package/es/ProEditTable/utils/index.js +10 -38
- package/es/ProEditTable/utils/tools.d.ts +3 -0
- package/es/ProEditTable/utils/tools.js +33 -0
- package/es/ProEnum/index.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/es/ProForm/components/combination/Group/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/Group/utils.d.ts +1 -1
- package/es/ProForm/components/combination/Group/utils.js +3 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/combination/ProNumberRange/index.js +5 -5
- package/es/ProForm/components/combination/ProRangeLimit/index.js +4 -3
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProTimeLimit/index.js +16 -8
- package/es/ProForm/components/render/Render.js +1 -1
- package/es/ProForm/components/render/propsType.d.ts +1 -0
- package/es/ProForm/index.js +3 -3
- package/es/ProForm/style/index.less +1 -0
- package/es/ProForm/utils/useForm.d.ts +5 -1
- package/es/ProForm/utils/useForm.js +28 -23
- package/es/ProForm/utils/valueType.d.ts +10 -5
- package/es/ProForm/utils/valueType.js +30 -9
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
- package/es/ProSelect/index.js +1 -1
- package/es/ProSelect/propsType.d.ts +1 -1
- package/es/ProStep/components/Listener/index.d.ts +1 -3
- package/es/ProStep/components/Listener/index.js +7 -3
- package/es/ProStep/index.d.ts +1 -3
- package/es/ProTree/components/ProTreeSelect/index.js +6 -2
- package/es/ProTree/components/Tree.js +10 -9
- package/es/ProTree/style/index.less +6 -3
- package/es/style/theme/antd.less +1 -1
- package/lib/ProEditTable/components/DndWrapper/index.d.ts +3 -1
- package/lib/ProEditTable/components/DndWrapper/index.js +17 -8
- package/lib/ProEditTable/index.js +6 -2
- package/lib/ProEditTable/propsType.d.ts +3 -0
- package/lib/ProEditTable/style/index.less +1 -0
- package/lib/ProEditTable/utils/index.js +9 -37
- package/lib/ProEditTable/utils/tools.d.ts +3 -0
- package/lib/ProEditTable/utils/tools.js +34 -1
- package/lib/ProEnum/index.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/Group/utils.d.ts +1 -1
- package/lib/ProForm/components/combination/Group/utils.js +3 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/lib/ProForm/components/combination/ProNumberRange/index.js +5 -5
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +4 -3
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +16 -8
- package/lib/ProForm/components/render/Render.js +1 -1
- package/lib/ProForm/components/render/propsType.d.ts +1 -0
- package/lib/ProForm/index.js +2 -2
- package/lib/ProForm/style/index.less +1 -0
- package/lib/ProForm/utils/useForm.d.ts +5 -1
- package/lib/ProForm/utils/useForm.js +28 -23
- package/lib/ProForm/utils/valueType.d.ts +10 -5
- package/lib/ProForm/utils/valueType.js +30 -9
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
- package/lib/ProSelect/index.js +1 -1
- package/lib/ProSelect/propsType.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.d.ts +1 -3
- package/lib/ProStep/components/Listener/index.js +7 -3
- package/lib/ProStep/index.d.ts +1 -3
- package/lib/ProTree/components/ProTreeSelect/index.js +6 -2
- package/lib/ProTree/components/Tree.js +10 -9
- package/lib/ProTree/style/index.less +6 -3
- package/lib/style/theme/antd.less +1 -1
- package/package.json +2 -2
package/dist/index.esm.css
CHANGED
|
@@ -2937,6 +2937,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2937
2937
|
}
|
|
2938
2938
|
.pro-form .ant-form-item-label > label {
|
|
2939
2939
|
white-space: pre-wrap;
|
|
2940
|
+
word-break: break-all;
|
|
2940
2941
|
}
|
|
2941
2942
|
.pro-form .suffix-value {
|
|
2942
2943
|
margin-left: calc(var(--zaui-space-size-sm, 8px) * var(--zaui-size, 1));
|
|
@@ -3736,6 +3737,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3736
3737
|
.pro-tree {
|
|
3737
3738
|
height: 100%;
|
|
3738
3739
|
}
|
|
3740
|
+
.pro-tree .ant-tree-iconEle {
|
|
3741
|
+
margin-right: 8px;
|
|
3742
|
+
}
|
|
3739
3743
|
.pro-tree .ant-tree-node-content-wrapper {
|
|
3740
3744
|
display: -webkit-box;
|
|
3741
3745
|
display: -webkit-flex;
|
|
@@ -5312,7 +5316,7 @@ input[type='button'] {
|
|
|
5312
5316
|
.ant-form .ant-form-item .ant-form-item-label > label,
|
|
5313
5317
|
.ant-drawer .ant-form-item .ant-form-item-label > label,
|
|
5314
5318
|
.ant-modal .ant-form-item .ant-form-item-label > label {
|
|
5315
|
-
word-break: break-
|
|
5319
|
+
word-break: break-all;
|
|
5316
5320
|
}
|
|
5317
5321
|
.ant-form .ant-form-item .ant-form-item-label > label::after,
|
|
5318
5322
|
.ant-drawer .ant-form-item .ant-form-item-label > label::after,
|
package/dist/less.esm.css
CHANGED
|
@@ -2937,6 +2937,7 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2937
2937
|
}
|
|
2938
2938
|
.pro-form .ant-form-item-label > label {
|
|
2939
2939
|
white-space: pre-wrap;
|
|
2940
|
+
word-break: break-all;
|
|
2940
2941
|
}
|
|
2941
2942
|
.pro-form .suffix-value {
|
|
2942
2943
|
margin-left: calc(var(--zaui-space-size-sm, 8px) * var(--zaui-size, 1));
|
|
@@ -3736,6 +3737,9 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3736
3737
|
.pro-tree {
|
|
3737
3738
|
height: 100%;
|
|
3738
3739
|
}
|
|
3740
|
+
.pro-tree .ant-tree-iconEle {
|
|
3741
|
+
margin-right: 8px;
|
|
3742
|
+
}
|
|
3739
3743
|
.pro-tree .ant-tree-node-content-wrapper {
|
|
3740
3744
|
display: -webkit-box;
|
|
3741
3745
|
display: -webkit-flex;
|
|
@@ -3,12 +3,14 @@ interface RowProps extends React.HTMLAttributes<HTMLTableRowElement> {
|
|
|
3
3
|
'data-row-key': string;
|
|
4
4
|
'data-hide'?: boolean;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
+
rowDraggable?: any;
|
|
6
7
|
}
|
|
7
8
|
export declare const Row: FC<RowProps>;
|
|
8
|
-
declare const DndWrapper: ({ draggable, value, onChange, disabled, children }: {
|
|
9
|
+
declare const DndWrapper: ({ draggable, value, onChange, onDrag, disabled, children }: {
|
|
9
10
|
draggable: any;
|
|
10
11
|
value: any;
|
|
11
12
|
onChange: any;
|
|
13
|
+
onDrag: any;
|
|
12
14
|
disabled: any;
|
|
13
15
|
children: any;
|
|
14
16
|
}) => any;
|
|
@@ -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", "children"];
|
|
3
|
+
var _excluded = ["disabled", "rowDraggable", "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,6 +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
|
+
rowDraggable = props.rowDraggable,
|
|
12
13
|
children = props.children,
|
|
13
14
|
restProps = _objectWithoutProperties(props, _excluded);
|
|
14
15
|
var data = useSortable({
|
|
@@ -35,16 +36,16 @@ export var Row = function Row(props) {
|
|
|
35
36
|
style: style
|
|
36
37
|
}, attributes), {}, {
|
|
37
38
|
children: React.Children.map(children, function (child) {
|
|
38
|
-
if (child.key === 'RC_TABLE_KEY') {
|
|
39
|
-
console.log('走这里么', child.key);
|
|
39
|
+
if (child.key === 'RC_TABLE_KEY' && !disabled) {
|
|
40
40
|
var _ref = (child === null || child === void 0 ? void 0 : child.props) || {},
|
|
41
41
|
render = _ref.render,
|
|
42
42
|
record = _ref.record,
|
|
43
43
|
renderIndex = _ref.renderIndex;
|
|
44
|
+
var isDrag = rowDraggable ? rowDraggable === null || rowDraggable === void 0 ? void 0 : rowDraggable(record) : true;
|
|
44
45
|
return /*#__PURE__*/React.cloneElement(child, {
|
|
45
46
|
children: _jsxs("span", {
|
|
46
47
|
className: "drag-wrapper".concat(props['data-hide'] ? ' no-check' : ''),
|
|
47
|
-
children: [_jsx(ProIcon, _objectSpread({
|
|
48
|
+
children: [isDrag ? _jsx(ProIcon, _objectSpread({
|
|
48
49
|
className: "drag-icon",
|
|
49
50
|
style: {
|
|
50
51
|
touchAction: 'none',
|
|
@@ -52,7 +53,9 @@ export var Row = function Row(props) {
|
|
|
52
53
|
},
|
|
53
54
|
type: "drag",
|
|
54
55
|
size: 20
|
|
55
|
-
}, listeners))
|
|
56
|
+
}, listeners)) : _jsx(ProIcon, {
|
|
57
|
+
size: 20
|
|
58
|
+
}), props['data-hide'] ? null : render === null || render === void 0 ? void 0 : render(null, record, renderIndex)]
|
|
56
59
|
})
|
|
57
60
|
});
|
|
58
61
|
}
|
|
@@ -65,12 +68,18 @@ var DndWrapper = function DndWrapper(_ref2) {
|
|
|
65
68
|
var draggable = _ref2.draggable,
|
|
66
69
|
value = _ref2.value,
|
|
67
70
|
onChange = _ref2.onChange,
|
|
71
|
+
onDrag = _ref2.onDrag,
|
|
68
72
|
disabled = _ref2.disabled,
|
|
69
73
|
children = _ref2.children;
|
|
70
|
-
var onDragEnd = function onDragEnd(
|
|
71
|
-
var active =
|
|
72
|
-
over =
|
|
74
|
+
var onDragEnd = function onDragEnd(event) {
|
|
75
|
+
var active = event.active,
|
|
76
|
+
over = event.over;
|
|
73
77
|
if (active.id !== (over === null || over === void 0 ? void 0 : over.id)) {
|
|
78
|
+
if (onDrag) {
|
|
79
|
+
var nextList = onDrag(event, value);
|
|
80
|
+
onChange(nextList);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
74
83
|
var activeIndex = value.findIndex(function (i) {
|
|
75
84
|
return i.rowKey === active.id;
|
|
76
85
|
});
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
|
9
9
|
import "antd/es/form/style";
|
|
10
10
|
import _Form from "antd/es/form";
|
|
11
11
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
12
|
-
var _excluded = ["value", "onChange", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "footerRender", "scroll"];
|
|
12
|
+
var _excluded = ["value", "onChange", "onDrag", "className", "columns", "type", "mode", "stripe", "draggable", "disabled", "insertType", "emptyBtnText", "actionWidth", "actionProps", "toolbarProps", "rowSelection", "onlyOneLineMsg", "deletePoConfirmMsg", "mulDeletePoConfirmMsg", "requiredAlign", "summary", "max", "headerRender", "pagination", "originalValues", "originalDiffTip", "rowKey", "rowDisabled", "rowDraggable", "footerRender", "scroll"];
|
|
13
13
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
|
|
15
15
|
import { get, isArray } from 'lodash';
|
|
@@ -25,6 +25,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
25
25
|
var _resetProps$id, _resetProps$id$split, _themeConfig$data2, _value$2;
|
|
26
26
|
var value = _ref.value,
|
|
27
27
|
onChange = _ref.onChange,
|
|
28
|
+
onDrag = _ref.onDrag,
|
|
28
29
|
className = _ref.className,
|
|
29
30
|
columns = _ref.columns,
|
|
30
31
|
type = _ref.type,
|
|
@@ -50,6 +51,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
50
51
|
originalDiffTip = _ref.originalDiffTip,
|
|
51
52
|
rowKey = _ref.rowKey,
|
|
52
53
|
rowDisabled = _ref.rowDisabled,
|
|
54
|
+
rowDraggable = _ref.rowDraggable,
|
|
53
55
|
footerRender = _ref.footerRender,
|
|
54
56
|
scroll = _ref.scroll,
|
|
55
57
|
resetProps = _objectWithoutProperties(_ref, _excluded);
|
|
@@ -317,6 +319,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
317
319
|
children: [_jsxs(DndWrapper, {
|
|
318
320
|
value: value,
|
|
319
321
|
onChange: onChange,
|
|
322
|
+
onDrag: onDrag,
|
|
320
323
|
disabled: disabled,
|
|
321
324
|
draggable: draggable,
|
|
322
325
|
children: [headerRender ? _jsx("div", {
|
|
@@ -338,7 +341,8 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
338
341
|
return {
|
|
339
342
|
disabled: disabled || virtualKey && !!editingKeys.length,
|
|
340
343
|
'data-hide': isHideCheckBox,
|
|
341
|
-
onClick: function onClick() {}
|
|
344
|
+
onClick: function onClick() {},
|
|
345
|
+
rowDraggable: rowDraggable
|
|
342
346
|
};
|
|
343
347
|
}
|
|
344
348
|
}, resetProps), {}, {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { Key, ReactNode } from 'react';
|
|
2
|
+
import { DragEndEvent } from '@dnd-kit/core';
|
|
2
3
|
import type { ButtonProps } from 'antd/es/button';
|
|
3
4
|
import type { TooltipProps } from 'antd/es/tooltip';
|
|
4
5
|
import type { NamePath } from 'antd/es/form/interface';
|
|
@@ -253,5 +254,7 @@ export interface ProEditTableProps<T = any> extends Omit<TableProps<T>, 'onChang
|
|
|
253
254
|
*/
|
|
254
255
|
headerRender?: ReactNode;
|
|
255
256
|
rowDisabled?: (record?: T) => string | boolean;
|
|
257
|
+
rowDraggable?: (record?: T) => string | boolean;
|
|
258
|
+
onDrag?: (event: DragEndEvent, dataSource: T[]) => T[];
|
|
256
259
|
ref?: any;
|
|
257
260
|
}
|
|
@@ -18,7 +18,7 @@ import classnames from 'classnames';
|
|
|
18
18
|
import { ReactSVG } from 'react-svg';
|
|
19
19
|
import { tools } from '@zat-design/utils';
|
|
20
20
|
import { actions, defaultBtnNameMap, defaultSingleActionKeys, defaultMultipleActionKeys, defaultEditingActionKeys } from './config';
|
|
21
|
-
import { customValidate, getNamePath, splitNames } from './tools';
|
|
21
|
+
import { customValidate, getNamePath, splitNames, handleScrollToError } from './tools';
|
|
22
22
|
import ProTooltip from '../../ProTooltip';
|
|
23
23
|
import { RenderField, ActionButton } from '../components';
|
|
24
24
|
import tipSvg from '../../assets/tip.svg';
|
|
@@ -98,35 +98,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
98
98
|
case 8:
|
|
99
99
|
_context.prev = 8;
|
|
100
100
|
_context.t0 = _context["catch"](3);
|
|
101
|
-
|
|
102
|
-
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
103
|
-
if (errorDom) {
|
|
104
|
-
var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
|
|
105
|
-
var tableCell = errorDom.closest('.ant-table-cell');
|
|
106
|
-
if (tableBody && tableCell) {
|
|
107
|
-
var previousSibling = tableCell.previousElementSibling;
|
|
108
|
-
var childOffsetLeft = 0;
|
|
109
|
-
var childFixedLeft = 0;
|
|
110
|
-
while (previousSibling) {
|
|
111
|
-
if (previousSibling.nodeType === 1) {
|
|
112
|
-
var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
|
|
113
|
-
var _ref2 = previousSibling.getBoundingClientRect() || {},
|
|
114
|
-
_ref2$width = _ref2.width,
|
|
115
|
-
width = _ref2$width === void 0 ? 0 : _ref2$width;
|
|
116
|
-
childOffsetLeft += width;
|
|
117
|
-
if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
|
|
118
|
-
childFixedLeft += width;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
previousSibling = previousSibling.previousElementSibling;
|
|
122
|
-
}
|
|
123
|
-
tableBody.scrollTo({
|
|
124
|
-
left: childOffsetLeft - childFixedLeft,
|
|
125
|
-
behavior: 'smooth'
|
|
126
|
-
});
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}, 0);
|
|
101
|
+
handleScrollToError();
|
|
130
102
|
return _context.abrupt("return", Promise.reject(_context.t0));
|
|
131
103
|
case 12:
|
|
132
104
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
|
@@ -254,10 +226,10 @@ export var transformColumns = function transformColumns() {
|
|
|
254
226
|
if (typeof columnTitle === 'string') {
|
|
255
227
|
item.originTitle = columnTitle;
|
|
256
228
|
if (tooltip) {
|
|
257
|
-
var
|
|
258
|
-
tooltipTitle =
|
|
259
|
-
icon =
|
|
260
|
-
resetProps = _objectWithoutProperties(
|
|
229
|
+
var _ref2 = tooltip || {},
|
|
230
|
+
tooltipTitle = _ref2.title,
|
|
231
|
+
icon = _ref2.icon,
|
|
232
|
+
resetProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
261
233
|
item.title = _jsxs("span", {
|
|
262
234
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
|
263
235
|
children: [before, columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
@@ -409,13 +381,13 @@ export var transformColumns = function transformColumns() {
|
|
|
409
381
|
// cacheMap 用来存储缓存值,若有值后不再请求
|
|
410
382
|
if (JSON.stringify(cacheMap.current) === '{}') {
|
|
411
383
|
Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
|
|
412
|
-
var
|
|
413
|
-
var _item, key, value,
|
|
384
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
|
|
385
|
+
var _item, key, value, _ref4, service, option;
|
|
414
386
|
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
415
387
|
while (1) switch (_context2.prev = _context2.next) {
|
|
416
388
|
case 0:
|
|
417
389
|
_item = _slicedToArray(item, 2), key = _item[0], value = _item[1];
|
|
418
|
-
|
|
390
|
+
_ref4 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref4.service, option = _ref4.option;
|
|
419
391
|
if (!service) {
|
|
420
392
|
_context2.next = 8;
|
|
421
393
|
break;
|
|
@@ -435,7 +407,7 @@ export var transformColumns = function transformColumns() {
|
|
|
435
407
|
}, _callee2);
|
|
436
408
|
}));
|
|
437
409
|
return function (_x3) {
|
|
438
|
-
return
|
|
410
|
+
return _ref3.apply(this, arguments);
|
|
439
411
|
};
|
|
440
412
|
}())).then(function (res) {
|
|
441
413
|
res.forEach(function (item) {
|
|
@@ -26,3 +26,6 @@ export declare const onDelete: ({ name, form, virtualKey, selectedRowKeys }: {
|
|
|
26
26
|
* @param rowDisabled 行禁用参数
|
|
27
27
|
*/
|
|
28
28
|
export declare const getDisabled: ({ globalControl, formDisabled, column, tabledDisabled, columnFieldProps, params, rowDisabled }: any) => any;
|
|
29
|
+
/** 表格自动滚动到报错位置
|
|
30
|
+
*/
|
|
31
|
+
export declare const handleScrollToError: () => void;
|
|
@@ -151,4 +151,37 @@ export var getDisabled = function getDisabled(_ref2) {
|
|
|
151
151
|
return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, _toConsumableArray(params)));
|
|
152
152
|
}
|
|
153
153
|
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || convertToBoolean(tabledDisabled);
|
|
154
|
+
};
|
|
155
|
+
/** 表格自动滚动到报错位置
|
|
156
|
+
*/
|
|
157
|
+
export var handleScrollToError = function handleScrollToError() {
|
|
158
|
+
setTimeout(function () {
|
|
159
|
+
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
160
|
+
if (errorDom) {
|
|
161
|
+
var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
|
|
162
|
+
var tableCell = errorDom.closest('.ant-table-cell');
|
|
163
|
+
if (tableBody && tableCell) {
|
|
164
|
+
var previousSibling = tableCell.previousElementSibling;
|
|
165
|
+
var childOffsetLeft = 0;
|
|
166
|
+
var childFixedLeft = 0;
|
|
167
|
+
while (previousSibling) {
|
|
168
|
+
if (previousSibling.nodeType === 1) {
|
|
169
|
+
var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
|
|
170
|
+
var _ref3 = previousSibling.getBoundingClientRect() || {},
|
|
171
|
+
_ref3$width = _ref3.width,
|
|
172
|
+
width = _ref3$width === void 0 ? 0 : _ref3$width;
|
|
173
|
+
childOffsetLeft += width;
|
|
174
|
+
if ((_previousSibling = previousSibling) === null || _previousSibling === void 0 ? void 0 : (_previousSibling$clas = _previousSibling.classList) === null || _previousSibling$clas === void 0 ? void 0 : (_previousSibling$clas2 = (_previousSibling$clas3 = _previousSibling$clas).contains) === null || _previousSibling$clas2 === void 0 ? void 0 : _previousSibling$clas2.call(_previousSibling$clas3, 'ant-table-cell-fix-left')) {
|
|
175
|
+
childFixedLeft += width;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
previousSibling = previousSibling.previousElementSibling;
|
|
179
|
+
}
|
|
180
|
+
tableBody.scrollTo({
|
|
181
|
+
left: childOffsetLeft - childFixedLeft,
|
|
182
|
+
behavior: 'smooth'
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}, 0);
|
|
154
187
|
};
|
package/es/ProEnum/index.js
CHANGED
|
@@ -166,7 +166,7 @@ var ProEnum = function ProEnum(props) {
|
|
|
166
166
|
}
|
|
167
167
|
switch (type) {
|
|
168
168
|
case 'ProSelect':
|
|
169
|
-
return _jsx(ProSelect, _objectSpread(_objectSpread({},
|
|
169
|
+
return _jsx(ProSelect, _objectSpread(_objectSpread({}, enumProps), {}, {
|
|
170
170
|
otherProps: otherProps,
|
|
171
171
|
dataSource: list,
|
|
172
172
|
fieldNames: {
|
|
@@ -122,7 +122,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
122
122
|
var _actionProps = (_props$actionProps = props.actionProps) === null || _props$actionProps === void 0 ? void 0 : _props$actionProps.map(function (item) {
|
|
123
123
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
124
124
|
// @ts-ignore
|
|
125
|
-
type: item.actionType
|
|
125
|
+
type: item.actionType || item.type
|
|
126
126
|
});
|
|
127
127
|
});
|
|
128
128
|
if (!(_actionProps === null || _actionProps === void 0 ? void 0 : _actionProps.find(function (item) {
|
|
@@ -46,7 +46,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
46
46
|
var _toolbarProps = (_props$toolbarProps = props.toolbarProps) === null || _props$toolbarProps === void 0 ? void 0 : _props$toolbarProps.map(function (item) {
|
|
47
47
|
return _objectSpread(_objectSpread({}, item), {}, {
|
|
48
48
|
// @ts-ignore
|
|
49
|
-
type: item.actionType
|
|
49
|
+
type: item.actionType || item.type
|
|
50
50
|
});
|
|
51
51
|
});
|
|
52
52
|
if (!(_toolbarProps === null || _toolbarProps === void 0 ? void 0 : _toolbarProps.find(function (item) {
|
|
@@ -43,6 +43,7 @@ export type GroupColumnProps<Values = any> = {
|
|
|
43
43
|
trim?: boolean;
|
|
44
44
|
upperCase?: boolean;
|
|
45
45
|
toISOString?: boolean;
|
|
46
|
+
toCSTString?: boolean;
|
|
46
47
|
clearNotShow?: boolean;
|
|
47
48
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
|
|
48
49
|
valuePropName?: string;
|
|
@@ -39,7 +39,7 @@ export declare const getReactiveProps: (params: Params) => {
|
|
|
39
39
|
component: any;
|
|
40
40
|
fieldProps: boolean;
|
|
41
41
|
};
|
|
42
|
-
type ValueTypeGetterParams = Pick<ProFormColumnProps, 'valueType' | 'switchValue' | 'toISOString'> & {
|
|
42
|
+
type ValueTypeGetterParams = Pick<ProFormColumnProps, 'valueType' | 'switchValue' | 'toISOString' | 'toCSTString'> & {
|
|
43
43
|
type?: any;
|
|
44
44
|
mode?: string;
|
|
45
45
|
};
|
|
@@ -171,6 +171,7 @@ export var useTransformColumns = function useTransformColumns(params) {
|
|
|
171
171
|
valueType = column.valueType,
|
|
172
172
|
switchValue = column.switchValue,
|
|
173
173
|
toISOString = column.toISOString,
|
|
174
|
+
toCSTString = column.toCSTString,
|
|
174
175
|
fieldProps = column.fieldProps,
|
|
175
176
|
normalize = column.normalize,
|
|
176
177
|
disabled = column.disabled,
|
|
@@ -221,6 +222,7 @@ export var useTransformColumns = function useTransformColumns(params) {
|
|
|
221
222
|
valueType: valueType,
|
|
222
223
|
switchValue: switchValue,
|
|
223
224
|
toISOString: toISOString,
|
|
225
|
+
toCSTString: toCSTString,
|
|
224
226
|
mode: mode
|
|
225
227
|
});
|
|
226
228
|
var newValue;
|
|
@@ -263,6 +265,7 @@ export var useTransformColumns = function useTransformColumns(params) {
|
|
|
263
265
|
name: columnName
|
|
264
266
|
}, reactiveProps), {}, {
|
|
265
267
|
disabled: reactiveProps.disabled || groupProps.disabled,
|
|
268
|
+
getValueProps: transform === null || transform === void 0 ? void 0 : transform.getValueProps,
|
|
266
269
|
fieldProps: _objectSpread(_objectSpread({}, column === null || column === void 0 ? void 0 : column.fieldProps), {}, {
|
|
267
270
|
onChange: handleChange,
|
|
268
271
|
value: value === null || value === void 0 ? void 0 : value[index]
|
|
@@ -655,7 +655,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
655
655
|
selectedRows: []
|
|
656
656
|
});
|
|
657
657
|
}
|
|
658
|
-
if (!labelInValue &&
|
|
658
|
+
if (!labelInValue && !isEqual(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
|
|
659
659
|
setState({
|
|
660
660
|
_value: value,
|
|
661
661
|
selectedRowKeys: [],
|
|
@@ -17,7 +17,7 @@ var formatAmount = tools.formatAmount,
|
|
|
17
17
|
formatPercent = tools.formatPercent,
|
|
18
18
|
formatPerMill = tools.formatPerMill;
|
|
19
19
|
var ProNumberRange = function ProNumberRange(props) {
|
|
20
|
-
var _valueProps, _valueProps2, _valueProps3, _valueProps4;
|
|
20
|
+
var _valueProps, _ref2, _ref3, _value$, _valueProps2, _ref4, _ref5, _value$2, _valueProps3, _valueProps4;
|
|
21
21
|
var _props$value = props.value,
|
|
22
22
|
value = _props$value === void 0 ? [] : _props$value,
|
|
23
23
|
_props$onChange = props.onChange,
|
|
@@ -183,8 +183,8 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
183
183
|
},
|
|
184
184
|
addonBefore: addonBefore
|
|
185
185
|
}, valueProps), {}, {
|
|
186
|
-
min: min
|
|
187
|
-
max: (value === null || value === void 0 ? void 0 : value[1])
|
|
186
|
+
min: min !== null && min !== void 0 ? min : (_valueProps = valueProps) === null || _valueProps === void 0 ? void 0 : _valueProps.min,
|
|
187
|
+
max: (_ref2 = (_ref3 = (_value$ = value === null || value === void 0 ? void 0 : value[1]) !== null && _value$ !== void 0 ? _value$ : range[1]) !== null && _ref3 !== void 0 ? _ref3 : max) !== null && _ref2 !== void 0 ? _ref2 : (_valueProps2 = valueProps) === null || _valueProps2 === void 0 ? void 0 : _valueProps2.max
|
|
188
188
|
}, childProps === null || childProps === void 0 ? void 0 : childProps[0])), _jsx(_Input, {
|
|
189
189
|
className: classnames({
|
|
190
190
|
'range-split': true,
|
|
@@ -203,8 +203,8 @@ var ProNumberRange = function ProNumberRange(props) {
|
|
|
203
203
|
},
|
|
204
204
|
addonAfter: addonAfter
|
|
205
205
|
}, valueProps), {}, {
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
min: (_ref4 = (_ref5 = (_value$2 = value === null || value === void 0 ? void 0 : value[0]) !== null && _value$2 !== void 0 ? _value$2 : range[0]) !== null && _ref5 !== void 0 ? _ref5 : min) !== null && _ref4 !== void 0 ? _ref4 : (_valueProps3 = valueProps) === null || _valueProps3 === void 0 ? void 0 : _valueProps3.min,
|
|
207
|
+
max: max !== null && max !== void 0 ? max : (_valueProps4 = valueProps) === null || _valueProps4 === void 0 ? void 0 : _valueProps4.max
|
|
208
208
|
}, childProps === null || childProps === void 0 ? void 0 : childProps[1]))]
|
|
209
209
|
});
|
|
210
210
|
};
|
|
@@ -78,12 +78,13 @@ var ProRangeLimit = function ProRangeLimit(props) {
|
|
|
78
78
|
'ant-input-disabled': _disabled === null || _disabled === void 0 ? void 0 : _disabled[1],
|
|
79
79
|
'forever-checkbox': true
|
|
80
80
|
});
|
|
81
|
+
var _foreverDate = foreverDate || (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.foreverDate);
|
|
81
82
|
var _isForever = useMemo(function () {
|
|
82
|
-
return moment(
|
|
83
|
+
return moment(_foreverDate, format).isSame(endDate);
|
|
83
84
|
}, [value]);
|
|
84
85
|
var foreverMoment = useMemo(function () {
|
|
85
|
-
return moment(
|
|
86
|
-
}, [
|
|
86
|
+
return moment(_foreverDate, format);
|
|
87
|
+
}, [_foreverDate, format]);
|
|
87
88
|
if (isView) {
|
|
88
89
|
var _props$value3, _props$value4;
|
|
89
90
|
var _separator = (value === null || value === void 0 ? void 0 : value[0]) && (value === null || value === void 0 ? void 0 : value[1]) ? separator : '';
|
|
@@ -9,7 +9,7 @@ export type ProTimeLimitProps = DistributiveOmit<DatePickerProps, 'value' | 'onC
|
|
|
9
9
|
value?: string;
|
|
10
10
|
onChange?: (value: ProTimeLimitProps['value'] | null, valueData: Moment) => void;
|
|
11
11
|
disabled?: boolean;
|
|
12
|
-
|
|
12
|
+
foreverDate?: string;
|
|
13
13
|
foreverText?: string;
|
|
14
14
|
viewEmpty?: React.ReactNode;
|
|
15
15
|
format?: string;
|
|
@@ -7,7 +7,7 @@ import _Input from "antd/es/input";
|
|
|
7
7
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
8
8
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
10
|
-
var _excluded = ["format", "disabled", "
|
|
10
|
+
var _excluded = ["format", "disabled", "foreverDate", "foreverText", "valueType", "otherProps"],
|
|
11
11
|
_excluded2 = ["mode"];
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
import classNames from 'classnames';
|
|
@@ -25,7 +25,8 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
25
25
|
var _props$format = props.format,
|
|
26
26
|
format = _props$format === void 0 ? 'YYYY-MM-DD' : _props$format,
|
|
27
27
|
disabled = props.disabled,
|
|
28
|
-
|
|
28
|
+
_props$foreverDate = props.foreverDate,
|
|
29
|
+
foreverDate = _props$foreverDate === void 0 ? '9999-01-01' : _props$foreverDate,
|
|
29
30
|
_props$foreverText = props.foreverText,
|
|
30
31
|
foreverText = _props$foreverText === void 0 ? locale.ProTimeLimit.foreverText : _props$foreverText,
|
|
31
32
|
_props$valueType = props.valueType,
|
|
@@ -35,12 +36,14 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
35
36
|
var _ref = ProForm.useFieldProps() || {},
|
|
36
37
|
isViewCon = _ref.isView,
|
|
37
38
|
viewEmpty = _ref.viewEmpty;
|
|
39
|
+
var initialConfig = useProConfig('ProTimeLimit');
|
|
38
40
|
var isView = typeof props.isView === 'boolean' ? props.isView : isViewCon; // 组件可直接接收isView参数, 优先级高
|
|
41
|
+
var _foreverDate = foreverDate || (initialConfig === null || initialConfig === void 0 ? void 0 : initialConfig.foreverDate);
|
|
39
42
|
var _useMemo = useMemo(function () {
|
|
40
|
-
var foreverMoment =
|
|
41
|
-
var foreverString =
|
|
43
|
+
var foreverMoment = moment(_foreverDate, format);
|
|
44
|
+
var foreverString = _foreverDate || foreverMoment.format(format);
|
|
42
45
|
return [foreverString, foreverMoment];
|
|
43
|
-
}, [format,
|
|
46
|
+
}, [format, _foreverDate]),
|
|
44
47
|
_useMemo2 = _slicedToArray(_useMemo, 2),
|
|
45
48
|
foreverString = _useMemo2[0],
|
|
46
49
|
foreverMoment = _useMemo2[1];
|
|
@@ -51,7 +54,6 @@ export var ProTimeLimit = function ProTimeLimit(props) {
|
|
|
51
54
|
_useControlled2 = _slicedToArray(_useControlled, 2),
|
|
52
55
|
value = _useControlled2[0],
|
|
53
56
|
onChange = _useControlled2[1];
|
|
54
|
-
var initialConfig = useProConfig('ProTimeLimit');
|
|
55
57
|
var isForever = useMemo(function () {
|
|
56
58
|
if (isObject(value)) {
|
|
57
59
|
return foreverMoment.format(format) === value.format(format);
|
|
@@ -112,9 +114,15 @@ var LimitPick = function LimitPick(props) {
|
|
|
112
114
|
var _props$mode = props.mode,
|
|
113
115
|
mode = _props$mode === void 0 ? 'DatePicker' : _props$mode,
|
|
114
116
|
rest = _objectWithoutProperties(props, _excluded2);
|
|
117
|
+
var _ref2 = useProConfig('ProTimeLimit') || {},
|
|
118
|
+
foreverDate = _ref2.foreverDate;
|
|
115
119
|
if (mode === 'RangePicker') {
|
|
116
|
-
return _jsx(ProRangeLimit, _objectSpread({
|
|
120
|
+
return _jsx(ProRangeLimit, _objectSpread({
|
|
121
|
+
foreverDate: foreverDate
|
|
122
|
+
}, rest));
|
|
117
123
|
}
|
|
118
|
-
return _jsx(ProTimeLimit, _objectSpread({
|
|
124
|
+
return _jsx(ProTimeLimit, _objectSpread({
|
|
125
|
+
foreverDate: foreverDate
|
|
126
|
+
}, rest));
|
|
119
127
|
};
|
|
120
128
|
export default LimitPick;
|
|
@@ -171,7 +171,7 @@ var Render = function Render(props) {
|
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
/** 移除多余参数,防止透传给formItem报错 */
|
|
174
|
-
var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'switchValue', 'precision', 'clearNotShow']);
|
|
174
|
+
var _otherFormItemProps = omit(otherFormItemProps, ['component', 'names', 'format', 'toISOString', 'toCSTString', 'switchValue', 'precision', 'clearNotShow']);
|
|
175
175
|
/**
|
|
176
176
|
* globalControl 全局控制优先
|
|
177
177
|
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
@@ -205,6 +205,7 @@ export interface ProFormColumnProps<Values = any> extends Omit<FormItemProps<Val
|
|
|
205
205
|
required?: boolean | boolean[] | ReactiveFunction<Values, boolean | boolean[]>;
|
|
206
206
|
labelRequired?: boolean;
|
|
207
207
|
toISOString?: boolean;
|
|
208
|
+
toCSTString?: boolean;
|
|
208
209
|
clearNotShow?: boolean;
|
|
209
210
|
index?: number;
|
|
210
211
|
namePath?: NamePath;
|
package/es/ProForm/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import { isObject, isString, merge } from 'lodash';
|
|
|
20
20
|
import { FormFooter, InputRange, ProAddress, ProCascader, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
21
21
|
import RenderFields from './components/render/RenderFields';
|
|
22
22
|
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
23
|
-
import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
|
|
23
|
+
import { getLayout, splitNameStr, useControlled, initialValuesToNames, filterInternalFields } from './utils/index';
|
|
24
24
|
import { useForm } from './utils/useForm';
|
|
25
25
|
import { useFieldProps } from './utils/useFieldProps';
|
|
26
26
|
import locale from '../locale';
|
|
@@ -163,7 +163,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
163
163
|
// 暂时通过'-'区分组合组件字段和普通字段
|
|
164
164
|
var keys = Object.keys(changedValue);
|
|
165
165
|
if (!keys.length) {
|
|
166
|
-
onValuesChange(changedValue, form.getFieldsValue());
|
|
166
|
+
onValuesChange(filterInternalFields(changedValue), form.getFieldsValue());
|
|
167
167
|
} else {
|
|
168
168
|
var values = keys.map(function (key) {
|
|
169
169
|
if (key.includes('-')) {
|
|
@@ -175,7 +175,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
175
175
|
}
|
|
176
176
|
return {};
|
|
177
177
|
});
|
|
178
|
-
onValuesChange(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values))), form.getFieldsValue());
|
|
178
|
+
onValuesChange(filterInternalFields(merge.apply(void 0, [changedValue].concat(_toConsumableArray(values)))), form.getFieldsValue());
|
|
179
179
|
}
|
|
180
180
|
};
|
|
181
181
|
// 包装一层兼容 names 改变
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import { FormInstance } from 'antd';
|
|
2
|
-
|
|
2
|
+
type ModifiedFormInstance<T> = FormInstance<T> & {
|
|
3
|
+
isModified?: boolean;
|
|
4
|
+
};
|
|
5
|
+
export declare const useForm: <T>(originForm: ModifiedFormInstance<T>) => [ModifiedFormInstance<T>];
|
|
6
|
+
export {};
|