@upbound/monarch-blocks 0.1.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/LICENSE +21 -0
- package/README.md +58 -0
- package/dist/cel-filter-bar.d.ts +187 -0
- package/dist/cel-filter-bar.js +1850 -0
- package/dist/cel-filter-bar.js.map +1 -0
- package/dist/chart.d.ts +52 -0
- package/dist/chart.js +332 -0
- package/dist/chart.js.map +1 -0
- package/dist/chat-interface.d.ts +143 -0
- package/dist/chat-interface.js +676 -0
- package/dist/chat-interface.js.map +1 -0
- package/dist/code-block.d.ts +21 -0
- package/dist/code-block.js +201 -0
- package/dist/code-block.js.map +1 -0
- package/dist/data-table.d.ts +505 -0
- package/dist/data-table.js +4725 -0
- package/dist/data-table.js.map +1 -0
- package/dist/filter-bar.d.ts +80 -0
- package/dist/filter-bar.js +590 -0
- package/dist/filter-bar.js.map +1 -0
- package/dist/floating-widget.d.ts +36 -0
- package/dist/floating-widget.js +218 -0
- package/dist/floating-widget.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.js +6217 -0
- package/dist/index.js.map +1 -0
- package/dist/page-header.d.ts +12 -0
- package/dist/page-header.js +120 -0
- package/dist/page-header.js.map +1 -0
- package/dist/relative-time.d.ts +60 -0
- package/dist/relative-time.js +328 -0
- package/dist/relative-time.js.map +1 -0
- package/dist/section-header.d.ts +11 -0
- package/dist/section-header.js +123 -0
- package/dist/section-header.js.map +1 -0
- package/dist/section-nav.d.ts +50 -0
- package/dist/section-nav.js +143 -0
- package/dist/section-nav.js.map +1 -0
- package/dist/timeline.d.ts +8 -0
- package/dist/timeline.js +95 -0
- package/dist/timeline.js.map +1 -0
- package/dist/types-BULiU2qC.d.ts +170 -0
- package/package.json +58 -0
|
@@ -0,0 +1,505 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { RowData, ColumnFilter, Cell, Column, ColumnOrderState, Row, ColumnDef, CellContext, HeaderGroup, TableOptions, TableState, InitialTableState, SortingFn, FilterFn, ExpandedState, ColumnFiltersState, PaginationState, SortingState, VisibilityState, ColumnPinningState, GroupingState, OnChangeFn, ColumnSizingState } from '@tanstack/react-table';
|
|
3
|
+
import * as React$1 from 'react';
|
|
4
|
+
import { ReactNode, Dispatch, SetStateAction, ComponentType } from 'react';
|
|
5
|
+
import { f as CelFilterSchema, g as CelFilterTree, k as CompileResult, i as CelRestrictedOptionSelectPayload } from './types-BULiU2qC.js';
|
|
6
|
+
import { IconName } from '@upbound/monarch-core';
|
|
7
|
+
|
|
8
|
+
/** A single entry (or nested submenu) in a cell's contextual right-click menu, alongside the built-in "Filter by this value" item. */
|
|
9
|
+
type ContextualMenuAction<TData extends RowData = RowData, TValue = unknown> = {
|
|
10
|
+
id: string;
|
|
11
|
+
label: React.ReactNode;
|
|
12
|
+
disabled?: boolean | ((cell: Cell<TData, TValue>) => boolean);
|
|
13
|
+
onSelect?: (cell: Cell<TData, TValue>) => void;
|
|
14
|
+
items?: ContextualMenuAction<TData, TValue>[];
|
|
15
|
+
className?: string;
|
|
16
|
+
};
|
|
17
|
+
type CellContextualFilterProps<TData extends RowData, TValue> = {
|
|
18
|
+
filter?: ColumnFilter;
|
|
19
|
+
globalSearch?: string;
|
|
20
|
+
cell: Cell<TData, TValue>;
|
|
21
|
+
onContextCell: (filter: ColumnFilter, cell: Cell<TData, TValue>) => void;
|
|
22
|
+
onContextSearch?: (searchTerm: string, cell: Cell<TData, TValue>) => void;
|
|
23
|
+
contextualMenuActions?: ContextualMenuAction<TData, TValue>[];
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The right-click cell menu content: an always-present "Filter by this value"
|
|
27
|
+
* item (disabled, never hidden, when nothing is derivable) plus any
|
|
28
|
+
* `contextualMenuActions`. Renders only the `ContextMenuContent` — the
|
|
29
|
+
* `ContextMenu`/`ContextMenuTrigger` wrapping the cell lives in the caller.
|
|
30
|
+
*/
|
|
31
|
+
declare function CellContextualFilter<TData extends RowData, TValue>({ filter, globalSearch, cell, onContextCell, onContextSearch, contextualMenuActions, }: CellContextualFilterProps<TData, TValue>): react_jsx_runtime.JSX.Element;
|
|
32
|
+
|
|
33
|
+
type ColumnOptionsProps<TData extends RowData> = {
|
|
34
|
+
columns: Column<TData, unknown>[];
|
|
35
|
+
columnOrdering: ColumnOrderState;
|
|
36
|
+
onColumnOrderingChange: React$1.Dispatch<React$1.SetStateAction<ColumnOrderState>>;
|
|
37
|
+
disableColumnOrdering?: boolean;
|
|
38
|
+
};
|
|
39
|
+
/**
|
|
40
|
+
* The "Columns" dropdown: per-column visibility toggle + native HTML5
|
|
41
|
+
* drag-and-drop reordering (the source uses the browser's own drag/drop API,
|
|
42
|
+
* not a DnD library). Pinned/actions/filter-only columns are excluded from
|
|
43
|
+
* dragging and from the draggable list respectively; reordering only ever
|
|
44
|
+
* touches the unpinned slots (`mergeUnpinnedColumnOrder`), so pinned columns
|
|
45
|
+
* never jump position.
|
|
46
|
+
*/
|
|
47
|
+
declare function ColumnOptions<TData extends RowData>({ columns: rawColumns, columnOrdering, onColumnOrderingChange, disableColumnOrdering, }: ColumnOptionsProps<TData>): react_jsx_runtime.JSX.Element;
|
|
48
|
+
|
|
49
|
+
declare function RowActions({ align, children, contentClassName, }: {
|
|
50
|
+
align?: 'start' | 'end';
|
|
51
|
+
children: React$1.ReactNode;
|
|
52
|
+
contentClassName?: string;
|
|
53
|
+
}): react_jsx_runtime.JSX.Element;
|
|
54
|
+
declare function RowActionItem({ disabled, className, tooltip, children, onClick, }: {
|
|
55
|
+
disabled?: boolean;
|
|
56
|
+
className?: string;
|
|
57
|
+
tooltip?: string;
|
|
58
|
+
children: React$1.ReactNode;
|
|
59
|
+
onClick?: () => void;
|
|
60
|
+
}): react_jsx_runtime.JSX.Element;
|
|
61
|
+
/** A ready-made right-pinned, non-sortable/filterable/hideable "Actions" column. */
|
|
62
|
+
declare function getActionsColumnDefinition<TData extends RowData, TValue = unknown>({ cell, }: Pick<ColumnDef<TData, TValue>, 'cell'>): ColumnDef<TData, TValue>;
|
|
63
|
+
declare function ExpandButton<TData extends RowData>({ row }: {
|
|
64
|
+
row: Row<TData>;
|
|
65
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
66
|
+
/** A ready-made right-pinned, fixed-width (28px) "Expand" column. Defaults to an `ExpandButton` cell. */
|
|
67
|
+
declare function getExpandColumnDefinition<TData extends RowData, TValue = unknown>(options?: {
|
|
68
|
+
cell?: (context: CellContext<TData, TValue>) => React$1.ReactNode;
|
|
69
|
+
}): ColumnDef<TData, TValue>;
|
|
70
|
+
type DataTableValueCellProps = {
|
|
71
|
+
content?: React$1.ReactNode;
|
|
72
|
+
/** Shown as a tooltip; also becomes the link's native title when `href` is set. */
|
|
73
|
+
title?: string;
|
|
74
|
+
className?: string;
|
|
75
|
+
href?: string;
|
|
76
|
+
onClick?: () => void;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* A generic cell renderer: a link (when `href` is set), a dashed-underline
|
|
80
|
+
* value with a hover tooltip (when `title` is set), or plain content — with
|
|
81
|
+
* an em-dash placeholder when `content` is empty. Legacy injected its router
|
|
82
|
+
* `Link` via a DI hook (`useLink()`); Monarch has no such layer, so the link
|
|
83
|
+
* branch renders a plain `<a>`.
|
|
84
|
+
*/
|
|
85
|
+
declare function DataTableValueCell({ content, title, className, href, onClick }: DataTableValueCellProps): react_jsx_runtime.JSX.Element;
|
|
86
|
+
/** A timestamp cell — relative time in the cell, absolute time on hover (via Monarch's `RelativeTime`); an em-dash when absent. */
|
|
87
|
+
declare function TimestampCell({ timestamp }: {
|
|
88
|
+
timestamp?: Date | string | number;
|
|
89
|
+
}): react_jsx_runtime.JSX.Element;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Non-CEL column filter definitions — the `meta.filter` vocabulary consumed by
|
|
93
|
+
* contextual (right-click cell) filtering and by the plain filter bar.
|
|
94
|
+
* Mirrors TableWrapper's `Filters/types.ts` shapes; `id` is omitted here since
|
|
95
|
+
* it comes from the owning `ColumnDef.id`, not the filter definition itself.
|
|
96
|
+
*/
|
|
97
|
+
type ColumnFilterType = 'checkbox' | 'radio' | 'dateRange' | 'scrollableCheckbox' | 'scrollableRadio' | 'text' | 'multiText';
|
|
98
|
+
type ColumnFilterOption = {
|
|
99
|
+
label: string;
|
|
100
|
+
value: string;
|
|
101
|
+
disabled?: boolean;
|
|
102
|
+
children?: ColumnFilterOption[];
|
|
103
|
+
};
|
|
104
|
+
type FetchColumnFilterOptionsArgs = {
|
|
105
|
+
query: string;
|
|
106
|
+
page: number;
|
|
107
|
+
signal: AbortSignal;
|
|
108
|
+
};
|
|
109
|
+
type FetchColumnFilterOptionsResult = {
|
|
110
|
+
items: ColumnFilterOption[];
|
|
111
|
+
hasMore: boolean;
|
|
112
|
+
};
|
|
113
|
+
type FetchColumnFilterOptions = (args: FetchColumnFilterOptionsArgs) => Promise<FetchColumnFilterOptionsResult>;
|
|
114
|
+
type ColumnFilterBase = {
|
|
115
|
+
title: string;
|
|
116
|
+
type: ColumnFilterType;
|
|
117
|
+
order?: number;
|
|
118
|
+
};
|
|
119
|
+
type StaticCheckboxColumnFilter = ColumnFilterBase & {
|
|
120
|
+
type: 'checkbox' | 'scrollableCheckbox';
|
|
121
|
+
options: string[] | ColumnFilterOption[];
|
|
122
|
+
fetchFilterOptions?: never;
|
|
123
|
+
};
|
|
124
|
+
type AsyncCheckboxColumnFilter = ColumnFilterBase & {
|
|
125
|
+
type: 'checkbox' | 'scrollableCheckbox';
|
|
126
|
+
fetchFilterOptions: FetchColumnFilterOptions;
|
|
127
|
+
options?: never;
|
|
128
|
+
};
|
|
129
|
+
type CheckboxColumnFilter = StaticCheckboxColumnFilter | AsyncCheckboxColumnFilter;
|
|
130
|
+
type RadioColumnFilter = ColumnFilterBase & {
|
|
131
|
+
type: 'radio' | 'scrollableRadio';
|
|
132
|
+
options: string[] | ColumnFilterOption[];
|
|
133
|
+
};
|
|
134
|
+
type DateRangeColumnFilter = ColumnFilterBase & {
|
|
135
|
+
type: 'dateRange';
|
|
136
|
+
/** When true, always show time inputs. When false, never show them. When omitted, auto-detect from value. */
|
|
137
|
+
includeTime?: boolean;
|
|
138
|
+
};
|
|
139
|
+
type TextColumnFilter = ColumnFilterBase & {
|
|
140
|
+
type: 'text';
|
|
141
|
+
placeholder?: string;
|
|
142
|
+
};
|
|
143
|
+
type MultiTextColumnFilter = ColumnFilterBase & {
|
|
144
|
+
type: 'multiText';
|
|
145
|
+
/** Defaults to comma (`,`) when omitted. */
|
|
146
|
+
delimiter?: string;
|
|
147
|
+
description?: string;
|
|
148
|
+
placeholder?: string;
|
|
149
|
+
};
|
|
150
|
+
type ColumnFilterDefinition = CheckboxColumnFilter | DateRangeColumnFilter | RadioColumnFilter | TextColumnFilter | MultiTextColumnFilter;
|
|
151
|
+
type CheckboxColumnFilterValue = string[] | undefined;
|
|
152
|
+
type RadioColumnFilterValue = string | undefined;
|
|
153
|
+
type DateRangeColumnFilterValue = {
|
|
154
|
+
startDate: Date | null;
|
|
155
|
+
endDate: Date | null;
|
|
156
|
+
} | undefined;
|
|
157
|
+
type TextColumnFilterValue = string | undefined;
|
|
158
|
+
type MultiTextColumnFilterValue = string[] | undefined;
|
|
159
|
+
type ColumnFilterValue = CheckboxColumnFilterValue | RadioColumnFilterValue | DateRangeColumnFilterValue | TextColumnFilterValue | MultiTextColumnFilterValue;
|
|
160
|
+
|
|
161
|
+
/** Derives a contextual (right-click cell) column-filter value from a cell. */
|
|
162
|
+
type ContextualFilterValueParser<TData extends RowData, TValue> = (cell: Cell<TData, TValue>) => ColumnFilterValue | undefined;
|
|
163
|
+
/** Derives a contextual (right-click cell) global-search term from a cell. */
|
|
164
|
+
type ContextualGlobalSearchValueParser<TData extends RowData, TValue> = (cell: Cell<TData, TValue>) => string | undefined;
|
|
165
|
+
/** A fixed-width grid track: sizes to content or an explicit CSS length. */
|
|
166
|
+
type GridColumnFixed = {
|
|
167
|
+
fixed: string;
|
|
168
|
+
flex?: never;
|
|
169
|
+
};
|
|
170
|
+
type GridColumnFlexContentMin = {
|
|
171
|
+
min: 'max-content' | 'min-content';
|
|
172
|
+
minCap?: string;
|
|
173
|
+
};
|
|
174
|
+
type GridColumnFlexFixedMin = {
|
|
175
|
+
min?: string;
|
|
176
|
+
minCap?: never;
|
|
177
|
+
};
|
|
178
|
+
/** A proportional grid track: shares space by weight, with optional min/max. */
|
|
179
|
+
type GridColumnFlex = {
|
|
180
|
+
flex: number;
|
|
181
|
+
max?: string;
|
|
182
|
+
fixed?: never;
|
|
183
|
+
} & (GridColumnFlexContentMin | GridColumnFlexFixedMin);
|
|
184
|
+
/**
|
|
185
|
+
* Column sizing for grid layout mode.
|
|
186
|
+
*
|
|
187
|
+
* Fixed column (sizes to content or explicit value):
|
|
188
|
+
* { fixed: 'max-content' }
|
|
189
|
+
* { fixed: '200px' }
|
|
190
|
+
*
|
|
191
|
+
* Proportional column (shares space by weight, with optional min/max):
|
|
192
|
+
* { flex: 2, min: '100px' }
|
|
193
|
+
* { flex: 0.5, min: 'max-content' }
|
|
194
|
+
* { flex: 0.5, min: 'max-content', minCap: '200px' }
|
|
195
|
+
* { flex: 1, min: '80px', max: '500px' }
|
|
196
|
+
*/
|
|
197
|
+
type GridColumnSizing = GridColumnFixed | GridColumnFlex;
|
|
198
|
+
/**
|
|
199
|
+
* Column-def metadata `DataTable` reads — a straight port of TableWrapper's
|
|
200
|
+
* `ColumnMeta` module augmentation. Import this file for its side effect
|
|
201
|
+
* (`import '@/lib/data-table/table-meta'`) wherever a `ColumnDef` is authored
|
|
202
|
+
* with any of these fields.
|
|
203
|
+
*/
|
|
204
|
+
declare module '@tanstack/react-table' {
|
|
205
|
+
interface ColumnMeta<TData extends RowData, TValue> {
|
|
206
|
+
/** Pins the column left or right. Pinned columns are excluded from column reordering. */
|
|
207
|
+
pinning?: 'left' | 'right';
|
|
208
|
+
/** Marks an actions column — hides its header label and excludes it from contextual filtering. */
|
|
209
|
+
actions?: boolean;
|
|
210
|
+
/** The column's non-CEL filter definition, read by the plain filter bar and contextual filtering. */
|
|
211
|
+
filter?: ColumnFilterDefinition;
|
|
212
|
+
/** Parses a cell into a filter value for contextual (right-click) cell filtering. */
|
|
213
|
+
contextualFilterValue?: ContextualFilterValueParser<TData, TValue>;
|
|
214
|
+
/** Parses a cell into a search term for contextual (right-click) global search. */
|
|
215
|
+
contextualGlobalSearchValue?: ContextualGlobalSearchValueParser<TData, TValue>;
|
|
216
|
+
/** When true, the column is used only for filtering and is never rendered in the table. */
|
|
217
|
+
filterOnly?: boolean;
|
|
218
|
+
/** Column sizing for `layout="grid"` mode — see `GridColumnSizing`. */
|
|
219
|
+
grid?: GridColumnSizing;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
type TableDataState = 'empty' | 'loading' | 'error' | 'success';
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Monarch-native equivalent of TableWrapper's `EmptyConfig` — same four
|
|
227
|
+
* states (error / empty / filtered-empty), rebuilt on Monarch's `Empty`
|
|
228
|
+
* compound API instead of a single props-driven component. Two deliberate
|
|
229
|
+
* adaptations: `icon` takes a Monarch `IconName` (no FontAwesome dependency),
|
|
230
|
+
* and `action` is a rendered node rather than a `ComponentType` reference.
|
|
231
|
+
* `details` has no native `Empty` slot — it composes `Alert` instead.
|
|
232
|
+
*/
|
|
233
|
+
type DataTableEmptyConfig = {
|
|
234
|
+
icon?: IconName;
|
|
235
|
+
header?: React$1.ReactNode;
|
|
236
|
+
subheader?: React$1.ReactNode;
|
|
237
|
+
details?: React$1.ReactNode;
|
|
238
|
+
action?: React$1.ReactNode;
|
|
239
|
+
className?: string;
|
|
240
|
+
wrapperClassName?: string;
|
|
241
|
+
};
|
|
242
|
+
declare const defaultErrorConfig: DataTableEmptyConfig;
|
|
243
|
+
declare const defaultEmptyConfig: DataTableEmptyConfig;
|
|
244
|
+
declare const defaultNoFilterFoundConfig: DataTableEmptyConfig;
|
|
245
|
+
type DataTableEmptyView = {
|
|
246
|
+
empty?: DataTableEmptyConfig;
|
|
247
|
+
error?: DataTableEmptyConfig;
|
|
248
|
+
filter?: DataTableEmptyConfig;
|
|
249
|
+
};
|
|
250
|
+
declare function DataTableEmptyView({ emptyView, tableState, filterCount, resetFilters, className, }: {
|
|
251
|
+
emptyView?: DataTableEmptyView;
|
|
252
|
+
/** `'success'`/`'loading'` render nothing here — the table body handles those. */
|
|
253
|
+
tableState: TableDataState;
|
|
254
|
+
filterCount: number;
|
|
255
|
+
resetFilters: () => void;
|
|
256
|
+
className?: string;
|
|
257
|
+
}): react_jsx_runtime.JSX.Element;
|
|
258
|
+
|
|
259
|
+
type RowCountRelation = 'eq' | 'gt';
|
|
260
|
+
/** Pass `true` for defaults, `false` to disable the footer entirely (handled by the caller, not this component), or an object to toggle individual parts. */
|
|
261
|
+
type DataTablePaginationConfig = boolean | {
|
|
262
|
+
/** Shows "Showing 1 to 20 of 25 results". @default true */
|
|
263
|
+
summary?: boolean;
|
|
264
|
+
/** Shows the first/previous/next/last icon buttons. @default true */
|
|
265
|
+
arrows?: boolean;
|
|
266
|
+
/** Shows numeric page buttons alongside the arrows. @default false */
|
|
267
|
+
numbers?: boolean;
|
|
268
|
+
/** Shows the rows-per-page selector. @default true */
|
|
269
|
+
pageSizeSelector?: boolean;
|
|
270
|
+
/** Options offered in the rows-per-page selector. @default [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] */
|
|
271
|
+
pageSizeOptions?: number[];
|
|
272
|
+
};
|
|
273
|
+
/** Dedupes/sorts `pageSizeOptions`, and snaps `pageSize` to the nearest option when it isn't one (ties go to the lower value). */
|
|
274
|
+
declare function normalizePageSizeOptions(pageSize: number, pageSizeOptions: number[]): {
|
|
275
|
+
normalizedPageSizeOptions: number[];
|
|
276
|
+
effectivePageSize: number;
|
|
277
|
+
};
|
|
278
|
+
type DataTablePaginationProps = {
|
|
279
|
+
pageIndex: number;
|
|
280
|
+
pageSize: number;
|
|
281
|
+
rowCount: number;
|
|
282
|
+
/** `'gt'` renders "N+ results" with an explanatory tooltip, for an inexact/server-estimated count. @default 'eq' */
|
|
283
|
+
rowCountRelation?: RowCountRelation;
|
|
284
|
+
paginationConfig?: DataTablePaginationConfig;
|
|
285
|
+
/** Called with the 1-based page number the user navigated to. */
|
|
286
|
+
onPageChange: (page: number) => void;
|
|
287
|
+
onPageSizeChange: (pageSize: number) => void;
|
|
288
|
+
};
|
|
289
|
+
declare function DataTablePagination({ pageIndex, pageSize, rowCount, rowCountRelation, paginationConfig, onPageChange, onPageSizeChange, }: DataTablePaginationProps): react_jsx_runtime.JSX.Element;
|
|
290
|
+
|
|
291
|
+
declare function DataTableHeader<TData extends RowData>({ headerGroups, onAutosizeAll, onAutosizeColumn, onResetColumnSize, stickyHeader, layout, }: {
|
|
292
|
+
headerGroups: HeaderGroup<TData>[];
|
|
293
|
+
onAutosizeAll: () => void;
|
|
294
|
+
onAutosizeColumn: (columnId: string) => void;
|
|
295
|
+
/** Called when the user double-clicks the resize separator to reset a column to its default size. */
|
|
296
|
+
onResetColumnSize: (columnId: string) => void;
|
|
297
|
+
stickyHeader?: StickyHeaderConfig;
|
|
298
|
+
layout?: TableLayout;
|
|
299
|
+
}): react_jsx_runtime.JSX.Element;
|
|
300
|
+
type DataTableRowProps = React$1.HTMLAttributes<HTMLElement> & {
|
|
301
|
+
hoverable?: boolean;
|
|
302
|
+
disabled?: boolean;
|
|
303
|
+
layout?: TableLayout;
|
|
304
|
+
};
|
|
305
|
+
declare const DataTableRow: React$1.ForwardRefExoticComponent<React$1.HTMLAttributes<HTMLElement> & {
|
|
306
|
+
hoverable?: boolean;
|
|
307
|
+
disabled?: boolean;
|
|
308
|
+
layout?: TableLayout;
|
|
309
|
+
} & React$1.RefAttributes<HTMLElement>>;
|
|
310
|
+
declare function DataTableCell<TData extends RowData, TValue>({ cell, className, showContextualFilter, onContextCell, onContextSearch, contextualMenuActions, layout, }: {
|
|
311
|
+
cell: Cell<TData, TValue>;
|
|
312
|
+
className?: string;
|
|
313
|
+
showContextualFilter?: boolean;
|
|
314
|
+
onContextCell?: (filter: ColumnFilter, cell: Cell<TData, TValue>) => void;
|
|
315
|
+
onContextSearch?: (searchTerm: string, cell: Cell<TData, TValue>) => void;
|
|
316
|
+
contextualMenuActions?: ContextualMenuAction<TData, TValue>[];
|
|
317
|
+
layout?: TableLayout;
|
|
318
|
+
}): react_jsx_runtime.JSX.Element;
|
|
319
|
+
declare function DataTableGroupRow({ groupLabel, colSpan, layout, }: {
|
|
320
|
+
groupLabel: string;
|
|
321
|
+
colSpan: number;
|
|
322
|
+
layout?: TableLayout;
|
|
323
|
+
}): react_jsx_runtime.JSX.Element;
|
|
324
|
+
type SkeletonColumn = {
|
|
325
|
+
id: string;
|
|
326
|
+
size?: number;
|
|
327
|
+
minSize?: number;
|
|
328
|
+
maxSize?: number;
|
|
329
|
+
};
|
|
330
|
+
declare function DataTableSkeletonBody({ rowCount, columns, renderCell, layout, }: {
|
|
331
|
+
rowCount?: number;
|
|
332
|
+
columns: SkeletonColumn[];
|
|
333
|
+
renderCell?: (columnId: string) => React$1.ReactNode | undefined;
|
|
334
|
+
layout?: TableLayout;
|
|
335
|
+
}): react_jsx_runtime.JSX.Element;
|
|
336
|
+
declare function DataTableExpandedRow({ colSpan, show, children, layout, }: {
|
|
337
|
+
colSpan: number;
|
|
338
|
+
show?: boolean;
|
|
339
|
+
children: React$1.ReactNode;
|
|
340
|
+
layout?: TableLayout;
|
|
341
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
342
|
+
declare function DataTableBody<TData extends RowData>({ tableRows, tableState, columns, skeletonRowCount, renderSkeletonCell, onRowRender, renderExpandedRow, showContextualFilter, onContextCell, onContextSearch, contextualMenuActions, layout, }: {
|
|
343
|
+
tableRows: Row<TData>[];
|
|
344
|
+
tableState: TableDataState;
|
|
345
|
+
columns: Column<TData, unknown>[];
|
|
346
|
+
skeletonRowCount?: number;
|
|
347
|
+
renderSkeletonCell?: (columnId: string) => React$1.ReactNode | undefined;
|
|
348
|
+
onRowRender?: (row: TData) => DataTableRowProps;
|
|
349
|
+
renderExpandedRow?: (row: TData) => React$1.ReactNode;
|
|
350
|
+
showContextualFilter?: boolean;
|
|
351
|
+
onContextCell?: (filter: ColumnFilter, cell: Cell<TData, unknown>) => void;
|
|
352
|
+
onContextSearch?: (searchTerm: string, cell: Cell<TData, unknown>) => void;
|
|
353
|
+
contextualMenuActions?: ContextualMenuAction<TData, unknown>[];
|
|
354
|
+
layout?: TableLayout;
|
|
355
|
+
}): react_jsx_runtime.JSX.Element;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Table rendering mode. `'auto'` uses a native `<table>`. `'grid'` renders
|
|
359
|
+
* CSS Grid + subgrid `<div role="...">` markup instead, with column widths
|
|
360
|
+
* driven by each column's `meta.grid` (`table-meta.ts`) rather than
|
|
361
|
+
* `size`/`minSize`/`maxSize`. Column pinning is unavailable in `'grid'` mode.
|
|
362
|
+
*/
|
|
363
|
+
type TableLayout = 'auto' | 'grid';
|
|
364
|
+
/** Enables sticky column headers. Pass `true` for defaults, or an object to customize offset/row height. */
|
|
365
|
+
type StickyHeaderConfig = boolean | {
|
|
366
|
+
/** Pixels from the top of the scroll container (e.g. space for a fixed bar). */
|
|
367
|
+
offset?: number;
|
|
368
|
+
/** Assumed header-row height in px, used to stack multiple header groups. @default 48 */
|
|
369
|
+
rowHeight?: number;
|
|
370
|
+
};
|
|
371
|
+
/** The `useReactTable` config `DataTable` forwards. A near-exact `TableOptions` port — see the orchestrator's `config` merge for exactly which fields are honored. */
|
|
372
|
+
interface TableHookOptions<TData extends RowData> extends Omit<TableOptions<TData>, 'getCoreRowModel' | 'getSortedRowModel' | 'getFilteredRowModel'> {
|
|
373
|
+
data: TData[];
|
|
374
|
+
state?: Partial<TableState>;
|
|
375
|
+
initialState?: InitialTableState;
|
|
376
|
+
sortingFns?: Record<string, SortingFn<TData>>;
|
|
377
|
+
filterFns?: Record<string, FilterFn<TData>>;
|
|
378
|
+
globalFilterFn?: FilterFn<TData>;
|
|
379
|
+
enableSortingRemoval?: boolean;
|
|
380
|
+
enablePagination?: boolean;
|
|
381
|
+
rowCountRelation?: RowCountRelation;
|
|
382
|
+
}
|
|
383
|
+
/** Wires the CEL filter builder into the filter row in place of plain column filters. */
|
|
384
|
+
type DataTableCelFilterConfig<TData extends RowData> = {
|
|
385
|
+
schema: CelFilterSchema;
|
|
386
|
+
tree: CelFilterTree;
|
|
387
|
+
onTreeChange: (tree: CelFilterTree) => void;
|
|
388
|
+
onCompileResultChange?: (result: CompileResult) => void;
|
|
389
|
+
onContextualFilter?: (payload: {
|
|
390
|
+
columnId: string;
|
|
391
|
+
values: string[];
|
|
392
|
+
cell: Cell<TData, unknown>;
|
|
393
|
+
}) => void;
|
|
394
|
+
/** Invoked when the user clicks a disabled CEL filter option. */
|
|
395
|
+
onRestrictedOptionSelect?: (payload: CelRestrictedOptionSelectPayload) => void;
|
|
396
|
+
activeFilterCount: number;
|
|
397
|
+
showClearButton?: boolean;
|
|
398
|
+
};
|
|
399
|
+
/**
|
|
400
|
+
* `DataTable`'s public prop surface — an exact-name port of legacy
|
|
401
|
+
* `TableWrapperProps<T>`. The only intended differences are internal
|
|
402
|
+
* (Monarch primitives instead of hand-rolled ones); every prop name, shape,
|
|
403
|
+
* and default here must match the source.
|
|
404
|
+
*/
|
|
405
|
+
interface DataTableProps<TData extends RowData> {
|
|
406
|
+
id: string;
|
|
407
|
+
config: TableHookOptions<TData>;
|
|
408
|
+
title?: ReactNode;
|
|
409
|
+
description?: ReactNode;
|
|
410
|
+
loading?: boolean;
|
|
411
|
+
renderSkeletonCell?: (columnId: string) => ReactNode | undefined;
|
|
412
|
+
showError?: boolean;
|
|
413
|
+
emptyView?: DataTableEmptyView;
|
|
414
|
+
className?: string;
|
|
415
|
+
/** Table layout mode. 'auto' uses native HTML table layout, 'grid' uses CSS Grid with div elements. @default 'auto' */
|
|
416
|
+
layout?: TableLayout;
|
|
417
|
+
/** When true, table height fits content instead of using viewport-based height constraints. @default false */
|
|
418
|
+
fitContent?: boolean;
|
|
419
|
+
serverSidePagination?: boolean;
|
|
420
|
+
onRowRender?(row: TData): DataTableRowProps;
|
|
421
|
+
renderExpandedRow?: (row: TData) => ReactNode;
|
|
422
|
+
/** Controlled expanded state (optional). When omitted, `DataTable` uses internal state. */
|
|
423
|
+
expanded?: ExpandedState;
|
|
424
|
+
onExpandedChange?: Dispatch<SetStateAction<ExpandedState>>;
|
|
425
|
+
ActionsComponent?: ComponentType<{
|
|
426
|
+
state: TableDataState;
|
|
427
|
+
}>;
|
|
428
|
+
disableSearch?: boolean;
|
|
429
|
+
disableFilters?: boolean;
|
|
430
|
+
disableSorting?: boolean;
|
|
431
|
+
/**
|
|
432
|
+
* Configure the pagination UI. Pass `false` to disable pagination, `true` for defaults,
|
|
433
|
+
* or an object to control individual pagination parts.
|
|
434
|
+
*/
|
|
435
|
+
paginationConfig?: DataTablePaginationConfig;
|
|
436
|
+
disableColumnReordering?: boolean;
|
|
437
|
+
disableColumnVisibility?: boolean;
|
|
438
|
+
disableColumnResizing?: boolean;
|
|
439
|
+
/**
|
|
440
|
+
* When true, disables column pinning (sticky left pin and Pin/Unpin menu).
|
|
441
|
+
* @default false
|
|
442
|
+
* Column pinning is always unavailable in `layout="grid"`, regardless of this flag.
|
|
443
|
+
*/
|
|
444
|
+
disableColumnPinning?: boolean;
|
|
445
|
+
searchTerm?: string;
|
|
446
|
+
onSearchTermChange?: Dispatch<SetStateAction<string>>;
|
|
447
|
+
filters?: ColumnFiltersState;
|
|
448
|
+
onFiltersChange?: Dispatch<SetStateAction<ColumnFiltersState>>;
|
|
449
|
+
pagination?: PaginationState;
|
|
450
|
+
onPaginationChange?: Dispatch<SetStateAction<PaginationState>>;
|
|
451
|
+
sorting?: SortingState;
|
|
452
|
+
onSortingChange?: Dispatch<SetStateAction<SortingState>>;
|
|
453
|
+
columnOrdering?: ColumnOrderState;
|
|
454
|
+
onColumnOrderingChange?: Dispatch<SetStateAction<ColumnOrderState>>;
|
|
455
|
+
columnVisibility?: VisibilityState;
|
|
456
|
+
onColumnVisibilityChange?: Dispatch<SetStateAction<VisibilityState>>;
|
|
457
|
+
columnPinning?: ColumnPinningState;
|
|
458
|
+
onColumnPinningChange?: Dispatch<SetStateAction<ColumnPinningState>>;
|
|
459
|
+
grouping?: GroupingState;
|
|
460
|
+
onGroupingChange?: OnChangeFn<GroupingState>;
|
|
461
|
+
/** Additional className applied to the CEL filter builder wrapper inside the filter bar. */
|
|
462
|
+
celFilterClassName?: string;
|
|
463
|
+
showContextualFilter?: boolean;
|
|
464
|
+
onContextCell?: (filter: ColumnFilter, cell: Cell<TData, unknown>) => void;
|
|
465
|
+
contextualMenuActions?: ContextualMenuAction<TData, unknown>[];
|
|
466
|
+
/** Initial column sizing state. Seed from a sync adapter or other persistence source. */
|
|
467
|
+
initialColumnSizing?: ColumnSizingState;
|
|
468
|
+
/** Called whenever column sizing changes, allowing the consumer to persist the new sizing. */
|
|
469
|
+
onColumnSizingPersist?: (sizing: ColumnSizingState) => void;
|
|
470
|
+
/**
|
|
471
|
+
* Enable sticky column headers within the table scroll area.
|
|
472
|
+
* Pass `true` for defaults, or an object to customise offset / row height.
|
|
473
|
+
*/
|
|
474
|
+
stickyHeader?: StickyHeaderConfig;
|
|
475
|
+
/** When set, renders the CEL filter builder in the filter row instead of column filters. */
|
|
476
|
+
celFilterConfig?: DataTableCelFilterConfig<TData>;
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
/**
|
|
480
|
+
* Full port of legacy `TableWrapper` — same prop surface
|
|
481
|
+
* (`DataTableProps<T>` mirrors `TableWrapperProps<T>` name-for-name), same
|
|
482
|
+
* controlled/uncontrolled state merges, same behavior. The only intended
|
|
483
|
+
* difference is that columns, headers, rows, cells, and menus render through
|
|
484
|
+
* Monarch's own primitives instead of legacy's hand-rolled ones.
|
|
485
|
+
*/
|
|
486
|
+
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, 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, }: DataTableProps<TData>): react_jsx_runtime.JSX.Element;
|
|
487
|
+
|
|
488
|
+
type ViewFilterProps<TData extends RowData> = {
|
|
489
|
+
columns: Column<TData, unknown>[];
|
|
490
|
+
columnFilters: ColumnFiltersState;
|
|
491
|
+
onColumnFiltersChange: React$1.Dispatch<React$1.SetStateAction<ColumnFiltersState>>;
|
|
492
|
+
className?: string;
|
|
493
|
+
};
|
|
494
|
+
/**
|
|
495
|
+
* The plain (non-CEL) filter row — a thin state adapter over Monarch's
|
|
496
|
+
* `FilterBar`, mirroring TableWrapper's own `ViewFilter` (itself just a
|
|
497
|
+
* `FilterBar` adapter, not a hand-rolled UI). Every `meta.filter` shape
|
|
498
|
+
* (checkbox/scrollableCheckbox, radio/scrollableRadio, dateRange, text,
|
|
499
|
+
* multiText) gets a chip here, mapped onto the matching `FilterBar` chip
|
|
500
|
+
* type. CEL-based filtering (`celFilterConfig`) is the richer, operator-driven
|
|
501
|
+
* tier this is not meant to replace.
|
|
502
|
+
*/
|
|
503
|
+
declare function ViewFilter<TData extends RowData>({ columns, columnFilters, onColumnFiltersChange, className, }: ViewFilterProps<TData>): react_jsx_runtime.JSX.Element;
|
|
504
|
+
|
|
505
|
+
export { CellContextualFilter, type CellContextualFilterProps, ColumnOptions, type ColumnOptionsProps, type ContextualMenuAction, DataTable, DataTableBody, type DataTableCelFilterConfig, DataTableCell, type DataTableEmptyConfig, DataTableEmptyView, DataTableExpandedRow, DataTableGroupRow, DataTableHeader, DataTablePagination, type DataTablePaginationConfig, type DataTablePaginationProps, type DataTableProps, DataTableRow, type DataTableRowProps, DataTableSkeletonBody, DataTableValueCell, type DataTableValueCellProps, ExpandButton, RowActionItem, RowActions, type RowCountRelation, type StickyHeaderConfig, type TableHookOptions, type TableLayout, TimestampCell, ViewFilter, type ViewFilterProps, defaultEmptyConfig, defaultErrorConfig, defaultNoFilterFoundConfig, getActionsColumnDefinition, getExpandColumnDefinition, normalizePageSizeOptions };
|