@zat-design/sisyphus-react 3.9.1-beta.9 → 3.9.2-beta.1

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 (37) hide show
  1. package/dist/index.esm.css +28 -1
  2. package/dist/less.esm.css +28 -1
  3. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +2 -1
  4. package/es/ProEditTable/propsType.d.ts +2 -0
  5. package/es/ProEnum/index.js +0 -1
  6. package/es/ProForm/components/combination/Group/index.js +15 -8
  7. package/es/ProForm/components/combination/Group/propsType.d.ts +2 -0
  8. package/es/ProForm/components/combination/Group/style/index.less +15 -0
  9. package/es/ProForm/components/combination/Group/utils.js +43 -9
  10. package/es/ProForm/components/combination/ProCascader/index.js +7 -1
  11. package/es/ProForm/components/render/ChangedWrapper.js +2 -1
  12. package/es/ProLayout/style/index.less +5 -0
  13. package/es/ProTable/components/FormatColumn/index.js +69 -29
  14. package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
  15. package/es/ProTable/components/RenderColumn/index.js +3 -5
  16. package/es/ProTable/propsType.d.ts +4 -5
  17. package/es/ProTable/style/index.less +23 -10
  18. package/es/ProTable/utils/index.d.ts +2 -0
  19. package/es/ProTable/utils/index.js +16 -3
  20. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +2 -1
  21. package/lib/ProEditTable/propsType.d.ts +2 -0
  22. package/lib/ProEnum/index.js +0 -1
  23. package/lib/ProForm/components/combination/Group/index.js +15 -8
  24. package/lib/ProForm/components/combination/Group/propsType.d.ts +2 -0
  25. package/lib/ProForm/components/combination/Group/style/index.less +15 -0
  26. package/lib/ProForm/components/combination/Group/utils.js +44 -9
  27. package/lib/ProForm/components/combination/ProCascader/index.js +7 -1
  28. package/lib/ProForm/components/render/ChangedWrapper.js +2 -1
  29. package/lib/ProLayout/style/index.less +5 -0
  30. package/lib/ProTable/components/FormatColumn/index.js +69 -29
  31. package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
  32. package/lib/ProTable/components/RenderColumn/index.js +3 -5
  33. package/lib/ProTable/propsType.d.ts +4 -5
  34. package/lib/ProTable/style/index.less +23 -10
  35. package/lib/ProTable/utils/index.d.ts +2 -0
  36. package/lib/ProTable/utils/index.js +16 -3
  37. package/package.json +2 -2
@@ -1246,6 +1246,9 @@
1246
1246
  border-radius: var(--zaui-border-radius, 8px) !important;
1247
1247
  background: #E4F2FE;
1248
1248
  }
1249
+ .pro-layout.pro-layout-light .pro-collapse .pro-collapse-panel .pro-collapse-level2-collapse .ant-collapse-header {
1250
+ border-radius: 0 !important;
1251
+ }
1249
1252
  .pro-layout.pro-layout-light .pro-header {
1250
1253
  border-radius: 0 0 var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px);
1251
1254
  }
@@ -1930,7 +1933,7 @@
1930
1933
  .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .varied-cell {
1931
1934
  margin-left: -8px;
1932
1935
  padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
1933
- background: var(--zaui-contract-bg, #fffaa1) !important;
1936
+ background-color: var(--zaui-contract-bg, #fffaa1) !important;
1934
1937
  border-radius: var(--zaui-border-radius, 8px);
1935
1938
  }
1936
1939
  .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container,
@@ -1939,6 +1942,19 @@
1939
1942
  white-space: nowrap;
1940
1943
  text-overflow: ellipsis;
1941
1944
  }
1945
+ .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell,
1946
+ .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell {
1947
+ margin-left: -8px;
1948
+ padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
1949
+ background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
1950
+ border-radius: var(--zaui-border-radius, 8px);
1951
+ }
1952
+ .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container,
1953
+ .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container {
1954
+ overflow: hidden;
1955
+ white-space: nowrap;
1956
+ text-overflow: ellipsis;
1957
+ }
1942
1958
  .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container,
1943
1959
  .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
1944
1960
  overflow: hidden;
@@ -2654,6 +2670,17 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2654
2670
  border-start-end-radius: 4px;
2655
2671
  border-end-end-radius: 4px;
2656
2672
  }
