@zat-design/sisyphus-react 3.9.2 → 3.9.3-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 (52) hide show
  1. package/.vscode/extensions.json +5 -0
  2. package/dist/index.esm.css +21 -1
  3. package/dist/less.esm.css +21 -1
  4. package/es/ProConfigProvider/index.js +3 -3
  5. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +3 -1
  6. package/es/ProEditTable/components/RenderField/index.js +3 -2
  7. package/es/ProEditTable/index.js +20 -15
  8. package/es/ProEnum/hooks/useEnum.js +2 -0
  9. package/es/ProForm/components/combination/FormList/components/ActionButton.js +10 -7
  10. package/es/ProForm/components/combination/FormList/components/LineFields.js +2 -1
  11. package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +6 -3
  12. package/es/ProForm/components/combination/FormList/index.js +1 -1
  13. package/es/ProForm/components/combination/ProCascader/index.js +7 -3
  14. package/es/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
  15. package/es/ProForm/components/render/ChangedWrapper.js +9 -5
  16. package/es/ProForm/components/render/Render.js +11 -7
  17. package/es/ProForm/index.js +11 -8
  18. package/es/ProForm/utils/diffOriginal.js +0 -1
  19. package/es/ProIcon/index.js +39 -22
  20. package/es/ProIcon/propsTypes.d.ts +2 -0
  21. package/es/ProTable/components/FormatColumn/index.js +69 -29
  22. package/es/ProTable/components/RenderColumn/index.d.ts +2 -0
  23. package/es/ProTable/components/RenderColumn/index.js +3 -5
  24. package/es/ProTable/propsType.d.ts +4 -5
  25. package/es/ProTable/style/index.less +27 -10
  26. package/es/ProTable/utils/index.d.ts +2 -0
  27. package/es/ProTable/utils/index.js +16 -3
  28. package/lib/ProConfigProvider/index.js +2 -2
  29. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +3 -1
  30. package/lib/ProEditTable/components/RenderField/index.js +3 -2
  31. package/lib/ProEditTable/index.js +19 -14
  32. package/lib/ProEnum/hooks/useEnum.js +2 -0
  33. package/lib/ProForm/components/combination/FormList/components/ActionButton.js +9 -6
  34. package/lib/ProForm/components/combination/FormList/components/LineFields.js +2 -1
  35. package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +4 -2
  36. package/lib/ProForm/components/combination/FormList/index.js +1 -1
  37. package/lib/ProForm/components/combination/ProCascader/index.js +7 -3
  38. package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +2 -0
  39. package/lib/ProForm/components/render/ChangedWrapper.js +9 -5
  40. package/lib/ProForm/components/render/Render.js +11 -7
  41. package/lib/ProForm/index.js +10 -7
  42. package/lib/ProForm/utils/diffOriginal.js +0 -1
  43. package/lib/ProIcon/index.js +37 -22
  44. package/lib/ProIcon/propsTypes.d.ts +2 -0
  45. package/lib/ProTable/components/FormatColumn/index.js +69 -29
  46. package/lib/ProTable/components/RenderColumn/index.d.ts +2 -0
  47. package/lib/ProTable/components/RenderColumn/index.js +3 -5
  48. package/lib/ProTable/propsType.d.ts +4 -5
  49. package/lib/ProTable/style/index.less +27 -10
  50. package/lib/ProTable/utils/index.d.ts +2 -0
  51. package/lib/ProTable/utils/index.js +16 -3
  52. package/package.json +1 -1
@@ -39,7 +39,8 @@ var RenderColumn = function RenderColumn(props) {
39
39
  tooltip = _useSetState2[0].tooltip,
40
40
  setState = _useSetState2[1];
41
41
  var cellDiffCls = (0, _classnames.default)({
42
- 'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged
42
+ 'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged,
43
+ 'add-cell': props === null || props === void 0 ? void 0 : props.isAddCell
43
44
  });
44
45
  // 比对场景走的逻辑
45
46
  if (!isInNewRowFlag && (0, _lodash.isBoolean)(props === null || props === void 0 ? void 0 : props.isChanged)) {
@@ -99,10 +100,7 @@ var RenderColumn = function RenderColumn(props) {
99
100
  children: renderNode
100
101
  }));
101
102
  }
