@canvas-components/list-table 0.2.2 → 0.2.3
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 +54 -36
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.d.cts
CHANGED
|
@@ -1412,6 +1412,12 @@ interface ListTablePaginationOptions {
|
|
|
1412
1412
|
interface ListTableRowSelectionRecordProps {
|
|
1413
1413
|
disabled?: boolean;
|
|
1414
1414
|
}
|
|
1415
|
+
/**
|
|
1416
|
+
* 行事件配置。
|
|
1417
|
+
*/
|
|
1418
|
+
interface ListTableRowEventProps {
|
|
1419
|
+
onClick?: (event: MouseEvent) => void;
|
|
1420
|
+
}
|
|
1415
1421
|
/**
|
|
1416
1422
|
* 行选择变更信息。
|
|
1417
1423
|
*/
|
|
@@ -1423,6 +1429,12 @@ interface ListTableRowSelectionChangeInfo {
|
|
|
1423
1429
|
*/
|
|
1424
1430
|
interface ListTableRowSelectionOptions<RecordType> {
|
|
1425
1431
|
type?: "checkbox" | "radio";
|
|
1432
|
+
/**
|
|
1433
|
+
* 点击普通表体区域时是否切换当前行选择状态。
|
|
1434
|
+
*
|
|
1435
|
+
* @default false
|
|
1436
|
+
*/
|
|
1437
|
+
selectRowByClick?: boolean;
|
|
1426
1438
|
selectedRowKeys?: Array<string | number>;
|
|
1427
1439
|
defaultSelectedRowKeys?: Array<string | number>;
|
|
1428
1440
|
fixed?: "left" | "right";
|
|
@@ -1507,6 +1519,8 @@ interface ListTableOptions<RecordType = Record<string, unknown>> {
|
|
|
1507
1519
|
height?: number | string;
|
|
1508
1520
|
columns: ListTableColumn<RecordType>[];
|
|
1509
1521
|
dataSource: RecordType[];
|
|
1522
|
+
/** AntD Table 风格的行事件配置。 */
|
|
1523
|
+
onRow?: (record: RecordType, rowIndex: number) => ListTableRowEventProps | null | undefined;
|
|
1510
1524
|
emptyText?: string;
|
|
1511
1525
|
theme?: Partial<ListTableTheme>;
|
|
1512
1526
|
/**
|
|
@@ -1682,4 +1696,4 @@ interface ListTableValidationTarget {
|
|
|
1682
1696
|
columnKey: string;
|
|
1683
1697
|
}
|
|
1684
1698
|
|
|
1685
|
-
export { type CreateCellEditorSessionParams, type DebugHitTestResult, type FilterPanelConfig, type FilterPanelOptionItem, type FilterPanelTexts, type FixedPopupConfig, type HeaderContextMenuColumnItem, type HeaderContextMenuConfig, type HeaderContextMenuDensity, ListTable, type ListTableAutoMergeRule, type ListTableBarcodeCellContent, type ListTableBarcodeFormat, type ListTableButtonCellContent, type ListTableButtonPopconfirmOptions, type ListTableButtonSize, type ListTableButtonType, type ListTableCarouselScrollOptions, type ListTableCellContent, type ListTableCellContentClickContext, type ListTableCellEditorSession, type ListTableCellSpan, type ListTableCellStyle, type ListTableChartCellContent, type ListTableChartSize, type ListTableChartType, type ListTableColorCellContent, type ListTableColumn, type ListTableContextMenuFeature, type ListTableContextMenuOptions, type ListTableCustomChartCellContent, type ListTableDangerConfirmRequest, type ListTableDataFormatType, type ListTableDebugOptions, type ListTableDebugSnapshot, type ListTableEditAutoCompleteEnter, type ListTableEditFilterOption, type ListTableEditOption, type ListTableEditValueType, type ListTableEditable, type ListTableEditorAutoCompleteEnter, type ListTableEditorConfig, type ListTableEditorFactory, type ListTableEditorFilterOption, type ListTableEditorNavigateDirection, type ListTableEditorOption, type ListTableEditorRect, type ListTableEditorRequest, type ListTableEditorTheme, type ListTableEditorValueType, type ListTableExportXlsxOptions, type ListTableFilterConditionOperator, type ListTableFilterConditionRelation, type ListTableFilterMatchMode, type ListTableFilterOption, type ListTableFilterOptionValue, type ListTableFilterPanelAdapter, type ListTableFilterState, type ListTableFilterType, type ListTableFilterValue$1 as ListTableFilterValue, type ListTableFixedPopupAdapter, type ListTableFormItemProps, type ListTableFormItemPropsConfig, type ListTableFormRule, type ListTableFormRules, type ListTableHeaderContextMenuAdapter, type ListTableHighlightMode, type ListTableHorizontalAlign, type ListTableIconCellContent, type ListTableImageCellContent, type ListTableImageObjectFit, type ListTableImagePreviewRequest, type ListTableLoadingAdapter, type ListTableLoadingRequest, type ListTableMergeCellOptions, type ListTableNestedTableCellContent, type ListTableNestedTableColumn, type ListTableOptions, type ListTablePaginationAdapter, type ListTablePaginationOptions, type ListTableProgressCellContent, type ListTableProgressShape, type ListTableProgressSize, type ListTableQrCodeCellContent, type ListTableQrCodeLevel, type ListTableQueryChange, type ListTableQueryChangeExtra, type ListTableQueryFilters, type ListTableQueryOptions, type ListTableQueryPagination, type ListTableQuerySorter, type ListTableRateCellContent, type ListTableRateSize, type ListTableRowDragMode, type ListTableRowDragOptions, type ListTableRowDragPayload, type ListTableRowDragSourceInfo, type ListTableRowDragZone, type ListTableRowSelectionChangeInfo, type ListTableRowSelectionOptions, type ListTableScrollToOptions, type ListTableScrollbarOptions, type ListTableSelectionState, type ListTableSortItem, type ListTableSortState, type ListTableSparklineChartCellContent, type ListTableSparklineSize, type ListTableSymbolType, type ListTableTagCellContent, type ListTableTheme, type ListTableTooltipAdapter, type ListTableTooltipRequest, type ListTableUiOptions, type ListTableValidationError, type ListTableValidationErrorField, type ListTableValidationFailure, type ListTableValidationTarget, type PaginationConfig, type RenderCellDescriptor };
|
|
1699
|
+
export { type CreateCellEditorSessionParams, type DebugHitTestResult, type FilterPanelConfig, type FilterPanelOptionItem, type FilterPanelTexts, type FixedPopupConfig, type HeaderContextMenuColumnItem, type HeaderContextMenuConfig, type HeaderContextMenuDensity, ListTable, type ListTableAutoMergeRule, type ListTableBarcodeCellContent, type ListTableBarcodeFormat, type ListTableButtonCellContent, type ListTableButtonPopconfirmOptions, type ListTableButtonSize, type ListTableButtonType, type ListTableCarouselScrollOptions, type ListTableCellContent, type ListTableCellContentClickContext, type ListTableCellEditorSession, type ListTableCellSpan, type ListTableCellStyle, type ListTableChartCellContent, type ListTableChartSize, type ListTableChartType, type ListTableColorCellContent, type ListTableColumn, type ListTableContextMenuFeature, type ListTableContextMenuOptions, type ListTableCustomChartCellContent, type ListTableDangerConfirmRequest, type ListTableDataFormatType, type ListTableDebugOptions, type ListTableDebugSnapshot, type ListTableEditAutoCompleteEnter, type ListTableEditFilterOption, type ListTableEditOption, type ListTableEditValueType, type ListTableEditable, type ListTableEditorAutoCompleteEnter, type ListTableEditorConfig, type ListTableEditorFactory, type ListTableEditorFilterOption, type ListTableEditorNavigateDirection, type ListTableEditorOption, type ListTableEditorRect, type ListTableEditorRequest, type ListTableEditorTheme, type ListTableEditorValueType, type ListTableExportXlsxOptions, type ListTableFilterConditionOperator, type ListTableFilterConditionRelation, type ListTableFilterMatchMode, type ListTableFilterOption, type ListTableFilterOptionValue, type ListTableFilterPanelAdapter, type ListTableFilterState, type ListTableFilterType, type ListTableFilterValue$1 as ListTableFilterValue, type ListTableFixedPopupAdapter, type ListTableFormItemProps, type ListTableFormItemPropsConfig, type ListTableFormRule, type ListTableFormRules, type ListTableHeaderContextMenuAdapter, type ListTableHighlightMode, type ListTableHorizontalAlign, type ListTableIconCellContent, type ListTableImageCellContent, type ListTableImageObjectFit, type ListTableImagePreviewRequest, type ListTableLoadingAdapter, type ListTableLoadingRequest, type ListTableMergeCellOptions, type ListTableNestedTableCellContent, type ListTableNestedTableColumn, type ListTableOptions, type ListTablePaginationAdapter, type ListTablePaginationOptions, type ListTableProgressCellContent, type ListTableProgressShape, type ListTableProgressSize, type ListTableQrCodeCellContent, type ListTableQrCodeLevel, type ListTableQueryChange, type ListTableQueryChangeExtra, type ListTableQueryFilters, type ListTableQueryOptions, type ListTableQueryPagination, type ListTableQuerySorter, type ListTableRateCellContent, type ListTableRateSize, type ListTableRowDragMode, type ListTableRowDragOptions, type ListTableRowDragPayload, type ListTableRowDragSourceInfo, type ListTableRowDragZone, type ListTableRowEventProps, type ListTableRowSelectionChangeInfo, type ListTableRowSelectionOptions, type ListTableScrollToOptions, type ListTableScrollbarOptions, type ListTableSelectionState, type ListTableSortItem, type ListTableSortState, type ListTableSparklineChartCellContent, type ListTableSparklineSize, type ListTableSymbolType, type ListTableTagCellContent, type ListTableTheme, type ListTableTooltipAdapter, type ListTableTooltipRequest, type ListTableUiOptions, type ListTableValidationError, type ListTableValidationErrorField, type ListTableValidationFailure, type ListTableValidationTarget, type PaginationConfig, type RenderCellDescriptor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1412,6 +1412,12 @@ interface ListTablePaginationOptions {
|
|
|
1412
1412
|
interface ListTableRowSelectionRecordProps {
|
|
1413
1413
|
disabled?: boolean;
|
|
1414
1414
|
}
|
|
1415
|
+
/**
|
|
1416
|
+
* 行事件配置。
|
|
1417
|
+
*/
|
|
1418
|
+
interface ListTableRowEventProps {
|
|
1419
|
+
onClick?: (event: MouseEvent) => void;
|
|
1420
|
+
}
|
|
1415
1421
|
/**
|
|
1416
1422
|
* 行选择变更信息。
|
|
1417
1423
|
*/
|
|
@@ -1423,6 +1429,12 @@ interface ListTableRowSelectionChangeInfo {
|
|
|
1423
1429
|
*/
|
|
1424
1430
|
interface ListTableRowSelectionOptions<RecordType> {
|
|
1425
1431
|
type?: "checkbox" | "radio";
|
|
1432
|
+
/**
|
|
1433
|
+
* 点击普通表体区域时是否切换当前行选择状态。
|
|
1434
|
+
*
|
|
1435
|
+
* @default false
|
|
1436
|
+
*/
|
|
1437
|
+
selectRowByClick?: boolean;
|
|
1426
1438
|
selectedRowKeys?: Array<string | number>;
|
|
1427
1439
|
defaultSelectedRowKeys?: Array<string | number>;
|
|
1428
1440
|
fixed?: "left" | "right";
|
|
@@ -1507,6 +1519,8 @@ interface ListTableOptions<RecordType = Record<string, unknown>> {
|
|
|
1507
1519
|
height?: number | string;
|
|
1508
1520
|
columns: ListTableColumn<RecordType>[];
|
|
1509
1521
|
dataSource: RecordType[];
|
|
1522
|
+
/** AntD Table 风格的行事件配置。 */
|
|
1523
|
+
onRow?: (record: RecordType, rowIndex: number) => ListTableRowEventProps | null | undefined;
|
|
1510
1524
|
emptyText?: string;
|
|
1511
1525
|
theme?: Partial<ListTableTheme>;
|
|
1512
1526
|
/**
|
|
@@ -1682,4 +1696,4 @@ interface ListTableValidationTarget {
|
|
|
1682
1696
|
columnKey: string;
|
|
1683
1697
|
}
|
|
1684
1698
|
|
|
1685
|
-
export { type CreateCellEditorSessionParams, type DebugHitTestResult, type FilterPanelConfig, type FilterPanelOptionItem, type FilterPanelTexts, type FixedPopupConfig, type HeaderContextMenuColumnItem, type HeaderContextMenuConfig, type HeaderContextMenuDensity, ListTable, type ListTableAutoMergeRule, type ListTableBarcodeCellContent, type ListTableBarcodeFormat, type ListTableButtonCellContent, type ListTableButtonPopconfirmOptions, type ListTableButtonSize, type ListTableButtonType, type ListTableCarouselScrollOptions, type ListTableCellContent, type ListTableCellContentClickContext, type ListTableCellEditorSession, type ListTableCellSpan, type ListTableCellStyle, type ListTableChartCellContent, type ListTableChartSize, type ListTableChartType, type ListTableColorCellContent, type ListTableColumn, type ListTableContextMenuFeature, type ListTableContextMenuOptions, type ListTableCustomChartCellContent, type ListTableDangerConfirmRequest, type ListTableDataFormatType, type ListTableDebugOptions, type ListTableDebugSnapshot, type ListTableEditAutoCompleteEnter, type ListTableEditFilterOption, type ListTableEditOption, type ListTableEditValueType, type ListTableEditable, type ListTableEditorAutoCompleteEnter, type ListTableEditorConfig, type ListTableEditorFactory, type ListTableEditorFilterOption, type ListTableEditorNavigateDirection, type ListTableEditorOption, type ListTableEditorRect, type ListTableEditorRequest, type ListTableEditorTheme, type ListTableEditorValueType, type ListTableExportXlsxOptions, type ListTableFilterConditionOperator, type ListTableFilterConditionRelation, type ListTableFilterMatchMode, type ListTableFilterOption, type ListTableFilterOptionValue, type ListTableFilterPanelAdapter, type ListTableFilterState, type ListTableFilterType, type ListTableFilterValue$1 as ListTableFilterValue, type ListTableFixedPopupAdapter, type ListTableFormItemProps, type ListTableFormItemPropsConfig, type ListTableFormRule, type ListTableFormRules, type ListTableHeaderContextMenuAdapter, type ListTableHighlightMode, type ListTableHorizontalAlign, type ListTableIconCellContent, type ListTableImageCellContent, type ListTableImageObjectFit, type ListTableImagePreviewRequest, type ListTableLoadingAdapter, type ListTableLoadingRequest, type ListTableMergeCellOptions, type ListTableNestedTableCellContent, type ListTableNestedTableColumn, type ListTableOptions, type ListTablePaginationAdapter, type ListTablePaginationOptions, type ListTableProgressCellContent, type ListTableProgressShape, type ListTableProgressSize, type ListTableQrCodeCellContent, type ListTableQrCodeLevel, type ListTableQueryChange, type ListTableQueryChangeExtra, type ListTableQueryFilters, type ListTableQueryOptions, type ListTableQueryPagination, type ListTableQuerySorter, type ListTableRateCellContent, type ListTableRateSize, type ListTableRowDragMode, type ListTableRowDragOptions, type ListTableRowDragPayload, type ListTableRowDragSourceInfo, type ListTableRowDragZone, type ListTableRowSelectionChangeInfo, type ListTableRowSelectionOptions, type ListTableScrollToOptions, type ListTableScrollbarOptions, type ListTableSelectionState, type ListTableSortItem, type ListTableSortState, type ListTableSparklineChartCellContent, type ListTableSparklineSize, type ListTableSymbolType, type ListTableTagCellContent, type ListTableTheme, type ListTableTooltipAdapter, type ListTableTooltipRequest, type ListTableUiOptions, type ListTableValidationError, type ListTableValidationErrorField, type ListTableValidationFailure, type ListTableValidationTarget, type PaginationConfig, type RenderCellDescriptor };
|
|
1699
|
+
export { type CreateCellEditorSessionParams, type DebugHitTestResult, type FilterPanelConfig, type FilterPanelOptionItem, type FilterPanelTexts, type FixedPopupConfig, type HeaderContextMenuColumnItem, type HeaderContextMenuConfig, type HeaderContextMenuDensity, ListTable, type ListTableAutoMergeRule, type ListTableBarcodeCellContent, type ListTableBarcodeFormat, type ListTableButtonCellContent, type ListTableButtonPopconfirmOptions, type ListTableButtonSize, type ListTableButtonType, type ListTableCarouselScrollOptions, type ListTableCellContent, type ListTableCellContentClickContext, type ListTableCellEditorSession, type ListTableCellSpan, type ListTableCellStyle, type ListTableChartCellContent, type ListTableChartSize, type ListTableChartType, type ListTableColorCellContent, type ListTableColumn, type ListTableContextMenuFeature, type ListTableContextMenuOptions, type ListTableCustomChartCellContent, type ListTableDangerConfirmRequest, type ListTableDataFormatType, type ListTableDebugOptions, type ListTableDebugSnapshot, type ListTableEditAutoCompleteEnter, type ListTableEditFilterOption, type ListTableEditOption, type ListTableEditValueType, type ListTableEditable, type ListTableEditorAutoCompleteEnter, type ListTableEditorConfig, type ListTableEditorFactory, type ListTableEditorFilterOption, type ListTableEditorNavigateDirection, type ListTableEditorOption, type ListTableEditorRect, type ListTableEditorRequest, type ListTableEditorTheme, type ListTableEditorValueType, type ListTableExportXlsxOptions, type ListTableFilterConditionOperator, type ListTableFilterConditionRelation, type ListTableFilterMatchMode, type ListTableFilterOption, type ListTableFilterOptionValue, type ListTableFilterPanelAdapter, type ListTableFilterState, type ListTableFilterType, type ListTableFilterValue$1 as ListTableFilterValue, type ListTableFixedPopupAdapter, type ListTableFormItemProps, type ListTableFormItemPropsConfig, type ListTableFormRule, type ListTableFormRules, type ListTableHeaderContextMenuAdapter, type ListTableHighlightMode, type ListTableHorizontalAlign, type ListTableIconCellContent, type ListTableImageCellContent, type ListTableImageObjectFit, type ListTableImagePreviewRequest, type ListTableLoadingAdapter, type ListTableLoadingRequest, type ListTableMergeCellOptions, type ListTableNestedTableCellContent, type ListTableNestedTableColumn, type ListTableOptions, type ListTablePaginationAdapter, type ListTablePaginationOptions, type ListTableProgressCellContent, type ListTableProgressShape, type ListTableProgressSize, type ListTableQrCodeCellContent, type ListTableQrCodeLevel, type ListTableQueryChange, type ListTableQueryChangeExtra, type ListTableQueryFilters, type ListTableQueryOptions, type ListTableQueryPagination, type ListTableQuerySorter, type ListTableRateCellContent, type ListTableRateSize, type ListTableRowDragMode, type ListTableRowDragOptions, type ListTableRowDragPayload, type ListTableRowDragSourceInfo, type ListTableRowDragZone, type ListTableRowEventProps, type ListTableRowSelectionChangeInfo, type ListTableRowSelectionOptions, type ListTableScrollToOptions, type ListTableScrollbarOptions, type ListTableSelectionState, type ListTableSortItem, type ListTableSortState, type ListTableSparklineChartCellContent, type ListTableSparklineSize, type ListTableSymbolType, type ListTableTagCellContent, type ListTableTheme, type ListTableTooltipAdapter, type ListTableTooltipRequest, type ListTableUiOptions, type ListTableValidationError, type ListTableValidationErrorField, type ListTableValidationFailure, type ListTableValidationTarget, type PaginationConfig, type RenderCellDescriptor };
|
package/dist/index.js
CHANGED
|
@@ -13866,6 +13866,12 @@ var ListTableEventController = class {
|
|
|
13866
13866
|
this.host.suppressNextClick = false;
|
|
13867
13867
|
return;
|
|
13868
13868
|
}
|
|
13869
|
+
if ((result.area === "body" || result.area === "body-content") && typeof result.rowIndex === "number") {
|
|
13870
|
+
const record = this.host.getDisplayData()[result.rowIndex];
|
|
13871
|
+
if (record !== void 0) {
|
|
13872
|
+
this.host.options.onRow?.(record, result.rowIndex)?.onClick?.(event);
|
|
13873
|
+
}
|
|
13874
|
+
}
|
|
13869
13875
|
this.host.summarySelected = result.area === "summary";
|
|
13870
13876
|
if ((result.area === "header" || result.area === "header-selection" || result.area === "sort-trigger" || result.area === "filter-trigger" || result.area === "fixed-trigger" || event.shiftKey && result.area === "column-collapse-trigger") && result.columnKey) {
|
|
13871
13877
|
this.host.clearBodySelection();
|
|
@@ -13969,6 +13975,12 @@ var ListTableEventController = class {
|
|
|
13969
13975
|
}
|
|
13970
13976
|
return;
|
|
13971
13977
|
}
|
|
13978
|
+
if ((result.area === "body" || result.area === "body-content") && typeof result.rowIndex === "number" && this.host.options.rowSelection?.selectRowByClick && result.columnKey !== ROW_SELECTION_COLUMN_KEY && result.columnKey !== EXPAND_COLUMN_KEY) {
|
|
13979
|
+
const record = this.host.getDisplayData()[result.rowIndex];
|
|
13980
|
+
if (record !== void 0) {
|
|
13981
|
+
this.host.toggleRowSelection(record, result.rowIndex);
|
|
13982
|
+
}
|
|
13983
|
+
}
|
|
13972
13984
|
if (result.area === "body" && typeof result.rowIndex === "number" && this.host.options.expandable?.expandRowByClick && result.columnKey !== ROW_SELECTION_COLUMN_KEY && result.columnKey !== EXPAND_COLUMN_KEY && this.host.toggleRowExpand(result.rowIndex)) {
|
|
13973
13985
|
return;
|
|
13974
13986
|
}
|