2673
+ .pro-group .ant-space-compact .pro-select .ant-select .ant-select-selector {
2674
+ border-radius: 0 !important;
2675
+ }
2676
+ .pro-group .ant-space-compact .pro-select:first-child .ant-select .ant-select-selector {
2677
+ border-start-start-radius: 4px !important;
2678
+ border-end-start-radius: 4px !important;
2679
+ }
2680
+ .pro-group .ant-space-compact .pro-select:last-child .ant-select .ant-select-selector {
2681
+ border-start-end-radius: 4px !important;
2682
+ border-end-end-radius: 4px!important;
2683
+ }
2657
2684
  .pro-group .ant-space-compact .ant-select .ant-select-selector {
2658
2685
  border-start-end-radius: 0;
2659
2686
  border-end-end-radius: 0;
package/dist/less.esm.css CHANGED
@@ -1246,6 +1246,9 @@
1246
1246
  border-radius: var(--zaui-border-radius, 8px) !important;
1247
1247
  background: #E4F2FE;
1248
1248
  }
1249
+ .pro-layout.pro-layout-light .pro-collapse .pro-collapse-panel .pro-collapse-level2-collapse .ant-collapse-header {
1250
+ border-radius: 0 !important;
1251
+ }
1249
1252
  .pro-layout.pro-layout-light .pro-header {
1250
1253
  border-radius: 0 0 var(--zaui-border-radius, 8px) var(--zaui-border-radius, 8px);
1251
1254
  }