102
- if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
103
- return renderNode;
104
- }
105
- return (0, _jsxRuntime.jsx)("span", {
103
+ return (0, _jsxRuntime.jsx)("div", {
106
104
  className: cellDiffCls,
107
105
  style: {
108
106
  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 {
@@ -277,16 +277,30 @@
277
277
  }
278
278
  }
279
279
 
280
- .@{ant-prefix}-table-cell .varied-cell {
281
- margin-left: -8px;
282
- padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
283
-
284
- background: var(--zaui-contract-bg; #fffaa1) !important;
285
- border-radius: var(--zaui-border-radius, 8px);
286
- .pro-form-view-container {
287
- overflow: hidden;
288
- white-space: nowrap;
289
- text-overflow: ellipsis;
280
+ .@{ant-prefix}-table-cell {
281
+ .varied-cell {
282
+ display: block;
283
+ margin-left: -8px;
284
+ padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
285
+ background-color: var(--zaui-contract-bg; #fffaa1) !important;
286
+ border-radius: var(--zaui-border-radius, 8px);
287
+ .pro-form-view-container {
288
+ overflow: hidden;
289
+ white-space: nowrap;
290
+ text-overflow: ellipsis;
291
+ }
292
+ }
293
+ .add-cell{
294
+ display: block;
295
+ margin-left: -8px;
296
+ padding: var(--zaui-space-size-xs, 4px) var(--zaui-space-size-sm, 8px);
297
+ background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
298
+ border-radius: var(--zaui-border-radius, 8px);
299
+ .pro-form-view-container {
300
+ overflow: hidden;
301
+ white-space: nowrap;
302
+ text-overflow: ellipsis;
303
+ }
290
304
  }
291
305
  }
292
306
 
@@ -586,5 +600,8 @@
586
600
  .@{ant-prefix}-table{
587
601
  .original-value-tooltip{
588
602
  position: fixed;
603
+ &.@{ant-prefix}-tooltip > @{ant-prefix}-tooltip-content > @{ant-prefix}-tooltip-inner{
604
+ width: max-content;
605
+ }
589
606
  }
590
607
  }
@@ -12,9 +12,11 @@ export declare const getDecimalDigits: (num?: number) => number;
12
12
  * @param any originalObj
13
13
  * @param {any} dataIndex
14
14
  * @return {any} isChanged 返回bool值,表示存在比对
15
+ * @return {any} isAddCell 返回bool值,表示存在比对
15
16
  */
16
17
  export declare const getOriginalValue: (value: any, record: any, originalObj: any, rowKey: any, dataIndex: any) => {
17
18
  originalValue: any;
19
+ isAddCell: boolean;
18
20
  isChanged: boolean;
19
21
  };
20
22
  export declare const getColumnDataIndex: (dataIndex: string | string[]) => string;
@@ -5,6 +5,8 @@ Object.defineProperty(exports, "__esModule", {
5
5
  });
6
6
  exports.isListResult = exports.getRowKey = exports.getOriginalValue = exports.getDecimalDigits = exports.getColumnDataIndex = void 0;
7
7
  var _lodash = require("lodash");
8
+ var _utils = require("@zat-design/utils");
9
+ var isEmpty = _utils.validate.isEmpty;
8
10
  /**
9
11
  * 获取小数点后的位数
10
12
  * @param num 数字
@@ -23,25 +25,36 @@ var getDecimalDigits = exports.getDecimalDigits = function getDecimalDigits() {
23
25
  * @param any originalObj
24
26
  * @param {any} dataIndex
25
27
  * @return {any} isChanged 返回bool值,表示存在比对
28
+ * @return {any} isAddCell 返回bool值,表示存在比对
26
29
  */
27
30
  var getOriginalValue = exports.getOriginalValue = function getOriginalValue(value, record, originalObj, rowKey, dataIndex) {
28
31
  if (!originalObj) {
29
32
  return {
30
33
  originalValue: null,
31
- isChanged: null
34
+ isChanged: null,
35
+ isAddCell: null
32
36
  };
33
37
  }
34
38
  var originalRecord = (0, _lodash.get)(originalObj, (0, _lodash.get)(record, rowKey));
35
39
  var originalValue = (0, _lodash.get)(originalRecord, dataIndex);
40
+ if (isEmpty(originalValue) && !isEmpty(value)) {
41
+ return {
42
+ originalValue: originalValue,
43
+ isAddCell: true,
44
+ isChanged: false
45
+ };
46
+ }
36
47
  if (!(0, _lodash.isEqual)(originalValue, value)) {
37
48
  return {
38
49
  originalValue: originalValue,
39
- isChanged: true
50
+ isChanged: true,
51
+ isAddCell: false
40
52
  };
41
53
  }
42
54
  return {
43
55
  originalValue: null,
44
- isChanged: false
56
+ isChanged: false,
57
+ isAddCell: false
45
58
  };
46
59
  };
47
60
  var getColumnDataIndex = exports.getColumnDataIndex = function getColumnDataIndex(dataIndex) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.9.2",
3
+ "version": "3.9.3-beta.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",