ztxkui 4.2.23-626 → 4.2.23-628
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/components/CanvasTable/components/CellOverlay.d.ts +0 -1
- package/dist/components/CanvasTable/components/CellOverlay.js +28 -7
- package/dist/components/CanvasTable/draw/scene.d.ts +9 -1
- package/dist/components/CanvasTable/draw/scene.js +31 -17
- package/dist/components/CanvasTable/hooks/useInteractions.js +16 -6
- package/dist/components/CanvasTable/hooks/useScrollState.js +21 -4
- package/dist/components/CanvasTable/index.js +13 -0
- package/dist/components/CanvasTable/utils/format.d.ts +5 -0
- package/dist/components/CanvasTable/utils/format.js +17 -0
- package/dist/components/CanvasTable/utils/hitTest.js +3 -4
- package/package.json +1 -1
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
/**
|
|
3
|
+
* 单元格覆盖层:render 返回 ReactNode 的单元格、ReactNode 表头。
|
|
4
|
+
* per-cell memo:滚动帧只有位置变化的单元格做 style diff,
|
|
5
|
+
* 内容(node 引用由 renderCache 稳定)子树整体跳过
|
|
6
|
+
*/
|
|
7
|
+
var CellOverlayItem = React.memo(function CellOverlayItem(_a) {
|
|
8
|
+
var cell = _a.cell;
|
|
9
|
+
return (React.createElement("div", { className: "zt-canvas-table__cell-overlay", style: {
|
|
8
10
|
position: 'absolute',
|
|
9
11
|
left: cell.x,
|
|
10
12
|
top: cell.y,
|
|
@@ -22,5 +24,24 @@ export function CellOverlay(_a) {
|
|
|
22
24
|
pointerEvents: 'auto',
|
|
23
25
|
boxSizing: 'border-box',
|
|
24
26
|
clipPath: cell.clipPath,
|
|
25
|
-
} }, cell.node));
|
|
27
|
+
} }, cell.node));
|
|
28
|
+
}, function (prev, next) {
|
|
29
|
+
var a = prev.cell;
|
|
30
|
+
var b = next.cell;
|
|
31
|
+
return (a.row === b.row &&
|
|
32
|
+
a.col === b.col &&
|
|
33
|
+
a.x === b.x &&
|
|
34
|
+
a.y === b.y &&
|
|
35
|
+
a.width === b.width &&
|
|
36
|
+
a.height === b.height &&
|
|
37
|
+
a.align === b.align &&
|
|
38
|
+
a.headerAlign === b.headerAlign &&
|
|
39
|
+
a.clipPath === b.clipPath &&
|
|
40
|
+
a.node === b.node);
|
|
41
|
+
});
|
|
42
|
+
export function CellOverlay(_a) {
|
|
43
|
+
var overlays = _a.overlays;
|
|
44
|
+
if (overlays.length === 0)
|
|
45
|
+
return null;
|
|
46
|
+
return (React.createElement(React.Fragment, null, overlays.map(function (cell) { return (React.createElement(CellOverlayItem, { key: "overlay-" + cell.row + "-" + cell.col, cell: cell })); })));
|
|
26
47
|
}
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ICellSelection, IBadgeProps, SortOrder } from '../interface';
|
|
2
|
+
import { IColumnType, ICellSelection, IBadgeProps, SortOrder } from '../interface';
|
|
3
3
|
import { ColumnLayout, ScrollbarMetrics } from '../utils/layout';
|
|
4
4
|
import { HeaderCellInfo } from '../utils/multiHeader';
|
|
5
5
|
import { MergeCellMap } from '../utils/merge';
|
|
6
6
|
import { RowMetrics, createRowAccessor } from '../utils/rowHeights';
|
|
7
7
|
import type { ISummaryData } from '../../Table/table-summary';
|
|
8
8
|
import { FlatRowMeta } from '../hooks/useExpandable';
|
|
9
|
+
export interface RenderCacheEntry {
|
|
10
|
+
renderFn: IColumnType['render'];
|
|
11
|
+
record: unknown;
|
|
12
|
+
index: number;
|
|
13
|
+
node: React.ReactNode;
|
|
14
|
+
}
|
|
9
15
|
export declare type CellKind = 'text' | 'overlay' | 'checkbox' | 'index' | 'empty';
|
|
10
16
|
export interface SceneCell {
|
|
11
17
|
row: number;
|
|
@@ -143,6 +149,8 @@ export interface BuildSceneParams<RecordType = any> {
|
|
|
143
149
|
summaryStartIndex: number | null;
|
|
144
150
|
/** summaryConfig 生成的合计行元数据(与 summaryStartIndex 起的行一一对应) */
|
|
145
151
|
summaryRows?: ISummaryData[] | null;
|
|
152
|
+
/** render 结果缓存(index.tsx 持有,跨滚动帧复用 render 输出引用) */
|
|
153
|
+
renderCache?: Map<string, RenderCacheEntry>;
|
|
146
154
|
mergeMap: MergeCellMap;
|
|
147
155
|
/** rowKey → 树形层级信息(按 key 映射,过滤/排序后依然稳定) */
|
|
148
156
|
expandMetaByKey: Map<string, FlatRowMeta> | null;
|
|
@@ -2,16 +2,34 @@ import { SPECIAL_KEYS } from '../utils/layout';
|
|
|
2
2
|
import { computeScrollbarMetrics } from '../utils/layout';
|
|
3
3
|
import { createRowAccessor } from '../utils/rowHeights';
|
|
4
4
|
import { isSummaryRow } from '../utils/summary';
|
|
5
|
-
import { formatCellValue } from '../utils/format';
|
|
5
|
+
import { formatCellValue, formatSummaryValue } from '../utils/format';
|
|
6
6
|
import { measureText } from '../utils/text';
|
|
7
7
|
import { TEXT_PADDING, SCROLLBAR_SIZE } from '../constants';
|
|
8
|
-
/**
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
8
|
+
/**
|
|
9
|
+
* render 结果缓存:renderFn/record/index 全一致才复用。
|
|
10
|
+
* 滚动帧拿到稳定引用,React 跳过内容子树 diff;业务更新 columns 或
|
|
11
|
+
* 数据引用变化时自动失效(renderFn/record 引用比对)
|
|
12
|
+
*/
|
|
13
|
+
function resolveRendered(renderCache, column, value, record, rowIndex, cacheKey) {
|
|
14
|
+
var cached = renderCache === null || renderCache === void 0 ? void 0 : renderCache.get(cacheKey);
|
|
15
|
+
if (cached &&
|
|
16
|
+
cached.renderFn === column.render &&
|
|
17
|
+
cached.record === record &&
|
|
18
|
+
cached.index === rowIndex) {
|
|
19
|
+
return cached.node;
|
|
20
|
+
}
|
|
21
|
+
var node = column.render({ value: value, record: record, index: rowIndex });
|
|
22
|
+
if (renderCache) {
|
|
23
|
+
if (renderCache.size > 5000)
|
|
24
|
+
renderCache.clear();
|
|
25
|
+
renderCache.set(cacheKey, {
|
|
26
|
+
renderFn: column.render,
|
|
27
|
+
record: record,
|
|
28
|
+
index: rowIndex,
|
|
29
|
+
node: node,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return node;
|
|
15
33
|
}
|
|
16
34
|
function resolveAlign(column) {
|
|
17
35
|
return column.align || 'left';
|
|
@@ -29,7 +47,7 @@ function computeLayerHeight(headerHeight, maxDepth) {
|
|
|
29
47
|
*/
|
|
30
48
|
export function buildScene(params) {
|
|
31
49
|
var _a, _b, _c, _d;
|
|
32
|
-
var dataSource = params.dataSource, layouts = params.layouts, headerRows = params.headerRows, getRowKey = params.getRowKey, containerWidth = params.containerWidth, containerHeight = params.containerHeight, headerHeight = params.headerHeight, rowHeight = params.rowHeight, scrollTop = params.scrollTop, scrollLeft = params.scrollLeft, hoverRow = params.hoverRow, sortField = params.sortField, sortOrder = params.sortOrder, filters = params.filters, selectedRowKeys = params.selectedRowKeys, striped = params.striped, bordered = params.bordered, cellSelection = params.cellSelection, resizeHoverIndex = params.resizeHoverIndex, resizeActiveIndex = params.resizeActiveIndex, getCheckboxProps = params.getCheckboxProps, summaryStartIndex = params.summaryStartIndex, _e = params.summaryRows, summaryRows = _e === void 0 ? null : _e, mergeMap = params.mergeMap, expandMetaByKey = params.expandMetaByKey, expandColumnLayoutIndex = params.expandColumnLayoutIndex, expandIndentColumnLayoutIndex = params.expandIndentColumnLayoutIndex, indentSize = params.indentSize, fixedTopRowsParam = params.fixedTopRows, fixedBottomRowsParam = params.fixedBottomRows, globalHeaderAlign = params.globalHeaderAlign, dynamicButtonColumnIndex = params.dynamicButtonColumnIndex, scrollbarVisible = params.scrollbarVisible, headerWrapParam = params.headerWrap, rowMetrics = params.rowMetrics;
|
|
50
|
+
var dataSource = params.dataSource, layouts = params.layouts, headerRows = params.headerRows, getRowKey = params.getRowKey, containerWidth = params.containerWidth, containerHeight = params.containerHeight, headerHeight = params.headerHeight, rowHeight = params.rowHeight, scrollTop = params.scrollTop, scrollLeft = params.scrollLeft, hoverRow = params.hoverRow, sortField = params.sortField, sortOrder = params.sortOrder, filters = params.filters, selectedRowKeys = params.selectedRowKeys, striped = params.striped, bordered = params.bordered, cellSelection = params.cellSelection, resizeHoverIndex = params.resizeHoverIndex, resizeActiveIndex = params.resizeActiveIndex, getCheckboxProps = params.getCheckboxProps, summaryStartIndex = params.summaryStartIndex, _e = params.summaryRows, summaryRows = _e === void 0 ? null : _e, renderCache = params.renderCache, mergeMap = params.mergeMap, expandMetaByKey = params.expandMetaByKey, expandColumnLayoutIndex = params.expandColumnLayoutIndex, expandIndentColumnLayoutIndex = params.expandIndentColumnLayoutIndex, indentSize = params.indentSize, fixedTopRowsParam = params.fixedTopRows, fixedBottomRowsParam = params.fixedBottomRows, globalHeaderAlign = params.globalHeaderAlign, dynamicButtonColumnIndex = params.dynamicButtonColumnIndex, scrollbarVisible = params.scrollbarVisible, headerWrapParam = params.headerWrap, rowMetrics = params.rowMetrics;
|
|
33
51
|
var headerWrap = headerWrapParam;
|
|
34
52
|
var maxDepth = Math.max(1, headerRows.length);
|
|
35
53
|
var layerHeight = computeLayerHeight(headerHeight, maxDepth);
|
|
@@ -257,7 +275,7 @@ export function buildScene(params) {
|
|
|
257
275
|
else if (meta) {
|
|
258
276
|
// summaryConfig 行:list 与叶子列 1:1 对齐(伪列位置为 undefined)
|
|
259
277
|
var item = (_a = meta.list) === null || _a === void 0 ? void 0 : _a[layout.index];
|
|
260
|
-
cell.text =
|
|
278
|
+
cell.text = formatSummaryValue(item, column);
|
|
261
279
|
if (meta.onClickHandle) {
|
|
262
280
|
var num_1 = item;
|
|
263
281
|
var columnIndex_1 = layout.index;
|
|
@@ -270,11 +288,7 @@ export function buildScene(params) {
|
|
|
270
288
|
}
|
|
271
289
|
else if (column.isSummary || column.render) {
|
|
272
290
|
if (column.render) {
|
|
273
|
-
var rendered = column.
|
|
274
|
-
value: value,
|
|
275
|
-
record: record,
|
|
276
|
-
index: rowIndex,
|
|
277
|
-
});
|
|
291
|
+
var rendered = resolveRendered(renderCache, column, value, record, rowIndex, key + '|' + column.key);
|
|
278
292
|
if (typeof rendered === 'string' ||
|
|
279
293
|
typeof rendered === 'number') {
|
|
280
294
|
cell.text = String(rendered);
|
|
@@ -289,7 +303,7 @@ export function buildScene(params) {
|
|
|
289
303
|
}
|
|
290
304
|
else {
|
|
291
305
|
cell.text = column.isSummary
|
|
292
|
-
?
|
|
306
|
+
? formatSummaryValue(value, column)
|
|
293
307
|
: '';
|
|
294
308
|
}
|
|
295
309
|
}
|
|
@@ -305,7 +319,7 @@ export function buildScene(params) {
|
|
|
305
319
|
cell.text = String(rowIndex + 1);
|
|
306
320
|
}
|
|
307
321
|
else if (column.render) {
|
|
308
|
-
var rendered =
|
|
322
|
+
var rendered = resolveRendered(renderCache, column, value, record, rowIndex, key + '|' + column.key);
|
|
309
323
|
if (typeof rendered === 'string' || typeof rendered === 'number') {
|
|
310
324
|
cell.text = String(rendered);
|
|
311
325
|
}
|
|
@@ -39,11 +39,15 @@ export function useInteractions(params) {
|
|
|
39
39
|
var selectStartRef = useRef(null);
|
|
40
40
|
var movedRef = useRef(false);
|
|
41
41
|
var hoverRowRef = useRef(null);
|
|
42
|
-
var notifySelection = useCallback(function (sel) {
|
|
42
|
+
var notifySelection = useCallback(function (sel, notifyBusiness) {
|
|
43
43
|
var _a;
|
|
44
|
+
if (notifyBusiness === void 0) { notifyBusiness = true; }
|
|
44
45
|
setCellSelection(sel);
|
|
45
46
|
cellSelectionRef.current = sel;
|
|
46
|
-
|
|
47
|
+
// 拖拽移动帧传 false:只更新内部,mouseup 时一次性回调业务,
|
|
48
|
+
// 避免业务在 onCellSelectionChange 里 setState 导致每帧重渲
|
|
49
|
+
if (notifyBusiness)
|
|
50
|
+
(_a = onCellSelectionChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onCellSelectionChangeRef, sel);
|
|
47
51
|
}, [setCellSelection, cellSelectionRef, onCellSelectionChangeRef]);
|
|
48
52
|
// ---- 全选 ----
|
|
49
53
|
var toggleSelectAll = useCallback(function () {
|
|
@@ -489,7 +493,7 @@ export function useInteractions(params) {
|
|
|
489
493
|
prev.endCol !== next.endCol ||
|
|
490
494
|
prev.startRow !== next.startRow ||
|
|
491
495
|
prev.startCol !== next.startCol) {
|
|
492
|
-
notifySelection(next);
|
|
496
|
+
notifySelection(next, false);
|
|
493
497
|
}
|
|
494
498
|
}
|
|
495
499
|
return;
|
|
@@ -623,7 +627,7 @@ export function useInteractions(params) {
|
|
|
623
627
|
}, [getLocalPos, handleMouseMoveAt]);
|
|
624
628
|
// ---- 结束拖拽 ----
|
|
625
629
|
var endDrag = useCallback(function (x, y) {
|
|
626
|
-
var _a, _b, _c;
|
|
630
|
+
var _a, _b, _c, _d;
|
|
627
631
|
var mode = modeRef.current;
|
|
628
632
|
if (mode === 'resize') {
|
|
629
633
|
var info = resizingRef.current;
|
|
@@ -635,6 +639,10 @@ export function useInteractions(params) {
|
|
|
635
639
|
if (mode === 'select') {
|
|
636
640
|
modeRef.current = 'none';
|
|
637
641
|
selectStartRef.current = null;
|
|
642
|
+
// 拖拽结束:框选结果一次性回调业务(拖拽移动帧不回调)
|
|
643
|
+
var sel = cellSelectionRef.current;
|
|
644
|
+
if (sel)
|
|
645
|
+
(_a = onCellSelectionChangeRef.current) === null || _a === void 0 ? void 0 : _a.call(onCellSelectionChangeRef, sel);
|
|
638
646
|
// 未拖动 = 单击:触发 onRowClick
|
|
639
647
|
if (!movedRef.current && x !== undefined && y !== undefined) {
|
|
640
648
|
var scene = sceneRef.current;
|
|
@@ -661,12 +669,12 @@ export function useInteractions(params) {
|
|
|
661
669
|
if (summaryStart != null && cell_3.row >= summaryStart) {
|
|
662
670
|
// 合计行不触发 onRowClick;summaryConfig 配置的单元格点击单独派发
|
|
663
671
|
var sceneCell = scene.dataCells.find(function (c) { return c.row === cell_3.row && c.col === cell_3.col; });
|
|
664
|
-
(
|
|
672
|
+
(_b = sceneCell === null || sceneCell === void 0 ? void 0 : sceneCell.summaryOnClick) === null || _b === void 0 ? void 0 : _b.call(sceneCell);
|
|
665
673
|
return;
|
|
666
674
|
}
|
|
667
675
|
var record = dataSourceRef.current[cell_3.row];
|
|
668
676
|
if (record)
|
|
669
|
-
(
|
|
677
|
+
(_d = (_c = callbacksRef.current).onRowClick) === null || _d === void 0 ? void 0 : _d.call(_c, record, cell_3.row);
|
|
670
678
|
}
|
|
671
679
|
}
|
|
672
680
|
}
|
|
@@ -679,6 +687,8 @@ export function useInteractions(params) {
|
|
|
679
687
|
metricsRef,
|
|
680
688
|
dataSourceRef,
|
|
681
689
|
callbacksRef,
|
|
690
|
+
cellSelectionRef,
|
|
691
|
+
onCellSelectionChangeRef,
|
|
682
692
|
]);
|
|
683
693
|
var handleMouseLeave = useCallback(function (e) {
|
|
684
694
|
// 拖拽进行中交给 document 监听收尾
|
|
@@ -22,6 +22,9 @@ export function useScrollState(params) {
|
|
|
22
22
|
var onScrollRef = useRef(onScroll);
|
|
23
23
|
onScrollRef.current = onScroll;
|
|
24
24
|
var dragRef = useRef({ mode: null, startPos: 0, startScroll: 0 });
|
|
25
|
+
// 连续 wheel 合帧:增量先累积,rAF 统一提交,每帧最多一次 setState
|
|
26
|
+
var pendingWheelRef = useRef({ left: 0, top: 0, scheduled: false });
|
|
27
|
+
var wheelRafRef = useRef(0);
|
|
25
28
|
/**
|
|
26
29
|
* clamp 后提交滚动位置。
|
|
27
30
|
* wheel 事件本身已按帧合成(~60Hz),React 事件批处理后每事件一次 render,
|
|
@@ -82,14 +85,28 @@ export function useScrollState(params) {
|
|
|
82
85
|
return;
|
|
83
86
|
e.preventDefault();
|
|
84
87
|
e.stopPropagation();
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
88
|
+
var pending = pendingWheelRef.current;
|
|
89
|
+
pending.left += deltaX;
|
|
90
|
+
pending.top += deltaY;
|
|
91
|
+
if (!pending.scheduled) {
|
|
92
|
+
pending.scheduled = true;
|
|
93
|
+
wheelRafRef.current = requestAnimationFrame(function () {
|
|
94
|
+
pending.scheduled = false;
|
|
95
|
+
commitScroll({
|
|
96
|
+
left: scrollRef.current.left + pending.left,
|
|
97
|
+
top: scrollRef.current.top + pending.top,
|
|
98
|
+
});
|
|
99
|
+
pending.left = 0;
|
|
100
|
+
pending.top = 0;
|
|
101
|
+
});
|
|
102
|
+
}
|
|
89
103
|
};
|
|
90
104
|
container.addEventListener('wheel', handleWheel, { passive: false });
|
|
91
105
|
return function () {
|
|
92
106
|
container.removeEventListener('wheel', handleWheel);
|
|
107
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
108
|
+
cancelAnimationFrame(wheelRafRef.current);
|
|
109
|
+
pendingWheelRef.current.scheduled = false;
|
|
93
110
|
};
|
|
94
111
|
}, [containerRef, metricsRef, commitScroll]);
|
|
95
112
|
var scrollTo = useCallback(function (params) {
|
|
@@ -178,6 +178,18 @@ function CanvasTableInner(props, ref) {
|
|
|
178
178
|
return 'hideColumn' in c ? __assign(__assign({}, c), { hidden: !!c.hideColumn }) : c;
|
|
179
179
|
});
|
|
180
180
|
}, [columns, dynamicStorageKey, storedList]);
|
|
181
|
+
// render 结果缓存:滚动帧复用 render 输出引用(逐条校验见 scene.resolveRendered)
|
|
182
|
+
var renderCacheRef = useRef(new Map());
|
|
183
|
+
var cacheRefsRef = useRef({
|
|
184
|
+
data: dataSource,
|
|
185
|
+
cols: baseColumns,
|
|
186
|
+
});
|
|
187
|
+
if (cacheRefsRef.current.data !== dataSource ||
|
|
188
|
+
cacheRefsRef.current.cols !== baseColumns) {
|
|
189
|
+
// 数据或列引用变化:全部失效(逐条 renderFn/record 校验是第二道兜底)
|
|
190
|
+
renderCacheRef.current.clear();
|
|
191
|
+
cacheRefsRef.current = { data: dataSource, cols: baseColumns };
|
|
192
|
+
}
|
|
181
193
|
var handleDynamicSave = useCallback(function (newList) {
|
|
182
194
|
if (dynamicStorageKey) {
|
|
183
195
|
setDynamicKey(dynamicStorageKey, newList);
|
|
@@ -417,6 +429,7 @@ function CanvasTableInner(props, ref) {
|
|
|
417
429
|
getCheckboxProps: rowSelection === null || rowSelection === void 0 ? void 0 : rowSelection.getCheckboxProps,
|
|
418
430
|
summaryStartIndex: summaryStartIndex,
|
|
419
431
|
summaryRows: summaryMetaRows,
|
|
432
|
+
renderCache: renderCacheRef.current,
|
|
420
433
|
mergeMap: mergeMap,
|
|
421
434
|
expandMetaByKey: metaByKey,
|
|
422
435
|
expandColumnLayoutIndex: expandColumnLayoutIndex,
|
|
@@ -4,3 +4,8 @@ export declare function formatPrecision(value: any, precision: number): string;
|
|
|
4
4
|
export declare function formatDate(value: any, format: string): string;
|
|
5
5
|
/** 按列配置格式化单元格值(千分符/精度/日期/空值) */
|
|
6
6
|
export declare function formatCellValue(value: any, column: IColumnType, noEmptyText?: boolean): string;
|
|
7
|
+
/**
|
|
8
|
+
* 合计单元格格式化:数值小数位按列 precision(未配置则保留原小数位),
|
|
9
|
+
* 千分符无条件生效(对齐 Table 合计展示习惯);非数值原样返回
|
|
10
|
+
*/
|
|
11
|
+
export declare function formatSummaryValue(item: any, column: IColumnType): string;
|
|
@@ -38,3 +38,20 @@ export function formatCellValue(value, column, noEmptyText) {
|
|
|
38
38
|
}
|
|
39
39
|
return String(result);
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* 合计单元格格式化:数值小数位按列 precision(未配置则保留原小数位),
|
|
43
|
+
* 千分符无条件生效(对齐 Table 合计展示习惯);非数值原样返回
|
|
44
|
+
*/
|
|
45
|
+
export function formatSummaryValue(item, column) {
|
|
46
|
+
if (item === null || item === undefined || item === '')
|
|
47
|
+
return '';
|
|
48
|
+
if (Array.isArray(item)) {
|
|
49
|
+
return item.map(function (v) { return formatSummaryValue(v, column); }).join('/');
|
|
50
|
+
}
|
|
51
|
+
var raw = String(item).replace(/,/g, '');
|
|
52
|
+
var num = Number(raw);
|
|
53
|
+
if (Number.isNaN(num))
|
|
54
|
+
return String(item);
|
|
55
|
+
var result = column.precision !== undefined ? num.toFixed(column.precision) : raw;
|
|
56
|
+
return formatThousand(result);
|
|
57
|
+
}
|
|
@@ -49,10 +49,10 @@ export function getCellAt(params) {
|
|
|
49
49
|
: Math.floor((y - headerHeight) / rowHeight);
|
|
50
50
|
}
|
|
51
51
|
else if (fixedBottomRows > 0 && y >= bottomAreaTop) {
|
|
52
|
-
//
|
|
52
|
+
// 固定底部区(rowAtSegmentOffset 返回绝对行号,无需再加段首)
|
|
53
53
|
var start = dataLength - fixedBottomRows;
|
|
54
54
|
rowIndex = acc
|
|
55
|
-
?
|
|
55
|
+
? rowAtSegmentOffset(acc, y - bottomAreaTop, start, dataLength)
|
|
56
56
|
: start + Math.floor((y - bottomAreaTop) / rowHeight);
|
|
57
57
|
}
|
|
58
58
|
else {
|
|
@@ -67,8 +67,7 @@ export function getCellAt(params) {
|
|
|
67
67
|
if (offset < 0 || offset >= scrollableContent)
|
|
68
68
|
return null; // 数据区末尾空白
|
|
69
69
|
rowIndex = acc
|
|
70
|
-
? fixedTopRows
|
|
71
|
-
rowAtSegmentOffset(acc, offset, fixedTopRows, dataLength - fixedBottomRows)
|
|
70
|
+
? rowAtSegmentOffset(acc, offset, fixedTopRows, dataLength - fixedBottomRows)
|
|
72
71
|
: fixedTopRows + Math.floor(offset / rowHeight);
|
|
73
72
|
if (rowIndex >= dataLength - fixedBottomRows)
|
|
74
73
|
return null;
|