@zat-design/sisyphus-react 3.9.8-beta.3 → 3.9.8-beta.5

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 (70) hide show
  1. package/es/ProEditTable/utils/diffOriginal.d.ts +1 -1
  2. package/es/ProEditTable/utils/diffOriginal.js +21 -22
  3. package/es/ProForm/components/combination/Group/index.js +7 -2
  4. package/es/ProForm/components/combination/Group/propsType.d.ts +1 -0
  5. package/es/ProForm/components/combination/Group/utils.d.ts +6 -1
  6. package/es/ProForm/components/combination/Group/utils.js +28 -6
  7. package/es/ProForm/components/render/Render.js +12 -8
  8. package/es/ProForm/components/render/RenderFields.d.ts +1 -0
  9. package/es/ProForm/components/render/RenderFields.js +4 -2
  10. package/es/ProForm/components/render/propsType.d.ts +1 -1
  11. package/es/ProForm/index.js +5 -2
  12. package/es/ProForm/propsType.d.ts +3 -0
  13. package/es/ProForm/utils/diffOriginal.js +9 -2
  14. package/es/ProForm/utils/valueType.d.ts +1 -3
  15. package/es/ProForm/utils/valueType.js +33 -3
  16. package/lib/ProEditTable/utils/diffOriginal.d.ts +1 -1
  17. package/lib/ProEditTable/utils/diffOriginal.js +21 -22
  18. package/lib/ProForm/components/combination/Group/index.js +7 -2
  19. package/lib/ProForm/components/combination/Group/propsType.d.ts +1 -0
  20. package/lib/ProForm/components/combination/Group/utils.d.ts +6 -1
  21. package/lib/ProForm/components/combination/Group/utils.js +28 -6
  22. package/lib/ProForm/components/render/Render.js +12 -8
  23. package/lib/ProForm/components/render/RenderFields.d.ts +1 -0
  24. package/lib/ProForm/components/render/RenderFields.js +4 -2
  25. package/lib/ProForm/components/render/propsType.d.ts +1 -1
  26. package/lib/ProForm/index.js +5 -2
  27. package/lib/ProForm/propsType.d.ts +3 -0
  28. package/lib/ProForm/utils/diffOriginal.js +9 -2
  29. package/lib/ProForm/utils/valueType.d.ts +1 -3
  30. package/lib/ProForm/utils/valueType.js +33 -3
  31. package/package.json +1 -1
  32. package/coverage/lcov-report/src/.umi/core/devScripts.ts.html +0 -241
  33. package/coverage/lcov-report/src/.umi/core/history.ts.html +0 -148
  34. package/coverage/lcov-report/src/.umi/core/index.html +0 -206
  35. package/coverage/lcov-report/src/.umi/core/plugin.ts.html +0 -109
  36. package/coverage/lcov-report/src/.umi/core/pluginRegister.ts.html +0 -160
  37. package/coverage/lcov-report/src/.umi/core/polyfill.ts.html +0 -97
  38. package/coverage/lcov-report/src/.umi/core/routes.ts.html +0 -26050
  39. package/coverage/lcov-report/src/.umi/core/umiExports.ts.html +0 -112
  40. package/coverage/lcov-report/src/.umi/dumi/demos/index.html +0 -116
  41. package/coverage/lcov-report/src/.umi/dumi/demos/index.ts.html +0 -6340
  42. package/coverage/lcov-report/src/.umi/dumi/index.html +0 -116
  43. package/coverage/lcov-report/src/.umi/dumi/layout.tsx.html +0 -109
  44. package/coverage/lcov-report/src/.umi/index.html +0 -116
  45. package/coverage/lcov-report/src/.umi/plugin-antd/index.html +0 -116
  46. package/coverage/lcov-report/src/.umi/plugin-antd/runtime.tsx.html +0 -172
  47. package/coverage/lcov-report/src/.umi/plugin-helmet/exports.ts.html +0 -94
  48. package/coverage/lcov-report/src/.umi/plugin-helmet/index.html +0 -116
  49. package/coverage/lcov-report/src/.umi/plugin-initial-state/Provider.tsx.html +0 -196
  50. package/coverage/lcov-report/src/.umi/plugin-initial-state/exports.ts.html +0 -106
  51. package/coverage/lcov-report/src/.umi/plugin-initial-state/index.html +0 -146
  52. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/index.html +0 -116
  53. package/coverage/lcov-report/src/.umi/plugin-initial-state/models/initialState.ts.html +0 -88
  54. package/coverage/lcov-report/src/.umi/plugin-initial-state/runtime.tsx.html +0 -124
  55. package/coverage/lcov-report/src/.umi/plugin-locale/SelectLang.tsx.html +0 -1246
  56. package/coverage/lcov-report/src/.umi/plugin-locale/index.html +0 -161
  57. package/coverage/lcov-report/src/.umi/plugin-locale/locale.tsx.html +0 -268
  58. package/coverage/lcov-report/src/.umi/plugin-locale/localeExports.ts.html +0 -778
  59. package/coverage/lcov-report/src/.umi/plugin-locale/runtime.tsx.html +0 -115
  60. package/coverage/lcov-report/src/.umi/plugin-model/Provider.tsx.html +0 -202
  61. package/coverage/lcov-report/src/.umi/plugin-model/helpers/constant.tsx.html +0 -97
  62. package/coverage/lcov-report/src/.umi/plugin-model/helpers/dispatcher.tsx.html +0 -142
  63. package/coverage/lcov-report/src/.umi/plugin-model/helpers/executor.tsx.html +0 -334
  64. package/coverage/lcov-report/src/.umi/plugin-model/helpers/index.html +0 -146
  65. package/coverage/lcov-report/src/.umi/plugin-model/index.html +0 -146
  66. package/coverage/lcov-report/src/.umi/plugin-model/runtime.tsx.html +0 -121
  67. package/coverage/lcov-report/src/.umi/plugin-model/useModel.tsx.html +0 -298
  68. package/coverage/lcov-report/src/.umi/plugin-request/index.html +0 -116
  69. package/coverage/lcov-report/src/.umi/plugin-request/request.ts.html +0 -919
  70. package/coverage/lcov-report/src/.umi/umi.ts.html +0 -268
