@zat-design/sisyphus-react 3.9.8-beta.1 → 3.9.8-beta.11

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.
Files changed (67) hide show
  1. package/dist/index.esm.css +0 -5
  2. package/dist/less.esm.css +0 -5
  3. package/es/ProEditTable/components/ActionButton/index.js +57 -9
  4. package/es/ProEditTable/components/RenderField/index.js +23 -14
  5. package/es/ProEditTable/components/RenderToolbar/index.js +18 -16
  6. package/es/ProEditTable/index.js +1 -1
  7. package/es/ProEditTable/propsType.d.ts +6 -3
  8. package/es/ProEditTable/utils/diffOriginal.d.ts +1 -1
  9. package/es/ProEditTable/utils/diffOriginal.js +21 -22
  10. package/es/ProEditTable/utils/index.js +35 -30
  11. package/es/ProEditTable/utils/tools.d.ts +1 -1
  12. package/es/ProEditTable/utils/tools.js +1 -1
  13. package/es/ProForm/components/combination/Group/index.js +7 -2
  14. package/es/ProForm/components/combination/Group/propsType.d.ts +1 -0
  15. package/es/ProForm/components/combination/Group/utils.d.ts +6 -1
  16. package/es/ProForm/components/combination/Group/utils.js +28 -6
  17. package/es/ProForm/components/render/Render.js +23 -11
  18. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  19. package/es/ProForm/components/render/RenderFields.js +8 -4
  20. package/es/ProForm/components/render/propsType.d.ts +3 -1
  21. package/es/ProForm/index.js +5 -2
  22. package/es/ProForm/propsType.d.ts +3 -0
  23. package/es/ProForm/utils/diffOriginal.js +9 -2
  24. package/es/ProForm/utils/useShouldUpdate.js +25 -5
  25. package/es/ProForm/utils/valueType.d.ts +8 -0
  26. package/es/ProForm/utils/valueType.js +99 -33
  27. package/es/ProLayout/components/ProHeader/style/index.less +0 -8
  28. package/es/ProTable/components/FormatColumn/index.js +1 -0
  29. package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
  30. package/es/ProTable/components/RenderColumn/index.js +10 -2
  31. package/es/ProTable/hooks/useAntdTable.js +4 -3
  32. package/es/ProTable/propsType.d.ts +2 -0
  33. package/es/ProTable/utils/index.d.ts +4 -0
  34. package/es/ProTable/utils/index.js +15 -0
  35. package/lib/ProEditTable/components/ActionButton/index.js +57 -9
  36. package/lib/ProEditTable/components/RenderField/index.js +22 -13
  37. package/lib/ProEditTable/components/RenderToolbar/index.js +18 -16
  38. package/lib/ProEditTable/index.js +1 -1
  39. package/lib/ProEditTable/propsType.d.ts +6 -3
  40. package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -1
  41. package/lib/ProEditTable/utils/diffOriginal.js +21 -22
  42. package/lib/ProEditTable/utils/index.js +35 -30
  43. package/lib/ProEditTable/utils/tools.d.ts +1 -1
  44. package/lib/ProEditTable/utils/tools.js +1 -1
  45. package/lib/ProForm/components/combination/Group/index.js +7 -2
  46. package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -0
  47. package/lib/ProForm/components/combination/Group/utils.d.ts +6 -1
  48. package/lib/ProForm/components/combination/Group/utils.js +28 -6
  49. package/lib/ProForm/components/render/Render.js +23 -11
  50. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  51. package/lib/ProForm/components/render/RenderFields.js +8 -4
  52. package/lib/ProForm/components/render/propsType.d.ts +3 -1
  53. package/lib/ProForm/index.js +5 -2
  54. package/lib/ProForm/propsType.d.ts +3 -0
  55. package/lib/ProForm/utils/diffOriginal.js +9 -2
  56. package/lib/ProForm/utils/useShouldUpdate.js +25 -5
  57. package/lib/ProForm/utils/valueType.d.ts +8 -0
  58. package/lib/ProForm/utils/valueType.js +100 -34
  59. package/lib/ProLayout/components/ProHeader/style/index.less +0 -8
  60. package/lib/ProTable/components/FormatColumn/index.js +1 -0
  61. package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
  62. package/lib/ProTable/components/RenderColumn/index.js +10 -2
  63. package/lib/ProTable/hooks/useAntdTable.js +3 -2
  64. package/lib/ProTable/propsType.d.ts +2 -0
  65. package/lib/ProTable/utils/index.d.ts +4 -0
  66. package/lib/ProTable/utils/index.js +17 -1
  67. package/package.json +2 -1
