@zat-design/sisyphus-react 3.9.7 → 3.9.8-beta.10
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 +6 -5
- package/dist/less.esm.css +6 -5
- package/es/ProAction/index.js +5 -5
- package/es/ProDownload/index.d.ts +1 -1
- package/es/ProDownload/index.js +3 -3
- package/es/ProDownload/utils.js +3 -3
- package/es/ProDrawerForm/components/ProDrawer/index.js +4 -4
- package/es/ProDrawerForm/components/ProModal/index.js +3 -3
- package/es/ProEditLabel/index.js +3 -3
- package/es/ProEditTable/components/ActionButton/index.d.ts +1 -1
- package/es/ProEditTable/components/ActionButton/index.js +51 -11
- package/es/ProEditTable/components/RcTable/BaseTable.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +1 -1
- package/es/ProEditTable/components/RcTable/VirtualTable.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/index.js +28 -19
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +1 -1
- package/es/ProEditTable/components/RenderToolbar/index.js +17 -15
- package/es/ProEditTable/components/Summary/index.d.ts +1 -1
- package/es/ProEditTable/index.js +1 -1
- package/es/ProEditTable/propsType.d.ts +5 -3
- package/es/ProEditTable/utils/config.d.ts +1 -1
- package/es/ProEditTable/utils/config.js +8 -9
- package/es/ProEditTable/utils/diffOriginal.d.ts +1 -1
- package/es/ProEditTable/utils/diffOriginal.js +21 -22
- package/es/ProEditTable/utils/index.js +37 -33
- package/es/ProEditTable/utils/tools.js +4 -4
- package/es/ProEnum/components/Group.d.ts +1 -1
- package/es/ProEnum/components/Tag.d.ts +1 -1
- package/es/ProEnum/hooks/useEnumRequest.js +2 -2
- package/es/ProEnum/index.d.ts +2 -2
- package/es/ProEnum/index.js +1 -1
- package/es/ProEnum/utils/eventCenter.js +2 -1
- package/es/ProEnum/utils/getEnumLabel.d.ts +1 -1
- package/es/ProForm/components/base/Input/index.d.ts +1 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/es/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/es/ProForm/components/combination/FormList/utils.js +1 -1
- package/es/ProForm/components/combination/Group/component/ComRender.js +1 -1
- package/es/ProForm/components/combination/Group/index.js +7 -2
- package/es/ProForm/components/combination/Group/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/Group/utils.d.ts +6 -1
- package/es/ProForm/components/combination/Group/utils.js +28 -6
- package/es/ProForm/components/combination/ProCascader/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProCascader/index.js +8 -8
- package/es/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +5 -5
- package/es/ProForm/components/old/InputRange/index.d.ts +1 -1
- package/es/ProForm/components/old/InputWithSuffix/index.d.ts +1 -1
- package/es/ProForm/components/old/ProAddress/index.d.ts +2 -1
- package/es/ProForm/components/old/ProAddress/index.js +1 -1
- package/es/ProForm/components/old/ProRangeBox/index.d.ts +2 -1
- package/es/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +25 -13
- package/es/ProForm/components/render/RenderFields.d.ts +1 -0
- package/es/ProForm/components/render/RenderFields.js +8 -4
- package/es/ProForm/components/render/propsType.d.ts +3 -1
- package/es/ProForm/index.js +6 -3
- package/es/ProForm/propsType.d.ts +3 -0
- package/es/ProForm/utils/diffOriginal.js +9 -2
- package/es/ProForm/utils/index.js +10 -14
- package/es/ProForm/utils/useForm.js +1 -1
- package/es/ProForm/utils/useShouldUpdate.js +25 -5
- package/es/ProForm/utils/valueType.d.ts +8 -0
- package/es/ProForm/utils/valueType.js +98 -33
- package/es/ProIcon/utils/index.js +3 -4
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +3 -3
- package/es/ProLayout/components/ProCollapse/index.d.ts +1 -1
- package/es/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/style/index.less +0 -8
- package/es/ProLayout/index.d.ts +4 -4
- package/es/ProLayout/utils/index.js +9 -9
- package/es/ProSelect/components/AdaptiveTooltip.d.ts +1 -1
- package/es/ProSelect/index.d.ts +1 -1
- package/es/ProStep/components/Anchor/index.d.ts +1 -1
- package/es/ProStep/components/Item/index.d.ts +1 -1
- package/es/ProStep/components/Listener/index.js +1 -1
- package/es/ProStep/components/Step/index.d.ts +1 -1
- package/es/ProStep/index.d.ts +2 -2
- package/es/ProStep/index.js +13 -12
- package/es/ProTable/components/FormatColumn/index.js +34 -5
- package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +1 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +2 -2
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +8 -9
- package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +1 -1
- package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/es/ProTable/components/RenderColumn/index.js +10 -2
- package/es/ProTable/components/RenderFooter/index.d.ts +1 -1
- package/es/ProTable/components/RenderTableHeader/index.d.ts +1 -1
- package/es/ProTable/components/TableResizable/index.d.ts +1 -1
- package/es/ProTable/hooks/useAntdTable.js +7 -6
- package/es/ProTable/index.d.ts +1 -1
- package/es/ProTable/index.js +8 -5
- package/es/ProTable/propsType.d.ts +2 -0
- package/es/ProTable/style/index.less +7 -0
- package/es/ProTable/utils/index.d.ts +4 -0
- package/es/ProTable/utils/index.js +15 -0
- package/es/ProTabs/components/Card/index.d.ts +1 -1
- package/es/ProThemeTools/component/ProTools/index.d.ts +1 -1
- package/es/ProThemeTools/index.d.ts +1 -1
- package/es/ProTooltip/index.d.ts +1 -1
- package/es/ProTree/components/AdaptiveTooltip.d.ts +1 -1
- package/es/ProTree/components/CloseIcon.d.ts +2 -1
- package/es/ProTree/components/List.d.ts +1 -1
- package/es/ProTree/components/ProTree.d.ts +1 -1
- package/es/ProTree/components/ProTree.js +1 -1
- package/es/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +22 -22
- package/es/ProTree/components/SearchTitle.d.ts +1 -1
- package/es/ProTree/components/Tree.d.ts +1 -1
- package/es/ProTree/components/Tree.js +4 -4
- package/es/ProTree/index.d.ts +1 -1
- package/es/ProTree/utils.js +11 -12
- package/es/ProTreeModal/components/Cascader.d.ts +1 -1
- package/es/ProTreeModal/components/CloseIcon.d.ts +2 -1
- package/es/ProTreeModal/components/SearchTitle.d.ts +1 -1
- package/es/ProTreeModal/components/Tree.js +6 -6
- package/es/ProTreeModal/components/Trigger.d.ts +1 -1
- package/es/ProTreeModal/index.d.ts +1 -1
- package/es/ProTreeModal/index.js +3 -3
- package/es/ProTreeModal/utils.js +14 -16
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/es/ProUpload/components/ImageRender.js +1 -1
- package/es/ProViewer/index.js +2 -2
- package/es/old/ProEditableTable/index.js +4 -4
- package/lib/ProAction/index.js +5 -5
- package/lib/ProDownload/index.d.ts +1 -1
- package/lib/ProDownload/index.js +3 -3
- package/lib/ProDownload/utils.js +3 -3
- package/lib/ProDrawerForm/components/ProDrawer/index.js +4 -4
- package/lib/ProDrawerForm/components/ProModal/index.js +3 -3
- package/lib/ProEditLabel/index.js +3 -3
- package/lib/ProEditTable/components/ActionButton/index.d.ts +1 -1
- package/lib/ProEditTable/components/ActionButton/index.js +51 -11
- package/lib/ProEditTable/components/RcTable/BaseTable.d.ts +1 -1
- package/lib/ProEditTable/components/RcTable/DraggableTable.d.ts +1 -1
- package/lib/ProEditTable/components/RcTable/VirtualTable.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/lib/ProEditTable/components/RenderField/index.js +27 -18
- package/lib/ProEditTable/components/RenderToolbar/index.d.ts +1 -1
- package/lib/ProEditTable/components/RenderToolbar/index.js +17 -15
- package/lib/ProEditTable/components/Summary/index.d.ts +1 -1
- package/lib/ProEditTable/index.js +1 -1
- package/lib/ProEditTable/propsType.d.ts +5 -3
- package/lib/ProEditTable/utils/config.d.ts +1 -1
- package/lib/ProEditTable/utils/config.js +8 -9
- package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -1
- package/lib/ProEditTable/utils/diffOriginal.js +21 -22
- package/lib/ProEditTable/utils/index.js +37 -33
- package/lib/ProEditTable/utils/tools.js +4 -4
- package/lib/ProEnum/components/Group.d.ts +1 -1
- package/lib/ProEnum/components/Tag.d.ts +1 -1
- package/lib/ProEnum/hooks/useEnumRequest.js +2 -2
- package/lib/ProEnum/index.d.ts +2 -2
- package/lib/ProEnum/index.js +1 -1
- package/lib/ProEnum/utils/eventCenter.js +2 -1
- package/lib/ProEnum/utils/getEnumLabel.d.ts +1 -1
- package/lib/ProForm/components/base/Input/index.d.ts +1 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +2 -2
- package/lib/ProForm/components/combination/FormList/components/BlockTitle.js +1 -1
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +1 -1
- package/lib/ProForm/components/combination/FormList/utils.js +1 -1
- package/lib/ProForm/components/combination/Group/component/ComRender.js +1 -1
- package/lib/ProForm/components/combination/Group/index.js +7 -2
- package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/Group/utils.d.ts +6 -1
- package/lib/ProForm/components/combination/Group/utils.js +28 -6
- package/lib/ProForm/components/combination/ProCascader/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProCascader/index.js +8 -8
- package/lib/ProForm/components/combination/ProModalSelect/hooks/useRequestList.js +1 -1
- package/lib/ProForm/components/combination/ProModalSelect/index.js +5 -5
- package/lib/ProForm/components/old/InputRange/index.d.ts +1 -1
- package/lib/ProForm/components/old/InputWithSuffix/index.d.ts +1 -1
- package/lib/ProForm/components/old/ProAddress/index.d.ts +2 -1
- package/lib/ProForm/components/old/ProAddress/index.js +1 -1
- package/lib/ProForm/components/old/ProRangeBox/index.d.ts +2 -1
- package/lib/ProForm/components/render/ConfirmWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +25 -13
- package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
- package/lib/ProForm/components/render/RenderFields.js +8 -4
- package/lib/ProForm/components/render/propsType.d.ts +3 -1
- package/lib/ProForm/index.js +6 -3
- package/lib/ProForm/propsType.d.ts +3 -0
- package/lib/ProForm/utils/diffOriginal.js +9 -2
- package/lib/ProForm/utils/index.js +10 -10
- package/lib/ProForm/utils/useForm.js +1 -1
- package/lib/ProForm/utils/useShouldUpdate.js +25 -5
- package/lib/ProForm/utils/valueType.d.ts +8 -0
- package/lib/ProForm/utils/valueType.js +99 -34
- package/lib/ProIcon/utils/index.js +3 -3
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +1 -1
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +3 -3
- package/lib/ProLayout/components/ProCollapse/index.d.ts +1 -1
- package/lib/ProLayout/components/ProFooter/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/components/Copy/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/lib/ProLayout/components/ProHeader/style/index.less +0 -8
- package/lib/ProLayout/index.d.ts +4 -4
- package/lib/ProLayout/utils/index.js +9 -9
- package/lib/ProSelect/components/AdaptiveTooltip.d.ts +1 -1
- package/lib/ProSelect/index.d.ts +1 -1
- package/lib/ProStep/components/Anchor/index.d.ts +1 -1
- package/lib/ProStep/components/Item/index.d.ts +1 -1
- package/lib/ProStep/components/Listener/index.js +1 -1
- package/lib/ProStep/components/Step/index.d.ts +1 -1
- package/lib/ProStep/index.d.ts +2 -2
- package/lib/ProStep/index.js +12 -11
- package/lib/ProTable/components/FormatColumn/index.js +34 -5
- package/lib/ProTable/components/RcTable/components/BaseTable/index.d.ts +1 -1
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.js +2 -2
- package/lib/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/utils/index.js +8 -8
- package/lib/ProTable/components/RcTable/components/DraggableTable/index.d.ts +1 -1
- package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
- package/lib/ProTable/components/RenderColumn/index.js +10 -2
- package/lib/ProTable/components/RenderFooter/index.d.ts +1 -1
- package/lib/ProTable/components/RenderTableHeader/index.d.ts +1 -1
- package/lib/ProTable/components/TableResizable/index.d.ts +1 -1
- package/lib/ProTable/hooks/useAntdTable.js +6 -5
- package/lib/ProTable/index.d.ts +1 -1
- package/lib/ProTable/index.js +8 -5
- package/lib/ProTable/propsType.d.ts +2 -0
- package/lib/ProTable/style/index.less +7 -0
- package/lib/ProTable/utils/index.d.ts +4 -0
- package/lib/ProTable/utils/index.js +17 -1
- package/lib/ProTabs/components/Card/index.d.ts +1 -1
- package/lib/ProThemeTools/component/ProTools/index.d.ts +1 -1
- package/lib/ProThemeTools/index.d.ts +1 -1
- package/lib/ProTooltip/index.d.ts +1 -1
- package/lib/ProTree/components/AdaptiveTooltip.d.ts +1 -1
- package/lib/ProTree/components/CloseIcon.d.ts +2 -1
- package/lib/ProTree/components/List.d.ts +1 -1
- package/lib/ProTree/components/ProTree.d.ts +1 -1
- package/lib/ProTree/components/ProTree.js +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/lib/ProTree/components/ProTreeSelect/index.js +22 -22
- package/lib/ProTree/components/SearchTitle.d.ts +1 -1
- package/lib/ProTree/components/Tree.d.ts +1 -1
- package/lib/ProTree/components/Tree.js +4 -4
- package/lib/ProTree/index.d.ts +1 -1
- package/lib/ProTree/utils.js +11 -11
- package/lib/ProTreeModal/components/Cascader.d.ts +1 -1
- package/lib/ProTreeModal/components/CloseIcon.d.ts +2 -1
- package/lib/ProTreeModal/components/SearchTitle.d.ts +1 -1
- package/lib/ProTreeModal/components/Tree.js +6 -6
- package/lib/ProTreeModal/components/Trigger.d.ts +1 -1
- package/lib/ProTreeModal/index.d.ts +1 -1
- package/lib/ProTreeModal/index.js +3 -3
- package/lib/ProTreeModal/utils.js +13 -13
- package/lib/ProUpload/components/DraggableUploadListItem.d.ts +1 -1
- package/lib/ProUpload/components/ImageRender.js +1 -1
- package/lib/ProViewer/index.js +2 -2
- package/lib/old/ProEditableTable/index.js +4 -4
- package/package.json +1 -1
- package/.vscode/extensions.json +0 -5
@@ -10,7 +10,20 @@ var isEmpty = _utils.validate.isEmpty;
|
|
10
10
|
// 过滤对象中undefined字段
|
11
11
|
// 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
|
12
12
|
var filterObject = function filterObject(data) {
|
13
|
-
if (!(0, _lodash.isObject)(data) ||
|
13
|
+
if (!(0, _lodash.isObject)(data) || data === null) return data;
|
14
|
+
// ['1', undefined] ['1', ''] 视为相等
|
15
|
+
if (Array.isArray(data)) {
|
16
|
+
// 数组中全是empty值的话 视为null
|
17
|
+
var isFillNull = true;
|
18
|
+
var arr = data.map(function (item) {
|
19
|
+
if (isEmpty(item)) {
|
20
|
+
return null;
|
21
|
+
}
|
22
|
+
isFillNull = false;
|
23
|
+
return item;
|
24
|
+
});
|
25
|
+
return isFillNull ? null : arr;
|
26
|
+
}
|
14
27
|
var resData = {};
|
15
28
|
Object.keys(data).forEach(function (key) {
|
16
29
|
if (!isEmpty(data[key])) {
|
@@ -47,25 +60,11 @@ var diffOriginal = exports.diffOriginal = function diffOriginal(params) {
|
|
47
60
|
}
|
48
61
|
var _value = filterObject(value);
|
49
62
|
var _originalValue = filterObject(originalValue);
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
// 如果两个值有一个不是空值, 则进行深比较
|
58
|
-
if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
|
59
|
-
return (0, _lodash.isEqual)(value === null || value === void 0 ? void 0 : value[index], valueItem);
|
60
|
-
}
|
61
|
-
return true;
|
62
|
-
});
|
63
|
-
return isSame ? 'same' : 'changed';
|
64
|
-
}
|
65
|
-
return 'changed';
|
66
|
-
}
|
67
|
-
if (!isEmpty(_originalValue) || !isEmpty(_value)) {
|
68
|
-
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
69
|
-
}
|
70
|
-
return 'same';
|
63
|
+
var isEmptyVal = isEmpty(_value);
|
64
|
+
var isEmptyOrg = isEmpty(_originalValue);
|
65
|
+
// 都为空视为相等
|
66
|
+
if (isEmptyOrg && isEmptyVal) return 'same';
|
67
|
+
// 如果原始值为空 且当前有值的话 视为新增
|
68
|
+
if (isEmptyOrg && !isEmptyVal) return 'add';
|
69
|
+
return (0, _lodash.isEqual)(_value, _originalValue) ? 'same' : 'changed';
|
71
70
|
};
|
@@ -30,7 +30,7 @@ var _excluded = ["type", "label", "show", "needConfirm", "onHandle", "onClick"],
|
|
30
30
|
// 渲染操作栏
|
31
31
|
var getActionColumn = function getActionColumn(config) {
|
32
32
|
var _cloneDeepWith = (0, _lodash.cloneDeepWith)(config, function (value) {
|
33
|
-
if (/*#__PURE__*/_react.default.isValidElement(value)) {
|
33
|
+
if ( /*#__PURE__*/_react.default.isValidElement(value)) {
|
34
34
|
return value;
|
35
35
|
}
|
36
36
|
}),
|
@@ -87,49 +87,53 @@ var getActionColumn = function getActionColumn(config) {
|
|
87
87
|
action.show = show !== null && show !== void 0 ? show : true;
|
88
88
|
action.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
|
89
89
|
action.onEvent = /*#__PURE__*/function () {
|
90
|
-
var
|
90
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(record, _ref) {
|
91
91
|
var _form$getFieldValue;
|
92
|
-
var rowName, _record, onEvent, result;
|
92
|
+
var index, form, name, namePath, tableLength, rowName, _record, onEvent, result;
|
93
93
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
94
94
|
while (1) switch (_context.prev = _context.next) {
|
95
95
|
case 0:
|
96
|
+
index = _ref.index, form = _ref.form, name = _ref.name, namePath = _ref.namePath, tableLength = _ref.tableLength;
|
96
97
|
index = _utils.tools.calc(firstIndex, '+', index);
|
97
98
|
rowName = [].concat((0, _toConsumableArray2.default)(virtualRowName), [index]);
|
98
99
|
if (!(type === 'save')) {
|
99
|
-
_context.next =
|
100
|
+
_context.next = 13;
|
100
101
|
break;
|
101
102
|
}
|
102
|
-
_context.prev =
|
103
|
-
_context.next =
|
103
|
+
_context.prev = 4;
|
104
|
+
_context.next = 7;
|
104
105
|
return (0, _tools.customValidate)(validateKeys, form, rowName);
|
105
|
-
case
|
106
|
-
_context.next =
|
106
|
+
case 7:
|
107
|
+
_context.next = 13;
|
107
108
|
break;
|
108
|
-
case
|
109
|
-
_context.prev =
|
110
|
-
_context.t0 = _context["catch"](
|
109
|
+
case 9:
|
110
|
+
_context.prev = 9;
|
111
|
+
_context.t0 = _context["catch"](4);
|
111
112
|
(0, _tools.handleScrollToError)();
|
112
113
|
return _context.abrupt("return", Promise.reject(_context.t0));
|
113
|
-
case
|
114
|
+
case 13:
|
114
115
|
// 编辑状态使用自定义form值,非编辑状态直接使用行数据
|
115
116
|
_record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
|
116
117
|
onEvent = onClick || onHandle;
|
117
118
|
if (onEvent) {
|
118
|
-
_context.next =
|
119
|
+
_context.next = 19;
|
119
120
|
break;
|
120
121
|
}
|
121
122
|
result = true;
|
122
|
-
_context.next =
|
123
|
+
_context.next = 22;
|
123
124
|
break;
|
124
|
-
case
|
125
|
-
_context.next =
|
126
|
-
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record,
|
125
|
+
case 19:
|
126
|
+
_context.next = 21;
|
127
|
+
return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, {
|
127
128
|
form: form,
|
128
|
-
|
129
|
+
index: index,
|
130
|
+
tableLength: tableLength,
|
131
|
+
name: name,
|
132
|
+
namePath: namePath
|
129
133
|
});
|
130
|
-
case 20:
|
131
|
-
result = _context.sent;
|
132
134
|
case 21:
|
135
|
+
result = _context.sent;
|
136
|
+
case 22:
|
133
137
|
if (result !== false && type !== 'custom') {
|
134
138
|
_config.actions[type]((0, _objectSpread2.default)((0, _objectSpread2.default)({}, config), {}, {
|
135
139
|
rowName: [].concat((0, _toConsumableArray2.default)(name), [index]),
|
@@ -139,14 +143,14 @@ var getActionColumn = function getActionColumn(config) {
|
|
139
143
|
validateKeys: validateKeys
|
140
144
|
}));
|
141
145
|
}
|
142
|
-
case
|
146
|
+
case 23:
|
143
147
|
case "end":
|
144
148
|
return _context.stop();
|
145
149
|
}
|
146
|
-
}, _callee, null, [[
|
150
|
+
}, _callee, null, [[4, 9]]);
|
147
151
|
}));
|
148
152
|
return function (_x, _x2) {
|
149
|
-
return
|
153
|
+
return _ref2.apply(this, arguments);
|
150
154
|
};
|
151
155
|
}();
|
152
156
|
action.buttonProps = buttonProps;
|
@@ -229,16 +233,16 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
229
233
|
if (typeof columnTitle === 'string') {
|
230
234
|
item.originTitle = columnTitle;
|
231
235
|
if (tooltip) {
|
232
|
-
var
|
233
|
-
tooltipTitle =
|
234
|
-
icon =
|
235
|
-
resetProps = (0, _objectWithoutProperties2.default)(
|
236
|
+
var _ref3 = tooltip || {},
|
237
|
+
tooltipTitle = _ref3.title,
|
238
|
+
icon = _ref3.icon,
|
239
|
+
resetProps = (0, _objectWithoutProperties2.default)(_ref3, _excluded2);
|
236
240
|
item.title = (0, _jsxRuntime.jsxs)("span", {
|
237
241
|
className: "pro-edit-table-title pro-edit-table-tooltip",
|
238
242
|
children: [before, columnTitle, (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
239
243
|
title: tooltipTitle !== null && tooltipTitle !== void 0 ? tooltipTitle : tooltip
|
240
244
|
}, resetProps), {}, {
|
241
|
-
children: icon ? (/*#__PURE__*/_react.default.cloneElement(icon, {
|
245
|
+
children: icon ? ( /*#__PURE__*/_react.default.cloneElement(icon, {
|
242
246
|
className: 'icon-tip'
|
243
247
|
})) : (0, _jsxRuntime.jsx)(_reactSvg.ReactSVG, {
|
244
248
|
className: "icon-tip",
|
@@ -391,14 +395,14 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
391
395
|
}
|
392
396
|
// cacheMap 用来存储缓存值,若有值后不再请求
|
393
397
|
if (JSON.stringify(cacheMap.current) === '{}') {
|
394
|
-
Promise.all(Object.entries(_cacheMap).map(/*#__PURE__*/function () {
|
395
|
-
var
|
396
|
-
var _item, key, value,
|
398
|
+
Promise.all(Object.entries(_cacheMap).map( /*#__PURE__*/function () {
|
399
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2(item) {
|
400
|
+
var _item, key, value, _ref5, service, option;
|
397
401
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
398
402
|
while (1) switch (_context2.prev = _context2.next) {
|
399
403
|
case 0:
|
400
404
|
_item = (0, _slicedToArray2.default)(item, 2), key = _item[0], value = _item[1];
|
401
|
-
|
405
|
+
_ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
|
402
406
|
if (!service) {
|
403
407
|
_context2.next = 8;
|
404
408
|
break;
|
@@ -418,7 +422,7 @@ var transformColumns = exports.transformColumns = function transformColumns() {
|
|
418
422
|
}, _callee2);
|
419
423
|
}));
|
420
424
|
return function (_x3) {
|
421
|
-
return
|
425
|
+
return _ref4.apply(this, arguments);
|
422
426
|
};
|
423
427
|
}())).then(function (res) {
|
424
428
|
res.forEach(function (item) {
|
@@ -14,14 +14,14 @@ var getRandom = exports.getRandom = function getRandom() {
|
|
14
14
|
};
|
15
15
|
// 深层次对比两个对象且取出来差异值
|
16
16
|
var difference = exports.difference = function difference(object, base) {
|
17
|
-
var
|
17
|
+
var changes = function changes(object, base) {
|
18
18
|
return (0, _lodash.transform)(object, function (result, value, key) {
|
19
19
|
if (!(0, _lodash.isEqual)(value, base[key])) {
|
20
|
-
result[key] = (0, _lodash.isObject)(value) && (0, _lodash.isObject)(base[key]) ?
|
20
|
+
result[key] = (0, _lodash.isObject)(value) && (0, _lodash.isObject)(base[key]) ? changes(value, base[key]) : value;
|
21
21
|
}
|
22
22
|
});
|
23
23
|
};
|
24
|
-
return
|
24
|
+
return changes(object, base);
|
25
25
|
};
|
26
26
|
// 数组字段循环校验,解决validateFields无法批量校验的问题
|
27
27
|
var customValidate = exports.customValidate = function customValidate(validateKeys, form, rowName) {
|
@@ -214,7 +214,7 @@ var handleScrollToError = exports.handleScrollToError = function handleScrollToE
|
|
214
214
|
*/
|
215
215
|
function cloneDeepFilterNode(value) {
|
216
216
|
return (0, _lodash.cloneDeepWith)(value, function (val) {
|
217
|
-
if (/*#__PURE__*/_react.default.isValidElement(val)) {
|
217
|
+
if ( /*#__PURE__*/_react.default.isValidElement(val)) {
|
218
218
|
return val;
|
219
219
|
}
|
220
220
|
});
|
@@ -6,5 +6,5 @@ interface Props extends Pick<ProEnum, 'id' | 'value' | 'onChange' | 'dataSource'
|
|
6
6
|
allowClear?: boolean;
|
7
7
|
button?: boolean;
|
8
8
|
}
|
9
|
-
declare const Group: (props: Props) =>
|
9
|
+
declare const Group: (props: Props) => JSX.Element;
|
10
10
|
export default Group;
|
@@ -3,5 +3,5 @@ interface Props extends Pick<ProEnum, 'id' | 'value' | 'onChange' | 'dataSource'
|
|
3
3
|
fieldValue: string;
|
4
4
|
fieldLabel: string;
|
5
5
|
}
|
6
|
-
declare const ProEnumTag: (props: Props) =>
|
6
|
+
declare const ProEnumTag: (props: Props) => JSX.Element;
|
7
7
|
export default ProEnumTag;
|
@@ -59,7 +59,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
59
59
|
staleTime: 6e4 * 60
|
60
60
|
}, useRequest === null || useRequest === void 0 ? void 0 : useRequest.options), {}, {
|
61
61
|
setCache: function () {
|
62
|
-
var _setCache = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(res) {
|
62
|
+
var _setCache = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(res) {
|
63
63
|
var response, _locale$ProEnum2, _useRequest$options, ignoreCodes, cacheData;
|
64
64
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
65
65
|
while (1) switch (_context.prev = _context.next) {
|
@@ -169,7 +169,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
169
169
|
}
|
170
170
|
}));
|
171
171
|
var mergeData = /*#__PURE__*/function () {
|
172
|
-
var _ref3 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
172
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee2() {
|
173
173
|
var cacheData, _useRequest$options2, _useRequest$options3, enumData, cacheCodes, codes, ignoreCodes, diff, response, res, _locale$ProEnum6;
|
174
174
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee2$(_context2) {
|
175
175
|
while (1) switch (_context2.prev = _context2.next) {
|
package/lib/ProEnum/index.d.ts
CHANGED
@@ -2,8 +2,8 @@ import useEnum from './hooks/useEnum';
|
|
2
2
|
import { ProEnumProps } from './propsType';
|
3
3
|
import './style/index.less';
|
4
4
|
declare const ProEnum: {
|
5
|
-
(props: ProEnumProps):
|
6
|
-
getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) =>
|
5
|
+
(props: ProEnumProps): JSX.Element;
|
6
|
+
getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => JSX.Element;
|
7
7
|
useEnum: typeof useEnum;
|
8
8
|
};
|
9
9
|
export default ProEnum;
|
package/lib/ProEnum/index.js
CHANGED
@@ -158,7 +158,7 @@ var ProEnum = function ProEnum(props) {
|
|
158
158
|
list = [];
|
159
159
|
}
|
160
160
|
}
|
161
|
-
if (/*#__PURE__*/_react.default.isValidElement(component)) {
|
161
|
+
if ( /*#__PURE__*/_react.default.isValidElement(component)) {
|
162
162
|
var Component = component;
|
163
163
|
return (0, _jsxRuntime.jsx)(Component, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, enumProps), {}, {
|
164
164
|
dataSource: list,
|
@@ -10,7 +10,7 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
10
10
|
this.events = void 0;
|
11
11
|
this.events = new Map();
|
12
12
|
}
|
13
|
-
|
13
|
+
(0, _createClass2.default)(SimpleEventCenter, [{
|
14
14
|
key: "subscribe",
|
15
15
|
value: function subscribe(eventName, callback) {
|
16
16
|
if (!this.events.has(eventName)) {
|
@@ -37,5 +37,6 @@ var SimpleEventCenter = /*#__PURE__*/function () {
|
|
37
37
|
}
|
38
38
|
}
|
39
39
|
}]);
|
40
|
+
return SimpleEventCenter;
|
40
41
|
}(); // 将 eventCenter 实例添加到 window 对象上
|
41
42
|
window.eventCenter = new SimpleEventCenter();
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) =>
|
1
|
+
declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => JSX.Element;
|
2
2
|
export default getEnumLabel;
|
@@ -137,7 +137,7 @@ var ActionButton = function ActionButton(props) {
|
|
137
137
|
return _actionProps;
|
138
138
|
}, [props.actionProps]);
|
139
139
|
var handleClick = /*#__PURE__*/function () {
|
140
|
-
var _ref6 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, index, item) {
|
140
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, index, item) {
|
141
141
|
var value, data;
|
142
142
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
143
143
|
while (1) switch (_context.prev = _context.next) {
|
@@ -276,7 +276,7 @@ var ActionButton = function ActionButton(props) {
|
|
276
276
|
},
|
277
277
|
children: label
|
278
278
|
}))
|
279
|
-
}), "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index)) : (/*#__PURE__*/(0, _react.createElement)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(rest, filterKeys)), {}, {
|
279
|
+
}), "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index)) : ( /*#__PURE__*/(0, _react.createElement)(_antd.Button, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _lodash.omit)(rest, filterKeys)), {}, {
|
280
280
|
key: "".concat(item === null || item === void 0 ? void 0 : item.type).concat(index),
|
281
281
|
type: "text",
|
282
282
|
onClick: function onClick(e) {
|
@@ -20,7 +20,7 @@ var BlockTitle = function BlockTitle(props) {
|
|
20
20
|
if (!title) {
|
21
21
|
return (0, _jsxRuntime.jsx)("div", {});
|
22
22
|
}
|
23
|
-
if (/*#__PURE__*/_react.default.isValidElement(title)) {
|
23
|
+
if ( /*#__PURE__*/_react.default.isValidElement(title)) {
|
24
24
|
return title;
|
25
25
|
}
|
26
26
|
var titleContent = title;
|
@@ -61,7 +61,7 @@ var ToolbarButton = function ToolbarButton(props) {
|
|
61
61
|
return _toolbarProps;
|
62
62
|
}, [props.toolbarProps]);
|
63
63
|
var handleClick = /*#__PURE__*/function () {
|
64
|
-
var _ref2 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
|
64
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee(defaultCallback, callback, item) {
|
65
65
|
var value, data;
|
66
66
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
67
67
|
while (1) switch (_context.prev = _context.next) {
|
@@ -30,7 +30,7 @@ var namesPathTransform = exports.namesPathTransform = function namesPathTransfor
|
|
30
30
|
// 比较memo
|
31
31
|
var memoWith = exports.memoWith = function memoWith(pre, next) {
|
32
32
|
return (0, _lodash.isEqualWith)(pre, next, function (objValue, othValue) {
|
33
|
-
if (/*#__PURE__*/_react.default.isValidElement(objValue) && /*#__PURE__*/_react.default.isValidElement(othValue)) {
|
33
|
+
if ( /*#__PURE__*/_react.default.isValidElement(objValue) && /*#__PURE__*/_react.default.isValidElement(othValue)) {
|
34
34
|
return true;
|
35
35
|
}
|
36
36
|
// 移除解决formlist函数里不更新问题
|
@@ -76,7 +76,7 @@ var ComRender = function ComRender(props) {
|
|
76
76
|
children: viewRender(componentProps)
|
77
77
|
});
|
78
78
|
}
|
79
|
-
var Component = component ? (/*#__PURE__*/_react.default.cloneElement(component, (0, _objectSpread3.default)({}, componentProps))) : (0, _jsxRuntime.jsx)(TypeComponent, (0, _objectSpread3.default)({}, componentProps));
|
79
|
+
var Component = component ? ( /*#__PURE__*/_react.default.cloneElement(component, (0, _objectSpread3.default)({}, componentProps))) : (0, _jsxRuntime.jsx)(TypeComponent, (0, _objectSpread3.default)({}, componentProps));
|
80
80
|
var Com = getComRender(Component, props, componentProps);
|
81
81
|
return (0, _jsxRuntime.jsx)(_useFieldProps.FieldProvider, {
|
82
82
|
value: (0, _objectSpread3.default)((0, _objectSpread3.default)({}, contextProps), {}, {
|
@@ -33,7 +33,10 @@ var Group = function Group(props) {
|
|
33
33
|
onChange = props.onChange,
|
34
34
|
otherProps = props.otherProps,
|
35
35
|
id = props.id,
|
36
|
-
isParentView = props.isView
|
36
|
+
isParentView = props.isView,
|
37
|
+
formDisabled = props.disabled;
|
38
|
+
var _ref = otherProps || {},
|
39
|
+
desensitizationKey = _ref.desensitizationKey;
|
37
40
|
var contextProps = _ProForm.default.useFieldProps() || {};
|
38
41
|
var names = contextProps.names,
|
39
42
|
name = contextProps.name,
|
@@ -58,7 +61,9 @@ var Group = function Group(props) {
|
|
58
61
|
form: form,
|
59
62
|
index: index,
|
60
63
|
value: value,
|
61
|
-
groupProps: props
|
64
|
+
groupProps: props,
|
65
|
+
formDisabled: formDisabled,
|
66
|
+
desensitizationKey: desensitizationKey
|
62
67
|
});
|
63
68
|
var columns = (0, _utils.insertSeparator)(columnsProps, space);
|
64
69
|
var _className = (0, _classnames2.default)((0, _defineProperty2.default)({
|
@@ -50,4 +50,5 @@ export type GroupColumnProps<Values = any> = {
|
|
50
50
|
confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps>;
|
51
51
|
valuePropName?: string;
|
52
52
|
getValueProps?: (value: any) => Record<string, unknown>;
|
53
|
+
desensitization?: [number, number] | ReactiveFunction<Values, [number, number]>;
|
53
54
|
} & ColumnPropsMap & FormItemProps;
|
@@ -31,6 +31,7 @@ interface Params {
|
|
31
31
|
component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
|
32
32
|
fieldProps?: boolean | ReactiveFunction<any, boolean>;
|
33
33
|
name?: NamePath;
|
34
|
+
desensitization?: [number, number] | ReactiveFunction<any, [number, number]>;
|
34
35
|
}
|
35
36
|
/** 计算响应式参数的值 */
|
36
37
|
export declare const getReactiveProps: (params: Params) => {
|
@@ -38,10 +39,12 @@ export declare const getReactiveProps: (params: Params) => {
|
|
38
39
|
show: boolean;
|
39
40
|
component: any;
|
40
41
|
fieldProps: boolean;
|
42
|
+
desensitization: [number, number];
|
41
43
|
};
|
42
|
-
type ValueTypeGetterParams = Pick<ProFormColumnProps, 'valueType' | 'switchValue' | 'toISOString' | 'toCSTString'> & {
|
44
|
+
type ValueTypeGetterParams = Pick<ProFormColumnProps, 'valueType' | 'switchValue' | 'toISOString' | 'toCSTString' | 'disabled' | 'desensitization'> & {
|
43
45
|
type?: any;
|
44
46
|
mode?: string;
|
47
|
+
desensitizationKey?: string;
|
45
48
|
};
|
46
49
|
/** 获取当前字段的转换函数 */
|
47
50
|
export declare const getValueTypeTrans: (params: ValueTypeGetterParams) => any;
|
@@ -56,6 +59,8 @@ interface ColumnsTransformerParams {
|
|
56
59
|
namePath?: InternalNamePath;
|
57
60
|
form: FormInstance;
|
58
61
|
index?: number;
|
62
|
+
formDisabled?: boolean;
|
63
|
+
desensitizationKey?: string;
|
59
64
|
groupProps: GroupProps;
|
60
65
|
}
|
61
66
|
/** 转换columns */
|
@@ -128,7 +128,7 @@ var getReactiveProps = exports.getReactiveProps = function getReactiveProps(para
|
|
128
128
|
show = params.show,
|
129
129
|
component = params.component,
|
130
130
|
fieldProps = params.fieldProps,
|
131
|
-
|
131
|
+
desensitization = params.desensitization;
|
132
132
|
var values = namePath ? form.getFieldValue(namePath) : form.getFieldsValue();
|
133
133
|
var _disabled = (0, _lodash.isFunction)(disabled) ? disabled(values, {
|
134
134
|
form: form,
|
@@ -150,17 +150,31 @@ var getReactiveProps = exports.getReactiveProps = function getReactiveProps(para
|
|
150
150
|
index: index,
|
151
151
|
namePath: namePath
|
152
152
|
}) : fieldProps;
|
153
|
+
var _desensitization = (0, _lodash.isFunction)(desensitization) ? desensitization(values, {
|
154
|
+
form: form,
|
155
|
+
index: index,
|
156
|
+
namePath: namePath
|
157
|
+
}) : desensitization;
|
153
158
|
return {
|
154
159
|
disabled: _disabled,
|
155
160
|
show: _show,
|
156
161
|
component: _component,
|
157
|
-
fieldProps: _fieldProps
|
162
|
+
fieldProps: _fieldProps,
|
163
|
+
desensitization: _desensitization
|
158
164
|
};
|
159
165
|
};
|
160
166
|
/** 获取当前字段的转换函数 */
|
161
167
|
var getValueTypeTrans = exports.getValueTypeTrans = function getValueTypeTrans(params) {
|
162
168
|
var _valueTypeMap$valueTy;
|
169
|
+
var desensitizationKey = params.desensitizationKey;
|
163
170
|
var valueType = params.valueType;
|
171
|
+
var desensitization = params.desensitization,
|
172
|
+
disabled = params.disabled;
|
173
|
+
var isDesensit = sessionStorage.getItem(desensitizationKey);
|
174
|
+
// 仅查看模式下进行数据脱敏
|
175
|
+
if ((desensitization === null || desensitization === void 0 ? void 0 : desensitization.length) && disabled && isDesensit === 'ON') {
|
176
|
+
valueType = 'desensitization';
|
177
|
+
}
|
164
178
|
var transform = (_valueTypeMap$valueTy = _valueType.default[valueType]) === null || _valueTypeMap$valueTy === void 0 ? void 0 : _valueTypeMap$valueTy.call(_valueType.default, params);
|
165
179
|
return transform;
|
166
180
|
};
|
@@ -206,7 +220,9 @@ var useTransformColumns = exports.useTransformColumns = function useTransformCol
|
|
206
220
|
namePath = params.namePath,
|
207
221
|
value = params.value,
|
208
222
|
internalChange = params.onChange,
|
209
|
-
groupProps = params.groupProps
|
223
|
+
groupProps = params.groupProps,
|
224
|
+
formDisabled = params.formDisabled,
|
225
|
+
desensitizationKey = params.desensitizationKey;
|
210
226
|
var timerRef = (0, _react.useRef)([]);
|
211
227
|
return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
|
212
228
|
var type = column.type,
|
@@ -219,7 +235,8 @@ var useTransformColumns = exports.useTransformColumns = function useTransformCol
|
|
219
235
|
disabled = column.disabled,
|
220
236
|
show = column.show,
|
221
237
|
component = column.component,
|
222
|
-
clearNotShow = column.clearNotShow
|
238
|
+
clearNotShow = column.clearNotShow,
|
239
|
+
desensitization = column.desensitization;
|
223
240
|
var _ref = fieldProps || {},
|
224
241
|
mode = _ref.mode,
|
225
242
|
onChange = _ref.onChange,
|
@@ -260,19 +277,24 @@ var useTransformColumns = exports.useTransformColumns = function useTransformCol
|
|
260
277
|
show: show,
|
261
278
|
component: component,
|
262
279
|
fieldProps: fieldProps,
|
263
|
-
name: columnName
|
280
|
+
name: columnName,
|
281
|
+
desensitization: desensitization
|
264
282
|
});
|
265
283
|
}, changedCallback, [value, show, fieldProps, _disabled, columnName, type]);
|
266
284
|
if (reactiveProps.show === false) {
|
267
285
|
return [];
|
268
286
|
}
|
287
|
+
var isDisabled = formDisabled || _disabled || reactiveProps.disabled;
|
269
288
|
var transform = getValueTypeTrans({
|
270
289
|
type: type,
|
271
290
|
valueType: valueType,
|
272
291
|
switchValue: switchValue,
|
273
292
|
toISOString: toISOString,
|
274
293
|
toCSTString: toCSTString,
|
275
|
-
mode: mode
|
294
|
+
mode: mode,
|
295
|
+
desensitizationKey: desensitizationKey,
|
296
|
+
disabled: isDisabled,
|
297
|
+
desensitization: reactiveProps.desensitization
|
276
298
|
});
|
277
299
|
var newValue;
|
278
300
|
var handleChange = function handleChange() {
|
@@ -1,4 +1,4 @@
|
|
1
1
|
/// <reference types="react" />
|
2
2
|
import { ProCascaderProps } from './propsType';
|
3
|
-
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) =>
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderProps) => JSX.Element>;
|
4
4
|
export default _default;
|
@@ -29,9 +29,9 @@ var defaultFieldNames = {
|
|
29
29
|
value: 'code',
|
30
30
|
children: 'children'
|
31
31
|
};
|
32
|
-
var
|
32
|
+
var filterDataSource = function filterDataSource(dataSource, level, fieldNames) {
|
33
33
|
return dataSource === null || dataSource === void 0 ? void 0 : dataSource.map(function (item) {
|
34
|
-
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, item), {}, (0, _defineProperty2.default)({}, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children', level === 1 ? [] :
|
34
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, item), {}, (0, _defineProperty2.default)({}, (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children', level === 1 ? [] : filterDataSource(item === null || item === void 0 ? void 0 : item[(fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'], level - 1, fieldNames)));
|
35
35
|
});
|
36
36
|
};
|
37
37
|
var getViewLabel = function getViewLabel(_ref) {
|
@@ -108,7 +108,7 @@ var ProCascader = function ProCascader(props) {
|
|
108
108
|
}, [dics === null || dics === void 0 ? void 0 : dics[addressCode], enumData]);
|
109
109
|
var realDataSource = (0, _react.useMemo)(function () {
|
110
110
|
var innerDataSource = dataSource || (addressCode ? enumDataSource : []);
|
111
|
-
var result = (0, _index.transformDataName)(isAddressMode && realLevel === 2 ?
|
111
|
+
var result = (0, _index.transformDataName)(isAddressMode && realLevel === 2 ? filterDataSource(innerDataSource, level, fieldNames) : innerDataSource, fieldNames);
|
112
112
|
return result;
|
113
113
|
}, [isAddressMode, addressCode, realLevel, dataSource, enumDataSource === null || enumDataSource === void 0 ? void 0 : enumDataSource.length]);
|
114
114
|
var lastDisabled = (0, _react.useMemo)(function () {
|
@@ -130,7 +130,7 @@ var ProCascader = function ProCascader(props) {
|
|
130
130
|
defaultLabel = _useState4[0],
|
131
131
|
setDefaultLabel = _useState4[1];
|
132
132
|
var getFirstLevelOptions = /*#__PURE__*/function () {
|
133
|
-
var _ref4 = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
133
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
134
134
|
var _yield$service, data, newData, transFormData, serviceData;
|
135
135
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
136
136
|
while (1) switch (_context.prev = _context.next) {
|
@@ -149,7 +149,7 @@ var ProCascader = function ProCascader(props) {
|
|
149
149
|
value: fieldNames.value,
|
150
150
|
children: (fieldNames === null || fieldNames === void 0 ? void 0 : fieldNames.children) || 'children'
|
151
151
|
});
|
152
|
-
serviceData = isAddressMode && realLevel === 2 ?
|
152
|
+
serviceData = isAddressMode && realLevel === 2 ? filterDataSource(transFormData, level, fieldNames) : transFormData;
|
153
153
|
setServiceData(serviceData);
|
154
154
|
case 9:
|
155
155
|
case "end":
|
@@ -219,7 +219,7 @@ var ProCascader = function ProCascader(props) {
|
|
219
219
|
})) === null || _ref5$filter === void 0 ? void 0 : _ref5$filter.join(separator)) || '-' : (defaultLabel === null || defaultLabel === void 0 ? void 0 : (_defaultLabel$filter = defaultLabel.filter(function (item) {
|
220
220
|
return !!item;
|
221
221
|
})) === null || _defaultLabel$filter === void 0 ? void 0 : _defaultLabel$filter.join(separator)) || '-';
|
222
|
-
var
|
222
|
+
var findSelectedOptions = function findSelectedOptions(options, value) {
|
223
223
|
var path = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : [];
|
224
224
|
var _value = value !== null && value !== void 0 ? value : [];
|
225
225
|
// 基准情况:如果 value 数组为空,且 path 不为空,说明找到了完整的路径
|
@@ -238,7 +238,7 @@ var ProCascader = function ProCascader(props) {
|
|
238
238
|
if (foundOption) {
|
239
239
|
// 如果找到了匹配的选项,并且还有更多的 value 需要匹配,递归地在子选项中查找
|
240
240
|
if (_value.length > 1 && foundOption.children) {
|
241
|
-
return
|
241
|
+
return findSelectedOptions(foundOption.children, _value.slice(1), [].concat((0, _toConsumableArray2.default)(path), [foundOption]));
|
242
242
|
}
|
243
243
|
// 如果没有更多的 value 需要匹配,返回当前选项(以及之前的路径)
|
244
244
|
return [].concat((0, _toConsumableArray2.default)(path), [foundOption]);
|
@@ -247,7 +247,7 @@ var ProCascader = function ProCascader(props) {
|
|
247
247
|
return null;
|
248
248
|
};
|
249
249
|
var _selectedOptions = (0, _react.useMemo)(function () {
|
250
|
-
return
|
250
|
+
return findSelectedOptions(service ? serviceData : realDataSource, addressValue);
|
251
251
|
}, [service, serviceData, realDataSource, addressValue]);
|
252
252
|
var handleAddressChange = function handleAddressChange(e) {
|
253
253
|
var cascaderValue = value === null || value === void 0 ? void 0 : value.slice(0, realLevel);
|
@@ -33,7 +33,7 @@ var useDefaultOptions = function useDefaultOptions(options) {
|
|
33
33
|
});
|
34
34
|
};
|
35
35
|
var defaultService = /*#__PURE__*/function () {
|
36
|
-
var _ref = (0, _asyncToGenerator2.default)(/*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
36
|
+
var _ref = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
|
37
37
|
return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
|
38
38
|
while (1) switch (_context.prev = _context.next) {
|
39
39
|
case 0:
|