@zat-design/sisyphus-react 3.5.0 → 3.5.1-beta.2
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/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/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/utils.js +1 -0
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/render/Render.js +2 -2
- package/es/ProForm/components/render/RenderFields.js +2 -2
- 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/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
- package/es/ProLayout/index.js +3 -4
- 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/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/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/utils.js +1 -0
- package/lib/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/lib/ProForm/components/render/Render.js +2 -2
- package/lib/ProForm/components/render/RenderFields.js +2 -2
- 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/ProLayout/components/Layout/Menu/OpenMenu/index.js +1 -2
- package/lib/ProLayout/index.js +3 -3
- 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;
|
|
@@ -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
|
};
|
|
@@ -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) {
|
|
@@ -263,6 +263,7 @@ export var useTransformColumns = function useTransformColumns(params) {
|
|
|
263
263
|
name: columnName
|
|
264
264
|
}, reactiveProps), {}, {
|
|
265
265
|
disabled: reactiveProps.disabled || groupProps.disabled,
|
|
266
|
+
getValueProps: transform === null || transform === void 0 ? void 0 : transform.getValueProps,
|
|
266
267
|
fieldProps: _objectSpread(_objectSpread({}, column === null || column === void 0 ? void 0 : column.fieldProps), {}, {
|
|
267
268
|
onChange: handleChange,
|
|
268
269
|
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: [],
|
|
@@ -34,7 +34,7 @@ import useRules from '../../utils/useRules';
|
|
|
34
34
|
import ConfirmWrapper from './ConfirmWrapper';
|
|
35
35
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
36
36
|
var Render = function Render(props) {
|
|
37
|
-
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
37
|
+
var _ref2, _ref3, _ref4, _ref5, _componentProps$disab, _otherProps$names2;
|
|
38
38
|
var component = props.component,
|
|
39
39
|
originComponent = props.originComponent,
|
|
40
40
|
_props$formItemProps = props.formItemProps,
|
|
@@ -177,7 +177,7 @@ var Render = function Render(props) {
|
|
|
177
177
|
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
178
178
|
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
|
179
179
|
*/
|
|
180
|
-
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 =
|
|
180
|
+
var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = (_componentProps$disab = componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _componentProps$disab !== void 0 ? _componentProps$disab : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : _disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
|
|
181
181
|
/**
|
|
182
182
|
* 最新fieldProps: 更新后的组件Props
|
|
183
183
|
*/
|
|
@@ -45,7 +45,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
var comList = columns.flatMap(function (column, index) {
|
|
48
|
-
var
|
|
48
|
+
var _fieldProps$disabled;
|
|
49
49
|
if (!!expand && !openState) {
|
|
50
50
|
// expand为Number时 过滤掉大于expand 且 非fixed的column
|
|
51
51
|
if (typeof expand === 'number') {
|
|
@@ -127,7 +127,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
127
127
|
placeholder = formItemChildProps.placeholder,
|
|
128
128
|
dataSource = formItemChildProps.dataSource;
|
|
129
129
|
var formLabel = _formItemProps.label;
|
|
130
|
-
var comDisabled = (
|
|
130
|
+
var comDisabled = (_fieldProps$disabled = fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.disabled) !== null && _fieldProps$disabled !== void 0 ? _fieldProps$disabled : _formItemProps === null || _formItemProps === void 0 ? void 0 : _formItemProps.disabled; // 组件属性层disabled fieldProps可能为函数
|
|
131
131
|
// 当前组件是不是一个选择组件
|
|
132
132
|
var _isSelect = isSelect({
|
|
133
133
|
dataSource: dataSource,
|
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 {};
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
3
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
4
|
import "antd/es/form/style";
|
|
4
5
|
import _Form from "antd/es/form";
|
|
5
6
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
7
|
import { filterInternalFields } from './index';
|
|
8
|
+
import { handleScrollToError } from '../../ProEditTable/utils/tools';
|
|
7
9
|
export var useForm = function useForm(originForm) {
|
|
8
10
|
var _Form$useForm = _Form.useForm(originForm),
|
|
9
11
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
10
12
|
form = _Form$useForm2[0];
|
|
11
13
|
var getFieldsValue = form.getFieldsValue,
|
|
12
14
|
validateFields = form.validateFields,
|
|
13
|
-
|
|
15
|
+
isModified = form.isModified;
|
|
16
|
+
if (isModified) return [form];
|
|
14
17
|
// @ts-ignore
|
|
15
18
|
var _getFieldsValue = function _getFieldsValue(nameList, filterFunc) {
|
|
16
19
|
// 全部查询
|
|
@@ -20,13 +23,6 @@ export var useForm = function useForm(originForm) {
|
|
|
20
23
|
}
|
|
21
24
|
return getFieldsValue(nameList, filterFunc);
|
|
22
25
|
};
|
|
23
|
-
// const _setFieldsValue: FormInstance<T>['setFieldsValue'] = (data) => {
|
|
24
|
-
// // 解决names通过set设置无法触发rc-field-form中onStoreChange的问题
|
|
25
|
-
// setTimeout(() => {
|
|
26
|
-
// const baseData = getFieldsValue(true);
|
|
27
|
-
// setFieldsValue({ ...baseData, ...data });
|
|
28
|
-
// }, 0);
|
|
29
|
-
// };
|
|
30
26
|
var _validateFields = /*#__PURE__*/function () {
|
|
31
27
|
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(nameList) {
|
|
32
28
|
var _rest$,
|
|
@@ -38,7 +34,6 @@ export var useForm = function useForm(originForm) {
|
|
|
38
34
|
_form$getInternalHook,
|
|
39
35
|
getFields,
|
|
40
36
|
fieldsList,
|
|
41
|
-
_error$errorFields,
|
|
42
37
|
_error$errorFields$,
|
|
43
38
|
_args = arguments;
|
|
44
39
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -52,7 +47,7 @@ export var useForm = function useForm(originForm) {
|
|
|
52
47
|
isRecursive = rest === null || rest === void 0 ? void 0 : (_rest$ = rest[0]) === null || _rest$ === void 0 ? void 0 : _rest$.recursive;
|
|
53
48
|
validateNames = []; // 前缀校验模式
|
|
54
49
|
if (!isRecursive) {
|
|
55
|
-
_context.next =
|
|
50
|
+
_context.next = 12;
|
|
56
51
|
break;
|
|
57
52
|
}
|
|
58
53
|
// @ts-ignore
|
|
@@ -64,30 +59,40 @@ export var useForm = function useForm(originForm) {
|
|
|
64
59
|
validateNames.push(item.name);
|
|
65
60
|
}
|
|
66
61
|
});
|
|
62
|
+
if (Array.isArray(nameList) && nameList.length && !validateNames.length) {
|
|
63
|
+
validateNames = _toConsumableArray(nameList);
|
|
64
|
+
}
|
|
67
65
|
// @ts-ignore
|
|
68
|
-
delete rest[0].recursive;
|
|
69
|
-
|
|
66
|
+
// delete rest[0].recursive;
|
|
67
|
+
_context.next = 11;
|
|
68
|
+
return validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
|
|
70
69
|
return filterInternalFields(values);
|
|
71
|
-
})
|
|
72
|
-
case
|
|
73
|
-
return _context.abrupt("return",
|
|
70
|
+
});
|
|
71
|
+
case 11:
|
|
72
|
+
return _context.abrupt("return", _context.sent);
|
|
73
|
+
case 12:
|
|
74
|
+
_context.next = 14;
|
|
75
|
+
return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
|
|
74
76
|
return nameList ? values : _getFieldsValue();
|
|
75
|
-
})
|
|
76
|
-
case
|
|
77
|
-
_context.
|
|
77
|
+
});
|
|
78
|
+
case 14:
|
|
79
|
+
return _context.abrupt("return", _context.sent);
|
|
80
|
+
case 17:
|
|
81
|
+
_context.prev = 17;
|
|
78
82
|
_context.t0 = _context["catch"](0);
|
|
79
|
-
if (_context.t0
|
|
80
|
-
form
|
|
83
|
+
if (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields) {
|
|
84
|
+
form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
|
|
81
85
|
block: 'center',
|
|
82
86
|
behavior: 'smooth'
|
|
83
87
|
});
|
|
84
88
|
}
|
|
89
|
+
handleScrollToError();
|
|
85
90
|
throw _context.t0;
|
|
86
|
-
case
|
|
91
|
+
case 22:
|
|
87
92
|
case "end":
|
|
88
93
|
return _context.stop();
|
|
89
94
|
}
|
|
90
|
-
}, _callee, null, [[0,
|
|
95
|
+
}, _callee, null, [[0, 17]]);
|
|
91
96
|
}));
|
|
92
97
|
return function _validateFields(_x) {
|
|
93
98
|
return _ref.apply(this, arguments);
|
|
@@ -95,6 +100,6 @@ export var useForm = function useForm(originForm) {
|
|
|
95
100
|
}();
|
|
96
101
|
form.getFieldsValue = _getFieldsValue;
|
|
97
102
|
form.validateFields = _validateFields;
|
|
98
|
-
|
|
103
|
+
form.isModified = true;
|
|
99
104
|
return [form];
|
|
100
105
|
};
|
|
@@ -18,8 +18,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
|
18
18
|
dataSource = props.dataSource,
|
|
19
19
|
style = props.style,
|
|
20
20
|
_props$theme = props.theme,
|
|
21
|
-
theme = _props$theme === void 0 ? 'dark' : _props$theme
|
|
22
|
-
otherProps = props.otherProps;
|
|
21
|
+
theme = _props$theme === void 0 ? 'dark' : _props$theme;
|
|
23
22
|
var _ref = dataSource || {},
|
|
24
23
|
menus = _ref.menus,
|
|
25
24
|
sideMenu = _ref.sideMenu;
|
package/es/ProLayout/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import "antd/es/message/style";
|
|
4
|
-
import _message from "antd/es/message";
|
|
5
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
6
4
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
5
|
import { createContext } from 'react';
|
|
@@ -48,8 +46,9 @@ var ProLayout = function ProLayout(props) {
|
|
|
48
46
|
set(props.collapsed || false);
|
|
49
47
|
}, [props.collapsed]);
|
|
50
48
|
useDeepCompareEffect(function () {
|
|
51
|
-
if (Array.isArray(dataSource) && !dataSource.length) {
|
|
52
|
-
|
|
49
|
+
if (Array.isArray(dataSource) && !dataSource.length || !dataSource) {
|
|
50
|
+
console.warn('Warning: Missing menu data source, or menu data source is not an array');
|
|
51
|
+
return;
|
|
53
52
|
}
|
|
54
53
|
var userData = transformMenus(dataSource);
|
|
55
54
|
setState({
|
package/es/ProSelect/index.js
CHANGED
|
@@ -325,7 +325,7 @@ export var ProSelect = function ProSelect(props, ref) {
|
|
|
325
325
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
326
326
|
return scrollFollowParent ? trigger.parentElement : document.body;
|
|
327
327
|
}
|
|
328
|
-
}, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style'])), {}, {
|
|
328
|
+
}, omit(cloneDeep(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style', 'onFieldChange'])), {}, {
|
|
329
329
|
value: transformValue(),
|
|
330
330
|
children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
|
|
331
331
|
return _jsx(Option, {
|
|
@@ -4,7 +4,7 @@ import { Service, Options, Result } from 'ahooks/lib/useRequest/src/types';
|
|
|
4
4
|
import { ProFormOtherProps } from '../ProForm/propsType';
|
|
5
5
|
export interface DataOption {
|
|
6
6
|
label?: string;
|
|
7
|
-
value?: string;
|
|
7
|
+
value?: string | number;
|
|
8
8
|
[key: string]: any;
|
|
9
9
|
}
|
|
10
10
|
export interface PropSelectProps extends Omit<SelectProps, 'onSearch'> {
|
|
@@ -1,5 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const _default: ({ children, delayTime, }: any) => React.DetailedReactHTMLElement<
|
|
3
|
-
onClick: import("lodash").DebouncedFunc<() => Promise<void>>;
|
|
4
|
-
}, HTMLElement>;
|
|
2
|
+
declare const _default: ({ children, delayTime, ...props }: any) => React.DetailedReactHTMLElement<any, HTMLElement>;
|
|
5
3
|
export default _default;
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
2
2
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
3
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
+
var _excluded = ["children", "delayTime"];
|
|
3
6
|
import { throttle } from 'lodash';
|
|
4
7
|
import React from 'react';
|
|
5
8
|
import { useStep } from '../../index';
|
|
6
9
|
export default (function (_ref) {
|
|
7
10
|
var children = _ref.children,
|
|
8
|
-
delayTime = _ref.delayTime
|
|
11
|
+
delayTime = _ref.delayTime,
|
|
12
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
9
13
|
var _useStep = useStep(),
|
|
10
14
|
notify = _useStep.notify;
|
|
11
|
-
return /*#__PURE__*/React.cloneElement(children, {
|
|
15
|
+
return /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, props), {}, {
|
|
12
16
|
onClick: throttle( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
13
17
|
var values;
|
|
14
18
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
@@ -32,5 +36,5 @@ export default (function (_ref) {
|
|
|
32
36
|
}
|
|
33
37
|
}, _callee);
|
|
34
38
|
})), 3000)
|
|
35
|
-
});
|
|
39
|
+
}));
|
|
36
40
|
});
|
package/es/ProStep/index.d.ts
CHANGED
|
@@ -7,8 +7,6 @@ declare const ProStep: {
|
|
|
7
7
|
({ children, ...resetProps }: ProStepPropsType): JSX.Element;
|
|
8
8
|
useStep: () => any;
|
|
9
9
|
Item: ({ id, title, collapse: collapseItem, children, ...restProps }: import("./propsType").ProStepItem) => JSX.Element;
|
|
10
|
-
Listener: ({ children, delayTime, }: any) => import("react").DetailedReactHTMLElement<
|
|
11
|
-
onClick: import("lodash").DebouncedFunc<() => Promise<void>>;
|
|
12
|
-
}, HTMLElement>;
|
|
10
|
+
Listener: ({ children, delayTime, ...props }: any) => import("react").DetailedReactHTMLElement<any, HTMLElement>;
|
|
13
11
|
};
|
|
14
12
|
export default ProStep;
|
|
@@ -30,9 +30,11 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
30
30
|
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
31
31
|
var label = 'label';
|
|
32
32
|
var code = 'value';
|
|
33
|
+
var uuidKey = 'value';
|
|
33
34
|
if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
|
|
34
35
|
code = proSelectFieldNames.value;
|
|
35
36
|
label = proSelectFieldNames.label;
|
|
37
|
+
uuidKey = proSelectFieldNames.key || proSelectFieldNames.value;
|
|
36
38
|
}
|
|
37
39
|
// 配置属性
|
|
38
40
|
var disabled = props.disabled,
|
|
@@ -76,6 +78,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
76
78
|
if (fieldNames && Object.keys(fieldNames).length) {
|
|
77
79
|
code = fieldNames.value || 'value';
|
|
78
80
|
label = fieldNames.label || 'label';
|
|
81
|
+
uuidKey = fieldNames.key || code;
|
|
79
82
|
}
|
|
80
83
|
// 经过处理后的枚举数据,可能来自用户配置的处理函数后返回的结果
|
|
81
84
|
var _useSetState = useSetState({}),
|
|
@@ -285,6 +288,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
285
288
|
icon = node.icon;
|
|
286
289
|
var labelText = node[label];
|
|
287
290
|
var value = node[code];
|
|
291
|
+
var key = node[uuidKey];
|
|
288
292
|
var titleHtml = _jsx("span", {
|
|
289
293
|
dangerouslySetInnerHTML: {
|
|
290
294
|
__html: labelText
|
|
@@ -315,7 +319,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
315
319
|
checkable: node.checkable,
|
|
316
320
|
icon: icon,
|
|
317
321
|
className: "node-val-".concat(value)
|
|
318
|
-
},
|
|
322
|
+
}, key);
|
|
319
323
|
}
|
|
320
324
|
var sonGrade = grade + 1;
|
|
321
325
|
return _jsx(_TreeSelect.TreeNode, {
|
|
@@ -328,7 +332,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
328
332
|
children: children.map(function (child) {
|
|
329
333
|
return renderTreeNode(child, sonGrade);
|
|
330
334
|
})
|
|
331
|
-
},
|
|
335
|
+
}, key);
|
|
332
336
|
};
|
|
333
337
|
/**
|
|
334
338
|
* 从树形数据中找出用户搜索得数据,并且将搜索字符串高亮标识
|
|
@@ -11,7 +11,7 @@ var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "
|
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
12
|
/*
|
|
13
13
|
*@Date: 2023-07-25 13:49:35
|
|
14
|
-
|
|
14
|
+
* @LastEditTime: 2024-05-20 11:47:45
|
|
15
15
|
*@Author: liudongliang
|
|
16
16
|
*@Description: 树每行节点渲染组件,复选时阻止点击事件冒泡,只有点击树节点文本会向上触发onSelect事件
|
|
17
17
|
*/
|
|
@@ -249,6 +249,12 @@ function List(props) {
|
|
|
249
249
|
className: nodeClass,
|
|
250
250
|
onClick: function onClick(e) {
|
|
251
251
|
e.stopPropagation();
|
|
252
|
+
onSelect(item === null || item === void 0 ? void 0 : item[fieldNameValue], {
|
|
253
|
+
node: e === null || e === void 0 ? void 0 : e.target,
|
|
254
|
+
event: e,
|
|
255
|
+
item: item,
|
|
256
|
+
selected: !isChecked
|
|
257
|
+
});
|
|
252
258
|
},
|
|
253
259
|
children: [tags && tags.length ? _jsx("div", {
|
|
254
260
|
className: "pro-tree-tree-node-tag",
|
|
@@ -263,20 +269,15 @@ function List(props) {
|
|
|
263
269
|
className: "tree-node-show-text",
|
|
264
270
|
children: [_jsx("div", {
|
|
265
271
|
className: "tree-node-show-text-label",
|
|
266
|
-
onClick: function onClick(e) {
|
|
267
|
-
return onSelect(item === null || item === void 0 ? void 0 : item[fieldNameValue], {
|
|
268
|
-
node: e === null || e === void 0 ? void 0 : e.target,
|
|
269
|
-
event: e,
|
|
270
|
-
item: item,
|
|
271
|
-
selected: !isChecked
|
|
272
|
-
});
|
|
273
|
-
},
|
|
274
272
|
children: optionRender ? optionRender(item, searchStr) : _jsx(SearchTitle, _objectSpread({
|
|
275
273
|
label: title,
|
|
276
274
|
searchStr: searchStr
|
|
277
275
|
}, other))
|
|
278
276
|
}), _jsx("div", {
|
|
279
277
|
className: "operate-tree-node-btns",
|
|
278
|
+
onClick: function onClick(e) {
|
|
279
|
+
e.stopPropagation();
|
|
280
|
+
},
|
|
280
281
|
children: (operateButton === null || operateButton === void 0 ? void 0 : operateButton.length) > 1 ? _jsx(_Popover, {
|
|
281
282
|
overlayClassName: "pro-tree-operate-container",
|
|
282
283
|
content: _jsx("div", {
|