@canvas-components/list-table 0.3.13 → 0.3.14
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/README.md +296 -272
- package/dist/index.cjs +55 -37
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +56 -38
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -24028,8 +24028,6 @@ function deferQueryUntilLoadingPaint(start) {
|
|
|
24028
24028
|
}, 0);
|
|
24029
24029
|
});
|
|
24030
24030
|
}
|
|
24031
|
-
|
|
24032
|
-
// src/domain/layout/compute-scrollbar-layout.ts
|
|
24033
24031
|
var DEFAULT_HORIZONTAL_LEFT = 0;
|
|
24034
24032
|
var DEFAULT_HORIZONTAL_RIGHT = 0;
|
|
24035
24033
|
var DEFAULT_HORIZONTAL_BOTTOM = 0;
|
|
@@ -24039,10 +24037,8 @@ var DEFAULT_VERTICAL_BOTTOM = 0;
|
|
|
24039
24037
|
var MIN_SCROLLBAR_THUMB_SIZE = 36;
|
|
24040
24038
|
function computeScrollbarLayout(params) {
|
|
24041
24039
|
const layout = {};
|
|
24042
|
-
const
|
|
24043
|
-
|
|
24044
|
-
6
|
|
24045
|
-
);
|
|
24040
|
+
const horizontal = utils.resolveCanvasScrollbarAxis(params.scrollbar, "horizontal");
|
|
24041
|
+
const vertical = utils.resolveCanvasScrollbarAxis(params.scrollbar, "vertical");
|
|
24046
24042
|
const horizontalLeft = Math.max(
|
|
24047
24043
|
params.scrollbar?.horizontalLeft ?? DEFAULT_HORIZONTAL_LEFT,
|
|
24048
24044
|
0
|
|
@@ -24068,11 +24064,12 @@ function computeScrollbarLayout(params) {
|
|
|
24068
24064
|
0
|
|
24069
24065
|
);
|
|
24070
24066
|
const horizontalTrackWidth = Math.max(
|
|
24071
|
-
params.width - horizontalLeft - horizontalRight - (params.maxScrollTop > 0 ? thickness : 0),
|
|
24067
|
+
params.width - horizontalLeft - horizontalRight - (params.maxScrollTop > 0 && vertical.visible ? vertical.thickness : 0),
|
|
24072
24068
|
0
|
|
24073
24069
|
);
|
|
24074
|
-
const horizontalTrackY = params.height - thickness - horizontalBottom;
|
|
24075
|
-
if (params.maxScrollLeft > 0 && horizontalTrackWidth > 0) {
|
|
24070
|
+
const horizontalTrackY = params.height - horizontal.thickness - horizontalBottom;
|
|
24071
|
+
if (horizontal.visible && params.maxScrollLeft > 0 && horizontalTrackWidth > 0) {
|
|
24072
|
+
const thickness = horizontal.thickness;
|
|
24076
24073
|
const buttonSize = Math.min(thickness, horizontalTrackWidth / 3);
|
|
24077
24074
|
const trackX = horizontalLeft + buttonSize;
|
|
24078
24075
|
const trackWidth = Math.max(horizontalTrackWidth - buttonSize * 2, 0);
|
|
@@ -24115,9 +24112,10 @@ function computeScrollbarLayout(params) {
|
|
|
24115
24112
|
params.bodyHeight - verticalTop - verticalBottom,
|
|
24116
24113
|
0
|
|
24117
24114
|
);
|
|
24118
|
-
const verticalTrackX = params.width - thickness - verticalRight;
|
|
24115
|
+
const verticalTrackX = params.width - vertical.thickness - verticalRight;
|
|
24119
24116
|
const verticalTrackY = params.bodyTop + verticalTop;
|
|
24120
|
-
if (params.maxScrollTop > 0 && verticalTrackHeight > 0) {
|
|
24117
|
+
if (vertical.visible && params.maxScrollTop > 0 && verticalTrackHeight > 0) {
|
|
24118
|
+
const thickness = vertical.thickness;
|
|
24121
24119
|
const buttonSize = Math.min(thickness, verticalTrackHeight / 3);
|
|
24122
24120
|
const trackY = verticalTrackY + buttonSize;
|
|
24123
24121
|
const trackHeight = Math.max(verticalTrackHeight - buttonSize * 2, 0);
|
|
@@ -26032,10 +26030,15 @@ function buildListTableRenderSnapshot(params) {
|
|
|
26032
26030
|
baseRowsOverride,
|
|
26033
26031
|
displayRowsOverride
|
|
26034
26032
|
} = params;
|
|
26035
|
-
const
|
|
26036
|
-
options.scrollbar
|
|
26037
|
-
|
|
26033
|
+
const verticalScrollbar = utils.resolveCanvasScrollbarAxis(
|
|
26034
|
+
options.scrollbar,
|
|
26035
|
+
"vertical"
|
|
26036
|
+
);
|
|
26037
|
+
const horizontalScrollbar = utils.resolveCanvasScrollbarAxis(
|
|
26038
|
+
options.scrollbar,
|
|
26039
|
+
"horizontal"
|
|
26038
26040
|
);
|
|
26041
|
+
const scrollbarThickness = verticalScrollbar.visible ? verticalScrollbar.thickness : 0;
|
|
26039
26042
|
let width = Math.max(hostWidth - scrollbarThickness, 0);
|
|
26040
26043
|
let height = hostHeight;
|
|
26041
26044
|
const sourceNormalizedColumns = normalizeColumns(
|
|
@@ -26103,8 +26106,8 @@ function buildListTableRenderSnapshot(params) {
|
|
|
26103
26106
|
(col) => col.summary != null && col.summary !== false || col.summaryTitle != null
|
|
26104
26107
|
);
|
|
26105
26108
|
const hasSummary = queryRows.displayRows.length > 0 && options.summaryRowHeight !== 0 && (options.summaryRowHeight != null || hasConfiguredSummary);
|
|
26106
|
-
const hasHorizontalScrollbar =
|
|
26107
|
-
const horizontalScrollbarReserve = hasHorizontalScrollbar ?
|
|
26109
|
+
const hasHorizontalScrollbar = horizontalScrollbar.visible && columnMetrics.centerContentWidth - columnMetrics.availableCenterWidth > 1;
|
|
26110
|
+
const horizontalScrollbarReserve = hasHorizontalScrollbar ? horizontalScrollbar.thickness + Math.max(options.scrollbar?.horizontalBottom ?? 0, 0) : 0;
|
|
26108
26111
|
const contentHeight = Math.max(height - horizontalScrollbarReserve, 0);
|
|
26109
26112
|
const initialBodyLayout = resolveBodyLayout({
|
|
26110
26113
|
height: contentHeight,
|
|
@@ -27024,9 +27027,7 @@ function resolveListTableRenderHostSize(params) {
|
|
|
27024
27027
|
height: canvasHostElement && canvasHostElement.clientHeight > 0 ? canvasHostElement.clientHeight : fallbackHeight
|
|
27025
27028
|
};
|
|
27026
27029
|
}
|
|
27027
|
-
|
|
27028
|
-
// src/rendering/primitives/draw-scrollbars.ts
|
|
27029
|
-
function drawScrollbars(ctx, layout, descriptors, borderColor, opacity = 1, interactive = true, verticalFrame) {
|
|
27030
|
+
function drawScrollbars(ctx, layout, descriptors, borderColor, opacity = 1, interactive = true, verticalFrame, options) {
|
|
27030
27031
|
const alpha = Number.isFinite(opacity) ? Math.min(Math.max(opacity, 0), 1) : 1;
|
|
27031
27032
|
if (alpha <= 1e-3) {
|
|
27032
27033
|
return;
|
|
@@ -27050,7 +27051,8 @@ function drawScrollbars(ctx, layout, descriptors, borderColor, opacity = 1, inte
|
|
|
27050
27051
|
"horizontal",
|
|
27051
27052
|
descriptors,
|
|
27052
27053
|
borderColor,
|
|
27053
|
-
interactive
|
|
27054
|
+
interactive,
|
|
27055
|
+
utils.resolveCanvasScrollbarAxis(options, "horizontal")
|
|
27054
27056
|
);
|
|
27055
27057
|
}
|
|
27056
27058
|
if (layout.vertical) {
|
|
@@ -27060,7 +27062,8 @@ function drawScrollbars(ctx, layout, descriptors, borderColor, opacity = 1, inte
|
|
|
27060
27062
|
"vertical",
|
|
27061
27063
|
descriptors,
|
|
27062
27064
|
borderColor,
|
|
27063
|
-
interactive
|
|
27065
|
+
interactive,
|
|
27066
|
+
utils.resolveCanvasScrollbarAxis(options, "vertical")
|
|
27064
27067
|
);
|
|
27065
27068
|
}
|
|
27066
27069
|
if (layout.horizontal) {
|
|
@@ -27104,7 +27107,7 @@ function drawHorizontalScrollbarTopBorder(ctx, horizontal, vertical, borderColor
|
|
|
27104
27107
|
ctx.stroke();
|
|
27105
27108
|
ctx.restore();
|
|
27106
27109
|
}
|
|
27107
|
-
function drawAxisScrollbar(ctx, layout, axis, descriptors, borderColor, interactive) {
|
|
27110
|
+
function drawAxisScrollbar(ctx, layout, axis, descriptors, borderColor, interactive, style) {
|
|
27108
27111
|
const kind = axis === "horizontal" ? "horizontal-scrollbar" : "vertical-scrollbar";
|
|
27109
27112
|
if (interactive) {
|
|
27110
27113
|
descriptors.push({
|
|
@@ -27132,9 +27135,21 @@ function drawAxisScrollbar(ctx, layout, axis, descriptors, borderColor, interact
|
|
|
27132
27135
|
scrollbarRole: "increase-button"
|
|
27133
27136
|
});
|
|
27134
27137
|
}
|
|
27135
|
-
|
|
27136
|
-
|
|
27137
|
-
|
|
27138
|
+
if (style.trackColor != null) {
|
|
27139
|
+
ctx.save();
|
|
27140
|
+
ctx.fillStyle = style.trackColor;
|
|
27141
|
+
for (const rect of [
|
|
27142
|
+
layout.track,
|
|
27143
|
+
layout.decreaseButton,
|
|
27144
|
+
layout.increaseButton
|
|
27145
|
+
]) {
|
|
27146
|
+
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
27147
|
+
}
|
|
27148
|
+
ctx.restore();
|
|
27149
|
+
}
|
|
27150
|
+
drawButton(ctx, layout.decreaseButton, axis, "decrease", style.buttonColor);
|
|
27151
|
+
drawButton(ctx, layout.increaseButton, axis, "increase", style.buttonColor);
|
|
27152
|
+
drawThumb(ctx, layout.thumb, style);
|
|
27138
27153
|
drawTrackBorder(ctx, layout.track, axis, borderColor);
|
|
27139
27154
|
}
|
|
27140
27155
|
function drawTrackBorder(ctx, rect, axis, borderColor) {
|
|
@@ -27197,16 +27212,23 @@ function drawVerticalScrollbarFrame(ctx, frame, borderColor) {
|
|
|
27197
27212
|
}
|
|
27198
27213
|
ctx.restore();
|
|
27199
27214
|
}
|
|
27200
|
-
function drawThumb(ctx, rect) {
|
|
27215
|
+
function drawThumb(ctx, rect, style) {
|
|
27201
27216
|
ctx.save();
|
|
27202
|
-
ctx.fillStyle =
|
|
27203
|
-
roundRect2(
|
|
27217
|
+
ctx.fillStyle = style.thumbColor;
|
|
27218
|
+
roundRect2(
|
|
27219
|
+
ctx,
|
|
27220
|
+
rect.x,
|
|
27221
|
+
rect.y,
|
|
27222
|
+
rect.width,
|
|
27223
|
+
rect.height,
|
|
27224
|
+
style.thumbRadius ?? rect.height / 2
|
|
27225
|
+
);
|
|
27204
27226
|
ctx.fill();
|
|
27205
27227
|
ctx.restore();
|
|
27206
27228
|
}
|
|
27207
|
-
function drawButton(ctx, rect, axis, direction) {
|
|
27229
|
+
function drawButton(ctx, rect, axis, direction, color) {
|
|
27208
27230
|
ctx.save();
|
|
27209
|
-
ctx.fillStyle =
|
|
27231
|
+
ctx.fillStyle = color;
|
|
27210
27232
|
ctx.beginPath();
|
|
27211
27233
|
const centerX = rect.x + rect.width / 2;
|
|
27212
27234
|
const centerY = rect.y + rect.height / 2;
|
|
@@ -29481,8 +29503,6 @@ function resolveActiveCellSectionClipRect(descriptor, params) {
|
|
|
29481
29503
|
height: isTopFrozen ? params.topFrozenHeight : params.bottomFrozenHeight
|
|
29482
29504
|
};
|
|
29483
29505
|
}
|
|
29484
|
-
|
|
29485
|
-
// src/rendering/pipeline/render-pipeline.ts
|
|
29486
29506
|
function executeListTableRenderPipeline(params) {
|
|
29487
29507
|
const {
|
|
29488
29508
|
renderer,
|
|
@@ -29716,16 +29736,14 @@ function executeListTableRenderPipeline(params) {
|
|
|
29716
29736
|
isScrollbarInteractive,
|
|
29717
29737
|
{
|
|
29718
29738
|
x: width,
|
|
29719
|
-
width: options.scrollbar
|
|
29720
|
-
options.scrollbar?.thickness ?? DEFAULT_SCROLLBAR_THICKNESS,
|
|
29721
|
-
6
|
|
29722
|
-
),
|
|
29739
|
+
width: !utils.resolveCanvasScrollbarAxis(options.scrollbar, "vertical").visible ? 0 : utils.resolveCanvasScrollbarAxis(options.scrollbar, "vertical").thickness,
|
|
29723
29740
|
top: 0,
|
|
29724
29741
|
height,
|
|
29725
29742
|
headerBottom: headerHeight,
|
|
29726
29743
|
headerBackgroundColor: theme.headerBackgroundColor,
|
|
29727
29744
|
bodyBackgroundColor: theme.backgroundColor
|
|
29728
|
-
}
|
|
29745
|
+
},
|
|
29746
|
+
options.scrollbar
|
|
29729
29747
|
);
|
|
29730
29748
|
drawActiveCellOverlay({
|
|
29731
29749
|
ctx,
|