@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
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
.pro-tree {
|
|
5
5
|
height: 100%; // tree auto css
|
|
6
|
+
.@{ant-prefix}-tree-iconEle{
|
|
7
|
+
margin-right: 8px;
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
.@{ant-prefix}-tree-node-content-wrapper{
|
|
8
11
|
display: flex;
|
|
@@ -13,11 +16,11 @@
|
|
|
13
16
|
.@{ant-prefix}-tree-node-content-wrapper {
|
|
14
17
|
color: var(--zaui-text);
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
|
|
17
20
|
.pro-tree-tree-node.checked {
|
|
18
21
|
color: var(--zaui-text);
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
|
|
21
24
|
.pro-tree-tree-node.checked .brand-bg-opa-ten {
|
|
22
25
|
background-color: inherit;
|
|
23
26
|
}
|
|
@@ -362,4 +365,4 @@
|
|
|
362
365
|
}
|
|
363
366
|
}
|
|
364
367
|
}
|
|
365
|
-
}
|
|
368
|
+
}
|
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: [],
|
|
@@ -32,7 +32,7 @@ var _excluded = ["labelWidth", "hiddenNames", "trim", "upperCase", "className",
|
|
|
32
32
|
/* eslint-disable prefer-destructuring */
|
|
33
33
|
// 这个组件只管渲染, 参数的整理在外部处理
|
|
34
34
|
var Render = function Render(props) {
|
|
35
|
-
var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
|
|
35
|
+
var _ref2, _ref3, _ref4, _ref5, _componentProps$disab, _otherProps$names2;
|
|
36
36
|
var component = props.component,
|
|
37
37
|
originComponent = props.originComponent,
|
|
38
38
|
_props$formItemProps = props.formItemProps,
|
|
@@ -175,7 +175,7 @@ var Render = function Render(props) {
|
|
|
175
175
|
* globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
|
|
176
176
|
* globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
|
|
177
177
|
*/
|
|
178
|
-
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 =
|
|
178
|
+
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;
|
|
179
179
|
/**
|
|
180
180
|
* 最新fieldProps: 更新后的组件Props
|
|
181
181
|
*/
|
|
@@ -53,7 +53,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
53
53
|
});
|
|
54
54
|
}
|
|
55
55
|
var comList = columns.flatMap(function (column, index) {
|
|
56
|
-
var
|
|
56
|
+
var _fieldProps$disabled;
|
|
57
57
|
if (!!expand && !openState) {
|
|
58
58
|
// expand为Number时 过滤掉大于expand 且 非fixed的column
|
|
59
59
|
if (typeof expand === 'number') {
|
|
@@ -135,7 +135,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
135
135
|
placeholder = formItemChildProps.placeholder,
|
|
136
136
|
dataSource = formItemChildProps.dataSource;
|
|
137
137
|
var formLabel = _formItemProps.label;
|
|
138
|
-
var comDisabled = (
|
|
138
|
+
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可能为函数
|
|
139
139
|
// 当前组件是不是一个选择组件
|
|
140
140
|
var _isSelect = (0, _utils.isSelect)({
|
|
141
141
|
dataSource: dataSource,
|
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;
|
package/lib/ProLayout/index.js
CHANGED
|
@@ -9,7 +9,6 @@ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/obje
|
|
|
9
9
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
10
10
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
11
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
|
-
var _antd = require("antd");
|
|
13
12
|
var _react = require("react");
|
|
14
13
|
var _classnames = _interopRequireDefault(require("classnames"));
|
|
15
14
|
var _ahooks = require("ahooks");
|
|
@@ -54,8 +53,9 @@ var ProLayout = function ProLayout(props) {
|
|
|
54
53
|
set(props.collapsed || false);
|
|
55
54
|
}, [props.collapsed]);
|
|
56
55
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
57
|
-
if (Array.isArray(dataSource) && !dataSource.length) {
|
|
58
|
-
|
|
56
|
+
if (Array.isArray(dataSource) && !dataSource.length || !dataSource) {
|
|
57
|
+
console.warn('Warning: Missing menu data source, or menu data source is not an array');
|
|
58
|
+
return;
|
|
59
59
|
}
|
|
60
60
|
var userData = (0, _utils.transformMenus)(dataSource);
|
|
61
61
|
setState({
|
package/lib/ProSelect/index.js
CHANGED
|
@@ -328,7 +328,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
|
328
328
|
getPopupContainer: function getPopupContainer(trigger) {
|
|
329
329
|
return scrollFollowParent ? trigger.parentElement : document.body;
|
|
330
330
|
}
|
|
331
|
-
}, (0, _lodash.omit)((0, _lodash.cloneDeep)(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style'])), {}, {
|
|
331
|
+
}, (0, _lodash.omit)((0, _lodash.cloneDeep)(selectProps), ['isView', 'showCodeName', 'form', 'name', 'style', 'onFieldChange'])), {}, {
|
|
332
332
|
value: transformValue(),
|
|
333
333
|
children: Array.isArray(newSelectList) && newSelectList.map(function (item) {
|
|
334
334
|
return (0, _jsxRuntime.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;
|
|
@@ -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
|
* 从树形数据中找出用户搜索得数据,并且将搜索字符串高亮标识
|
|
@@ -22,7 +22,7 @@ var _locale = _interopRequireDefault(require("../../locale"));
|
|
|
22
22
|
var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode", "isRadioSelect"];
|
|
23
23
|
/*
|
|
24
24
|
*@Date: 2023-07-25 13:49:35
|
|
25
|
-
|
|
25
|
+
* @LastEditTime: 2024-05-20 11:47:45
|
|
26
26
|
*@Author: liudongliang
|
|
27
27
|
*@Description: 树每行节点渲染组件,复选时阻止点击事件冒泡,只有点击树节点文本会向上触发onSelect事件
|
|
28
28
|
*/
|
|
@@ -254,6 +254,12 @@ function List(props) {
|
|
|
254
254
|
className: nodeClass,
|
|
255
255
|
onClick: function onClick(e) {
|
|
256
256
|
e.stopPropagation();
|
|
257
|
+
onSelect(item === null || item === void 0 ? void 0 : item[fieldNameValue], {
|
|
258
|
+
node: e === null || e === void 0 ? void 0 : e.target,
|
|
259
|
+
event: e,
|
|
260
|
+
item: item,
|
|
261
|
+
selected: !isChecked
|
|
262
|
+
});
|
|
257
263
|
},
|
|
258
264
|
children: [tags && tags.length ? (0, _jsxRuntime.jsx)("div", {
|
|
259
265
|
className: "pro-tree-tree-node-tag",
|
|
@@ -268,20 +274,15 @@ function List(props) {
|
|
|
268
274
|
className: "tree-node-show-text",
|
|
269
275
|
children: [(0, _jsxRuntime.jsx)("div", {
|
|
270
276
|
className: "tree-node-show-text-label",
|
|
271
|
-
onClick: function onClick(e) {
|
|
272
|
-
return onSelect(item === null || item === void 0 ? void 0 : item[fieldNameValue], {
|
|
273
|
-
node: e === null || e === void 0 ? void 0 : e.target,
|
|
274
|
-
event: e,
|
|
275
|
-
item: item,
|
|
276
|
-
selected: !isChecked
|
|
277
|
-
});
|
|
278
|
-
},
|
|
279
277
|
children: optionRender ? optionRender(item, searchStr) : (0, _jsxRuntime.jsx)(_SearchTitle.default, (0, _objectSpread2.default)({
|
|
280
278
|
label: title,
|
|
281
279
|
searchStr: searchStr
|
|
282
280
|
}, other))
|
|
283
281
|
}), (0, _jsxRuntime.jsx)("div", {
|
|
284
282
|
className: "operate-tree-node-btns",
|
|
283
|
+
onClick: function onClick(e) {
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
},
|
|
285
286
|
children: (operateButton === null || operateButton === void 0 ? void 0 : operateButton.length) > 1 ? (0, _jsxRuntime.jsx)(_antd.Popover, {
|
|
286
287
|
overlayClassName: "pro-tree-operate-container",
|
|
287
288
|
content: (0, _jsxRuntime.jsx)("div", {
|
|
@@ -3,6 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
.pro-tree {
|
|
5
5
|
height: 100%; // tree auto css
|
|
6
|
+
.@{ant-prefix}-tree-iconEle{
|
|
7
|
+
margin-right: 8px;
|
|
8
|
+
}
|
|
6
9
|
|
|
7
10
|
.@{ant-prefix}-tree-node-content-wrapper{
|
|
8
11
|
display: flex;
|
|
@@ -13,11 +16,11 @@
|
|
|
13
16
|
.@{ant-prefix}-tree-node-content-wrapper {
|
|
14
17
|
color: var(--zaui-text);
|
|
15
18
|
}
|
|
16
|
-
|
|
19
|
+
|
|
17
20
|
.pro-tree-tree-node.checked {
|
|
18
21
|
color: var(--zaui-text);
|
|
19
22
|
}
|
|
20
|
-
|
|
23
|
+
|
|
21
24
|
.pro-tree-tree-node.checked .brand-bg-opa-ten {
|
|
22
25
|
background-color: inherit;
|
|
23
26
|
}
|
|
@@ -362,4 +365,4 @@
|
|
|
362
365
|
}
|
|
363
366
|
}
|
|
364
367
|
}
|
|
365
|
-
}
|
|
368
|
+
}
|