@vendure-io/ui 2.2.0 → 3.0.0-next.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/package.json +19 -5
- package/src/components/atoms/accordion.tsx +21 -6
- package/src/components/atoms/alert-dialog.tsx +31 -6
- package/src/components/atoms/alert.tsx +59 -12
- package/src/components/atoms/avatar.tsx +1 -1
- package/src/components/atoms/badge.tsx +7 -2
- package/src/components/atoms/breadcrumb.tsx +137 -4
- package/src/components/atoms/button-group.tsx +30 -6
- package/src/components/atoms/button.tsx +128 -18
- package/src/components/atoms/calendar.tsx +6 -6
- package/src/components/atoms/card.tsx +130 -16
- package/src/components/atoms/carousel.tsx +16 -9
- package/src/components/atoms/chart.tsx +87 -1
- package/src/components/atoms/checkbox.tsx +85 -7
- package/src/components/atoms/collapsible.tsx +2 -1
- package/src/components/atoms/combobox.tsx +147 -21
- package/src/components/atoms/command.tsx +414 -12
- package/src/components/atoms/context-menu.tsx +28 -23
- package/src/components/atoms/dialog.tsx +151 -29
- package/src/components/atoms/direction.tsx +23 -2
- package/src/components/atoms/drawer.tsx +15 -10
- package/src/components/atoms/dropdown-menu.tsx +43 -28
- package/src/components/atoms/empty.tsx +4 -0
- package/src/components/atoms/field.tsx +41 -15
- package/src/components/atoms/hover-card.tsx +61 -8
- package/src/components/atoms/input-group.tsx +17 -9
- package/src/components/atoms/input-otp.tsx +6 -6
- package/src/components/atoms/input.tsx +7 -1
- package/src/components/atoms/item.tsx +3 -3
- package/src/components/atoms/kbd.tsx +32 -3
- package/src/components/atoms/label-swap.tsx +82 -0
- package/src/components/atoms/label.tsx +1 -1
- package/src/components/atoms/menubar.tsx +28 -26
- package/src/components/atoms/native-select.tsx +3 -2
- package/src/components/atoms/navigation-menu.tsx +13 -8
- package/src/components/atoms/pagination.tsx +2 -2
- package/src/components/atoms/popover.tsx +23 -5
- package/src/components/atoms/progress.tsx +46 -33
- package/src/components/atoms/radio-group.tsx +9 -4
- package/src/components/atoms/resizable.tsx +1 -1
- package/src/components/atoms/scroll-area.tsx +2 -2
- package/src/components/atoms/select.tsx +258 -19
- package/src/components/atoms/sheet.tsx +59 -23
- package/src/components/atoms/sidebar.tsx +333 -23
- package/src/components/atoms/skeleton.tsx +1 -1
- package/src/components/atoms/slider.tsx +1 -1
- package/src/components/atoms/sonner.tsx +128 -38
- package/src/components/atoms/spinner.tsx +1 -1
- package/src/components/atoms/switch.tsx +10 -5
- package/src/components/atoms/table.tsx +147 -7
- package/src/components/atoms/tabs.tsx +3 -3
- package/src/components/atoms/textarea.tsx +3 -1
- package/src/components/atoms/toggle-group.tsx +4 -2
- package/src/components/atoms/toggle.tsx +28 -6
- package/src/components/atoms/tooltip.tsx +85 -15
- package/src/components/molecules/anonymized-token.tsx +24 -8
- package/src/components/molecules/app-shell.tsx +53 -20
- package/src/components/molecules/arrow-link.tsx +40 -0
- package/src/components/molecules/chip.tsx +2 -2
- package/src/components/molecules/code-block.tsx +54 -31
- package/src/components/molecules/collapsible-section.tsx +129 -0
- package/src/components/molecules/confirm-dialog.tsx +113 -9
- package/src/components/molecules/copyable-text.tsx +75 -11
- package/src/components/molecules/data-table/data-table-bulk-actions.tsx +32 -4
- package/src/components/molecules/data-table/data-table-column-header.tsx +20 -3
- package/src/components/molecules/data-table/data-table-filters.tsx +1 -1
- package/src/components/molecules/data-table/data-table-helpers.tsx +68 -1
- package/src/components/molecules/data-table/data-table-selection-storage.tsx +115 -0
- package/src/components/molecules/data-table/data-table-types.tsx +121 -4
- package/src/components/molecules/data-table/data-table-view-options.tsx +2 -2
- package/src/components/molecules/data-table/data-table.tsx +837 -80
- package/src/components/molecules/data-table/table-pagination.tsx +2 -2
- package/src/components/molecules/date-picker.tsx +13 -7
- package/src/components/molecules/date-range-picker.tsx +13 -6
- package/src/components/molecules/date-time-picker.tsx +13 -7
- package/src/components/molecules/date-time.tsx +8 -1
- package/src/components/molecules/direction-link.tsx +130 -0
- package/src/components/molecules/elapsed-time.tsx +223 -0
- package/src/components/molecules/file-dropzone.tsx +2 -2
- package/src/components/molecules/id-chip.tsx +169 -32
- package/src/components/molecules/inline-code.tsx +4 -0
- package/src/components/molecules/issued-secret.tsx +318 -0
- package/src/components/molecules/list-row.tsx +349 -0
- package/src/components/molecules/live-indicator.tsx +83 -0
- package/src/components/molecules/page-header.tsx +117 -5
- package/src/components/molecules/password-input.tsx +2 -2
- package/src/components/molecules/relative-time.tsx +85 -56
- package/src/components/molecules/search-trigger.tsx +127 -0
- package/src/components/molecules/secret-value.tsx +26 -9
- package/src/components/molecules/skip-link.tsx +1 -1
- package/src/components/molecules/stat-card.tsx +4 -4
- package/src/components/molecules/state-views/empty-state.tsx +35 -17
- package/src/components/molecules/state-views/error-state.tsx +32 -14
- package/src/components/molecules/status-badge.tsx +415 -49
- package/src/components/molecules/time-tooltip.tsx +140 -0
- package/src/components/molecules/timeline.tsx +246 -0
- package/src/components/molecules/visibility-icon.tsx +89 -0
- package/src/hooks/use-active-label-size.ts +32 -0
- package/src/hooks/use-pinned-height.ts +55 -0
- package/src/hooks/use-scrolled.ts +27 -0
- package/src/lib/content-inset.ts +17 -0
- package/src/lib/control-name.ts +55 -0
- package/src/lib/dialog-padding.ts +48 -0
- package/src/lib/field-surface.ts +31 -0
- package/src/lib/format-elapsed.ts +67 -0
- package/src/lib/format-relative.ts +29 -1
- package/src/lib/highlight.ts +3 -3
- package/src/lib/menu-item.tsx +72 -0
- package/src/lib/outline-edge.ts +21 -0
- package/src/lib/popup-align.ts +67 -0
- package/src/lib/popup-direction.ts +22 -0
- package/src/lib/popup-motion.ts +19 -0
- package/src/lib/state-dictionary.ts +42 -6
- package/src/lib/syntax-colors.ts +8 -0
- package/src/lib/tint-recipes.ts +68 -0
- package/src/lib/tone-icons.ts +24 -0
- package/src/lib/trigger-slot.ts +16 -0
- package/src/lib/utils.ts +104 -1
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import type { OnChangeFn, RowSelectionState, Updater } from '@tanstack/react-table';
|
|
2
|
+
import type {
|
|
3
|
+
ControlledState,
|
|
4
|
+
DataTableRowSelection,
|
|
5
|
+
} from '@vendure-io/ui/components/molecules/data-table/data-table-types';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
// The row selection of a table, kept in session storage under a consumer's key.
|
|
9
|
+
// It survives a reload and a visit to another page in the same tab. It is not in
|
|
10
|
+
// the URL: a URL change is a navigation, and each checkbox click would run one.
|
|
11
|
+
|
|
12
|
+
const STORAGE_PREFIX = 'vendure-ui:data-table-selection:';
|
|
13
|
+
|
|
14
|
+
/** The ids stored under `key`. Blocked, missing or malformed storage gives none. */
|
|
15
|
+
export function readStoredSelection(key: string): RowSelectionState {
|
|
16
|
+
try {
|
|
17
|
+
const stored = globalThis.sessionStorage?.getItem(STORAGE_PREFIX + key);
|
|
18
|
+
const ids: unknown = stored ? JSON.parse(stored) : [];
|
|
19
|
+
if (!Array.isArray(ids)) return {};
|
|
20
|
+
return Object.fromEntries(ids.map((id) => [String(id), true]));
|
|
21
|
+
} catch {
|
|
22
|
+
return {};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Store the selected ids under `key`. All of them, whatever page they are on. An
|
|
28
|
+
* empty selection removes the entry. Storage that is full or blocked is ignored:
|
|
29
|
+
* the selection then lasts until the table unmounts.
|
|
30
|
+
*/
|
|
31
|
+
export function writeStoredSelection(key: string, selection: RowSelectionState) {
|
|
32
|
+
try {
|
|
33
|
+
const ids = selectedIds(selection);
|
|
34
|
+
if (ids.length === 0) {
|
|
35
|
+
globalThis.sessionStorage?.removeItem(STORAGE_PREFIX + key);
|
|
36
|
+
} else {
|
|
37
|
+
globalThis.sessionStorage?.setItem(STORAGE_PREFIX + key, JSON.stringify(ids));
|
|
38
|
+
}
|
|
39
|
+
} catch {
|
|
40
|
+
// Storage can be full or blocked.
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const selectedIds = (selection: RowSelectionState) =>
|
|
45
|
+
Object.keys(selection).filter((id) => selection[id]);
|
|
46
|
+
|
|
47
|
+
const sameSelection = (a: RowSelectionState, b: RowSelectionState) => {
|
|
48
|
+
const left = selectedIds(a);
|
|
49
|
+
return left.length === selectedIds(b).length && left.every((id) => b[id]);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
const resolve = (updater: Updater<RowSelectionState>, old: RowSelectionState) =>
|
|
53
|
+
typeof updater === 'function' ? updater(old) : updater;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Wraps a table's `rowSelection` config so its selection is stored under
|
|
57
|
+
* `storageKey`. Without a key, or without `rowSelection`, it returns the config
|
|
58
|
+
* as it is.
|
|
59
|
+
*
|
|
60
|
+
* - On the first load, ids stored under the key become the selection. Nothing
|
|
61
|
+
* stored leaves the selection as the consumer set it.
|
|
62
|
+
* - Every change the table makes is stored.
|
|
63
|
+
* - A new key switches to the selection stored under it, or to none. Nothing
|
|
64
|
+
* from the old key carries over, and the switch itself stores nothing.
|
|
65
|
+
*
|
|
66
|
+
* The stored ids are applied in a layout effect, before the first paint, and
|
|
67
|
+
* reported through the consumer's `onChange`. A controlled consumer takes them
|
|
68
|
+
* there.
|
|
69
|
+
*/
|
|
70
|
+
export function useSelectionStorage<TData>(
|
|
71
|
+
storageKey: string | undefined,
|
|
72
|
+
rowSelection: DataTableRowSelection<TData> | undefined,
|
|
73
|
+
): DataTableRowSelection<TData> | undefined {
|
|
74
|
+
const enabled = storageKey != null && rowSelection != null;
|
|
75
|
+
const controlled = rowSelection?.value !== undefined;
|
|
76
|
+
const [own, setOwn] = React.useState<RowSelectionState>(rowSelection?.defaultValue ?? {});
|
|
77
|
+
const current = controlled ? (rowSelection?.value as RowSelectionState) : own;
|
|
78
|
+
|
|
79
|
+
// The latest values, read by the callbacks below so their identity holds.
|
|
80
|
+
const latest = React.useRef({ storageKey, current, onChange: rowSelection?.onChange });
|
|
81
|
+
latest.current = { storageKey, current, onChange: rowSelection?.onChange };
|
|
82
|
+
const loadedKey = React.useRef<string | undefined>(undefined);
|
|
83
|
+
|
|
84
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: restores when the key changes, nothing else
|
|
85
|
+
React.useLayoutEffect(() => {
|
|
86
|
+
if (!enabled) {
|
|
87
|
+
loadedKey.current = undefined;
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
const first = loadedKey.current === undefined;
|
|
91
|
+
loadedKey.current = storageKey;
|
|
92
|
+
const stored = readStoredSelection(storageKey);
|
|
93
|
+
// On the first load an empty store leaves the consumer's own selection.
|
|
94
|
+
if (first && selectedIds(stored).length === 0) return;
|
|
95
|
+
if (sameSelection(stored, latest.current.current)) return;
|
|
96
|
+
if (!controlled) setOwn(stored);
|
|
97
|
+
latest.current.onChange?.(stored);
|
|
98
|
+
}, [enabled, storageKey]);
|
|
99
|
+
|
|
100
|
+
const onChange = React.useCallback<OnChangeFn<RowSelectionState>>((updater) => {
|
|
101
|
+
const next = resolve(updater, latest.current.current);
|
|
102
|
+
// Updates in one tick build on each other before the next render.
|
|
103
|
+
latest.current.current = next;
|
|
104
|
+
if (latest.current.storageKey != null) writeStoredSelection(latest.current.storageKey, next);
|
|
105
|
+
setOwn(next);
|
|
106
|
+
latest.current.onChange?.(updater);
|
|
107
|
+
}, []);
|
|
108
|
+
|
|
109
|
+
return React.useMemo(() => {
|
|
110
|
+
if (!enabled || rowSelection == null) return rowSelection;
|
|
111
|
+
const { defaultValue: _defaultValue, ...rest } = rowSelection;
|
|
112
|
+
return { ...rest, value: current, onChange } as ControlledState<RowSelectionState> &
|
|
113
|
+
DataTableRowSelection<TData>;
|
|
114
|
+
}, [enabled, rowSelection, current, onChange]);
|
|
115
|
+
}
|
|
@@ -13,6 +13,20 @@ import type {
|
|
|
13
13
|
} from '@tanstack/react-table';
|
|
14
14
|
import type * as React from 'react';
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* The keys DataTable reads from a column's `meta`. DataTable does not augment
|
|
18
|
+
* TanStack's `ColumnMeta`, so a consumer's own meta keys keep working; write
|
|
19
|
+
* `meta: { align: 'end' } satisfies DataTableColumnMeta` for a checked value.
|
|
20
|
+
*/
|
|
21
|
+
export interface DataTableColumnMeta {
|
|
22
|
+
/**
|
|
23
|
+
* Which side of the column its header, sort control and cells line up on.
|
|
24
|
+
* `'end'` is for numbers (totals, quantities), so their digits line up.
|
|
25
|
+
* Logical, so it flips in right-to-left. Defaults to `'start'`.
|
|
26
|
+
*/
|
|
27
|
+
align?: 'start' | 'end';
|
|
28
|
+
}
|
|
29
|
+
|
|
16
30
|
// Pure type module for the DataTable molecule. Kept runtime-free so it can be
|
|
17
31
|
// imported by both `data-table.tsx` and its sub-components without an import
|
|
18
32
|
// cycle. `data-table.tsx` re-exports everything here (plus the consumer-facing
|
|
@@ -131,18 +145,83 @@ export type DataTableFilters<TData> = ControlledState<ColumnFiltersState> & {
|
|
|
131
145
|
|
|
132
146
|
export interface DataTableBulkActionContext<TData> {
|
|
133
147
|
/**
|
|
134
|
-
* `row.original`
|
|
135
|
-
* selection cache
|
|
148
|
+
* `row.original` of the selected rows the table has loaded, from the core's
|
|
149
|
+
* selection cache. Use it to DISPLAY rows. It can be SHORTER than
|
|
150
|
+
* `selectedRowIds`: a selection spans pages, it can be restored before its
|
|
151
|
+
* rows load, and a stored id can name a row that no longer exists. Act on
|
|
152
|
+
* `selectedRowIds`; read `missingRowIds` before an action that needs row data.
|
|
136
153
|
*/
|
|
137
154
|
selection: TData[];
|
|
155
|
+
/** The id of EVERY selected row, loaded or not. Act on these. */
|
|
138
156
|
selectedRowIds: string[];
|
|
157
|
+
/** `selectedRowIds.length`. Show this as the count: it is never below what the action receives. */
|
|
158
|
+
selectedCount: number;
|
|
159
|
+
/**
|
|
160
|
+
* The selected ids with no row object in `selection`. Empty when `selection`
|
|
161
|
+
* has a row for every id. When it is not empty, an action that needs row data
|
|
162
|
+
* must load these rows or tell the user: it must not act on fewer rows than
|
|
163
|
+
* `selectedCount` says.
|
|
164
|
+
*/
|
|
165
|
+
missingRowIds: string[];
|
|
139
166
|
table: Table<TData>;
|
|
140
167
|
clearSelection: () => void; // table.resetRowSelection()
|
|
141
168
|
}
|
|
142
169
|
|
|
170
|
+
/**
|
|
171
|
+
* The select all / clear all ripple timing of one row, handed to `renderRow`.
|
|
172
|
+
* Put both on the `<tr>` you render so it ripples like a built-in row:
|
|
173
|
+
* `className` merged into yours, `style` spread before yours. `style` holds
|
|
174
|
+
* only custom properties (`--ripple-at`, `--ripple-span`), so it never
|
|
175
|
+
* collides with an inline `transform`, `transition` or `opacity` of the row.
|
|
176
|
+
* The row also needs `data-state="selected"` while selected, as the built-in
|
|
177
|
+
* rows have.
|
|
178
|
+
*/
|
|
179
|
+
export interface DataTableRowRipple {
|
|
180
|
+
className: string;
|
|
181
|
+
style: React.CSSProperties;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* What a built-in body cell of one column carries, handed to `renderRow` as
|
|
186
|
+
* `ctx.cellProps(columnId)`. Spread it on the `<td>` you render
|
|
187
|
+
* (`<TableCell {...cellProps(cell.column.id)}>`) and the cell matches the
|
|
188
|
+
* built-in row: the select cell is the zero-width cell the checkbox floats
|
|
189
|
+
* over, the leading data cell carries the checkbox gutter, and every cell
|
|
190
|
+
* lines its content up with the header. Merge your own classes with `cn`.
|
|
191
|
+
*/
|
|
192
|
+
export interface DataTableRowCellProps {
|
|
193
|
+
'data-column-id': string;
|
|
194
|
+
'data-content-inset-cell': string;
|
|
195
|
+
className: string;
|
|
196
|
+
style: React.CSSProperties | undefined;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* What a built-in row carries for click-to-select, handed to `renderRow` as
|
|
201
|
+
* `ctx.selectProps`. Spread it on the `<tr>` you render and the row behaves
|
|
202
|
+
* like a built-in row: while rows are selected a click on the row selects it,
|
|
203
|
+
* a click on the name (`DataTableRowLink`) opens the item, Shift+click extends
|
|
204
|
+
* the selection, and row controls keep their own action. A press that starts
|
|
205
|
+
* on a row control (a drag handle with `role="button"` or
|
|
206
|
+
* `data-table-row-control`) or moves more than 4px before release never
|
|
207
|
+
* selects, so a drag never does. Spread it before your own handlers: an
|
|
208
|
+
* `onClickCapture`, `onMouseDown` or `onPointerDown` of yours replaces the
|
|
209
|
+
* table's.
|
|
210
|
+
*/
|
|
211
|
+
export interface DataTableRowSelectProps {
|
|
212
|
+
'data-click-selects': '' | undefined;
|
|
213
|
+
onClickCapture: React.MouseEventHandler<HTMLElement>;
|
|
214
|
+
onMouseDown: React.MouseEventHandler<HTMLElement>;
|
|
215
|
+
onPointerDown: React.PointerEventHandler<HTMLElement>;
|
|
216
|
+
}
|
|
217
|
+
|
|
143
218
|
export interface DataTableLabels {
|
|
144
219
|
empty?: string; // 'No results'
|
|
145
220
|
selectAllRows?: string; // 'Select all rows'
|
|
221
|
+
/** Tooltip on the header checkbox while not every row on the page is selected. */
|
|
222
|
+
selectAllOnPage?: string; // 'Select all on this page'
|
|
223
|
+
/** Tooltip on the header checkbox while every row on the page is selected. */
|
|
224
|
+
clearPageSelection?: string; // 'Clear selection on this page'
|
|
146
225
|
selectRow?: (index: number) => string; // (i) => `Select row ${i + 1}`
|
|
147
226
|
rowActions?: string; // 'Open row actions'
|
|
148
227
|
columnsTrigger?: string; // 'Columns'
|
|
@@ -193,6 +272,22 @@ export interface DataTableProps<TData> {
|
|
|
193
272
|
filters?: DataTableFilters<TData>;
|
|
194
273
|
columnVisibility?: DataTableColumnVisibility;
|
|
195
274
|
rowSelection?: DataTableRowSelection<TData>;
|
|
275
|
+
/**
|
|
276
|
+
* Keeps the row selection in session storage under this key, so it survives a
|
|
277
|
+
* reload and a visit to another page in the same tab. Needs `rowSelection`.
|
|
278
|
+
*
|
|
279
|
+
* - On the first load the table restores the ids stored under the key and
|
|
280
|
+
* reports them through `rowSelection.onChange`.
|
|
281
|
+
* - Every change is stored, with the ids of rows on other pages: a selection
|
|
282
|
+
* can span pages. An empty selection removes the entry.
|
|
283
|
+
* - A new key switches to the selection stored under it, or to none. Nothing
|
|
284
|
+
* from the old key carries over.
|
|
285
|
+
* - No navigation and no request. Blocked or full storage is ignored.
|
|
286
|
+
*
|
|
287
|
+
* The key names the list and anything that scopes its rows, such as a channel
|
|
288
|
+
* or a project: `${route}:${channelId}`. Without the prop nothing changes.
|
|
289
|
+
*/
|
|
290
|
+
selectionStorageKey?: string;
|
|
196
291
|
|
|
197
292
|
// slots
|
|
198
293
|
/** First child of the internal `ListHeader` (title zone) — compose `PageHeader` here. */
|
|
@@ -201,7 +296,10 @@ export interface DataTableProps<TData> {
|
|
|
201
296
|
toolbar?: React.ReactNode | ((table: Table<TData>) => React.ReactNode);
|
|
202
297
|
/**
|
|
203
298
|
* Replaces the controls row inside the header band while selection is
|
|
204
|
-
* non-empty (title and applied-filter chips stay).
|
|
299
|
+
* non-empty, at the row's height (title and applied-filter chips stay).
|
|
300
|
+
* Without a controls row it covers the column header row instead. Either
|
|
301
|
+
* way the table does not move. Keep the bar one line of `h-8` or smaller
|
|
302
|
+
* controls, so it fits the 40px header row. Only meaningful with
|
|
205
303
|
* `rowSelection` wired.
|
|
206
304
|
*/
|
|
207
305
|
bulkActions?: (ctx: DataTableBulkActionContext<TData>) => React.ReactNode;
|
|
@@ -233,10 +331,29 @@ export interface DataTableProps<TData> {
|
|
|
233
331
|
* MODEL) by owning the row JSX — together they restore the donor's
|
|
234
332
|
* `isUtilityRow`/`renderUtilityRow`/`DraggableRow` seam without the core reading
|
|
235
333
|
* `meta`.
|
|
334
|
+
*
|
|
335
|
+
* A row you render yourself changes with the others when select all or clear
|
|
336
|
+
* all ripples down the page only if it takes `ctx.ripple` (see
|
|
337
|
+
* {@link DataTableRowRipple}); a row that ignores it changes at once.
|
|
338
|
+
* `ctx.cellProps(columnId)` gives each cell the built-in cell's classes (see
|
|
339
|
+
* {@link DataTableRowCellProps}), so the row's select cell and leading cell
|
|
340
|
+
* never drift from the table's own. `ctx.selectProps` (see
|
|
341
|
+
* {@link DataTableRowSelectProps}) gives the row click-to-select while rows
|
|
342
|
+
* are selected; a row without it keeps opening the item from anywhere on it.
|
|
343
|
+
* A row with a `DataTableRowLink` needs nothing more: the table raises its
|
|
344
|
+
* buttons, links, inputs and copy chips above the stretched link, as it does
|
|
345
|
+
* on a built-in row.
|
|
236
346
|
*/
|
|
237
347
|
renderRow?: (
|
|
238
348
|
row: Row<TData>,
|
|
239
|
-
ctx: {
|
|
349
|
+
ctx: {
|
|
350
|
+
table: Table<TData>;
|
|
351
|
+
columnCount: number;
|
|
352
|
+
defaultRow: React.ReactNode;
|
|
353
|
+
ripple: DataTableRowRipple;
|
|
354
|
+
cellProps: (columnId: string) => DataTableRowCellProps;
|
|
355
|
+
selectProps: DataTableRowSelectProps;
|
|
356
|
+
},
|
|
240
357
|
) => React.ReactNode;
|
|
241
358
|
|
|
242
359
|
/**
|
|
@@ -40,11 +40,11 @@ function DataTableViewOptions<TData>({
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<DropdownMenu>
|
|
43
|
-
{/* `
|
|
43
|
+
{/* `ms-auto` pins the trigger to the end of the controls row, so it reads
|
|
44
44
|
as a table setting even when no search input fills the row. */}
|
|
45
45
|
<DropdownMenuTrigger
|
|
46
46
|
data-slot="data-table-view-options"
|
|
47
|
-
className="
|
|
47
|
+
className="ms-auto"
|
|
48
48
|
render={
|
|
49
49
|
<Button variant="outline">
|
|
50
50
|
<SlidersHorizontalIcon />
|