@canvas-components/list-table 0.3.15 → 0.3.16
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 +57 -2
- package/dist/index.cjs +201 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +52 -5
- package/dist/index.d.ts +52 -5
- package/dist/index.js +201 -44
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -69,6 +69,87 @@ var DebugManager = class {
|
|
|
69
69
|
console.info(`[ListTable Debug] ${label}`, payload);
|
|
70
70
|
}
|
|
71
71
|
};
|
|
72
|
+
|
|
73
|
+
// src/services/table-styles-service.ts
|
|
74
|
+
function resolveStylePixels(value) {
|
|
75
|
+
if (typeof value === "string" && !/^\s*\d+(?:\.\d+)?(?:px)?\s*$/.test(value))
|
|
76
|
+
return void 0;
|
|
77
|
+
const number = typeof value === "string" ? parseFloat(value) : value;
|
|
78
|
+
return number != null && Number.isFinite(number) && number >= 0 ? number : void 0;
|
|
79
|
+
}
|
|
80
|
+
function resolveCanvasCellStyle(style) {
|
|
81
|
+
if (!style) return void 0;
|
|
82
|
+
const padding = typeof style.padding === "string" ? style.padding.trim().split(/\s+/) : [style.padding];
|
|
83
|
+
const result = {
|
|
84
|
+
backgroundColor: style.backgroundColor,
|
|
85
|
+
color: style.color,
|
|
86
|
+
fontSize: resolveStylePixels(style.fontSize),
|
|
87
|
+
fontWeight: style.fontWeight == null ? void 0 : String(style.fontWeight),
|
|
88
|
+
fontFamily: style.fontFamily,
|
|
89
|
+
textAlign: style.textAlign,
|
|
90
|
+
verticalAlign: style.verticalAlign,
|
|
91
|
+
paddingInline: resolveStylePixels(style.paddingInline) ?? (padding.length <= 2 ? resolveStylePixels(padding[1] ?? padding[0]) : void 0),
|
|
92
|
+
paddingBlock: resolveStylePixels(style.paddingBlock) ?? (padding.length <= 2 ? resolveStylePixels(padding[0]) : void 0),
|
|
93
|
+
borderColor: style.borderColor,
|
|
94
|
+
borderWidth: resolveStylePixels(style.borderWidth)
|
|
95
|
+
};
|
|
96
|
+
return Object.fromEntries(
|
|
97
|
+
Object.entries(result).filter(([, value]) => value !== void 0)
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
function resolveListTableStyleOptions(options) {
|
|
101
|
+
const styles = options.styles;
|
|
102
|
+
if (!styles) return options;
|
|
103
|
+
const cell = resolveCanvasCellStyle(styles.cell) ?? {};
|
|
104
|
+
const header = { ...cell, ...resolveCanvasCellStyle(styles.header) };
|
|
105
|
+
const body = { ...cell, ...resolveCanvasCellStyle(styles.body) };
|
|
106
|
+
const summary = { ...cell, ...resolveCanvasCellStyle(styles.summary) };
|
|
107
|
+
const mapColumns = (columns) => columns.map((column) => ({
|
|
108
|
+
...column,
|
|
109
|
+
align: column.align ?? (column.cellStyle?.textAlign ?? body.textAlign),
|
|
110
|
+
headerAlign: column.headerAlign ?? (column.headerStyle?.textAlign ?? column.align ?? header.textAlign),
|
|
111
|
+
cellStyle: { ...body, ...column.cellStyle },
|
|
112
|
+
headerStyle: { ...header, ...column.headerStyle },
|
|
113
|
+
summaryStyle: { ...summary, ...column.summaryStyle },
|
|
114
|
+
children: column.children ? mapColumns(column.children) : void 0
|
|
115
|
+
}));
|
|
116
|
+
const scrollbar = { ...options.scrollbar };
|
|
117
|
+
for (const axis of ["vertical", "horizontal"]) {
|
|
118
|
+
const style = axis === "vertical" ? styles.scrollVertical : styles.scrollHorizontal;
|
|
119
|
+
if (!style || scrollbar[axis] === false) continue;
|
|
120
|
+
const mapped = {
|
|
121
|
+
thumbColor: style.color,
|
|
122
|
+
trackColor: style.backgroundColor,
|
|
123
|
+
thickness: resolveStylePixels(
|
|
124
|
+
axis === "vertical" ? style.width : style.height
|
|
125
|
+
),
|
|
126
|
+
thumbRadius: resolveStylePixels(style.borderRadius)
|
|
127
|
+
};
|
|
128
|
+
scrollbar[axis] = {
|
|
129
|
+
...scrollbar[axis],
|
|
130
|
+
...Object.fromEntries(
|
|
131
|
+
Object.entries(mapped).filter(([, value]) => value !== void 0)
|
|
132
|
+
)
|
|
133
|
+
};
|
|
134
|
+
}
|
|
135
|
+
return {
|
|
136
|
+
...options,
|
|
137
|
+
columns: mapColumns(options.columns),
|
|
138
|
+
scrollbar,
|
|
139
|
+
theme: {
|
|
140
|
+
...options.theme,
|
|
141
|
+
...cell.borderColor ? { borderColor: cell.borderColor } : {},
|
|
142
|
+
...cell.fontSize != null ? { fontSize: cell.fontSize } : {},
|
|
143
|
+
...cell.fontFamily ? { fontFamily: cell.fontFamily } : {},
|
|
144
|
+
...body.color ? { textColor: body.color } : {},
|
|
145
|
+
...header.backgroundColor ? { headerBackgroundColor: header.backgroundColor } : {},
|
|
146
|
+
...header.color ? { headerTextColor: header.color } : {},
|
|
147
|
+
...body.backgroundColor ? { backgroundColor: body.backgroundColor } : {},
|
|
148
|
+
activeCellStyle: resolveCanvasCellStyle(styles.activeCell),
|
|
149
|
+
activeRowStyle: resolveCanvasCellStyle(styles.activeRow)
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
}
|
|
72
153
|
function resolveColumnKey(column) {
|
|
73
154
|
return column.key?.trim() || stringifyDataIndex(column.dataIndex);
|
|
74
155
|
}
|
|
@@ -691,6 +772,7 @@ function normalizeColumn(column, depth, parentKey) {
|
|
|
691
772
|
moneyFormat: column.moneyFormat,
|
|
692
773
|
dataFormat: column.dataFormat,
|
|
693
774
|
headerStyle: column.headerStyle,
|
|
775
|
+
summaryStyle: column.summaryStyle,
|
|
694
776
|
summary: column.summary,
|
|
695
777
|
summaryTitle: column.summaryTitle,
|
|
696
778
|
meta: column.meta,
|
|
@@ -7201,10 +7283,11 @@ function roundRectPath(ctx, x, y, width, height, radius) {
|
|
|
7201
7283
|
}
|
|
7202
7284
|
|
|
7203
7285
|
// src/rendering/primitives/draw-grid.ts
|
|
7204
|
-
function drawGridRect(ctx, rect, theme, borderColor = theme.borderColor) {
|
|
7286
|
+
function drawGridRect(ctx, rect, theme, borderColor = theme.borderColor, borderWidth = 1) {
|
|
7287
|
+
if (borderWidth <= 0) return;
|
|
7205
7288
|
ctx.save();
|
|
7206
7289
|
ctx.strokeStyle = borderColor;
|
|
7207
|
-
ctx.lineWidth =
|
|
7290
|
+
ctx.lineWidth = borderWidth;
|
|
7208
7291
|
ctx.beginPath();
|
|
7209
7292
|
const showTop = rect.y > 0;
|
|
7210
7293
|
const showLeft = rect.x > 0;
|
|
@@ -7236,7 +7319,8 @@ function resolveHeaderTextLayout(params) {
|
|
|
7236
7319
|
allowActions,
|
|
7237
7320
|
hasFilter,
|
|
7238
7321
|
contentInsetStart = 0,
|
|
7239
|
-
contentInsetEnd = 0
|
|
7322
|
+
contentInsetEnd = 0,
|
|
7323
|
+
paddingInline = HEADER_TEXT_PADDING
|
|
7240
7324
|
} = params;
|
|
7241
7325
|
const contentRect = {
|
|
7242
7326
|
x: rect.x + contentInsetStart,
|
|
@@ -7258,11 +7342,11 @@ function resolveHeaderTextLayout(params) {
|
|
|
7258
7342
|
contentRect,
|
|
7259
7343
|
contentVisibleRect,
|
|
7260
7344
|
align,
|
|
7261
|
-
|
|
7345
|
+
paddingInline
|
|
7262
7346
|
);
|
|
7263
7347
|
const baseLayout = {
|
|
7264
7348
|
align,
|
|
7265
|
-
maxWidth: Math.max(contentVisibleRect.width -
|
|
7349
|
+
maxWidth: Math.max(contentVisibleRect.width - paddingInline * 2, 12),
|
|
7266
7350
|
x: baseX
|
|
7267
7351
|
};
|
|
7268
7352
|
if (!allowActions || !actionVisibilityState.visible || align === "left") {
|
|
@@ -7274,10 +7358,10 @@ function resolveHeaderTextLayout(params) {
|
|
|
7274
7358
|
trailingInset: contentInsetEnd
|
|
7275
7359
|
});
|
|
7276
7360
|
const textRight = Math.min(
|
|
7277
|
-
contentVisibleRect.x + contentVisibleRect.width -
|
|
7278
|
-
actionLayout.startX -
|
|
7361
|
+
contentVisibleRect.x + contentVisibleRect.width - paddingInline,
|
|
7362
|
+
actionLayout.startX - paddingInline
|
|
7279
7363
|
);
|
|
7280
|
-
const textLeft = contentVisibleRect.x +
|
|
7364
|
+
const textLeft = contentVisibleRect.x + paddingInline;
|
|
7281
7365
|
if (align === "center") {
|
|
7282
7366
|
const centeredWidth = Math.max(
|
|
7283
7367
|
Math.min(baseX - textLeft, textRight - baseX) * 2,
|
|
@@ -7412,9 +7496,15 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
7412
7496
|
const isRangeSelected = isHeaderCellInRange(params.rangeHighlight, cell);
|
|
7413
7497
|
ctx.fillStyle = isSelected || isRangeSelected ? theme.selectionBackgroundColor : cell.node.style?.backgroundColor ?? theme.headerBackgroundColor;
|
|
7414
7498
|
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
7415
|
-
drawGridRect(
|
|
7499
|
+
drawGridRect(
|
|
7500
|
+
ctx,
|
|
7501
|
+
rect,
|
|
7502
|
+
theme,
|
|
7503
|
+
cell.node.style?.borderColor,
|
|
7504
|
+
cell.node.style?.borderWidth
|
|
7505
|
+
);
|
|
7416
7506
|
ctx.fillStyle = cell.node.style?.color ?? theme.headerTextColor;
|
|
7417
|
-
ctx.font = `${theme.headerFontWeight} ${theme.fontSize}px ${theme.fontFamily}`;
|
|
7507
|
+
ctx.font = `${cell.node.style?.fontWeight ?? theme.headerFontWeight} ${cell.node.style?.fontSize ?? theme.fontSize}px ${cell.node.style?.fontFamily ?? theme.fontFamily}`;
|
|
7418
7508
|
ctx.textBaseline = "middle";
|
|
7419
7509
|
const visibleRect = clipRect ? intersectRects(rect, clipRect) : rect;
|
|
7420
7510
|
if (!visibleRect) {
|
|
@@ -7446,6 +7536,7 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
7446
7536
|
allowActions: cell.node.children.length === 0,
|
|
7447
7537
|
hasFilter: params.filterableColumnKeys.has(cell.node.key),
|
|
7448
7538
|
contentWidth: measureHeaderContentWidth(ctx, titleContent),
|
|
7539
|
+
paddingInline: cell.node.style?.paddingInline,
|
|
7449
7540
|
contentInsetStart: resolveHeaderContentInsetStart({
|
|
7450
7541
|
columnKey: cell.node.key,
|
|
7451
7542
|
hasChildren: cell.node.children.length > 0,
|
|
@@ -7457,7 +7548,7 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
7457
7548
|
const textY = resolveHeaderContentCenterY(
|
|
7458
7549
|
rect,
|
|
7459
7550
|
titleContent,
|
|
7460
|
-
theme.fontSize,
|
|
7551
|
+
cell.node.style?.fontSize ?? theme.fontSize,
|
|
7461
7552
|
cell.node.style?.paddingBlock ?? params.defaultPaddingBlock ?? resolveDensityPaddingBlock(cell.height),
|
|
7462
7553
|
cell.node.style?.verticalAlign
|
|
7463
7554
|
);
|
|
@@ -8119,6 +8210,11 @@ function drawSummarySegment(params, columns, clipRect, defaultTitleColumnKey) {
|
|
|
8119
8210
|
function drawSummaryCell(ctx, rect, column, theme, summaryValues, selectedHeaderKey, summarySelected, rangeHighlight, clipRect, descriptors, inlineContentInset, defaultTitleColumnKey, textSelection) {
|
|
8120
8211
|
ctx.save();
|
|
8121
8212
|
const cellClip = clipRect ? intersectRects2(rect, clipRect) : rect;
|
|
8213
|
+
const style = column.summaryStyle;
|
|
8214
|
+
const fontSize = style?.fontSize ?? theme.fontSize;
|
|
8215
|
+
const paddingInline = style?.paddingInline ?? 12;
|
|
8216
|
+
const paddingBlock = style?.paddingBlock ?? 0;
|
|
8217
|
+
const textY = style?.verticalAlign === "top" ? rect.y + paddingBlock + fontSize / 2 : style?.verticalAlign === "bottom" ? rect.y + rect.height - paddingBlock - fontSize / 2 : rect.y + rect.height / 2;
|
|
8122
8218
|
if (!cellClip) {
|
|
8123
8219
|
ctx.restore();
|
|
8124
8220
|
return;
|
|
@@ -8128,9 +8224,9 @@ function drawSummaryCell(ctx, rect, column, theme, summaryValues, selectedHeader
|
|
|
8128
8224
|
column.leafIndex,
|
|
8129
8225
|
(rangeHighlight ?? EMPTY_RANGE_HIGHLIGHT2).selectedColumnRange
|
|
8130
8226
|
);
|
|
8131
|
-
ctx.fillStyle = summarySelected || isHeaderColumnSelected || isColumnRangeSelected ? theme.selectionBackgroundColor : theme.headerBackgroundColor;
|
|
8227
|
+
ctx.fillStyle = summarySelected || isHeaderColumnSelected || isColumnRangeSelected ? theme.selectionBackgroundColor : style?.backgroundColor ?? theme.headerBackgroundColor;
|
|
8132
8228
|
ctx.fillRect(rect.x, rect.y, rect.width, rect.height);
|
|
8133
|
-
drawGridRect(ctx, rect, theme);
|
|
8229
|
+
drawGridRect(ctx, rect, theme, style?.borderColor, style?.borderWidth);
|
|
8134
8230
|
const resolvedDisplayValue = resolveSummaryCellDisplayValue(
|
|
8135
8231
|
column,
|
|
8136
8232
|
summaryValues?.get(column.key),
|
|
@@ -8141,10 +8237,10 @@ function drawSummaryCell(ctx, rect, column, theme, summaryValues, selectedHeader
|
|
|
8141
8237
|
ctx.beginPath();
|
|
8142
8238
|
ctx.rect(cellClip.x, cellClip.y, cellClip.width, cellClip.height);
|
|
8143
8239
|
ctx.clip();
|
|
8144
|
-
ctx.fillStyle = theme.headerTextColor;
|
|
8145
|
-
ctx.font =
|
|
8240
|
+
ctx.fillStyle = style?.color ?? theme.headerTextColor;
|
|
8241
|
+
ctx.font = `${style?.fontWeight ?? "600"} ${fontSize}px ${style?.fontFamily ?? theme.fontFamily}`;
|
|
8146
8242
|
ctx.textBaseline = "middle";
|
|
8147
|
-
const align = column.align ?? "left";
|
|
8243
|
+
const align = style?.textAlign ?? column.align ?? "left";
|
|
8148
8244
|
ctx.textAlign = align;
|
|
8149
8245
|
const contentInsetStart = column.key === inlineContentInset?.columnKey ? inlineContentInset.width : 0;
|
|
8150
8246
|
const contentRect = {
|
|
@@ -8157,16 +8253,16 @@ function drawSummaryCell(ctx, rect, column, theme, summaryValues, selectedHeader
|
|
|
8157
8253
|
rect: contentRect,
|
|
8158
8254
|
visibleRect,
|
|
8159
8255
|
align,
|
|
8160
|
-
padding:
|
|
8256
|
+
padding: paddingInline
|
|
8161
8257
|
});
|
|
8162
8258
|
const displayText = resolveSummaryDisplayText(ctx, {
|
|
8163
8259
|
text: resolvedDisplayValue,
|
|
8164
8260
|
visibleRect,
|
|
8165
|
-
padding:
|
|
8261
|
+
padding: paddingInline
|
|
8166
8262
|
});
|
|
8167
8263
|
const textWidth = ctx.measureText(displayText).width;
|
|
8168
8264
|
const textOriginX = textX - (align === "right" ? textWidth : align === "center" ? textWidth / 2 : 0);
|
|
8169
|
-
const textTop =
|
|
8265
|
+
const textTop = textY - fontSize / 2;
|
|
8170
8266
|
const fragmentKey = `summary:${column.key}`;
|
|
8171
8267
|
drawSelectableTextSelectionBackground({
|
|
8172
8268
|
ctx,
|
|
@@ -8174,14 +8270,14 @@ function drawSummaryCell(ctx, rect, column, theme, summaryValues, selectedHeader
|
|
|
8174
8270
|
textSelection,
|
|
8175
8271
|
textOriginX,
|
|
8176
8272
|
textTop,
|
|
8177
|
-
textHeight:
|
|
8273
|
+
textHeight: fontSize,
|
|
8178
8274
|
rowIndex: Number.MAX_SAFE_INTEGER,
|
|
8179
8275
|
columnKey: column.key,
|
|
8180
8276
|
contentIndex: 0,
|
|
8181
8277
|
fragmentKey,
|
|
8182
8278
|
color: theme.textSelectionBackgroundColor ?? "#99c2ff"
|
|
8183
8279
|
});
|
|
8184
|
-
ctx.fillText(displayText, textX,
|
|
8280
|
+
ctx.fillText(displayText, textX, textY);
|
|
8185
8281
|
textDescriptor = {
|
|
8186
8282
|
rowIndex: Number.MAX_SAFE_INTEGER,
|
|
8187
8283
|
contentIndex: 0,
|
|
@@ -8194,7 +8290,7 @@ function drawSummaryCell(ctx, rect, column, theme, summaryValues, selectedHeader
|
|
|
8194
8290
|
x: textOriginX,
|
|
8195
8291
|
y: textTop,
|
|
8196
8292
|
width: textWidth,
|
|
8197
|
-
height:
|
|
8293
|
+
height: fontSize
|
|
8198
8294
|
},
|
|
8199
8295
|
cellClip
|
|
8200
8296
|
) ?? void 0,
|
|
@@ -10955,6 +11051,25 @@ function normalizeCellContents(contents) {
|
|
|
10955
11051
|
}
|
|
10956
11052
|
return [normalizeCellContentItem(contents)];
|
|
10957
11053
|
}
|
|
11054
|
+
function applyCellTextStyle(contents, column) {
|
|
11055
|
+
const { color, fontSize, fontWeight, fontFamily } = column.cellStyle ?? {};
|
|
11056
|
+
if (color == null && fontSize == null && fontWeight == null && fontFamily == null)
|
|
11057
|
+
return contents;
|
|
11058
|
+
return contents.map((content) => ({
|
|
11059
|
+
...content,
|
|
11060
|
+
style: {
|
|
11061
|
+
...color != null ? { color } : {},
|
|
11062
|
+
...fontSize != null ? { fontSize } : {},
|
|
11063
|
+
...fontWeight != null ? { fontWeight } : {},
|
|
11064
|
+
...fontFamily != null ? { fontFamily } : {},
|
|
11065
|
+
..."color" in content && content.color != null ? { color: content.color } : {},
|
|
11066
|
+
..."textColor" in content && content.textColor != null ? { color: content.textColor } : {},
|
|
11067
|
+
..."fontSize" in content && content.fontSize != null ? { fontSize: content.fontSize } : {},
|
|
11068
|
+
..."fontWeight" in content && content.fontWeight != null ? { fontWeight: content.fontWeight } : {},
|
|
11069
|
+
...content.style
|
|
11070
|
+
}
|
|
11071
|
+
}));
|
|
11072
|
+
}
|
|
10958
11073
|
function normalizeDrawableCellContents(contents) {
|
|
10959
11074
|
return contents.filter(
|
|
10960
11075
|
(content) => content.visible !== false && content.style?.display !== "none"
|
|
@@ -11128,7 +11243,10 @@ function drawBodyCellContents(params) {
|
|
|
11128
11243
|
skipNestedTableOuterBorders,
|
|
11129
11244
|
defaultRowHeight
|
|
11130
11245
|
} = params;
|
|
11131
|
-
const contents =
|
|
11246
|
+
const contents = applyCellTextStyle(
|
|
11247
|
+
normalizeDrawableCellContents(params.contents),
|
|
11248
|
+
column
|
|
11249
|
+
);
|
|
11132
11250
|
if (contents.length === 0) {
|
|
11133
11251
|
return void 0;
|
|
11134
11252
|
}
|
|
@@ -11363,7 +11481,10 @@ function appendClippedContentDescriptors(descriptors, itemDescriptors, visibleRe
|
|
|
11363
11481
|
}
|
|
11364
11482
|
function measureBodyCellContentsHeight(params) {
|
|
11365
11483
|
const { ctx, column, theme } = params;
|
|
11366
|
-
const contents =
|
|
11484
|
+
const contents = applyCellTextStyle(
|
|
11485
|
+
normalizeDrawableCellContents(params.contents),
|
|
11486
|
+
column
|
|
11487
|
+
);
|
|
11367
11488
|
if (contents.length === 0) {
|
|
11368
11489
|
return 0;
|
|
11369
11490
|
}
|
|
@@ -11393,7 +11514,10 @@ function measureBodyCellContentsHeight(params) {
|
|
|
11393
11514
|
}
|
|
11394
11515
|
function measureBodyCellContentsWidth(params) {
|
|
11395
11516
|
const { ctx, column, theme } = params;
|
|
11396
|
-
const contents =
|
|
11517
|
+
const contents = applyCellTextStyle(
|
|
11518
|
+
normalizeDrawableCellContents(params.contents),
|
|
11519
|
+
column
|
|
11520
|
+
);
|
|
11397
11521
|
if (contents.length === 0) {
|
|
11398
11522
|
return 0;
|
|
11399
11523
|
}
|
|
@@ -20322,7 +20446,9 @@ var ListTableEventController = class {
|
|
|
20322
20446
|
event.clientX,
|
|
20323
20447
|
event.clientY
|
|
20324
20448
|
);
|
|
20325
|
-
const result = this.host.resolvePointerHit(position.x, position.y
|
|
20449
|
+
const result = this.host.resolvePointerHit(position.x, position.y, {
|
|
20450
|
+
excludeKinds: ["resize-handle"]
|
|
20451
|
+
});
|
|
20326
20452
|
const rawContextResult = typeof result.hitRowIndex === "number" ? { ...result, rowIndex: result.hitRowIndex } : result;
|
|
20327
20453
|
const bodyRows = this.resolveBodyRows();
|
|
20328
20454
|
const contextResult = hydrateBodyContentHitResult({
|
|
@@ -24284,13 +24410,22 @@ function drawSegmentRows(params, segment, columns, startRowIndex, endRowIndex, r
|
|
|
24284
24410
|
collapseConfig: params.collapseConfig
|
|
24285
24411
|
}) : [];
|
|
24286
24412
|
const cellDescriptorStartIndex = params.descriptors.length;
|
|
24413
|
+
const activeStyle = isSelected || isSelectedCellRange ? params.theme.activeCellStyle : isRangeHighlighted ? params.theme.activeRowStyle : void 0;
|
|
24414
|
+
const styledColumn = activeStyle ? {
|
|
24415
|
+
...cell.column,
|
|
24416
|
+
cellStyle: { ...cell.column.cellStyle, ...activeStyle }
|
|
24417
|
+
} : cell.column;
|
|
24418
|
+
const cellTheme = activeStyle?.backgroundColor ? {
|
|
24419
|
+
...params.theme,
|
|
24420
|
+
selectionBackgroundColor: activeStyle.backgroundColor
|
|
24421
|
+
} : params.theme;
|
|
24287
24422
|
const cellTooltip = drawBodyCell(
|
|
24288
24423
|
ctx,
|
|
24289
24424
|
rect,
|
|
24290
24425
|
cell.record,
|
|
24291
24426
|
cell.sourceRowIndex,
|
|
24292
|
-
|
|
24293
|
-
|
|
24427
|
+
styledColumn,
|
|
24428
|
+
cellTheme,
|
|
24294
24429
|
params.rowBackgroundColor,
|
|
24295
24430
|
params.striped === true,
|
|
24296
24431
|
isHovered,
|
|
@@ -24337,11 +24472,12 @@ function drawSegmentRows(params, segment, columns, startRowIndex, endRowIndex, r
|
|
|
24337
24472
|
}
|
|
24338
24473
|
ctx.restore();
|
|
24339
24474
|
}
|
|
24340
|
-
function drawActiveCellBorder(ctx, rect) {
|
|
24341
|
-
|
|
24475
|
+
function drawActiveCellBorder(ctx, rect, borderColor = ACTIVE_CELL_BORDER_COLOR, borderWidth = 1) {
|
|
24476
|
+
if (borderWidth <= 0) return;
|
|
24477
|
+
const inset = borderWidth / 2;
|
|
24342
24478
|
ctx.save();
|
|
24343
|
-
ctx.strokeStyle =
|
|
24344
|
-
ctx.lineWidth =
|
|
24479
|
+
ctx.strokeStyle = borderColor;
|
|
24480
|
+
ctx.lineWidth = borderWidth;
|
|
24345
24481
|
ctx.strokeRect(
|
|
24346
24482
|
rect.x + inset,
|
|
24347
24483
|
rect.y + inset,
|
|
@@ -25009,7 +25145,13 @@ function drawBodyCell(ctx, rect, record, rowIndex, column, theme, rowBackgroundC
|
|
|
25009
25145
|
validationMessage
|
|
25010
25146
|
);
|
|
25011
25147
|
}
|
|
25012
|
-
drawGridRect(
|
|
25148
|
+
drawGridRect(
|
|
25149
|
+
ctx,
|
|
25150
|
+
rect,
|
|
25151
|
+
theme,
|
|
25152
|
+
column.cellStyle?.borderColor ?? theme.borderColor,
|
|
25153
|
+
column.cellStyle?.borderWidth
|
|
25154
|
+
);
|
|
25013
25155
|
ctx.restore();
|
|
25014
25156
|
return validationMessage ? {
|
|
25015
25157
|
text: validationMessage,
|
|
@@ -28522,6 +28664,7 @@ function renderListTablePagination(params) {
|
|
|
28522
28664
|
return;
|
|
28523
28665
|
}
|
|
28524
28666
|
const paginationConfig = {
|
|
28667
|
+
styles: options.styles?.pagination,
|
|
28525
28668
|
mode: paginationOptions.mode,
|
|
28526
28669
|
current: state.currentPage,
|
|
28527
28670
|
total: getPaginationTotal(options, total),
|
|
@@ -29269,6 +29412,7 @@ function drawActiveCellOverlay(params) {
|
|
|
29269
29412
|
return;
|
|
29270
29413
|
}
|
|
29271
29414
|
const { ctx, layout } = params;
|
|
29415
|
+
if (params.borderWidth === 0) return;
|
|
29272
29416
|
if (layout.rangeSegments?.length) {
|
|
29273
29417
|
layout.rangeSegments.forEach((segment) => {
|
|
29274
29418
|
ctx.save();
|
|
@@ -29280,8 +29424,8 @@ function drawActiveCellOverlay(params) {
|
|
|
29280
29424
|
segment.clipRect.height
|
|
29281
29425
|
);
|
|
29282
29426
|
ctx.clip();
|
|
29283
|
-
ctx.strokeStyle = "#1677ff";
|
|
29284
|
-
ctx.lineWidth = 1;
|
|
29427
|
+
ctx.strokeStyle = params.borderColor ?? "#1677ff";
|
|
29428
|
+
ctx.lineWidth = params.borderWidth ?? 1;
|
|
29285
29429
|
ctx.beginPath();
|
|
29286
29430
|
ctx.moveTo(segment.startX, segment.startY);
|
|
29287
29431
|
if (segment.controlX != null && segment.controlY != null) {
|
|
@@ -29303,7 +29447,13 @@ function drawActiveCellOverlay(params) {
|
|
|
29303
29447
|
ctx.beginPath();
|
|
29304
29448
|
ctx.rect(clipRect.x, clipRect.y, clipRect.width, clipRect.height);
|
|
29305
29449
|
ctx.clip();
|
|
29306
|
-
drawRangeHighlightBorder(
|
|
29450
|
+
drawRangeHighlightBorder(
|
|
29451
|
+
ctx,
|
|
29452
|
+
rect,
|
|
29453
|
+
{ omitLeft, omitRight },
|
|
29454
|
+
params.borderColor,
|
|
29455
|
+
params.borderWidth
|
|
29456
|
+
);
|
|
29307
29457
|
ctx.restore();
|
|
29308
29458
|
});
|
|
29309
29459
|
}
|
|
@@ -29317,7 +29467,12 @@ function drawActiveCellOverlay(params) {
|
|
|
29317
29467
|
layout.clipRect.height
|
|
29318
29468
|
);
|
|
29319
29469
|
ctx.clip();
|
|
29320
|
-
drawActiveCellBorder(
|
|
29470
|
+
drawActiveCellBorder(
|
|
29471
|
+
ctx,
|
|
29472
|
+
layout.rect,
|
|
29473
|
+
params.borderColor,
|
|
29474
|
+
params.borderWidth
|
|
29475
|
+
);
|
|
29321
29476
|
ctx.restore();
|
|
29322
29477
|
}
|
|
29323
29478
|
}
|
|
@@ -29415,10 +29570,7 @@ function removeRangeSegmentsAtSharedLayerBoundaries(segments, ranges) {
|
|
|
29415
29570
|
return;
|
|
29416
29571
|
}
|
|
29417
29572
|
const top = Math.max(left.y, right.y);
|
|
29418
|
-
const bottom = Math.min(
|
|
29419
|
-
left.y + left.height,
|
|
29420
|
-
right.y + right.height
|
|
29421
|
-
);
|
|
29573
|
+
const bottom = Math.min(left.y + left.height, right.y + right.height);
|
|
29422
29574
|
if (bottom > top) {
|
|
29423
29575
|
sharedBoundaries.push({ x: boundary, top, bottom });
|
|
29424
29576
|
}
|
|
@@ -29608,10 +29760,10 @@ function subtractCoveredIntervals(start, end, coveredIntervals) {
|
|
|
29608
29760
|
([currentStart, currentEnd]) => currentEnd > currentStart
|
|
29609
29761
|
);
|
|
29610
29762
|
}
|
|
29611
|
-
function drawRangeHighlightBorder(ctx, rect, edges = {}) {
|
|
29763
|
+
function drawRangeHighlightBorder(ctx, rect, edges = {}, borderColor = "#1677ff", borderWidth = 1) {
|
|
29612
29764
|
ctx.save();
|
|
29613
|
-
ctx.strokeStyle =
|
|
29614
|
-
ctx.lineWidth =
|
|
29765
|
+
ctx.strokeStyle = borderColor;
|
|
29766
|
+
ctx.lineWidth = borderWidth;
|
|
29615
29767
|
const left = rect.x + 0.5;
|
|
29616
29768
|
const top = rect.y + 0.5;
|
|
29617
29769
|
const right = rect.x + Math.max(rect.width - 0.5, 0);
|
|
@@ -29907,6 +30059,8 @@ function executeListTableRenderPipeline(params) {
|
|
|
29907
30059
|
);
|
|
29908
30060
|
drawActiveCellOverlay({
|
|
29909
30061
|
ctx,
|
|
30062
|
+
borderColor: theme.activeCellStyle?.borderColor,
|
|
30063
|
+
borderWidth: theme.activeCellStyle?.borderWidth,
|
|
29910
30064
|
layout: resolveActiveCellOverlayLayout({
|
|
29911
30065
|
descriptors,
|
|
29912
30066
|
selection,
|
|
@@ -30661,6 +30815,7 @@ function resolvePaginationSignature(params) {
|
|
|
30661
30815
|
paginationConfig ? "enabled" : "disabled",
|
|
30662
30816
|
paginationConfig?.mode ?? "",
|
|
30663
30817
|
paginationConfig?.total ?? params.total,
|
|
30818
|
+
JSON.stringify(params.options.styles?.pagination ?? null),
|
|
30664
30819
|
params.total > 0 ? "nonempty" : "empty",
|
|
30665
30820
|
params.currentPage,
|
|
30666
30821
|
params.pageSize,
|
|
@@ -32566,6 +32721,7 @@ var ListTableCore = class {
|
|
|
32566
32721
|
/** 由 assembleListTableCoreControllers 在构造阶段挂载。 */
|
|
32567
32722
|
__publicField(this, "renderController");
|
|
32568
32723
|
__publicField(this, "debugManager");
|
|
32724
|
+
options = resolveListTableStyleOptions(options);
|
|
32569
32725
|
this.container = container;
|
|
32570
32726
|
this.options = options;
|
|
32571
32727
|
applyInitialColumnVisibility(options.columns);
|
|
@@ -32620,6 +32776,7 @@ var ListTableCore = class {
|
|
|
32620
32776
|
* @param options 新配置。
|
|
32621
32777
|
*/
|
|
32622
32778
|
updateOptions(options) {
|
|
32779
|
+
options = resolveListTableStyleOptions(options);
|
|
32623
32780
|
this.animationController.stopCarouselScroll();
|
|
32624
32781
|
const host = this.asAssemblyHost();
|
|
32625
32782
|
const shouldResetColumnConfig = shouldPersistIncomingColumnConfig(
|