@lensui/lens-table 0.1.4 → 0.1.6
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 +46 -61
- package/dist/index.cjs +764 -170
- package/dist/index.css +362 -31
- package/dist/index.d.cts +39 -33
- package/dist/index.d.ts +39 -33
- package/dist/index.js +764 -170
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -36,6 +36,7 @@ interface TableLabels {
|
|
|
36
36
|
sortDesc: string;
|
|
37
37
|
sortBoth: string;
|
|
38
38
|
dragColumn: string;
|
|
39
|
+
revealSelectedCell: string;
|
|
39
40
|
previousYear: string;
|
|
40
41
|
nextYear: string;
|
|
41
42
|
previousMonth: string;
|
|
@@ -218,6 +219,22 @@ interface GridSelection extends GridCellPosition {
|
|
|
218
219
|
rowKey: GridKey;
|
|
219
220
|
columnKey: string;
|
|
220
221
|
}
|
|
222
|
+
/** Cell locator accepted by controlled and default selection props. */
|
|
223
|
+
type GridSelectionTarget = {
|
|
224
|
+
columnKey: string;
|
|
225
|
+
rowKey: GridKey;
|
|
226
|
+
rowIndex?: number;
|
|
227
|
+
columnIndex?: number;
|
|
228
|
+
} | {
|
|
229
|
+
columnKey: string;
|
|
230
|
+
rowIndex: number;
|
|
231
|
+
rowKey?: GridKey;
|
|
232
|
+
columnIndex?: number;
|
|
233
|
+
};
|
|
234
|
+
/** Fully resolved selected cell returned by onSelectedCellChange. */
|
|
235
|
+
interface SelectedCellChange extends GridSelection {
|
|
236
|
+
value: unknown;
|
|
237
|
+
}
|
|
221
238
|
/** Fired after a cell editor commits a value. */
|
|
222
239
|
interface CellChange<Row> extends GridSelection {
|
|
223
240
|
value: unknown;
|
|
@@ -270,24 +287,6 @@ interface TableContextMenuConfig<Row> {
|
|
|
270
287
|
range?: ContextMenuSection<Row, RangeContextMenuBuiltin, RangeContextMenuContext<Row>>;
|
|
271
288
|
}
|
|
272
289
|
type TableContextMenu<Row> = boolean | TableContextMenuConfig<Row>;
|
|
273
|
-
/** Payload for inserting one or more rows around a target row. */
|
|
274
|
-
interface InsertRowsEvent<Row> {
|
|
275
|
-
rowIndex: number;
|
|
276
|
-
row: Row;
|
|
277
|
-
position: 'before' | 'after';
|
|
278
|
-
count: number;
|
|
279
|
-
/** Rows created by the grid for the optimistic visible insert. Consumers can persist these directly. */
|
|
280
|
-
insertedRows?: Row[];
|
|
281
|
-
}
|
|
282
|
-
/** Payload for deleting the selected rows. */
|
|
283
|
-
interface DeleteRowsEvent<Row> {
|
|
284
|
-
rows: Array<{
|
|
285
|
-
rowIndex: number;
|
|
286
|
-
row: Row;
|
|
287
|
-
}>;
|
|
288
|
-
/** Current rendered viewport, including virtual overscan. Useful for fast optimistic updates before rebuilding large datasets. */
|
|
289
|
-
viewportRange?: ViewportRange;
|
|
290
|
-
}
|
|
291
290
|
/**
|
|
292
291
|
* Public props for Table.
|
|
293
292
|
*
|
|
@@ -333,22 +332,24 @@ interface TableProps<Row extends object> {
|
|
|
333
332
|
summary?: TableSummaryConfig;
|
|
334
333
|
/** Show an automatically generated row number column on the left. */
|
|
335
334
|
rowNumber?: boolean;
|
|
336
|
-
selectedCell?:
|
|
337
|
-
defaultSelectedCell?:
|
|
338
|
-
onSelectedCellChange?: (selection:
|
|
335
|
+
selectedCell?: GridSelectionTarget | null;
|
|
336
|
+
defaultSelectedCell?: GridSelectionTarget | null;
|
|
337
|
+
onSelectedCellChange?: (selection: SelectedCellChange | null) => void;
|
|
339
338
|
/** Enable spreadsheet-style mouse drag selection across multiple body cells. Defaults to false. */
|
|
340
339
|
rangeSelection?: boolean;
|
|
341
340
|
rowSelection?: boolean | AxisSelectionConfig;
|
|
342
341
|
selectedRowKeys?: GridKey[];
|
|
343
342
|
defaultSelectedRowKeys?: GridKey[];
|
|
344
|
-
|
|
343
|
+
onSelectedRowChange?: (keys: GridKey[], rows: Row[], indices: number[]) => void;
|
|
345
344
|
columnSelection?: boolean | AxisSelectionConfig;
|
|
346
345
|
selectedColumnKeys?: string[];
|
|
347
346
|
defaultSelectedColumnKeys?: string[];
|
|
348
|
-
|
|
347
|
+
onSelectedColumnChange?: (keys: string[]) => void;
|
|
349
348
|
columnDraggable?: boolean;
|
|
350
349
|
columnResizable?: boolean;
|
|
351
|
-
|
|
350
|
+
onColumnsReorder?: (columns: GridColumn<Row>[], detail: {
|
|
351
|
+
sourceIndex: number;
|
|
352
|
+
targetIndex: number;
|
|
352
353
|
type: 'column' | 'group';
|
|
353
354
|
sourceKey: string;
|
|
354
355
|
targetKey: string;
|
|
@@ -357,13 +358,18 @@ interface TableProps<Row extends object> {
|
|
|
357
358
|
}) => void;
|
|
358
359
|
onColumnResize?: (columnKey: string, width: number) => void;
|
|
359
360
|
rowDraggable?: boolean;
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
361
|
+
onRowsReorder?: (rows: Row[], detail: {
|
|
362
|
+
sourceIndex: number;
|
|
363
|
+
targetIndex: number;
|
|
364
|
+
}) => void;
|
|
365
|
+
/** Receives the complete rows array and the rows added by the built-in insert operation. */
|
|
366
|
+
onInsertRows?: (rows: Row[], insertedRows: Row[]) => void | Promise<void>;
|
|
367
|
+
/** Receives the complete rows array and the rows removed by the built-in delete operation. */
|
|
368
|
+
onDeleteRows?: (rows: Row[], deletedRows: Row[]) => void | Promise<void>;
|
|
369
|
+
/** Overrides the built-in value sorting. Return rows ordered for the internally managed sort state. */
|
|
370
|
+
onSortChange?: (rows: Row[], state: GridSortState) => Row[];
|
|
371
|
+
/** Overrides the built-in text filtering. Return the rows that match the internally managed filter values. */
|
|
372
|
+
onFilterChange?: (rows: Row[], values: Readonly<Record<string, string>>) => Row[];
|
|
367
373
|
onCellChange?: (change: CellChange<Row>) => void | Promise<void>;
|
|
368
374
|
onCellContextMenu?: (event: ContextMenuEvent<Row>) => void;
|
|
369
375
|
/** true uses the built-in menu, false disables custom menus, object customizes menu content and order. */
|
|
@@ -380,7 +386,7 @@ interface ViewportRange {
|
|
|
380
386
|
columnEnd: number;
|
|
381
387
|
}
|
|
382
388
|
|
|
383
|
-
declare function Table<Row extends object>({ columns:
|
|
389
|
+
declare function Table<Row extends object>({ columns: columnProps, rows: sourceRows, rowKey, width, height, autoHeight, layout, rowHeight: rowHeightProp, headerHeight: headerHeightProp, fixedHeader, locale, borderless, verticalBorderless, striped, highlight, cellSpans, loading, loadingContent, virtualized, tooltip, summary, rowNumber, selectedCell, defaultSelectedCell, onSelectedCellChange, rangeSelection, rowSelection, selectedRowKeys, defaultSelectedRowKeys, onSelectedRowChange, columnSelection, selectedColumnKeys, defaultSelectedColumnKeys, onSelectedColumnChange, columnDraggable, columnResizable, onColumnsReorder, onColumnResize, rowDraggable, onRowsReorder, onInsertRows, onDeleteRows, onSortChange, onFilterChange, onCellChange, onCellContextMenu, contextMenu: contextMenuConfig, emptyContent, className, style, ariaLabel, }: TableProps<Row>): react.JSX.Element;
|
|
384
390
|
|
|
385
391
|
type LayoutColumn<Row> = GridColumn<Row> & {
|
|
386
392
|
rowSelection?: boolean;
|
|
@@ -427,4 +433,4 @@ declare function hitTestColumn(metrics: ColumnMetric[], contentX: number): numbe
|
|
|
427
433
|
|
|
428
434
|
type TableFilterValues = Record<string, string>;
|
|
429
435
|
|
|
430
|
-
export { type AxisSelectionConfig, type CellChange, type ContextMenuEvent, type
|
|
436
|
+
export { type AxisSelectionConfig, type CellChange, type ContextMenuEvent, type GridCellPosition, type GridColumn, type GridKey, type GridSelection, type GridSelectionTarget, type GridSortState, type SelectedCellChange, type SelectionMode, type SortDirection, Table, type CellChange as TableCellChange, type GridCellPosition as TableCellPosition, type TableCellSpan, type TableCellSpanRule, type TableCellSpanRuleContext, type TableCellSpans, type GridColumn as TableColumn, type TableContextMenu, type TableContextMenuConfig, type ContextMenuEvent as TableContextMenuEvent, type GridSelection as TableEditingCell, type TableFilterValues, type TableHighlightConfig, type GridKey as TableKey, type TableLabels, type TableLayoutConfig, type TableLocaleCode, type TableLocaleConfig, type TableProps, type TableResolvedCellSpan, type GridSortState as TableSorter, type TableSummaryConfig, type TableTooltipConfig, type ViewportRange as TableViewportRange, type TableVirtualizedConfig, Table as VelocityGrid, type TableCellSpan as VelocityGridCellSpan, type TableCellSpanRule as VelocityGridCellSpanRule, type TableCellSpanRuleContext as VelocityGridCellSpanRuleContext, type TableCellSpans as VelocityGridCellSpans, type TableContextMenu as VelocityGridContextMenu, type TableContextMenuConfig as VelocityGridContextMenuConfig, type TableHighlightConfig as VelocityGridHighlightConfig, type TableLabels as VelocityGridLabels, type TableLayoutConfig as VelocityGridLayoutConfig, type TableLocaleCode as VelocityGridLocaleCode, type TableLocaleConfig as VelocityGridLocaleConfig, type TableProps as VelocityGridProps, type TableResolvedCellSpan as VelocityGridResolvedCellSpan, type TableSummaryConfig as VelocityGridSummaryConfig, type TableTooltipConfig as VelocityGridTooltipConfig, type TableVirtualizedConfig as VelocityGridVirtualizedConfig, type ViewportRange, buildColumnMetrics, getViewportRange, hitTestColumn };
|