@zat-design/sisyphus-react 3.10.1 → 3.10.2-beta.2
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/.vscode/extensions.json +5 -0
- package/es/ProEditTable/components/RenderField/ListChangedWrapper.js +2 -3
- package/es/ProEditTable/components/RenderField/index.js +8 -16
- package/es/ProForm/components/base/Input/index.js +23 -2
- package/es/ProForm/components/base/Input/propsType.d.ts +2 -0
- package/es/ProForm/components/combination/Group/utils.js +1 -13
- package/es/ProForm/components/combination/ProCascader/index.js +13 -8
- package/es/ProForm/components/combination/ProCascader/propsType.d.ts +1 -0
- package/es/ProForm/components/render/ChangedWrapper.js +1 -1
- package/es/ProForm/components/render/Render.js +11 -19
- package/es/ProForm/utils/transformValue.js +9 -5
- package/es/ProForm/utils/valueType.d.ts +0 -6
- package/es/ProForm/utils/valueType.js +4 -50
- package/es/ProSelect/index.js +11 -3
- package/es/ProTable/components/FormatColumn/index.js +0 -5
- package/es/ProTable/components/RenderColumn/index.js +55 -42
- package/es/ProTable/utils/index.d.ts +6 -0
- package/es/ProTable/utils/index.js +14 -0
- package/lib/ProEditTable/components/RenderField/ListChangedWrapper.js +1 -2
- package/lib/ProEditTable/components/RenderField/index.js +8 -16
- package/lib/ProForm/components/base/Input/index.js +23 -2
- package/lib/ProForm/components/base/Input/propsType.d.ts +2 -0
- package/lib/ProForm/components/combination/Group/utils.js +1 -13
- package/lib/ProForm/components/combination/ProCascader/index.js +13 -6
- package/lib/ProForm/components/combination/ProCascader/propsType.d.ts +1 -0
- package/lib/ProForm/components/render/ChangedWrapper.js +1 -1
- package/lib/ProForm/components/render/Render.js +11 -19
- package/lib/ProForm/utils/transformValue.js +9 -5
- package/lib/ProForm/utils/valueType.d.ts +0 -6
- package/lib/ProForm/utils/valueType.js +4 -50
- package/lib/ProSelect/index.js +10 -2
- package/lib/ProTable/components/FormatColumn/index.js +0 -5
- package/lib/ProTable/components/RenderColumn/index.js +56 -43
- package/lib/ProTable/utils/index.d.ts +6 -0
- package/lib/ProTable/utils/index.js +15 -1
- package/package.json +1 -1
package/lib/ProSelect/index.js
CHANGED
@@ -217,7 +217,15 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
217
217
|
}
|
218
218
|
return props.children;
|
219
219
|
};
|
220
|
-
var
|
220
|
+
var isReactElement = function isReactElement(element) {
|
221
|
+
return /*#__PURE__*/(0, _react.isValidElement)(element);
|
222
|
+
};
|
223
|
+
var handleChange = function handleChange(value, _option) {
|
224
|
+
// option/其第一层子节点是react节点且是labelInValue就拿record
|
225
|
+
var option = _option;
|
226
|
+
if (labelInValue && (isReactElement(_option) || isReactElement(_option === null || _option === void 0 ? void 0 : _option.children))) {
|
227
|
+
option = _option === null || _option === void 0 ? void 0 : _option.record;
|
228
|
+
}
|
221
229
|
var getChangeValue = selectProps.getChangeValue;
|
222
230
|
if (selectProps.mode && selectProps.mode === 'multiple') {
|
223
231
|
if (Array.isArray(option)) {
|
@@ -235,7 +243,7 @@ var ProSelect = exports.ProSelect = function ProSelect(props, ref) {
|
|
235
243
|
} else if (!selectProps.mode && labelInValue) {
|
236
244
|
onChange(getChangeValue ? getChangeValue(getValueObject(value)) : getValueObject(value), option);
|
237
245
|
} else {
|
238
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(value) : value,
|
246
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(getChangeValue ? getChangeValue(value) : value, _option === null || _option === void 0 ? void 0 : _option.record);
|
239
247
|
}
|
240
248
|
};
|
241
249
|
/**
|
@@ -347,11 +347,6 @@ var formatColumn = exports.formatColumn = function formatColumn(_ref2) {
|
|
347
347
|
if (!originalValue) {
|
348
348
|
originalRenderValue = '-';
|
349
349
|
}
|
350
|
-
if (originalObj && renderValue !== originalRenderValue) {
|
351
|
-
otherProps.isChanged = true;
|
352
|
-
} else {
|
353
|
-
otherProps.isChanged = false;
|
354
|
-
}
|
355
350
|
var node = (0, _jsxRuntime.jsxs)(_antd.Space, {
|
356
351
|
size: 8,
|
357
352
|
children: [prefixNode(value, record, index), renderValue, suffixNode(value, record, index)]
|
@@ -14,7 +14,8 @@ var _lodash = require("lodash");
|
|
14
14
|
var _classnames = _interopRequireDefault(require("classnames"));
|
15
15
|
var _icons = require("@ant-design/icons");
|
16
16
|
var _reactSvg = require("react-svg");
|
17
|
-
var _utils = require("
|
17
|
+
var _utils = require("../../utils");
|
18
|
+
var _utils2 = require("../../../utils");
|
18
19
|
var _copy = _interopRequireDefault(require("../../../assets/copy.svg"));
|
19
20
|
var Paragraph = _antd.Typography.Paragraph,
|
20
21
|
Text = _antd.Typography.Text;
|
@@ -43,6 +44,32 @@ var RenderColumn = function RenderColumn(props) {
|
|
43
44
|
'varied-cell': props === null || props === void 0 ? void 0 : props.isChanged,
|
44
45
|
'add-cell': props === null || props === void 0 ? void 0 : props.isAddCell
|
45
46
|
});
|
47
|
+
var checkEllipsis = function checkEllipsis(box) {
|
48
|
+
var range = document.createRange();
|
49
|
+
range.setStart(box, 0);
|
50
|
+
range.setEnd(box, box.childNodes.length);
|
51
|
+
var rangeWidth = range.getBoundingClientRect().width;
|
52
|
+
var _getPadding = (0, _utils.getPadding)(box),
|
53
|
+
pLeft = _getPadding.pLeft,
|
54
|
+
pRight = _getPadding.pRight,
|
55
|
+
pTop = _getPadding.pTop,
|
56
|
+
pBottom = _getPadding.pBottom;
|
57
|
+
var horizontalPadding = pLeft + pRight;
|
58
|
+
if (rangeWidth + horizontalPadding > box.clientWidth) {
|
59
|
+
return true;
|
60
|
+
}
|
61
|
+
return false;
|
62
|
+
};
|
63
|
+
var handleMouseOver = function handleMouseOver(e) {
|
64
|
+
setState({
|
65
|
+
tooltip: checkEllipsis(e.target)
|
66
|
+
});
|
67
|
+
};
|
68
|
+
var tooltipProps = (0, _objectSpread2.default)({
|
69
|
+
getPopupContainer: function getPopupContainer(triggerNode) {
|
70
|
+
return triggerNode.parentNode;
|
71
|
+
}
|
72
|
+
}, toolTipProps);
|
46
73
|
// 比对场景走的逻辑
|
47
74
|
if (!isInNewRowFlag && (0, _lodash.isBoolean)(props === null || props === void 0 ? void 0 : props.isChanged)) {
|
48
75
|
var renderNode = value ? node : '-';
|
@@ -60,11 +87,36 @@ var RenderColumn = function RenderColumn(props) {
|
|
60
87
|
}) : (0, _jsxRuntime.jsx)("div", {
|
61
88
|
style: {
|
62
89
|
minWidth: minWidth,
|
63
|
-
width: width
|
90
|
+
width: width,
|
91
|
+
overflow: 'hidden',
|
92
|
+
textOverflow: 'ellipsis',
|
93
|
+
whiteSpace: 'nowrap'
|
64
94
|
},
|
65
95
|
children: ellipsis ? currentValue : renderNode
|
66
96
|
});
|
67
97
|
if ((props === null || props === void 0 ? void 0 : props.isChanged) === false) {
|
98
|
+
if (ellipsis) {
|
99
|
+
return (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
100
|
+
title: currentValue,
|
101
|
+
onOpenChange: function onOpenChange(open) {
|
102
|
+
setState({
|
103
|
+
tooltip: false
|
104
|
+
});
|
105
|
+
},
|
106
|
+
open: tooltip
|
107
|
+
}, tooltipProps), {}, {
|
108
|
+
children: (0, _jsxRuntime.jsx)(Text, {
|
109
|
+
style: {
|
110
|
+
width: width,
|
111
|
+
minWidth: minWidth
|
112
|
+
},
|
113
|
+
ellipsis: true,
|
114
|
+
onMouseOver: handleMouseOver,
|
115
|
+
onFocus: handleMouseOver,
|
116
|
+
children: renderNode
|
117
|
+
})
|
118
|
+
}));
|
119
|
+
}
|
68
120
|
return renderNode;
|
69
121
|
}
|
70
122
|
if (Array.isArray(originalValue)) {
|
@@ -74,7 +126,7 @@ var RenderColumn = function RenderColumn(props) {
|
|
74
126
|
if (Array.isArray(originalValue)) {
|
75
127
|
return null;
|
76
128
|
}
|
77
|
-
return !(0,
|
129
|
+
return !(0, _utils2.isEmpty)(originalValue) ? originalValue : '-';
|
78
130
|
};
|
79
131
|
return (0, _jsxRuntime.jsx)(_antd.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
80
132
|
className: cellDiffCls,
|
@@ -88,7 +140,7 @@ var RenderColumn = function RenderColumn(props) {
|
|
88
140
|
title: (0, _jsxRuntime.jsx)(_antd.Space, {
|
89
141
|
direction: "vertical",
|
90
142
|
className: "changed-tooltip",
|
91
|
-
children: (props === null || props === void 0 ? void 0 : props.isChanged) ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
143
|
+
children: (props === null || props === void 0 ? void 0 : props.isChanged) && !(props === null || props === void 0 ? void 0 : props.isAddCell) ? (0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
92
144
|
children: [(0, _jsxRuntime.jsxs)(_antd.Space, {
|
93
145
|
align: "start",
|
94
146
|
className: "original-value-container",
|
@@ -140,45 +192,6 @@ var RenderColumn = function RenderColumn(props) {
|
|
140
192
|
});
|
141
193
|
}
|
142
194
|
if (ellipsis) {
|
143
|
-
var getPadding = function getPadding(el) {
|
144
|
-
var style = window.getComputedStyle(el, null);
|
145
|
-
var paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
|
146
|
-
var paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
|
147
|
-
var paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
|
148
|
-
var paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
|
149
|
-
return {
|
150
|
-
pLeft: paddingLeft,
|
151
|
-
pRight: paddingRight,
|
152
|
-
pTop: paddingTop,
|
153
|
-
pBottom: paddingBottom
|
154
|
-
};
|
155
|
-
};
|
156
|
-
var checkEllipsis = function checkEllipsis(box) {
|
157
|
-
var range = document.createRange();
|
158
|
-
range.setStart(box, 0);
|
159
|
-
range.setEnd(box, box.childNodes.length);
|
160
|
-
var rangeWidth = range.getBoundingClientRect().width;
|
161
|
-
var _getPadding = getPadding(box),
|
162
|
-
pLeft = _getPadding.pLeft,
|
163
|
-
pRight = _getPadding.pRight,
|
164
|
-
pTop = _getPadding.pTop,
|
165
|
-
pBottom = _getPadding.pBottom;
|
166
|
-
var horizontalPadding = pLeft + pRight;
|
167
|
-
if (rangeWidth + horizontalPadding > box.clientWidth) {
|
168
|
-
return true;
|
169
|
-
}
|
170
|
-
return false;
|
171
|
-
};
|
172
|
-
var handleMouseOver = function handleMouseOver(e) {
|
173
|
-
setState({
|
174
|
-
tooltip: checkEllipsis(e.target)
|
175
|
-
});
|
176
|
-
};
|
177
|
-
var tooltipProps = (0, _objectSpread2.default)({
|
178
|
-
getPopupContainer: function getPopupContainer(triggerNode) {
|
179
|
-
return triggerNode.parentNode;
|
180
|
-
}
|
181
|
-
}, toolTipProps);
|
182
195
|
if (!value) {
|
183
196
|
return (0, _jsxRuntime.jsx)("div", {
|
184
197
|
style: {
|
@@ -33,3 +33,9 @@ export declare const getRowKey: (rowKey: any, record: any) => any;
|
|
33
33
|
export declare const removeEmptyKeys: (obj: any) => {
|
34
34
|
[k: string]: unknown;
|
35
35
|
};
|
36
|
+
export declare const getPadding: (el: HTMLElement) => {
|
37
|
+
pLeft: number;
|
38
|
+
pRight: number;
|
39
|
+
pTop: number;
|
40
|
+
pBottom: number;
|
41
|
+
};
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
5
5
|
value: true
|
6
6
|
});
|
7
|
-
exports.removeEmptyKeys = exports.isListResult = exports.getRowKey = exports.getOriginalValue = exports.getDecimalDigits = exports.getColumnDataIndex = void 0;
|
7
|
+
exports.removeEmptyKeys = exports.isListResult = exports.getRowKey = exports.getPadding = exports.getOriginalValue = exports.getDecimalDigits = exports.getColumnDataIndex = void 0;
|
8
8
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
9
9
|
var _lodash = require("lodash");
|
10
10
|
var _utils = require("@zat-design/utils");
|
@@ -92,4 +92,18 @@ var removeEmptyKeys = exports.removeEmptyKeys = function removeEmptyKeys(obj) {
|
|
92
92
|
});
|
93
93
|
// 使用 Object.fromEntries() 将过滤后的键值对数组转换回对象
|
94
94
|
return Object.fromEntries(filteredEntries);
|
95
|
+
};
|
96
|
+
/* 获取边距 */
|
97
|
+
var getPadding = exports.getPadding = function getPadding(el) {
|
98
|
+
var style = window.getComputedStyle(el, null);
|
99
|
+
var paddingLeft = Number.parseInt(style.paddingLeft, 10) || 0;
|
100
|
+
var paddingRight = Number.parseInt(style.paddingRight, 10) || 0;
|
101
|
+
var paddingTop = Number.parseInt(style.paddingTop, 10) || 0;
|
102
|
+
var paddingBottom = Number.parseInt(style.paddingBottom, 10) || 0;
|
103
|
+
return {
|
104
|
+
pLeft: paddingLeft,
|
105
|
+
pRight: paddingRight,
|
106
|
+
pTop: paddingTop,
|
107
|
+
pBottom: paddingBottom
|
108
|
+
};
|
95
109
|
};
|