react-gridix 0.1.1 → 0.2.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/README.md +1184 -147
- package/dist/index.d.ts +222 -22
- package/dist/react-gridix.cjs +2 -1
- package/dist/react-gridix.js +1206 -521
- package/dist/style.css +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { ComponentType } from 'react';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
3
|
import { JSX as JSX_2 } from 'react';
|
|
4
|
+
import { MutableRefObject } from 'react';
|
|
4
5
|
import { ReactNode } from 'react';
|
|
5
6
|
|
|
6
7
|
declare type AnyRow = Record<string, any>;
|
|
@@ -123,17 +124,34 @@ export declare interface ColumnDef<T = Record<string, any>> {
|
|
|
123
124
|
*/
|
|
124
125
|
headerName?: string;
|
|
125
126
|
/**
|
|
126
|
-
* "number"
|
|
127
|
-
* "boolean"
|
|
127
|
+
* - `"number"` : sorts numerically, edits parse as numbers, filters with a min / max range.
|
|
128
|
+
* - `"boolean"` : shows a checkbox that toggles with one click (see `checkbox`).
|
|
129
|
+
* - `"date"` : shows a formatted date, edits with a date picker, sorts by day, filters with a from / to range.
|
|
130
|
+
* Values can be ISO strings (`"2026-11-05"`), `Date` objects or timestamps. A date is saved in the same
|
|
131
|
+
* kind the cell already had (a `Date` stays a `Date`, a string stays an ISO string).
|
|
128
132
|
*/
|
|
129
|
-
type?: "text" | "number" | "boolean";
|
|
133
|
+
type?: "text" | "number" | "boolean" | "date";
|
|
130
134
|
width?: number | string;
|
|
131
135
|
minWidth?: number | string;
|
|
136
|
+
/** Largest width in pixels when the user resizes the column. */
|
|
137
|
+
maxWidth?: number;
|
|
132
138
|
align?: "left" | "center" | "right";
|
|
133
|
-
/**
|
|
139
|
+
/** Click the header to sort by this column. Default false: sorting is opt-in, column by column. */
|
|
134
140
|
sortable?: boolean;
|
|
141
|
+
/** Let the user drag the right edge of the header to change the column's width. Default false. */
|
|
142
|
+
resizable?: boolean;
|
|
143
|
+
/** Keep this column stuck to the left or right edge while the grid scrolls sideways. Pinned columns move to that edge. */
|
|
144
|
+
pinned?: "left" | "right";
|
|
145
|
+
/** Start with this column hidden. Needs `columnMenu` on the grid if users should be able to show it again. */
|
|
146
|
+
hidden?: boolean;
|
|
147
|
+
/** Set to false to keep this column out of the column menu (it can then never be hidden by the user). */
|
|
148
|
+
hideable?: boolean;
|
|
135
149
|
/** Show a filter indicator in this column's header. Default false. Clicking it opens the filter popup. */
|
|
136
150
|
filterable?: boolean;
|
|
151
|
+
/** Which filter this column gets. Defaults from `type`, see {@link FilterType}. */
|
|
152
|
+
filterType?: FilterType;
|
|
153
|
+
/** Choices for a `"select"` filter. When missing they are taken from the values in the loaded rows. */
|
|
154
|
+
filterOptions?: (string | FilterOption)[];
|
|
137
155
|
/** Placeholder of the default filter text box. */
|
|
138
156
|
filterPlaceholder?: string;
|
|
139
157
|
/** A React component drawn instead of the default dot. Receives `{ column, active, open }`. */
|
|
@@ -146,7 +164,7 @@ export declare interface ColumnDef<T = Record<string, any>> {
|
|
|
146
164
|
filterPopupClassName?: string;
|
|
147
165
|
/** Inline styles for this column's filter popup. */
|
|
148
166
|
filterPopupStyle?: CSSProperties;
|
|
149
|
-
/** A React component that replaces the filter
|
|
167
|
+
/** A React component that replaces the filter controls inside the popup (text matching only). */
|
|
150
168
|
filterRenderer?: ComponentType<FilterRendererProps<T>>;
|
|
151
169
|
/**
|
|
152
170
|
* `true` / `false`, or a function that decides per cell. Overrides the grid-level `editable`.
|
|
@@ -161,9 +179,19 @@ export declare interface ColumnDef<T = Record<string, any>> {
|
|
|
161
179
|
validate?: (value: unknown, row: T) => boolean;
|
|
162
180
|
/** Custom sort. Return a negative, zero or positive number. */
|
|
163
181
|
comparator?: (a: any, b: any, rowA: T, rowB: T) => number;
|
|
182
|
+
/** `type: "date"`: how the date is shown, as `Intl.DateTimeFormat` options. Default `{ year: "numeric", month: "short", day: "numeric" }`. */
|
|
183
|
+
dateFormat?: Intl.DateTimeFormatOptions;
|
|
184
|
+
/** `type: "date"`: locale for the displayed date, for example `"en-GB"`. Default is the browser's. */
|
|
185
|
+
dateLocale?: string;
|
|
186
|
+
/** `type: "date"`: earliest day the date picker accepts, as `"YYYY-MM-DD"`. */
|
|
187
|
+
dateMin?: string;
|
|
188
|
+
/** `type: "date"`: latest day the date picker accepts, as `"YYYY-MM-DD"`. */
|
|
189
|
+
dateMax?: string;
|
|
190
|
+
/** What goes into the CSV export for this column. Defaults to the displayed text (dates as `YYYY-MM-DD`). */
|
|
191
|
+
exportValue?: (value: any, row: T) => string | number | boolean | null | undefined;
|
|
164
192
|
/** A React component that renders the cell content. Define it outside render so it keeps its identity. */
|
|
165
193
|
cellRenderer?: ComponentType<CellParams<T>>;
|
|
166
|
-
/** A React component used instead of the
|
|
194
|
+
/** A React component used instead of the default editor when editing this column. */
|
|
167
195
|
cellEditor?: ComponentType<CellEditorProps<T>>;
|
|
168
196
|
/** A React component that renders the header label (the filter indicator and sort arrow are still added). */
|
|
169
197
|
headerRenderer?: ComponentType<HeaderRendererProps<T>>;
|
|
@@ -186,12 +214,27 @@ export declare interface ColumnDef<T = Record<string, any>> {
|
|
|
186
214
|
headerCheckbox?: boolean;
|
|
187
215
|
}
|
|
188
216
|
|
|
189
|
-
export declare function DataGrid<T extends AnyRow = AnyRow>({ columns, rows, getRowId, editable, enterMovesDown, onCellEdit, onRowsChange,
|
|
217
|
+
export declare function DataGrid<T extends AnyRow = AnyRow>({ columns, rows, getRowId, editable, enterMovesDown, onCellEdit, onRowsChange, rowSelection, selectedRowIds, defaultSelectedRowIds, onSelectionChange, isRowSelectable, sort: sortProp, defaultSort, onSortChange, multiSort, searchable, searchPlaceholder, search: searchProp, onSearchChange, filters: filtersProp, onFiltersChange, pagination, paginationPosition, pageSize: initialPageSize, pageSizeOptions, page: pageProp, onPageChange, onPageSizeChange, serverSide, rowCount, onQueryChange, queryDebounce, loading: loadingProp, loadingRows, skeletonRow, errorMessage, columnMenu, onColumnVisibilityChange, keyboardNavigation, virtualize, rowHeight, overscan, exportable, apiRef, onRowClick, toolbar, emptyMessage, striped, stripeColors, checkboxVariant, animateRows, theme, maxHeight, className, style, classNames, styles, rowClassName, rowStyle, }: DataGridProps<T>): JSX_2.Element;
|
|
218
|
+
|
|
219
|
+
/** Methods you can call from outside by passing a ref as `apiRef`. */
|
|
220
|
+
export declare interface DataGridApi<T = Record<string, any>> {
|
|
221
|
+
/** Builds the CSV text without downloading it. */
|
|
222
|
+
getCsv: (options?: ExportOptions) => string;
|
|
223
|
+
/** Downloads a CSV file (opens the browser's save dialog). */
|
|
224
|
+
exportCsv: (options?: ExportOptions) => void;
|
|
225
|
+
getSelectedRows: () => T[];
|
|
226
|
+
getSelectedRowIds: () => (string | number)[];
|
|
227
|
+
/** Selects every selectable row that matches the search and filters. */
|
|
228
|
+
selectAll: () => void;
|
|
229
|
+
clearSelection: () => void;
|
|
230
|
+
/** Runs the last query again (`serverSide` only). Use it after your data changed on the server. */
|
|
231
|
+
refresh: () => void;
|
|
232
|
+
}
|
|
190
233
|
|
|
191
234
|
export declare interface DataGridProps<T = Record<string, any>> {
|
|
192
235
|
columns: ColumnDef<T>[];
|
|
193
236
|
rows: T[];
|
|
194
|
-
/** Stable id for each row. Defaults to the row's index in `rows`. */
|
|
237
|
+
/** Stable id for each row. Defaults to the row's index in `rows`. Row selection needs ids that do not change. */
|
|
195
238
|
getRowId?: (row: T, index: number) => string | number;
|
|
196
239
|
/** Allow editing cells (double-click, Enter/F2, or just start typing). Default false. */
|
|
197
240
|
editable?: boolean;
|
|
@@ -204,20 +247,93 @@ export declare interface DataGridProps<T = Record<string, any>> {
|
|
|
204
247
|
onCellEdit?: (event: CellEditEvent<T>) => void;
|
|
205
248
|
/** Fires with the full updated array after a cell edit. Handy for `setRows`. */
|
|
206
249
|
onRowsChange?: (rows: T[]) => void;
|
|
207
|
-
/**
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
/**
|
|
250
|
+
/**
|
|
251
|
+
* Adds a checkbox column for selecting rows. `true` or `"multiple"` allows many rows (with a
|
|
252
|
+
* select-all header and Shift+click ranges), `"single"` allows one. Default false.
|
|
253
|
+
*/
|
|
254
|
+
rowSelection?: boolean | "single" | "multiple";
|
|
255
|
+
/** Controlled selection: the ids of the selected rows. Pair it with `onSelectionChange`. */
|
|
256
|
+
selectedRowIds?: (string | number)[];
|
|
257
|
+
/** Initial selection when you do not control it. */
|
|
258
|
+
defaultSelectedRowIds?: (string | number)[];
|
|
259
|
+
/** Fires whenever the selection changes. */
|
|
260
|
+
onSelectionChange?: (selection: RowSelection<T>) => void;
|
|
261
|
+
/** Return false for rows that must not be selected (their checkbox is disabled). */
|
|
262
|
+
isRowSelectable?: (row: T) => boolean;
|
|
263
|
+
/** Controlled sort. Pair it with `onSortChange`. */
|
|
264
|
+
sort?: SortModel[];
|
|
265
|
+
/** Initial sort when you do not control it. */
|
|
266
|
+
defaultSort?: SortModel | SortModel[] | null;
|
|
267
|
+
/** Fires with the new sort list (empty when no column is sorted). */
|
|
268
|
+
onSortChange?: (sort: SortModel[]) => void;
|
|
269
|
+
/** Hold Shift while clicking headers to sort by several columns. Default false. */
|
|
270
|
+
multiSort?: boolean;
|
|
271
|
+
/** Show the global search box. Default false. */
|
|
213
272
|
searchable?: boolean;
|
|
214
273
|
searchPlaceholder?: string;
|
|
215
|
-
/**
|
|
274
|
+
/** Controlled search text. Pair it with `onSearchChange`. */
|
|
275
|
+
search?: string;
|
|
276
|
+
onSearchChange?: (search: string) => void;
|
|
277
|
+
/** Controlled filters, by field. Pair it with `onFiltersChange`. */
|
|
278
|
+
filters?: Record<string, FilterValue>;
|
|
279
|
+
onFiltersChange?: (filters: Record<string, FilterValue>) => void;
|
|
280
|
+
/** Split rows into pages and show the row count and page controls. Default false. */
|
|
216
281
|
pagination?: boolean;
|
|
217
282
|
/** Where the row count and page controls go: "bottom" (default), "top" or "both". */
|
|
218
283
|
paginationPosition?: PaginationPosition;
|
|
284
|
+
/** Initial rows per page. */
|
|
219
285
|
pageSize?: number;
|
|
220
286
|
pageSizeOptions?: number[];
|
|
287
|
+
/** Controlled page (zero-based). Pair it with `onPageChange`. */
|
|
288
|
+
page?: number;
|
|
289
|
+
onPageChange?: (page: number) => void;
|
|
290
|
+
/** Fires when the user picks another page size. */
|
|
291
|
+
onPageSizeChange?: (pageSize: number) => void;
|
|
292
|
+
/**
|
|
293
|
+
* Let your server sort, filter, search and page. The grid then shows `rows` as they are (the
|
|
294
|
+
* current page) and calls `onQueryChange` whenever the query changes. Default false.
|
|
295
|
+
*/
|
|
296
|
+
serverSide?: boolean;
|
|
297
|
+
/** Total number of rows on the server, for the page count. Needed with `serverSide` and `pagination`. */
|
|
298
|
+
rowCount?: number;
|
|
299
|
+
/**
|
|
300
|
+
* Called on mount and whenever the query changes (`serverSide` only). If it returns a promise,
|
|
301
|
+
* the grid shows the loading state until the promise settles and shows an error with a Retry
|
|
302
|
+
* button if it rejects. Update your `rows` (and `rowCount`) before the promise resolves.
|
|
303
|
+
*/
|
|
304
|
+
onQueryChange?: (query: GridQuery) => void | Promise<unknown>;
|
|
305
|
+
/** Wait this long (ms) after the last keystroke in the search box before querying. Default 250. */
|
|
306
|
+
queryDebounce?: number;
|
|
307
|
+
/**
|
|
308
|
+
* Force the loading state on or off. When you leave it out, the loading state follows the promise
|
|
309
|
+
* returned by `onQueryChange`.
|
|
310
|
+
*/
|
|
311
|
+
loading?: boolean;
|
|
312
|
+
/** How many placeholder rows to draw while loading. Default: the page size (at most 20), or 5 without pagination. */
|
|
313
|
+
loadingRows?: number;
|
|
314
|
+
/** A component that draws one placeholder row's content. Without it each cell gets a shimmering bar. */
|
|
315
|
+
skeletonRow?: ComponentType<SkeletonRowProps<T>>;
|
|
316
|
+
/** Shown (with a Retry button) when the promise from `onQueryChange` rejects. */
|
|
317
|
+
errorMessage?: ReactNode;
|
|
318
|
+
/** Show a "Columns" button that lets users show and hide columns. Default false. */
|
|
319
|
+
columnMenu?: boolean;
|
|
320
|
+
/** Fires with the fields that are hidden now. */
|
|
321
|
+
onColumnVisibilityChange?: (hiddenFields: string[]) => void;
|
|
322
|
+
/** Arrow keys, Home/End and Page Up/Down move between cells. Default false. */
|
|
323
|
+
keyboardNavigation?: boolean;
|
|
324
|
+
/**
|
|
325
|
+
* Render only the rows that are on screen, so tens of thousands of rows stay smooth. Needs a fixed
|
|
326
|
+
* `rowHeight`, and the grid scrolls inside `maxHeight` (400 when you set none). Default false.
|
|
327
|
+
*/
|
|
328
|
+
virtualize?: boolean;
|
|
329
|
+
/** Row height in pixels when `virtualize` is on. Rows must fit it. Default 40. */
|
|
330
|
+
rowHeight?: number;
|
|
331
|
+
/** Extra rows rendered above and below the visible ones when `virtualize` is on. Default 6. */
|
|
332
|
+
overscan?: number;
|
|
333
|
+
/** Show an "Export CSV" button. Pass an object to set the file name, scope and so on. Default false. */
|
|
334
|
+
exportable?: boolean | ExportOptions;
|
|
335
|
+
/** Pass a ref to call methods such as `exportCsv()` or `getSelectedRows()` from outside. */
|
|
336
|
+
apiRef?: MutableRefObject<DataGridApi<T> | null>;
|
|
221
337
|
onRowClick?: (row: T, rowIndex: number) => void;
|
|
222
338
|
/** Extra content on the right side of the toolbar. */
|
|
223
339
|
toolbar?: ReactNode;
|
|
@@ -226,13 +342,13 @@ export declare interface DataGridProps<T = Record<string, any>> {
|
|
|
226
342
|
striped?: boolean;
|
|
227
343
|
/** Two colours for the alternating rows, for example `["#ffffff", "#f1f5f9"]`. Implies `striped`. */
|
|
228
344
|
stripeColors?: [string, string];
|
|
229
|
-
/** Checkbox style for `type: "boolean"` columns: "button", "tick" or "native" (default). */
|
|
345
|
+
/** Checkbox style for `type: "boolean"` columns and the selection column: "button", "tick" or "native" (default). */
|
|
230
346
|
checkboxVariant?: CheckboxVariant;
|
|
231
347
|
/** Rows slide in smoothly when they render (new page, sort, search). Default true. Respects "reduce motion". */
|
|
232
348
|
animateRows?: boolean;
|
|
233
349
|
/**
|
|
234
|
-
* Name of a theme. Nothing changes unless you pass one: "ocean", "midnight", "sunset"
|
|
235
|
-
* or the name of your own `[data-rk-theme="..."]` CSS.
|
|
350
|
+
* Name of a theme. Nothing changes unless you pass one: "ocean", "midnight", "sunset", "forest",
|
|
351
|
+
* "lavender", "coffee", "graphite" or "aurora", or the name of your own `[data-rk-theme="..."]` CSS.
|
|
236
352
|
*/
|
|
237
353
|
theme?: GridTheme | (string & {});
|
|
238
354
|
/** Makes the body scroll with a sticky header, e.g. 400 or "60vh". */
|
|
@@ -249,6 +365,29 @@ export declare interface DataGridProps<T = Record<string, any>> {
|
|
|
249
365
|
rowStyle?: CSSProperties | ((row: T, rowIndex: number) => CSSProperties);
|
|
250
366
|
}
|
|
251
367
|
|
|
368
|
+
/** Value of a `"date"` filter: ISO days (`"2026-11-05"`), both ends included. */
|
|
369
|
+
export declare interface DateRangeFilter {
|
|
370
|
+
from?: string;
|
|
371
|
+
to?: string;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
export declare interface ExportOptions {
|
|
375
|
+
/** File name without the extension. Default `"export"`. */
|
|
376
|
+
filename?: string;
|
|
377
|
+
/**
|
|
378
|
+
* Which rows to export.
|
|
379
|
+
* - `"filtered"` (default): every row matching the search and filters, across all pages
|
|
380
|
+
* - `"page"` : only the rows on the current page
|
|
381
|
+
* - `"selected"`: only the selected rows
|
|
382
|
+
* With `serverSide`, "filtered" means the rows currently loaded.
|
|
383
|
+
*/
|
|
384
|
+
scope?: "filtered" | "page" | "selected";
|
|
385
|
+
/** Also export columns the user has hidden. Default false. */
|
|
386
|
+
includeHidden?: boolean;
|
|
387
|
+
/** Add an apostrophe in front of text that starts with `= + - @`, so spreadsheets do not run it as a formula. Default true. */
|
|
388
|
+
sanitize?: boolean;
|
|
389
|
+
}
|
|
390
|
+
|
|
252
391
|
/**
|
|
253
392
|
* Every field a column can point at: top-level keys, plus dot paths into nested objects
|
|
254
393
|
* (`"contact.phone"`). Goes up to 5 levels deep. Arrays are treated as plain values.
|
|
@@ -260,43 +399,104 @@ export declare type FieldPath<T, D extends number = 5> = [D] extends [never] ? n
|
|
|
260
399
|
/** Props received by a column's `filterIndicator` component. */
|
|
261
400
|
export declare interface FilterIndicatorProps<T = Record<string, any>> {
|
|
262
401
|
column: ColumnDef<T>;
|
|
263
|
-
/** True while a filter
|
|
402
|
+
/** True while a filter is set for this column. */
|
|
264
403
|
active: boolean;
|
|
265
404
|
/** True while the filter popup is open. */
|
|
266
405
|
open: boolean;
|
|
267
406
|
}
|
|
268
407
|
|
|
269
|
-
/**
|
|
408
|
+
/** An entry in a `"select"` filter's list. A plain string is shorthand for `{ value }`. */
|
|
409
|
+
export declare interface FilterOption {
|
|
410
|
+
value: string;
|
|
411
|
+
/** Text shown in the list. Defaults to `value`. */
|
|
412
|
+
label?: string;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
/**
|
|
416
|
+
* Props received by a column's `filterRenderer` component (shown inside the filter popup).
|
|
417
|
+
* A column with a `filterRenderer` always filters with a text "contains" match.
|
|
418
|
+
*/
|
|
270
419
|
export declare interface FilterRendererProps<T = Record<string, any>> {
|
|
271
420
|
column: ColumnDef<T>;
|
|
272
421
|
value: string;
|
|
273
422
|
onChange: (value: string) => void;
|
|
274
423
|
}
|
|
275
424
|
|
|
276
|
-
|
|
425
|
+
/**
|
|
426
|
+
* Which kind of filter a column gets in its popup.
|
|
427
|
+
* - `"text"` : "contains" match on the displayed text (default for text columns)
|
|
428
|
+
* - `"exact"` : the displayed text must equal what was typed (ignoring case)
|
|
429
|
+
* - `"number"` : a min / max range (default for `type: "number"` columns)
|
|
430
|
+
* - `"date"` : a from / to range (default for `type: "date"` columns)
|
|
431
|
+
* - `"select"` : pick one or more values from a list (default for `type: "boolean"` columns)
|
|
432
|
+
*/
|
|
433
|
+
export declare type FilterType = "text" | "exact" | "number" | "date" | "select";
|
|
434
|
+
|
|
435
|
+
/** What a column's filter currently holds. The shape depends on the column's `FilterType`. */
|
|
436
|
+
export declare type FilterValue = string | NumberRangeFilter | DateRangeFilter | string[];
|
|
437
|
+
|
|
438
|
+
/**
|
|
439
|
+
* Everything the grid wants from your server in `serverSide` mode. It is sent to `onQueryChange`
|
|
440
|
+
* on mount and whenever the sort, search, a filter, the page or the page size changes.
|
|
441
|
+
*/
|
|
442
|
+
export declare interface GridQuery {
|
|
443
|
+
/** Sorted columns, in priority order. Only sortable columns are included. */
|
|
444
|
+
sort: SortModel[];
|
|
445
|
+
/** Active filters by field. A filter that is empty is left out. Values depend on each column's `filterType`. */
|
|
446
|
+
filters: Record<string, FilterValue>;
|
|
447
|
+
/** The global search text (trimmed). */
|
|
448
|
+
search: string;
|
|
449
|
+
/** Zero-based page index. */
|
|
450
|
+
page: number;
|
|
451
|
+
pageSize: number;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
export declare type GridSlot = "root" | "toolbar" | "search" | "scroll" | "table" | "thead" | "headerRow" | "headerCell" | "filterIndicator" | "filterPopup" | "filterInput" | "tbody" | "row" | "cell" | "editor" | "empty" | "footer" | "rowCount" | "pageInfo" | "pageSize" | "pagination" | "pageButton" | "checkbox" | "checkboxControl" | "checkboxIndicator" | "toolButton" | "skeleton";
|
|
277
455
|
|
|
278
456
|
/**
|
|
279
457
|
* Built-in themes. A theme only applies when you pass its name to `<DataGrid theme="..." />`.
|
|
280
458
|
* Any other string works too if you define `[data-rk-theme="name"]` CSS variables yourself.
|
|
281
459
|
*/
|
|
282
|
-
export declare type GridTheme = "ocean" | "midnight" | "sunset" | "forest";
|
|
460
|
+
export declare type GridTheme = "ocean" | "midnight" | "sunset" | "forest" | "lavender" | "coffee" | "graphite" | "aurora";
|
|
283
461
|
|
|
284
462
|
/** Props received by a column's `headerRenderer` component. */
|
|
285
463
|
export declare interface HeaderRendererProps<T = Record<string, any>> {
|
|
286
464
|
column: ColumnDef<T>;
|
|
465
|
+
/** Direction this column is sorted in, or null when it is not sorted. */
|
|
287
466
|
sortDirection: SortDirection | null;
|
|
288
467
|
}
|
|
289
468
|
|
|
290
469
|
export declare type MoveDirection = "down" | "up" | "left" | "right" | "none";
|
|
291
470
|
|
|
471
|
+
/** Value of a `"number"` filter. Either bound may be missing. */
|
|
472
|
+
export declare interface NumberRangeFilter {
|
|
473
|
+
min?: number;
|
|
474
|
+
max?: number;
|
|
475
|
+
}
|
|
476
|
+
|
|
292
477
|
export declare type PaginationPosition = "bottom" | "top" | "both";
|
|
293
478
|
|
|
294
479
|
declare type Prev = [never, 0, 1, 2, 3, 4, 5];
|
|
295
480
|
|
|
296
481
|
declare type Primitive = string | number | boolean | bigint | symbol | null | undefined | Date | ((...args: any[]) => any);
|
|
297
482
|
|
|
483
|
+
/** The selected rows. `rows` only holds rows that are loaded in the grid right now (matters with `serverSide`). */
|
|
484
|
+
export declare interface RowSelection<T> {
|
|
485
|
+
ids: (string | number)[];
|
|
486
|
+
rows: T[];
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
/** Props received by the `skeletonRow` component, which draws one placeholder row while loading. */
|
|
490
|
+
export declare interface SkeletonRowProps<T = Record<string, any>> {
|
|
491
|
+
/** Position of this placeholder row (0, 1, 2 ...). */
|
|
492
|
+
rowIndex: number;
|
|
493
|
+
/** The columns that are currently visible. */
|
|
494
|
+
columns: ColumnDef<T>[];
|
|
495
|
+
}
|
|
496
|
+
|
|
298
497
|
export declare type SortDirection = "asc" | "desc";
|
|
299
498
|
|
|
499
|
+
/** One sorted column. The grid keeps a list of these (more than one only with `multiSort`). */
|
|
300
500
|
export declare interface SortModel {
|
|
301
501
|
field: string;
|
|
302
502
|
direction: SortDirection;
|
package/dist/react-gridix.cjs
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("react/jsx-runtime"),f=require("react"),ct=require("react-dom"),oe=(...o)=>o.filter(Boolean).join(" ");function ut(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M3.5 8.5l3 3 6-7",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function ft(){return l.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:l.jsx("path",{d:"M4 8h8",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round"})})}function je({checked:o,onChange:d,indeterminate:c=!1,variant:g="native",disabled:P=!1,label:x,"aria-label":m,id:A,name:U,indicator:T,className:W,style:w,classNames:k={},styles:E={}}){const B=c?"indeterminate":o?"checked":"unchecked";return l.jsxs("label",{className:oe("rk-checkbox",`rk-checkbox--${g}`,B==="checked"&&"rk-checkbox--checked",c&&"rk-checkbox--indeterminate",P&&"rk-checkbox--disabled",k.root,W),style:{...E.root,...w},"data-state":B,children:[g==="native"?l.jsx("input",{type:"checkbox",id:A,name:U,ref:y=>{y&&(y.indeterminate=c)},className:oe("rk-checkbox__control",k.control),style:E.control,checked:o,disabled:P,"aria-label":m,"data-state":B,onChange:y=>d(y.target.checked)}):l.jsx("button",{type:"button",role:"checkbox",id:A,className:oe("rk-checkbox__control",k.control),style:E.control,"aria-checked":c?"mixed":o,"aria-label":m,disabled:P,"data-state":B,onClick:()=>d(!o),children:l.jsx("span",{className:oe("rk-checkbox__indicator",T!==void 0&&!c&&"rk-checkbox__indicator--custom",k.indicator),style:E.indicator,"data-state":B,"aria-hidden":"true",children:c?g==="tick"?l.jsx(ft,{}):null:T!==void 0?T:g==="tick"?l.jsx(ut,{}):null})}),x!=null&&x!==!1&&x!==""&&l.jsx("span",{className:oe("rk-checkbox__label",k.label),style:E.label,children:x})]})}const ve=(...o)=>o.filter(Boolean).join(" "),ht=typeof window<"u"?f.useLayoutEffect:f.useEffect;function pt({column:o,label:d,value:c,onChange:g,theme:P,indicatorClassName:x,indicatorStyle:m,popupClassName:A,popupStyle:U,inputClassName:T,inputStyle:W}){const[w,k]=f.useState(!1),[E,B]=f.useState({top:0,left:0}),y=f.useRef(null),z=f.useRef(null),O=c.trim()!=="",$=f.useCallback(()=>{var R;const b=y.current;if(!b)return;const F=b.getBoundingClientRect(),K=((R=z.current)==null?void 0:R.offsetWidth)??260,L=Math.max(8,Math.min(F.left,window.innerWidth-K-8));B({top:F.bottom+6,left:L})},[]);ht(()=>{w&&$()},[w,$]),f.useEffect(()=>{if(!w)return;const b=K=>{var R,ie;const L=K.target;(R=z.current)!=null&&R.contains(L)||(ie=y.current)!=null&&ie.contains(L)||k(!1)},F=K=>{var L;K.key==="Escape"&&(k(!1),(L=y.current)==null||L.focus())};return document.addEventListener("mousedown",b),document.addEventListener("keydown",F),window.addEventListener("resize",$),window.addEventListener("scroll",$,!0),()=>{document.removeEventListener("mousedown",b),document.removeEventListener("keydown",F),window.removeEventListener("resize",$),window.removeEventListener("scroll",$,!0)}},[w,$]);const pe=()=>{var b;k(!1),(b=y.current)==null||b.focus()};return l.jsxs(l.Fragment,{children:[l.jsx("button",{ref:y,type:"button",className:ve("rk-grid__filter-btn",O&&"rk-grid__filter-btn--active",w&&"rk-grid__filter-btn--open",x),style:m,"aria-label":`Filter ${d}`,"aria-haspopup":"dialog","aria-expanded":w,"data-active":O||void 0,onClick:b=>{b.stopPropagation(),w||$(),k(F=>!F)},children:o.filterIndicator?f.createElement(o.filterIndicator,{column:o,active:O,open:w}):l.jsx("span",{className:"rk-grid__filter-dot","aria-hidden":"true"})}),w&&typeof document<"u"&&ct.createPortal(l.jsxs("div",{ref:z,role:"dialog","aria-label":`Filter ${d}`,"data-rk-theme":P||void 0,className:ve("rk-grid-popup",A),style:{position:"fixed",top:E.top,left:E.left,...U},children:[o.filterRenderer?f.createElement(o.filterRenderer,{column:o,value:c,onChange:g}):l.jsx("input",{autoFocus:!0,type:"text",className:ve("rk-grid__filter-input",T),style:W,value:c,placeholder:o.filterPlaceholder??`Filter ${d}…`,"aria-label":`Filter text for ${d}`,onChange:b=>g(b.target.value),onKeyDown:b=>{b.key==="Enter"&&pe()}}),O&&l.jsx("button",{type:"button",className:"rk-grid__filter-clear",onClick:()=>g(""),children:"Clear"})]}),document.body)]})}const we=new Set(["__proto__","prototype","constructor"]),We=(o,d)=>Object.prototype.hasOwnProperty.call(o,d);function V(o,d){if(o===null||typeof o!="object")return;if(We(o,d))return o[d];let c=o;for(const g of d.split(".")){if(c==null||typeof c!="object"||we.has(g))return;c=c[g]}return c}function ze(o,d,c){if(Array.isArray(o)){const g=[...o];return g[d]=c,g}return{...o,[d]:c}}function Ee(o,d,c){const g=o??{};if(We(g,d)||!d.includes("."))return we.has(d)?o:ze(g,d,c);const[P,...x]=d.split(".");if(we.has(P))return o;const m=g[P];return ze(g,P,Ee(m!==null&&typeof m=="object"?m:{},x.join("."),c))}const D=(...o)=>o.filter(Boolean).join(" "),Oe=(o,d)=>`${typeof o}:${o}\0${d}`,Se=o=>o.headerName??(o.type==="boolean"?"":o.field),he=o=>Se(o)||o.field;function ye(o,d){const c=V(d,o.field);return o.valueFormatter?o.valueFormatter(c,d):o.type==="boolean"&&typeof c=="boolean"?c?"Yes":"No":c==null?"":c instanceof Date?c.toLocaleDateString():String(c)}function gt(o,d){return typeof o=="number"&&typeof d=="number"?o-d:o instanceof Date&&d instanceof Date?o.getTime()-d.getTime():typeof o=="boolean"&&typeof d=="boolean"?Number(o)-Number(d):String(o).localeCompare(String(d),void 0,{numeric:!0,sensitivity:"base"})}function bt({columns:o,rows:d,getRowId:c,editable:g=!1,enterMovesDown:P=!0,onCellEdit:x,onRowsChange:m,sortable:A=!0,defaultSort:U=null,onSortChange:T,searchable:W=!0,searchPlaceholder:w="Search…",pagination:k=!0,paginationPosition:E="bottom",pageSize:B=10,pageSizeOptions:y=[5,10,25,50],onRowClick:z,toolbar:O,emptyMessage:$="No rows to show",striped:pe=!1,stripeColors:b,checkboxVariant:F="native",animateRows:K=!0,theme:L,maxHeight:R,className:ie,style:qe,classNames:S={},styles:j={},rowClassName:ge,rowStyle:be}){const _=(e,t)=>({className:D(t,S[e]),style:j[e]}),[Ne,Ce]=f.useState(d),Y=f.useRef(d);f.useEffect(()=>{Y.current=d,Ce(d)},[d]);const De=e=>{Y.current=e,Ce(e)},[H,Ge]=f.useState(""),[Q,Je]=f.useState({}),[v,Ue]=f.useState(U),[Ye,X]=f.useState(0),[I,He]=f.useState(B),[Z,ee]=f.useState(null),q=f.useRef(0),le=f.useRef(null),ke=f.useRef(new Map),Pe=f.useMemo(()=>Ne.map((e,t)=>({row:e,index:t,id:c?c(e,t):t})),[Ne,c]),te=f.useMemo(()=>{const e=H.trim().toLowerCase(),t=Object.entries(Q).filter(([n,i])=>i.trim()!==""&&o.some(s=>s.field===n&&s.filterable));let r=Pe.filter(({row:n})=>e&&!o.some(s=>ye(s,n).toLowerCase().includes(e))?!1:t.every(([i,s])=>{const h=o.find(a=>a.field===i);return h?ye(h,n).toLowerCase().includes(s.trim().toLowerCase()):!0}));if(v){const n=o.find(i=>i.field===v.field);if(n){const i=v.direction==="asc"?1:-1;r=[...r].sort((s,h)=>{const a=V(s.row,n.field),u=V(h.row,n.field),p=a==null||a==="",N=u==null||u==="";return p||N?p===N?0:p?1:-1:(n.comparator?n.comparator(a,u,s.row,h.row):gt(a,u))*i})}}return r},[Pe,o,H,Q,v]);f.useEffect(()=>X(0),[H,Q,v,I]);const Ie=f.useRef(null),G=te.length,re=k?Math.max(1,Math.ceil(G/I)):1,C=Math.min(Ye,re-1),M=k?te.slice(C*I,C*I+I):te,Qe=G===0?0:k?C*I+1:1,Xe=k?Math.min(G,(C+1)*I):G,$e=e=>e.sortable??A,Le=`${C}|${I}|${v?`${v.field}:${v.direction}`:""}|${H}|${JSON.stringify(Q)}`,Te=f.useRef(!0);f.useEffect(()=>{if(Te.current){Te.current=!1;return}const e=Ie.current;e&&typeof e.scrollTo=="function"&&e.scrollTop>0&&e.scrollTo({top:0,behavior:"smooth"})},[Le]);const se=(e,t,r)=>({value:V(t,e.field),formattedValue:ye(e,t),row:t,rowIndex:r,field:e.field,column:e}),xe=(e,t)=>{const r=e.editable??g;return typeof r=="function"?r(t):!!r},ae=(e,t)=>xe(e,t)&&!(e.type==="boolean"&&!e.cellEditor),Ze=(e,t)=>{const r=se(e,t.row,t.index),n=xe(e,r);return{...r,editable:n,updateValue:i=>n&&Fe(t,e,{value:i})}},Be=e=>{if(!$e(e))return;let t;!v||v.field!==e.field?t={field:e.field,direction:"asc"}:v.direction==="asc"?t={field:e.field,direction:"desc"}:t=null,Ue(t),T==null||T(t)},de=(e,t)=>{var r;return(r=ke.current.get(Oe(e,t)))==null?void 0:r.focus()},J=()=>{q.current+=1,ee(null)},ce=(e,t,r={})=>{if(!ae(t,se(t,e.row,e.index)))return!1;const n=V(e.row,t.field),i=t.cellEditor?n:r.text??(n==null?"":String(n));return le.current=i,q.current+=1,ee({id:e.id,field:t.field,draft:i,session:q.current,select:r.select??"end",invalid:!1}),!0},Fe=(e,t,r)=>{const n=Y.current[e.index]??e.row,i=V(n,t.field);let s;if("value"in r)s=r.value;else if(t.valueParser)s=t.valueParser(r.text,n);else if(t.type==="number")if(r.text.trim()==="")s=null;else{const u=Number(r.text);if(!Number.isFinite(u))return!1;s=u}else s=r.text;if(Object.is(s,i))return!0;if(t.validate&&!t.validate(s,n))return!1;const h=Ee(n,t.field,s),a=Y.current.map((u,p)=>p===e.index?h:u);return De(a),x==null||x({rowId:e.id,rowIndex:e.index,field:t.field,oldValue:i,newValue:s,row:h}),m==null||m(a),!0},Me=(e,t,r)=>{const n=M.findIndex(p=>p.id===e.id),i=o.findIndex(p=>p.field===t);if(n<0||i<0)return null;const s=(p,N)=>ae(N,se(N,p.row,p.index));if(r==="down"||r==="up"){const p=r==="down"?1:-1;for(let N=n+p;N>=0&&N<M.length;N+=p)if(s(M[N],o[i]))return{entry:M[N],col:o[i]};return null}const h=r==="right"?1:-1;let a=n,u=i+h;for(;a>=0&&a<M.length;){for(;u>=0&&u<o.length;){if(s(M[a],o[u]))return{entry:M[a],col:o[u]};u+=h}a+=h,u=h>0?0:o.length-1}return null},ne=(e,t,r,n={})=>{const{move:i="none",focus:s=!0}=n;if(!Fe(e,t,r))return ee(a=>a&&{...a,invalid:!0}),!1;const h=i==="none"?null:Me(e,t.field,i);return h?ce(h.entry,h.col,{select:"all"}):(J(),s&&de(e.id,t.field)),!0},et=(e,t,r)=>{if(e.nativeEvent.isComposing)return;const n=e.currentTarget.value;if(e.key==="Enter"){e.preventDefault();const i=P?e.shiftKey?"up":"down":"none";ne(t,r,{text:n},{move:i})}else if(e.key==="Escape")e.preventDefault(),J(),de(t.id,r.field);else if(e.key==="Tab"){const i=e.shiftKey?"left":"right";Me(t,r.field,i)&&(e.preventDefault(),ne(t,r,{text:n},{move:i}))}},tt=(e,t,r,n)=>{e.target!==e.currentTarget||!ae(r,n)||(e.key==="Enter"||e.key==="F2"?(e.preventDefault(),ce(t,r)):!r.cellEditor&&e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),ce(t,r,{text:e.key})))},rt=(e,t,r)=>t.cellEditor?l.jsx("div",{className:"rk-grid__custom-editor",onBlur:n=>{n.currentTarget.contains(n.relatedTarget)||r.session===q.current&&(ne(e,t,{value:le.current},{focus:!1})||J())},onKeyDown:n=>{n.key==="Escape"&&(n.preventDefault(),n.stopPropagation(),J(),de(e.id,t.field))},children:f.createElement(t.cellEditor,{value:r.draft,row:e.row,rowIndex:e.index,field:t.field,column:t,onChange:n=>{le.current=n,ee(i=>i&&i.session===r.session?{...i,draft:n,invalid:!1}:i)},onCommit:(n,i="none")=>{r.session===q.current&&ne(e,t,{value:n===void 0?le.current:n},{move:i})},onCancel:()=>{J(),de(e.id,t.field)}})}):l.jsx("input",{autoFocus:!0,className:D("rk-grid__editor",r.invalid&&"rk-grid__editor--invalid",S.editor),style:{textAlign:t.align,...j.editor},value:r.draft===null||r.draft===void 0?"":String(r.draft),inputMode:t.type==="number"?"decimal":void 0,"aria-label":`Edit ${he(t)}`,"aria-invalid":r.invalid||void 0,onChange:n=>{const i=n.target.value;ee(s=>s&&{...s,draft:i,invalid:!1})},onFocus:n=>{const i=n.currentTarget;r.select==="all"?i.select():i.setSelectionRange(i.value.length,i.value.length)},onBlur:n=>{r.session===q.current&&(ne(e,t,{text:n.currentTarget.value},{focus:!1})||J())},onKeyDown:n=>et(n,e,t)}),Ke=e=>{var r,n,i,s,h,a,u,p;const t=e.checkbox??{};return{variant:t.variant??F,indicator:t.indicator,className:t.className,style:t.style,classNames:{root:D(S.checkbox,(r=t.classNames)==null?void 0:r.root),control:D(S.checkboxControl,(n=t.classNames)==null?void 0:n.control),indicator:D(S.checkboxIndicator,(i=t.classNames)==null?void 0:i.indicator),label:(s=t.classNames)==null?void 0:s.label},styles:{root:{...j.checkbox,...(h=t.styles)==null?void 0:h.root},control:{...j.checkboxControl,...(a=t.styles)==null?void 0:a.control},indicator:{...j.checkboxIndicator,...(u=t.styles)==null?void 0:u.indicator},label:(p=t.styles)==null?void 0:p.label}}},ue=e=>e.stopPropagation(),nt=(e,t)=>l.jsx("span",{className:"rk-grid__checkbox-cell",onClick:ue,onDoubleClick:ue,children:l.jsx(je,{...Ke(e),checked:!!t.value,disabled:!t.editable,"aria-label":`Toggle ${he(e)}`,onChange:r=>t.updateValue(r)})}),Re=e=>te.filter(t=>xe(e,se(e,t.row,t.index))),ot=(e,t)=>{const r=new Map(Re(e).map(s=>[s.index,s])),n=[],i=Y.current.map((s,h)=>{const a=r.get(h);if(!a)return s;const u=V(s,e.field);if(!!u===t||e.validate&&!e.validate(t,s))return s;const p=Ee(s,e.field,t);return n.push({rowId:a.id,rowIndex:h,field:e.field,oldValue:u,newValue:t,row:p}),p});n.length!==0&&(De(i),n.forEach(s=>x==null?void 0:x(s)),m==null||m(i))},it=e=>{const t=Re(e),r=t.length>0?t:te,n=r.filter(s=>!!V(s.row,e.field)).length,i=r.length>0&&n===r.length;return l.jsx("span",{className:"rk-grid__header-checkbox",onClick:ue,onDoubleClick:ue,children:l.jsx(je,{...Ke(e),checked:i,indeterminate:n>0&&!i,disabled:t.length===0,label:Se(e)||void 0,"aria-label":`Select all ${he(e)}`,onChange:s=>ot(e,s)})})},lt=pe||!!b,st=b?{"--rk-stripe-a":b[0],"--rk-stripe-b":b[1]}:void 0,at=k&&(E==="top"||E==="both"),dt=!k||E==="bottom"||E==="both",Ve=e=>l.jsxs("div",{className:D("rk-grid__footer",e==="top"&&"rk-grid__footer--top",S.footer),style:j.footer,"data-position":e,children:[l.jsx("span",{..._("rowCount","rk-grid__count"),children:G===0?"0 rows":`${Qe}–${Xe} of ${G}`}),k&&l.jsxs("div",{..._("pagination","rk-grid__pagination"),children:[l.jsxs("label",{className:"rk-grid__page-size-label",children:["Rows per page",l.jsx("select",{value:I,onChange:t=>He(Number(t.target.value)),..._("pageSize","rk-grid__page-size"),children:(y.includes(I)?y:[...y,I].sort((t,r)=>t-r)).map(t=>l.jsx("option",{value:t,children:t},t))})]}),l.jsx("button",{type:"button","aria-label":"First page",disabled:C===0,onClick:()=>X(0),..._("pageButton","rk-grid__page-btn"),children:"«"}),l.jsx("button",{type:"button","aria-label":"Previous page",disabled:C===0,onClick:()=>X(C-1),..._("pageButton","rk-grid__page-btn"),children:"‹"}),l.jsxs("span",{..._("pageInfo","rk-grid__page-info"),children:["Page ",C+1," of ",re]}),l.jsx("button",{type:"button","aria-label":"Next page",disabled:C>=re-1,onClick:()=>X(C+1),..._("pageButton","rk-grid__page-btn"),children:"›"}),l.jsx("button",{type:"button","aria-label":"Last page",disabled:C>=re-1,onClick:()=>X(re-1),..._("pageButton","rk-grid__page-btn"),children:"»"})]})]});return l.jsxs("div",{className:D("rk-grid",S.root,ie),style:{...st,...j.root,...qe},"data-rk-theme":L||void 0,children:[(W||O)&&l.jsxs("div",{..._("toolbar","rk-grid__toolbar"),children:[W?l.jsx("input",{type:"search",value:H,onChange:e=>Ge(e.target.value),placeholder:w,"aria-label":"Search all columns",..._("search","rk-grid__search")}):l.jsx("span",{}),O]}),at&&Ve("top"),l.jsx("div",{ref:Ie,..._("scroll","rk-grid__scroll"),style:{...j.scroll,...R!==void 0?{maxHeight:R}:null},children:l.jsxs("table",{..._("table","rk-grid__table"),role:"grid",children:[l.jsx("thead",{..._("thead","rk-grid__thead"),children:l.jsx("tr",{..._("headerRow","rk-grid__tr"),children:o.map(e=>{const t=(v==null?void 0:v.field)===e.field?v.direction:null,r=$e(e);return l.jsx("th",{scope:"col","aria-sort":t?t==="asc"?"ascending":"descending":r?"none":void 0,tabIndex:r?0:void 0,onClick:()=>Be(e),onKeyDown:n=>{r&&n.target===n.currentTarget&&(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),Be(e))},className:D("rk-grid__th",r&&"rk-grid__th--sortable",S.headerCell,e.className,e.headerClassName),style:{width:e.width,minWidth:e.minWidth,textAlign:e.align,...j.headerCell,...e.style,...e.headerStyle},children:l.jsxs("span",{className:"rk-grid__th-content",children:[e.headerRenderer?f.createElement(e.headerRenderer,{column:e,sortDirection:t}):e.headerCheckbox&&e.type==="boolean"?it(e):Se(e),e.filterable&&l.jsx(pt,{column:e,label:he(e),value:Q[e.field]??"",onChange:n=>Je(i=>({...i,[e.field]:n})),theme:L,indicatorClassName:D(S.filterIndicator,e.filterIndicatorClassName),indicatorStyle:{...j.filterIndicator,...e.filterIndicatorStyle},popupClassName:D(S.filterPopup,e.filterPopupClassName),popupStyle:{...j.filterPopup,...e.filterPopupStyle},inputClassName:S.filterInput,inputStyle:j.filterInput}),r&&l.jsx("span",{className:"rk-grid__sort","aria-hidden":"true",children:t==="asc"?"▲":t==="desc"?"▼":"↕"})]})},e.field)})})}),l.jsx("tbody",{..._("tbody","rk-grid__tbody"),children:M.length===0?l.jsx("tr",{children:l.jsx("td",{colSpan:o.length,..._("empty","rk-grid__empty"),children:$})}):M.map((e,t)=>{const{row:r,id:n,index:i}=e,s=typeof ge=="function"?ge(r,i):ge,h=typeof be=="function"?be(r,i):be;return l.jsx("tr",{onClick:z?()=>z(r,i):void 0,className:D("rk-grid__tr","rk-grid__row",lt&&(t%2===0?"rk-grid__row--stripe-a":"rk-grid__row--stripe-b"),K&&"rk-grid__row--enter",z&&"rk-grid__row--clickable",S.row,s),style:{...K?{"--rk-i":Math.min(t,24)}:null,...j.row,...h},children:o.map(a=>{const u=Ze(a,e),p=typeof a.cellClassName=="function"?a.cellClassName(u):a.cellClassName,N=typeof a.cellStyle=="function"?a.cellStyle(u):a.cellStyle,_e=Z!==null&&Z.id===n&&Z.field===a.field,me=ae(a,u);return l.jsx("td",{ref:fe=>{const Ae=Oe(n,a.field);fe?ke.current.set(Ae,fe):ke.current.delete(Ae)},tabIndex:me?0:void 0,onDoubleClick:me?()=>ce(e,a):void 0,onKeyDown:fe=>tt(fe,e,a,u),className:D("rk-grid__td",me&&"rk-grid__td--editable",_e&&"rk-grid__td--editing",S.cell,a.className,p),style:{textAlign:a.align,...j.cell,...a.style,...N},children:_e&&Z?rt(e,a,Z):a.cellRenderer?f.createElement(a.cellRenderer,u):a.type==="boolean"&&!a.cellEditor?nt(a,u):u.formattedValue},a.field)})},n)})},Le)]})}),dt&&Ve("bottom")]})}exports.Checkbox=je;exports.DataGrid=bt;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),h=require("react"),yn=require("react-dom"),ye=(...r)=>r.filter(Boolean).join(" ");function vn(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M3.5 8.5l3 3 6-7",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round",strokeLinejoin:"round"})})}function jn(){return o.jsx("svg",{viewBox:"0 0 16 16",width:"100%",height:"100%","aria-hidden":"true",focusable:"false",children:o.jsx("path",{d:"M4 8h8",fill:"none",stroke:"currentColor",strokeWidth:"2.2",strokeLinecap:"round"})})}function ee({checked:r,onChange:a,indeterminate:c=!1,variant:d="native",disabled:g=!1,label:f,"aria-label":x,id:_,name:w,indicator:L,className:F,style:b,classNames:C={},styles:E={}}){const M=c?"indeterminate":r?"checked":"unchecked";return o.jsxs("label",{className:ye("rk-checkbox",`rk-checkbox--${d}`,M==="checked"&&"rk-checkbox--checked",c&&"rk-checkbox--indeterminate",g&&"rk-checkbox--disabled",C.root,F),style:{...E.root,...b},"data-state":M,children:[d==="native"?o.jsx("input",{type:"checkbox",id:_,name:w,ref:I=>{I&&(I.indeterminate=c)},className:ye("rk-checkbox__control",C.control),style:E.control,checked:r,disabled:g,"aria-label":x,"data-state":M,onChange:I=>a(I.target.checked)}):o.jsx("button",{type:"button",role:"checkbox",id:_,className:ye("rk-checkbox__control",C.control),style:E.control,"aria-checked":c?"mixed":r,"aria-label":x,disabled:g,"data-state":M,onClick:()=>a(!r),children:o.jsx("span",{className:ye("rk-checkbox__indicator",L!==void 0&&!c&&"rk-checkbox__indicator--custom",C.indicator),style:E.indicator,"data-state":M,"aria-hidden":"true",children:c?d==="tick"?o.jsx(jn,{}):null:L!==void 0?L:d==="tick"?o.jsx(vn,{}):null})}),f!=null&&f!==!1&&f!==""&&o.jsx("span",{className:ye("rk-checkbox__label",C.label),style:E.label,children:f})]})}const wn=/^(\d{4})-(\d{2})-(\d{2})$/,fr=r=>String(r).padStart(2,"0");function we(r){const a=wn.exec(r);if(!a)return null;const[c,d,g]=[Number(a[1]),Number(a[2]),Number(a[3])],f=new Date(c,d-1,g);return f.getFullYear()===c&&f.getMonth()===d-1&&f.getDate()===g?f:null}function U(r){var a;if(r instanceof Date)return Number.isNaN(r.getTime())?null:`${r.getFullYear()}-${fr(r.getMonth()+1)}-${fr(r.getDate())}`;if(typeof r=="number")return Number.isFinite(r)?U(new Date(r)):null;if(typeof r=="string"){const c=r.trim();if(c==="")return null;const d=(a=/^\d{4}-\d{2}-\d{2}/.exec(c))==null?void 0:a[0];if(d)return we(d)?d:null;const g=Date.parse(c);return Number.isNaN(g)?null:U(new Date(g))}return null}function Nn(r,a,c){const d=U(r);return d?we(d).toLocaleDateString(a,c??{year:"numeric",month:"short",day:"numeric"}):r==null?"":String(r)}function En(r,a){var c;return r===""?null:a instanceof Date?we(r):typeof a=="number"?((c=we(r))==null?void 0:c.getTime())??null:r}function ur(r){return r.filterType?r.filterType:r.type==="number"?"number":r.type==="date"?"date":r.type==="boolean"?"select":"text"}const Sn=r=>typeof r=="object"&&r!==null&&!Array.isArray(r);function mr(r){if(r==null)return!1;if(typeof r=="string")return r.trim()!=="";if(Array.isArray(r))return r.length>0;if(Sn(r)){const a=r;return typeof a.min=="number"||typeof a.max=="number"||!!a.from||!!a.to}return!1}function Cn(r,a,c,d){switch(r){case"text":return c.toLowerCase().includes(String(a).trim().toLowerCase());case"exact":return c.toLowerCase()===String(a).trim().toLowerCase();case"number":{const{min:g,max:f}=a,x=typeof d=="number"?d:d==null||d===""?NaN:Number(d);return Number.isNaN(x)?!1:(typeof g!="number"||x>=g)&&(typeof f!="number"||x<=f)}case"date":{const{from:g,to:f}=a,x=U(d);return x?(!g||x>=g)&&(!f||x<=f):!1}case"select":return a.includes(String(d??""))}}function Dn(r,a,c,d){if(r.filterOptions)return r.filterOptions.map(f=>typeof f=="string"?{value:f,label:f}:f);if(r.type==="boolean")return[{value:"true",label:"Yes"},{value:"false",label:"No"}];const g=new Map;for(const f of a){const x=c(f);if(x==null||x==="")continue;const _=String(x);g.has(_)||g.set(_,d(f))}return[...g].map(([f,x])=>({value:f,label:x})).sort((f,x)=>f.label.localeCompare(x.label,void 0,{numeric:!0}))}const Et=typeof window<"u"?h.useLayoutEffect:h.useEffect;function ve(r,a,c){const[d,g]=h.useState(a),f=r!==void 0,x=f?r:d,_=h.useCallback(w=>{f||g(w),c==null||c(w)},[f,c]);return[x,_]}const S=(...r)=>r.filter(Boolean).join(" "),Ze=r=>r.headerName??(r.type==="boolean"?"":r.field),fe=r=>Ze(r)||r.field;function xr({anchorRef:r,open:a,onClose:c,label:d,theme:g,className:f,style:x,children:_}){const w=h.useRef(null),[L,F]=h.useState({top:0,left:0}),b=h.useCallback(()=>{var O;const C=r.current;if(!C)return;const E=C.getBoundingClientRect(),M=((O=w.current)==null?void 0:O.offsetWidth)??260,I=Math.max(8,Math.min(E.left,window.innerWidth-M-8));F({top:E.bottom+6,left:I})},[r]);return Et(()=>{a&&b()},[a,b]),h.useEffect(()=>{if(!a)return;const C=M=>{var O,te;const I=M.target;(O=w.current)!=null&&O.contains(I)||(te=r.current)!=null&&te.contains(I)||c()},E=M=>{var I;M.key==="Escape"&&(c(),(I=r.current)==null||I.focus())};return document.addEventListener("mousedown",C),document.addEventListener("keydown",E),window.addEventListener("resize",b),window.addEventListener("scroll",b,!0),()=>{document.removeEventListener("mousedown",C),document.removeEventListener("keydown",E),window.removeEventListener("resize",b),window.removeEventListener("scroll",b,!0)}},[a,c,b,r]),!a||typeof document>"u"?null:yn.createPortal(o.jsx("div",{ref:w,role:"dialog","aria-label":d,"data-rk-theme":g||void 0,className:S("rk-grid-popup",f),style:{position:"fixed",top:L.top,left:L.left,...x},children:_}),document.body)}const Qe=r=>{if(r.trim()==="")return;const a=Number(r);return Number.isFinite(a)?a:void 0},br=r=>typeof r=="object"&&r!==null&&!Array.isArray(r);function Mn({value:r,onChange:a,label:c,inputClassName:d,inputStyle:g}){const f=br(r)?r:{},[x,_]=h.useState(f.min===void 0?"":String(f.min)),[w,L]=h.useState(f.max===void 0?"":String(f.max));h.useEffect(()=>{Qe(x)!==f.min&&_(f.min===void 0?"":String(f.min)),Qe(w)!==f.max&&L(f.max===void 0?"":String(f.max))},[f.min,f.max]);const F=(b,C)=>{const E=Qe(b),M=Qe(C);a(E===void 0&&M===void 0?void 0:{min:E,max:M})};return o.jsxs("div",{className:"rk-grid__filter-fields",children:[o.jsxs("label",{className:"rk-grid__filter-field",children:[o.jsx("span",{children:"Min"}),o.jsx("input",{autoFocus:!0,type:"number",className:S("rk-grid__filter-input",d),style:g,value:x,"aria-label":`Minimum ${c}`,onChange:b=>{_(b.target.value),F(b.target.value,w)}})]}),o.jsxs("label",{className:"rk-grid__filter-field",children:[o.jsx("span",{children:"Max"}),o.jsx("input",{type:"number",className:S("rk-grid__filter-input",d),style:g,value:w,"aria-label":`Maximum ${c}`,onChange:b=>{L(b.target.value),F(x,b.target.value)}})]})]})}function Tn({value:r,onChange:a,label:c,inputClassName:d,inputStyle:g}){const f=br(r)?r:{},x=(_,w)=>a(!_&&!w?void 0:{from:_||void 0,to:w||void 0});return o.jsxs("div",{className:"rk-grid__filter-fields",children:[o.jsxs("label",{className:"rk-grid__filter-field",children:[o.jsx("span",{children:"From"}),o.jsx("input",{autoFocus:!0,type:"date",className:S("rk-grid__filter-input",d),style:g,value:f.from??"","aria-label":`${c} from`,onChange:_=>x(_.target.value,f.to)})]}),o.jsxs("label",{className:"rk-grid__filter-field",children:[o.jsx("span",{children:"To"}),o.jsx("input",{type:"date",className:S("rk-grid__filter-input",d),style:g,value:f.to??"","aria-label":`${c} to`,onChange:_=>x(f.from,_.target.value)})]})]})}function In({value:r,onChange:a,options:c}){const d=Array.isArray(r)?r:[],g=(f,x)=>{const _=x?[...d,f]:d.filter(w=>w!==f);a(_.length?_:void 0)};return o.jsxs("div",{className:"rk-grid__filter-fields rk-grid__filter-options",role:"group",children:[c.length===0&&o.jsx("span",{className:"rk-grid__filter-empty",children:"No values"}),c.map(f=>o.jsx(ee,{checked:d.includes(f.value),onChange:x=>g(f.value,x),label:f.label??f.value},f.value))]})}function Ln({column:r,label:a,kind:c,value:d,onChange:g,options:f,theme:x,indicatorClassName:_,indicatorStyle:w,popupClassName:L,popupStyle:F,inputClassName:b,inputStyle:C}){const[E,M]=h.useState(!1),I=h.useRef(null),O=mr(d),te=h.useCallback(()=>M(!1),[]),Ne=typeof d=="string"?d:"",et=()=>{if(r.filterRenderer)return h.createElement(r.filterRenderer,{column:r,value:Ne,onChange:W=>g(W||void 0)});switch(c){case"number":return o.jsx(Mn,{value:d,onChange:g,label:a,inputClassName:b,inputStyle:C});case"date":return o.jsx(Tn,{value:d,onChange:g,label:a,inputClassName:b,inputStyle:C});case"select":return o.jsx(In,{value:d,onChange:g,options:f});default:return o.jsx("input",{autoFocus:!0,type:"text",className:S("rk-grid__filter-input",b),style:C,value:Ne,placeholder:r.filterPlaceholder??(c==="exact"?"Exactly…":`Filter ${a}…`),"aria-label":`Filter text for ${a}`,onChange:W=>g(W.target.value||void 0),onKeyDown:W=>{var re;W.key==="Enter"&&(M(!1),(re=I.current)==null||re.focus())}})}};return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:I,type:"button",className:S("rk-grid__filter-btn",O&&"rk-grid__filter-btn--active",E&&"rk-grid__filter-btn--open",_),style:w,"aria-label":`Filter ${a}`,"aria-haspopup":"dialog","aria-expanded":E,"data-active":O||void 0,onClick:W=>{W.stopPropagation(),M(re=>!re)},onKeyDown:W=>W.stopPropagation(),children:r.filterIndicator?h.createElement(r.filterIndicator,{column:r,active:O,open:E}):o.jsx("span",{className:"rk-grid__filter-dot","aria-hidden":"true"})}),o.jsxs(xr,{anchorRef:I,open:E,onClose:te,label:`Filter ${a}`,theme:x,className:L,style:F,children:[et(),O&&o.jsx("button",{type:"button",className:"rk-grid__filter-clear",onClick:()=>g(void 0),children:"Clear"})]})]})}function Fn({columns:r,hidden:a,onToggle:c,theme:d,className:g,style:f}){const[x,_]=h.useState(!1),w=h.useRef(null),L=h.useCallback(()=>_(!1),[]),F=r.filter(b=>!a.has(b.field)).length;return o.jsxs(o.Fragment,{children:[o.jsx("button",{ref:w,type:"button",className:S("rk-grid__tool-btn",g),style:f,"aria-haspopup":"dialog","aria-expanded":x,onClick:()=>_(b=>!b),children:"Columns"}),o.jsx(xr,{anchorRef:w,open:x,onClose:L,label:"Show or hide columns",theme:d,children:o.jsx("div",{className:"rk-grid__filter-fields rk-grid__filter-options",role:"group","aria-label":"Columns",children:r.filter(b=>b.hideable!==!1).map(b=>{const C=!a.has(b.field);return o.jsx(ee,{checked:C,disabled:C&&F<=1,onChange:E=>c(b.field,!E),label:fe(b)},b.field)})})})]})}const Rn=/^[=+\-@\t\r]/;function $n(r,a,c){if(r==null)return"";let d=String(r);return c&&typeof r=="string"&&Rn.test(d)&&!Number.isFinite(Number(d))&&(d=`'${d}`),d.includes(a)||/["\r\n]/.test(d)?`"${d.replace(/"/g,'""')}"`:d}function On(r,a,c={}){const{delimiter:d=",",sanitize:g=!0}=c,f=x=>x.map(_=>$n(_,d,g)).join(d);return[f(r),...a.map(f)].join(`\r
|
|
2
|
+
`)}function Pn(r,a){if(typeof document>"u")return;const c=new Blob(["\uFEFF",r],{type:"text/csv;charset=utf-8"}),d=URL.createObjectURL(c),g=document.createElement("a");g.href=d,g.download=a,g.style.display="none",document.body.appendChild(g),g.click(),g.remove(),setTimeout(()=>URL.revokeObjectURL(d),1e3)}const St=new Set(["__proto__","prototype","constructor"]),kr=(r,a)=>Object.prototype.hasOwnProperty.call(r,a);function B(r,a){if(r===null||typeof r!="object")return;if(kr(r,a))return r[a];let c=r;for(const d of a.split(".")){if(c==null||typeof c!="object"||St.has(d))return;c=c[d]}return c}function hr(r,a,c){if(Array.isArray(r)){const d=[...r];return d[a]=c,d}return{...r,[a]:c}}function Ct(r,a,c){const d=r??{};if(kr(d,a)||!a.includes("."))return St.has(a)?r:hr(d,a,c);const[g,...f]=a.split(".");if(St.has(g))return r;const x=d[g];return hr(d,g,Ct(x!==null&&typeof x=="object"?x:{},f.join("."),c))}const G=44,An=150,pr=10,Nt=(r,a)=>`${typeof r}:${r}\0${a}`;function je(r,a){const c=B(a,r.field);return r.valueFormatter?r.valueFormatter(c,a):r.type==="boolean"&&typeof c=="boolean"?c?"Yes":"No":r.type==="date"?Nn(c,r.dateLocale,r.dateFormat):c==null?"":c instanceof Date?c.toLocaleDateString():String(c)}function Kn(r,a,c){if(c.type==="date"){const d=U(r)??"",g=U(a)??"";return d<g?-1:d>g?1:0}return typeof r=="number"&&typeof a=="number"?r-a:r instanceof Date&&a instanceof Date?r.getTime()-a.getTime():typeof r=="boolean"&&typeof a=="boolean"?Number(r)-Number(a):String(r).localeCompare(String(a),void 0,{numeric:!0,sensitivity:"base"})}const Bn=r=>r?Array.isArray(r)?r:[r]:[],gr=r=>r.type==="date"&&r.validity.badInput;function Wn({columns:r,rows:a,getRowId:c,editable:d=!1,enterMovesDown:g=!0,onCellEdit:f,onRowsChange:x,rowSelection:_=!1,selectedRowIds:w,defaultSelectedRowIds:L,onSelectionChange:F,isRowSelectable:b,sort:C,defaultSort:E=null,onSortChange:M,multiSort:I=!1,searchable:O=!1,searchPlaceholder:te="Search…",search:Ne,onSearchChange:et,filters:W,onFiltersChange:re,pagination:z=!1,paginationPosition:Ee="bottom",pageSize:_r=10,pageSizeOptions:tt=[5,10,25,50],page:yr,onPageChange:vr,onPageSizeChange:rt,serverSide:K=!1,rowCount:jr,onQueryChange:Dt,queryDebounce:Mt=250,loading:wr,loadingRows:Nr,skeletonRow:Tt,errorMessage:Er="Could not load the data.",columnMenu:It=!1,onColumnVisibilityChange:nt,keyboardNavigation:it=!1,virtualize:V=!1,rowHeight:H=40,overscan:Lt=6,exportable:Se=!1,apiRef:ue,onRowClick:ot,toolbar:Ft,emptyMessage:Sr="No rows to show",striped:Cr=!1,stripeColors:Ce,checkboxVariant:st="native",animateRows:Rt=!0,theme:lt,maxHeight:De,className:Dr,style:Mr,classNames:D={},styles:v={},rowClassName:at,rowStyle:ct}){const T=(e,t)=>({className:S(t,D[e]),style:v[e]}),[Me,$t]=h.useState(a),ne=h.useRef(a);h.useEffect(()=>{ne.current=a,$t(a)},[a]);const Ot=e=>{ne.current=e,$t(e)},[he,Tr]=ve(Ne,"",et),[ie,Ir]=ve(W,{},re),[P,Lr]=ve(C,Bn(E),M),[dt,oe]=ve(yr,0,vr),[R,Fr]=h.useState(_r),Rr=e=>{Fr(e),rt==null||rt(e)},[Te,$r]=h.useState(()=>new Set(r.filter(e=>e.hidden).map(e=>e.field))),Or=(e,t)=>{const n=new Set(Te);t?n.add(e):n.delete(e),$r(n),nt==null||nt([...n])},[ft,Pt]=h.useState({}),[Ie,Pr]=h.useState({}),[Vn,Ar]=h.useState(0),pe=h.useRef(new Map),[ge,se]=h.useState(null),le=h.useRef(0),Le=h.useRef(null),Fe=h.useRef(new Map),[ut,At]=h.useState(null),ht=h.useRef(null),me=h.useRef(null),[pt,Kt]=h.useState({top:0,height:0}),y=h.useMemo(()=>{const e=r.filter(t=>!Te.has(t.field));return[...e.filter(t=>t.pinned==="left"),...e.filter(t=>t.pinned!=="left"&&t.pinned!=="right"),...e.filter(t=>t.pinned==="right")]},[r,Te]),gt=e=>e.sortable===!0,A=_==="single"?"single":_?"multiple":null,xe=y.length+(A?1:0),ae=h.useMemo(()=>Me.map((e,t)=>({row:e,index:t,id:c?c(e,t):t})),[Me,c]),Bt=h.useRef(new Map);ae.forEach(e=>Bt.current.set(e.id,e.row));const Re=h.useMemo(()=>Object.entries(ie).filter(([e,t])=>{const n=y.find(l=>l.field===e);return!!n&&!!n.filterable&&mr(t)}),[ie,y]),[Kr,Br]=h.useState(he);h.useEffect(()=>{if(!K)return;const e=setTimeout(()=>Br(he),Mt);return()=>clearTimeout(e)},[he,K,Mt]);const ce=K?Kr:he,Wt=e=>e.filterRenderer?"text":ur(e),J=h.useMemo(()=>{if(K)return ae;const e=ce.trim().toLowerCase();let t=ae.filter(({row:l})=>e&&!y.some(i=>je(i,l).toLowerCase().includes(e))?!1:Re.every(([i,s])=>{const m=y.find(p=>p.field===i);return Cn(Wt(m),s,je(m,l),B(l,i))}));const n=P.map(l=>({col:y.find(i=>i.field===l.field),dir:l.direction==="asc"?1:-1})).filter(l=>!!l.col);return n.length&&(t=[...t].sort((l,i)=>{for(const{col:s,dir:m}of n){const p=B(l.row,s.field),u=B(i.row,s.field),k=p==null||p==="",N=u==null||u==="";if(k||N){if(k!==N)return k?1:-1;continue}const Xe=s.comparator?s.comparator(p,u,l.row,i.row):Kn(p,u,s);if(Xe!==0)return Xe*m}return 0})),t},[ae,y,ce,Re,P,K]),$e=JSON.stringify([ce,ie,P,R]),Vt=h.useRef($e);h.useEffect(()=>{Vt.current!==$e&&(Vt.current=$e,oe(0))},[$e]);const de=K?jr??ae.length:J.length,Y=z?Math.max(1,Math.ceil(de/R)):1,$=Math.min(dt,Y-1),j=z&&!K?J.slice($*R,$*R+R):J,Wr=de===0?0:z?$*R+1:1,Vr=z?Math.min(de,($+1)*R):de,mt=h.useMemo(()=>({sort:P.filter(e=>{const t=r.find(n=>n.field===e.field);return!!t&>(t)}),filters:Object.fromEntries(Re),search:ce.trim(),page:$,pageSize:R}),[P,r,Re,ce,$,R]),Ur=JSON.stringify(mt),Oe=h.useRef(mt);Oe.current=mt;const Pe=h.useRef(Dt);Pe.current=Dt;const[qr,Ae]=h.useState(!1),[zr,xt]=h.useState(!1),bt=h.useRef(0),Ke=h.useCallback(e=>{var l;const t=++bt.current,n=(l=Pe.current)==null?void 0:l.call(Pe,e);n&&typeof n.then=="function"?(Ae(!0),xt(!1),n.then(()=>{t===bt.current&&Ae(!1)},()=>{t===bt.current&&(Ae(!1),xt(!0))})):(Ae(!1),xt(!1))},[]);h.useEffect(()=>{K&&Ke(Oe.current)},[K,Ur,Ke]),h.useEffect(()=>{K&&z&&dt>Y-1&&oe(Y-1)},[K,z,dt,Y]);const kt=wr??qr,Ut=e=>e.map(t=>Bt.current.get(t)).filter(t=>t!==void 0),[q,Be]=ve(w,L??[],e=>F==null?void 0:F({ids:e,rows:Ut(e)})),_t=h.useMemo(()=>new Set(q),[q]),We=e=>b?b(e):!0,Ve=h.useRef(null),qt=h.useRef(!1),Hr=(e,t)=>{if(!A||!We(e.row))return;if(A==="single"){Be(t?[e.id]:[]),Ve.current=e.id;return}const n=new Set(q),l=qt.current&&Ve.current!==null?j.findIndex(s=>s.id===Ve.current):-1,i=j.findIndex(s=>s.id===e.id);if(l>=0&&i>=0)for(let s=Math.min(l,i);s<=Math.max(l,i);s++)We(j[s].row)&&(t?n.add(j[s].id):n.delete(j[s].id));else t?n.add(e.id):n.delete(e.id);Ve.current=e.id,Be([...n])},be=h.useMemo(()=>J.filter(e=>We(e.row)),[J,b]),zt=be.filter(e=>_t.has(e.id)).length,Ht=be.length>0&&zt===be.length,Jt=e=>{const t=new Set(q);be.forEach(n=>e?t.add(n.id):t.delete(n.id)),Be([...t])},Ue=(e,t,n)=>({value:B(t,e.field),formattedValue:je(e,t),row:t,rowIndex:n,field:e.field,column:e}),yt=(e,t)=>{const n=e.editable??d;return typeof n=="function"?n(t):!!n},qe=(e,t)=>yt(e,t)&&!(e.type==="boolean"&&!e.cellEditor),Jr=(e,t)=>{const n=Ue(e,t.row,t.index),l=yt(e,n);return{...n,editable:l,updateValue:i=>l&&Gt(t,e,{value:i})}},Yt=(e,t)=>{if(!gt(e))return;const n=P.find(s=>s.field===e.field),l=n?n.direction==="asc"?"desc":null:"asc";let i;t&&I?l?n?i=P.map(s=>s.field===e.field?{...s,direction:l}:s):i=[...P,{field:e.field,direction:l}]:i=P.filter(s=>s.field!==e.field):i=l?[{field:e.field,direction:l}]:[],Lr(i)},ze=(e,t)=>{var n;return(n=Fe.current.get(Nt(e,t)))==null?void 0:n.focus()},X=()=>{le.current+=1,se(null)},Yr=e=>{for(const t of ne.current){const n=B(t,e.field);if(n!=null&&n!=="")return n}},He=(e,t,n={})=>{if(!qe(t,Ue(t,e.row,e.index)))return!1;const l=B(e.row,t.field);let i;return t.cellEditor?i=l:t.type==="date"?i=U(l)??"":i=n.text??(l==null?"":String(l)),Le.current=i,le.current+=1,se({id:e.id,field:t.field,draft:i,session:le.current,select:n.select??"end",invalid:!1}),!0},Gt=(e,t,n)=>{const l=ne.current[e.index]??e.row,i=B(l,t.field);let s;if("value"in n)s=n.value;else if(t.valueParser)s=t.valueParser(n.text,l);else if(t.type==="date"){if(n.text!==""&&!we(n.text))return!1;s=En(n.text,i??Yr(t))}else if(t.type==="number")if(n.text.trim()==="")s=null;else{const u=Number(n.text);if(!Number.isFinite(u))return!1;s=u}else s=n.text;if(t.type==="date"){if(U(s)===U(i))return!0;const u=U(s);if(u&&(t.dateMin&&u<t.dateMin||t.dateMax&&u>t.dateMax))return!1}else if(Object.is(s,i))return!0;if(t.validate&&!t.validate(s,l))return!1;const m=Ct(l,t.field,s),p=ne.current.map((u,k)=>k===e.index?m:u);return Ot(p),f==null||f({rowId:e.id,rowIndex:e.index,field:t.field,oldValue:i,newValue:s,row:m}),x==null||x(p),!0},Xt=(e,t,n)=>{const l=j.findIndex(k=>k.id===e.id),i=y.findIndex(k=>k.field===t);if(l<0||i<0)return null;const s=(k,N)=>qe(N,Ue(N,k.row,k.index));if(n==="down"||n==="up"){const k=n==="down"?1:-1;for(let N=l+k;N>=0&&N<j.length;N+=k)if(s(j[N],y[i]))return{entry:j[N],col:y[i]};return null}const m=n==="right"?1:-1;let p=l,u=i+m;for(;p>=0&&p<j.length;){for(;u>=0&&u<y.length;){if(s(j[p],y[u]))return{entry:j[p],col:y[u]};u+=m}p+=m,u=m>0?0:y.length-1}return null},ke=(e,t,n,l={})=>{const{move:i="none",focus:s=!0}=l;if(!Gt(e,t,n))return se(p=>p&&{...p,invalid:!0}),!1;const m=i==="none"?null:Xt(e,t.field,i);return m?He(m.entry,m.col,{select:"all"}):(X(),s&&ze(e.id,t.field)),!0},Gr=(e,t,n)=>{if(e.nativeEvent.isComposing)return;const l=e.currentTarget.value,i=gr(e.currentTarget);if(e.key==="Enter"){if(e.preventDefault(),i)return se(m=>m&&{...m,invalid:!0});const s=g?e.shiftKey?"up":"down":"none";ke(t,n,{text:l},{move:s})}else if(e.key==="Escape")e.preventDefault(),X(),ze(t.id,n.field);else if(e.key==="Tab"&&!i){const s=e.shiftKey?"left":"right";Xt(t,n.field,s)&&(e.preventDefault(),ke(t,n,{text:l},{move:s}))}},Xr=(e,t)=>{var s;const n=j[e],l=y[t];if(!n||!l)return;At({id:n.id,field:l.field}),ht.current=Nt(n.id,l.field);const i=me.current;if(V&&i){const m=((s=i.querySelector("thead"))==null?void 0:s.clientHeight)??0,p=e*H;p<i.scrollTop?i.scrollTo({top:p,behavior:"auto"}):p+H>i.scrollTop+i.clientHeight-m&&i.scrollTo({top:p+H-i.clientHeight+m,behavior:"auto"})}};h.useEffect(()=>{const e=ht.current;if(!e)return;const t=Fe.current.get(e);t&&(ht.current=null,t.focus())});const Qr=(e,t,n)=>{if(!it)return!1;let l=j.findIndex(s=>s.id===t.id),i=y.findIndex(s=>s.field===n.field);if(l<0||i<0)return!1;switch(e.key){case"ArrowDown":l+=1;break;case"ArrowUp":l-=1;break;case"ArrowRight":i+=1;break;case"ArrowLeft":i-=1;break;case"PageDown":l+=pr;break;case"PageUp":l-=pr;break;case"Home":i=0,(e.ctrlKey||e.metaKey)&&(l=0);break;case"End":i=y.length-1,(e.ctrlKey||e.metaKey)&&(l=j.length-1);break;default:return!1}return e.preventDefault(),Xr(Math.max(0,Math.min(j.length-1,l)),Math.max(0,Math.min(y.length-1,i))),!0},Zr=(e,t,n,l)=>{e.target===e.currentTarget&&(Qr(e,t,n)||qe(n,l)&&(e.key==="Enter"||e.key==="F2"?(e.preventDefault(),He(t,n)):!n.cellEditor&&n.type!=="date"&&e.key.length===1&&!e.ctrlKey&&!e.metaKey&&!e.altKey&&(e.preventDefault(),He(t,n,{text:e.key}))))};Et(()=>{if(!V||!me.current)return;const e=me.current,t=()=>Kt(l=>l.height===e.clientHeight?l:{...l,height:e.clientHeight});if(t(),typeof ResizeObserver>"u")return;const n=new ResizeObserver(t);return n.observe(e),()=>n.disconnect()},[V]);const _e=V&&!kt&&j.length>0,en=pt.height||(typeof De=="number"?De:400),Je=_e?Math.max(0,Math.floor(pt.top/H)-Lt):0,vt=_e?Math.min(j.length,Math.ceil((pt.top+en)/H)+Lt):j.length,tn=_e?j.slice(Je,vt):j,Qt=`${$}|${R}|${JSON.stringify(P)}|${ce}|${JSON.stringify(ie)}`,Zt=h.useRef(!0);h.useEffect(()=>{if(Zt.current){Zt.current=!1;return}const e=me.current;e&&typeof e.scrollTo=="function"&&e.scrollTop>0&&e.scrollTo({top:0,behavior:"smooth"})},[Qt]);const jt=Object.keys(ft).length>0,Ye=e=>ft[e.field]??(typeof e.width=="number"?e.width:An),rn=e=>Math.max(40,typeof e.minWidth=="number"?e.minWidth:60),nn=(e,t)=>{e.preventDefault(),e.stopPropagation();const n={...ft};jt||y.forEach(k=>{var N;return n[k.field]=((N=pe.current.get(k.field))==null?void 0:N.offsetWidth)??Ye(k)});const l=e.clientX,i=n[t.field]??Ye(t),s=e.currentTarget;s.setPointerCapture(e.pointerId),Pt(n);const m=k=>Math.min(t.maxWidth??1/0,Math.max(rn(t),Math.round(k))),p=k=>Pt(N=>({...N,[t.field]:m(i+k.clientX-l)})),u=()=>{s.removeEventListener("pointermove",p),s.removeEventListener("pointerup",u),s.removeEventListener("pointercancel",u)};s.addEventListener("pointermove",p),s.addEventListener("pointerup",u),s.addEventListener("pointercancel",u)};Et(()=>{var i,s;const e={};let t=A&&y.some(m=>m.pinned==="left")?G:0;for(const m of y)m.pinned==="left"&&(e[m.field]=t,t+=((i=pe.current.get(m.field))==null?void 0:i.offsetWidth)??0);let n=0;for(const m of[...y].reverse())m.pinned==="right"&&(e[m.field]=n,n+=((s=pe.current.get(m.field))==null?void 0:s.offsetWidth)??0);const l=Object.keys(e);(l.length!==Object.keys(Ie).length||l.some(m=>e[m]!==Ie[m]))&&Pr(e)}),h.useEffect(()=>{const e=()=>Ar(t=>t+1);return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);const er=y.map(e=>e.pinned).lastIndexOf("left"),on=y.findIndex(e=>e.pinned==="right"),Ge=er>=0,tr=(e,t)=>({className:e.pinned?S("rk-grid__pinned",`rk-grid__pinned--${e.pinned}`,t===er&&"rk-grid__pinned--edge",t===on&&"rk-grid__pinned--edge"):void 0,style:e.pinned==="left"?{left:Ie[e.field]??0}:e.pinned==="right"?{right:Ie[e.field]??0}:void 0}),rr=typeof Se=="object"?Se:{},nr=(e={})=>{const t={...rr,...e},n=t.scope??"filtered",l=n==="page"?j:n==="selected"?ae.filter(p=>_t.has(p.id)):J,i=t.includeHidden?r:y,s=i.map(p=>Ze(p)||p.field),m=l.map(({row:p})=>i.map(u=>{const k=B(p,u.field);return u.exportValue?u.exportValue(k,p):u.type==="date"?U(k)??"":je(u,p)}));return On(s,m,{sanitize:t.sanitize})},ir=(e={})=>{const t={...rr,...e};Pn(nr(e),`${t.filename??"export"}.csv`)};h.useEffect(()=>{ue&&(ue.current={getCsv:nr,exportCsv:ir,getSelectedRows:()=>Ut(q),getSelectedRowIds:()=>q,selectAll:()=>Jt(!0),clearSelection:()=>Be([]),refresh:()=>{K&&Ke(Oe.current)}})}),h.useEffect(()=>()=>{ue&&(ue.current=null)},[ue]);const or=e=>{var n,l,i,s,m,p,u,k;const t=e.checkbox??{};return{variant:t.variant??st,indicator:t.indicator,className:t.className,style:t.style,classNames:{root:S(D.checkbox,(n=t.classNames)==null?void 0:n.root),control:S(D.checkboxControl,(l=t.classNames)==null?void 0:l.control),indicator:S(D.checkboxIndicator,(i=t.classNames)==null?void 0:i.indicator),label:(s=t.classNames)==null?void 0:s.label},styles:{root:{...v.checkbox,...(m=t.styles)==null?void 0:m.root},control:{...v.checkboxControl,...(p=t.styles)==null?void 0:p.control},indicator:{...v.checkboxIndicator,...(u=t.styles)==null?void 0:u.indicator},label:(k=t.styles)==null?void 0:k.label}}},Q=e=>e.stopPropagation(),sn=(e,t)=>o.jsx("span",{className:"rk-grid__checkbox-cell",onClick:Q,onDoubleClick:Q,children:o.jsx(ee,{...or(e),checked:!!t.value,disabled:!t.editable,"aria-label":`Toggle ${fe(e)}`,onChange:n=>t.updateValue(n)})}),sr=e=>J.filter(t=>yt(e,Ue(e,t.row,t.index))),ln=(e,t)=>{const n=new Map(sr(e).map(s=>[s.index,s])),l=[],i=ne.current.map((s,m)=>{const p=n.get(m);if(!p)return s;const u=B(s,e.field);if(!!u===t||e.validate&&!e.validate(t,s))return s;const k=Ct(s,e.field,t);return l.push({rowId:p.id,rowIndex:m,field:e.field,oldValue:u,newValue:t,row:k}),k});l.length!==0&&(Ot(i),l.forEach(s=>f==null?void 0:f(s)),x==null||x(i))},an=e=>{const t=sr(e),n=t.length>0?t:J,l=n.filter(s=>!!B(s.row,e.field)).length,i=n.length>0&&l===n.length;return o.jsx("span",{className:"rk-grid__header-checkbox",onClick:Q,onDoubleClick:Q,children:o.jsx(ee,{...or(e),checked:i,indeterminate:l>0&&!i,disabled:t.length===0,label:Ze(e)||void 0,"aria-label":`Select all ${fe(e)}`,onChange:s=>ln(e,s)})})},cn=(e,t,n)=>{if(t.cellEditor)return o.jsx("div",{className:"rk-grid__custom-editor",onBlur:i=>{i.currentTarget.contains(i.relatedTarget)||n.session===le.current&&(ke(e,t,{value:Le.current},{focus:!1})||X())},onKeyDown:i=>{i.key==="Escape"&&(i.preventDefault(),i.stopPropagation(),X(),ze(e.id,t.field))},children:h.createElement(t.cellEditor,{value:n.draft,row:e.row,rowIndex:e.index,field:t.field,column:t,onChange:i=>{Le.current=i,se(s=>s&&s.session===n.session?{...s,draft:i,invalid:!1}:s)},onCommit:(i,s="none")=>{n.session===le.current&&ke(e,t,{value:i===void 0?Le.current:i},{move:s})},onCancel:()=>{X(),ze(e.id,t.field)}})});const l=t.type==="date";return o.jsx("input",{autoFocus:!0,type:l?"date":"text",min:l?t.dateMin:void 0,max:l?t.dateMax:void 0,className:S("rk-grid__editor",n.invalid&&"rk-grid__editor--invalid",D.editor),style:{textAlign:t.align,...v.editor},value:n.draft===null||n.draft===void 0?"":String(n.draft),inputMode:t.type==="number"?"decimal":void 0,"aria-label":`Edit ${fe(t)}`,"aria-invalid":n.invalid||void 0,onChange:i=>{const s=i.target.value;se(m=>m&&{...m,draft:s,invalid:!1})},onFocus:i=>{const s=i.currentTarget;l||(n.select==="all"?s.select():s.setSelectionRange(s.value.length,s.value.length))},onBlur:i=>{if(n.session===le.current){if(gr(i.currentTarget))return X();ke(e,t,{text:i.currentTarget.value},{focus:!1})||X()}},onKeyDown:i=>Gr(i,e,t)})},dn=h.useMemo(()=>{const e=new Map;for(const t of y)t.filterable&&!t.filterRenderer&&ur(t)==="select"&&e.set(t.field,Dn(t,Me,n=>B(n,t.field),n=>je(t,n)));return e},[y,Me]),fn=Cr||!!Ce,un=Ce?{"--rk-stripe-a":Ce[0],"--rk-stripe-b":Ce[1]}:void 0,hn=z&&(Ee==="top"||Ee==="both"),pn=z&&(Ee==="bottom"||Ee==="both"),gn=O||!!Ft||It||!!Se,lr=e=>o.jsxs("div",{className:S("rk-grid__footer",e==="top"&&"rk-grid__footer--top",D.footer),style:v.footer,"data-position":e,children:[o.jsxs("span",{...T("rowCount","rk-grid__count"),children:[de===0?"0 rows":`${Wr}–${Vr} of ${de}`,A&&q.length>0?` · ${q.length} selected`:""]}),o.jsxs("div",{...T("pagination","rk-grid__pagination"),children:[o.jsxs("label",{className:"rk-grid__page-size-label",children:["Rows per page",o.jsx("select",{value:R,onChange:t=>Rr(Number(t.target.value)),...T("pageSize","rk-grid__page-size"),children:(tt.includes(R)?tt:[...tt,R].sort((t,n)=>t-n)).map(t=>o.jsx("option",{value:t,children:t},t))})]}),o.jsx("button",{type:"button","aria-label":"First page",disabled:$===0,onClick:()=>oe(0),...T("pageButton","rk-grid__page-btn"),children:"«"}),o.jsx("button",{type:"button","aria-label":"Previous page",disabled:$===0,onClick:()=>oe($-1),...T("pageButton","rk-grid__page-btn"),children:"‹"}),o.jsxs("span",{...T("pageInfo","rk-grid__page-info"),children:["Page ",$+1," of ",Y]}),o.jsx("button",{type:"button","aria-label":"Next page",disabled:$>=Y-1,onClick:()=>oe($+1),...T("pageButton","rk-grid__page-btn"),children:"›"}),o.jsx("button",{type:"button","aria-label":"Last page",disabled:$>=Y-1,onClick:()=>oe(Y-1),...T("pageButton","rk-grid__page-btn"),children:"»"})]})]}),mn=e=>o.jsx("tr",{className:"rk-grid__tr rk-grid__skeleton-row","aria-hidden":"true",style:V?{height:H}:void 0,children:Tt?o.jsx("td",{colSpan:xe,className:"rk-grid__td rk-grid__skeleton-cell",children:h.createElement(Tt,{rowIndex:e,columns:y})}):o.jsxs(o.Fragment,{children:[A&&o.jsx("td",{className:"rk-grid__td",children:o.jsx("span",{...T("skeleton","rk-grid__skeleton"),style:{...v.skeleton,width:18}})}),y.map((t,n)=>o.jsx("td",{className:"rk-grid__td",style:{textAlign:t.align},children:o.jsx("span",{...T("skeleton","rk-grid__skeleton"),style:{...v.skeleton,width:`${55+(e*7+n*13)%35}%`}})},t.field))]})},`sk${e}`),xn=(e,t)=>{const{row:n,id:l,index:i}=e,s=typeof at=="function"?at(n,i):at,m=typeof ct=="function"?ct(n,i):ct,p=_t.has(l);return o.jsxs("tr",{onClick:ot?()=>ot(n,i):void 0,"aria-selected":A?p:void 0,className:S("rk-grid__tr","rk-grid__row",fn&&(t%2===0?"rk-grid__row--stripe-a":"rk-grid__row--stripe-b"),Rt&&!V&&"rk-grid__row--enter",p&&"rk-grid__row--selected",ot&&"rk-grid__row--clickable",D.row,s),style:{...Rt&&!V?{"--rk-i":Math.min(t,24)}:null,...V?{height:H}:null,...v.row,...m},children:[A&&o.jsx("td",{className:S("rk-grid__td rk-grid__select-cell",Ge&&"rk-grid__pinned rk-grid__pinned--left"),style:{width:G,minWidth:G,maxWidth:G,...Ge?{left:0}:null},onClick:Q,children:o.jsx("span",{className:"rk-grid__checkbox-cell",onClickCapture:u=>qt.current=u.shiftKey,children:o.jsx(ee,{variant:st,checked:p,disabled:!We(n),"aria-label":A==="single"?"Select row":`Select row ${i+1}`,onChange:u=>Hr(e,u),classNames:{root:D.checkbox,control:D.checkboxControl,indicator:D.checkboxIndicator},styles:{root:v.checkbox,control:v.checkboxControl,indicator:v.checkboxIndicator}})})}),y.map((u,k)=>{const N=Jr(u,e),Xe=typeof u.cellClassName=="function"?u.cellClassName(N):u.cellClassName,kn=typeof u.cellStyle=="function"?u.cellStyle(N):u.cellStyle,ar=ge!==null&&ge.id===l&&ge.field===u.field,wt=qe(u,N),cr=tr(u,k),_n=ut?ut.id===l&&ut.field===u.field:t===0&&k===0;return o.jsx("td",{ref:Z=>{const dr=Nt(l,u.field);Z?Fe.current.set(dr,Z):Fe.current.delete(dr)},tabIndex:it?_n?0:-1:wt?0:void 0,onFocus:it?Z=>Z.target===Z.currentTarget&&At({id:l,field:u.field}):void 0,onDoubleClick:wt?()=>He(e,u):void 0,onKeyDown:Z=>Zr(Z,e,u,N),className:S("rk-grid__td",wt&&"rk-grid__td--editable",ar&&"rk-grid__td--editing",cr.className,D.cell,u.className,Xe),style:{textAlign:u.align,...v.cell,...u.style,...kn,...cr.style},children:ar&&ge?cn(e,u,ge):u.cellRenderer?h.createElement(u.cellRenderer,N):u.type==="boolean"&&!u.cellEditor?sn(u,N):N.formattedValue},u.field)})]},l)},bn=Nr??(z?Math.min(R,20):5);return o.jsxs("div",{className:S("rk-grid",V&&"rk-grid--virtual",D.root,Dr),style:{...un,...v.root,...Mr},"data-rk-theme":lt||void 0,"aria-busy":kt||void 0,children:[gn&&o.jsxs("div",{...T("toolbar","rk-grid__toolbar"),children:[o.jsxs("div",{className:"rk-grid__toolbar-left",children:[O&&o.jsx("input",{type:"search",value:he,onChange:e=>Tr(e.target.value),placeholder:te,"aria-label":"Search all columns",...T("search","rk-grid__search")}),A&&q.length>0&&o.jsxs("span",{className:"rk-grid__selected-count",role:"status",children:[q.length," selected"]})]}),o.jsxs("div",{className:"rk-grid__toolbar-actions",children:[Ft,It&&o.jsx(Fn,{columns:r,hidden:Te,onToggle:Or,theme:lt,className:D.toolButton,style:v.toolButton}),Se&&o.jsx("button",{type:"button",onClick:()=>ir(),...T("toolButton","rk-grid__tool-btn"),children:"Export CSV"})]})]}),hn&&lr("top"),o.jsx("div",{ref:me,...T("scroll","rk-grid__scroll"),onScroll:V?e=>Kt({top:e.currentTarget.scrollTop,height:e.currentTarget.clientHeight}):void 0,style:{...v.scroll,...De!==void 0?{maxHeight:De}:V?{maxHeight:400}:null},children:o.jsxs("table",{...T("table","rk-grid__table"),role:"grid",style:jt?{...v.table,tableLayout:"fixed",width:y.reduce((e,t)=>e+Ye(t),A?G:0),minWidth:"100%"}:v.table,children:[o.jsx("thead",{...T("thead","rk-grid__thead"),children:o.jsxs("tr",{...T("headerRow","rk-grid__tr"),children:[A&&o.jsx("th",{scope:"col",className:S("rk-grid__th rk-grid__select-cell",Ge&&"rk-grid__pinned rk-grid__pinned--left",D.headerCell),style:{width:G,minWidth:G,maxWidth:G,...Ge?{left:0}:null,...v.headerCell},children:A==="multiple"&&o.jsx("span",{className:"rk-grid__checkbox-cell",children:o.jsx(ee,{variant:st,checked:Ht,indeterminate:zt>0&&!Ht,disabled:be.length===0,"aria-label":"Select all rows",onChange:Jt,classNames:{root:D.checkbox,control:D.checkboxControl,indicator:D.checkboxIndicator},styles:{root:v.checkbox,control:v.checkboxControl,indicator:v.checkboxIndicator}})})}),y.map((e,t)=>{const n=P.findIndex(p=>p.field===e.field),l=n>=0?P[n].direction:null,i=gt(e),s=Wt(e),m=tr(e,t);return o.jsxs("th",{ref:p=>{p?pe.current.set(e.field,p):pe.current.delete(e.field)},scope:"col","aria-sort":l?l==="asc"?"ascending":"descending":i?"none":void 0,tabIndex:i?0:void 0,onClick:p=>Yt(e,p.shiftKey),onKeyDown:p=>{i&&p.target===p.currentTarget&&(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),Yt(e,p.shiftKey))},className:S("rk-grid__th",i&&"rk-grid__th--sortable",m.className,D.headerCell,e.className,e.headerClassName),style:{width:jt?Ye(e):e.width,minWidth:e.minWidth,textAlign:e.align,...v.headerCell,...e.style,...e.headerStyle,...m.style},children:[o.jsxs("span",{className:"rk-grid__th-content",children:[e.headerRenderer?h.createElement(e.headerRenderer,{column:e,sortDirection:l}):e.headerCheckbox&&e.type==="boolean"?an(e):Ze(e),e.filterable&&o.jsx(Ln,{column:e,label:fe(e),kind:s,value:ie[e.field],onChange:p=>{const u={...ie};p===void 0?delete u[e.field]:u[e.field]=p,Ir(u)},options:dn.get(e.field)??[],theme:lt,indicatorClassName:S(D.filterIndicator,e.filterIndicatorClassName),indicatorStyle:{...v.filterIndicator,...e.filterIndicatorStyle},popupClassName:S(D.filterPopup,e.filterPopupClassName),popupStyle:{...v.filterPopup,...e.filterPopupStyle},inputClassName:D.filterInput,inputStyle:v.filterInput}),i&&o.jsxs("span",{className:"rk-grid__sort","aria-hidden":"true",children:[l==="asc"?"▲":l==="desc"?"▼":"↕",l&&P.length>1&&o.jsx("sup",{className:"rk-grid__sort-order",children:n+1})]})]}),e.resizable&&o.jsx("span",{className:"rk-grid__resizer",role:"separator","aria-orientation":"vertical","aria-label":`Resize ${fe(e)}`,onPointerDown:p=>nn(p,e),onClick:Q,onDoubleClick:Q})]},e.field)})]})}),o.jsx("tbody",{...T("tbody","rk-grid__tbody"),children:kt?Array.from({length:bn},(e,t)=>mn(t)):zr?o.jsx("tr",{children:o.jsxs("td",{colSpan:xe,...T("empty","rk-grid__empty rk-grid__error"),role:"alert",children:[Er," ",o.jsx("button",{type:"button",className:"rk-grid__tool-btn",onClick:()=>Ke(Oe.current),children:"Retry"})]})}):j.length===0?o.jsx("tr",{children:o.jsx("td",{colSpan:xe,...T("empty","rk-grid__empty"),children:Sr})}):o.jsxs(o.Fragment,{children:[_e&&Je>0&&o.jsx("tr",{"aria-hidden":"true",className:"rk-grid__spacer",children:o.jsx("td",{colSpan:xe,style:{height:Je*H}})}),tn.map((e,t)=>xn(e,Je+t)),_e&&vt<j.length&&o.jsx("tr",{"aria-hidden":"true",className:"rk-grid__spacer",children:o.jsx("td",{colSpan:xe,style:{height:(j.length-vt)*H}})})]})},Qt)]})}),pn&&lr("bottom")]})}exports.Checkbox=ee;exports.DataGrid=Wn;
|