@zat-design/sisyphus-react 3.9.0-beta.9 → 3.9.1-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 (60) hide show
  1. package/dist/index.esm.css +26 -16
  2. package/dist/less.esm.css +22 -14
  3. package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -3
  4. package/es/ProEditTable/components/RenderField/index.js +3 -2
  5. package/es/ProEditTable/index.js +23 -16
  6. package/es/ProEditTable/style/index.less +14 -2
  7. package/es/ProEnum/index.js +5 -3
  8. package/es/ProEnum/propsType.d.ts +1 -0
  9. package/es/ProForm/components/base/SwitchCheckbox/index.js +9 -2
  10. package/es/ProForm/components/combination/FormList/index.js +1 -1
  11. package/es/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  12. package/es/ProForm/components/combination/Group/component/ComRender.js +12 -1
  13. package/es/ProForm/components/combination/ProModalSelect/index.js +28 -28
  14. package/es/ProForm/components/render/ChangedWrapper.js +1 -1
  15. package/es/ProForm/components/render/RenderFields.js +3 -2
  16. package/es/ProForm/components/render/propsType.d.ts +1 -0
  17. package/es/ProForm/style/index.less +10 -6
  18. package/es/ProForm/utils/diffOriginal.js +18 -12
  19. package/es/ProTable/components/FormatColumn/index.d.ts +4 -2
  20. package/es/ProTable/components/FormatColumn/index.js +54 -33
  21. package/es/ProTable/components/RenderColumn/index.d.ts +1 -2
  22. package/es/ProTable/components/RenderColumn/index.js +16 -12
  23. package/es/ProTable/components/TableResizable/index.js +1 -5
  24. package/es/ProTable/index.js +0 -1
  25. package/es/ProTable/propsType.d.ts +1 -2
  26. package/es/ProTable/utils/index.d.ts +5 -2
  27. package/es/ProTable/utils/index.js +13 -4
  28. package/es/style/theme/antd.less +4 -2
  29. package/es/utils/index.d.ts +1 -1
  30. package/es/utils/index.js +4 -1
  31. package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +5 -1
  32. package/lib/ProEditTable/components/RenderField/index.js +3 -2
  33. package/lib/ProEditTable/index.js +23 -16
  34. package/lib/ProEditTable/style/index.less +14 -2
  35. package/lib/ProEnum/index.js +5 -3
  36. package/lib/ProEnum/propsType.d.ts +1 -0
  37. package/lib/ProForm/components/base/SwitchCheckbox/index.js +9 -2
  38. package/lib/ProForm/components/combination/FormList/index.js +1 -1
  39. package/lib/ProForm/components/combination/Group/component/ComRender.d.ts +1 -0
  40. package/lib/ProForm/components/combination/Group/component/ComRender.js +12 -1
  41. package/lib/ProForm/components/combination/ProModalSelect/index.js +27 -27
  42. package/lib/ProForm/components/render/ChangedWrapper.js +1 -1
  43. package/lib/ProForm/components/render/RenderFields.js +3 -2
  44. package/lib/ProForm/components/render/propsType.d.ts +1 -0
  45. package/lib/ProForm/style/index.less +10 -6
  46. package/lib/ProForm/utils/diffOriginal.js +18 -12
  47. package/lib/ProTable/components/FormatColumn/index.d.ts +4 -2
  48. package/lib/ProTable/components/FormatColumn/index.js +53 -32
  49. package/lib/ProTable/components/RenderColumn/index.d.ts +1 -2
  50. package/lib/ProTable/components/RenderColumn/index.js +16 -12
  51. package/lib/ProTable/components/TableResizable/index.js +0 -4
  52. package/lib/ProTable/index.js +0 -1
  53. package/lib/ProTable/propsType.d.ts +1 -2
  54. package/lib/ProTable/utils/index.d.ts +5 -2
  55. package/lib/ProTable/utils/index.js +13 -4
  56. package/lib/style/theme/antd.less +4 -2
  57. package/lib/utils/index.d.ts +1 -1
  58. package/lib/utils/index.js +4 -1
  59. package/package.json +1 -1
  60. package/.vscode/extensions.json +0 -5
