@canvas-components/list-table 0.3.34 → 0.3.36
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 +66 -63
- package/dist/index.d.cts +4 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +66 -63
- package/package.json +5 -5
package/dist/index.cjs
CHANGED
|
@@ -783,6 +783,7 @@ function normalizeColumn(column, depth, parentKey) {
|
|
|
783
783
|
showExpandIcon: column.showExpandIcon,
|
|
784
784
|
ellipsis: column.ellipsis,
|
|
785
785
|
editable: column.editable,
|
|
786
|
+
showEditIcon: column.showEditIcon,
|
|
786
787
|
formItemProps: column.formItemProps,
|
|
787
788
|
allowSort: column.allowSort ?? (column.sorter != null ? column.sorter !== false : void 0),
|
|
788
789
|
sortValueGetter: column.sortValueGetter,
|
|
@@ -5313,6 +5314,31 @@ function drawHeaderActionGlyph(ctx, rect, actionType, color = "#8c8c8c", sortOrd
|
|
|
5313
5314
|
}
|
|
5314
5315
|
ctx.restore();
|
|
5315
5316
|
}
|
|
5317
|
+
function drawHeaderEditMarker(ctx, headerRect) {
|
|
5318
|
+
const size = Math.max(0, Math.min(10, headerRect.width - 2, headerRect.height - 2));
|
|
5319
|
+
const rect = { x: headerRect.x + 1, y: headerRect.y + 1, width: size, height: size };
|
|
5320
|
+
if (size > 0) {
|
|
5321
|
+
ctx.save();
|
|
5322
|
+
ctx.fillStyle = "rgba(22, 119, 255, 0.08)";
|
|
5323
|
+
ctx.beginPath();
|
|
5324
|
+
const { x, y } = rect;
|
|
5325
|
+
const radius = Math.min(4, size / 2);
|
|
5326
|
+
if (typeof ctx.arcTo === "function") {
|
|
5327
|
+
ctx.moveTo(x + radius, y);
|
|
5328
|
+
ctx.arcTo(x + size, y, x + size, y + size, radius);
|
|
5329
|
+
ctx.arcTo(x + size, y + size, x, y + size, radius);
|
|
5330
|
+
ctx.arcTo(x, y + size, x, y, radius);
|
|
5331
|
+
ctx.arcTo(x, y, x + size, y, radius);
|
|
5332
|
+
ctx.closePath();
|
|
5333
|
+
} else {
|
|
5334
|
+
ctx.rect(x, y, size, size);
|
|
5335
|
+
}
|
|
5336
|
+
ctx.fill();
|
|
5337
|
+
ctx.restore();
|
|
5338
|
+
drawHeaderActionGlyph(ctx, rect, "edit", "#1677ff");
|
|
5339
|
+
}
|
|
5340
|
+
return rect;
|
|
5341
|
+
}
|
|
5316
5342
|
function drawEditIcon(ctx, rect) {
|
|
5317
5343
|
const scale = Math.min(rect.width, rect.height) / 14;
|
|
5318
5344
|
const x = rect.x + (rect.width - 14 * scale) / 2;
|
|
@@ -8850,15 +8876,14 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
8850
8876
|
);
|
|
8851
8877
|
const isExpandSystemColumn = cell.node.children.length === 0 && cell.node.column.meta?.systemType === "expandable";
|
|
8852
8878
|
const isRowSelectorSystemColumn = cell.node.children.length === 0 && cell.node.column.meta?.systemType === "rowSelector";
|
|
8853
|
-
const isEditableLeaf = cell.node.children.length === 0 && !!cell.node.column.editable;
|
|
8879
|
+
const isEditableLeaf = cell.node.children.length === 0 && !!cell.node.column.editable && cell.node.column.showEditIcon !== false;
|
|
8854
8880
|
const visibleState = getHeaderActionVisibilityState(
|
|
8855
8881
|
cell.node.key,
|
|
8856
8882
|
params.hoveredColumnKey,
|
|
8857
8883
|
params.sortState.find((item) => item.key === cell.node.key)?.key ?? null,
|
|
8858
8884
|
params.filteredColumnKeys,
|
|
8859
8885
|
params.filterableColumnKeys,
|
|
8860
|
-
params.fixedColumnKeys
|
|
8861
|
-
isEditableLeaf
|
|
8886
|
+
params.fixedColumnKeys
|
|
8862
8887
|
);
|
|
8863
8888
|
const titleContent = cell.node.titleContent ?? [
|
|
8864
8889
|
{ type: "text", text: cell.node.title }
|
|
@@ -8870,7 +8895,6 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
8870
8895
|
actionVisibilityState: visibleState,
|
|
8871
8896
|
allowActions: cell.node.children.length === 0,
|
|
8872
8897
|
hasFilter: params.filterableColumnKeys.has(cell.node.key),
|
|
8873
|
-
hasEdit: isEditableLeaf,
|
|
8874
8898
|
contentWidth: measureHeaderContentWidth(ctx, titleContent),
|
|
8875
8899
|
paddingInline: cell.node.style?.paddingInline,
|
|
8876
8900
|
contentInsetStart: resolveHeaderContentInsetStart({
|
|
@@ -9037,18 +9061,29 @@ function measureHeaderContentWidth(ctx, contents) {
|
|
|
9037
9061
|
) + Math.max(contents.length - 1, 0) * gap;
|
|
9038
9062
|
}
|
|
9039
9063
|
function drawHeaderActions(params, rect, columnKey, visibilityState, fixed, visibleRect = rect, hasEdit = false, selected = false) {
|
|
9040
|
-
if (!visibilityState.visible) {
|
|
9041
|
-
return;
|
|
9042
|
-
}
|
|
9043
9064
|
const { ctx, descriptors } = params;
|
|
9044
9065
|
ctx.save();
|
|
9045
9066
|
ctx.beginPath();
|
|
9046
9067
|
ctx.rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height);
|
|
9047
9068
|
ctx.clip();
|
|
9069
|
+
if (hasEdit) {
|
|
9070
|
+
const hitRect = intersectRects(drawHeaderEditMarker(ctx, rect), visibleRect);
|
|
9071
|
+
if (hitRect) descriptors.push({
|
|
9072
|
+
kind: "header",
|
|
9073
|
+
rect: hitRect,
|
|
9074
|
+
columnKey,
|
|
9075
|
+
fixed,
|
|
9076
|
+
debugNodeType: "header-edit-icon",
|
|
9077
|
+
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
9078
|
+
});
|
|
9079
|
+
}
|
|
9080
|
+
if (!visibilityState.visible) {
|
|
9081
|
+
ctx.restore();
|
|
9082
|
+
return;
|
|
9083
|
+
}
|
|
9048
9084
|
const actionLayout = getHeaderActionLayout({
|
|
9049
9085
|
rect,
|
|
9050
9086
|
hasFilter: params.filterableColumnKeys.has(columnKey),
|
|
9051
|
-
hasEdit,
|
|
9052
9087
|
visibilityState,
|
|
9053
9088
|
trailingInset: resolveCollapsedColumnMarkerSet(
|
|
9054
9089
|
params.collapsedColumnMarkers,
|
|
@@ -9079,28 +9114,7 @@ function drawHeaderActions(params, rect, columnKey, visibilityState, fixed, visi
|
|
|
9079
9114
|
width: ACTION_SIZE2,
|
|
9080
9115
|
height: ACTION_SIZE2
|
|
9081
9116
|
};
|
|
9082
|
-
if (actionType === "edit")
|
|
9083
|
-
drawHeaderActionIcon(
|
|
9084
|
-
ctx,
|
|
9085
|
-
actionRect,
|
|
9086
|
-
"edit",
|
|
9087
|
-
true,
|
|
9088
|
-
false,
|
|
9089
|
-
headerSelected,
|
|
9090
|
-
params.theme.selectionBackgroundColor
|
|
9091
|
-
);
|
|
9092
|
-
const hitRect2 = intersectRects(actionRect, visibleRect);
|
|
9093
|
-
if (hitRect2)
|
|
9094
|
-
descriptors.push({
|
|
9095
|
-
kind: "header",
|
|
9096
|
-
rect: hitRect2,
|
|
9097
|
-
columnKey,
|
|
9098
|
-
fixed,
|
|
9099
|
-
debugNodeType: "header-edit-icon",
|
|
9100
|
-
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
9101
|
-
});
|
|
9102
|
-
return;
|
|
9103
|
-
}
|
|
9117
|
+
if (actionType === "edit") return;
|
|
9104
9118
|
const iconHovered = params.hoveredColumnKey === columnKey && params.hoveredActionType === (actionType === "sort" ? "sort-trigger" : actionType === "filter" ? "filter-trigger" : "fixed-trigger");
|
|
9105
9119
|
drawHeaderActionIcon(
|
|
9106
9120
|
ctx,
|
|
@@ -9253,7 +9267,7 @@ function getHeaderSelectionRect(rect) {
|
|
|
9253
9267
|
height: size
|
|
9254
9268
|
};
|
|
9255
9269
|
}
|
|
9256
|
-
function getHeaderActionVisibilityState(columnKey, hoveredColumnKey, sortedColumnKey, filteredColumnKeys, filterableColumnKeys, fixedColumnKeys
|
|
9270
|
+
function getHeaderActionVisibilityState(columnKey, hoveredColumnKey, sortedColumnKey, filteredColumnKeys, filterableColumnKeys, fixedColumnKeys) {
|
|
9257
9271
|
const hovered = hoveredColumnKey === columnKey;
|
|
9258
9272
|
const sorted = sortedColumnKey === columnKey;
|
|
9259
9273
|
const filtered = filterableColumnKeys.has(columnKey) && filteredColumnKeys.has(columnKey);
|
|
@@ -9263,7 +9277,7 @@ function getHeaderActionVisibilityState(columnKey, hoveredColumnKey, sortedColum
|
|
|
9263
9277
|
sorted,
|
|
9264
9278
|
filtered,
|
|
9265
9279
|
fixed,
|
|
9266
|
-
visible: hovered || sorted || filtered || fixed
|
|
9280
|
+
visible: hovered || sorted || filtered || fixed
|
|
9267
9281
|
};
|
|
9268
9282
|
}
|
|
9269
9283
|
function getActionActive(actionType, visibilityState) {
|
|
@@ -10350,8 +10364,7 @@ function drawBodyNestedTableContent(params) {
|
|
|
10350
10364
|
align: column.align ?? "left",
|
|
10351
10365
|
actionVisibilityState,
|
|
10352
10366
|
allowActions: true,
|
|
10353
|
-
hasFilter: column.allowFilter === true
|
|
10354
|
-
hasEdit: !!column.editable
|
|
10367
|
+
hasFilter: column.allowFilter === true
|
|
10355
10368
|
});
|
|
10356
10369
|
const headerHighlighted = isNestedTableHeaderHighlighted(
|
|
10357
10370
|
content,
|
|
@@ -10728,11 +10741,27 @@ function drawNestedTableHeaderActions(params) {
|
|
|
10728
10741
|
const filtered = highlight?.filterState?.[columnKey] != null;
|
|
10729
10742
|
const fixed = resolveNestedColumnFixed(column, highlight);
|
|
10730
10743
|
const headerSelected = highlight?.kind === "header" && isNestedTableRuntimeColumnMatched(highlight, column, columnIndex);
|
|
10744
|
+
if (column.editable && column.showEditIcon !== false) {
|
|
10745
|
+
const markerRect = drawHeaderEditMarker(drawParams.ctx, rect);
|
|
10746
|
+
drawParams.descriptors.push({
|
|
10747
|
+
kind: "body-content",
|
|
10748
|
+
rect: markerRect,
|
|
10749
|
+
columnKey: drawParams.column.key,
|
|
10750
|
+
rowIndex: drawParams.rowIndex,
|
|
10751
|
+
contentIndex: drawParams.contentIndex,
|
|
10752
|
+
contentKey: "nested-table",
|
|
10753
|
+
nestedColumnDataIndex: columnKey,
|
|
10754
|
+
nestedColumnIndex: columnIndex,
|
|
10755
|
+
fixed: drawParams.column.fixed,
|
|
10756
|
+
frozen: drawParams.frozen,
|
|
10757
|
+
debugNodeType: "nested-table-header-edit-icon",
|
|
10758
|
+
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
10759
|
+
});
|
|
10760
|
+
}
|
|
10731
10761
|
if (!visibilityState.visible) return;
|
|
10732
10762
|
const { actionTypes, startX, totalWidth } = getHeaderActionLayout({
|
|
10733
10763
|
rect,
|
|
10734
10764
|
hasFilter: column.allowFilter === true,
|
|
10735
|
-
hasEdit: !!column.editable,
|
|
10736
10765
|
visibilityState
|
|
10737
10766
|
});
|
|
10738
10767
|
drawParams.ctx.save();
|
|
@@ -10754,33 +10783,7 @@ function drawNestedTableHeaderActions(params) {
|
|
|
10754
10783
|
width: size,
|
|
10755
10784
|
height: size
|
|
10756
10785
|
};
|
|
10757
|
-
if (actionType === "edit")
|
|
10758
|
-
drawHeaderActionIcon(
|
|
10759
|
-
drawParams.ctx,
|
|
10760
|
-
actionRect,
|
|
10761
|
-
"edit",
|
|
10762
|
-
true,
|
|
10763
|
-
false,
|
|
10764
|
-
headerSelected,
|
|
10765
|
-
drawParams.theme.selectionBackgroundColor
|
|
10766
|
-
);
|
|
10767
|
-
drawParams.descriptors.push({
|
|
10768
|
-
kind: "body-content",
|
|
10769
|
-
rect: actionRect,
|
|
10770
|
-
columnKey: drawParams.column.key,
|
|
10771
|
-
rowIndex: drawParams.rowIndex,
|
|
10772
|
-
contentIndex: drawParams.contentIndex,
|
|
10773
|
-
contentKey: "nested-table",
|
|
10774
|
-
nestedColumnDataIndex: columnKey,
|
|
10775
|
-
nestedColumnIndex: columnIndex,
|
|
10776
|
-
fixed: drawParams.column.fixed,
|
|
10777
|
-
frozen: drawParams.frozen,
|
|
10778
|
-
debugNodeType: "nested-table-header-edit-icon",
|
|
10779
|
-
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
10780
|
-
});
|
|
10781
|
-
actionX += size + gap;
|
|
10782
|
-
return;
|
|
10783
|
-
}
|
|
10786
|
+
if (actionType === "edit") return;
|
|
10784
10787
|
const active = actionType === "sort" && sortOrder != null || actionType === "filter" && filtered || actionType === "fixed" && fixed != null;
|
|
10785
10788
|
drawHeaderActionIcon(
|
|
10786
10789
|
drawParams.ctx,
|
|
@@ -10824,7 +10827,7 @@ function resolveNestedTableHeaderActionVisibility(params) {
|
|
|
10824
10827
|
sorted,
|
|
10825
10828
|
filtered,
|
|
10826
10829
|
fixed,
|
|
10827
|
-
visible: hovered || sorted || filtered || fixed
|
|
10830
|
+
visible: hovered || sorted || filtered || fixed
|
|
10828
10831
|
};
|
|
10829
10832
|
}
|
|
10830
10833
|
function isNestedTableRowHighlighted(content, record, rowIndex, highlight, highlightMode) {
|
package/dist/index.d.cts
CHANGED
|
@@ -959,6 +959,8 @@ interface ListTableNestedTableColumn {
|
|
|
959
959
|
align?: ListTableHorizontalAlign;
|
|
960
960
|
/** 是否允许编辑子表格单元格。 */
|
|
961
961
|
editable?: ListTableEditable<Record<string, unknown>>;
|
|
962
|
+
/** 是否显示可编辑列的表头左上角编辑图标,默认 true;不影响编辑能力。 */
|
|
963
|
+
showEditIcon?: boolean;
|
|
962
964
|
/** 子表格单元格编辑器配置。 */
|
|
963
965
|
formItemProps?: ListTableFormItemProps<Record<string, unknown>>;
|
|
964
966
|
fixed?: "left" | "right";
|
|
@@ -1138,6 +1140,8 @@ interface ListTableColumn<RecordType = Record<string, unknown>> {
|
|
|
1138
1140
|
ellipsis?: boolean;
|
|
1139
1141
|
/** 是否允许进入编辑输入态。 */
|
|
1140
1142
|
editable?: ListTableEditable<RecordType>;
|
|
1143
|
+
/** 是否显示可编辑列的表头左上角编辑图标,默认 true;不影响编辑能力。 */
|
|
1144
|
+
showEditIcon?: boolean;
|
|
1141
1145
|
/** 编辑器配置,未传时默认使用文本输入。 */
|
|
1142
1146
|
formItemProps?: ListTableFormItemProps<RecordType>;
|
|
1143
1147
|
/** 是否允许拖拽改变列宽。默认取表格级配置。 */
|
package/dist/index.d.ts
CHANGED
|
@@ -959,6 +959,8 @@ interface ListTableNestedTableColumn {
|
|
|
959
959
|
align?: ListTableHorizontalAlign;
|
|
960
960
|
/** 是否允许编辑子表格单元格。 */
|
|
961
961
|
editable?: ListTableEditable<Record<string, unknown>>;
|
|
962
|
+
/** 是否显示可编辑列的表头左上角编辑图标,默认 true;不影响编辑能力。 */
|
|
963
|
+
showEditIcon?: boolean;
|
|
962
964
|
/** 子表格单元格编辑器配置。 */
|
|
963
965
|
formItemProps?: ListTableFormItemProps<Record<string, unknown>>;
|
|
964
966
|
fixed?: "left" | "right";
|
|
@@ -1138,6 +1140,8 @@ interface ListTableColumn<RecordType = Record<string, unknown>> {
|
|
|
1138
1140
|
ellipsis?: boolean;
|
|
1139
1141
|
/** 是否允许进入编辑输入态。 */
|
|
1140
1142
|
editable?: ListTableEditable<RecordType>;
|
|
1143
|
+
/** 是否显示可编辑列的表头左上角编辑图标,默认 true;不影响编辑能力。 */
|
|
1144
|
+
showEditIcon?: boolean;
|
|
1141
1145
|
/** 编辑器配置,未传时默认使用文本输入。 */
|
|
1142
1146
|
formItemProps?: ListTableFormItemProps<RecordType>;
|
|
1143
1147
|
/** 是否允许拖拽改变列宽。默认取表格级配置。 */
|
package/dist/index.js
CHANGED
|
@@ -761,6 +761,7 @@ function normalizeColumn(column, depth, parentKey) {
|
|
|
761
761
|
showExpandIcon: column.showExpandIcon,
|
|
762
762
|
ellipsis: column.ellipsis,
|
|
763
763
|
editable: column.editable,
|
|
764
|
+
showEditIcon: column.showEditIcon,
|
|
764
765
|
formItemProps: column.formItemProps,
|
|
765
766
|
allowSort: column.allowSort ?? (column.sorter != null ? column.sorter !== false : void 0),
|
|
766
767
|
sortValueGetter: column.sortValueGetter,
|
|
@@ -5291,6 +5292,31 @@ function drawHeaderActionGlyph(ctx, rect, actionType, color = "#8c8c8c", sortOrd
|
|
|
5291
5292
|
}
|
|
5292
5293
|
ctx.restore();
|
|
5293
5294
|
}
|
|
5295
|
+
function drawHeaderEditMarker(ctx, headerRect) {
|
|
5296
|
+
const size = Math.max(0, Math.min(10, headerRect.width - 2, headerRect.height - 2));
|
|
5297
|
+
const rect = { x: headerRect.x + 1, y: headerRect.y + 1, width: size, height: size };
|
|
5298
|
+
if (size > 0) {
|
|
5299
|
+
ctx.save();
|
|
5300
|
+
ctx.fillStyle = "rgba(22, 119, 255, 0.08)";
|
|
5301
|
+
ctx.beginPath();
|
|
5302
|
+
const { x, y } = rect;
|
|
5303
|
+
const radius = Math.min(4, size / 2);
|
|
5304
|
+
if (typeof ctx.arcTo === "function") {
|
|
5305
|
+
ctx.moveTo(x + radius, y);
|
|
5306
|
+
ctx.arcTo(x + size, y, x + size, y + size, radius);
|
|
5307
|
+
ctx.arcTo(x + size, y + size, x, y + size, radius);
|
|
5308
|
+
ctx.arcTo(x, y + size, x, y, radius);
|
|
5309
|
+
ctx.arcTo(x, y, x + size, y, radius);
|
|
5310
|
+
ctx.closePath();
|
|
5311
|
+
} else {
|
|
5312
|
+
ctx.rect(x, y, size, size);
|
|
5313
|
+
}
|
|
5314
|
+
ctx.fill();
|
|
5315
|
+
ctx.restore();
|
|
5316
|
+
drawHeaderActionGlyph(ctx, rect, "edit", "#1677ff");
|
|
5317
|
+
}
|
|
5318
|
+
return rect;
|
|
5319
|
+
}
|
|
5294
5320
|
function drawEditIcon(ctx, rect) {
|
|
5295
5321
|
const scale = Math.min(rect.width, rect.height) / 14;
|
|
5296
5322
|
const x = rect.x + (rect.width - 14 * scale) / 2;
|
|
@@ -8828,15 +8854,14 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
8828
8854
|
);
|
|
8829
8855
|
const isExpandSystemColumn = cell.node.children.length === 0 && cell.node.column.meta?.systemType === "expandable";
|
|
8830
8856
|
const isRowSelectorSystemColumn = cell.node.children.length === 0 && cell.node.column.meta?.systemType === "rowSelector";
|
|
8831
|
-
const isEditableLeaf = cell.node.children.length === 0 && !!cell.node.column.editable;
|
|
8857
|
+
const isEditableLeaf = cell.node.children.length === 0 && !!cell.node.column.editable && cell.node.column.showEditIcon !== false;
|
|
8832
8858
|
const visibleState = getHeaderActionVisibilityState(
|
|
8833
8859
|
cell.node.key,
|
|
8834
8860
|
params.hoveredColumnKey,
|
|
8835
8861
|
params.sortState.find((item) => item.key === cell.node.key)?.key ?? null,
|
|
8836
8862
|
params.filteredColumnKeys,
|
|
8837
8863
|
params.filterableColumnKeys,
|
|
8838
|
-
params.fixedColumnKeys
|
|
8839
|
-
isEditableLeaf
|
|
8864
|
+
params.fixedColumnKeys
|
|
8840
8865
|
);
|
|
8841
8866
|
const titleContent = cell.node.titleContent ?? [
|
|
8842
8867
|
{ type: "text", text: cell.node.title }
|
|
@@ -8848,7 +8873,6 @@ function drawHeaderCell(params, cell, clipRect) {
|
|
|
8848
8873
|
actionVisibilityState: visibleState,
|
|
8849
8874
|
allowActions: cell.node.children.length === 0,
|
|
8850
8875
|
hasFilter: params.filterableColumnKeys.has(cell.node.key),
|
|
8851
|
-
hasEdit: isEditableLeaf,
|
|
8852
8876
|
contentWidth: measureHeaderContentWidth(ctx, titleContent),
|
|
8853
8877
|
paddingInline: cell.node.style?.paddingInline,
|
|
8854
8878
|
contentInsetStart: resolveHeaderContentInsetStart({
|
|
@@ -9015,18 +9039,29 @@ function measureHeaderContentWidth(ctx, contents) {
|
|
|
9015
9039
|
) + Math.max(contents.length - 1, 0) * gap;
|
|
9016
9040
|
}
|
|
9017
9041
|
function drawHeaderActions(params, rect, columnKey, visibilityState, fixed, visibleRect = rect, hasEdit = false, selected = false) {
|
|
9018
|
-
if (!visibilityState.visible) {
|
|
9019
|
-
return;
|
|
9020
|
-
}
|
|
9021
9042
|
const { ctx, descriptors } = params;
|
|
9022
9043
|
ctx.save();
|
|
9023
9044
|
ctx.beginPath();
|
|
9024
9045
|
ctx.rect(visibleRect.x, visibleRect.y, visibleRect.width, visibleRect.height);
|
|
9025
9046
|
ctx.clip();
|
|
9047
|
+
if (hasEdit) {
|
|
9048
|
+
const hitRect = intersectRects(drawHeaderEditMarker(ctx, rect), visibleRect);
|
|
9049
|
+
if (hitRect) descriptors.push({
|
|
9050
|
+
kind: "header",
|
|
9051
|
+
rect: hitRect,
|
|
9052
|
+
columnKey,
|
|
9053
|
+
fixed,
|
|
9054
|
+
debugNodeType: "header-edit-icon",
|
|
9055
|
+
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
9056
|
+
});
|
|
9057
|
+
}
|
|
9058
|
+
if (!visibilityState.visible) {
|
|
9059
|
+
ctx.restore();
|
|
9060
|
+
return;
|
|
9061
|
+
}
|
|
9026
9062
|
const actionLayout = getHeaderActionLayout({
|
|
9027
9063
|
rect,
|
|
9028
9064
|
hasFilter: params.filterableColumnKeys.has(columnKey),
|
|
9029
|
-
hasEdit,
|
|
9030
9065
|
visibilityState,
|
|
9031
9066
|
trailingInset: resolveCollapsedColumnMarkerSet(
|
|
9032
9067
|
params.collapsedColumnMarkers,
|
|
@@ -9057,28 +9092,7 @@ function drawHeaderActions(params, rect, columnKey, visibilityState, fixed, visi
|
|
|
9057
9092
|
width: ACTION_SIZE2,
|
|
9058
9093
|
height: ACTION_SIZE2
|
|
9059
9094
|
};
|
|
9060
|
-
if (actionType === "edit")
|
|
9061
|
-
drawHeaderActionIcon(
|
|
9062
|
-
ctx,
|
|
9063
|
-
actionRect,
|
|
9064
|
-
"edit",
|
|
9065
|
-
true,
|
|
9066
|
-
false,
|
|
9067
|
-
headerSelected,
|
|
9068
|
-
params.theme.selectionBackgroundColor
|
|
9069
|
-
);
|
|
9070
|
-
const hitRect2 = intersectRects(actionRect, visibleRect);
|
|
9071
|
-
if (hitRect2)
|
|
9072
|
-
descriptors.push({
|
|
9073
|
-
kind: "header",
|
|
9074
|
-
rect: hitRect2,
|
|
9075
|
-
columnKey,
|
|
9076
|
-
fixed,
|
|
9077
|
-
debugNodeType: "header-edit-icon",
|
|
9078
|
-
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
9079
|
-
});
|
|
9080
|
-
return;
|
|
9081
|
-
}
|
|
9095
|
+
if (actionType === "edit") return;
|
|
9082
9096
|
const iconHovered = params.hoveredColumnKey === columnKey && params.hoveredActionType === (actionType === "sort" ? "sort-trigger" : actionType === "filter" ? "filter-trigger" : "fixed-trigger");
|
|
9083
9097
|
drawHeaderActionIcon(
|
|
9084
9098
|
ctx,
|
|
@@ -9231,7 +9245,7 @@ function getHeaderSelectionRect(rect) {
|
|
|
9231
9245
|
height: size
|
|
9232
9246
|
};
|
|
9233
9247
|
}
|
|
9234
|
-
function getHeaderActionVisibilityState(columnKey, hoveredColumnKey, sortedColumnKey, filteredColumnKeys, filterableColumnKeys, fixedColumnKeys
|
|
9248
|
+
function getHeaderActionVisibilityState(columnKey, hoveredColumnKey, sortedColumnKey, filteredColumnKeys, filterableColumnKeys, fixedColumnKeys) {
|
|
9235
9249
|
const hovered = hoveredColumnKey === columnKey;
|
|
9236
9250
|
const sorted = sortedColumnKey === columnKey;
|
|
9237
9251
|
const filtered = filterableColumnKeys.has(columnKey) && filteredColumnKeys.has(columnKey);
|
|
@@ -9241,7 +9255,7 @@ function getHeaderActionVisibilityState(columnKey, hoveredColumnKey, sortedColum
|
|
|
9241
9255
|
sorted,
|
|
9242
9256
|
filtered,
|
|
9243
9257
|
fixed,
|
|
9244
|
-
visible: hovered || sorted || filtered || fixed
|
|
9258
|
+
visible: hovered || sorted || filtered || fixed
|
|
9245
9259
|
};
|
|
9246
9260
|
}
|
|
9247
9261
|
function getActionActive(actionType, visibilityState) {
|
|
@@ -10328,8 +10342,7 @@ function drawBodyNestedTableContent(params) {
|
|
|
10328
10342
|
align: column.align ?? "left",
|
|
10329
10343
|
actionVisibilityState,
|
|
10330
10344
|
allowActions: true,
|
|
10331
|
-
hasFilter: column.allowFilter === true
|
|
10332
|
-
hasEdit: !!column.editable
|
|
10345
|
+
hasFilter: column.allowFilter === true
|
|
10333
10346
|
});
|
|
10334
10347
|
const headerHighlighted = isNestedTableHeaderHighlighted(
|
|
10335
10348
|
content,
|
|
@@ -10706,11 +10719,27 @@ function drawNestedTableHeaderActions(params) {
|
|
|
10706
10719
|
const filtered = highlight?.filterState?.[columnKey] != null;
|
|
10707
10720
|
const fixed = resolveNestedColumnFixed(column, highlight);
|
|
10708
10721
|
const headerSelected = highlight?.kind === "header" && isNestedTableRuntimeColumnMatched(highlight, column, columnIndex);
|
|
10722
|
+
if (column.editable && column.showEditIcon !== false) {
|
|
10723
|
+
const markerRect = drawHeaderEditMarker(drawParams.ctx, rect);
|
|
10724
|
+
drawParams.descriptors.push({
|
|
10725
|
+
kind: "body-content",
|
|
10726
|
+
rect: markerRect,
|
|
10727
|
+
columnKey: drawParams.column.key,
|
|
10728
|
+
rowIndex: drawParams.rowIndex,
|
|
10729
|
+
contentIndex: drawParams.contentIndex,
|
|
10730
|
+
contentKey: "nested-table",
|
|
10731
|
+
nestedColumnDataIndex: columnKey,
|
|
10732
|
+
nestedColumnIndex: columnIndex,
|
|
10733
|
+
fixed: drawParams.column.fixed,
|
|
10734
|
+
frozen: drawParams.frozen,
|
|
10735
|
+
debugNodeType: "nested-table-header-edit-icon",
|
|
10736
|
+
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
10737
|
+
});
|
|
10738
|
+
}
|
|
10709
10739
|
if (!visibilityState.visible) return;
|
|
10710
10740
|
const { actionTypes, startX, totalWidth } = getHeaderActionLayout({
|
|
10711
10741
|
rect,
|
|
10712
10742
|
hasFilter: column.allowFilter === true,
|
|
10713
|
-
hasEdit: !!column.editable,
|
|
10714
10743
|
visibilityState
|
|
10715
10744
|
});
|
|
10716
10745
|
drawParams.ctx.save();
|
|
@@ -10732,33 +10761,7 @@ function drawNestedTableHeaderActions(params) {
|
|
|
10732
10761
|
width: size,
|
|
10733
10762
|
height: size
|
|
10734
10763
|
};
|
|
10735
|
-
if (actionType === "edit")
|
|
10736
|
-
drawHeaderActionIcon(
|
|
10737
|
-
drawParams.ctx,
|
|
10738
|
-
actionRect,
|
|
10739
|
-
"edit",
|
|
10740
|
-
true,
|
|
10741
|
-
false,
|
|
10742
|
-
headerSelected,
|
|
10743
|
-
drawParams.theme.selectionBackgroundColor
|
|
10744
|
-
);
|
|
10745
|
-
drawParams.descriptors.push({
|
|
10746
|
-
kind: "body-content",
|
|
10747
|
-
rect: actionRect,
|
|
10748
|
-
columnKey: drawParams.column.key,
|
|
10749
|
-
rowIndex: drawParams.rowIndex,
|
|
10750
|
-
contentIndex: drawParams.contentIndex,
|
|
10751
|
-
contentKey: "nested-table",
|
|
10752
|
-
nestedColumnDataIndex: columnKey,
|
|
10753
|
-
nestedColumnIndex: columnIndex,
|
|
10754
|
-
fixed: drawParams.column.fixed,
|
|
10755
|
-
frozen: drawParams.frozen,
|
|
10756
|
-
debugNodeType: "nested-table-header-edit-icon",
|
|
10757
|
-
debugText: "\u5F53\u524D\u5217\u53EF\u7F16\u8F91"
|
|
10758
|
-
});
|
|
10759
|
-
actionX += size + gap;
|
|
10760
|
-
return;
|
|
10761
|
-
}
|
|
10764
|
+
if (actionType === "edit") return;
|
|
10762
10765
|
const active = actionType === "sort" && sortOrder != null || actionType === "filter" && filtered || actionType === "fixed" && fixed != null;
|
|
10763
10766
|
drawHeaderActionIcon(
|
|
10764
10767
|
drawParams.ctx,
|
|
@@ -10802,7 +10805,7 @@ function resolveNestedTableHeaderActionVisibility(params) {
|
|
|
10802
10805
|
sorted,
|
|
10803
10806
|
filtered,
|
|
10804
10807
|
fixed,
|
|
10805
|
-
visible: hovered || sorted || filtered || fixed
|
|
10808
|
+
visible: hovered || sorted || filtered || fixed
|
|
10806
10809
|
};
|
|
10807
10810
|
}
|
|
10808
10811
|
function isNestedTableRowHighlighted(content, record, rowIndex, highlight, highlightMode) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@canvas-components/list-table",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.36",
|
|
4
4
|
"description": "Framework-agnostic list table core engine.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -27,11 +27,11 @@
|
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
29
|
"@ant-design/icons-svg": "4.6.0",
|
|
30
|
-
"@canvas-components/qrcode": "0.2.2",
|
|
31
|
-
"@canvas-components/barcode": "0.2.2",
|
|
32
30
|
"@canvas-components/utils": "0.2.8",
|
|
33
|
-
"@canvas-components/
|
|
34
|
-
"@canvas-components/
|
|
31
|
+
"@canvas-components/chart": "0.3.8",
|
|
32
|
+
"@canvas-components/barcode": "0.2.2",
|
|
33
|
+
"@canvas-components/qrcode": "0.2.2",
|
|
34
|
+
"@canvas-components/stats": "0.1.4"
|
|
35
35
|
},
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "tsup --config tsup.config.ts"
|