@zat-design/sisyphus-react 3.8.2-beta.9 → 3.8.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.
- package/dist/index.esm.css +10 -4
- package/dist/less.esm.css +10 -4
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +7 -6
- package/es/ProEditTable/components/RenderField/index.js +1 -0
- package/es/ProEnum/hooks/useEnumRequest.js +1 -1
- package/es/ProEnum/index.js +2 -2
- package/es/ProForm/components/base/InputNumber/index.js +1 -1
- package/es/ProForm/components/render/ChangedWrapper.js +8 -2
- package/es/ProForm/components/render/Render.js +1 -0
- package/es/ProForm/style/index.less +13 -0
- package/es/ProTable/components/FormatColumn/index.d.ts +3 -1
- package/es/ProTable/components/FormatColumn/index.js +119 -28
- package/es/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/es/ProTable/components/RenderColumn/index.js +22 -7
- package/es/ProTable/index.js +11 -6
- package/es/ProTable/style/index.less +5 -4
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +10 -9
- package/lib/ProEditTable/components/RenderField/index.js +1 -0
- package/lib/ProEnum/hooks/useEnumRequest.js +1 -1
- package/lib/ProEnum/index.js +2 -2
- package/lib/ProForm/components/base/InputNumber/index.js +1 -1
- package/lib/ProForm/components/render/ChangedWrapper.js +8 -2
- package/lib/ProForm/components/render/Render.js +1 -0
- package/lib/ProForm/style/index.less +13 -0
- package/lib/ProTable/components/FormatColumn/index.d.ts +3 -1
- package/lib/ProTable/components/FormatColumn/index.js +118 -27
- package/lib/ProTable/components/RenderColumn/index.d.ts +1 -0
- package/lib/ProTable/components/RenderColumn/index.js +22 -7
- package/lib/ProTable/index.js +11 -6
- package/lib/ProTable/style/index.less +5 -4
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -1900,12 +1900,12 @@
|
|
|
1900
1900
|
background: unset !important;
|
|
1901
1901
|
}
|
|
1902
1902
|
.pro-table tbody.ant-table-tbody tr.ant-table-row.new-cell {
|
|
1903
|
-
background: #d2fff4 !important;
|
|
1904
|
-
background-color: #d2fff4 !important;
|
|
1903
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1904
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1905
1905
|
}
|
|
1906
1906
|
.pro-table tbody.ant-table-tbody tr.ant-table-row.new-cell td.ant-table-cell {
|
|
1907
|
-
background: #d2fff4 !important;
|
|
1908
|
-
background-color: #d2fff4 !important;
|
|
1907
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1908
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1909
1909
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
|
1910
1910
|
}
|
|
1911
1911
|
.pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell {
|
|
@@ -3139,6 +3139,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3139
3139
|
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3140
3140
|
border-radius: 4px;
|
|
3141
3141
|
}
|
|
3142
|
+
.changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
|
|
3143
|
+
white-space: nowrap;
|
|
3144
|
+
}
|
|
3145
|
+
.changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
|
|
3146
|
+
white-space: nowrap;
|
|
3147
|
+
}
|
|
3142
3148
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
3143
3149
|
padding: var(--zaui-space-size-sm, 8px);
|
|
3144
3150
|
background: #f8f9fa;
|
package/dist/less.esm.css
CHANGED
|
@@ -1900,12 +1900,12 @@
|
|
|
1900
1900
|
background: unset !important;
|
|
1901
1901
|
}
|
|
1902
1902
|
.pro-table tbody.ant-table-tbody tr.ant-table-row.new-cell {
|
|
1903
|
-
background: #d2fff4 !important;
|
|
1904
|
-
background-color: #d2fff4 !important;
|
|
1903
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1904
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1905
1905
|
}
|
|
1906
1906
|
.pro-table tbody.ant-table-tbody tr.ant-table-row.new-cell td.ant-table-cell {
|
|
1907
|
-
background: #d2fff4 !important;
|
|
1908
|
-
background-color: #d2fff4 !important;
|
|
1907
|
+
background: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1908
|
+
background-color: var(--zaui-contract-bg-add, #d2fff4) !important;
|
|
1909
1909
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
|
1910
1910
|
}
|
|
1911
1911
|
.pro-table tbody.ant-table-tbody .ant-table-cell .varied-cell {
|
|
@@ -3139,6 +3139,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
3139
3139
|
background: var(--zaui-contract-bg-add, #d2fff4);
|
|
3140
3140
|
border-radius: 4px;
|
|
3141
3141
|
}
|
|
3142
|
+
.changed-tooltip .original-value-container .ant-space-item:nth-child(1) {
|
|
3143
|
+
white-space: nowrap;
|
|
3144
|
+
}
|
|
3145
|
+
.changed-tooltip .current-value-container .ant-space-item:nth-child(1) {
|
|
3146
|
+
white-space: nowrap;
|
|
3147
|
+
}
|
|
3142
3148
|
.pro-upload .pro-upload-dragger .pro-upload-handle-box {
|
|
3143
3149
|
padding: var(--zaui-space-size-sm, 8px);
|
|
3144
3150
|
background: #f8f9fa;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
1
2
|
import "antd/es/space/style";
|
|
2
3
|
import _Space from "antd/es/space";
|
|
3
4
|
import "antd/es/tooltip/style";
|
|
4
5
|
import _Tooltip from "antd/es/tooltip";
|
|
5
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
6
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
7
|
-
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "valuePropName"];
|
|
8
|
+
var _excluded = ["name", "names", "namesStr", "originalName", "originalNames", "originalValues", "form", "equalWith", "rowKeyPath", "children", "type", "normalize", "getValueProps", "valuePropName"];
|
|
8
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
10
|
import React, { useMemo } from 'react';
|
|
10
11
|
import classNames from 'classnames';
|
|
@@ -65,6 +66,7 @@ var getOriginalValue = function getOriginalValue(_ref) {
|
|
|
65
66
|
}) : get(originalValues, originalName);
|
|
66
67
|
};
|
|
67
68
|
var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
69
|
+
var _getValueProps;
|
|
68
70
|
var name = props.name,
|
|
69
71
|
names = props.names,
|
|
70
72
|
namesStr = props.namesStr,
|
|
@@ -79,6 +81,7 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
79
81
|
children = props.children,
|
|
80
82
|
type = props.type,
|
|
81
83
|
normalize = props.normalize,
|
|
84
|
+
getValueProps = props.getValueProps,
|
|
82
85
|
_props$valuePropName = props.valuePropName,
|
|
83
86
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
84
87
|
rest = _objectWithoutProperties(props, _excluded);
|
|
@@ -124,12 +127,10 @@ var ListChangedWrapper = function ListChangedWrapper(props) {
|
|
|
124
127
|
return target.parentElement;
|
|
125
128
|
},
|
|
126
129
|
title: _jsxs(_Space, {
|
|
127
|
-
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, {
|
|
130
|
+
children: ["\u521D\u59CB\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children), {}, _defineProperty(_defineProperty({
|
|
128
131
|
// @ts-ignore
|
|
129
|
-
isView: true
|
|
130
|
-
|
|
131
|
-
checked: type === 'Switch' ? originalValue : undefined
|
|
132
|
-
})) : undefined]
|
|
132
|
+
isView: true
|
|
133
|
+
}, valuePropName, getValueProps ? (_getValueProps = getValueProps(originalValue)) === null || _getValueProps === void 0 ? void 0 : _getValueProps[valuePropName] : props[valuePropName]), "checked", type === 'Switch' ? originalValue : undefined))) : undefined]
|
|
133
134
|
}),
|
|
134
135
|
children: _jsx("div", {
|
|
135
136
|
className: diffClassName,
|
|
@@ -42,7 +42,7 @@ var useEnumRequest = function useEnumRequest(props, dispatch) {
|
|
|
42
42
|
}
|
|
43
43
|
var logDebug = function logDebug(msg) {
|
|
44
44
|
if (props.debugger) {
|
|
45
|
-
console.
|
|
45
|
+
console.warn('proEnum:', msg);
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
48
|
var enumRes = useRequestFunc(useRequest === null || useRequest === void 0 ? void 0 : useRequest.service, _objectSpread(_objectSpread({
|
package/es/ProEnum/index.js
CHANGED
|
@@ -53,8 +53,8 @@ var ProEnum = function ProEnum(props) {
|
|
|
53
53
|
showCodeName = _ref2.showCodeName,
|
|
54
54
|
resProps = _objectWithoutProperties(_ref2, _excluded2);
|
|
55
55
|
enumProps.showCodeName = (_enumProps$showCodeNa = enumProps.showCodeName) !== null && _enumProps$showCodeNa !== void 0 ? _enumProps$showCodeNa : showCodeName;
|
|
56
|
-
var label = '';
|
|
57
|
-
var fieldValue = '';
|
|
56
|
+
var label = 'label';
|
|
57
|
+
var fieldValue = 'value';
|
|
58
58
|
var _useState = useState(dataSource || []),
|
|
59
59
|
_useState2 = _slicedToArray(_useState, 2),
|
|
60
60
|
dataList = _useState2[0],
|
|
@@ -82,7 +82,7 @@ var InputNumber = function InputNumber(props) {
|
|
|
82
82
|
var _parser = function parser(value, precision) {
|
|
83
83
|
if (value === '') return value;
|
|
84
84
|
var num = Number(value.replace(/[\s,]+/g, ''));
|
|
85
|
-
return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : value : num.toFixed(precision);
|
|
85
|
+
return Number.isNaN(num) || !precision && precision !== 0 ? Number.isNaN(Number(value)) ? null : Number(value) : Number(num.toFixed(precision));
|
|
86
86
|
};
|
|
87
87
|
if (valueType) {
|
|
88
88
|
switch (valueType) {
|
|
@@ -5,7 +5,7 @@ import _Tooltip from "antd/es/tooltip";
|
|
|
5
5
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
6
6
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
7
7
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
8
|
-
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize"];
|
|
8
|
+
var _excluded = ["name", "names", "namesStr", "form", "equalWith", "children", "type", "diffConfig", "valuePropName", "normalize", "getValueProps"];
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
import classNames from 'classnames';
|
|
11
11
|
import { get } from 'lodash';
|
|
@@ -26,6 +26,7 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
26
26
|
_props$valuePropName = props.valuePropName,
|
|
27
27
|
valuePropName = _props$valuePropName === void 0 ? 'value' : _props$valuePropName,
|
|
28
28
|
normalize = props.normalize,
|
|
29
|
+
getValueProps = props.getValueProps,
|
|
29
30
|
rest = _objectWithoutProperties(props, _excluded);
|
|
30
31
|
var _useProConfig = useProConfig('ProForm'),
|
|
31
32
|
isDiffAll = _useProConfig.isDiffAll;
|
|
@@ -53,9 +54,10 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
53
54
|
var isChanged = diffType === 'changed';
|
|
54
55
|
var tipContent = useMemo(function () {
|
|
55
56
|
if (!isWatch || noChange) return undefined;
|
|
57
|
+
var valueProps = getValueProps ? getValueProps(originalValue) : originalValue;
|
|
56
58
|
return /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread({}, children.props), {}, _defineProperty({
|
|
57
59
|
isView: true
|
|
58
|
-
}, valuePropName,
|
|
60
|
+
}, valuePropName, valueProps === null || valueProps === void 0 ? void 0 : valueProps.value))) : undefined;
|
|
59
61
|
}, [originalValue, children]);
|
|
60
62
|
if (!isWatch || noChange) {
|
|
61
63
|
// 嵌套子组件
|
|
@@ -87,9 +89,13 @@ var ChangedWrapper = function ChangedWrapper(props) {
|
|
|
87
89
|
},
|
|
88
90
|
title: _jsxs(_Space, {
|
|
89
91
|
direction: "vertical",
|
|
92
|
+
className: "changed-tooltip",
|
|
90
93
|
children: [_jsxs(_Space, {
|
|
94
|
+
align: "start",
|
|
95
|
+
className: "original-value-container",
|
|
91
96
|
children: ["\u521D\u59CB\u503C\uFF1A", tipContent]
|
|
92
97
|
}), _showEllipse && _jsxs(_Space, {
|
|
98
|
+
className: "current-value-container",
|
|
93
99
|
children: ["\u5F53\u524D\u503C\uFF1A", /*#__PURE__*/React.isValidElement(children) ? /*#__PURE__*/React.cloneElement(children, _objectSpread(_objectSpread(_objectSpread({}, children.props), rest), {}, {
|
|
94
100
|
isView: true
|
|
95
101
|
})) : undefined]
|
|
@@ -472,3 +472,16 @@
|
|
|
472
472
|
}
|
|
473
473
|
}
|
|
474
474
|
}
|
|
475
|
+
|
|
476
|
+
.changed-tooltip {
|
|
477
|
+
.original-value-container {
|
|
478
|
+
.ant-space-item:nth-child(1) {
|
|
479
|
+
white-space: nowrap;
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
.current-value-container {
|
|
483
|
+
.ant-space-item:nth-child(1) {
|
|
484
|
+
white-space: nowrap;
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ProTableColumn } from '../../propsType';
|
|
3
|
-
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, }: {
|
|
3
|
+
export declare const formatColumn: ({ column, originalObj, dataSourceObj, rowKey, diffToolTip, wrapToolTipProps, scroll, onUpdateMinWidth, }: {
|
|
4
4
|
column: ProTableColumn;
|
|
5
5
|
originalObj: any;
|
|
6
6
|
dataSourceObj: any;
|
|
7
7
|
rowKey: any;
|
|
8
8
|
diffToolTip?: boolean;
|
|
9
9
|
wrapToolTipProps?: any;
|
|
10
|
+
scroll?: any;
|
|
11
|
+
onUpdateMinWidth?: any;
|
|
10
12
|
}) => void;
|
|
11
13
|
/**
|
|
12
14
|
* 查找最近的父级className
|
|
@@ -5,20 +5,53 @@ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-run
|
|
|
5
5
|
import { isValidElement } from 'react';
|
|
6
6
|
import moment from 'moment';
|
|
7
7
|
import classnames from 'classnames';
|
|
8
|
-
import
|
|
8
|
+
import ReactDOM from 'react-dom';
|
|
9
|
+
import { isEqual, isFunction, isString, isObject } from 'lodash';
|
|
9
10
|
import { tools } from '@zat-design/utils';
|
|
10
11
|
import TooltipTitle from '../TooltipTitle';
|
|
11
12
|
import RenderColumn from '../RenderColumn';
|
|
12
13
|
import { getDecimalDigits, getOriginalValue } from '../../utils';
|
|
13
14
|
import getEnumLabel from '../../../ProEnum/utils/getEnumLabel';
|
|
14
15
|
import ProForm from '../../../ProForm';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
16
|
+
var isReactElement = function isReactElement(element) {
|
|
17
|
+
return /*#__PURE__*/isValidElement(element);
|
|
18
|
+
};
|
|
19
|
+
var calcMinWidth = function calcMinWidth(_ref) {
|
|
20
|
+
var minWidth = _ref.minWidth,
|
|
21
|
+
width = _ref.width,
|
|
22
|
+
title = _ref.title,
|
|
23
|
+
isMaxContentOverFlow = _ref.isMaxContentOverFlow,
|
|
24
|
+
callback = _ref.callback;
|
|
25
|
+
if (!minWidth && !width && isMaxContentOverFlow) {
|
|
26
|
+
var tempEl = document.createElement('div');
|
|
27
|
+
tempEl.style.display = 'inline-block';
|
|
28
|
+
document.body.appendChild(tempEl);
|
|
29
|
+
if (isFunction(title)) {
|
|
30
|
+
var component = title();
|
|
31
|
+
ReactDOM.render(component, tempEl);
|
|
32
|
+
} else if (isReactElement(title)) {
|
|
33
|
+
ReactDOM.render(title, tempEl);
|
|
34
|
+
} else {
|
|
35
|
+
tempEl.innerHTML = title;
|
|
36
|
+
}
|
|
37
|
+
// 使用 requestAnimationFrame 确保在下一个浏览器重绘周期中获取宽度
|
|
38
|
+
requestAnimationFrame(function () {
|
|
39
|
+
var _width = tempEl.offsetWidth;
|
|
40
|
+
ReactDOM.unmountComponentAtNode(tempEl);
|
|
41
|
+
tempEl.remove();
|
|
42
|
+
callback(_width);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
export var formatColumn = function formatColumn(_ref2) {
|
|
47
|
+
var column = _ref2.column,
|
|
48
|
+
originalObj = _ref2.originalObj,
|
|
49
|
+
dataSourceObj = _ref2.dataSourceObj,
|
|
50
|
+
rowKey = _ref2.rowKey,
|
|
51
|
+
diffToolTip = _ref2.diffToolTip,
|
|
52
|
+
wrapToolTipProps = _ref2.wrapToolTipProps,
|
|
53
|
+
scroll = _ref2.scroll,
|
|
54
|
+
onUpdateMinWidth = _ref2.onUpdateMinWidth;
|
|
22
55
|
var title = column.title,
|
|
23
56
|
valueType = column.valueType,
|
|
24
57
|
_column$format = column.format,
|
|
@@ -37,7 +70,17 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
37
70
|
_column$originalDiffT = column.originalDiffTip,
|
|
38
71
|
originalDiffTip = _column$originalDiffT === void 0 ? true : _column$originalDiffT,
|
|
39
72
|
_column$toolTipProps = column.toolTipProps,
|
|
40
|
-
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps
|
|
73
|
+
toolTipProps = _column$toolTipProps === void 0 ? {} : _column$toolTipProps,
|
|
74
|
+
minWidth = column.minWidth;
|
|
75
|
+
// 仅在 {x: 'max-content', y: 300 } 且 column无指定 width minWidth 情况下 才开启 minWidth的自动计算
|
|
76
|
+
var isMaxContentOverFlow = isObject(scroll) ? (scroll === null || scroll === void 0 ? void 0 : scroll.x) === 'max-content' && Reflect.ownKeys(scroll).includes('y') : false;
|
|
77
|
+
calcMinWidth({
|
|
78
|
+
minWidth: minWidth,
|
|
79
|
+
width: width,
|
|
80
|
+
title: title,
|
|
81
|
+
isMaxContentOverFlow: isMaxContentOverFlow,
|
|
82
|
+
callback: onUpdateMinWidth
|
|
83
|
+
});
|
|
41
84
|
var _toolTipProps = _objectSpread(_objectSpread({}, toolTipProps), wrapToolTipProps);
|
|
42
85
|
var _originalDiffTip = diffToolTip !== null && diffToolTip !== void 0 ? diffToolTip : originalDiffTip;
|
|
43
86
|
// 前缀处理
|
|
@@ -65,13 +108,17 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
65
108
|
}
|
|
66
109
|
};
|
|
67
110
|
if (column === null || column === void 0 ? void 0 : column.render) {
|
|
111
|
+
if (!originalObj && Object.keys(originalObj !== null && originalObj !== void 0 ? originalObj : {}).length === 0) {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
68
114
|
var originalRender = column.render; // 保存原始的 render 方法
|
|
69
115
|
// 自定义render 手动重载下
|
|
70
116
|
column.render = function (value, record, index) {
|
|
117
|
+
var _originalObj$record$r;
|
|
71
118
|
var isFn = isFunction(originalRender);
|
|
72
|
-
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record, index) : undefined;
|
|
73
|
-
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
74
|
-
var originalRenderValue = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(originalValue, originalObj, index) : undefined;
|
|
119
|
+
var _value = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(value, record !== null && record !== void 0 ? record : {}, index) : undefined;
|
|
120
|
+
var originalValue = getOriginalValue(value, record !== null && record !== void 0 ? record : {}, originalObj, rowKey, dataIndex);
|
|
121
|
+
var originalRenderValue = isFn ? originalRender === null || originalRender === void 0 ? void 0 : originalRender(originalValue, (_originalObj$record$r = originalObj === null || originalObj === void 0 ? void 0 : originalObj[record === null || record === void 0 ? void 0 : record[rowKey]]) !== null && _originalObj$record$r !== void 0 ? _originalObj$record$r : {}, index) : undefined;
|
|
75
122
|
return _jsx(RenderColumn, {
|
|
76
123
|
valueType: valueType,
|
|
77
124
|
originalValue: originalValue === undefined ? undefined : originalRenderValue,
|
|
@@ -81,7 +128,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
81
128
|
node: _value,
|
|
82
129
|
currentValue: _value,
|
|
83
130
|
originalDiffTip: _originalDiffTip,
|
|
84
|
-
toolTipProps: _toolTipProps
|
|
131
|
+
toolTipProps: _toolTipProps,
|
|
132
|
+
minWidth: minWidth
|
|
85
133
|
});
|
|
86
134
|
};
|
|
87
135
|
return;
|
|
@@ -112,7 +160,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
112
160
|
originalRenderValue = '-';
|
|
113
161
|
}
|
|
114
162
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
115
|
-
return
|
|
163
|
+
return _jsx("div", {
|
|
164
|
+
style: {
|
|
165
|
+
minWidth: minWidth
|
|
166
|
+
},
|
|
167
|
+
children: "-"
|
|
168
|
+
});
|
|
116
169
|
}
|
|
117
170
|
var node = _jsxs(_Space, {
|
|
118
171
|
size: 8,
|
|
@@ -127,7 +180,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
127
180
|
value: value,
|
|
128
181
|
currentValue: renderValue,
|
|
129
182
|
originalDiffTip: _originalDiffTip,
|
|
130
|
-
toolTipProps: _toolTipProps
|
|
183
|
+
toolTipProps: _toolTipProps,
|
|
184
|
+
minWidth: minWidth
|
|
131
185
|
});
|
|
132
186
|
};
|
|
133
187
|
// 千分位, 千分位带CNY前缀
|
|
@@ -146,7 +200,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
146
200
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
147
201
|
});
|
|
148
202
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
149
|
-
|
|
203
|
+
_jsx("div", {
|
|
204
|
+
style: {
|
|
205
|
+
minWidth: minWidth
|
|
206
|
+
},
|
|
207
|
+
children: "-"
|
|
208
|
+
});
|
|
150
209
|
}
|
|
151
210
|
return _jsx(RenderColumn, {
|
|
152
211
|
valueType: valueType,
|
|
@@ -157,7 +216,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
157
216
|
value: value,
|
|
158
217
|
currentValue: renderValue,
|
|
159
218
|
originalDiffTip: _originalDiffTip,
|
|
160
|
-
toolTipProps: _toolTipProps
|
|
219
|
+
toolTipProps: _toolTipProps,
|
|
220
|
+
minWidth: minWidth
|
|
161
221
|
});
|
|
162
222
|
};
|
|
163
223
|
} else if (['datePicker', 'date', 'dateTime', 'dateStartTime', 'dateEndTime', 'dateStartEndTime'].includes(valueType)) {
|
|
@@ -199,7 +259,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
199
259
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
|
200
260
|
});
|
|
201
261
|
if (!value && renderValue === originalRenderValue) {
|
|
202
|
-
|
|
262
|
+
_jsx("div", {
|
|
263
|
+
style: {
|
|
264
|
+
minWidth: minWidth
|
|
265
|
+
},
|
|
266
|
+
children: "-"
|
|
267
|
+
});
|
|
203
268
|
}
|
|
204
269
|
return _jsx(RenderColumn, {
|
|
205
270
|
valueType: valueType,
|
|
@@ -210,7 +275,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
210
275
|
value: value,
|
|
211
276
|
currentValue: renderValue,
|
|
212
277
|
originalDiffTip: _originalDiffTip,
|
|
213
|
-
toolTipProps: _toolTipProps
|
|
278
|
+
toolTipProps: _toolTipProps,
|
|
279
|
+
minWidth: minWidth
|
|
214
280
|
});
|
|
215
281
|
};
|
|
216
282
|
} else if (['enumName', 'enumCodeName'].includes(valueType)) {
|
|
@@ -248,7 +314,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
248
314
|
value: value,
|
|
249
315
|
currentValue: renderValue,
|
|
250
316
|
originalDiffTip: _originalDiffTip,
|
|
251
|
-
toolTipProps: _toolTipProps
|
|
317
|
+
toolTipProps: _toolTipProps,
|
|
318
|
+
minWidth: minWidth
|
|
252
319
|
});
|
|
253
320
|
};
|
|
254
321
|
} else if (precision || prefix || suffix) {
|
|
@@ -264,7 +331,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
264
331
|
originalRenderValue = '-';
|
|
265
332
|
}
|
|
266
333
|
if (!value && value !== 0 && renderValue === originalRenderValue) {
|
|
267
|
-
|
|
334
|
+
_jsx("div", {
|
|
335
|
+
style: {
|
|
336
|
+
minWidth: minWidth
|
|
337
|
+
},
|
|
338
|
+
children: "-"
|
|
339
|
+
});
|
|
268
340
|
}
|
|
269
341
|
return _jsx(RenderColumn, {
|
|
270
342
|
valueType: valueType,
|
|
@@ -275,7 +347,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
275
347
|
value: value,
|
|
276
348
|
currentValue: renderValue,
|
|
277
349
|
originalDiffTip: _originalDiffTip,
|
|
278
|
-
toolTipProps: _toolTipProps
|
|
350
|
+
toolTipProps: _toolTipProps,
|
|
351
|
+
minWidth: minWidth
|
|
279
352
|
});
|
|
280
353
|
};
|
|
281
354
|
} else if (valueType === 'address') {
|
|
@@ -288,7 +361,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
288
361
|
return !!item;
|
|
289
362
|
})) === null || _realValue$filter === void 0 ? void 0 : _realValue$filter.length) === 0;
|
|
290
363
|
if (isEqual(value, originalValue) && isEmpty) {
|
|
291
|
-
|
|
364
|
+
_jsx("div", {
|
|
365
|
+
style: {
|
|
366
|
+
minWidth: minWidth
|
|
367
|
+
},
|
|
368
|
+
children: "-"
|
|
369
|
+
});
|
|
292
370
|
}
|
|
293
371
|
var className = classnames({
|
|
294
372
|
'varied-cell': originalValue !== undefined,
|
|
@@ -331,7 +409,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
331
409
|
node: value,
|
|
332
410
|
value: value,
|
|
333
411
|
currentValue: value,
|
|
334
|
-
toolTipProps: _toolTipProps
|
|
412
|
+
toolTipProps: _toolTipProps,
|
|
413
|
+
minWidth: minWidth
|
|
335
414
|
}), suffixNode(value, record, index)]
|
|
336
415
|
});
|
|
337
416
|
};
|
|
@@ -339,7 +418,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
339
418
|
column.render = function (value, record, index) {
|
|
340
419
|
var originalValue = getOriginalValue(value, record, originalObj, rowKey, dataIndex);
|
|
341
420
|
if (!value && value !== 0 && value === originalValue) {
|
|
342
|
-
|
|
421
|
+
_jsx("div", {
|
|
422
|
+
style: {
|
|
423
|
+
minWidth: minWidth
|
|
424
|
+
},
|
|
425
|
+
children: "-"
|
|
426
|
+
});
|
|
343
427
|
}
|
|
344
428
|
return _jsxs(_Space, {
|
|
345
429
|
size: 8,
|
|
@@ -352,7 +436,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
352
436
|
value: value,
|
|
353
437
|
currentValue: value || '-',
|
|
354
438
|
originalDiffTip: _originalDiffTip,
|
|
355
|
-
toolTipProps: _toolTipProps
|
|
439
|
+
toolTipProps: _toolTipProps,
|
|
440
|
+
minWidth: minWidth
|
|
356
441
|
}), suffixNode(value, record, index)]
|
|
357
442
|
});
|
|
358
443
|
};
|
|
@@ -364,7 +449,12 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
364
449
|
children: [prefixNode(value, record, index), value, suffixNode(value, record, index)]
|
|
365
450
|
});
|
|
366
451
|
if (!value && value !== 0 && value === originalValue) {
|
|
367
|
-
|
|
452
|
+
_jsx("div", {
|
|
453
|
+
style: {
|
|
454
|
+
minWidth: minWidth
|
|
455
|
+
},
|
|
456
|
+
children: "-"
|
|
457
|
+
});
|
|
368
458
|
}
|
|
369
459
|
return _jsx(RenderColumn, {
|
|
370
460
|
valueType: valueType,
|
|
@@ -375,7 +465,8 @@ export var formatColumn = function formatColumn(_ref) {
|
|
|
375
465
|
value: value,
|
|
376
466
|
currentValue: value || '-',
|
|
377
467
|
originalDiffTip: _originalDiffTip,
|
|
378
|
-
toolTipProps: _toolTipProps
|
|
468
|
+
toolTipProps: _toolTipProps,
|
|
469
|
+
minWidth: minWidth
|
|
379
470
|
});
|
|
380
471
|
};
|
|
381
472
|
}
|
|
@@ -23,7 +23,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
23
23
|
originalValue = props.originalValue,
|
|
24
24
|
originalDiffTip = props.originalDiffTip,
|
|
25
25
|
_props$toolTipProps = props.toolTipProps,
|
|
26
|
-
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps
|
|
26
|
+
toolTipProps = _props$toolTipProps === void 0 ? {} : _props$toolTipProps,
|
|
27
|
+
minWidth = props.minWidth;
|
|
27
28
|
var _useSetState = useSetState({
|
|
28
29
|
tooltip: false
|
|
29
30
|
}),
|
|
@@ -36,7 +37,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
36
37
|
if (ellipsis) {
|
|
37
38
|
renderNode = _jsx(Text, {
|
|
38
39
|
style: {
|
|
39
|
-
width: currentValue === '-' ? 32.5 : width
|
|
40
|
+
width: currentValue === '-' ? 32.5 : width,
|
|
41
|
+
minWidth: minWidth
|
|
40
42
|
},
|
|
41
43
|
ellipsis: {
|
|
42
44
|
tooltip: false
|
|
@@ -47,7 +49,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
47
49
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
48
50
|
className: "varied-cell",
|
|
49
51
|
style: {
|
|
50
|
-
width: width
|
|
52
|
+
width: width,
|
|
53
|
+
minWidth: minWidth
|
|
51
54
|
},
|
|
52
55
|
title: originalDiffTip ? _jsxs(_Fragment, {
|
|
53
56
|
children: ["\u521D\u59CB\u503C\uFF1A", originalValue, _jsx("br", {}), ellipsis ? "\u5F53\u524D\u503C\uFF1A".concat(currentValue) : undefined]
|
|
@@ -62,7 +65,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
62
65
|
return _jsx("span", {
|
|
63
66
|
className: "varied-cell",
|
|
64
67
|
style: {
|
|
65
|
-
width: width
|
|
68
|
+
width: width,
|
|
69
|
+
minWidth: minWidth
|
|
66
70
|
},
|
|
67
71
|
children: renderNode
|
|
68
72
|
});
|
|
@@ -133,7 +137,12 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
133
137
|
}
|
|
134
138
|
}, toolTipProps);
|
|
135
139
|
if (!value) {
|
|
136
|
-
return
|
|
140
|
+
return _jsx("div", {
|
|
141
|
+
style: {
|
|
142
|
+
minWidth: minWidth
|
|
143
|
+
},
|
|
144
|
+
children: "-"
|
|
145
|
+
});
|
|
137
146
|
}
|
|
138
147
|
return _jsx(_Tooltip, _objectSpread(_objectSpread({
|
|
139
148
|
title: value,
|
|
@@ -146,7 +155,8 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
146
155
|
}, tooltipProps), {}, {
|
|
147
156
|
children: _jsx(Text, {
|
|
148
157
|
style: {
|
|
149
|
-
width: width
|
|
158
|
+
width: width,
|
|
159
|
+
minWidth: minWidth
|
|
150
160
|
},
|
|
151
161
|
ellipsis: true,
|
|
152
162
|
onMouseOver: handleMouseOver,
|
|
@@ -155,6 +165,11 @@ var RenderColumn = function RenderColumn(props) {
|
|
|
155
165
|
})
|
|
156
166
|
}));
|
|
157
167
|
}
|
|
158
|
-
return
|
|
168
|
+
return _jsx("div", {
|
|
169
|
+
style: {
|
|
170
|
+
minWidth: minWidth
|
|
171
|
+
},
|
|
172
|
+
children: value || value === 0 ? node : '-'
|
|
173
|
+
});
|
|
159
174
|
};
|
|
160
175
|
export default RenderColumn;
|
package/es/ProTable/index.js
CHANGED
|
@@ -204,18 +204,22 @@ function ProTable(props) {
|
|
|
204
204
|
}).filter(function (item) {
|
|
205
205
|
return !(item === null || item === void 0 ? void 0 : item.delete);
|
|
206
206
|
});
|
|
207
|
-
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item) {
|
|
207
|
+
newColumns === null || newColumns === void 0 ? void 0 : newColumns.forEach(function (item, index) {
|
|
208
208
|
formatColumn({
|
|
209
209
|
column: item,
|
|
210
210
|
originalObj: originalObj,
|
|
211
211
|
dataSourceObj: dataSourceObj,
|
|
212
212
|
rowKey: 'rowKey',
|
|
213
213
|
diffToolTip: toolTip,
|
|
214
|
-
wrapToolTipProps: wrapToolTipProps
|
|
214
|
+
wrapToolTipProps: wrapToolTipProps,
|
|
215
|
+
scroll: _scroll,
|
|
216
|
+
onUpdateMinWidth: function onUpdateMinWidth(w) {
|
|
217
|
+
curColumns[index].minWidth = w;
|
|
218
|
+
}
|
|
215
219
|
});
|
|
216
220
|
});
|
|
217
221
|
return newColumns;
|
|
218
|
-
}, [curColumns, handleResize]);
|
|
222
|
+
}, [curColumns, handleResize, _scroll]);
|
|
219
223
|
var _columns = useMemo(function () {
|
|
220
224
|
return columns === null || columns === void 0 ? void 0 : columns.filter(function (item, index) {
|
|
221
225
|
var show = item.show;
|
|
@@ -228,9 +232,10 @@ function ProTable(props) {
|
|
|
228
232
|
return true;
|
|
229
233
|
});
|
|
230
234
|
}, [columns]);
|
|
231
|
-
var isExistPercentWidth = !!_columns.find(function (item) {
|
|
232
|
-
|
|
233
|
-
|
|
235
|
+
var isExistPercentWidth = !!(_columns === null || _columns === void 0 ? void 0 : _columns.find(function (item) {
|
|
236
|
+
var _item$width;
|
|
237
|
+
return (item === null || item === void 0 ? void 0 : item.width) && typeof (item === null || item === void 0 ? void 0 : item.width) === 'string' && (item === null || item === void 0 ? void 0 : (_item$width = item.width) === null || _item$width === void 0 ? void 0 : _item$width.endsWith('%'));
|
|
238
|
+
}));
|
|
234
239
|
if (isExistPercentWidth) {
|
|
235
240
|
_scroll = props === null || props === void 0 ? void 0 : props.scroll;
|
|
236
241
|
}
|
|
@@ -259,11 +259,12 @@
|
|
|
259
259
|
|
|
260
260
|
tbody.@{ant-prefix}-table-tbody {
|
|
261
261
|
tr.@{ant-prefix}-table-row.new-cell {
|
|
262
|
-
background: #d2fff4 !important;
|
|
263
|
-
background-color: #d2fff4 !important;
|
|
262
|
+
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
263
|
+
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
264
|
+
|
|
264
265
|
td.@{ant-prefix}-table-cell {
|
|
265
|
-
background: #d2fff4 !important;
|
|
266
|
-
background-color: #d2fff4 !important;
|
|
266
|
+
background: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
267
|
+
background-color: var(--zaui-contract-bg-add; #d2fff4) !important;
|
|
267
268
|
border-bottom: 1px solid var(--zaui-form-control-line, #dcdcdc);
|
|
268
269
|
}
|
|
269
270
|
}
|