ztxkui 4.2.23-602 → 4.2.23-604
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.
|
@@ -507,6 +507,7 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
507
507
|
isHasFilterRef: isHasFilterRef,
|
|
508
508
|
getPrecision: getPrecision,
|
|
509
509
|
disableExeclCopy: disableExeclCopy_1,
|
|
510
|
+
disablePrecisionControl: _column.disablePrecisionControl,
|
|
510
511
|
});
|
|
511
512
|
} });
|
|
512
513
|
// 兼容下拉框滚动行为
|
|
@@ -773,9 +774,13 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
773
774
|
_column.render = function (text, record, index) {
|
|
774
775
|
var percisionResult = getPrecision ? getPrecision === null || getPrecision === void 0 ? void 0 : getPrecision(record) : null;
|
|
775
776
|
var renderOption = {};
|
|
776
|
-
if (percisionResult) {
|
|
777
|
+
if (percisionResult != null) {
|
|
777
778
|
renderOption.precision = percisionResult;
|
|
778
779
|
}
|
|
780
|
+
else if (_column.disablePrecisionControl &&
|
|
781
|
+
typeof _column.precision === 'number') {
|
|
782
|
+
renderOption.precision = _column.precision;
|
|
783
|
+
}
|
|
779
784
|
var selfResult = selfRender_1(text, record, index, renderOption);
|
|
780
785
|
try {
|
|
781
786
|
// 如果命中了自定义显示字段,并且命中了是数字
|
|
@@ -875,10 +880,10 @@ function getNewColumns(basicConfig, editableConfig, dynamicConfig, otherConfig)
|
|
|
875
880
|
else if (_column.dateFormat) {
|
|
876
881
|
return dayjs(text).format(_column.dateFormat);
|
|
877
882
|
}
|
|
878
|
-
if (percisionResult) {
|
|
883
|
+
if (percisionResult != null) {
|
|
879
884
|
value = exactRound(text, percisionResult);
|
|
880
885
|
}
|
|
881
|
-
else if (_column.precision) {
|
|
886
|
+
else if (_column.precision != null) {
|
|
882
887
|
value = exactRound(text, _column.precision);
|
|
883
888
|
}
|
|
884
889
|
if (_column.thousand) {
|
|
@@ -56,6 +56,8 @@ interface IEditableCellProps {
|
|
|
56
56
|
onTableChange: any;
|
|
57
57
|
currentpage: ICurrentPage;
|
|
58
58
|
noTdWrap?: boolean;
|
|
59
|
+
/**是否禁用动态精度控制(保留静态 precision)*/
|
|
60
|
+
disablePrecisionControl?: boolean;
|
|
59
61
|
[props: string]: any;
|
|
60
62
|
}
|
|
61
63
|
declare const _default: React.NamedExoticComponent<IEditableCellProps>;
|
|
@@ -137,7 +137,7 @@ export function transformData(data, config) {
|
|
|
137
137
|
return newData;
|
|
138
138
|
}
|
|
139
139
|
var TableEnhanceCell = function (_a) {
|
|
140
|
-
var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, dataSource = _a.dataSource, onTableChange = _a.onTableChange, columns = _a.columns, currentpage = _a.currentpage, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, rowKey = _a.rowKey, expandableChildrenColumnName = _a.expandableChildrenColumnName, isHasFilterRef = _a.isHasFilterRef, getPrecision = _a.getPrecision, disableExeclCopy = _a.disableExeclCopy, noTdWrap = _a.noTdWrap, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "dataSource", "onTableChange", "columns", "currentpage", "onMouseEnter", "onMouseLeave", "rowKey", "expandableChildrenColumnName", "isHasFilterRef", "getPrecision", "disableExeclCopy", "noTdWrap"]);
|
|
140
|
+
var title = _a.title, index = _a.index, editable = _a.editable, editableConfig = _a.editableConfig, children = _a.children, dataIndex = _a.dataIndex, record = _a.record, handleSave = _a.handleSave, dataSource = _a.dataSource, onTableChange = _a.onTableChange, columns = _a.columns, currentpage = _a.currentpage, onMouseEnter = _a.onMouseEnter, onMouseLeave = _a.onMouseLeave, rowKey = _a.rowKey, expandableChildrenColumnName = _a.expandableChildrenColumnName, isHasFilterRef = _a.isHasFilterRef, getPrecision = _a.getPrecision, disableExeclCopy = _a.disableExeclCopy, disablePrecisionControl = _a.disablePrecisionControl, noTdWrap = _a.noTdWrap, restProps = __rest(_a, ["title", "index", "editable", "editableConfig", "children", "dataIndex", "record", "handleSave", "dataSource", "onTableChange", "columns", "currentpage", "onMouseEnter", "onMouseLeave", "rowKey", "expandableChildrenColumnName", "isHasFilterRef", "getPrecision", "disableExeclCopy", "disablePrecisionControl", "noTdWrap"]);
|
|
141
141
|
var tdRef = useRef();
|
|
142
142
|
var valueRef = useRef({});
|
|
143
143
|
var _b = useState(), val = _b[0], setVal = _b[1];
|
|
@@ -378,15 +378,20 @@ var TableEnhanceCell = function (_a) {
|
|
|
378
378
|
selectData = data();
|
|
379
379
|
}
|
|
380
380
|
var precisionResult = precision;
|
|
381
|
-
//
|
|
382
|
-
if (
|
|
383
|
-
|
|
384
|
-
|
|
381
|
+
// 禁用动态精度控制时,直接使用静态 precision
|
|
382
|
+
if (!disablePrecisionControl) {
|
|
383
|
+
// 这个配置的优先级最高
|
|
384
|
+
if (getPrecisionRef.current) {
|
|
385
|
+
try {
|
|
386
|
+
var dynamicPrecision = getPrecisionRef.current(record);
|
|
387
|
+
precisionResult =
|
|
388
|
+
dynamicPrecision != null ? dynamicPrecision : precision;
|
|
389
|
+
}
|
|
390
|
+
catch (err) { }
|
|
391
|
+
}
|
|
392
|
+
else if (precisionHandle) {
|
|
393
|
+
precisionResult = precisionHandle(record);
|
|
385
394
|
}
|
|
386
|
-
catch (err) { }
|
|
387
|
-
}
|
|
388
|
-
else if (precisionHandle) {
|
|
389
|
-
precisionResult = precisionHandle(record);
|
|
390
395
|
}
|
|
391
396
|
if (maxHandle && maxHandle instanceof Function) {
|
|
392
397
|
var result = maxHandle(record, { precision: precisionResult });
|
|
@@ -93,7 +93,10 @@ function formatCurrency(n) {
|
|
|
93
93
|
}
|
|
94
94
|
}
|
|
95
95
|
function getValue(value, isFocusRef, precision) {
|
|
96
|
-
if (value &&
|
|
96
|
+
if (value &&
|
|
97
|
+
!isNaN(Number(value)) &&
|
|
98
|
+
!isFocusRef.current &&
|
|
99
|
+
precision != null) {
|
|
97
100
|
return exactRound(value, precision);
|
|
98
101
|
}
|
|
99
102
|
return value;
|
|
@@ -113,7 +116,7 @@ function saveSafeInteger(value, precision) {
|
|
|
113
116
|
// if (Number(integerVal) > Number.MAX_SAFE_INTEGER) {
|
|
114
117
|
// integerVal = integerVal.substring(0, integerVal.length - 1);
|
|
115
118
|
// }
|
|
116
|
-
if (precision) {
|
|
119
|
+
if (precision != null) {
|
|
117
120
|
pointVal =
|
|
118
121
|
pointVal.length < precision ? pointVal : pointVal.substring(0, precision);
|
|
119
122
|
}
|