@zat-design/sisyphus-react 3.4.5-beta.11 → 3.4.5-beta.12
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 +10 -0
- package/dist/less.esm.css +10 -0
- package/es/ProEditTable/components/RenderField/index.js +36 -29
- package/es/ProEditTable/index.js +2 -2
- package/es/ProEditTable/utils/tools.d.ts +12 -0
- package/es/ProEditTable/utils/tools.js +49 -1
- package/es/ProForm/components/render/RenderFields.js +3 -1
- package/es/ProForm/propsType.d.ts +2 -0
- package/es/ProTree/components/ProTree.js +48 -26
- package/es/ProTree/components/Tree.js +52 -36
- package/es/ProTree/style/index.less +4 -0
- package/lib/ProEditTable/components/RenderField/index.js +34 -27
- package/lib/ProEditTable/index.js +2 -2
- package/lib/ProEditTable/utils/tools.d.ts +12 -0
- package/lib/ProEditTable/utils/tools.js +50 -1
- package/lib/ProForm/components/render/RenderFields.js +3 -1
- package/lib/ProForm/propsType.d.ts +2 -0
- package/lib/ProTree/components/ProTree.js +48 -26
- package/lib/ProTree/components/Tree.js +52 -36
- package/lib/ProTree/style/index.less +4 -0
- package/package.json +1 -1
- package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +0 -241
- package/coverage/lcov-report/src/.umi/core/history.ts.html +0 -148
- package/coverage/lcov-report/src/.umi/core/index.html +0 -206
- package/coverage/lcov-report/src/.umi/core/plugin.ts.html +0 -109
- package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +0 -160
- package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +0 -97
- package/coverage/lcov-report/src/.umi/core/routes.ts.html +0 -26050
- package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +0 -112
- package/coverage/lcov-report/src/.umi/dumi/demos/index.html +0 -116
- package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +0 -6340
- package/coverage/lcov-report/src/.umi/dumi/index.html +0 -116
- package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +0 -109
- package/coverage/lcov-report/src/.umi/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-antd/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +0 -172
- package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +0 -94
- package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +0 -196
- package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +0 -106
- package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +0 -88
- package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +0 -124
- package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +0 -1246
- package/coverage/lcov-report/src/.umi/plugin-locale/index.html +0 -161
- package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +0 -268
- package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +0 -778
- package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +0 -115
- package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +0 -202
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +0 -97
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +0 -142
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +0 -334
- package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-model/index.html +0 -146
- package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +0 -121
- package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +0 -298
- package/coverage/lcov-report/src/.umi/plugin-request/index.html +0 -116
- package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +0 -919
- package/coverage/lcov-report/src/.umi/umi.ts.html +0 -268
package/dist/index.esm.css
CHANGED
|
@@ -3913,6 +3913,16 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3913
3913
|
height: auto !important;
|
|
3914
3914
|
min-height: auto !important;
|
|
3915
3915
|
}
|
|
3916
|
+
.ant-tree-node-content-wrapper {
|
|
3917
|
+
display: -webkit-box;
|
|
3918
|
+
display: -webkit-flex;
|
|
3919
|
+
display: -ms-flexbox;
|
|
3920
|
+
display: flex;
|
|
3921
|
+
-webkit-box-align: baseline;
|
|
3922
|
+
-webkit-align-items: baseline;
|
|
3923
|
+
-ms-flex-align: baseline;
|
|
3924
|
+
align-items: baseline;
|
|
3925
|
+
}
|
|
3916
3926
|
.pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox {
|
|
3917
3927
|
margin-top: var(--zaui-space-size-sm);
|
|
3918
3928
|
}
|
package/dist/less.esm.css
CHANGED
|
@@ -3913,6 +3913,16 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3913
3913
|
height: auto !important;
|
|
3914
3914
|
min-height: auto !important;
|
|
3915
3915
|
}
|
|
3916
|
+
.ant-tree-node-content-wrapper {
|
|
3917
|
+
display: -webkit-box;
|
|
3918
|
+
display: -webkit-flex;
|
|
3919
|
+
display: -ms-flexbox;
|
|
3920
|
+
display: flex;
|
|
3921
|
+
-webkit-box-align: baseline;
|
|
3922
|
+
-webkit-align-items: baseline;
|
|
3923
|
+
-ms-flex-align: baseline;
|
|
3924
|
+
align-items: baseline;
|
|
3925
|
+
}
|
|
3916
3926
|
.pro-form.pro-form-view .ant-form-item .pro-tree .ant-tree-checkbox {
|
|
3917
3927
|
margin-top: var(--zaui-space-size-sm);
|
|
3918
3928
|
}
|
|
@@ -17,10 +17,10 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
18
18
|
import React, { useCallback, useEffect } from 'react';
|
|
19
19
|
import classNames from 'classnames';
|
|
20
|
-
import { cloneDeep, isEqual, debounce, omit, isFunction
|
|
20
|
+
import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
|
|
21
21
|
import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
|
-
import { getNamePath, difference } from '../../utils/tools';
|
|
23
|
+
import { getNamePath, difference, getDisabled } from '../../utils/tools';
|
|
24
24
|
import * as componentMap from '../../../ProForm/components';
|
|
25
25
|
import Container from '../../../ProForm/components/Container';
|
|
26
26
|
import transformNames from '../../../ProForm/utils/transformNames';
|
|
@@ -29,7 +29,7 @@ import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
|
29
29
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
30
|
import { isSelect } from '../../../ProForm/utils';
|
|
31
31
|
var RenderField = function RenderField(_ref) {
|
|
32
|
-
var _type, _type$replace, _fieldProps2,
|
|
32
|
+
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
|
|
33
33
|
var value = _ref.text,
|
|
34
34
|
record = _ref.record,
|
|
35
35
|
index = _ref.index,
|
|
@@ -75,7 +75,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
75
75
|
formNamePath = config.namePath,
|
|
76
76
|
_config$originalDiffT = config.originalDiffTip,
|
|
77
77
|
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT,
|
|
78
|
-
rowDisabled = config.rowDisabled
|
|
78
|
+
rowDisabled = config.rowDisabled,
|
|
79
|
+
otherProps = config.otherProps;
|
|
79
80
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
80
81
|
var _rules = rules || [];
|
|
81
82
|
var _required = required;
|
|
@@ -96,35 +97,41 @@ var RenderField = function RenderField(_ref) {
|
|
|
96
97
|
form: form,
|
|
97
98
|
namePath: [].concat(_toConsumableArray(namePath), [index])
|
|
98
99
|
};
|
|
100
|
+
// 行参数
|
|
101
|
+
var rowParams = [currentValue, rowData, options];
|
|
99
102
|
if (typeof isEditable === 'function') {
|
|
100
|
-
isEditable = isEditable(
|
|
103
|
+
isEditable = isEditable.apply(void 0, rowParams);
|
|
101
104
|
}
|
|
105
|
+
// 获取最终的disabled
|
|
106
|
+
_disabled = getDisabled({
|
|
107
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
108
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
109
|
+
column: column,
|
|
110
|
+
tabledDisabled: config === null || config === void 0 ? void 0 : config.disabled,
|
|
111
|
+
columnFieldProps: _fieldProps,
|
|
112
|
+
params: rowParams
|
|
113
|
+
});
|
|
102
114
|
// 是否只读文本
|
|
103
|
-
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || (
|
|
115
|
+
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || getDisabled({
|
|
116
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
117
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
118
|
+
column: column,
|
|
119
|
+
tabledDisabled: config === null || config === void 0 ? void 0 : config.disabled,
|
|
120
|
+
columnFieldProps: _fieldProps,
|
|
121
|
+
params: rowParams,
|
|
122
|
+
rowDisabled: rowDisabled
|
|
123
|
+
});
|
|
104
124
|
// 只读文本时,采用当前formItem的name,单行编辑时,使用生成的虚拟的name
|
|
105
125
|
var baseName = isView ? name : namePath;
|
|
106
126
|
var TargetComponent;
|
|
107
|
-
if (
|
|
108
|
-
_required = required(
|
|
109
|
-
}
|
|
110
|
-
if (typeof fieldProps === 'function') {
|
|
111
|
-
_fieldProps = fieldProps(currentValue, rowData, options);
|
|
112
|
-
}
|
|
113
|
-
if (typeof ((_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.disabled) === 'function') {
|
|
114
|
-
_disabled = _fieldProps.disabled(currentValue, rowData, options);
|
|
115
|
-
} else if (isBoolean((_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.disabled)) {
|
|
116
|
-
_disabled = _fieldProps.disabled;
|
|
117
|
-
}
|
|
118
|
-
if ((config === null || config === void 0 ? void 0 : config.disabled) === true) {
|
|
119
|
-
_disabled = column.disabled || (config === null || config === void 0 ? void 0 : config.disabled);
|
|
127
|
+
if (isFunction(required)) {
|
|
128
|
+
_required = required.apply(void 0, rowParams);
|
|
120
129
|
}
|
|
121
|
-
if (
|
|
122
|
-
|
|
123
|
-
} else if (isBoolean(column.disabled)) {
|
|
124
|
-
_disabled = column.disabled;
|
|
130
|
+
if (isFunction(fieldProps)) {
|
|
131
|
+
_fieldProps = fieldProps.apply(void 0, rowParams);
|
|
125
132
|
}
|
|
126
|
-
if (
|
|
127
|
-
_rules = rules(
|
|
133
|
+
if (isFunction(rules)) {
|
|
134
|
+
_rules = rules.apply(void 0, rowParams);
|
|
128
135
|
}
|
|
129
136
|
// 设置校验规则
|
|
130
137
|
var internalRule = useRules({
|
|
@@ -134,7 +141,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
134
141
|
required: !isView && _required,
|
|
135
142
|
rules: isEditing ? _rules : [],
|
|
136
143
|
isSelect: isSelect({
|
|
137
|
-
dataSource: (
|
|
144
|
+
dataSource: (_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.dataSource,
|
|
138
145
|
type: type
|
|
139
146
|
}),
|
|
140
147
|
type: type
|
|
@@ -169,7 +176,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
169
176
|
* @returns {}
|
|
170
177
|
*/
|
|
171
178
|
var valueTypeTransform = useCallback(function () {
|
|
172
|
-
var
|
|
179
|
+
var _fieldProps3;
|
|
173
180
|
// 不存在valueType返回空
|
|
174
181
|
if (!valueType) {
|
|
175
182
|
return {};
|
|
@@ -179,7 +186,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
179
186
|
valueType = 'switch';
|
|
180
187
|
}
|
|
181
188
|
var params = _objectSpread(_objectSpread({}, column), {}, {
|
|
182
|
-
mode: (
|
|
189
|
+
mode: (_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.mode
|
|
183
190
|
});
|
|
184
191
|
return isFunction(valueTypeMap[valueType]) ? valueTypeMap[valueType](params) : {};
|
|
185
192
|
}, [valueType]);
|
|
@@ -224,7 +231,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
224
231
|
}
|
|
225
232
|
if (isEditable && isEditing) {
|
|
226
233
|
if (typeof _editRender === 'function') {
|
|
227
|
-
TargetComponent = _editRender(
|
|
234
|
+
TargetComponent = _editRender.apply(void 0, rowParams);
|
|
228
235
|
}
|
|
229
236
|
if ( /*#__PURE__*/React.isValidElement(_editRender)) {
|
|
230
237
|
TargetComponent = _editRender;
|
package/es/ProEditTable/index.js
CHANGED
|
@@ -129,7 +129,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
129
129
|
return getRowKey(item) === getRowKey(record);
|
|
130
130
|
}));
|
|
131
131
|
};
|
|
132
|
-
var config = {
|
|
132
|
+
var config = _objectSpread({
|
|
133
133
|
form: form,
|
|
134
134
|
mode: mode,
|
|
135
135
|
isView: isView,
|
|
@@ -162,7 +162,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
162
162
|
originalDiffTip: originalDiffTip,
|
|
163
163
|
prefixCls: prefixCls,
|
|
164
164
|
rowDisabled: rowDisabled
|
|
165
|
-
};
|
|
165
|
+
}, resetProps);
|
|
166
166
|
// 编辑行设置下样式
|
|
167
167
|
var _rowClassName = function _rowClassName(record) {
|
|
168
168
|
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|
|
@@ -14,3 +14,15 @@ export declare const onDelete: ({ name, form, virtualKey, selectedRowKeys }: {
|
|
|
14
14
|
virtualKey: any;
|
|
15
15
|
selectedRowKeys: any;
|
|
16
16
|
}) => void;
|
|
17
|
+
/** 获取最终的disabled, 两张模式【子级优先,全局优先】
|
|
18
|
+
* 全局优先:globalControl为true时,全局控制
|
|
19
|
+
* 子级优先:globalControl为false时,子级控制
|
|
20
|
+
* @param globalControl 全局控制
|
|
21
|
+
* @param formDisabled 表单的disabled
|
|
22
|
+
* @param column 当前列
|
|
23
|
+
* @param tabledDisabled 表格的disabled
|
|
24
|
+
* @param columnFieldProps 当前列的fieldProps
|
|
25
|
+
* @param params 当前列的参数
|
|
26
|
+
* @param rowDisabled 行禁用参数
|
|
27
|
+
*/
|
|
28
|
+
export declare const getDisabled: ({ globalControl, formDisabled, column, tabledDisabled, columnFieldProps, params, rowDisabled }: any) => any;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
+
import { cloneDeep, isString, isObject, isEqual, transform, isFunction, isBoolean } from 'lodash';
|
|
2
3
|
export var getRandom = function getRandom() {
|
|
3
4
|
return Math.random().toString(36).slice(-6);
|
|
4
5
|
};
|
|
@@ -74,4 +75,51 @@ export var onDelete = function onDelete(_ref) {
|
|
|
74
75
|
form.setFieldValue(namePath, virtualList);
|
|
75
76
|
}
|
|
76
77
|
}
|
|
78
|
+
};
|
|
79
|
+
/** 获取最终的disabled, 两张模式【子级优先,全局优先】
|
|
80
|
+
* 全局优先:globalControl为true时,全局控制
|
|
81
|
+
* 子级优先:globalControl为false时,子级控制
|
|
82
|
+
* @param globalControl 全局控制
|
|
83
|
+
* @param formDisabled 表单的disabled
|
|
84
|
+
* @param column 当前列
|
|
85
|
+
* @param tabledDisabled 表格的disabled
|
|
86
|
+
* @param columnFieldProps 当前列的fieldProps
|
|
87
|
+
* @param params 当前列的参数
|
|
88
|
+
* @param rowDisabled 行禁用参数
|
|
89
|
+
*/
|
|
90
|
+
export var getDisabled = function getDisabled(_ref2) {
|
|
91
|
+
var globalControl = _ref2.globalControl,
|
|
92
|
+
formDisabled = _ref2.formDisabled,
|
|
93
|
+
column = _ref2.column,
|
|
94
|
+
tabledDisabled = _ref2.tabledDisabled,
|
|
95
|
+
columnFieldProps = _ref2.columnFieldProps,
|
|
96
|
+
params = _ref2.params,
|
|
97
|
+
rowDisabled = _ref2.rowDisabled;
|
|
98
|
+
var convertToBoolean = function convertToBoolean(value) {
|
|
99
|
+
if (value === null || value === undefined || value === '') {
|
|
100
|
+
return false;
|
|
101
|
+
}
|
|
102
|
+
if (value === 0) {
|
|
103
|
+
return true;
|
|
104
|
+
}
|
|
105
|
+
return Boolean(value);
|
|
106
|
+
};
|
|
107
|
+
// 判断是否有column的disabled属性
|
|
108
|
+
var noColumnDisabled = function noColumnDisabled() {
|
|
109
|
+
if (isFunction(column === null || column === void 0 ? void 0 : column.disabled) || isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled) || isBoolean(column === null || column === void 0 ? void 0 : column.disabled) || isBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
|
|
110
|
+
return false;
|
|
111
|
+
}
|
|
112
|
+
return true;
|
|
113
|
+
};
|
|
114
|
+
if (globalControl) {
|
|
115
|
+
return convertToBoolean(formDisabled) || convertToBoolean(tabledDisabled);
|
|
116
|
+
}
|
|
117
|
+
// 当表单含有diabled属性时,优先使用表单的disabled
|
|
118
|
+
if (isFunction(rowDisabled) && noColumnDisabled()) {
|
|
119
|
+
return rowDisabled(params[1]);
|
|
120
|
+
}
|
|
121
|
+
if (isFunction(column === null || column === void 0 ? void 0 : column.disabled) || isFunction(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled)) {
|
|
122
|
+
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled.apply(column, _toConsumableArray(params))) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled.apply(columnFieldProps, _toConsumableArray(params)));
|
|
123
|
+
}
|
|
124
|
+
return convertToBoolean(column === null || column === void 0 ? void 0 : column.disabled) || convertToBoolean(columnFieldProps === null || columnFieldProps === void 0 ? void 0 : columnFieldProps.disabled);
|
|
77
125
|
};
|
|
@@ -178,7 +178,9 @@ var RenderFields = function RenderFields(props) {
|
|
|
178
178
|
hiddenNames: column.hiddenNames,
|
|
179
179
|
colProps: _colProps,
|
|
180
180
|
mode: componentProps.mode,
|
|
181
|
-
namePath: column.namePath
|
|
181
|
+
namePath: column.namePath,
|
|
182
|
+
globalControl: globalControl,
|
|
183
|
+
formDisabled: formDisabled
|
|
182
184
|
};
|
|
183
185
|
if (outerClearNotShow !== false && show === false && (column === null || column === void 0 ? void 0 : column.name) && form.getFieldValue(column === null || column === void 0 ? void 0 : column.name)) {
|
|
184
186
|
setTimeout(function () {
|
|
@@ -41,6 +41,8 @@ export interface ProFormOtherProps {
|
|
|
41
41
|
required?: boolean | boolean[] | (() => boolean | boolean[]);
|
|
42
42
|
mode?: string;
|
|
43
43
|
namePath?: any[] | string | number;
|
|
44
|
+
globalControl?: boolean;
|
|
45
|
+
formDisabled?: boolean;
|
|
44
46
|
}
|
|
45
47
|
export interface ProFormProps<Values = any> extends FormProps<Values> {
|
|
46
48
|
disabled?: boolean;
|
|
@@ -5,6 +5,8 @@ import _Input from "antd/es/input";
|
|
|
5
5
|
import "antd/es/spin/style";
|
|
6
6
|
import _Spin from "antd/es/spin";
|
|
7
7
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
8
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
9
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
8
10
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
9
11
|
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
10
12
|
import "antd/es/message/style";
|
|
@@ -336,32 +338,52 @@ var ProTree = function ProTree(props) {
|
|
|
336
338
|
handleFinish(allValue, checked, checkedValues);
|
|
337
339
|
};
|
|
338
340
|
/** 点击了树节点开始loading,改变自身state并将值通过onchange上传到form */
|
|
339
|
-
var onSelectTreeNode = function
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
341
|
+
var onSelectTreeNode = /*#__PURE__*/function () {
|
|
342
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(props, info) {
|
|
343
|
+
var values;
|
|
344
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
345
|
+
while (1) switch (_context.prev = _context.next) {
|
|
346
|
+
case 0:
|
|
347
|
+
if (!(disabled || isView)) {
|
|
348
|
+
_context.next = 2;
|
|
349
|
+
break;
|
|
350
|
+
}
|
|
351
|
+
return _context.abrupt("return", null);
|
|
352
|
+
case 2:
|
|
353
|
+
setState({
|
|
354
|
+
clickShowLoading: loading
|
|
355
|
+
});
|
|
356
|
+
if (!onSelect) {
|
|
357
|
+
_context.next = 7;
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
_context.next = 6;
|
|
361
|
+
return onSelect(props, info);
|
|
362
|
+
case 6:
|
|
363
|
+
setState({
|
|
364
|
+
clickShowLoading: false
|
|
365
|
+
});
|
|
366
|
+
case 7:
|
|
367
|
+
if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
|
|
368
|
+
// 单选将选中节点值冒泡到form
|
|
369
|
+
values = props;
|
|
370
|
+
if (labelInValue) {
|
|
371
|
+
values = state.flatTreeData.filter(function (item) {
|
|
372
|
+
return values === item[fieldNameValue];
|
|
373
|
+
});
|
|
374
|
+
}
|
|
375
|
+
onChange && onChange(values);
|
|
376
|
+
}
|
|
377
|
+
case 8:
|
|
378
|
+
case "end":
|
|
379
|
+
return _context.stop();
|
|
380
|
+
}
|
|
381
|
+
}, _callee);
|
|
382
|
+
}));
|
|
383
|
+
return function onSelectTreeNode(_x, _x2) {
|
|
384
|
+
return _ref2.apply(this, arguments);
|
|
385
|
+
};
|
|
386
|
+
}();
|
|
365
387
|
var boxClass = classNames(_defineProperty({
|
|
366
388
|
'pro-tree': true,
|
|
367
389
|
'footer-shadow': footer
|
|
@@ -3,16 +3,18 @@ import _Tree from "antd/es/tree";
|
|
|
3
3
|
import "antd/es/popover/style";
|
|
4
4
|
import _Popover from "antd/es/popover";
|
|
5
5
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
|
+
import _regeneratorRuntime from "@babel/runtime/helpers/esm/regeneratorRuntime";
|
|
7
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
6
8
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
7
9
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode"];
|
|
10
|
+
var _excluded = ["checkedValues", "disabled", "searchStr", "originalTreeData", "showCodeName", "checkStrictly", "flatTreeData", "mode", "fieldNames", "tags", "onCheck", "optionRender", "treeData", "showLine", "switcherIcon", "checkable", "menu", "innerExpandKeys", "selectedKey", "disabledMode", "isRadioSelect"];
|
|
9
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
12
|
/*
|
|
11
13
|
*@Date: 2023-07-25 13:49:35
|
|
12
14
|
*@LastEditTime: 2023-07-25 13:49:35
|
|
13
15
|
*@Author: liudongliang
|
|
14
16
|
*@Description: 树每行节点渲染组件,复选时阻止点击事件冒泡,只有点击树节点文本会向上触发onSelect事件
|
|
15
|
-
*/
|
|
17
|
+
*/
|
|
16
18
|
/* eslint-disable no-plusplus */
|
|
17
19
|
import React, { useEffect, useState } from 'react';
|
|
18
20
|
import { useSetState } from 'ahooks';
|
|
@@ -50,6 +52,7 @@ function List(props) {
|
|
|
50
52
|
innerExpandKeys = props.innerExpandKeys,
|
|
51
53
|
selectedKey = props.selectedKey,
|
|
52
54
|
disabledMode = props.disabledMode,
|
|
55
|
+
isRadioSelect = props.isRadioSelect,
|
|
53
56
|
other = _objectWithoutProperties(props, _excluded);
|
|
54
57
|
var fieldNameLabel = fieldNames.label;
|
|
55
58
|
var fieldNameValue = fieldNames.value;
|
|
@@ -102,18 +105,37 @@ function List(props) {
|
|
|
102
105
|
});
|
|
103
106
|
}
|
|
104
107
|
}, [selectedKey]);
|
|
105
|
-
var onSelect = function
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
108
|
+
var onSelect = /*#__PURE__*/function () {
|
|
109
|
+
var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(value, item) {
|
|
110
|
+
var _props$onSelect;
|
|
111
|
+
var val;
|
|
112
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
113
|
+
while (1) switch (_context.prev = _context.next) {
|
|
114
|
+
case 0:
|
|
115
|
+
// if (window.handing) {
|
|
116
|
+
// return null;
|
|
117
|
+
// }
|
|
118
|
+
// window.handing = true;
|
|
119
|
+
val = value;
|
|
120
|
+
if (!isRadioSelect && value === currentClickTreeNode) {
|
|
121
|
+
// 如果当前点击了已经选中节点,那么取消选择
|
|
122
|
+
val = '';
|
|
123
|
+
}
|
|
124
|
+
setState({
|
|
125
|
+
currentClickTreeNode: val
|
|
126
|
+
});
|
|
127
|
+
_context.next = 5;
|
|
128
|
+
return props === null || props === void 0 ? void 0 : (_props$onSelect = props.onSelect) === null || _props$onSelect === void 0 ? void 0 : _props$onSelect.call(props, val, item);
|
|
129
|
+
case 5:
|
|
130
|
+
case "end":
|
|
131
|
+
return _context.stop();
|
|
132
|
+
}
|
|
133
|
+
}, _callee);
|
|
134
|
+
}));
|
|
135
|
+
return function onSelect(_x, _x2) {
|
|
136
|
+
return _ref.apply(this, arguments);
|
|
137
|
+
};
|
|
138
|
+
}();
|
|
117
139
|
var TreeNodeRow = function TreeNodeRow(props) {
|
|
118
140
|
var nodeClass = props.nodeClass,
|
|
119
141
|
item = props.item,
|
|
@@ -275,31 +297,25 @@ function List(props) {
|
|
|
275
297
|
isChecked = true;
|
|
276
298
|
}
|
|
277
299
|
var title = showCodeName ? "".concat(item[fieldNameValue], "-").concat(item[fieldNameLabel]) : item[fieldNameLabel];
|
|
300
|
+
var nodeTitle = _jsx(TreeNodeRow, {
|
|
301
|
+
nodeClass: nodeClass,
|
|
302
|
+
item: item,
|
|
303
|
+
index: index,
|
|
304
|
+
title: (item === null || item === void 0 ? void 0 : item.title) || title,
|
|
305
|
+
isChecked: isChecked,
|
|
306
|
+
onlyKey: item[fieldNameValue]
|
|
307
|
+
});
|
|
278
308
|
if (item[fieldNames.children]) {
|
|
279
|
-
return {
|
|
280
|
-
title:
|
|
281
|
-
|
|
282
|
-
item: item,
|
|
283
|
-
index: index,
|
|
284
|
-
title: title,
|
|
285
|
-
isChecked: isChecked,
|
|
286
|
-
onlyKey: item[fieldNameValue]
|
|
287
|
-
}),
|
|
288
|
-
key: item[fieldNameValue],
|
|
309
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
310
|
+
title: nodeTitle,
|
|
311
|
+
key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue],
|
|
289
312
|
children: loop(item[fieldNames.children], index)
|
|
290
|
-
};
|
|
313
|
+
});
|
|
291
314
|
}
|
|
292
|
-
return {
|
|
293
|
-
title:
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
index: index,
|
|
297
|
-
title: title,
|
|
298
|
-
isChecked: isChecked,
|
|
299
|
-
onlyKey: item[fieldNameValue]
|
|
300
|
-
}),
|
|
301
|
-
key: item[fieldNameValue]
|
|
302
|
-
};
|
|
315
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
|
316
|
+
title: nodeTitle,
|
|
317
|
+
key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue]
|
|
318
|
+
});
|
|
303
319
|
});
|
|
304
320
|
return treeRow; // .filter((item) => item);
|
|
305
321
|
};
|
|
@@ -324,6 +324,10 @@
|
|
|
324
324
|
height : auto !important;
|
|
325
325
|
min-height : auto !important;
|
|
326
326
|
}
|
|
327
|
+
.ant-tree-node-content-wrapper{
|
|
328
|
+
display: flex;
|
|
329
|
+
align-items: baseline;
|
|
330
|
+
}
|
|
327
331
|
|
|
328
332
|
.pro-form.pro-form-view .@{ant-prefix}-form-item .pro-tree .@{ant-prefix}-tree-checkbox {
|
|
329
333
|
margin-top: var(--zaui-space-size-sm);
|
|
@@ -32,7 +32,7 @@ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "e
|
|
|
32
32
|
/* eslint-disable prefer-destructuring */
|
|
33
33
|
/* eslint-disable prefer-const */
|
|
34
34
|
var RenderField = function RenderField(_ref) {
|
|
35
|
-
var _type, _type$replace, _fieldProps2,
|
|
35
|
+
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
|
|
36
36
|
var value = _ref.text,
|
|
37
37
|
record = _ref.record,
|
|
38
38
|
index = _ref.index,
|
|
@@ -78,7 +78,8 @@ var RenderField = function RenderField(_ref) {
|
|
|
78
78
|
formNamePath = config.namePath,
|
|
79
79
|
_config$originalDiffT = config.originalDiffTip,
|
|
80
80
|
originalDiffTip = _config$originalDiffT === void 0 ? true : _config$originalDiffT,
|
|
81
|
-
rowDisabled = config.rowDisabled
|
|
81
|
+
rowDisabled = config.rowDisabled,
|
|
82
|
+
otherProps = config.otherProps;
|
|
82
83
|
var _fieldProps = fieldProps || formItemProps || {};
|
|
83
84
|
var _rules = rules || [];
|
|
84
85
|
var _required = required;
|
|
@@ -99,35 +100,41 @@ var RenderField = function RenderField(_ref) {
|
|
|
99
100
|
form: form,
|
|
100
101
|
namePath: [].concat((0, _toConsumableArray2.default)(namePath), [index])
|
|
101
102
|
};
|
|
103
|
+
// 行参数
|
|
104
|
+
var rowParams = [currentValue, rowData, options];
|
|
102
105
|
if (typeof isEditable === 'function') {
|
|
103
|
-
isEditable = isEditable(
|
|
106
|
+
isEditable = isEditable.apply(void 0, rowParams);
|
|
104
107
|
}
|
|
108
|
+
// 获取最终的disabled
|
|
109
|
+
_disabled = (0, _tools.getDisabled)({
|
|
110
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
111
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
112
|
+
column: column,
|
|
113
|
+
tabledDisabled: config === null || config === void 0 ? void 0 : config.disabled,
|
|
114
|
+
columnFieldProps: _fieldProps,
|
|
115
|
+
params: rowParams
|
|
116
|
+
});
|
|
105
117
|
// 是否只读文本
|
|
106
|
-
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || (
|
|
118
|
+
var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || (0, _tools.getDisabled)({
|
|
119
|
+
globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
|
|
120
|
+
formDisabled: otherProps === null || otherProps === void 0 ? void 0 : otherProps.formDisabled,
|
|
121
|
+
column: column,
|
|
122
|
+
tabledDisabled: config === null || config === void 0 ? void 0 : config.disabled,
|
|
123
|
+
columnFieldProps: _fieldProps,
|
|
124
|
+
params: rowParams,
|
|
125
|
+
rowDisabled: rowDisabled
|
|
126
|
+
});
|
|
107
127
|
// 只读文本时,采用当前formItem的name,单行编辑时,使用生成的虚拟的name
|
|
108
128
|
var baseName = isView ? name : namePath;
|
|
109
129
|
var TargetComponent;
|
|
110
|
-
if (
|
|
111
|
-
_required = required(
|
|
112
|
-
}
|
|
113
|
-
if (typeof fieldProps === 'function') {
|
|
114
|
-
_fieldProps = fieldProps(currentValue, rowData, options);
|
|
115
|
-
}
|
|
116
|
-
if (typeof ((_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.disabled) === 'function') {
|
|
117
|
-
_disabled = _fieldProps.disabled(currentValue, rowData, options);
|
|
118
|
-
} else if ((0, _lodash.isBoolean)((_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.disabled)) {
|
|
119
|
-
_disabled = _fieldProps.disabled;
|
|
120
|
-
}
|
|
121
|
-
if ((config === null || config === void 0 ? void 0 : config.disabled) === true) {
|
|
122
|
-
_disabled = column.disabled || (config === null || config === void 0 ? void 0 : config.disabled);
|
|
130
|
+
if ((0, _lodash.isFunction)(required)) {
|
|
131
|
+
_required = required.apply(void 0, rowParams);
|
|
123
132
|
}
|
|
124
|
-
if (
|
|
125
|
-
|
|
126
|
-
} else if ((0, _lodash.isBoolean)(column.disabled)) {
|
|
127
|
-
_disabled = column.disabled;
|
|
133
|
+
if ((0, _lodash.isFunction)(fieldProps)) {
|
|
134
|
+
_fieldProps = fieldProps.apply(void 0, rowParams);
|
|
128
135
|
}
|
|
129
|
-
if (
|
|
130
|
-
_rules = rules(
|
|
136
|
+
if ((0, _lodash.isFunction)(rules)) {
|
|
137
|
+
_rules = rules.apply(void 0, rowParams);
|
|
131
138
|
}
|
|
132
139
|
// 设置校验规则
|
|
133
140
|
var internalRule = (0, _useRules.default)({
|
|
@@ -137,7 +144,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
137
144
|
required: !isView && _required,
|
|
138
145
|
rules: isEditing ? _rules : [],
|
|
139
146
|
isSelect: (0, _utils.isSelect)({
|
|
140
|
-
dataSource: (
|
|
147
|
+
dataSource: (_fieldProps2 = _fieldProps) === null || _fieldProps2 === void 0 ? void 0 : _fieldProps2.dataSource,
|
|
141
148
|
type: type
|
|
142
149
|
}),
|
|
143
150
|
type: type
|
|
@@ -172,7 +179,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
172
179
|
* @returns {}
|
|
173
180
|
*/
|
|
174
181
|
var valueTypeTransform = (0, _react.useCallback)(function () {
|
|
175
|
-
var
|
|
182
|
+
var _fieldProps3;
|
|
176
183
|
// 不存在valueType返回空
|
|
177
184
|
if (!valueType) {
|
|
178
185
|
return {};
|
|
@@ -182,7 +189,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
182
189
|
valueType = 'switch';
|
|
183
190
|
}
|
|
184
191
|
var params = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, column), {}, {
|
|
185
|
-
mode: (
|
|
192
|
+
mode: (_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.mode
|
|
186
193
|
});
|
|
187
194
|
return (0, _lodash.isFunction)(_valueType.default[valueType]) ? _valueType.default[valueType](params) : {};
|
|
188
195
|
}, [valueType]);
|
|
@@ -227,7 +234,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
227
234
|
}
|
|
228
235
|
if (isEditable && isEditing) {
|
|
229
236
|
if (typeof _editRender === 'function') {
|
|
230
|
-
TargetComponent = _editRender(
|
|
237
|
+
TargetComponent = _editRender.apply(void 0, rowParams);
|
|
231
238
|
}
|
|
232
239
|
if ( /*#__PURE__*/_react.default.isValidElement(_editRender)) {
|
|
233
240
|
TargetComponent = _editRender;
|
|
@@ -132,7 +132,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
132
132
|
return getRowKey(item) === getRowKey(record);
|
|
133
133
|
}));
|
|
134
134
|
};
|
|
135
|
-
var config = {
|
|
135
|
+
var config = (0, _objectSpread2.default)({
|
|
136
136
|
form: form,
|
|
137
137
|
mode: mode,
|
|
138
138
|
isView: isView,
|
|
@@ -165,7 +165,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
|
|
|
165
165
|
originalDiffTip: originalDiffTip,
|
|
166
166
|
prefixCls: prefixCls,
|
|
167
167
|
rowDisabled: rowDisabled
|
|
168
|
-
};
|
|
168
|
+
}, resetProps);
|
|
169
169
|
// 编辑行设置下样式
|
|
170
170
|
var _rowClassName = function _rowClassName(record) {
|
|
171
171
|
var isEdit = !virtualKey || editingKeys.includes(record.rowKey);
|