@@ -1930,7 +1933,7 @@
1930
1933
  .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .varied-cell {
1931
1934
  margin-left: -8px;
1932
1935
  padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
1933
- background: var(--zaui-contract-bg, #fffaa1) !important;
1936
+ background-color: var(--zaui-contract-bg, #fffaa1) !important;
1934
1937
  border-radius: var(--zaui-border-radius, 8px);
1935
1938
  }
1936
1939
  .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .varied-cell .pro-form-view-container,
@@ -1939,6 +1942,19 @@
1939
1942
  white-space: nowrap;
1940
1943
  text-overflow: ellipsis;
1941
1944
  }
1945
+ .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell,
1946
+ .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell {
1947
+ margin-left: -8px;
1948
+ padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
1949
+ background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
1950
+ border-radius: var(--zaui-border-radius, 8px);
1951
+ }
1952
+ .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container,
1953
+ .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .add-cell .pro-form-view-container {
1954
+ overflow: hidden;
1955
+ white-space: nowrap;
1956
+ text-overflow: ellipsis;
1957
+ }
1942
1958
  .pro-table .ant-table table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container,
1943
1959
  .pro-table .ant-table.ant-table-scroll-horizontal table tbody.ant-table-tbody .ant-table-cell .ant-typography-ellipsis .pro-form-view-container {
1944
1960
  overflow: hidden;
@@ -2654,6 +2670,17 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
2654
2670
  border-start-end-radius: 4px;
2655
2671
  border-end-end-radius: 4px;
2656
2672
  }
2673
+ .pro-group .ant-space-compact .pro-select .ant-select .ant-select-selector {
2674
+ border-radius: 0 !important;
2675
+ }
2676
+ .pro-group .ant-space-compact .pro-select:first-child .ant-select .ant-select-selector {
2677
+ border-start-start-radius: 4px !important;
2678
+ border-end-start-radius: 4px !important;
2679
+ }
2680
+ .pro-group .ant-space-compact .pro-select:last-child .ant-select .ant-select-selector {
2681
+ border-start-end-radius: 4px !important;
2682
+ border-end-end-radius: 4px!important;
2683
+ }
2657
2684
  .pro-group .ant-space-compact .ant-select .ant-select-selector {
2658
2685
  border-start-end-radius: 0;
2659
2686
  border-end-end-radius: 0;
@@ -118,7 +118,8 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
118
118
  var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
119
119
  var diffType = useMemo(function () {
120
120
  if (!isWatch || noChange) return 'same';
121
- var _value = normalize ? normalize(props[valuePropName]) : props[valuePropName];
121
+ var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
122
+ : props[valuePropName];
122
123
  return diffOriginal({
123
124
  value: _value,
124
125
  originalValue: originalValue,
@@ -8,6 +8,7 @@ import type { ColumnType, TableProps } from 'antd/es/table';
8
8
  import type { FormInstance, FormItemProps } from 'antd/es/form';
9
9
  import type { FunctionArgs, ProRule } from '../ProForm/propsType';
10
10
  import { ProFormValueType, ColumnPropsMap } from '../ProForm/components/render/propsType';
11
+ import { DiffOriginalParams } from '../ProForm/utils/diffOriginal';
11
12
  export type ActionType = 'edit' | 'delete' | 'save' | 'cancel' | 'add' | 'mulDelete' | 'custom';
12
13
  export type ShowFunction<T> = (record?: T, options?: {
13
14
  index?: number;
@@ -105,6 +106,7 @@ export interface ProColumnsProps<Values = any, T = any> extends Omit<FormItemPro
105
106
  hiddenNames?: NamePath[] | NamePath[][];
106
107
  rules?: ProRule[] | RulesFn<T>;
107
108
  confirm?: boolean | ModalFuncProps | FunctionArgs<Values, boolean | ModalFuncProps | void>;
109
+ onDiff?: DiffOriginalParams['equalWith'];
108
110
  [key: string]: any;
109
111
  }
110
112
  export type ProEditTableColumnsProps<K = any> = ProColumnsProps & ColumnPropsMap<K, 'ProEditTable'>;
@@ -231,7 +231,6 @@ var ProEnum = function ProEnum(props) {
231
231
  if (!code && !dataSource && !useRequest) {
232
232
  var _locale$ProEnum4;
233
233
  _message.error(locale === null || locale === void 0 ? void 0 : (_locale$ProEnum4 = locale.ProEnum) === null || _locale$ProEnum4 === void 0 ? void 0 : _locale$ProEnum4.errorNoEnumType);
234
- // return;
235
234
  }
236
235
  var transToLabel = function transToLabel(value) {
237
236
  var list = dataList && dataList.length ? dataList : enumLists;
@@ -70,23 +70,30 @@ var Group = function Group(props) {
70
70
  id: id,
71
71
  children: space.compact || (space === null || space === void 0 ? void 0 : space.separator) ? _jsx(_Space.Compact, {
72
72
  children: columns.map(function (column, index) {
73
- return _jsx(ComRender, _objectSpread(_objectSpread({
73
+ column.otherProps = otherProps;
74
+ // 自定义间隔移除对于参数
75
+ if (column === null || column === void 0 ? void 0 : column.separator) {
76
+ delete column.separator;
77
+ delete column.otherProps;
78
+ }
79
+ return _jsx(ComRender, _objectSpread({
74
80
  contextProps: contextProps,
75
81
  isView: isParentView || isView
76
- }, column), {}, {
77
- otherProps: otherProps
78
- }), column.name);
82
+ }, column), column.name || index);
79
83
  })
80
84
  }) : _jsx(_Space, _objectSpread(_objectSpread({
81
85
  align: "start"
82
86
  }, omit(space, ['separator', 'compact'])), {}, {
83
87
  children: columns.map(function (column, index) {
84
- return _jsx(ComRender, _objectSpread(_objectSpread({
88
+ column.otherProps = otherProps;
89
+ if (column === null || column === void 0 ? void 0 : column.separator) {
90
+ delete column.separator;
91
+ delete column.otherProps;
92
+ }
93
+ return _jsx(ComRender, _objectSpread({
85
94
  contextProps: contextProps,
86
95
  isView: isParentView || isView
87
- }, column), {}, {
88
- otherProps: otherProps
89
- }), column.name);
96
+ }, column), column.name || index);
90
97
  })
91
98
  }))
92
99
  });
@@ -12,6 +12,8 @@ export interface SpaceType extends SpaceProps {
12
12
  * 分隔符
13
13
  */
14
14
  separator?: string | React.ReactNode;
15
+ /** 分隔符插入位置 */
16
+ separatorIndex?: number | number[];
15
17
  /** 间隔距离 */
16
18
  size?: number;
17
19
  }
@@ -104,6 +104,21 @@
104
104
  }
105
105
  }
106
106
 
107
+ .pro-select {
108
+ .@{ant-prefix}-select .@{ant-prefix}-select-selector{
109
+ border-radius: 0 !important;
110
+ }
111
+ &:first-child .@{ant-prefix}-select .@{ant-prefix}-select-selector {
112
+ border-start-start-radius: 4px !important;
113
+ border-end-start-radius: 4px !important;
114
+ }
115
+
116
+ &:last-child .@{ant-prefix}-select .@{ant-prefix}-select-selector {
117
+ border-start-end-radius: 4px !important;
118
+ border-end-end-radius: 4px!important;
119
+ }
120
+ }
121
+
107
122
  .@{ant-prefix}-select {
108
123
  .@{ant-prefix}-select-selector {
109
124
  .border-radius(0, 0, 0, 0);
@@ -4,8 +4,10 @@ import _typeof from "@babel/runtime/helpers/esm/typeof";
4
4
  import "antd/es/button/style";
5
5
  import _Button from "antd/es/button";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
+ /* eslint-disable no-lonely-if */
7
8
  import { useRef } from 'react';
8
9
  import { cloneDeep, isEqual, isFunction } from 'lodash';
10
+ import { validate } from '@zat-design/utils';
9
11
  import valueTypeMap from '../../../utils/valueType';
10
12
  import { useDeepCompareMemo } from '../../../utils/useDeepCompareMemo';
11
13
  import { difference } from '../../../../ProEditTable/utils/tools';
@@ -18,20 +20,52 @@ export var insertSeparator = function insertSeparator(columns, space) {
18
20
  if (!(space === null || space === void 0 ? void 0 : space.separator)) {
19
21
  return columns;
20
22
  }
23
+ var separatorIndexs = function () {
24
+ var reuslt = [];
25
+ if (validate.isEmpty(space === null || space === void 0 ? void 0 : space.separatorIndex)) {
26
+ return reuslt;
27
+ }
28
+ // 如果 index 是数字,将其转换为数组
29
+ if (typeof (space === null || space === void 0 ? void 0 : space.separatorIndex) === 'number') {
30
+ reuslt.push(space.separatorIndex);
31
+ }
32
+ if (Array.isArray(space.separatorIndex)) {
33
+ reuslt = reuslt.concat(space.separatorIndex);
34
+ }
35
+ return reuslt;
36
+ }();
21
37
  return columns.reduce(function (result, current, index, array) {
22
38
  // 将当前元素添加到结果数组中
23
39
  result.push(current);
24
- // 如果当前元素不是最后一个元素,则添加间隔符
25
- if (index < array.length - 1) {
26
- result.push({
27
- component: _jsx(_Button, {
28
- className: "group-separator",
29
- children: space.separator
30
- }),
31
- fieldProps: {
32
- disabled: true
40
+ if (separatorIndexs === null || separatorIndexs === void 0 ? void 0 : separatorIndexs.length) {
41
+ separatorIndexs.forEach(function (separatorIndex) {
42
+ if (index === separatorIndex) {
43
+ result.push({
44
+ separator: true,
45
+ component: _jsx(_Button, {
46
+ className: "group-separator",
47
+ children: space.separator
48
+ }),
49
+ fieldProps: {
50
+ disabled: true
51
+ }
52
+ });
33
53
  }
34
54
  });
55
+ } else {
56
+ // 如果当前元素不是最后一个元素,则添加间隔符
57
+ if (index < array.length - 1) {
58
+ result.push({
59
+ separator: true,
60
+ component: _jsx(_Button, {
61
+ className: "group-separator",
62
+ children: space.separator
63
+ }),
64
+ fieldProps: {
65
+ disabled: true
66
+ }
67
+ });
68
+ }
35
69
  }
36
70
  return result;
37
71
  }, []);
@@ -35,11 +35,17 @@ var _filterDataSource = function filterDataSource(dataSource, level, fieldNames)
35
35
  });
36
36
  };
37
37
  var getViewLabel = function getViewLabel(_ref) {
38
+ var _value2;
38
39
  var dataSource = _ref.dataSource,
39
40
  value = _ref.value;
41
+ var _value = value;
40
42
  var viewLabel = [];
43
+ // fix: value是string类型,需要转为数组
44
+ if (_value && !Array.isArray(_value)) {
45
+ _value = [value];
46
+ }
41
47
  // 根据dataSource得到label数组,查看模式展示需要
42
- value === null || value === void 0 ? void 0 : value.forEach(function (value, index) {
48
+ (_value2 = _value) === null || _value2 === void 0 ? void 0 : _value2.forEach(function (value, index) {
43
49
  var _dataSource;
44
50
  var temp = (_dataSource = dataSource) === null || _dataSource === void 0 ? void 0 : _dataSource.find(function (item) {
45
51
  return (item === null || item === void 0 ? void 0 : item.value) === value;
@@ -44,7 +44,8 @@ var ChangedWrapper = function ChangedWrapper(props) {
44
44
  var noChange = !equalWith && (!originalValues || isDiffAll ? false : isEmpty(originalValue));
45
45
  var diffType = useMemo(function () {
46
46
  if (!isWatch || noChange) return 'same';
47
- var _value = normalize ? normalize(props[valuePropName]) : props[valuePropName];
47
+ var _value = normalize ? normalize(props[valuePropName], undefined, undefined, true) // true 代表是值比对时的调用
48
+ : props[valuePropName];
48
49
  return diffOriginal({
49
50
  originalValue: originalValue,
50
51
  value: _value,
@@ -67,6 +67,11 @@
67
67
  border-radius: var(--zaui-border-radius, 8px) !important;
68
68
  background: #E4F2FE;
69
69
  }
70
+ .pro-collapse-level2-collapse{
71
+ .@{ant-prefix}-collapse-header{
72
+ border-radius: 0 !important;
73
+ }
74
+ }
70
75
 
71
76
  }
72
77
  }
@@ -113,9 +113,9 @@ export var formatColumn = function formatColumn(_ref2) {
113
113
  }
114
114
  };
115
115
  if (column === null || column === void 0 ? void 0 : column.render) {
116
- if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0 && !onDiff) {
117
- return;
118
- }
116
+ // if (!originalObj && Object.keys(originalObj ?? {}).length === 0 && !onDiff) {
117
+ // return;
118
+ // }
119
119
  var originalRender = column.render; // 保存原始的 render 方法
120
120
  // 自定义render 手动重载下
121
121
  column.render = function (value, record, index) {
@@ -123,8 +123,10 @@ export var formatColumn = function formatColumn(_ref2) {
123
123
  var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : null;
124
124
  var originalResult = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
125
125
  var originalValue = originalResult.originalValue;
126
- var isChanged = originalResult.isChanged;
126
+ var isChanged = originalResult.isChanged,
127
+ isAddCell = originalResult.isAddCell;
127
128
  var isInNewRowFlag = isInNewRow(record);
129
+ var _isAddCell = isAddCell;
128
130
  otherProps.isChanged = isChanged;
129
131
  // 存在比对
130
132
  if (isFunction(otherProps === null || otherProps === void 0 ? void 0 : otherProps.viewRender) && (diffConfig === null || diffConfig === void 0 ? void 0 : diffConfig.originalDataSource)) {
@@ -142,6 +144,27 @@ export var formatColumn = function formatColumn(_ref2) {
142
144
  }
143
145
  originalValue = diffResult;
144
146
  }
147
+ // 存在自定义onDiff比对
148
+ if (isFunction(onDiff)) {
149
+ var _originalObj$record$r2;
150
+ var _diffResult = onDiff({
151
+ originalValue: originalValue,
152
+ originalRecord: (_originalObj$record$r2 = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r2 !== void 0 ? _originalObj$record$r2 : {},
153
+ value: value,
154
+ record: record,
155
+ index: index
156
+ });
157
+ if (_diffResult === 'changed') {
158
+ otherProps.isChanged = true;
159
+ }
160
+ if (_diffResult === 'same') {
161
+ otherProps.isChanged = false;
162
+ }
163
+ if (_diffResult === 'add') {
164
+ _isAddCell = true;
165
+ otherProps.isChanged = false;
166
+ }
167
+ }
145
168
  return _jsx(RenderColumn, _objectSpread(_objectSpread({}, otherProps), {}, {
146
169
  valueType: valueType,
147
170
  originalValue: isEmpty(originalValue) ? null : originalValue,
@@ -152,7 +175,8 @@ export var formatColumn = function formatColumn(_ref2) {
152
175
  currentValue: _value,
153
176
  toolTipProps: _toolTipProps,
154
177
  minWidth: minWidth,
155
- isInNewRowFlag: isInNewRowFlag
178
+ isInNewRowFlag: isInNewRowFlag,
179
+ isAddCell: _isAddCell
156
180
  }));
157
181
  };
158
182
  return;
@@ -177,8 +201,9 @@ export var formatColumn = function formatColumn(_ref2) {
177
201
  var realValue = tools.calc(Number(value !== null && value !== void 0 ? value : 0), '*', multiple);
178
202
  var renderValue = getDecimalDigits(value) > valueTypePrecision ? realValue : realValue.toFixed(valueTypePrecision);
179
203
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
180
- var originalValue = originalResult.originalValue;
181
- var isChanged = originalResult.isChanged;
204
+ var isChanged = originalResult.isChanged,
205
+ originalValue = originalResult.originalValue,
206
+ isAddCell = originalResult.isAddCell;
182
207
  otherProps.isChanged = isChanged;
183
208
  var originalRealValue = tools.calc(Number(originalValue || null), '*', multiple);
184
209
  var originalRenderValue = getDecimalDigits(originalValue) > valueTypePrecision ? originalRealValue : originalRealValue.toFixed(valueTypePrecision);
@@ -208,7 +233,8 @@ export var formatColumn = function formatColumn(_ref2) {
208
233
  currentValue: renderValue,
209
234
  toolTipProps: _toolTipProps,
210
235
  minWidth: minWidth,
211
- isInNewRowFlag: isInNewRowFlag
236
+ isInNewRowFlag: isInNewRowFlag,
237
+ isAddCell: isAddCell
212
238
  }));
213
239
  };
214
240
  // 千分位, 千分位带CNY前缀
@@ -217,8 +243,9 @@ export var formatColumn = function formatColumn(_ref2) {
217
243
  var valueStr = valueTypePrecision ? "".concat(Number(value).toFixed(valueTypePrecision)) : "".concat(value);
218
244
  var renderValue = valueStr.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
219
245
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
220
- var originalValue = originalResult.originalValue;
221
- var isChanged = originalResult.isChanged;
246
+ var isChanged = originalResult.isChanged,
247
+ originalValue = originalResult.originalValue,
248
+ isAddCell = originalResult.isAddCell;
222
249
  otherProps.isChanged = isChanged;
223
250
  var originalRealValue = valueTypePrecision ? "".concat(Number(originalValue).toFixed(valueTypePrecision)) : "".concat(originalValue);
224
251
  var originalRenderValue = originalRealValue.replace(/\B(?=(\d{3})+(?!\d))/g, ',');
@@ -248,7 +275,8 @@ export var formatColumn = function formatColumn(_ref2) {
248
275
  currentValue: renderValue,
249
276
  toolTipProps: _toolTipProps,
250
277
  minWidth: minWidth,
251
- isInNewRowFlag: isInNewRowFlag
278
+ isInNewRowFlag: isInNewRowFlag,
279
+ isAddCell: isAddCell
252
280
  }));
253
281
  };
254
282
  } else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
@@ -256,8 +284,9 @@ export var formatColumn = function formatColumn(_ref2) {
256
284
  var _moment, _moment2, _moment3, _moment4, _moment5, _moment6, _moment7, _moment8, _moment9, _moment10, _moment11, _moment12, _moment13, _moment14;
257
285
  var renderValue = (_moment = moment(value)) === null || _moment === void 0 ? void 0 : _moment.format(format);
258
286
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
259
- var originalValue = originalResult.originalValue;
260
- var isChanged = originalResult.isChanged;
287
+ var isChanged = originalResult.isChanged,
288
+ originalValue = originalResult.originalValue,
289
+ isAddCell = originalResult.isAddCell;
261
290
  otherProps.isChanged = isChanged;
262
291
  var originalRenderValue = (_moment2 = moment(originalValue)) === null || _moment2 === void 0 ? void 0 : _moment2.format(format);
263
292
  switch (valueType) {
@@ -311,7 +340,8 @@ export var formatColumn = function formatColumn(_ref2) {
311
340
  currentValue: renderValue,
312
341
  toolTipProps: _toolTipProps,
313
342
  minWidth: minWidth,
314
- isInNewRowFlag: isInNewRowFlag
343
+ isInNewRowFlag: isInNewRowFlag,
344
+ isAddCell: isAddCell
315
345
  }));
316
346
  };
317
347
  } else if (['enumName', 'enumCodeName'].includes(valueType)) {
@@ -319,8 +349,9 @@ export var formatColumn = function formatColumn(_ref2) {
319
349
  var realCode = typeof code === 'function' ? code(value, record) : code;
320
350
  var renderValue = getEnumLabel(realCode, value, valueType === 'enumCodeName');
321
351
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
322
- var originalValue = originalResult.originalValue;
323
- var isChanged = originalResult.isChanged;
352
+ var isChanged = originalResult.isChanged,
353
+ originalValue = originalResult.originalValue,
354
+ isAddCell = originalResult.isAddCell;
324
355
  otherProps.isChanged = isChanged;
325
356
  var originalRenderValue = getEnumLabel(realCode, originalValue, valueType === 'enumCodeName');
326
357
  if (Array.isArray(column === null || column === void 0 ? void 0 : column.codeValues) && !realCode) {
@@ -354,15 +385,17 @@ export var formatColumn = function formatColumn(_ref2) {
354
385
  currentValue: renderValue,
355
386
  toolTipProps: _toolTipProps,
356
387
  minWidth: minWidth,
357
- isInNewRowFlag: isInNewRowFlag
388
+ isInNewRowFlag: isInNewRowFlag,
389
+ isAddCell: isAddCell
358
390
  }));
359
391
  };
360
392
  } else if (precision || prefix || suffix) {
361
393
  column.render = function (value, record, index) {
362
394
  var renderValue = value === 'number' ? value.toFixed(precision) : value;
363
395
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
364
- var originalValue = originalResult.originalValue;
365
- var isChanged = originalResult.isChanged;
396
+ var isChanged = originalResult.isChanged,
397
+ originalValue = originalResult.originalValue,
398
+ isAddCell = originalResult.isAddCell;
366
399
  otherProps.isChanged = isChanged;
367
400
  var originalRenderValue = originalValue === 'number' ? originalValue.toFixed(precision) : originalValue;
368
401
  var node = _jsxs(_Space, {
@@ -391,7 +424,8 @@ export var formatColumn = function formatColumn(_ref2) {
391
424
  currentValue: renderValue,
392
425
  toolTipProps: _toolTipProps,
393
426
  minWidth: minWidth,
394
- isInNewRowFlag: isInNewRowFlag
427
+ isInNewRowFlag: isInNewRowFlag,
428
+ isAddCell: isAddCell
395
429
  }));
396
430
  };
397
431
  } else if (valueType === 'address') {
@@ -399,8 +433,9 @@ export var formatColumn = function formatColumn(_ref2) {
399
433
  var _realValue$filter;
400
434
  var realValue = transform ? transform(value, record) : value;
401
435
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
402
- var originalValue = originalResult.originalValue;
403
- var isChanged = originalResult.isChanged;
436
+ var isChanged = originalResult.isChanged,
437
+ originalValue = originalResult.originalValue,
438
+ isAddCell = originalResult.isAddCell;
404
439
  otherProps.isChanged = isChanged;
405
440
  var originalRealValue = transform ? transform(originalValue, record) : originalValue;
406
441
  var isEmpty = !realValue || Array.isArray(realValue) && (realValue === null || realValue === void 0 ? void 0 : (_realValue$filter = realValue.filter(function (item) {
@@ -448,7 +483,8 @@ export var formatColumn = function formatColumn(_ref2) {
448
483
  currentValue: renderValue,
449
484
  toolTipProps: _toolTipProps,
450
485
  minWidth: minWidth,
451
- isInNewRowFlag: isInNewRowFlag
486
+ isInNewRowFlag: isInNewRowFlag,
487
+ isAddCell: isAddCell
452
488
  }));
453
489
  };
454
490
  } else if (copyable) {
@@ -473,8 +509,9 @@ export var formatColumn = function formatColumn(_ref2) {
473
509
  } else if (ellipsis) {
474
510
  column.render = function (value, record, index) {
475
511
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
476
- var originalValue = originalResult.originalValue;
477
- var isChanged = originalResult.isChanged;
512
+ var isChanged = originalResult.isChanged,
513
+ originalValue = originalResult.originalValue,
514
+ isAddCell = originalResult.isAddCell;
478
515
  otherProps.isChanged = isChanged;
479
516
  if (!value && value !== 0 && value === originalValue) {
480
517
  _jsx("div", {
@@ -497,15 +534,17 @@ export var formatColumn = function formatColumn(_ref2) {
497
534
  currentValue: value || '-',
498
535
  toolTipProps: _toolTipProps,
499
536
  minWidth: minWidth,
500
- isInNewRowFlag: isInNewRowFlag
537
+ isInNewRowFlag: isInNewRowFlag,
538
+ isAddCell: isAddCell
501
539
  })), suffixNode(value, record, index)]
502
540
  });
503
541
  };
504
542
  } else {
505
543
  column.render = function (value, record, index) {
506
544
  var originalResult = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
507
- var originalValue = originalResult.originalValue;
508
- var isChanged = originalResult.isChanged;
545
+ var isChanged = originalResult.isChanged,
546
+ originalValue = originalResult.originalValue,
547
+ isAddCell = originalResult.isAddCell;
509
548
  otherProps.isChanged = isChanged;
510
549
  var node = _jsxs(_Space, {
511
550
  size: 8,
@@ -530,7 +569,8 @@ export var formatColumn = function formatColumn(_ref2) {
530
569
  currentValue: value || '-',
531
570
  toolTipProps: _toolTipProps,
532
571
  minWidth: minWidth,
533
- isInNewRowFlag: isInNewRowFlag
572
+ isInNewRowFlag: isInNewRowFlag,
573
+ isAddCell: isAddCell
534
574
  }));
535
575
  };
536
576
  }
@@ -13,6 +13,8 @@ interface Props {
13
13
  minWidth?: number;
14
14
  isInNewRowFlag?: boolean;
15
15
  isChanged?: boolean;
16
+ /** 新增单元格字段 */
17
+ isAddCell?: boolean;
16
18
  }
17
19
  declare const RenderColumn: FC<Props>;
18
20
  export default RenderColumn;
@@ -37,7 +37,8 @@ var RenderColumn = function RenderColumn(props) {
37
37
  tooltip = _useSetState2[0].tooltip,
38
38
  setState = _useSetState2[1];
39
39
  var cellDiffCls = classNames({
40
- 'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged
40
+ 'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged,
41
+ 'add-cell': props === null || props === void 0 ? void 0 : props.isAddCell
41
42
  });
42
43
  // 比对场景走的逻辑
43
44
  if (!isInNewRowFlag && isBoolean(props === null || props === void 0 ? void 0 : props.isChanged)) {
@@ -97,10 +98,7 @@ var RenderColumn = function RenderColumn(props) {
97
98
  children: renderNode
98
99
  }));
99
100
  }
100
- if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
101
- return renderNode;
102
- }
103
- return _jsx("span", {
101
+ return _jsx("div", {
104
102
  className: cellDiffCls,
105
103
  style: {
106
104
  width: width,
@@ -40,11 +40,10 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
40
40
  toolTipProps?: TooltipProps & React.RefAttributes<unknown>;
41
41
  transform?: (value: any, record?: any) => string[];
42
42
  show?: boolean | (() => boolean);
43
- onDiff?: ({ value, originValue }: {
44
- value: any;
45
- originValue: any;
46
- }) => boolean;
47
- viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => any;
43
+ /** 自定义比对函数, 触发条件必须写render */
44
+ onDiff?: ({ value, record, index, originalValue, originalRecord }: any) => any;
45
+ /** 自定义提示render, 触发条件必须写render */
46
+ viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => 'same' | 'changed' | 'add' | undefined;
48
47
  isChanged?: boolean | null;
49
48
  }
50
49
  export interface CreateTreeFromArrayOptions {