@@ -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
  };
@@ -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 */
@@ -120,7 +120,7 @@ export var getReactiveProps = function getReactiveProps(params) {
120
120
  show = params.show,
121
121
  component = params.component,
122
122
  fieldProps = params.fieldProps,
123
- name = params.name;
123
+ desensitization = params.desensitization;
124
124
  var values = namePath ? form.getFieldValue(namePath) : form.getFieldsValue();
125
125
  var _disabled = isFunction(disabled) ? disabled(values, {
126
126
  form: form,
@@ -142,17 +142,31 @@ export var getReactiveProps = function getReactiveProps(params) {
142
142
  index: index,
143
143
  namePath: namePath
144
144
  }) : fieldProps;
145
+ var _desensitization = isFunction(desensitization) ? desensitization(values, {
146
+ form: form,
147
+ index: index,
148
+ namePath: namePath
149
+ }) : desensitization;
145
150
  return {
146
151
  disabled: _disabled,
147
152
  show: _show,
148
153
  component: _component,
149
- fieldProps: _fieldProps
154
+ fieldProps: _fieldProps,
155
+ desensitization: _desensitization
150
156
  };
151
157
  };
152
158
  /** 获取当前字段的转换函数 */
153
159
  export var getValueTypeTrans = function getValueTypeTrans(params) {
154
160
  var _valueTypeMap$valueTy;
161
+ var desensitizationKey = params.desensitizationKey;
155
162
  var valueType = params.valueType;
163
+ var desensitization = params.desensitization,
164
+ disabled = params.disabled;
165
+ var isDesensit = sessionStorage.getItem(desensitizationKey);
166
+ // 仅查看模式下进行数据脱敏
167
+ if ((desensitization === null || desensitization === void 0 ? void 0 : desensitization.length) && disabled && isDesensit === 'ON') {
168
+ valueType = 'desensitization';
169
+ }
156
170
  var transform = (_valueTypeMap$valueTy = valueTypeMap[valueType]) === null || _valueTypeMap$valueTy === void 0 ? void 0 : _valueTypeMap$valueTy.call(valueTypeMap, params);
157
171
  return transform;
158
172
  };
@@ -198,7 +212,9 @@ export var useTransformColumns = function useTransformColumns(params) {
198
212
  namePath = params.namePath,
199
213
  value = params.value,
200
214
  internalChange = params.onChange,
201
- groupProps = params.groupProps;
215
+ groupProps = params.groupProps,
216
+ formDisabled = params.formDisabled,
217
+ desensitizationKey = params.desensitizationKey;
202
218
  var timerRef = useRef([]);
203
219
  return columns === null || columns === void 0 ? void 0 : columns.flatMap(function (column, index) {
204
220
  var type = column.type,
@@ -211,7 +227,8 @@ export var useTransformColumns = function useTransformColumns(params) {
211
227
  disabled = column.disabled,
212
228
  show = column.show,
213
229
  component = column.component,
214
- clearNotShow = column.clearNotShow;
230
+ clearNotShow = column.clearNotShow,
231
+ desensitization = column.desensitization;
215
232
  var _ref = fieldProps || {},
216
233
  mode = _ref.mode,
217
234
  onChange = _ref.onChange,
@@ -252,19 +269,24 @@ export var useTransformColumns = function useTransformColumns(params) {
252
269
  show: show,
253
270
  component: component,
254
271
  fieldProps: fieldProps,
255
- name: columnName
272
+ name: columnName,
273
+ desensitization: desensitization
256
274
  });
257
275
  }, changedCallback, [value, show, fieldProps, _disabled, columnName, type]);
258
276
  if (reactiveProps.show === false) {
259
277
  return [];
260
278
  }
279
+ var isDisabled = formDisabled || _disabled || reactiveProps.disabled;
261
280
  var transform = getValueTypeTrans({
262
281
  type: type,
263
282
  valueType: valueType,
264
283
  switchValue: switchValue,
265
284
  toISOString: toISOString,
266
285
  toCSTString: toCSTString,
267
- mode: mode
286
+ mode: mode,
287
+ desensitizationKey: desensitizationKey,
288
+ disabled: isDisabled,
289
+ desensitization: reactiveProps.desensitization
268
290
  });
269
291
  var newValue;
270
292
  var handleChange = function handleChange() {
@@ -31,7 +31,7 @@ import ConfirmWrapper from './ConfirmWrapper';
31
31
  import ChangedWrapper from './ChangedWrapper';
32
32
  // 这个组件只管渲染, 参数的整理在外部处理
33
33
  var Render = function Render(props) {
34
- var _ref2, _ref3, _ref4, _ref5, _otherProps$names2;
34
+ var _ref3, _ref4, _ref5, _ref6, _otherProps$names2;
35
35
  var component = props.component,
36
36
  originComponent = props.originComponent,
37
37
  _props$formItemProps = props.formItemProps,
@@ -116,7 +116,9 @@ var Render = function Render(props) {
116
116
  */
117
117
  var valueTypeTransform = function valueTypeTransform() {
118
118
  var _ref = otherProps || {},
119
- valueType = _ref.valueType;
119
+ desensitizationKey = _ref.desensitizationKey;
120
+ var _ref2 = otherProps || {},
121
+ valueType = _ref2.valueType;
120
122
  // SwitchCheckbox默认YN, 兼容已有组件
121
123
  if (type === 'SwitchCheckbox') {
122
124
  valueType = 'switch';
@@ -124,7 +126,9 @@ var Render = function Render(props) {
124
126
  if (type === 'Input') {
125
127
  valueType = valueType || 'trim';
126
128
  }
127
- if (_desensitization === null || _desensitization === void 0 ? void 0 : _desensitization.length) {
129
+ var isDesensit = sessionStorage.getItem(desensitizationKey);
130
+ // 仅查看模式下进行数据脱敏
131
+ if ((_desensitization === null || _desensitization === void 0 ? void 0 : _desensitization.length) && _disabled && isDesensit === 'ON') {
128
132
  valueType = 'desensitization';
129
133
  }
130
134
  // 不存在valueType返回空
@@ -149,7 +153,7 @@ var Render = function Render(props) {
149
153
  * globalControl true时,优先级 全局【formDisabled】> formitem上【column.disabled】 > 组件上【fieldProps.disabled】
150
154
  * globalControl false时,优先级 组件上【fieldProps.disabled】 > formitem上【column.disabled】 > 全局【formDisabled】
151
155
  */
152
- var lastDisabled = globalControl ? (_ref2 = (_ref3 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref3 !== void 0 ? _ref3 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref2 !== void 0 ? _ref2 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref4 = (_ref5 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref4 !== void 0 ? _ref4 : formDisabled;
156
+ var lastDisabled = globalControl ? (_ref3 = (_ref4 = formDisabled !== null && formDisabled !== void 0 ? formDisabled : _disabled) !== null && _ref4 !== void 0 ? _ref4 : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref3 !== void 0 ? _ref3 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled : (_ref5 = (_ref6 = _disabled !== null && _disabled !== void 0 ? _disabled : _fieldProps === null || _fieldProps === void 0 ? void 0 : _fieldProps.disabled) !== null && _ref6 !== void 0 ? _ref6 : componentProps === null || componentProps === void 0 ? void 0 : componentProps.disabled) !== null && _ref5 !== void 0 ? _ref5 : formDisabled;
153
157
  // ↑↑↑↑↑↑ formItem参数整理 ↑↑↑↑↑↑
154
158
  Object.assign(otherFormItemProps, transforms, {
155
159
  names: otherProps.names
@@ -202,8 +206,8 @@ var Render = function Render(props) {
202
206
  var functionArgs = function functionArgs(args) {
203
207
  var _otherFormItemProps$n;
204
208
  var _args = _toConsumableArray(args);
205
- var _ref6 = otherProps || {},
206
- valueType = _ref6.valueType;
209
+ var _ref7 = otherProps || {},
210
+ valueType = _ref7.valueType;
207
211
  _args[1] = form.getFieldsValue();
208
212
  _args[2] = {
209
213
  form: form
@@ -303,7 +307,7 @@ var Render = function Render(props) {
303
307
  * onBlur参数重置 (value, record, { form, index, namePath, option }) => void
304
308
  */
305
309
  var handleBlur = /*#__PURE__*/function () {
306
- var _ref7 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
310
+ var _ref8 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
307
311
  var _len3,
308
312
  args,
309
313
  _key3,
@@ -330,7 +334,7 @@ var Render = function Render(props) {
330
334
  }, _callee);
331
335
  }));
332
336
  return function handleBlur() {
333
- return _ref7.apply(this, arguments);
337
+ return _ref8.apply(this, arguments);
334
338
  };
335
339
  }();
336
340
  var renderItem = function renderItem() {
@@ -18,6 +18,7 @@ interface Props<T = any> {
18
18
  requiredOnView?: boolean;
19
19
  required?: boolean | boolean[] | (() => boolean | boolean[]);
20
20
  globalControl?: boolean;
21
+ desensitizationKey?: string;
21
22
  }
22
23
  declare const RenderFields: React.FC<Props>;
23
24
  export default RenderFields;
@@ -26,7 +26,8 @@ var RenderFields = function RenderFields(props) {
26
26
  requiredOnView = props.requiredOnView,
27
27
  required = props.required,
28
28
  diffConfig = props.diffConfig,
29
- globalControl = props.globalControl;
29
+ globalControl = props.globalControl,
30
+ desensitizationKey = props.desensitizationKey;
30
31
  // 是否包含隐藏字段
31
32
  var hiddenData = columns.filter(function (item) {
32
33
  return Array.isArray(item.hiddenNames);
@@ -189,7 +190,8 @@ var RenderFields = function RenderFields(props) {
189
190
  listName: column.listName,
190
191
  globalControl: globalControl,
191
192
  formDisabled: formDisabled,
192
- diffConfig: diffConfig
193
+ diffConfig: diffConfig,
194
+ desensitizationKey: desensitizationKey
193
195
  };
194
196
  return _jsx(FieldProvider, {
195
197
  value: otherProps,
@@ -85,7 +85,7 @@ type FieldProps<T extends ControlProps, Values, TT> = TT extends 'ProForm' ? Tra
85
85
  /**
86
86
  * 值转换
87
87
  */
88
- export type ProFormValueType = 'percentage' | 'permillage' | 'thousandth' | 'datePicker' | 'enumName' | 'enumCodeName' | 'address' | 'thousandthCNY' | 'date' | 'dateTime' | 'dateStartTime' | 'dateEndTime' | 'dateStartEndTime' | 'switch';
88
+ export type ProFormValueType = 'percentage' | 'permillage' | 'thousandth' | 'datePicker' | 'enumName' | 'enumCodeName' | 'address' | 'thousandthCNY' | 'date' | 'dateTime' | 'dateStartTime' | 'dateEndTime' | 'dateStartEndTime' | 'switch' | 'desensitization';
89
89
  export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
90
90
  type?: 'Input';
91
91
  fieldProps?: FieldProps<InputProps, Values, T>;
@@ -11,7 +11,7 @@ import "antd/es/space/style";
11
11
  import _Space from "antd/es/space";
12
12
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
13
13
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
14
- var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize"];
14
+ var _excluded = ["mode", "span", "disabled", "isView", "columns", "footer", "onOk", "okText", "onCancel", "confirmLoading", "cancelText", "form", "children", "rowProps", "className", "expand", "expandOpen", "expandOpenChange", "viewEmpty", "labelAlign", "labelWidth", "onValuesChange", "onFinish", "diffConfig", "submitOnEnter", "clearNotShow", "initialValues", "requiredOnView", "formId", "required", "formKey", "globalControl", "scrollToError", "optimize", "desensitizationKey"];
15
15
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
16
  import { DoubleLeftOutlined } from '@ant-design/icons';
17
17
  import classnames from 'classnames';
@@ -69,6 +69,8 @@ var ProForm = function ProForm(props, ref) {
69
69
  scrollToError = _props$scrollToError === void 0 ? true : _props$scrollToError,
70
70
  _props$optimize = props.optimize,
71
71
  optimize = _props$optimize === void 0 ? false : _props$optimize,
72
+ _props$desensitizatio = props.desensitizationKey,
73
+ desensitizationKey = _props$desensitizatio === void 0 ? 'zat-design-pro-component-desensitization' : _props$desensitizatio,
72
74
  otherProps = _objectWithoutProperties(props, _excluded);
73
75
  var config = useProConfig('ProForm');
74
76
  var _useForm = useForm(originForm, {
@@ -237,7 +239,8 @@ var ProForm = function ProForm(props, ref) {
237
239
  clearNotShow: clearNotShow,
238
240
  requiredOnView: requiredOnView,
239
241
  required: required,
240
- globalControl: globalControl
242
+ globalControl: globalControl,
243
+ desensitizationKey: desensitizationKey
241
244
  }), footerRender()]
242
245
  })), children]
243
246
  }));
@@ -46,6 +46,7 @@ export interface ProFormOtherProps {
46
46
  formDisabled?: boolean;
47
47
  isDiffChange?: boolean;
48
48
  diffConfig?: DiffConfigProps;
49
+ desensitizationKey?: string;
49
50
  }
50
51
  export interface DiffConfigProps<Values = any> {
51
52
  /** 比对原始数据源 */
@@ -94,6 +95,8 @@ export interface ProFormProps<Values = any> extends FormProps<Values> {
94
95
  * 1. 开启不过滤names的中间态值
95
96
  */
96
97
  optimize?: boolean;
98
+ /** 全局脱敏开关的key、默认 zat-design-pro-component-desensitization */
99
+ desensitizationKey?: string;
97
100
  }
98
101
  export interface Transform<T = any> {
99
102
  normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue;
@@ -6,9 +6,16 @@ var filterObject = function filterObject(data) {
6
6
  if (!isObject(data) || data === null) return data;
7
7
  // ['1', undefined] ['1', ''] 视为相等
8
8
  if (Array.isArray(data)) {
9
- return data.map(function (item) {
10
- return isEmpty(item) ? null : item;
9
+ // 数组中全是empty值的话 视为null
10
+ var isFillNull = true;
11
+ var arr = data.map(function (item) {
12
+ if (isEmpty(item)) {
13
+ return null;
14
+ }
15
+ isFillNull = false;
16
+ return item;
11
17
  });
18
+ return isFillNull ? null : arr;
12
19
  }
13
20
  var resData = {};
14
21
  Object.keys(data).forEach(function (key) {
@@ -67,9 +67,7 @@ declare const _default: {
67
67
  };
68
68
  };
69
69
  /** 脱敏 转换 */
70
- desensitization: ({ desensitization }: {
71
- desensitization: any;
72
- }) => {
70
+ desensitization: (props: any) => {
73
71
  getValueProps: (value: any) => {
74
72
  value: any;
75
73
  };
@@ -1,3 +1,4 @@
1
+ import _readOnlyError from "@babel/runtime/helpers/esm/readOnlyError";
1
2
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
3
4
  import Big from 'big.js';
@@ -304,13 +305,42 @@ export default {
304
305
  return switchTransform(switchValue);
305
306
  },
306
307
  /** 脱敏 转换 */
307
- desensitization: function desensitization(_ref13) {
308
- var _desensitization = _ref13.desensitization;
308
+ desensitization: function desensitization(props) {
309
+ var desensitization = props.desensitization,
310
+ type = props.type,
311
+ mode = props.mode,
312
+ names = props.names;
313
+ // 判断是否是地址控件,并带地址详情场景
314
+ if (type === 'ProCascader' && mode === 'address' && (names === null || names === void 0 ? void 0 : names.length) === 4) {
315
+ return {
316
+ getValueProps: function getValueProps(value) {
317
+ try {
318
+ if (value === null || value === void 0 ? void 0 : value.length) {
319
+ var _value = _slicedToArray(value, 4),
320
+ province = _value[0],
321
+ city = _value[1],
322
+ county = _value[2],
323
+ address = _value[3];
324
+ return {
325
+ value: [province, city, county, maskStringRangeWithRegex(address, desensitization)]
326
+ };
327
+ }
328
+ return {
329
+ value: value
330
+ };
331
+ } catch (error) {
332
+ return {
333
+ value: value
334
+ }; // 如果发生错误,返回原始值
335
+ }
336
+ }
337
+ };
338
+ }
309
339
  return {
310
340
  getValueProps: function getValueProps(value) {
311
341
  try {
312
342
  return {
313
- value: maskStringRangeWithRegex(value, _desensitization)
343
+ value: maskStringRangeWithRegex(value, desensitization)
314
344
  };
315
345
  } catch (error) {
316
346
  return {
@@ -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;
@@ -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) || Array.isArray(data) || data === null) return 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
- if (isEmpty(_originalValue) && !isEmpty(_value)) {
52
- return 'add';
53
- }
54
- if (Array.isArray(_originalValue)) {
55
- if ((_originalValue === null || _originalValue === void 0 ? void 0 : _originalValue.length) === (_value === null || _value === void 0 ? void 0 : _value.length)) {
56
- var isSame = _originalValue.every(function (valueItem, index) {
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
  };
@@ -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 */