@zat-design/sisyphus-react 3.5.0 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +2 -1
- package/dist/less.esm.css +1 -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/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/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/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/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/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/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));
|
|
@@ -5312,7 +5313,7 @@ input[type='button'] {
|
|
|
5312
5313
|
.ant-form .ant-form-item .ant-form-item-label > label,
|
|
5313
5314
|
.ant-drawer .ant-form-item .ant-form-item-label > label,
|
|
5314
5315
|
.ant-modal .ant-form-item .ant-form-item-label > label {
|
|
5315
|
-
word-break: break-
|
|
5316
|
+
word-break: break-all;
|
|
5316
5317
|
}
|
|
5317
5318
|
.ant-form .ant-form-item .ant-form-item-label > label::after,
|
|
5318
5319
|
.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));
|
|
@@ -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: [],
|
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;
|
|
@@ -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
|
* 从树形数据中找出用户搜索得数据,并且将搜索字符串高亮标识
|
package/es/style/theme/antd.less
CHANGED
|
@@ -102,35 +102,7 @@ var getActionColumn = function getActionColumn(config) {
|
|
|
102
102
|
case 8:
|
|
103
103
|
_context.prev = 8;
|
|
104
104
|
_context.t0 = _context["catch"](3);
|
|
105
|
-
|
|
106
|
-
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
107
|
-
if (errorDom) {
|
|
108
|
-
var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
|
|
109
|
-
var tableCell = errorDom.closest('.ant-table-cell');
|
|
110
|
-
if (tableBody && tableCell) {
|
|
111
|
-
var previousSibling = tableCell.previousElementSibling;
|
|
112
|
-
var childOffsetLeft = 0;
|
|
113
|
-
var childFixedLeft = 0;
|
|
114
|
-
while (previousSibling) {
|
|
115
|
-
if (previousSibling.nodeType === 1) {
|
|
116
|
-
var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
|
|
117
|
-
var _ref2 = previousSibling.getBoundingClientRect() || {},
|
|
118
|
-
_ref2$width = _ref2.width,
|
|
119
|
-
width = _ref2$width === void 0 ? 0 : _ref2$width;
|
|
120
|
-
childOffsetLeft += width;
|
|
121
|
-
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')) {
|
|
122
|
-
childFixedLeft += width;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
previousSibling = previousSibling.previousElementSibling;
|
|
126
|
-
}
|
|
127
|
-
tableBody.scrollTo({
|
|
128
|
-
left: childOffsetLeft - childFixedLeft,
|
|
129
|
-
behavior: 'smooth'
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}, 0);
|
|
105
|
+
(0, _tools.handleScrollToError)();
|
|
134
106
|
return _context.abrupt("return", Promise.reject(_context.t0));
|
|
135
107
|
case 12:
|
|
136
108
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
|
@@ -258,10 +230,10 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
258
230
|
if (typeof columnTitle === 'string') {
|
|
259
231
|
item.originTitle = columnTitle;
|
|
260
232
|
if (tooltip) {
|
|
261
|
-
var
|
|
262
|
-
tooltipTitle =
|
|
263
|
-
icon =
|
|
264
|
-
resetProps = (0, _objectWithoutProperties2.default)(
|
|
233
|
+
var _ref2 = tooltip || {},
|
|
234
|
+
tooltipTitle = _ref2.title,
|
|
235
|
+
icon = _ref2.icon,
|
|
236
|
+
resetProps = (0, _objectWithoutProperties2.default)(_ref2, _excluded2);
|
|
265
237
|
item.title = (0, _jsxRuntime.jsxs)("span", {
|
|
266
238
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
|
267
239
|
children: [before, columnTitle, (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
@@ -413,13 +385,13 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
413
385
|
// cacheMap 用来存储缓存值,若有值后不再请求
|
|
414
386
|
if (JSON.stringify(cacheMap.current) === '{}') {
|
|
415
387
|
Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
|
|
416
|
-
var
|
|
417
|
-
var _item, key, value,
|
|
388
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(item) {
|
|
389
|
+
var _item, key, value, _ref4, service, option;
|
|
418
390
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
|
419
391
|
while (1) switch (_context2.prev = _context2.next) {
|
|
420
392
|
case 0:
|
|
421
393
|
_item = (0, _slicedToArray2.default)(item, 2), key = _item[0], value = _item[1];
|
|
422
|
-
|
|
394
|
+
_ref4 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref4.service, option = _ref4.option;
|
|
423
395
|
if (!service) {
|
|
424
396
|
_context2.next = 8;
|
|
425
397
|
break;
|
|
@@ -439,7 +411,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
|
439
411
|
}, _callee2);
|
|
440
412
|
}));
|
|
441
413
|
return function (_x3) {
|
|
442
|
-
return
|
|
414
|
+
return _ref3.apply(this, arguments);
|
|
443
415
|
};
|
|
444
416
|
}())).then(function (res) {
|
|
445
417
|
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;
|
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.splitNames = exports.onDelete = exports.getRandom = exports.getNamePath = exports.getDisabled = exports.difference = exports.customValidate = void 0;
|
|
7
|
+
exports.splitNames = exports.onDelete = exports.handleScrollToError = exports.getRandom = exports.getNamePath = exports.getDisabled = exports.difference = exports.customValidate = void 0;
|
|
8
8
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
9
|
var _lodash = require("lodash");
|
|
10
10
|
var getRandom = exports.getRandom = function getRandom() {
|
|
@@ -158,4 +158,37 @@ var getDisabled = exports.getDisabled = function getDisabled(_ref2) {
|
|
|
158
158
|
return convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, (0, _toConsumableArray2.default)(params)));
|
|
159
159
|
}
|
|
160
160
|
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || convertToBoolean(tabledDisabled);
|
|
161
|
+
};
|
|
162
|
+
/** 表格自动滚动到报错位置
|
|
163
|
+
*/
|
|
164
|
+
var handleScrollToError = exports.handleScrollToError = function handleScrollToError() {
|
|
165
|
+
setTimeout(function () {
|
|
166
|
+
var errorDom = document.querySelector('.ant-form-item-has-error');
|
|
167
|
+
if (errorDom) {
|
|
168
|
+
var tableBody = errorDom.closest('.ant-table-content') || errorDom.closest('.ant-table-body');
|
|
169
|
+
var tableCell = errorDom.closest('.ant-table-cell');
|
|
170
|
+
if (tableBody && tableCell) {
|
|
171
|
+
var previousSibling = tableCell.previousElementSibling;
|
|
172
|
+
var childOffsetLeft = 0;
|
|
173
|
+
var childFixedLeft = 0;
|
|
174
|
+
while (previousSibling) {
|
|
175
|
+
if (previousSibling.nodeType === 1) {
|
|
176
|
+
var _previousSibling, _previousSibling$clas, _previousSibling$clas2, _previousSibling$clas3;
|
|
177
|
+
var _ref3 = previousSibling.getBoundingClientRect() || {},
|
|
178
|
+
_ref3$width = _ref3.width,
|
|
179
|
+
width = _ref3$width === void 0 ? 0 : _ref3$width;
|
|
180
|
+
childOffsetLeft += width;
|
|
181
|
+
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')) {
|
|
182
|
+
childFixedLeft += width;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
previousSibling = previousSibling.previousElementSibling;
|
|
186
|
+
}
|
|
187
|
+
tableBody.scrollTo({
|
|
188
|
+
left: childOffsetLeft - childFixedLeft,
|
|
189
|
+
behavior: 'smooth'
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}, 0);
|
|
161
194
|
};
|
|
@@ -123,7 +123,7 @@ var ActionButton = function ActionButton(props) {
|
|
|
123
123
|
var _actionProps = (_props$actionProps = props.actionProps) === null || _props$actionProps === void 0 ? void 0 : _props$actionProps.map(function (item) {
|
|
124
124
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
125
125
|
// @ts-ignore
|
|
126
|
-
type: item.actionType
|
|
126
|
+
type: item.actionType || item.type
|
|
127
127
|
});
|
|
128
128
|
});
|
|
129
129
|
if (!(_actionProps === null || _actionProps === void 0 ? void 0 : _actionProps.find(function (item) {
|
|
@@ -50,7 +50,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
|
50
50
|
var _toolbarProps = (_props$toolbarProps = props.toolbarProps) === null || _props$toolbarProps === void 0 ? void 0 : _props$toolbarProps.map(function (item) {
|
|
51
51
|
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, item), {}, {
|
|
52
52
|
// @ts-ignore
|
|
53
|
-
type: item.actionType
|
|
53
|
+
type: item.actionType || item.type
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
if (!(_toolbarProps === null || _toolbarProps === void 0 ? void 0 : _toolbarProps.find(function (item) {
|
|
@@ -270,6 +270,7 @@ var useTransformColumns = exports.useTransformColumns = function useTransformCol
|
|
|
270
270
|
name: columnName
|
|
271
271
|
}, reactiveProps), {}, {
|
|
272
272
|
disabled: reactiveProps.disabled || groupProps.disabled,
|
|
273
|
+
getValueProps: transform === null || transform === void 0 ? void 0 : transform.getValueProps,
|
|
273
274
|
fieldProps: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, column === null || column === void 0 ? void 0 : column.fieldProps), {}, {
|
|
274
275
|
onChange: handleChange,
|
|
275
276
|
value: value === null || value === void 0 ? void 0 : value[index]
|
|
@@ -652,7 +652,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
652
652
|
selectedRows: []
|
|
653
653
|
});
|
|
654
654
|
}
|
|
655
|
-
if (!labelInValue &&
|
|
655
|
+
if (!labelInValue && !(0, _lodash.isEqual)(value, _value === null || _value === void 0 ? void 0 : _value[valueKey])) {
|
|
656
656
|
setState({
|
|
657
657
|
_value: value,
|
|
658
658
|
selectedRowKeys: [],
|
package/lib/ProForm/index.js
CHANGED
|
@@ -164,7 +164,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
164
164
|
// 暂时通过'-'区分组合组件字段和普通字段
|
|
165
165
|
var keys = Object.keys(changedValue);
|
|
166
166
|
if (!keys.length) {
|
|
167
|
-
onValuesChange(changedValue, form.getFieldsValue());
|
|
167
|
+
onValuesChange((0, _index.filterInternalFields)(changedValue), form.getFieldsValue());
|
|
168
168
|
} else {
|
|
169
169
|
var values = keys.map(function (key) {
|
|
170
170
|
if (key.includes('-')) {
|
|
@@ -176,7 +176,7 @@ var ProForm = function ProForm(props, ref) {
|
|
|
176
176
|
}
|
|
177
177
|
return {};
|
|
178
178
|
});
|
|
179
|
-
onValuesChange(_lodash.merge.apply(void 0, [changedValue].concat((0, _toConsumableArray2.default)(values))), form.getFieldsValue());
|
|
179
|
+
onValuesChange((0, _index.filterInternalFields)(_lodash.merge.apply(void 0, [changedValue].concat((0, _toConsumableArray2.default)(values)))), form.getFieldsValue());
|
|
180
180
|
}
|
|
181
181
|
};
|
|
182
182
|
// 包装一层兼容 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 {};
|
|
@@ -6,17 +6,20 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useForm = void 0;
|
|
8
8
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
9
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
|
|
9
10
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
12
|
var _antd = require("antd");
|
|
12
13
|
var _index = require("./index");
|
|
14
|
+
var _tools = require("../../ProEditTable/utils/tools");
|
|
13
15
|
var useForm = exports.useForm = function useForm(originForm) {
|
|
14
16
|
var _Form$useForm = _antd.Form.useForm(originForm),
|
|
15
17
|
_Form$useForm2 = (0, _slicedToArray2.default)(_Form$useForm, 1),
|
|
16
18
|
form = _Form$useForm2[0];
|
|
17
19
|
var getFieldsValue = form.getFieldsValue,
|
|
18
20
|
validateFields = form.validateFields,
|
|
19
|
-
|
|
21
|
+
isModified = form.isModified;
|
|
22
|
+
if (isModified) return [form];
|
|
20
23
|
// @ts-ignore
|
|
21
24
|
var _getFieldsValue = function _getFieldsValue(nameList, filterFunc) {
|
|
22
25
|
// 全部查询
|
|
@@ -26,13 +29,6 @@ var useForm = exports.useForm = function useForm(originForm) {
|
|
|
26
29
|
}
|
|
27
30
|
return getFieldsValue(nameList, filterFunc);
|
|
28
31
|
};
|
|
29
|
-
// const _setFieldsValue: FormInstance<T>['setFieldsValue'] = (data) => {
|
|
30
|
-
// // 解决names通过set设置无法触发rc-field-form中onStoreChange的问题
|
|
31
|
-
// setTimeout(() => {
|
|
32
|
-
// const baseData = getFieldsValue(true);
|
|
33
|
-
// setFieldsValue({ ...baseData, ...data });
|
|
34
|
-
// }, 0);
|
|
35
|
-
// };
|
|
36
32
|
var _validateFields = /*#__PURE__*/function () {
|
|
37
33
|
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(nameList) {
|
|
38
34
|
var _rest$,
|
|
@@ -44,7 +40,6 @@ var useForm = exports.useForm = function useForm(originForm) {
|
|
|
44
40
|
_form$getInternalHook,
|
|
45
41
|
getFields,
|
|
46
42
|
fieldsList,
|
|
47
|
-
_error$errorFields,
|
|
48
43
|
_error$errorFields$,
|
|
49
44
|
_args = arguments;
|
|
50
45
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
@@ -58,7 +53,7 @@ var useForm = exports.useForm = function useForm(originForm) {
|
|
|
58
53
|
isRecursive = rest === null || rest === void 0 ? void 0 : (_rest$ = rest[0]) === null || _rest$ === void 0 ? void 0 : _rest$.recursive;
|
|
59
54
|
validateNames = []; // 前缀校验模式
|
|
60
55
|
if (!isRecursive) {
|
|
61
|
-
_context.next =
|
|
56
|
+
_context.next = 12;
|
|
62
57
|
break;
|
|
63
58
|
}
|
|
64
59
|
// @ts-ignore
|
|
@@ -70,30 +65,40 @@ var useForm = exports.useForm = function useForm(originForm) {
|
|
|
70
65
|
validateNames.push(item.name);
|
|
71
66
|
}
|
|
72
67
|
});
|
|
68
|
+
if (Array.isArray(nameList) && nameList.length && !validateNames.length) {
|
|
69
|
+
validateNames = (0, _toConsumableArray2.default)(nameList);
|
|
70
|
+
}
|
|
73
71
|
// @ts-ignore
|
|
74
|
-
delete rest[0].recursive;
|
|
75
|
-
|
|
72
|
+
// delete rest[0].recursive;
|
|
73
|
+
_context.next = 11;
|
|
74
|
+
return validateFields.apply(void 0, [validateNames].concat(rest)).then(function (values) {
|
|
76
75
|
return (0, _index.filterInternalFields)(values);
|
|
77
|
-
})
|
|
78
|
-
case
|
|
79
|
-
return _context.abrupt("return",
|
|
76
|
+
});
|
|
77
|
+
case 11:
|
|
78
|
+
return _context.abrupt("return", _context.sent);
|
|
79
|
+
case 12:
|
|
80
|
+
_context.next = 14;
|
|
81
|
+
return validateFields.apply(void 0, [nameList].concat(rest)).then(function (values) {
|
|
80
82
|
return nameList ? values : _getFieldsValue();
|
|
81
|
-
})
|
|
82
|
-
case
|
|
83
|
-
_context.
|
|
83
|
+
});
|
|
84
|
+
case 14:
|
|
85
|
+
return _context.abrupt("return", _context.sent);
|
|
86
|
+
case 17:
|
|
87
|
+
_context.prev = 17;
|
|
84
88
|
_context.t0 = _context["catch"](0);
|
|
85
|
-
if (_context.t0
|
|
86
|
-
form
|
|
89
|
+
if (_context.t0 === null || _context.t0 === void 0 ? void 0 : _context.t0.errorFields) {
|
|
90
|
+
form.scrollToField((_error$errorFields$ = _context.t0.errorFields[0]) === null || _error$errorFields$ === void 0 ? void 0 : _error$errorFields$.name, {
|
|
87
91
|
block: 'center',
|
|
88
92
|
behavior: 'smooth'
|
|
89
93
|
});
|
|
90
94
|
}
|
|
95
|
+
(0, _tools.handleScrollToError)();
|
|
91
96
|
throw _context.t0;
|
|
92
|
-
case
|
|
97
|
+
case 22:
|
|
93
98
|
case "end":
|
|
94
99
|
return _context.stop();
|
|
95
100
|
}
|
|
96
|
-
}, _callee, null, [[0,
|
|
101
|
+
}, _callee, null, [[0, 17]]);
|
|
97
102
|
}));
|
|
98
103
|
return function _validateFields(_x) {
|
|
99
104
|
return _ref.apply(this, arguments);
|
|
@@ -101,6 +106,6 @@ var useForm = exports.useForm = function useForm(originForm) {
|
|
|
101
106
|
}();
|
|
102
107
|
form.getFieldsValue = _getFieldsValue;
|
|
103
108
|
form.validateFields = _validateFields;
|
|
104
|
-
|
|
109
|
+
form.isModified = true;
|
|
105
110
|
return [form];
|
|
106
111
|
};
|
|
@@ -24,8 +24,7 @@ var OpenMenu = function OpenMenu(props) {
|
|
|
24
24
|
dataSource = props.dataSource,
|
|
25
25
|
style = props.style,
|
|
26
26
|
_props$theme = props.theme,
|
|
27
|
-
theme = _props$theme === void 0 ? 'dark' : _props$theme
|
|
28
|
-
otherProps = props.otherProps;
|
|
27
|
+
theme = _props$theme === void 0 ? 'dark' : _props$theme;
|
|
29
28
|
var _ref = dataSource || {},
|
|
30
29
|
menus = _ref.menus,
|
|
31
30
|
sideMenu = _ref.sideMenu;
|
|
@@ -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;
|
|
@@ -7,15 +7,19 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.default = void 0;
|
|
8
8
|
var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
|
|
9
9
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
11
|
+
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
10
12
|
var _lodash = require("lodash");
|
|
11
13
|
var _react = _interopRequireDefault(require("react"));
|
|
12
14
|
var _index = require("../../index");
|
|
15
|
+
var _excluded = ["children", "delayTime"];
|
|
13
16
|
var _default = exports.default = function _default(_ref) {
|
|
14
17
|
var children = _ref.children,
|
|
15
|
-
delayTime = _ref.delayTime
|
|
18
|
+
delayTime = _ref.delayTime,
|
|
19
|
+
props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
|
|
16
20
|
var _useStep = (0, _index.useStep)(),
|
|
17
21
|
notify = _useStep.notify;
|
|
18
|
-
return /*#__PURE__*/_react.default.cloneElement(children, {
|
|
22
|
+
return /*#__PURE__*/_react.default.cloneElement(children, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, props), {}, {
|
|
19
23
|
onClick: (0, _lodash.throttle)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
|
20
24
|
var values;
|
|
21
25
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
@@ -39,5 +43,5 @@ var _default = exports.default = function _default(_ref) {
|
|
|
39
43
|
}
|
|
40
44
|
}, _callee);
|
|
41
45
|
})), 3000)
|
|
42
|
-
});
|
|
46
|
+
}));
|
|
43
47
|
};
|
package/lib/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;
|
|
@@ -32,9 +32,11 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
32
32
|
dics = _useProConfig$dics === void 0 ? {} : _useProConfig$dics;
|
|
33
33
|
var label = 'label';
|
|
34
34
|
var code = 'value';
|
|
35
|
+
var uuidKey = 'value';
|
|
35
36
|
if (proSelectFieldNames && Object.keys(proSelectFieldNames).length) {
|
|
36
37
|
code = proSelectFieldNames.value;
|
|
37
38
|
label = proSelectFieldNames.label;
|
|
39
|
+
uuidKey = proSelectFieldNames.key || proSelectFieldNames.value;
|
|
38
40
|
}
|
|
39
41
|
// 配置属性
|
|
40
42
|
var disabled = props.disabled,
|
|
@@ -78,6 +80,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
78
80
|
if (fieldNames && Object.keys(fieldNames).length) {
|
|
79
81
|
code = fieldNames.value || 'value';
|
|
80
82
|
label = fieldNames.label || 'label';
|
|
83
|
+
uuidKey = fieldNames.key || code;
|
|
81
84
|
}
|
|
82
85
|
// 经过处理后的枚举数据,可能来自用户配置的处理函数后返回的结果
|
|
83
86
|
var _useSetState = (0, _ahooks.useSetState)({}),
|
|
@@ -287,6 +290,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
287
290
|
icon = node.icon;
|
|
288
291
|
var labelText = node[label];
|
|
289
292
|
var value = node[code];
|
|
293
|
+
var key = node[uuidKey];
|
|
290
294
|
var titleHtml = (0, _jsxRuntime.jsx)("span", {
|
|
291
295
|
dangerouslySetInnerHTML: {
|
|
292
296
|
__html: labelText
|
|
@@ -317,7 +321,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
317
321
|
checkable: node.checkable,
|
|
318
322
|
icon: icon,
|
|
319
323
|
className: "node-val-".concat(value)
|
|
320
|
-
},
|
|
324
|
+
}, key);
|
|
321
325
|
}
|
|
322
326
|
var sonGrade = grade + 1;
|
|
323
327
|
return (0, _jsxRuntime.jsx)(_antd.TreeSelect.TreeNode, {
|
|
@@ -330,7 +334,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
330
334
|
children: children.map(function (child) {
|
|
331
335
|
return renderTreeNode(child, sonGrade);
|
|
332
336
|
})
|
|
333
|
-
},
|
|
337
|
+
}, key);
|
|
334
338
|
};
|
|
335
339
|
/**
|
|
336
340
|
* 从树形数据中找出用户搜索得数据,并且将搜索字符串高亮标识
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "3.5.
|
|
3
|
+
"version": "3.5.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
"@dnd-kit/sortable": "^7.0.2",
|
|
59
59
|
"@dnd-kit/utilities": "^3.2.1",
|
|
60
60
|
"@pansy/react-watermark": "^3.1.13",
|
|
61
|
-
"@zat-design/utils": "^1.1.
|
|
61
|
+
"@zat-design/utils": "^1.1.25",
|
|
62
62
|
"ahooks": "3.7.4",
|
|
63
63
|
"antd": "4.24.8",
|
|
64
64
|
"big.js": "^6.2.1",
|