@upbound/monarch-blocks 0.11.0 → 0.12.0
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/data-table.d.ts +33 -38
- package/dist/data-table.js +110 -86
- package/dist/data-table.js.map +1 -1
- package/dist/{empty-view-CjRwaITk.d.ts → empty-view--jBQ7evg.d.ts} +80 -8
- package/dist/graph.d.ts +5 -4
- package/dist/graph.js +52 -10
- package/dist/graph.js.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +121 -106
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/data-table.d.ts
CHANGED
|
@@ -1,26 +1,27 @@
|
|
|
1
1
|
import * as React$1 from 'react';
|
|
2
2
|
import { ReactNode, Dispatch, SetStateAction, ComponentType } from 'react';
|
|
3
|
-
import { RowData, ColumnFilter,
|
|
3
|
+
import { RowData, ColumnFilter, ColumnOrderState, CellContext, TableState, ExpandedState, ColumnFiltersState, PaginationState, SortingState, ColumnVisibilityState, ColumnPinningState, GroupingState, OnChangeFn, ColumnSizingState } from '@tanstack/react-table';
|
|
4
|
+
import { D as DataTableCellInstance, b as DataTableColumnInstance, j as DataTableRowInstance, a as DataTableColumnDef, e as DataTableFeatures, T as TableDataState, f as DataTableHeaderGroupInstance, i as DataTableOptions, d as DataTableEmptyView } from './empty-view--jBQ7evg.js';
|
|
5
|
+
export { c as DataTableEmptyConfig, g as DataTableHeaderInstance, h as DataTableInstance, k as dataTableFeatures, l as defaultEmptyConfig, m as defaultErrorConfig, n as defaultNoFilterFoundConfig } from './empty-view--jBQ7evg.js';
|
|
4
6
|
import { DropdownMenuItem } from '@upbound/monarch-core';
|
|
5
7
|
import { CelFilterSchema, CelFilterTree, CompileResult, CelRestrictedOptionSelectPayload } from './cel-filter-bar.js';
|
|
6
|
-
import
|
|
7
|
-
export { D as DataTableEmptyConfig, d as defaultEmptyConfig, b as defaultErrorConfig, c as defaultNoFilterFoundConfig } from './empty-view-CjRwaITk.js';
|
|
8
|
+
import '@tanstack/table-core';
|
|
8
9
|
|
|
9
10
|
/** A single entry (or nested submenu) in a cell's contextual right-click menu, alongside the built-in "Filter by this value" item. */
|
|
10
11
|
type ContextualMenuAction<TData extends RowData = RowData, TValue = unknown> = {
|
|
11
12
|
id: string;
|
|
12
13
|
label: React.ReactNode;
|
|
13
|
-
disabled?: boolean | ((cell:
|
|
14
|
-
onSelect?: (cell:
|
|
14
|
+
disabled?: boolean | ((cell: DataTableCellInstance<TData, TValue>) => boolean);
|
|
15
|
+
onSelect?: (cell: DataTableCellInstance<TData, TValue>) => void;
|
|
15
16
|
items?: ContextualMenuAction<TData, TValue>[];
|
|
16
17
|
className?: string;
|
|
17
18
|
};
|
|
18
19
|
type CellContextualFilterProps<TData extends RowData, TValue> = {
|
|
19
20
|
filter?: ColumnFilter;
|
|
20
21
|
globalSearch?: string;
|
|
21
|
-
cell:
|
|
22
|
-
onContextCell: (filter: ColumnFilter, cell:
|
|
23
|
-
onContextSearch?: (searchTerm: string, cell:
|
|
22
|
+
cell: DataTableCellInstance<TData, TValue>;
|
|
23
|
+
onContextCell: (filter: ColumnFilter, cell: DataTableCellInstance<TData, TValue>) => void;
|
|
24
|
+
onContextSearch?: (searchTerm: string, cell: DataTableCellInstance<TData, TValue>) => void;
|
|
24
25
|
contextualMenuActions?: ContextualMenuAction<TData, TValue>[];
|
|
25
26
|
};
|
|
26
27
|
/**
|
|
@@ -32,7 +33,7 @@ type CellContextualFilterProps<TData extends RowData, TValue> = {
|
|
|
32
33
|
declare function CellContextualFilter<TData extends RowData, TValue>({ filter, globalSearch, cell, onContextCell, onContextSearch, contextualMenuActions, }: CellContextualFilterProps<TData, TValue>): React$1.JSX.Element;
|
|
33
34
|
|
|
34
35
|
type ColumnOptionsProps<TData extends RowData> = {
|
|
35
|
-
columns:
|
|
36
|
+
columns: DataTableColumnInstance<TData, unknown>[];
|
|
36
37
|
columnOrdering: ColumnOrderState;
|
|
37
38
|
onColumnOrderingChange: React$1.Dispatch<React$1.SetStateAction<ColumnOrderState>>;
|
|
38
39
|
disableColumnOrdering?: boolean;
|
|
@@ -61,14 +62,14 @@ declare function RowActionItem({ variant, disabled, className, tooltip, children
|
|
|
61
62
|
onClick?: React$1.ComponentProps<typeof DropdownMenuItem>['onClick'];
|
|
62
63
|
}): React$1.JSX.Element;
|
|
63
64
|
/** A ready-made right-pinned, non-sortable/filterable/hideable "Actions" column. */
|
|
64
|
-
declare function getActionsColumnDefinition<TData extends RowData, TValue = unknown>({ cell, }: Pick<
|
|
65
|
+
declare function getActionsColumnDefinition<TData extends RowData, TValue = unknown>({ cell, }: Pick<DataTableColumnDef<TData, TValue>, 'cell'>): DataTableColumnDef<TData, TValue>;
|
|
65
66
|
declare function ExpandButton<TData extends RowData>({ row }: {
|
|
66
|
-
row:
|
|
67
|
+
row: DataTableRowInstance<TData>;
|
|
67
68
|
}): React$1.JSX.Element | null;
|
|
68
69
|
/** A ready-made right-pinned, fixed-width (28px) "Expand" column. Defaults to an `ExpandButton` cell. */
|
|
69
70
|
declare function getExpandColumnDefinition<TData extends RowData, TValue = unknown>(options?: {
|
|
70
|
-
cell?: (context: CellContext<TData, TValue>) => React$1.ReactNode;
|
|
71
|
-
}):
|
|
71
|
+
cell?: (context: CellContext<DataTableFeatures, TData, TValue>) => React$1.ReactNode;
|
|
72
|
+
}): DataTableColumnDef<TData, TValue>;
|
|
72
73
|
type DataTableValueCellProps = {
|
|
73
74
|
content?: React$1.ReactNode;
|
|
74
75
|
/** Shown as a tooltip; also becomes the link's native title when `href` is set. */
|
|
@@ -122,7 +123,7 @@ type DataTablePaginationProps = {
|
|
|
122
123
|
declare function DataTablePagination({ pageIndex, pageSize, rowCount, rowCountRelation, paginationConfig, onPageChange, onPageSizeChange, }: DataTablePaginationProps): React$1.JSX.Element;
|
|
123
124
|
|
|
124
125
|
declare function DataTableHeader<TData extends RowData>({ headerGroups, onAutosizeAll, onAutosizeColumn, onResetColumnSize, stickyHeader, layout, }: {
|
|
125
|
-
headerGroups:
|
|
126
|
+
headerGroups: DataTableHeaderGroupInstance<TData>[];
|
|
126
127
|
onAutosizeAll: () => void;
|
|
127
128
|
onAutosizeColumn: (columnId: string) => void;
|
|
128
129
|
/** Called when the user double-clicks the resize separator to reset a column to its default size. */
|
|
@@ -141,11 +142,11 @@ declare const DataTableRow: React$1.ForwardRefExoticComponent<React$1.HTMLAttrib
|
|
|
141
142
|
layout?: TableLayout;
|
|
142
143
|
} & React$1.RefAttributes<HTMLElement>>;
|
|
143
144
|
declare function DataTableCell<TData extends RowData, TValue>({ cell, className, showContextualFilter, onContextCell, onContextSearch, contextualMenuActions, layout, }: {
|
|
144
|
-
cell:
|
|
145
|
+
cell: DataTableCellInstance<TData, TValue>;
|
|
145
146
|
className?: string;
|
|
146
147
|
showContextualFilter?: boolean;
|
|
147
|
-
onContextCell?: (filter: ColumnFilter, cell:
|
|
148
|
-
onContextSearch?: (searchTerm: string, cell:
|
|
148
|
+
onContextCell?: (filter: ColumnFilter, cell: DataTableCellInstance<TData, TValue>) => void;
|
|
149
|
+
onContextSearch?: (searchTerm: string, cell: DataTableCellInstance<TData, TValue>) => void;
|
|
149
150
|
contextualMenuActions?: ContextualMenuAction<TData, TValue>[];
|
|
150
151
|
layout?: TableLayout;
|
|
151
152
|
}): React$1.JSX.Element;
|
|
@@ -173,16 +174,16 @@ declare function DataTableExpandedRow({ colSpan, show, children, layout, }: {
|
|
|
173
174
|
layout?: TableLayout;
|
|
174
175
|
}): React$1.JSX.Element | null;
|
|
175
176
|
declare function DataTableBody<TData extends RowData>({ tableRows, tableState, columns, skeletonRowCount, renderSkeletonCell, onRowRender, renderExpandedRow, showContextualFilter, onContextCell, onContextSearch, contextualMenuActions, layout, }: {
|
|
176
|
-
tableRows:
|
|
177
|
+
tableRows: DataTableRowInstance<TData>[];
|
|
177
178
|
tableState: TableDataState;
|
|
178
|
-
columns:
|
|
179
|
+
columns: DataTableColumnInstance<TData, unknown>[];
|
|
179
180
|
skeletonRowCount?: number;
|
|
180
181
|
renderSkeletonCell?: (columnId: string) => React$1.ReactNode | undefined;
|
|
181
|
-
onRowRender?: (row: TData, tableRow:
|
|
182
|
+
onRowRender?: (row: TData, tableRow: DataTableRowInstance<TData>) => DataTableRowProps;
|
|
182
183
|
renderExpandedRow?: (row: TData) => React$1.ReactNode;
|
|
183
184
|
showContextualFilter?: boolean;
|
|
184
|
-
onContextCell?: (filter: ColumnFilter, cell:
|
|
185
|
-
onContextSearch?: (searchTerm: string, cell:
|
|
185
|
+
onContextCell?: (filter: ColumnFilter, cell: DataTableCellInstance<TData, unknown>) => void;
|
|
186
|
+
onContextSearch?: (searchTerm: string, cell: DataTableCellInstance<TData, unknown>) => void;
|
|
186
187
|
contextualMenuActions?: ContextualMenuAction<TData, unknown>[];
|
|
187
188
|
layout?: TableLayout;
|
|
188
189
|
}): React$1.JSX.Element;
|
|
@@ -201,16 +202,10 @@ type StickyHeaderConfig = boolean | {
|
|
|
201
202
|
/** Assumed header-row height in px, used to stack multiple header groups. @default 48 */
|
|
202
203
|
rowHeight?: number;
|
|
203
204
|
};
|
|
204
|
-
/** The `
|
|
205
|
-
interface TableHookOptions<TData extends RowData> extends Omit<
|
|
205
|
+
/** The `useTable` config `DataTable` forwards. A near-exact `TableOptions` port — see the orchestrator's `config` merge for exactly which fields are honored. */
|
|
206
|
+
interface TableHookOptions<TData extends RowData> extends Omit<DataTableOptions<TData>, 'features' | 'state'> {
|
|
206
207
|
data: TData[];
|
|
207
|
-
state?: Partial<TableState
|
|
208
|
-
initialState?: InitialTableState;
|
|
209
|
-
sortingFns?: Record<string, SortingFn<TData>>;
|
|
210
|
-
filterFns?: Record<string, FilterFn<TData>>;
|
|
211
|
-
globalFilterFn?: FilterFn<TData>;
|
|
212
|
-
enableSortingRemoval?: boolean;
|
|
213
|
-
enablePagination?: boolean;
|
|
208
|
+
state?: Partial<TableState<DataTableFeatures>>;
|
|
214
209
|
rowCountRelation?: RowCountRelation;
|
|
215
210
|
}
|
|
216
211
|
/**
|
|
@@ -241,7 +236,7 @@ type DataTableCelFilterConfig<TData extends RowData> = {
|
|
|
241
236
|
onContextualFilter?: (payload: {
|
|
242
237
|
columnId: string;
|
|
243
238
|
values: string[];
|
|
244
|
-
cell:
|
|
239
|
+
cell: DataTableCellInstance<TData, unknown>;
|
|
245
240
|
}) => void;
|
|
246
241
|
/** Invoked when the user clicks a disabled CEL filter option. */
|
|
247
242
|
onRestrictedOptionSelect?: (payload: CelRestrictedOptionSelectPayload) => void;
|
|
@@ -275,7 +270,7 @@ interface DataTableProps<TData extends RowData> {
|
|
|
275
270
|
fitContent?: boolean;
|
|
276
271
|
serverSidePagination?: boolean;
|
|
277
272
|
/** Extra props for each body row. `tableRow` is the TanStack row — use `tableRow.depth` to style `getSubRows` sub-rows. */
|
|
278
|
-
onRowRender?(row: TData, tableRow:
|
|
273
|
+
onRowRender?(row: TData, tableRow: DataTableRowInstance<TData>): DataTableRowProps;
|
|
279
274
|
/**
|
|
280
275
|
* Renders full-width content under an expanded row. For expanded rows that line up with the
|
|
281
276
|
* table's columns, set `config.getSubRows` instead: sub-rows render through the same column
|
|
@@ -318,8 +313,8 @@ interface DataTableProps<TData extends RowData> {
|
|
|
318
313
|
onSortingChange?: Dispatch<SetStateAction<SortingState>>;
|
|
319
314
|
columnOrdering?: ColumnOrderState;
|
|
320
315
|
onColumnOrderingChange?: Dispatch<SetStateAction<ColumnOrderState>>;
|
|
321
|
-
columnVisibility?:
|
|
322
|
-
onColumnVisibilityChange?: Dispatch<SetStateAction<
|
|
316
|
+
columnVisibility?: ColumnVisibilityState;
|
|
317
|
+
onColumnVisibilityChange?: Dispatch<SetStateAction<ColumnVisibilityState>>;
|
|
323
318
|
columnPinning?: ColumnPinningState;
|
|
324
319
|
onColumnPinningChange?: Dispatch<SetStateAction<ColumnPinningState>>;
|
|
325
320
|
grouping?: GroupingState;
|
|
@@ -327,7 +322,7 @@ interface DataTableProps<TData extends RowData> {
|
|
|
327
322
|
/** Additional className applied to the CEL filter builder wrapper inside the filter bar. */
|
|
328
323
|
celFilterClassName?: string;
|
|
329
324
|
showContextualFilter?: boolean;
|
|
330
|
-
onContextCell?: (filter: ColumnFilter, cell:
|
|
325
|
+
onContextCell?: (filter: ColumnFilter, cell: DataTableCellInstance<TData, unknown>) => void;
|
|
331
326
|
contextualMenuActions?: ContextualMenuAction<TData, unknown>[];
|
|
332
327
|
/** Initial column sizing state. Seed from a sync adapter or other persistence source. */
|
|
333
328
|
initialColumnSizing?: ColumnSizingState;
|
|
@@ -372,7 +367,7 @@ interface DataTableProps<TData extends RowData> {
|
|
|
372
367
|
declare function DataTable<TData extends RowData>({ id, config, title, description, emptyView, showError, className, fitContent, loading, renderSkeletonCell, serverSidePagination, ActionsComponent: Actions, onRowRender, renderExpandedRow, expanded: parentExpanded, onExpandedChange: parentOnExpandedChange, disableSearch: deprecatedDisableSearch, search, disableFilters, disableSorting, paginationConfig, disableColumnReordering, disableColumnVisibility, disableColumnResizing, disableColumnPinning, searchTerm: parentGlobalFilter, onSearchTermChange: parentSetGlobalFilter, filters: parentColumnFilters, onFiltersChange: parentSetColumnFilters, pagination: parentPagination, onPaginationChange: parentSetPagination, sorting: parentSorting, onSortingChange: parentSetSorting, columnOrdering: parentColumnOrdering, onColumnOrderingChange: parentSetColumnOrdering, columnVisibility: parentColumnVisibility, onColumnVisibilityChange: parentSetColumnVisibility, columnPinning: parentColumnPinning, onColumnPinningChange: parentSetColumnPinning, grouping: parentGrouping, onGroupingChange: parentSetGrouping, celFilterClassName, showContextualFilter, onContextCell, contextualMenuActions, layout, initialColumnSizing, onColumnSizingPersist, stickyHeader, celFilterConfig, filterVisibility, }: DataTableProps<TData>): React$1.JSX.Element;
|
|
373
368
|
|
|
374
369
|
type ViewFilterProps<TData extends RowData> = {
|
|
375
|
-
columns:
|
|
370
|
+
columns: DataTableColumnInstance<TData, unknown>[];
|
|
376
371
|
columnFilters: ColumnFiltersState;
|
|
377
372
|
onColumnFiltersChange: React$1.Dispatch<React$1.SetStateAction<ColumnFiltersState>>;
|
|
378
373
|
className?: string;
|
|
@@ -389,5 +384,5 @@ type ViewFilterProps<TData extends RowData> = {
|
|
|
389
384
|
*/
|
|
390
385
|
declare function ViewFilter<TData extends RowData>({ columns, columnFilters, onColumnFiltersChange, className, }: ViewFilterProps<TData>): React$1.JSX.Element;
|
|
391
386
|
|
|
392
|
-
export { CellContextualFilter, ColumnOptions, DataTable, DataTableBody, DataTableCell, DataTableEmptyView, DataTableExpandedRow, DataTableGroupRow, DataTableHeader, DataTablePagination, DataTableRow, DataTableSkeletonBody, DataTableValueCell, ExpandButton, RowActionItem, RowActions, TimestampCell, ViewFilter, getActionsColumnDefinition, getExpandColumnDefinition, normalizePageSizeOptions };
|
|
387
|
+
export { CellContextualFilter, ColumnOptions, DataTable, DataTableBody, DataTableCell, DataTableCellInstance, DataTableColumnDef, DataTableColumnInstance, DataTableEmptyView, DataTableExpandedRow, DataTableFeatures, DataTableGroupRow, DataTableHeader, DataTableHeaderGroupInstance, DataTableOptions, DataTablePagination, DataTableRow, DataTableRowInstance, DataTableSkeletonBody, DataTableValueCell, ExpandButton, RowActionItem, RowActions, TimestampCell, ViewFilter, getActionsColumnDefinition, getExpandColumnDefinition, normalizePageSizeOptions };
|
|
393
388
|
export type { CellContextualFilterProps, ColumnOptionsProps, ContextualMenuAction, DataTableCelFilterConfig, DataTableFilterVisibilityConfig, DataTablePaginationConfig, DataTablePaginationProps, DataTableProps, DataTableRowProps, DataTableSearchConfig, DataTableValueCellProps, RowCountRelation, StickyHeaderConfig, TableHookOptions, TableLayout, ViewFilterProps };
|