@canvas-components/list-table 0.2.0 → 0.2.1
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 +54 -142
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +30 -118
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var utils = require('@canvas-components/utils');
|
|
3
4
|
var barcode = require('@canvas-components/barcode');
|
|
4
5
|
var chart = require('@canvas-components/chart');
|
|
5
6
|
var qrcode = require('@canvas-components/qrcode');
|
|
6
|
-
var utils = require('@canvas-components/utils');
|
|
7
7
|
|
|
8
8
|
var __defProp = Object.defineProperty;
|
|
9
9
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -70,13 +70,8 @@ var DebugManager = class {
|
|
|
70
70
|
console.info(`[ListTable Debug] ${label}`, payload);
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
|
-
|
|
74
|
-
// src/domain/columns/column-key.ts
|
|
75
|
-
function stringifyColumnDataIndex(dataIndex) {
|
|
76
|
-
return Array.isArray(dataIndex) ? dataIndex.map((item) => String(item)).join(".") : String(dataIndex);
|
|
77
|
-
}
|
|
78
73
|
function resolveColumnKey(column) {
|
|
79
|
-
return column.key?.trim() ||
|
|
74
|
+
return column.key?.trim() || utils.stringifyDataIndex(column.dataIndex);
|
|
80
75
|
}
|
|
81
76
|
function ensureColumnKeysInPlace(columns) {
|
|
82
77
|
columns.forEach((column) => {
|
|
@@ -1603,27 +1598,6 @@ function clampPageNumber(page, totalPages) {
|
|
|
1603
1598
|
}
|
|
1604
1599
|
return Math.min(Math.max(1, Math.floor(page)), totalPages);
|
|
1605
1600
|
}
|
|
1606
|
-
|
|
1607
|
-
// src/domain/data/get-value-by-data-index.ts
|
|
1608
|
-
function getValueByDataIndex(record, dataIndex) {
|
|
1609
|
-
if (dataIndex == null) {
|
|
1610
|
-
return void 0;
|
|
1611
|
-
}
|
|
1612
|
-
const path = Array.isArray(dataIndex) ? dataIndex : [dataIndex];
|
|
1613
|
-
let current = record;
|
|
1614
|
-
for (const key of path) {
|
|
1615
|
-
if (current == null) {
|
|
1616
|
-
return void 0;
|
|
1617
|
-
}
|
|
1618
|
-
if (typeof current !== "object" && !Array.isArray(current)) {
|
|
1619
|
-
return void 0;
|
|
1620
|
-
}
|
|
1621
|
-
current = current[key];
|
|
1622
|
-
}
|
|
1623
|
-
return current;
|
|
1624
|
-
}
|
|
1625
|
-
|
|
1626
|
-
// src/domain/rows/row-selection.ts
|
|
1627
1601
|
var maximumTreeDepthCache = /* @__PURE__ */ new WeakMap();
|
|
1628
1602
|
var ROW_SELECTION_COLUMN_KEY = "__row_selection__";
|
|
1629
1603
|
var EXPAND_COLUMN_KEY = "__row_expand__";
|
|
@@ -1655,7 +1629,7 @@ function getRowKey(options, record, index) {
|
|
|
1655
1629
|
return rowKey(record, index);
|
|
1656
1630
|
}
|
|
1657
1631
|
if (rowKey != null) {
|
|
1658
|
-
const resolved = getValueByDataIndex(record, rowKey);
|
|
1632
|
+
const resolved = utils.getValueByDataIndex(record, rowKey);
|
|
1659
1633
|
if (typeof resolved === "string" || typeof resolved === "number") {
|
|
1660
1634
|
return resolved;
|
|
1661
1635
|
}
|
|
@@ -3711,8 +3685,6 @@ function resolveLinkTextDecoration(content, hovered = false) {
|
|
|
3711
3685
|
}
|
|
3712
3686
|
return shouldDrawUnderline(content.underline, hovered) ? "underline" : "none";
|
|
3713
3687
|
}
|
|
3714
|
-
|
|
3715
|
-
// src/rendering/cell-content/draw-nested-table-content.ts
|
|
3716
3688
|
var DEFAULT_COLUMN_WIDTH2 = 140;
|
|
3717
3689
|
var TABLE_PADDING_X = 12;
|
|
3718
3690
|
function drawBodyNestedTableContent(params) {
|
|
@@ -3826,7 +3798,7 @@ function drawBodyNestedTableContent(params) {
|
|
|
3826
3798
|
}
|
|
3827
3799
|
drawNestedTableText({
|
|
3828
3800
|
ctx,
|
|
3829
|
-
text: String(getValueByDataIndex(record, column.dataIndex) ?? ""),
|
|
3801
|
+
text: String(utils.getValueByDataIndex(record, column.dataIndex) ?? ""),
|
|
3830
3802
|
x: cellX,
|
|
3831
3803
|
y: rowY,
|
|
3832
3804
|
width: columnWidth,
|
|
@@ -3932,25 +3904,20 @@ function isNestedTableColumnHighlighted(content, column, columnIndex, highlight)
|
|
|
3932
3904
|
return true;
|
|
3933
3905
|
}
|
|
3934
3906
|
return content.highlightColumnDataIndexes?.some(
|
|
3935
|
-
(dataIndex) => isSameDataIndex(dataIndex, column.dataIndex)
|
|
3936
|
-
) === true || highlight?.columnDataIndex ===
|
|
3907
|
+
(dataIndex) => utils.isSameDataIndex(dataIndex, column.dataIndex)
|
|
3908
|
+
) === true || highlight?.columnDataIndex === utils.stringifyDataIndex(column.dataIndex) || highlight?.columnIndex === columnIndex;
|
|
3937
3909
|
}
|
|
3938
3910
|
function resolveNestedTableRowKey(content, record, rowIndex) {
|
|
3939
3911
|
if (typeof content.rowKey === "function") {
|
|
3940
3912
|
return content.rowKey(record, rowIndex);
|
|
3941
3913
|
}
|
|
3942
3914
|
if (content.rowKey != null) {
|
|
3943
|
-
const value = getValueByDataIndex(record, content.rowKey);
|
|
3915
|
+
const value = utils.getValueByDataIndex(record, content.rowKey);
|
|
3944
3916
|
return typeof value === "string" || typeof value === "number" ? value : void 0;
|
|
3945
3917
|
}
|
|
3946
3918
|
const fallbackKey = record.key;
|
|
3947
3919
|
return typeof fallbackKey === "string" || typeof fallbackKey === "number" ? fallbackKey : rowIndex;
|
|
3948
3920
|
}
|
|
3949
|
-
function isSameDataIndex(left, right) {
|
|
3950
|
-
const leftPath = Array.isArray(left) ? left : [left];
|
|
3951
|
-
const rightPath = Array.isArray(right) ? right : [right];
|
|
3952
|
-
return leftPath.length === rightPath.length && leftPath.every((key, index) => key === rightPath[index]);
|
|
3953
|
-
}
|
|
3954
3921
|
function pushNestedTableDescriptor(params) {
|
|
3955
3922
|
const { column, columnIndex, content, drawParams, record, rect, rowIndex } = params;
|
|
3956
3923
|
const rowKey = record != null && typeof rowIndex === "number" ? resolveNestedTableRowKey(content, record, rowIndex) : void 0;
|
|
@@ -3963,14 +3930,11 @@ function pushNestedTableDescriptor(params) {
|
|
|
3963
3930
|
contentKey: "nested-table",
|
|
3964
3931
|
nestedRowKey: rowKey,
|
|
3965
3932
|
nestedRowIndex: rowIndex,
|
|
3966
|
-
nestedColumnDataIndex:
|
|
3933
|
+
nestedColumnDataIndex: utils.stringifyDataIndex(column.dataIndex),
|
|
3967
3934
|
nestedColumnIndex: columnIndex,
|
|
3968
3935
|
cursor: "pointer"
|
|
3969
3936
|
});
|
|
3970
3937
|
}
|
|
3971
|
-
function serializeDataIndex(dataIndex) {
|
|
3972
|
-
return (Array.isArray(dataIndex) ? dataIndex : [dataIndex]).map((item) => String(item)).join(".");
|
|
3973
|
-
}
|
|
3974
3938
|
function drawNestedTableText(params) {
|
|
3975
3939
|
const {
|
|
3976
3940
|
align = "left",
|
|
@@ -5185,8 +5149,6 @@ function applyTextContentStyle(ctx, content, fallbackColor, theme) {
|
|
|
5185
5149
|
ctx.textBaseline = "alphabetic";
|
|
5186
5150
|
ctx.textAlign = "left";
|
|
5187
5151
|
}
|
|
5188
|
-
|
|
5189
|
-
// src/features/editing/editing-utils.ts
|
|
5190
5152
|
function canEditCell(column, context) {
|
|
5191
5153
|
if (!column || column.key === ROW_SELECTION_COLUMN_KEY || column.key === EXPAND_COLUMN_KEY) {
|
|
5192
5154
|
return false;
|
|
@@ -5271,7 +5233,7 @@ function resolveNextEditableCell(params) {
|
|
|
5271
5233
|
}
|
|
5272
5234
|
const editableColumns = leafColumns.filter(
|
|
5273
5235
|
(column) => canEditCell(column, {
|
|
5274
|
-
value: column.dataIndex == null ? void 0 : getValueByDataIndex(currentRecord, column.dataIndex),
|
|
5236
|
+
value: column.dataIndex == null ? void 0 : utils.getValueByDataIndex(currentRecord, column.dataIndex),
|
|
5275
5237
|
record: currentRecord,
|
|
5276
5238
|
rowIndex
|
|
5277
5239
|
})
|
|
@@ -5350,7 +5312,7 @@ var CONTENT_GAP = 8;
|
|
|
5350
5312
|
var CONTENT_VERTICAL_PADDING = 6;
|
|
5351
5313
|
function resolveBodyCellContents(params) {
|
|
5352
5314
|
const { record, rowIndex, column } = params;
|
|
5353
|
-
const value = getValueByDataIndex(record, column.dataIndex);
|
|
5315
|
+
const value = utils.getValueByDataIndex(record, column.dataIndex);
|
|
5354
5316
|
const rendered = column.render?.(value, record, rowIndex, column);
|
|
5355
5317
|
if (rendered != null) {
|
|
5356
5318
|
return normalizeCellContents(rendered);
|
|
@@ -6658,7 +6620,7 @@ function buildBodyContentsPlainText(contents) {
|
|
|
6658
6620
|
if (content.type === "table") {
|
|
6659
6621
|
return content.dataSource.map(
|
|
6660
6622
|
(record) => content.columns.map(
|
|
6661
|
-
(column) => String(getValueByDataIndex(record, column.dataIndex) ?? "")
|
|
6623
|
+
(column) => String(utils.getValueByDataIndex(record, column.dataIndex) ?? "")
|
|
6662
6624
|
).join(" ")
|
|
6663
6625
|
).join(" ");
|
|
6664
6626
|
}
|
|
@@ -6745,7 +6707,7 @@ function resolveStickyLineStartX(params) {
|
|
|
6745
6707
|
const preferredX = resolveLineStartX(rect, lineWidth, align);
|
|
6746
6708
|
const minX = visibleRect.x;
|
|
6747
6709
|
const maxX = visibleRect.x + Math.max(visibleRect.width - lineWidth, 0);
|
|
6748
|
-
return clamp(preferredX, minX, maxX);
|
|
6710
|
+
return utils.clamp(preferredX, minX, maxX);
|
|
6749
6711
|
}
|
|
6750
6712
|
function intersectRects(left, right) {
|
|
6751
6713
|
const x = Math.max(left.x, right.x);
|
|
@@ -6762,9 +6724,6 @@ function intersectRects(left, right) {
|
|
|
6762
6724
|
height: maxY - y
|
|
6763
6725
|
};
|
|
6764
6726
|
}
|
|
6765
|
-
function clamp(value, min, max) {
|
|
6766
|
-
return Math.min(Math.max(value, min), max);
|
|
6767
|
-
}
|
|
6768
6727
|
|
|
6769
6728
|
// src/services/cell-content-action-service.ts
|
|
6770
6729
|
function emitBodyCellContentClick(params) {
|
|
@@ -6794,7 +6753,7 @@ function emitBodyCellContentClick(params) {
|
|
|
6794
6753
|
record,
|
|
6795
6754
|
rowIndex: result.rowIndex,
|
|
6796
6755
|
column,
|
|
6797
|
-
value: getValueByDataIndex(record, column.dataIndex),
|
|
6756
|
+
value: utils.getValueByDataIndex(record, column.dataIndex),
|
|
6798
6757
|
contentIndex,
|
|
6799
6758
|
nativeEvent: event
|
|
6800
6759
|
};
|
|
@@ -6980,30 +6939,20 @@ function resolveBodyContentIndex(result, contents) {
|
|
|
6980
6939
|
}
|
|
6981
6940
|
return void 0;
|
|
6982
6941
|
}
|
|
6983
|
-
|
|
6984
|
-
// src/domain/layout/geometry.ts
|
|
6985
|
-
function clamp2(value, min, max) {
|
|
6986
|
-
return Math.min(Math.max(value, min), max);
|
|
6987
|
-
}
|
|
6988
|
-
function isPointInRect2(x, y, rect) {
|
|
6989
|
-
return x >= rect.x && x <= rect.x + rect.width && y >= rect.y && y <= rect.y + rect.height;
|
|
6990
|
-
}
|
|
6991
|
-
|
|
6992
|
-
// src/domain/layout/scrollbar.ts
|
|
6993
6942
|
function isPointInScrollbar(x, y, scrollbar) {
|
|
6994
|
-
return
|
|
6943
|
+
return utils.isPointInRect(x, y, scrollbar.decreaseButton) || utils.isPointInRect(x, y, scrollbar.increaseButton) || utils.isPointInRect(x, y, scrollbar.track) || utils.isPointInRect(x, y, scrollbar.thumb);
|
|
6995
6944
|
}
|
|
6996
6945
|
function resolveScrollbarRole(x, y, scrollbar) {
|
|
6997
|
-
if (
|
|
6946
|
+
if (utils.isPointInRect(x, y, scrollbar.thumb)) {
|
|
6998
6947
|
return "thumb";
|
|
6999
6948
|
}
|
|
7000
|
-
if (
|
|
6949
|
+
if (utils.isPointInRect(x, y, scrollbar.decreaseButton)) {
|
|
7001
6950
|
return "decrease-button";
|
|
7002
6951
|
}
|
|
7003
|
-
if (
|
|
6952
|
+
if (utils.isPointInRect(x, y, scrollbar.increaseButton)) {
|
|
7004
6953
|
return "increase-button";
|
|
7005
6954
|
}
|
|
7006
|
-
if (
|
|
6955
|
+
if (utils.isPointInRect(x, y, scrollbar.track)) {
|
|
7007
6956
|
return "track";
|
|
7008
6957
|
}
|
|
7009
6958
|
return void 0;
|
|
@@ -7102,8 +7051,6 @@ function scaleRectByZoom(rect, zoom) {
|
|
|
7102
7051
|
height: rect.height * safeZoom
|
|
7103
7052
|
};
|
|
7104
7053
|
}
|
|
7105
|
-
|
|
7106
|
-
// src/domain/columns/header-reorder.ts
|
|
7107
7054
|
function resolveHeaderReorderTarget(pointerX, siblings, getBounds) {
|
|
7108
7055
|
if (siblings.length === 0) {
|
|
7109
7056
|
return null;
|
|
@@ -7130,7 +7077,7 @@ function resolveHeaderReorderTarget(pointerX, siblings, getBounds) {
|
|
|
7130
7077
|
}
|
|
7131
7078
|
}
|
|
7132
7079
|
}
|
|
7133
|
-
targetSiblingIndex =
|
|
7080
|
+
targetSiblingIndex = utils.clamp(targetSiblingIndex, 0, siblings.length);
|
|
7134
7081
|
const targetIndicatorX = resolveTargetIndicatorX(
|
|
7135
7082
|
siblings,
|
|
7136
7083
|
targetSiblingIndex,
|
|
@@ -7721,8 +7668,6 @@ function createListTableAnimationRuntime() {
|
|
|
7721
7668
|
carouselScrollAnimation: null
|
|
7722
7669
|
};
|
|
7723
7670
|
}
|
|
7724
|
-
|
|
7725
|
-
// src/features/scroll/scroll-feature.ts
|
|
7726
7671
|
var WHEEL_DELTA_MODE_PIXEL = 0;
|
|
7727
7672
|
var WHEEL_DELTA_MODE_LINE = 1;
|
|
7728
7673
|
var WHEEL_DELTA_MODE_PAGE = 2;
|
|
@@ -7817,7 +7762,7 @@ function stepScrollbarScroll(params) {
|
|
|
7817
7762
|
if (area === "horizontal-scrollbar") {
|
|
7818
7763
|
return {
|
|
7819
7764
|
...current,
|
|
7820
|
-
left:
|
|
7765
|
+
left: utils.clamp(
|
|
7821
7766
|
current.left + direction * horizontalStep,
|
|
7822
7767
|
0,
|
|
7823
7768
|
viewport.maxScrollLeft
|
|
@@ -7826,7 +7771,7 @@ function stepScrollbarScroll(params) {
|
|
|
7826
7771
|
}
|
|
7827
7772
|
return {
|
|
7828
7773
|
...current,
|
|
7829
|
-
top:
|
|
7774
|
+
top: utils.clamp(
|
|
7830
7775
|
current.top + direction * rowHeight,
|
|
7831
7776
|
0,
|
|
7832
7777
|
viewport.maxScrollTop
|
|
@@ -7836,7 +7781,7 @@ function stepScrollbarScroll(params) {
|
|
|
7836
7781
|
function jumpScrollbarScroll(params) {
|
|
7837
7782
|
const { current, axis, pointerValue, track, thumb, viewport } = params;
|
|
7838
7783
|
if (axis === "horizontal") {
|
|
7839
|
-
const nextThumbX =
|
|
7784
|
+
const nextThumbX = utils.clamp(
|
|
7840
7785
|
pointerValue - thumb.width / 2,
|
|
7841
7786
|
track.x,
|
|
7842
7787
|
track.x + track.width - thumb.width
|
|
@@ -7847,7 +7792,7 @@ function jumpScrollbarScroll(params) {
|
|
|
7847
7792
|
left: ratio2 * viewport.maxScrollLeft
|
|
7848
7793
|
};
|
|
7849
7794
|
}
|
|
7850
|
-
const nextThumbY =
|
|
7795
|
+
const nextThumbY = utils.clamp(
|
|
7851
7796
|
pointerValue - thumb.height / 2,
|
|
7852
7797
|
track.y,
|
|
7853
7798
|
track.y + track.height - thumb.height
|
|
@@ -7860,7 +7805,7 @@ function jumpScrollbarScroll(params) {
|
|
|
7860
7805
|
}
|
|
7861
7806
|
function dragScrollbarScroll(params) {
|
|
7862
7807
|
const { current, dragging, pointerValue } = params;
|
|
7863
|
-
const nextThumbValue =
|
|
7808
|
+
const nextThumbValue = utils.clamp(
|
|
7864
7809
|
pointerValue - dragging.pointerOffset,
|
|
7865
7810
|
dragging.trackStart,
|
|
7866
7811
|
dragging.trackStart + dragging.trackLength - dragging.thumbLength
|
|
@@ -7924,7 +7869,7 @@ function resolveVerticalCarouselScroll(params) {
|
|
|
7924
7869
|
return {
|
|
7925
7870
|
nextScroll: {
|
|
7926
7871
|
...current,
|
|
7927
|
-
top:
|
|
7872
|
+
top: utils.clamp(current.top + Math.max(rowHeight, 1), 0, maxScrollTop)
|
|
7928
7873
|
},
|
|
7929
7874
|
animate: true,
|
|
7930
7875
|
shouldStop: false
|
|
@@ -7951,7 +7896,7 @@ function resolveHorizontalCarouselScroll(params) {
|
|
|
7951
7896
|
return {
|
|
7952
7897
|
nextScroll: {
|
|
7953
7898
|
...current,
|
|
7954
|
-
left:
|
|
7899
|
+
left: utils.clamp(nextLeft, 0, maxScrollLeft)
|
|
7955
7900
|
},
|
|
7956
7901
|
animate: true,
|
|
7957
7902
|
shouldStop: false
|
|
@@ -7962,7 +7907,7 @@ function resolveColumnBoundaries(columns, maxScrollLeft) {
|
|
|
7962
7907
|
let offset = 0;
|
|
7963
7908
|
columns.forEach((column) => {
|
|
7964
7909
|
offset += Math.max(column.width, 0);
|
|
7965
|
-
boundaries.push(
|
|
7910
|
+
boundaries.push(utils.clamp(offset, 0, maxScrollLeft));
|
|
7966
7911
|
});
|
|
7967
7912
|
return Array.from(new Set(boundaries)).filter((value) => value > 0);
|
|
7968
7913
|
}
|
|
@@ -9247,7 +9192,7 @@ var ListTableCarouselController = class {
|
|
|
9247
9192
|
}
|
|
9248
9193
|
};
|
|
9249
9194
|
function getCellClipboardText(record, rowIndex, column) {
|
|
9250
|
-
const value = getValueByDataIndex(record, column.dataIndex);
|
|
9195
|
+
const value = utils.getValueByDataIndex(record, column.dataIndex);
|
|
9251
9196
|
const rendered = column.render?.(value, record, rowIndex, column);
|
|
9252
9197
|
if (rendered != null) {
|
|
9253
9198
|
return renderResultToClipboardText(rendered);
|
|
@@ -9832,7 +9777,7 @@ async function validateTableCells(params) {
|
|
|
9832
9777
|
continue;
|
|
9833
9778
|
}
|
|
9834
9779
|
visited.add(stateKey);
|
|
9835
|
-
const value = column.dataIndex == null ? void 0 : getValueByDataIndex(record, column.dataIndex);
|
|
9780
|
+
const value = column.dataIndex == null ? void 0 : utils.getValueByDataIndex(record, column.dataIndex);
|
|
9836
9781
|
const message = await validateCellValue(column, {
|
|
9837
9782
|
value,
|
|
9838
9783
|
record,
|
|
@@ -9891,7 +9836,7 @@ function resolveValidationTargetsForChange(params) {
|
|
|
9891
9836
|
return;
|
|
9892
9837
|
}
|
|
9893
9838
|
const dependencies = resolveFormItemProps(column, {
|
|
9894
|
-
value: column.dataIndex == null ? void 0 : getValueByDataIndex(record, column.dataIndex),
|
|
9839
|
+
value: column.dataIndex == null ? void 0 : utils.getValueByDataIndex(record, column.dataIndex),
|
|
9895
9840
|
record,
|
|
9896
9841
|
rowIndex
|
|
9897
9842
|
})?.dependencies;
|
|
@@ -9986,7 +9931,7 @@ function openCellEditingSession(params) {
|
|
|
9986
9931
|
if (!column || !record) {
|
|
9987
9932
|
return null;
|
|
9988
9933
|
}
|
|
9989
|
-
const currentValue = column.dataIndex == null ? void 0 : getValueByDataIndex(record, column.dataIndex);
|
|
9934
|
+
const currentValue = column.dataIndex == null ? void 0 : utils.getValueByDataIndex(record, column.dataIndex);
|
|
9990
9935
|
if (!canEditCell(column, {
|
|
9991
9936
|
value: currentValue,
|
|
9992
9937
|
record,
|
|
@@ -10518,8 +10463,6 @@ var ListTableEditingController = class {
|
|
|
10518
10463
|
this.validationMessages = /* @__PURE__ */ new Map();
|
|
10519
10464
|
}
|
|
10520
10465
|
};
|
|
10521
|
-
|
|
10522
|
-
// src/features/column-resize/column-resize-feature.ts
|
|
10523
10466
|
function startColumnResizeDrag(params) {
|
|
10524
10467
|
const { options, leafColumns, columnKey, pointerX } = params;
|
|
10525
10468
|
for (const leaf of leafColumns) {
|
|
@@ -10541,7 +10484,7 @@ function updateColumnResizeDrag(params) {
|
|
|
10541
10484
|
const { dragging, pointerX, leafColumns, options } = params;
|
|
10542
10485
|
const dx = pointerX - dragging.startX;
|
|
10543
10486
|
const nextWidth = Math.round(
|
|
10544
|
-
|
|
10487
|
+
utils.clamp(dragging.startWidth + dx, dragging.minWidth, dragging.maxWidth)
|
|
10545
10488
|
);
|
|
10546
10489
|
const column = leafColumns.find((item) => item.key === dragging.columnKey);
|
|
10547
10490
|
if (!column || column.width === nextWidth) {
|
|
@@ -10898,7 +10841,7 @@ function resolveColumnFilterValue(record, column) {
|
|
|
10898
10841
|
if (column.filterValueGetter) {
|
|
10899
10842
|
return column.filterValueGetter(record);
|
|
10900
10843
|
}
|
|
10901
|
-
const value = getValueByDataIndex(record, column.dataIndex);
|
|
10844
|
+
const value = utils.getValueByDataIndex(record, column.dataIndex);
|
|
10902
10845
|
if (value !== void 0) {
|
|
10903
10846
|
return value;
|
|
10904
10847
|
}
|
|
@@ -10932,7 +10875,7 @@ function resolveColumnFilterOptionValue(record, column) {
|
|
|
10932
10875
|
return serializeFilterOptionValue(column.filterOptionValueGetter(record));
|
|
10933
10876
|
}
|
|
10934
10877
|
if (column.filterOptions?.length) {
|
|
10935
|
-
const rawValue = getValueByDataIndex(record, column.dataIndex) ?? record[column.key];
|
|
10878
|
+
const rawValue = utils.getValueByDataIndex(record, column.dataIndex) ?? record[column.key];
|
|
10936
10879
|
if (rawValue !== void 0) {
|
|
10937
10880
|
return serializeFilterOptionValue(rawValue);
|
|
10938
10881
|
}
|
|
@@ -12041,8 +11984,6 @@ function moveRowDrag(params) {
|
|
|
12041
11984
|
function endRowDragSession() {
|
|
12042
11985
|
return createIdleRowDragSession();
|
|
12043
11986
|
}
|
|
12044
|
-
|
|
12045
|
-
// src/features/row-drag/row-drag-insertion.ts
|
|
12046
11987
|
function resolveRowDragInsertionPosition(params) {
|
|
12047
11988
|
const bodyTop = Math.max(params.bodyTop, 0);
|
|
12048
11989
|
const bodyBottom = Math.max(params.bodyBottom, bodyTop);
|
|
@@ -12059,15 +12000,15 @@ function resolveRowDragInsertionPosition(params) {
|
|
|
12059
12000
|
for (const row of rowRects) {
|
|
12060
12001
|
if (params.pointerY <= (row.top + row.bottom) / 2) {
|
|
12061
12002
|
return {
|
|
12062
|
-
insertIndex:
|
|
12063
|
-
indicatorY:
|
|
12003
|
+
insertIndex: utils.clamp(row.rowIndex, 0, rowCount),
|
|
12004
|
+
indicatorY: utils.clamp(row.top, bodyTop, bodyBottom)
|
|
12064
12005
|
};
|
|
12065
12006
|
}
|
|
12066
12007
|
}
|
|
12067
12008
|
const lastRow = rowRects[rowRects.length - 1];
|
|
12068
12009
|
return {
|
|
12069
|
-
insertIndex:
|
|
12070
|
-
indicatorY:
|
|
12010
|
+
insertIndex: utils.clamp(lastRow.rowIndex + 1, 0, rowCount),
|
|
12011
|
+
indicatorY: utils.clamp(lastRow.bottom, bodyTop, bodyBottom)
|
|
12071
12012
|
};
|
|
12072
12013
|
}
|
|
12073
12014
|
function resolveVisibleRowRects(descriptors) {
|
|
@@ -12090,9 +12031,6 @@ function resolveVisibleRowRects(descriptors) {
|
|
|
12090
12031
|
}
|
|
12091
12032
|
return Array.from(rows.values());
|
|
12092
12033
|
}
|
|
12093
|
-
function clamp3(value, min, max) {
|
|
12094
|
-
return Math.min(Math.max(value, min), max);
|
|
12095
|
-
}
|
|
12096
12034
|
|
|
12097
12035
|
// src/services/row-drag-bus.ts
|
|
12098
12036
|
var RowDragBus = class {
|
|
@@ -12678,8 +12616,8 @@ var ListTableRowDragController = class {
|
|
|
12678
12616
|
const pointer = this.potentialPointer ?? fallbackPointer;
|
|
12679
12617
|
return {
|
|
12680
12618
|
dataUrl,
|
|
12681
|
-
grabOffsetX:
|
|
12682
|
-
grabOffsetY:
|
|
12619
|
+
grabOffsetX: utils.clamp((pointer.x - rect.x) * zoom, 0, rect.width * zoom),
|
|
12620
|
+
grabOffsetY: utils.clamp((pointer.y - rect.y) * zoom, 0, rect.height * zoom)
|
|
12683
12621
|
};
|
|
12684
12622
|
}
|
|
12685
12623
|
showPreview(capture, clientX, clientY) {
|
|
@@ -12916,9 +12854,6 @@ function structuredCloneSafe(value) {
|
|
|
12916
12854
|
return value;
|
|
12917
12855
|
}
|
|
12918
12856
|
}
|
|
12919
|
-
function clamp4(value, min, max) {
|
|
12920
|
-
return Math.min(Math.max(value, min), max);
|
|
12921
|
-
}
|
|
12922
12857
|
function resolveValidZoom(value) {
|
|
12923
12858
|
return typeof value === "number" && Number.isFinite(value) && value > 0 ? value : 1;
|
|
12924
12859
|
}
|
|
@@ -13280,7 +13215,7 @@ var ListTableEventController = class {
|
|
|
13280
13215
|
(item) => item.key === result.columnKey
|
|
13281
13216
|
);
|
|
13282
13217
|
const record = this.host.getDisplayData()[result.rowIndex];
|
|
13283
|
-
const value = column && record && column.dataIndex != null ? getValueByDataIndex(record, column.dataIndex) : void 0;
|
|
13218
|
+
const value = column && record && column.dataIndex != null ? utils.getValueByDataIndex(record, column.dataIndex) : void 0;
|
|
13284
13219
|
if (!record || !shouldOpenCellEditorOnClick(column, 2, {
|
|
13285
13220
|
value,
|
|
13286
13221
|
record,
|
|
@@ -13611,7 +13546,7 @@ var ListTableEventController = class {
|
|
|
13611
13546
|
(item) => item.key === result.columnKey
|
|
13612
13547
|
);
|
|
13613
13548
|
const record = this.host.getDisplayData()[result.rowIndex];
|
|
13614
|
-
const value = column && record && column.dataIndex != null ? getValueByDataIndex(record, column.dataIndex) : void 0;
|
|
13549
|
+
const value = column && record && column.dataIndex != null ? utils.getValueByDataIndex(record, column.dataIndex) : void 0;
|
|
13615
13550
|
if (record && shouldOpenCellEditorOnClick(column, 1, {
|
|
13616
13551
|
value,
|
|
13617
13552
|
record,
|
|
@@ -13816,7 +13751,7 @@ var ListTableEventController = class {
|
|
|
13816
13751
|
const columnKey = this.host.selection.columnKey;
|
|
13817
13752
|
const column = this.host.leafColumns.find((item) => item.key === columnKey);
|
|
13818
13753
|
const record = this.host.getDisplayData()[rowIndex];
|
|
13819
|
-
const value = column && record && column.dataIndex != null ? getValueByDataIndex(record, column.dataIndex) : void 0;
|
|
13754
|
+
const value = column && record && column.dataIndex != null ? utils.getValueByDataIndex(record, column.dataIndex) : void 0;
|
|
13820
13755
|
if (!column || !record || !canEditCell(column, { value, record, rowIndex })) {
|
|
13821
13756
|
return;
|
|
13822
13757
|
}
|
|
@@ -15410,8 +15345,6 @@ function computeScrollbarLayout(params) {
|
|
|
15410
15345
|
}
|
|
15411
15346
|
return layout;
|
|
15412
15347
|
}
|
|
15413
|
-
|
|
15414
|
-
// src/domain/layout/compute-viewport.ts
|
|
15415
15348
|
function computeViewport(params) {
|
|
15416
15349
|
const bodyHeight = Math.max(
|
|
15417
15350
|
params.bodyHeight ?? params.height - params.headerHeight,
|
|
@@ -15441,15 +15374,12 @@ function computeViewport(params) {
|
|
|
15441
15374
|
return {
|
|
15442
15375
|
viewport,
|
|
15443
15376
|
scroll: {
|
|
15444
|
-
left:
|
|
15445
|
-
top:
|
|
15377
|
+
left: utils.clamp(params.scroll.left, 0, resolvedMaxScrollLeft),
|
|
15378
|
+
top: utils.clamp(params.scroll.top, 0, resolvedMaxScrollTop)
|
|
15446
15379
|
},
|
|
15447
15380
|
centerVisibleWidth
|
|
15448
15381
|
};
|
|
15449
15382
|
}
|
|
15450
|
-
function clamp5(value, min, max) {
|
|
15451
|
-
return Math.min(Math.max(value, min), max);
|
|
15452
|
-
}
|
|
15453
15383
|
|
|
15454
15384
|
// src/domain/rows/body-layout.ts
|
|
15455
15385
|
function resolveBodyLayout(params) {
|
|
@@ -16550,7 +16480,7 @@ function resolveSummaryTextX(params) {
|
|
|
16550
16480
|
const maxX = visibleRect.x + visibleRect.width - padding;
|
|
16551
16481
|
const preferredX = getAlignedTextX(rect, align, padding);
|
|
16552
16482
|
if (align === "center") {
|
|
16553
|
-
return
|
|
16483
|
+
return utils.clamp(preferredX, minX, maxX);
|
|
16554
16484
|
}
|
|
16555
16485
|
if (align === "right") {
|
|
16556
16486
|
return Math.max(Math.min(preferredX, maxX), minX);
|
|
@@ -16592,9 +16522,6 @@ function intersectRects2(left, right) {
|
|
|
16592
16522
|
height: maxY - y
|
|
16593
16523
|
};
|
|
16594
16524
|
}
|
|
16595
|
-
function clamp6(value, min, max) {
|
|
16596
|
-
return Math.min(Math.max(value, min), max);
|
|
16597
|
-
}
|
|
16598
16525
|
function isIndexInHighlightRange2(index, range) {
|
|
16599
16526
|
return Boolean(range && index >= range.start && index <= range.end);
|
|
16600
16527
|
}
|
|
@@ -17306,7 +17233,7 @@ function buildMergedBodyCells(rows, columns, mergeCell, rowIndexMap) {
|
|
|
17306
17233
|
if (!column || covered.has(coverKey)) {
|
|
17307
17234
|
continue;
|
|
17308
17235
|
}
|
|
17309
|
-
const value = getValueByDataIndex(record, column.dataIndex);
|
|
17236
|
+
const value = utils.getValueByDataIndex(record, column.dataIndex);
|
|
17310
17237
|
const spanConfig = spanConfigMap.get(getCellCoverKey(rowIndex, column.key)) ?? column.onCell?.(value, record, sourceRowIndex, column);
|
|
17311
17238
|
const hasExplicitRowSpan = hasExplicitSpan(spanConfig, "rowSpan");
|
|
17312
17239
|
const hasExplicitColSpan = hasExplicitSpan(spanConfig, "colSpan");
|
|
@@ -17397,7 +17324,7 @@ function buildSpanConfigMap(rows, columns, rowIndexMap) {
|
|
|
17397
17324
|
rows.forEach((record, rowIndex) => {
|
|
17398
17325
|
const sourceRowIndex = rowIndexMap?.[rowIndex] ?? rowIndex;
|
|
17399
17326
|
columns.forEach((column) => {
|
|
17400
|
-
const value = getValueByDataIndex(record, column.dataIndex);
|
|
17327
|
+
const value = utils.getValueByDataIndex(record, column.dataIndex);
|
|
17401
17328
|
spanConfigMap.set(
|
|
17402
17329
|
getCellCoverKey(rowIndex, column.key),
|
|
17403
17330
|
column.onCell?.(value, record, sourceRowIndex, column)
|
|
@@ -17479,7 +17406,7 @@ function buildAutoColSpanMap(rows, columns, keys, spanConfigMap) {
|
|
|
17479
17406
|
columnIndex += 1;
|
|
17480
17407
|
continue;
|
|
17481
17408
|
}
|
|
17482
|
-
const currentValue = getValueByDataIndex(record, column.dataIndex);
|
|
17409
|
+
const currentValue = utils.getValueByDataIndex(record, column.dataIndex);
|
|
17483
17410
|
let colSpan = 1;
|
|
17484
17411
|
for (let index = columnIndex + 1; index < columns.length; index += 1) {
|
|
17485
17412
|
if (!targetColumnIndexes.has(index)) {
|
|
@@ -17493,7 +17420,7 @@ function buildAutoColSpanMap(rows, columns, keys, spanConfigMap) {
|
|
|
17493
17420
|
if (hasExplicitSpan(spanConfigMap.get(nextCellKey), "colSpan")) {
|
|
17494
17421
|
break;
|
|
17495
17422
|
}
|
|
17496
|
-
const nextValue = getValueByDataIndex(record, nextColumn.dataIndex);
|
|
17423
|
+
const nextValue = utils.getValueByDataIndex(record, nextColumn.dataIndex);
|
|
17497
17424
|
if (!isSameMergeValue(currentValue, nextValue)) {
|
|
17498
17425
|
break;
|
|
17499
17426
|
}
|
|
@@ -17519,7 +17446,7 @@ function getTargetMergeColumns(columns, keys) {
|
|
|
17519
17446
|
return [];
|
|
17520
17447
|
}
|
|
17521
17448
|
return columns.filter(
|
|
17522
|
-
(column) => keys.some((key) =>
|
|
17449
|
+
(column) => keys.some((key) => utils.isSameDataIndex(column.dataIndex, key))
|
|
17523
17450
|
);
|
|
17524
17451
|
}
|
|
17525
17452
|
function getCellCoverKey(rowIndex, columnKey) {
|
|
@@ -17538,7 +17465,7 @@ function getMergeGroupKey(record, keys) {
|
|
|
17538
17465
|
if (!keys?.length) {
|
|
17539
17466
|
return "";
|
|
17540
17467
|
}
|
|
17541
|
-
return keys.map((key) => normalizeMergeValue(getValueByDataIndex(record, key))).join("|");
|
|
17468
|
+
return keys.map((key) => normalizeMergeValue(utils.getValueByDataIndex(record, key))).join("|");
|
|
17542
17469
|
}
|
|
17543
17470
|
function normalizeMergeValue(value) {
|
|
17544
17471
|
if (value == null) {
|
|
@@ -17552,14 +17479,6 @@ function normalizeMergeValue(value) {
|
|
|
17552
17479
|
function isSameMergeValue(left, right) {
|
|
17553
17480
|
return normalizeMergeValue(left) === normalizeMergeValue(right);
|
|
17554
17481
|
}
|
|
17555
|
-
function isSameDataIndex2(left, right) {
|
|
17556
|
-
const leftPath = Array.isArray(left) ? left : [left];
|
|
17557
|
-
const rightPath = Array.isArray(right) ? right : [right];
|
|
17558
|
-
if (leftPath.length !== rightPath.length) {
|
|
17559
|
-
return false;
|
|
17560
|
-
}
|
|
17561
|
-
return leftPath.every((key, index) => key === rightPath[index]);
|
|
17562
|
-
}
|
|
17563
17482
|
function getMergedCellWidth(columns, startIndex, colSpan) {
|
|
17564
17483
|
let width = 0;
|
|
17565
17484
|
for (let index = startIndex; index < startIndex + colSpan; index += 1) {
|
|
@@ -18324,8 +18243,6 @@ function isDragSourceColumn3(column, dragReorder) {
|
|
|
18324
18243
|
}
|
|
18325
18244
|
return column.leafIndex >= dragReorder.sourceLeafStartIndex && column.leafIndex <= dragReorder.sourceLeafEndIndex;
|
|
18326
18245
|
}
|
|
18327
|
-
|
|
18328
|
-
// src/rendering/primitives/header-text-layout.ts
|
|
18329
18246
|
var ACTION_GAP = 4;
|
|
18330
18247
|
var ACTION_SIZE = 14;
|
|
18331
18248
|
var ACTION_PADDING_INLINE = 10;
|
|
@@ -18417,16 +18334,13 @@ function getStickyTextX(rect, visibleRect, align, padding) {
|
|
|
18417
18334
|
const maxX = visibleRect.x + visibleRect.width - padding;
|
|
18418
18335
|
const preferredX = getAlignedTextX2(rect, align, padding);
|
|
18419
18336
|
if (align === "center") {
|
|
18420
|
-
return
|
|
18337
|
+
return utils.clamp(preferredX, minX, maxX);
|
|
18421
18338
|
}
|
|
18422
18339
|
if (align === "right") {
|
|
18423
18340
|
return Math.max(Math.min(preferredX, maxX), minX);
|
|
18424
18341
|
}
|
|
18425
18342
|
return Math.min(Math.max(preferredX, minX), maxX);
|
|
18426
18343
|
}
|
|
18427
|
-
function clamp7(value, min, max) {
|
|
18428
|
-
return Math.min(Math.max(value, min), max);
|
|
18429
|
-
}
|
|
18430
18344
|
|
|
18431
18345
|
// src/rendering/primitives/draw-header.ts
|
|
18432
18346
|
var ACTION_GAP2 = 4;
|
|
@@ -20789,8 +20703,6 @@ var ListTableSelectionController = class {
|
|
|
20789
20703
|
this.summarySelected = false;
|
|
20790
20704
|
}
|
|
20791
20705
|
};
|
|
20792
|
-
|
|
20793
|
-
// src/services/summary-service.ts
|
|
20794
20706
|
var SUMMARY_ASYNC_BATCH_SIZE = 2e3;
|
|
20795
20707
|
var SUMMARY_ASYNC_FRAME_BUDGET = 8;
|
|
20796
20708
|
async function computeSummaryValuesAsync(params) {
|
|
@@ -20960,7 +20872,7 @@ function getColumnRawValue(record, column, config) {
|
|
|
20960
20872
|
if (filterValue != null && filterValue !== "") {
|
|
20961
20873
|
return filterValue;
|
|
20962
20874
|
}
|
|
20963
|
-
return getValueByDataIndex(record, column.dataIndex);
|
|
20875
|
+
return utils.getValueByDataIndex(record, column.dataIndex);
|
|
20964
20876
|
}
|
|
20965
20877
|
function normalizeSummaryValue(value) {
|
|
20966
20878
|
if (value == null || value === "") {
|