@@ -915,11 +915,6 @@
915
915
  background: #fff;
916
916
  letter-spacing: 2px;
917
917
  }
918
- .pro-header .pro-header-describe .ant-space .pro-header-describe-value .pro-header-describe-items.pro-header-describe-items-more .pro-header-tag {
919
- padding: 0;
920
- background: transparent !important;
921
- color: #333;
922
- }
923
918
  .pro-header .pro-header-copy {
924
919
  display: -webkit-box;
925
920
  display: -webkit-flex;
package/dist/less.esm.css CHANGED
@@ -915,11 +915,6 @@
915
915
  background: #fff;
916
916
  letter-spacing: 2px;
917
917
  }
918
- .pro-header .pro-header-describe .ant-space .pro-header-describe-value .pro-header-describe-items.pro-header-describe-items-more .pro-header-tag {
919
- padding: 0;
920
- background: transparent !important;
921
- color: #333;
922
- }
923
918
  .pro-header .pro-header-copy {
924
919
  display: -webkit-box;
925
920
  display: -webkit-flex;
@@ -3,6 +3,7 @@ import _Button from "antd/es/button";
3
3
  import "antd/es/popconfirm/style";
4
4
  import _Popconfirm from "antd/es/popconfirm";
5
5
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
6
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
6
7
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
7
8
  import React from 'react';
8
9
  import { isFunction, omit } from 'lodash';
@@ -22,13 +23,20 @@ var ActionButton = function ActionButton(_ref) {
22
23
  deletePoConfirmMsg = config.deletePoConfirmMsg,
23
24
  mulDeletePoConfirmMsg = config.mulDeletePoConfirmMsg,
24
25
  max = config.max,
25
- tableLength = config.tableLength;
26
+ name = config.name,
27
+ tableLength = config.tableLength,
28
+ selectedRows = config.selectedRows;
29
+ var rowNamePath = [].concat(_toConsumableArray(name), [index]);
26
30
  // 操作按钮权限控制
27
31
  var getShow = function getShow(show) {
28
32
  if (typeof show === 'function') {
29
33
  return show(record, {
30
34
  index: index,
31
- form: form
35
+ form: form,
36
+ name: name,
37
+ namePath: rowNamePath,
38
+ tableLength: tableLength,
39
+ selectedRows: selectedRows
32
40
  });
33
41
  }
34
42
  return show;
@@ -38,7 +46,11 @@ var ActionButton = function ActionButton(_ref) {
38
46
  if (typeof disabled === 'function') {
39
47
  return disabled(record, {
40
48
  index: index,
41
- form: form
49
+ form: form,
50
+ name: name,
51
+ namePath: rowNamePath,
52
+ tableLength: tableLength,
53
+ selectedRows: selectedRows
42
54
  });
43
55
  }
44
56
  // 新增超过最大行,禁止操作按钮
@@ -60,14 +72,29 @@ var ActionButton = function ActionButton(_ref) {
60
72
  // 其他操作按钮Props
61
73
  var actionBtnProps = _objectSpread(_objectSpread({}, btnConfig.buttonProps), {}, {
62
74
  onClick: function onClick() {
63
- btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
75
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, {
76
+ index: index,
77
+ form: form,
78
+ name: name,
79
+ namePath: rowNamePath,
80
+ tableLength: tableLength,
81
+ selectedRows: selectedRows
82
+ });
64
83
  },
65
84
  disabled: getDisabled((_btnConfig$buttonProp3 = btnConfig.buttonProps) === null || _btnConfig$buttonProp3 === void 0 ? void 0 : _btnConfig$buttonProp3.disabled)
66
85
  });
67
86
  // 当传入函数时,先转成reactNode
68
87
  if (isFunction(btnConfig.label)) {
69
- btnConfig.label = _jsx(btnConfig.label, {
70
- form: form
88
+ var addIndex = tableLength ? tableLength - 1 : 0;
89
+ var namePath = [].concat(_toConsumableArray(name), [addIndex]);
90
+ var addRecord = form.getFieldValue(namePath) || {};
91
+ btnConfig.label = btnConfig.label(addRecord, {
92
+ form: form,
93
+ namePath: namePath,
94
+ name: name,
95
+ tableLength: tableLength,
96
+ selectedRows: selectedRows,
97
+ index: addIndex
71
98
  });
72
99
  }
73
100
  var isDisabled = !selectedRowKeys.length && btnConfig.type === 'mulDelete' || editingKeys.length || (delBtnProps === null || delBtnProps === void 0 ? void 0 : delBtnProps.disabled);
@@ -77,7 +104,14 @@ var ActionButton = function ActionButton(_ref) {
77
104
  placement: "topRight",
78
105
  title: deleteMsgMap[btnConfig.type],
79
106
  onConfirm: function onConfirm() {
80
- btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
107
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, {
108
+ index: index,
109
+ form: form,
110
+ name: name,
111
+ namePath: rowNamePath,
112
+ tableLength: tableLength,
113
+ selectedRows: selectedRows
114
+ });
81
115
  },
82
116
  disabled: isDisabled,
83
117
  okText: locale.ProEditTable.confirm,
@@ -97,13 +131,27 @@ var ActionButton = function ActionButton(_ref) {
97
131
  index: index,
98
132
  disabled: isDisabled,
99
133
  onClick: function onClick() {
100
- btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
134
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, {
135
+ index: index,
136
+ form: form,
137
+ name: name,
138
+ namePath: rowNamePath,
139
+ tableLength: tableLength,
140
+ selectedRows: selectedRows
141
+ });
101
142
  }
102
143
  }))) : _jsx(_Button, _objectSpread(_objectSpread({}, omit(delBtnProps, ['buttonProps', 'isEditable', 'onEvent'])), {}, {
103
144
  disabled: isDisabled,
104
145
  type: "link",
105
146
  onClick: function onClick() {
106
- btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, index);
147
+ btnConfig === null || btnConfig === void 0 ? void 0 : btnConfig.onEvent(record, {
148
+ index: index,
149
+ form: form,
150
+ name: name,
151
+ namePath: rowNamePath,
152
+ tableLength: tableLength,
153
+ selectedRows: selectedRows
154
+ });
107
155
  },
108
156
  children: btnConfig.label
109
157
  }))
@@ -6,11 +6,11 @@ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
6
6
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
7
7
  import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
8
8
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
9
- var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "onDiff", "className", "trim", "confirm", "dependencies"];
9
+ var _excluded = ["type", "valueType", "names", "fieldProps", "labelRequired", "editRender", "component", "viewRender", "title", "originTitle", "label", "dataIndex", "formItemProps", "isEditable", "required", "rules", "onDiff", "className", "trim", "confirm", "dependencies", "desensitization"];
10
10
  import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
