@canvas-components/list-table 0.3.16 → 0.3.17
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 +21 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +22 -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(
|
|
@@ -30505,9 +30509,10 @@ var ListTableRenderController = class {
|
|
|
30505
30509
|
const availableHeight = this.options.getContainerClientHeight() > 0 ? this.options.getContainerClientHeight() : hostSize.height;
|
|
30506
30510
|
const zoom = this.resolveZoom();
|
|
30507
30511
|
const layoutWidth = hostSize.width / zoom;
|
|
30508
|
-
const
|
|
30509
|
-
|
|
30510
|
-
|
|
30512
|
+
const measureSnapshot = this.buildSnapshot(
|
|
30513
|
+
layoutWidth,
|
|
30514
|
+
hostSize.height / zoom
|
|
30515
|
+
);
|
|
30511
30516
|
if (!measureSnapshot) {
|
|
30512
30517
|
this.options.setFittedHeight(null);
|
|
30513
30518
|
return;
|
|
@@ -30526,10 +30531,13 @@ var ListTableRenderController = class {
|
|
|
30526
30531
|
summaryHeight: measureSnapshot.bodyLayout.summaryHeight
|
|
30527
30532
|
});
|
|
30528
30533
|
const paginationElement = this.options.getPaginationElement();
|
|
30534
|
+
const scrollbar = this.options.getOptions().scrollbar;
|
|
30535
|
+
const horizontal = resolveCanvasScrollbarAxis(scrollbar, "horizontal");
|
|
30536
|
+
const horizontalReserve = horizontal.visible && measureSnapshot.columnMetrics.centerContentWidth - measureSnapshot.columnMetrics.availableCenterWidth > 1 ? horizontal.thickness + Math.max(scrollbar?.horizontalBottom ?? 0, 0) : 0;
|
|
30529
30537
|
const paginationHeight = paginationElement && paginationElement.style.display !== "none" ? paginationElement.offsetHeight : 0;
|
|
30530
30538
|
const fittedHeight = resolveFittedTableHeight({
|
|
30531
30539
|
availableHeight,
|
|
30532
|
-
contentHeight: contentHeight * zoom + paginationHeight
|
|
30540
|
+
contentHeight: (contentHeight + horizontalReserve) * zoom + paginationHeight
|
|
30533
30541
|
});
|
|
30534
30542
|
this.options.setFittedHeight(
|
|
30535
30543
|
fittedHeight == null ? null : fittedHeight + TABLE_CONTENT_BORDER_SIZE
|