@zat-design/sisyphus-react 3.4.5-beta.27 → 3.4.5-beta.28
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/es/ProEditTable/components/RenderField/index.js +5 -3
- package/es/ProForm/components/combination/ProModalSelect/index.js +4 -0
- package/es/ProTree/components/ProTree.js +48 -48
- package/es/ProTree/components/ProTreeSelect/index.js +3 -7
- package/es/ProTree/components/Tree.js +18 -12
- package/es/ProUpload/index.js +3 -5
- package/lib/ProEditTable/components/RenderField/index.js +4 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +4 -0
- package/lib/ProTree/components/ProTree.js +48 -48
- package/lib/ProTree/components/ProTreeSelect/index.js +3 -7
- package/lib/ProTree/components/Tree.js +18 -12
- package/lib/ProUpload/index.js +3 -5
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
|
11
11
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
12
12
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
13
13
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
14
|
-
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className"];
|
|
14
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim"];
|
|
15
15
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
16
|
/* eslint-disable prefer-destructuring */
|
|
17
17
|
/* eslint-disable prefer-const */
|
|
@@ -22,12 +22,13 @@ import valueTypeMap from '../../../ProForm/utils/valueType';
|
|
|
22
22
|
import transformMap from '../../utils/transform';
|
|
23
23
|
import { getNamePath, difference, getDisabled } from '../../utils/tools';
|
|
24
24
|
import * as componentMap from '../../../ProForm/components';
|
|
25
|
+
import { useProConfig } from '../../../ProConfigProvider';
|
|
25
26
|
import Container from '../../../ProForm/components/Container';
|
|
26
27
|
import transformNames from '../../../ProForm/utils/transformNames';
|
|
27
28
|
import { FieldProvider } from '../../../ProForm/utils/useFieldProps';
|
|
28
29
|
import { useListChanged } from '../../../ProForm/utils/useListChanged';
|
|
29
30
|
import useRules from '../../../ProForm/utils/useRules';
|
|
30
|
-
import { isSelect } from '../../../ProForm/utils';
|
|
31
|
+
import { isSelect, isTrim } from '../../../ProForm/utils';
|
|
31
32
|
var RenderField = function RenderField(_ref) {
|
|
32
33
|
var _type, _type$replace, _fieldProps2, _names, _TargetComponent4, _componentProps;
|
|
33
34
|
var value = _ref.text,
|
|
@@ -56,6 +57,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
56
57
|
rules = _column$rules === void 0 ? [] : _column$rules,
|
|
57
58
|
equalWith = column.equalWith,
|
|
58
59
|
className = column.className,
|
|
60
|
+
trim = column.trim,
|
|
59
61
|
resetProps = _objectWithoutProperties(column, _excluded);
|
|
60
62
|
// editRender弃用使用component同ProForm
|
|
61
63
|
var _editRender = component || editRender;
|
|
@@ -517,7 +519,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
517
519
|
if (['Select', 'ProSelect', 'ProEnum'].includes(type)) {
|
|
518
520
|
componentProps.scrollFollowParent = false;
|
|
519
521
|
}
|
|
520
|
-
Object.assign(_formItemProps, _objectSpread(_objectSpread(_objectSpread({}, defaultTransform()), valueTypeTransform()), namesTransform()));
|
|
522
|
+
Object.assign(_formItemProps, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, defaultTransform()), valueTypeTransform()), namesTransform()), isTrim(type, trim, useProConfig())));
|
|
521
523
|
// 编辑&保存模式,在查看状态下移除表单的rules不做校验
|
|
522
524
|
if (!isEditing) {
|
|
523
525
|
delete _formItemProps.rules;
|
|
@@ -596,6 +596,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
596
596
|
});
|
|
597
597
|
nextState.selectedRows = value;
|
|
598
598
|
}
|
|
599
|
+
} else if (value) {
|
|
600
|
+
nextState.selectedRowKeys = [value];
|
|
601
|
+
nextState.selectedRows = [_defineProperty({}, valueKey, value[valueKey])];
|
|
599
602
|
}
|
|
600
603
|
setState(nextState);
|
|
601
604
|
}
|
|
@@ -799,6 +802,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
799
802
|
form: form,
|
|
800
803
|
columns: formColumns,
|
|
801
804
|
onFinish: handleSearch,
|
|
805
|
+
confirmLoading: loading,
|
|
802
806
|
footer: (formColumns === null || formColumns === void 0 ? void 0 : formColumns.length) > 1
|
|
803
807
|
}), _jsx(ProTable, _objectSpread({
|
|
804
808
|
onRow: function onRow(record) {
|
|
@@ -161,10 +161,7 @@ var ProTree = function ProTree(props) {
|
|
|
161
161
|
}
|
|
162
162
|
}, [dataSource, enumCode]);
|
|
163
163
|
useDeepCompareEffect(function () {
|
|
164
|
-
if (enumCode) {
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
if (dataSource) {
|
|
164
|
+
if (enumCode || dataSource) {
|
|
168
165
|
return undefined;
|
|
169
166
|
}
|
|
170
167
|
var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
|
@@ -176,56 +173,60 @@ var ProTree = function ProTree(props) {
|
|
|
176
173
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
|
177
174
|
fetchFunction.run(defaultParams);
|
|
178
175
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
|
176
|
+
var handleSignalSelect = function handleSignalSelect(value) {
|
|
177
|
+
var checkedValues = [];
|
|
178
|
+
var innerVal = value;
|
|
179
|
+
if (labelInValue) {
|
|
180
|
+
checkedValues = innerVal[fieldNameValue];
|
|
181
|
+
} else {
|
|
182
|
+
// 单选值场景为string走到这里
|
|
183
|
+
checkedValues = innerVal;
|
|
184
|
+
}
|
|
185
|
+
setState({
|
|
186
|
+
checkedValues: checkedValues
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var handleCheckSelect = function handleCheckSelect(allKeys) {
|
|
190
|
+
var checkedValues = [];
|
|
191
|
+
if (allValue && typeof value === 'string') {
|
|
192
|
+
// 如果value等于allValue那么全选中,否则选中value得值
|
|
193
|
+
if (value === allValue) {
|
|
194
|
+
checkedValues = allKeys;
|
|
195
|
+
} else {
|
|
196
|
+
checkedValues = [value];
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
var innerVal = value;
|
|
200
|
+
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
|
201
|
+
if (labelInValue) {
|
|
202
|
+
var isObjectArray = innerVal && innerVal.every(function (element) {
|
|
203
|
+
return _typeof(element) === 'object' && element !== null;
|
|
204
|
+
});
|
|
205
|
+
if (!isObjectArray) {
|
|
206
|
+
console.error('Please enter an array object');
|
|
207
|
+
}
|
|
208
|
+
checkedValues = innerVal && innerVal.map(function (item) {
|
|
209
|
+
return item[fieldNameValue];
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
// 复选,单纯value数组场景
|
|
213
|
+
checkedValues = innerVal;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
setState({
|
|
217
|
+
checkedValues: checkedValues,
|
|
218
|
+
checkAll: checkedValues.length === allKeys.length
|
|
219
|
+
});
|
|
220
|
+
};
|
|
179
221
|
useEffect(function () {
|
|
180
222
|
if (value) {
|
|
181
|
-
var checkedValues = [];
|
|
182
223
|
var allKeys = state.allKeys;
|
|
183
224
|
if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
|
|
184
225
|
// 单选
|
|
185
|
-
|
|
186
|
-
if (labelInValue) {
|
|
187
|
-
checkedValues = innerVal[fieldNameValue];
|
|
188
|
-
} else {
|
|
189
|
-
// 单选值场景为string走到这里
|
|
190
|
-
checkedValues = innerVal;
|
|
191
|
-
}
|
|
192
|
-
setState({
|
|
193
|
-
checkedValues: checkedValues
|
|
194
|
-
});
|
|
226
|
+
handleSignalSelect(value);
|
|
195
227
|
} else {
|
|
196
228
|
// 复选
|
|
197
|
-
|
|
198
|
-
// 如果value等于allValue那么全选中,否则选中value得值
|
|
199
|
-
if (value === allValue) {
|
|
200
|
-
checkedValues = allKeys;
|
|
201
|
-
} else {
|
|
202
|
-
checkedValues = [value];
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
var _innerVal = value;
|
|
206
|
-
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
|
207
|
-
if (labelInValue) {
|
|
208
|
-
var isObjectArray = _innerVal && _innerVal.every(function (element) {
|
|
209
|
-
return _typeof(element) === 'object' && element !== null;
|
|
210
|
-
});
|
|
211
|
-
if (!isObjectArray) {
|
|
212
|
-
console.error('Please enter an array object');
|
|
213
|
-
checkedValues = [];
|
|
214
|
-
}
|
|
215
|
-
checkedValues = _innerVal && _innerVal.map(function (item) {
|
|
216
|
-
return item[fieldNameValue];
|
|
217
|
-
});
|
|
218
|
-
} else {
|
|
219
|
-
// 复选,单纯value数组场景
|
|
220
|
-
checkedValues = _innerVal;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
// treeViewData = filterCheckedNodes(originalTreeData, checkedValues, '', fieldNames);
|
|
224
|
-
setState({
|
|
225
|
-
checkedValues: checkedValues,
|
|
226
|
-
checkAll: checkedValues.length === allKeys.length
|
|
227
|
-
// treeViewData,
|
|
228
|
-
});
|
|
229
|
+
handleCheckSelect(allKeys);
|
|
229
230
|
}
|
|
230
231
|
} else if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
|
|
231
232
|
// 单选--场景-->如果表单的value没有值,那么配置的selectedKey就起作用了,选中树节点
|
|
@@ -390,7 +391,6 @@ var ProTree = function ProTree(props) {
|
|
|
390
391
|
}, className, className));
|
|
391
392
|
var toggleExpand = function toggleExpand() {
|
|
392
393
|
var _state$innerExpandKey;
|
|
393
|
-
// expandedKeys
|
|
394
394
|
if (state === null || state === void 0 ? void 0 : (_state$innerExpandKey = state.innerExpandKeys) === null || _state$innerExpandKey === void 0 ? void 0 : _state$innerExpandKey.length) {
|
|
395
395
|
setState({
|
|
396
396
|
innerExpandKeys: []
|
|
@@ -193,12 +193,8 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
193
193
|
}
|
|
194
194
|
}, [enumCode, dataSource]);
|
|
195
195
|
useDeepCompareEffect(function () {
|
|
196
|
-
// code存在,不执行接口请求
|
|
197
|
-
if (enumCode) {
|
|
198
|
-
return undefined;
|
|
199
|
-
}
|
|
200
|
-
// dataSource存在不执行接口请求
|
|
201
|
-
if (dataSource) {
|
|
196
|
+
// code存在huo dataSource存在,不执行接口请求
|
|
197
|
+
if (enumCode || dataSource) {
|
|
202
198
|
return undefined;
|
|
203
199
|
}
|
|
204
200
|
// disabled 状态时,不查询接口
|
|
@@ -411,7 +407,7 @@ export var ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
411
407
|
}
|
|
412
408
|
return result;
|
|
413
409
|
}
|
|
414
|
-
var handleChange = function handleChange(newVal
|
|
410
|
+
var handleChange = function handleChange(newVal) {
|
|
415
411
|
// newVal回来得一定是label、value
|
|
416
412
|
var result = newVal;
|
|
417
413
|
if (props === null || props === void 0 ? void 0 : props.labelInValue) {
|
|
@@ -59,13 +59,15 @@ function List(props) {
|
|
|
59
59
|
var _useSetState = useSetState({
|
|
60
60
|
expandedKeys: [],
|
|
61
61
|
autoExpandParent: true,
|
|
62
|
-
currentClickTreeNode: null
|
|
62
|
+
currentClickTreeNode: null,
|
|
63
|
+
handing: false
|
|
63
64
|
}),
|
|
64
65
|
_useSetState2 = _slicedToArray(_useSetState, 2),
|
|
65
66
|
_useSetState2$ = _useSetState2[0],
|
|
66
67
|
expandedKeys = _useSetState2$.expandedKeys,
|
|
67
68
|
autoExpandParent = _useSetState2$.autoExpandParent,
|
|
68
69
|
currentClickTreeNode = _useSetState2$.currentClickTreeNode,
|
|
70
|
+
handing = _useSetState2$.handing,
|
|
69
71
|
setState = _useSetState2[1];
|
|
70
72
|
useEffect(function () {
|
|
71
73
|
if (searchStr) {
|
|
@@ -112,21 +114,28 @@ function List(props) {
|
|
|
112
114
|
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
113
115
|
while (1) switch (_context.prev = _context.next) {
|
|
114
116
|
case 0:
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
if (!handing) {
|
|
118
|
+
_context.next = 2;
|
|
119
|
+
break;
|
|
120
|
+
}
|
|
121
|
+
return _context.abrupt("return", null);
|
|
122
|
+
case 2:
|
|
119
123
|
val = value;
|
|
120
124
|
if (!isRadioSelect && value === currentClickTreeNode) {
|
|
121
125
|
// 如果当前点击了已经选中节点,那么取消选择
|
|
122
126
|
val = '';
|
|
123
127
|
}
|
|
124
128
|
setState({
|
|
125
|
-
currentClickTreeNode: val
|
|
129
|
+
currentClickTreeNode: val,
|
|
130
|
+
handing: true
|
|
126
131
|
});
|
|
127
|
-
_context.next =
|
|
132
|
+
_context.next = 7;
|
|
128
133
|
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
|
|
134
|
+
case 7:
|
|
135
|
+
setState({
|
|
136
|
+
handing: false
|
|
137
|
+
});
|
|
138
|
+
case 8:
|
|
130
139
|
case "end":
|
|
131
140
|
return _context.stop();
|
|
132
141
|
}
|
|
@@ -285,7 +294,6 @@ function List(props) {
|
|
|
285
294
|
})]
|
|
286
295
|
}, onlyKey);
|
|
287
296
|
};
|
|
288
|
-
// const _treeData = useMemo(() => {
|
|
289
297
|
function fn() {
|
|
290
298
|
var loop = function loop(data, index) {
|
|
291
299
|
index++;
|
|
@@ -317,7 +325,7 @@ function List(props) {
|
|
|
317
325
|
key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue]
|
|
318
326
|
});
|
|
319
327
|
});
|
|
320
|
-
return treeRow;
|
|
328
|
+
return treeRow;
|
|
321
329
|
};
|
|
322
330
|
if ((other === null || other === void 0 ? void 0 : other.mode) === 'view') {
|
|
323
331
|
return;
|
|
@@ -328,8 +336,6 @@ function List(props) {
|
|
|
328
336
|
}
|
|
329
337
|
return loop(newTreeData, -1);
|
|
330
338
|
}
|
|
331
|
-
// return fn();
|
|
332
|
-
// }, [searchStr, expandedKeys, showCodeName, originalTreeData, currentClickTreeNode]);
|
|
333
339
|
var _treeData = fn();
|
|
334
340
|
var onExpand = function onExpand(newExpandedKeys) {
|
|
335
341
|
setState({
|
package/es/ProUpload/index.js
CHANGED
|
@@ -175,10 +175,6 @@ var ProUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
175
175
|
* @return {*}
|
|
176
176
|
*/
|
|
177
177
|
var handleBeforeUpload = function handleBeforeUpload(file, fileList) {
|
|
178
|
-
if (!isFunction(beforeUpload)) {
|
|
179
|
-
return false;
|
|
180
|
-
}
|
|
181
|
-
// TODO
|
|
182
178
|
if (!validateFileExt(extExt, file)) {
|
|
183
179
|
var _locale$ProUpload2;
|
|
184
180
|
_message.error("".concat(locale === null || locale === void 0 ? void 0 : (_locale$ProUpload2 = locale.ProUpload) === null || _locale$ProUpload2 === void 0 ? void 0 : _locale$ProUpload2.errorInfoExt, "\u3010").concat(extExt.join('、'), "\u3011"));
|
|
@@ -189,7 +185,9 @@ var ProUpload = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
189
185
|
_message.error("".concat(locale === null || locale === void 0 ? void 0 : (_locale$ProUpload3 = locale.ProUpload) === null || _locale$ProUpload3 === void 0 ? void 0 : _locale$ProUpload3.errorInfoSize).concat(size, "M"));
|
|
190
186
|
return false;
|
|
191
187
|
}
|
|
192
|
-
|
|
188
|
+
if (beforeUpload) {
|
|
189
|
+
return beforeUpload(file, fileList);
|
|
190
|
+
}
|
|
193
191
|
};
|
|
194
192
|
var handleRemove = function handleRemove(file) {
|
|
195
193
|
var nextList = _fileList.slice();
|
|
@@ -22,13 +22,14 @@ var _valueType = _interopRequireDefault(require("../../../ProForm/utils/valueTyp
|
|
|
22
22
|
var _transform = _interopRequireDefault(require("../../utils/transform"));
|
|
23
23
|
var _tools = require("../../utils/tools");
|
|
24
24
|
var componentMap = _interopRequireWildcard(require("../../../ProForm/components"));
|
|
25
|
+
var _ProConfigProvider = require("../../../ProConfigProvider");
|
|
25
26
|
var _Container = _interopRequireDefault(require("../../../ProForm/components/Container"));
|
|
26
27
|
var _transformNames = _interopRequireDefault(require("../../../ProForm/utils/transformNames"));
|
|
27
28
|
var _useFieldProps = require("../../../ProForm/utils/useFieldProps");
|
|
28
29
|
var _useListChanged3 = require("../../../ProForm/utils/useListChanged");
|
|
29
30
|
var _useRules = _interopRequireDefault(require("../../../ProForm/utils/useRules"));
|
|
30
31
|
var _utils = require("../../../ProForm/utils");
|
|
31
|
-
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className"];
|
|
32
|
+
var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "equalWith", "className", "trim"];
|
|
32
33
|
/* eslint-disable prefer-destructuring */
|
|
33
34
|
/* eslint-disable prefer-const */
|
|
34
35
|
var RenderField = function RenderField(_ref) {
|
|
@@ -59,6 +60,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
59
60
|
rules = _column$rules === void 0 ? [] : _column$rules,
|
|
60
61
|
equalWith = column.equalWith,
|
|
61
62
|
className = column.className,
|
|
63
|
+
trim = column.trim,
|
|
62
64
|
resetProps = (0, _objectWithoutProperties2.default)(column, _excluded);
|
|
63
65
|
// editRender弃用使用component同ProForm
|
|
64
66
|
var _editRender = component || editRender;
|
|
@@ -520,7 +522,7 @@ var RenderField = function RenderField(_ref) {
|
|
|
520
522
|
if (['Select', 'ProSelect', 'ProEnum'].includes(type)) {
|
|
521
523
|
componentProps.scrollFollowParent = false;
|
|
522
524
|
}
|
|
523
|
-
Object.assign(_formItemProps, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultTransform()), valueTypeTransform()), namesTransform()));
|
|
525
|
+
Object.assign(_formItemProps, (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, defaultTransform()), valueTypeTransform()), namesTransform()), (0, _utils.isTrim)(type, trim, (0, _ProConfigProvider.useProConfig)())));
|
|
524
526
|
// 编辑&保存模式,在查看状态下移除表单的rules不做校验
|
|
525
527
|
if (!isEditing) {
|
|
526
528
|
delete _formItemProps.rules;
|
|
@@ -593,6 +593,9 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
593
593
|
});
|
|
594
594
|
nextState.selectedRows = value;
|
|
595
595
|
}
|
|
596
|
+
} else if (value) {
|
|
597
|
+
nextState.selectedRowKeys = [value];
|
|
598
|
+
nextState.selectedRows = [(0, _defineProperty2.default)({}, valueKey, value[valueKey])];
|
|
596
599
|
}
|
|
597
600
|
setState(nextState);
|
|
598
601
|
}
|
|
@@ -796,6 +799,7 @@ var ProModalSelect = function ProModalSelect(props, ref) {
|
|
|
796
799
|
form: form,
|
|
797
800
|
columns: formColumns,
|
|
798
801
|
onFinish: handleSearch,
|
|
802
|
+
confirmLoading: loading,
|
|
799
803
|
footer: (formColumns === null || formColumns === void 0 ? void 0 : formColumns.length) > 1
|
|
800
804
|
}), (0, _jsxRuntime.jsx)(_index.ProTable, (0, _objectSpread3.default)({
|
|
801
805
|
onRow: function onRow(record) {
|
|
@@ -161,10 +161,7 @@ var ProTree = function ProTree(props) {
|
|
|
161
161
|
}
|
|
162
162
|
}, [dataSource, enumCode]);
|
|
163
163
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
164
|
-
if (enumCode) {
|
|
165
|
-
return undefined;
|
|
166
|
-
}
|
|
167
|
-
if (dataSource) {
|
|
164
|
+
if (enumCode || dataSource) {
|
|
168
165
|
return undefined;
|
|
169
166
|
}
|
|
170
167
|
var _ref = (useRequest === null || useRequest === void 0 ? void 0 : useRequest.options) || {},
|
|
@@ -176,56 +173,60 @@ var ProTree = function ProTree(props) {
|
|
|
176
173
|
// 执行用户配置的枚举服务,拉取枚举数据进行更新
|
|
177
174
|
fetchFunction.run(defaultParams);
|
|
178
175
|
}, [useRequest === null || useRequest === void 0 ? void 0 : useRequest.options]);
|
|
176
|
+
var handleSignalSelect = function handleSignalSelect(value) {
|
|
177
|
+
var checkedValues = [];
|
|
178
|
+
var innerVal = value;
|
|
179
|
+
if (labelInValue) {
|
|
180
|
+
checkedValues = innerVal[fieldNameValue];
|
|
181
|
+
} else {
|
|
182
|
+
// 单选值场景为string走到这里
|
|
183
|
+
checkedValues = innerVal;
|
|
184
|
+
}
|
|
185
|
+
setState({
|
|
186
|
+
checkedValues: checkedValues
|
|
187
|
+
});
|
|
188
|
+
};
|
|
189
|
+
var handleCheckSelect = function handleCheckSelect(allKeys) {
|
|
190
|
+
var checkedValues = [];
|
|
191
|
+
if (allValue && typeof value === 'string') {
|
|
192
|
+
// 如果value等于allValue那么全选中,否则选中value得值
|
|
193
|
+
if (value === allValue) {
|
|
194
|
+
checkedValues = allKeys;
|
|
195
|
+
} else {
|
|
196
|
+
checkedValues = [value];
|
|
197
|
+
}
|
|
198
|
+
} else {
|
|
199
|
+
var innerVal = value;
|
|
200
|
+
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
|
201
|
+
if (labelInValue) {
|
|
202
|
+
var isObjectArray = innerVal && innerVal.every(function (element) {
|
|
203
|
+
return (0, _typeof2.default)(element) === 'object' && element !== null;
|
|
204
|
+
});
|
|
205
|
+
if (!isObjectArray) {
|
|
206
|
+
console.error('Please enter an array object');
|
|
207
|
+
}
|
|
208
|
+
checkedValues = innerVal && innerVal.map(function (item) {
|
|
209
|
+
return item[fieldNameValue];
|
|
210
|
+
});
|
|
211
|
+
} else {
|
|
212
|
+
// 复选,单纯value数组场景
|
|
213
|
+
checkedValues = innerVal;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
setState({
|
|
217
|
+
checkedValues: checkedValues,
|
|
218
|
+
checkAll: checkedValues.length === allKeys.length
|
|
219
|
+
});
|
|
220
|
+
};
|
|
179
221
|
(0, _react.useEffect)(function () {
|
|
180
222
|
if (value) {
|
|
181
|
-
var checkedValues = [];
|
|
182
223
|
var allKeys = state.allKeys;
|
|
183
224
|
if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
|
|
184
225
|
// 单选
|
|
185
|
-
|
|
186
|
-
if (labelInValue) {
|
|
187
|
-
checkedValues = innerVal[fieldNameValue];
|
|
188
|
-
} else {
|
|
189
|
-
// 单选值场景为string走到这里
|
|
190
|
-
checkedValues = innerVal;
|
|
191
|
-
}
|
|
192
|
-
setState({
|
|
193
|
-
checkedValues: checkedValues
|
|
194
|
-
});
|
|
226
|
+
handleSignalSelect(value);
|
|
195
227
|
} else {
|
|
196
228
|
// 复选
|
|
197
|
-
|
|
198
|
-
// 如果value等于allValue那么全选中,否则选中value得值
|
|
199
|
-
if (value === allValue) {
|
|
200
|
-
checkedValues = allKeys;
|
|
201
|
-
} else {
|
|
202
|
-
checkedValues = [value];
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
var _innerVal = value;
|
|
206
|
-
// 开启 labelInValue [{ label:xx, value: ""}] 形式、需要取出来 value
|
|
207
|
-
if (labelInValue) {
|
|
208
|
-
var isObjectArray = _innerVal && _innerVal.every(function (element) {
|
|
209
|
-
return (0, _typeof2.default)(element) === 'object' && element !== null;
|
|
210
|
-
});
|
|
211
|
-
if (!isObjectArray) {
|
|
212
|
-
console.error('Please enter an array object');
|
|
213
|
-
checkedValues = [];
|
|
214
|
-
}
|
|
215
|
-
checkedValues = _innerVal && _innerVal.map(function (item) {
|
|
216
|
-
return item[fieldNameValue];
|
|
217
|
-
});
|
|
218
|
-
} else {
|
|
219
|
-
// 复选,单纯value数组场景
|
|
220
|
-
checkedValues = _innerVal;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
// treeViewData = filterCheckedNodes(originalTreeData, checkedValues, '', fieldNames);
|
|
224
|
-
setState({
|
|
225
|
-
checkedValues: checkedValues,
|
|
226
|
-
checkAll: checkedValues.length === allKeys.length
|
|
227
|
-
// treeViewData,
|
|
228
|
-
});
|
|
229
|
+
handleCheckSelect(allKeys);
|
|
229
230
|
}
|
|
230
231
|
} else if (!(other === null || other === void 0 ? void 0 : other.checkable)) {
|
|
231
232
|
// 单选--场景-->如果表单的value没有值,那么配置的selectedKey就起作用了,选中树节点
|
|
@@ -390,7 +391,6 @@ var ProTree = function ProTree(props) {
|
|
|
390
391
|
}, className, className));
|
|
391
392
|
var toggleExpand = function toggleExpand() {
|
|
392
393
|
var _state$innerExpandKey;
|
|
393
|
-
// expandedKeys
|
|
394
394
|
if (state === null || state === void 0 ? void 0 : (_state$innerExpandKey = state.innerExpandKeys) === null || _state$innerExpandKey === void 0 ? void 0 : _state$innerExpandKey.length) {
|
|
395
395
|
setState({
|
|
396
396
|
innerExpandKeys: []
|
|
@@ -195,12 +195,8 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
195
195
|
}
|
|
196
196
|
}, [enumCode, dataSource]);
|
|
197
197
|
(0, _ahooks.useDeepCompareEffect)(function () {
|
|
198
|
-
// code存在,不执行接口请求
|
|
199
|
-
if (enumCode) {
|
|
200
|
-
return undefined;
|
|
201
|
-
}
|
|
202
|
-
// dataSource存在不执行接口请求
|
|
203
|
-
if (dataSource) {
|
|
198
|
+
// code存在huo dataSource存在,不执行接口请求
|
|
199
|
+
if (enumCode || dataSource) {
|
|
204
200
|
return undefined;
|
|
205
201
|
}
|
|
206
202
|
// disabled 状态时,不查询接口
|
|
@@ -413,7 +409,7 @@ var ProTreeSelect = exports.ProTreeSelect = function ProTreeSelect(props, ref) {
|
|
|
413
409
|
}
|
|
414
410
|
return result;
|
|
415
411
|
}
|
|
416
|
-
var handleChange = function handleChange(newVal
|
|
412
|
+
var handleChange = function handleChange(newVal) {
|
|
417
413
|
// newVal回来得一定是label、value
|
|
418
414
|
var result = newVal;
|
|
419
415
|
if (props === null || props === void 0 ? void 0 : props.labelInValue) {
|
|
@@ -64,13 +64,15 @@ function List(props) {
|
|
|
64
64
|
var _useSetState = (0, _ahooks.useSetState)({
|
|
65
65
|
expandedKeys: [],
|
|
66
66
|
autoExpandParent: true,
|
|
67
|
-
currentClickTreeNode: null
|
|
67
|
+
currentClickTreeNode: null,
|
|
68
|
+
handing: false
|
|
68
69
|
}),
|
|
69
70
|
_useSetState2 = (0, _slicedToArray2.default)(_useSetState, 2),
|
|
70
71
|
_useSetState2$ = _useSetState2[0],
|
|
71
72
|
expandedKeys = _useSetState2$.expandedKeys,
|
|
72
73
|
autoExpandParent = _useSetState2$.autoExpandParent,
|
|
73
74
|
currentClickTreeNode = _useSetState2$.currentClickTreeNode,
|
|
75
|
+
handing = _useSetState2$.handing,
|
|
74
76
|
setState = _useSetState2[1];
|
|
75
77
|
(0, _react.useEffect)(function () {
|
|
76
78
|
if (searchStr) {
|
|
@@ -117,21 +119,28 @@ function List(props) {
|
|
|
117
119
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
|
118
120
|
while (1) switch (_context.prev = _context.next) {
|
|
119
121
|
case 0:
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
122
|
+
if (!handing) {
|
|
123
|
+
_context.next = 2;
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
return _context.abrupt("return", null);
|
|
127
|
+
case 2:
|
|
124
128
|
val = value;
|
|
125
129
|
if (!isRadioSelect && value === currentClickTreeNode) {
|
|
126
130
|
// 如果当前点击了已经选中节点,那么取消选择
|
|
127
131
|
val = '';
|
|
128
132
|
}
|
|
129
133
|
setState({
|
|
130
|
-
currentClickTreeNode: val
|
|
134
|
+
currentClickTreeNode: val,
|
|
135
|
+
handing: true
|
|
131
136
|
});
|
|
132
|
-
_context.next =
|
|
137
|
+
_context.next = 7;
|
|
133
138
|
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);
|
|
134
|
-
case
|
|
139
|
+
case 7:
|
|
140
|
+
setState({
|
|
141
|
+
handing: false
|
|
142
|
+
});
|
|
143
|
+
case 8:
|
|
135
144
|
case "end":
|
|
136
145
|
return _context.stop();
|
|
137
146
|
}
|
|
@@ -290,7 +299,6 @@ function List(props) {
|
|
|
290
299
|
})]
|
|
291
300
|
}, onlyKey);
|
|
292
301
|
};
|
|
293
|
-
// const _treeData = useMemo(() => {
|
|
294
302
|
function fn() {
|
|
295
303
|
var loop = function loop(data, index) {
|
|
296
304
|
index++;
|
|
@@ -322,7 +330,7 @@ function List(props) {
|
|
|
322
330
|
key: (item === null || item === void 0 ? void 0 : item.key) || item[fieldNameValue]
|
|
323
331
|
});
|
|
324
332
|
});
|
|
325
|
-
return treeRow;
|
|
333
|
+
return treeRow;
|
|
326
334
|
};
|
|
327
335
|
if ((other === null || other === void 0 ? void 0 : other.mode) === 'view') {
|
|
328
336
|
return;
|
|
@@ -333,8 +341,6 @@ function List(props) {
|
|
|
333
341
|
}
|
|
334
342
|
return loop(newTreeData, -1);
|
|
335
343
|
}
|
|
336
|
-
// return fn();
|
|
337
|
-
// }, [searchStr, expandedKeys, showCodeName, originalTreeData, currentClickTreeNode]);
|
|
338
344
|
var _treeData = fn();
|
|
339
345
|
var onExpand = function onExpand(newExpandedKeys) {
|
|
340
346
|
setState({
|
package/lib/ProUpload/index.js
CHANGED
|
@@ -182,10 +182,6 @@ var ProUpload = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
182
182
|
* @return {*}
|
|
183
183
|
*/
|
|
184
184
|
var handleBeforeUpload = function handleBeforeUpload(file, fileList) {
|
|
185
|
-
if (!(0, _lodash.isFunction)(beforeUpload)) {
|
|
186
|
-
return false;
|
|
187
|
-
}
|
|
188
|
-
// TODO
|
|
189
185
|
if (!(0, _uitls.validateFileExt)(extExt, file)) {
|
|
190
186
|
var _locale$ProUpload2;
|
|
191
187
|
_antd.message.error("".concat(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProUpload2 = _locale.default.ProUpload) === null || _locale$ProUpload2 === void 0 ? void 0 : _locale$ProUpload2.errorInfoExt, "\u3010").concat(extExt.join('、'), "\u3011"));
|
|
@@ -196,7 +192,9 @@ var ProUpload = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
196
192
|
_antd.message.error("".concat(_locale.default === null || _locale.default === void 0 ? void 0 : (_locale$ProUpload3 = _locale.default.ProUpload) === null || _locale$ProUpload3 === void 0 ? void 0 : _locale$ProUpload3.errorInfoSize).concat(size, "M"));
|
|
197
193
|
return false;
|
|
198
194
|
}
|
|
199
|
-
|
|
195
|
+
if (beforeUpload) {
|
|
196
|
+
return beforeUpload(file, fileList);
|
|
197
|
+
}
|
|
200
198
|
};
|
|
201
199
|
var handleRemove = function handleRemove(file) {
|
|
202
200
|
var nextList = _fileList.slice();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zat-design/sisyphus-react",
|
|
3
|
-
"version": "3.4.5-beta.
|
|
3
|
+
"version": "3.4.5-beta.28",
|
|
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.19",
|
|
62
62
|
"ahooks": "3.7.4",
|
|
63
63
|
"antd": "4.24.8",
|
|
64
64
|
"big.js": "^6.2.1",
|