@canvas-components/list-table 0.3.16 → 0.3.18
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.cjs +48 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -14
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { stringifyDataIndex, getValueByDataIndex, clamp, copyTextSync, copyText, exportTableToXlsx,
|
|
1
|
+
import { stringifyDataIndex, getValueByDataIndex, clamp, resolveCanvasScrollbarAxis, copyTextSync, copyText, exportTableToXlsx, formatPreciseNumber, addPreciseNumbers, comparePreciseNumbers, isSameDataIndex, dividePreciseNumber, exportTableToTxt, exportTableToCsv, downloadJsonFile, mapRowsToExportRecords, copyJson, copyRows, parseNumberValue, formatNumberValue, formatPercentValue, formatScientificValue, formatChineseNumber, parseChineseNumber, normalizeDecimalPlaces, roundPreciseNumber, isDateTimeFormatPattern, formatDateTimeValue, formatCustomNumberPattern, isPointInRect as isPointInRect$1 } from '@canvas-components/utils';
|
|
2
2
|
import { drawBarcodeToCanvas } from '@canvas-components/barcode';
|
|
3
3
|
import { drawCanvasChartToCanvas, getCanvasChartRenderer, resolveCanvasChartTooltipText } from '@canvas-components/chart';
|
|
4
4
|
import { drawQrCodeToCanvas } from '@canvas-components/qrcode';
|
|
@@ -664,15 +664,19 @@ function stretchColumnWidths(columns, containerWidth) {
|
|
|
664
664
|
}
|
|
665
665
|
const extra = containerWidth - totalWidth;
|
|
666
666
|
const stretchableWidth = computeColumnWidths(stretchableColumns);
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
667
|
+
let accumulatedWidth = 0;
|
|
668
|
+
let allocatedExtra = 0;
|
|
669
|
+
stretchableColumns.forEach((column, index) => {
|
|
670
|
+
accumulatedWidth += column.width;
|
|
671
|
+
const targetExtra = index === stretchableColumns.length - 1 ? extra : Math.min(
|
|
672
|
+
extra,
|
|
673
|
+
Math.floor(
|
|
674
|
+
extra * (stretchableWidth > 0 ? accumulatedWidth / stretchableWidth : (index + 1) / stretchableColumns.length)
|
|
675
|
+
)
|
|
676
|
+
);
|
|
677
|
+
column.width += targetExtra - allocatedExtra;
|
|
678
|
+
allocatedExtra = targetExtra;
|
|
679
|
+
});
|
|
676
680
|
}
|
|
677
681
|
function shrinkColumnWidthsToFit(columns, containerWidth) {
|
|
678
682
|
let remaining = Math.max(
|
|
@@ -751,6 +755,7 @@ function normalizeColumn(column, depth, parentKey) {
|
|
|
751
755
|
align: column.align ?? "left",
|
|
752
756
|
headerAlign: column.headerAlign,
|
|
753
757
|
fixed: column.fixed,
|
|
758
|
+
resizable: column.resizable,
|
|
754
759
|
hidden: column.hidden,
|
|
755
760
|
showExpandIcon: column.showExpandIcon,
|
|
756
761
|
ellipsis: column.ellipsis,
|
|
@@ -8151,6 +8156,18 @@ var EMPTY_RANGE_HIGHLIGHT2 = {
|
|
|
8151
8156
|
selectedColumnRange: null
|
|
8152
8157
|
};
|
|
8153
8158
|
function drawSummary(params) {
|
|
8159
|
+
const width = params.width ?? Math.max(
|
|
8160
|
+
0,
|
|
8161
|
+
...[
|
|
8162
|
+
...params.leftColumns,
|
|
8163
|
+
...params.centerColumns,
|
|
8164
|
+
...params.rightColumns
|
|
8165
|
+
].map((column) => column.drawX + column.width)
|
|
8166
|
+
);
|
|
8167
|
+
params.ctx.save();
|
|
8168
|
+
params.ctx.fillStyle = params.theme.backgroundColor;
|
|
8169
|
+
params.ctx.fillRect(0, params.summaryTop, width, params.summaryHeight);
|
|
8170
|
+
params.ctx.restore();
|
|
8154
8171
|
const defaultTitleColumnKey = resolveDefaultSummaryTitleColumnKey([
|
|
8155
8172
|
...params.leftColumns,
|
|
8156
8173
|
...params.centerColumns,
|
|
@@ -29011,6 +29028,18 @@ function roundRect2(ctx, x, y, width, height, radius) {
|
|
|
29011
29028
|
|
|
29012
29029
|
// src/rendering/pipeline/body-section-renderer.ts
|
|
29013
29030
|
function drawListTableBodySections(params) {
|
|
29031
|
+
params.ctx.save();
|
|
29032
|
+
params.ctx.beginPath();
|
|
29033
|
+
params.ctx.rect(
|
|
29034
|
+
0,
|
|
29035
|
+
params.headerHeight,
|
|
29036
|
+
params.width + 1,
|
|
29037
|
+
Math.max(
|
|
29038
|
+
params.bottomFrozenTop + params.bottomFrozenHeight - params.headerHeight,
|
|
29039
|
+
0
|
|
29040
|
+
)
|
|
29041
|
+
);
|
|
29042
|
+
params.ctx.clip();
|
|
29014
29043
|
const baseParams = {
|
|
29015
29044
|
ctx: params.ctx,
|
|
29016
29045
|
rowHeight: params.rowHeight,
|
|
@@ -29075,6 +29104,7 @@ function drawListTableBodySections(params) {
|
|
|
29075
29104
|
borderColor: params.theme.borderColor
|
|
29076
29105
|
});
|
|
29077
29106
|
}
|
|
29107
|
+
params.ctx.restore();
|
|
29078
29108
|
}
|
|
29079
29109
|
function drawBodySection(params) {
|
|
29080
29110
|
const { section, bodyHeight } = params;
|
|
@@ -29956,6 +29986,7 @@ function executeListTableRenderPipeline(params) {
|
|
|
29956
29986
|
ctx,
|
|
29957
29987
|
textSelection: selection.textSelection,
|
|
29958
29988
|
summaryValues,
|
|
29989
|
+
width,
|
|
29959
29990
|
summaryTop,
|
|
29960
29991
|
summaryHeight: summaryRowHeight,
|
|
29961
29992
|
leftColumns: leftSegment,
|
|
@@ -30505,9 +30536,10 @@ var ListTableRenderController = class {
|
|
|
30505
30536
|
const availableHeight = this.options.getContainerClientHeight() > 0 ? this.options.getContainerClientHeight() : hostSize.height;
|
|
30506
30537
|
const zoom = this.resolveZoom();
|
|
30507
30538
|
const layoutWidth = hostSize.width / zoom;
|
|
30508
|
-
const
|
|
30509
|
-
|
|
30510
|
-
|
|
30539
|
+
const measureSnapshot = this.buildSnapshot(
|
|
30540
|
+
layoutWidth,
|
|
30541
|
+
hostSize.height / zoom
|
|
30542
|
+
);
|
|
30511
30543
|
if (!measureSnapshot) {
|
|
30512
30544
|
this.options.setFittedHeight(null);
|
|
30513
30545
|
return;
|
|
@@ -30526,10 +30558,13 @@ var ListTableRenderController = class {
|
|
|
30526
30558
|
summaryHeight: measureSnapshot.bodyLayout.summaryHeight
|
|
30527
30559
|
});
|
|
30528
30560
|
const paginationElement = this.options.getPaginationElement();
|
|
30561
|
+
const scrollbar = this.options.getOptions().scrollbar;
|
|
30562
|
+
const horizontal = resolveCanvasScrollbarAxis(scrollbar, "horizontal");
|
|
30563
|
+
const horizontalReserve = horizontal.visible && measureSnapshot.columnMetrics.centerContentWidth - measureSnapshot.columnMetrics.availableCenterWidth > 1 ? horizontal.thickness + Math.max(scrollbar?.horizontalBottom ?? 0, 0) : 0;
|
|
30529
30564
|
const paginationHeight = paginationElement && paginationElement.style.display !== "none" ? paginationElement.offsetHeight : 0;
|
|
30530
30565
|
const fittedHeight = resolveFittedTableHeight({
|
|
30531
30566
|
availableHeight,
|
|
30532
|
-
contentHeight: contentHeight * zoom + paginationHeight
|
|
30567
|
+
contentHeight: (contentHeight + horizontalReserve) * zoom + paginationHeight
|
|
30533
30568
|
});
|
|
30534
30569
|
this.options.setFittedHeight(
|
|
30535
30570
|
fittedHeight == null ? null : fittedHeight + TABLE_CONTENT_BORDER_SIZE
|