11
11
  /* eslint-disable prefer-destructuring */
12
12
  /* eslint-disable prefer-const */
13
- import React, { useCallback, useEffect } from 'react';
13
+ import React, { useEffect } from 'react';
14
14
  import classNames from 'classnames';
15
15
  import { cloneDeep, isEqual, debounce, omit, isFunction } from 'lodash';
16
16
  import valueTypeMap from '../../../ProForm/utils/valueType';
@@ -57,6 +57,7 @@ var RenderField = function RenderField(_ref) {
57
57
  trim = column.trim,
58
58
  confirm = column.confirm,
59
59
  dependencies = column.dependencies,
60
+ desensitization = column.desensitization,
60
61
  resetProps = _objectWithoutProperties(column, _excluded);
61
62
  // editRender弃用使用component同ProForm
62
63
  var _editRender = component || editRender;
@@ -82,6 +83,7 @@ var RenderField = function RenderField(_ref) {
82
83
  var _required = required;
83
84
  var _valueType = valueType;
84
85
  var _disabled = false;
86
+ var _desensitization = desensitization || [];
85
87
  var isCell = mode === 'cell';
86
88
  if (isCell) {
87
89
  record['is-view'] = !isEqual(cellNamePath, cellName);
@@ -118,6 +120,9 @@ var RenderField = function RenderField(_ref) {
118
120
  if (isFunction(valueType)) {
119
121
  _valueType = valueType.apply(void 0, rowParams);
120
122
  }
123
+ if (isFunction(desensitization)) {
124
+ _desensitization = desensitization.apply(void 0, rowParams);
125
+ }
121
126
  // 获取最终的disabled
122
127
  _disabled = getDisabled({
123
128
  globalControl: otherProps === null || otherProps === void 0 ? void 0 : otherProps.globalControl,
@@ -129,9 +134,9 @@ var RenderField = function RenderField(_ref) {
129
134
  });
130
135
  if (typeof isEditable === 'function') {
131
136
  isEditable = isEditable.apply(void 0, rowParams);
132
- setTimeout(function () {
133
- !isEditable && form.validateFields([cellName]);
134
- }, 100);
137
+ // setTimeout(() => {
138
+ // !isEditable && form.validateFields([cellName]);
139
+ // }, 100);
135
140
  }
136
141
  // 是否只读文本
137
142
  var isView = !isEditable || (record === null || record === void 0 ? void 0 : record['is-view']) || config.isView || virtualKey && !isEditing || getDisabled({
@@ -189,21 +194,23 @@ var RenderField = function RenderField(_ref) {
189
194
  * 配置valueType时,基于formItem的normalize与getValueProps进行值类型转换
190
195
  * @returns {}
191
196
  */
192
- var valueTypeTransform = useCallback(function () {
193
- var _fieldProps3;
194
- // 不存在valueType返回空
195
- if (!_valueType) {
196
- return {};
197
- }
197
+ var valueTypeTransform = function valueTypeTransform() {
198
+ var _fieldProps3, _desensitization2;
198
199
  // SwitchCheckbox默认YN, 兼容已有组件
199
200
  if (type === 'SwitchCheckbox') {
200
201
  _valueType = 'switch';
201
202
  }
202
203
  var params = _objectSpread(_objectSpread({}, column), {}, {
203
- mode: (_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.mode
204
+ mode: (_fieldProps3 = _fieldProps) === null || _fieldProps3 === void 0 ? void 0 : _fieldProps3.mode,
205
+ desensitization: _desensitization
204
206
  });
207
+ var isDesensit = sessionStorage.getItem(otherProps === null || otherProps === void 0 ? void 0 : otherProps.desensitizationKey);
208
+ // 仅查看模式下进行数据脱敏
209
+ if (((_desensitization2 = _desensitization) === null || _desensitization2 === void 0 ? void 0 : _desensitization2.length) && _disabled && isDesensit === 'ON') {
210
+ _valueType = 'desensitization';
211
+ }
205
212
  return isFunction(valueTypeMap[_valueType]) ? valueTypeMap[_valueType](params) : {};
206
- }, [_valueType]);
213
+ };
207
214
  if ((_names = names) === null || _names === void 0 ? void 0 : _names.length) {
208
215
  // 支持names配置,临时生成对应的formItem,用来存储单个对应的值
209
216
  names = names.map(function (key) {
@@ -517,6 +524,7 @@ var RenderField = function RenderField(_ref) {
517
524
  onBlur: _onblur,
518
525
  index: index,
519
526
  confirm: confirm,
527
+ desensitization: _desensitization,
520
528
  otherProps: {
521
529
  form: form,
522
530
  names: names,
@@ -525,7 +533,8 @@ var RenderField = function RenderField(_ref) {
525
533
  listName: cellName,
526
534
  viewEmpty: viewEmpty,
527
535
  valueType: _valueType,
528
- isView: isView
536
+ isView: isView,
537
+ desensitizationKey: otherProps === null || otherProps === void 0 ? void 0 : otherProps.desensitizationKey
529
538
  }
530
539
  });
531
540
  componentProps = omit(componentProps, ['onFieldChange', 'namePath', 'index']);
@@ -17,12 +17,9 @@ var RenderToolbar = function RenderToolbar(config) {
17
17
  toolbarProps = config.toolbarProps,
18
18
  name = config.name,
19
19
  virtualKey = config.virtualKey,
20
- form = config.form,
21
20
  disabled = config.disabled,
22
- selectedRows = config.selectedRows,
23
21
  tableLength = config.tableLength;
24
22
  var virtualName = getNamePath(name, virtualKey);
25
- var dataSource = form.getFieldValue(name);
26
23
  // toolbarProps配置为false 默认不插入
27
24
  if (toolbarProps === false || disabled) {
28
25
  return null;
@@ -76,29 +73,34 @@ var RenderToolbar = function RenderToolbar(config) {
76
73
  toolbar.show = show !== null && show !== void 0 ? show : true;
77
74
  toolbar.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
78
75
  toolbar.onEvent = /*#__PURE__*/function () {
79
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, index) {
80
- var onEvent, result;
76
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, _ref) {
77
+ var index, form, name, namePath, tableLength, selectedRows, onEvent, result;
81
78
  return _regeneratorRuntime().wrap(function _callee$(_context) {
82
79
  while (1) switch (_context.prev = _context.next) {
83
80
  case 0:
81
+ index = _ref.index, form = _ref.form, name = _ref.name, namePath = _ref.namePath, tableLength = _ref.tableLength, selectedRows = _ref.selectedRows;
84
82
  onEvent = onClick || onHandle;
85
83
  if (onEvent) {
86
- _context.next = 5;
84
+ _context.next = 6;
87
85
  break;
88
86
  }
89
87
  result = true;
90
- _context.next = 8;
88
+ _context.next = 9;
91
89
  break;
92
- case 5:
93
- _context.next = 7;
94
- return onEvent === null || onEvent === void 0 ? void 0 : onEvent(selectedRows, dataSource, {
90
+ case 6:
91
+ _context.next = 8;
92
+ return onEvent === null || onEvent === void 0 ? void 0 : onEvent(record, {
93
+ index: index,
95
94
  form: form,
96
- namePath: virtualName
95
+ name: name,
96
+ namePath: namePath,
97
+ tableLength: tableLength,
98
+ selectedRows: selectedRows
97
99
  });
98
- case 7:
99
- result = _context.sent;
100
100
  case 8:
101
- if (result && type !== 'custom') {
101
+ result = _context.sent;
102
+ case 9:
103
+ if (result !== false && type !== 'custom') {
102
104
  actions[type](_objectSpread(_objectSpread({}, config), {}, {
103
105
  index: index,
104
106
  record: record,
@@ -107,14 +109,14 @@ var RenderToolbar = function RenderToolbar(config) {
107
109
  virtualName: virtualName
108
110
  }));
109
111
  }
110
- case 9:
112
+ case 10:
111
113
  case "end":
112
114
  return _context.stop();
113
115
  }
114
116
  }, _callee);
115
117
  }));
116
118
  return function (_x, _x2) {
117
- return _ref.apply(this, arguments);
119
+ return _ref2.apply(this, arguments);
118
120
  };
119
121
  }();
120
122
  toolbar.buttonProps = buttonProps;
@@ -297,7 +297,7 @@ var ProEditTable = function ProEditTable(_ref, ref) {
297
297
  }, [value, config.name]);
298
298
  var _columns = useMemo(function () {
299
299
  return transformColumns(columns, config);
300
- }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath]);
300
+ }, [valueChangeRef.current, disabled, forceUpdate, columns, page, actionProps, editingKeys, cellNamePath, value === null || value === void 0 ? void 0 : value.length]);
301
301
  var initDataSource = function initDataSource() {
302
302
  var _value$every, _value$some;
303
303
  var isAllHasKey = value === null || value === void 0 ? void 0 : (_value$every = value.every) === null || _value$every === void 0 ? void 0 : _value$every.call(value, function (item) {
@@ -11,9 +11,12 @@ import { ProFormValueType, ColumnPropsMap } from '../ProForm/components/render/p
11
11
  import { DiffOriginalParams } from '../ProForm/utils/diffOriginal';
12
12
  export type ActionType = 'edit' | 'delete' | 'save' | 'cancel' | 'add' | 'mulDelete' | 'custom';
13
13
  export type ShowFunction<T> = (record?: T, options?: {
14
- index?: number;
15
- form?: FormInstance;
16
- namePath?: NamePath;
14
+ index: number;
15
+ form: FormInstance;
16
+ name: NamePath;
17
+ namePath: NamePath;
18
+ tableLength: number;
19
+ selectedRows: T[];
17
20
  }) => Promise<any> | boolean | void;
18
21
  export interface OptionsProps {
19
22
  index: number;
@@ -4,7 +4,7 @@ export interface DiffOriginalParams {
4
4
  originalValue: any;
5
5
  value: any;
6
6
  form: FormInstance;
7
- equalWith?: ({ originValue, originRecord, value, record, index }: {
7
+ equalWith?: ({ originValue, originRecord, value, record, index, }: {
8
8
  originValue: any;
9
9
  originRecord: any;
10
10
  value: any;
@@ -4,7 +4,20 @@ var isEmpty = validate.isEmpty;
4
4
  // 过滤对象中undefined字段
5
5
  // 防止{a: '1'} {a: '1', b: undefined | null}被认为不相等
6
6
  var filterObject = function filterObject(data) {
7
- if (!isObject(data) || Array.isArray(data) || data === null) return data;
7
+ if (!isObject(data) || data === null) return data;
8
+ // ['1', undefined] ['1', ''] 视为相等
9
+ if (Array.isArray(data)) {
10
+ // 数组中全是empty值的话 视为null
11
+ var isFillNull = true;
12
+ var arr = data.map(function (item) {
13
+ if (isEmpty(item)) {
14
+ return null;
15
+ }
16
+ isFillNull = false;
17
+ return item;
18
+ });
19
+ return isFillNull ? null : arr;
20
+ }
8
21
  var resData = {};
9
22
  Object.keys(data).forEach(function (key) {
10
23
  if (!isEmpty(data[key])) {
@@ -41,25 +54,11 @@ export var diffOriginal = function diffOriginal(params) {
41
54
  }
42
55
  var _value = filterObject(value);
43
56
  var _originalValue = filterObject(originalValue);
44
- // 如果原始值为空 且当前有值的话 认为变更类型是新增
45
- if (isEmpty(_originalValue) && !isEmpty(_value)) {
46
- return 'add';
47
- }
48
- if (Array.isArray(_originalValue)) {
49
- if ((_originalValue === null || _originalValue === void 0 ? void 0 : _originalValue.length) === (_value === null || _value === void 0 ? void 0 : _value.length)) {
50
- var isSame = _originalValue.every(function (valueItem, index) {
51
- // 如果两个值有一个不是空值, 则进行深比较
52
- if (!isEmpty(value === null || value === void 0 ? void 0 : value[index]) || !isEmpty(valueItem)) {
53
- return isEqual(value === null || value === void 0 ? void 0 : value[index], valueItem);
54
- }
55
- return true;
56
- });
57
- return isSame ? 'same' : 'changed';
58
- }
59
- return 'changed';
60
- }
61
- if (!isEmpty(_originalValue) || !isEmpty(_value)) {
62
- return isEqual(_value, _originalValue) ? 'same' : 'changed';
63
- }
64
- return 'same';
57
+ var isEmptyVal = isEmpty(_value);
58
+ var isEmptyOrg = isEmpty(_originalValue);
59
+ // 都为空视为相等
60
+ if (isEmptyOrg && isEmptyVal) return 'same';
61
+ // 如果原始值为空 且当前有值的话 视为新增
62
+ if (isEmptyOrg && !isEmptyVal) return 'add';
63
+ return isEqual(_value, _originalValue) ? 'same' : 'changed';
65
64
  };
@@ -83,49 +83,54 @@ var getActionColumn = function getActionColumn(config) {
83
83
  action.show = show !== null && show !== void 0 ? show : true;
84
84
  action.needConfirm = needConfirm !== null && needConfirm !== void 0 ? needConfirm : true;
85
85
  action.onEvent = /*#__PURE__*/function () {
86
- var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, index) {
86
+ var _ref2 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee(record, _ref) {
87
87
  var _form$getFieldValue;
88
- var rowName, _record, onEvent, result;
88
+ var index, form, name, namePath, tableLength, selectedRows, rowName, _record, onEvent, result;
89
89
  return _regeneratorRuntime().wrap(function _callee$(_context) {
90
90
  while (1) switch (_context.prev = _context.next) {
91
91
  case 0:
92
+ index = _ref.index, form = _ref.form, name = _ref.name, namePath = _ref.namePath, tableLength = _ref.tableLength, selectedRows = _ref.selectedRows;
92
93
  index = tools.calc(firstIndex, '+', index);
93
94
  rowName = [].concat(_toConsumableArray(virtualRowName), [index]);
94
95
  if (!(type === 'save')) {
95
- _context.next = 12;
96
+ _context.next = 13;
96
97
  break;
97
98
  }
98
- _context.prev = 3;
99
- _context.next = 6;
99
+ _context.prev = 4;
100
+ _context.next = 7;
100
101
  return customValidate(validateKeys, form, rowName);
101
- case 6:
102
- _context.next = 12;
102
+ case 7:
103
+ _context.next = 13;
103
104
  break;
104
- case 8:
105
- _context.prev = 8;
106
- _context.t0 = _context["catch"](3);
105
+ case 9:
106
+ _context.prev = 9;
107
+ _context.t0 = _context["catch"](4);
107
108
  handleScrollToError();
108
109
  return _context.abrupt("return", Promise.reject(_context.t0));
109
- case 12:
110
+ case 13:
110
111
  // 编辑状态使用自定义form值,非编辑状态直接使用行数据
111
112
  _record = (_form$getFieldValue = form.getFieldValue(rowName)) !== null && _form$getFieldValue !== void 0 ? _form$getFieldValue : record; // 新增事件可以设置初始默认值,当做函数的出参导出
112
113
  onEvent = onClick || onHandle;
113
114
  if (onEvent) {
114
- _context.next = 18;
115
+ _context.next = 19;
115
116
  break;
116
117
  }
117
118
  result = true;
118
- _context.next = 21;
119
+ _context.next = 22;
119
120
  break;
120
- case 18:
121
- _context.next = 20;
122
- return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, index, {
121
+ case 19:
122
+ _context.next = 21;
123
+ return onEvent === null || onEvent === void 0 ? void 0 : onEvent(_record, {
123
124
  form: form,
124
- namePath: virtualRowName
125
+ index: index,
126
+ tableLength: tableLength,
127
+ name: name,
128
+ namePath: namePath,
129
+ selectedRows: selectedRows
125
130
  });
126
- case 20:
127
- result = _context.sent;
128
131
  case 21:
132
+ result = _context.sent;
133
+ case 22:
129
134
  if (result !== false && type !== 'custom') {
130
135
  actions[type](_objectSpread(_objectSpread({}, config), {}, {
131
136
  rowName: [].concat(_toConsumableArray(name), [index]),
@@ -135,14 +140,14 @@ var getActionColumn = function getActionColumn(config) {
135
140
  validateKeys: validateKeys
136
141
  }));
137
142
  }
138
- case 22:
143
+ case 23:
139
144
  case "end":
140
145
  return _context.stop();
141
146
  }
142
- }, _callee, null, [[3, 8]]);
147
+ }, _callee, null, [[4, 9]]);
143
148
  }));
144
149
  return function (_x, _x2) {
145
- return _ref.apply(this, arguments);
150
+ return _ref2.apply(this, arguments);
146
151
  };
147
152
  }();
148
153
  action.buttonProps = buttonProps;
@@ -225,10 +230,10 @@ export var transformColumns = function transformColumns() {
225
230
  if (typeof columnTitle === 'string') {
226
231
  item.originTitle = columnTitle;
227
232
  if (tooltip) {
228
- var _ref2 = tooltip || {},
229
- tooltipTitle = _ref2.title,
230
- icon = _ref2.icon,
231
- resetProps = _objectWithoutProperties(_ref2, _excluded2);
233
+ var _ref3 = tooltip || {},
234
+ tooltipTitle = _ref3.title,
235
+ icon = _ref3.icon,
236
+ resetProps = _objectWithoutProperties(_ref3, _excluded2);
232
237
  item.title = _jsxs("span", {
233
238
  className: "pro-edit-table-title pro-edit-table-tooltip",
234
239
  children: [before, columnTitle, _jsx(_Tooltip, _objectSpread(_objectSpread({
@@ -388,13 +393,13 @@ export var transformColumns = function transformColumns() {
388
393
  // cacheMap 用来存储缓存值,若有值后不再请求
389
394
  if (JSON.stringify(cacheMap.current) === '{}') {
390
395
  Promise.all(Object.entries(_cacheMap).map(/*#__PURE__*/function () {
391
- var _ref3 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
392
- var _item, key, value, _ref4, service, option;
396
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee2(item) {
397
+ var _item, key, value, _ref5, service, option;
393
398
  return _regeneratorRuntime().wrap(function _callee2$(_context2) {
394
399
  while (1) switch (_context2.prev = _context2.next) {
395
400
  case 0:
396
401
  _item = _slicedToArray(item, 2), key = _item[0], value = _item[1];
397
- _ref4 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref4.service, option = _ref4.option;
402
+ _ref5 = (value === null || value === void 0 ? void 0 : value.useRequest) || {}, service = _ref5.service, option = _ref5.option;
398
403
  if (!service) {
399
404
  _context2.next = 8;
400
405
  break;
@@ -414,7 +419,7 @@ export var transformColumns = function transformColumns() {
414
419
  }, _callee2);
415
420
  }));
416
421
  return function (_x3) {
417
- return _ref3.apply(this, arguments);
422
+ return _ref4.apply(this, arguments);
418
423
  };
419
424
  }())).then(function (res) {
420
425
  res.forEach(function (item) {
@@ -7,7 +7,7 @@ export declare const customValidate: (validateKeys: any, form: any, rowName: any
7
7
  * @returns string
8
8
  */
9
9
  export declare const splitNames: (names: any[]) => any;
10
- export declare const getNamePath: (name: any, virtualKey: any) => any;
10
+ export declare const getNamePath: (name: any, virtualKey: any) => any[];
11
11
  export declare const onDelete: ({ name, form, virtualKey, selectedRowKeys }: {
12
12
  name: any;
13
13
  form: any;
@@ -45,7 +45,7 @@ export var splitNames = function splitNames(names) {
45
45
  };
46
46
  // 获取中间formItem的name
47
47
  export var getNamePath = function getNamePath(name, virtualKey) {
48
- var nextName = cloneDeep(name);
48
+ var nextName = cloneDeep(Array.isArray(name) ? name : [name]);
49
49
  var lastValue = nextName[nextName.length - 1];
50
50
  nextName[nextName.length - 1] = "".concat(lastValue).concat(virtualKey ? "-".concat(virtualKey) : '');
51
51
  return nextName;
@@ -27,7 +27,10 @@ var Group = function Group(props) {
27
27
  onChange = props.onChange,
28
28
  otherProps = props.otherProps,
29
29
  id = props.id,
30
- isParentView = props.isView;
30
+ isParentView = props.isView,
31
+ formDisabled = props.disabled;
32
+ var _ref = otherProps || {},
33
+ desensitizationKey = _ref.desensitizationKey;
31
34
  var contextProps = ProForm.useFieldProps() || {};
32
35
  var names = contextProps.names,
33
36
  name = contextProps.name,
@@ -52,7 +55,9 @@ var Group = function Group(props) {
52
55
  form: form,
53
56
  index: index,
54
57
  value: value,
55
- groupProps: props
58
+ groupProps: props,
59
+ formDisabled: formDisabled,
60
+ desensitizationKey: desensitizationKey
56
61
  });
57
62
  var columns = insertSeparator(columnsProps, space);
58
63
  var _className = classnames(_defineProperty({
@@ -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 */