@@ -10,6 +10,7 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
10
10
  var _jsxRuntime = require("react/jsx-runtime");
11
11
  var _antd = require("antd");
12
12
  var _ahooks = require("ahooks");
13
+ var _lodash = require("lodash");
13
14
  var _classnames = _interopRequireDefault(require("classnames"));
14
15
  var _icons = require("@ant-design/icons");
15
16
  var _reactSvg = require("react-svg");
@@ -27,7 +28,6 @@ var RenderColumn = function RenderColumn(props) {
27
28
  ellipsis = props.ellipsis,
28
29
  width = props.width,
29
30
  originalValue = props.originalValue,
30
- originalDiffTip = props.originalDiffTip,
31
31
  _props$toolTipProps = props.toolTipProps,
32
32
  toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
33
33
  minWidth = props.minWidth,
@@ -39,11 +39,12 @@ 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': originalDiffTip
42
+ 'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged
43
43
  });
44
- if (!(0, _utils.isEmpty)(originalValue) && !isInNewRowFlag) {
44
+ // 比对场景走的逻辑
45
+ if (!isInNewRowFlag && (0, _lodash.isBoolean)(props === null || props === void 0 ? void 0 : props.isChanged)) {
45
46
  var renderNode = value ? node : '-';
46
- if (ellipsis || originalDiffTip) {
47
+ if (ellipsis || (props === null || props === void 0 ? void 0 : props.isChanged)) {
47
48
  renderNode = (0, _jsxRuntime.jsx)(Text, {
48
49
  style: {
49
50
  width: currentValue === '-' ? 32.5 : width,
@@ -54,29 +55,35 @@ var RenderColumn = function RenderColumn(props) {
54
55
  },
55
56
  children: ellipsis ? currentValue : renderNode
56
57
  });
57
- if ((props === null || props === void 0 ? void 0 : props.diffChange) === false) {
58
+ if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
58
59
  return renderNode;
59
60
  }
60
61
  if (Array.isArray(originalValue)) {
61
62
  console.error('Error: When enabled, dataIndex corresponds to an array, which needs to be converted using viewRender');
62
63
  }
64
+ var originalValueCalc = function originalValueCalc() {
65
+ if (Array.isArray(originalValue)) {
66
+ return null;
67
+ }
68
+ return !(0, _utils.isEmpty)(originalValue) ? originalValue : '-';
69
+ };
63
70
  return (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
64
71
  className: cellDiffCls,
65
72
  style: {
66
73
  width: width,
67
74
  minWidth: minWidth
68
75
  },
69
- overlayClassName: "original-value-tootip",
76
+ overlayClassName: "original-value-tooltip",
70
77
  placement: "topLeft",
71
78
  autoAdjustOverflow: false,
72
79
  title: (0, _jsxRuntime.jsx)(_antd.Space, {
73
80
  direction: "vertical",
74
81
  className: "changed-tooltip",
75
- children: originalDiffTip ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
82
+ children: (props === null || props === void 0 ? void 0 : props.isChanged) ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
76
83
  children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
77
84
  align: "start",
78
85
  className: "original-value-container",
79
- children: ["\u521D\u59CB\u503C\uFF1A", !Array.isArray(originalValue) ? originalValue : null]
86
+ children: ["\u521D\u59CB\u503C\uFF1A", originalValueCalc()]
80
87
  }), (0, _jsxRuntime.jsx)(_antd.Space, {
81
88
  className: "current-value-container",
82
89
  children: ellipsis ? (0, _jsxRuntime.jsxs)(_antd.Space, {
@@ -92,7 +99,7 @@ var RenderColumn = function RenderColumn(props) {
92
99
  children: renderNode
93
100
  }));
94
101
  }
95
- if ((props === null || props === void 0 ? void 0 : props.diffChange) === false) {
102
+ if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
96
103
  return renderNode;
97
104
  }
98
105
  return (0, _jsxRuntime.jsx)("span", {
@@ -145,15 +152,12 @@ var RenderColumn = function RenderColumn(props) {
145
152
  range.setStart(box, 0);
146
153
  range.setEnd(box, box.childNodes.length);
147
154
  var rangeWidth = range.getBoundingClientRect().width;
148
- var rangeHeight = range.getBoundingClientRect().height;
149
- var contentWidth = rangeWidth - Math.floor(rangeWidth);
150
155
  var _getPadding = getPadding(box),
151
156
  pLeft = _getPadding.pLeft,
152
157
  pRight = _getPadding.pRight,
153
158
  pTop = _getPadding.pTop,
154
159
  pBottom = _getPadding.pBottom;
155
160
  var horizontalPadding = pLeft + pRight;
156
- var verticalPadding = pTop + pBottom;
157
161
  if (rangeWidth + horizontalPadding > box.clientWidth) {
158
162
  return true;
159
163
  }
@@ -12,7 +12,6 @@ var _jsxRuntime = require("react/jsx-runtime");
12
12
  var _react = require("react");
13
13
  var _reactResizable = require("react-resizable");
14
14
  var _classnames = _interopRequireDefault(require("classnames"));
15
- var _index = require("../../index");
16
15
  var _FormatColumn = require("../FormatColumn");
17
16
  var _excluded = ["onDrag", "width", "minwidth"];
18
17
  var ResizableTitle = function ResizableTitle(props) {
@@ -22,9 +21,6 @@ var ResizableTitle = function ResizableTitle(props) {
22
21
  _props$minwidth = props.minwidth,
23
22
  minwidth = _props$minwidth === void 0 ? 50 : _props$minwidth,
24
23
  restProps = (0, _objectWithoutProperties2.default)(props, _excluded);
25
- var _useContext = (0, _react.useContext)(_index.TableContext),
26
- tableConfig = _useContext.tableConfig,
27
- Storage = _useContext.Storage;
28
24
  // 添加偏移量
29
25
  var _useState = (0, _react.useState)(0),
30
26
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -221,7 +221,6 @@ var ProTable = function ProTable(props) {
221
221
  originalObj: originalObj,
222
222
  rowKey: props.rowKey,
223
223
  diffConfig: diffConfig,
224
- diffToolTip: toolTip,
225
224
  wrapToolTipProps: wrapToolTipProps,
226
225
  scroll: _scroll,
227
226
  onUpdateMinWidth: function onUpdateMinWidth(w) {
@@ -31,7 +31,6 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
31
31
  value: string | number;
32
32
  }[];
33
33
  copyable?: boolean;
34
- originalDiffTip?: boolean;
35
34
  prefix?: string | ReactNode | ((value: any, record?: any, index?: number) => any);
36
35
  suffix?: string | ReactNode | ((value: any, record?: any, index?: number) => any);
37
36
  tooltip?: ReactNode | {
@@ -46,7 +45,7 @@ export interface ProTableColumn extends Omit<ColumnType<any>, 'dataIndex'> {
46
45
  originValue: any;
47
46
  }) => boolean;
48
47
  viewRender?: ({ value, record, index, originalValue, originalRecord }: any) => any;
49
- diffChange?: boolean;
48
+ isChanged?: boolean | null;
50
49
  }
51
50
  export interface CreateTreeFromArrayOptions {
52
51
  itemKey?: string;
@@ -11,9 +11,12 @@ export declare const getDecimalDigits: (num?: number) => number;
11
11
  * @param any value
12
12
  * @param any originalObj
13
13
  * @param {any} dataIndex
14
- * @return {any}
14
+ * @return {any} isChanged 返回bool值,表示存在比对
15
15
  */
16
- export declare const getOriginalValue: (value: any, record: any, originalObj: any, rowKey: any, dataIndex: any) => any;
16
+ export declare const getOriginalValue: (value: any, record: any, originalObj: any, rowKey: any, dataIndex: any) => {
17
+ originalValue: any;
18
+ isChanged: boolean;
19
+ };
17
20
  export declare const getColumnDataIndex: (dataIndex: string | string[]) => string;
18
21
  /**
19
22
  * 判断数据是否为Response<List<any>>结构
@@ -22,18 +22,27 @@ var getDecimalDigits = exports.getDecimalDigits = function getDecimalDigits() {
22
22
  * @param any value
23
23
  * @param any originalObj
24
24
  * @param {any} dataIndex
25
- * @return {any}
25
+ * @return {any} isChanged 返回bool值,表示存在比对
26
26
  */
27
27
  var getOriginalValue = exports.getOriginalValue = function getOriginalValue(value, record, originalObj, rowKey, dataIndex) {
28
28
  if (!originalObj) {
29
- return null;
29
+ return {
30
+ originalValue: null,
31
+ isChanged: null
32
+ };
30
33
  }
31
34
  var originalRecord = (0, _lodash.get)(originalObj, (0, _lodash.get)(record, rowKey));
32
35
  var originalValue = (0, _lodash.get)(originalRecord, dataIndex);
33
36
  if (!(0, _lodash.isEqual)(originalValue, value)) {
34
- return originalValue;
37
+ return {
38
+ originalValue: originalValue,
39
+ isChanged: true
40
+ };
35
41
  }
36
- return null;
42
+ return {
43
+ originalValue: null,
44
+ isChanged: false
45
+ };
37
46
  };
38
47
  var getColumnDataIndex = exports.getColumnDataIndex = function getColumnDataIndex(dataIndex) {
39
48
  return typeof dataIndex === 'string' ? dataIndex : dataIndex === null || dataIndex === void 0 ? void 0 : dataIndex.join('-');
@@ -280,8 +280,10 @@
280
280
  table {
281
281
  .@{ant-prefix}-table-tbody {
282
282
  .@{ant-prefix}-table-row:nth-child(even) {
283
- &:hover td {
284
- background-color: @zaui-table-hover-bg;
283
+ &:hover td,
284
+ &:hover td.@{ant-prefix}-table-cell-fix-right,
285
+ &:hover td.@{ant-prefix}-table-cell-fix-left {
286
+ background-color: @zaui-table-hover-bg !important;
285
287
  }
286
288
 
287
289
  & td,
@@ -1,3 +1,3 @@
1
1
  /** 判断一个值是否是空值 */
2
- export declare const isEmpty: (value: any) => boolean;
2
+ export declare const isEmpty: (value: any, emptyValue?: string) => boolean;
3
3
  export declare const useFocus: (element: Element) => boolean;
@@ -9,7 +9,10 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/sli
9
9
  var _react = require("react");
10
10
  var EMPTY_VALUE = [undefined, null, ''];
11
11
  /** 判断一个值是否是空值 */
12
- var isEmpty = exports.isEmpty = function isEmpty(value) {
12
+ var isEmpty = exports.isEmpty = function isEmpty(value, emptyValue) {
13
+ if (emptyValue) {
14
+ EMPTY_VALUE.push(emptyValue);
15
+ }
13
16
  if (EMPTY_VALUE.includes(value)) {
14
17
  return true;
15
18
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "3.9.0-beta.9",
3
+ "version": "3.9.1-beta.1",
4
4
  "license": "Apache-2.0",
5
5
  "main": "lib/index.js",
6
6
  "module": "es/index.js",
@@ -1,5 +0,0 @@
1
- {
2
- "recommendations": [
3
- "kisstkondoros.vscode-codemetrics"
4
- ]
5
- }