argus-table 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/argus-column-group.js +66 -0
- package/dist/argus-column-group.js.map +1 -0
- package/dist/argus-column.js +4 -25
- package/dist/argus-column.js.map +1 -1
- package/dist/argus-table.js +553 -200
- package/dist/argus-table.js.map +1 -1
- package/dist/attributes.js +21 -0
- package/dist/attributes.js.map +1 -0
- package/dist/cdn/argus-table.js +92 -57
- package/dist/cdn/argus-table.js.map +1 -1
- package/dist/column-registry.js +23 -0
- package/dist/column-registry.js.map +1 -0
- package/dist/controllers/auto-width.js +6 -5
- package/dist/controllers/auto-width.js.map +1 -1
- package/dist/controllers/column-children.js +32 -9
- package/dist/controllers/column-children.js.map +1 -1
- package/dist/controllers/column-window.js +0 -4
- package/dist/controllers/column-window.js.map +1 -1
- package/dist/controllers/plugins.js +25 -6
- package/dist/controllers/plugins.js.map +1 -1
- package/dist/controllers/reorder-drag.js +12 -9
- package/dist/controllers/reorder-drag.js.map +1 -1
- package/dist/controllers/row-measure.js +2 -1
- package/dist/controllers/row-measure.js.map +1 -1
- package/dist/controllers/virtual-controller.js +25 -32
- package/dist/controllers/virtual-controller.js.map +1 -1
- package/dist/core/src/columns/column-groups.js +129 -0
- package/dist/core/src/columns/column-groups.js.map +1 -0
- package/dist/core/src/columns/column-order.js +125 -31
- package/dist/core/src/columns/column-order.js.map +1 -1
- package/dist/core/src/columns/resolve-columns.js +0 -1
- package/dist/core/src/columns/resolve-columns.js.map +1 -1
- package/dist/core/src/columns/spread-width.js +43 -0
- package/dist/core/src/columns/spread-width.js.map +1 -0
- package/dist/core/src/filters/filter.js +6 -8
- package/dist/core/src/filters/filter.js.map +1 -1
- package/dist/core/src/grid/row-layout.js +19 -11
- package/dist/core/src/grid/row-layout.js.map +1 -1
- package/dist/core/src/state/selection.js +2 -1
- package/dist/core/src/state/selection.js.map +1 -1
- package/dist/core/src/table/create-table.js +57 -22
- package/dist/core/src/table/create-table.js.map +1 -1
- package/dist/core/src/table/sorted-row-model.js.map +1 -1
- package/dist/core/src/virtual/row-sizes.js +0 -4
- package/dist/core/src/virtual/row-sizes.js.map +1 -1
- package/dist/custom-elements.json +489 -245
- package/dist/events.js +16 -16
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +273 -127
- package/dist/index.js +3 -2
- package/dist/render/body.js +2 -2
- package/dist/render/body.js.map +1 -1
- package/dist/render/cells.js +11 -3
- package/dist/render/cells.js.map +1 -1
- package/dist/render/content-directive.js +1 -1
- package/dist/render/content-directive.js.map +1 -1
- package/dist/render/content.js +15 -3
- package/dist/render/content.js.map +1 -1
- package/dist/render/header.js +82 -19
- package/dist/render/header.js.map +1 -1
- package/dist/styles/base.js +1 -1
- package/dist/styles/base.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -150,15 +150,41 @@ interface SortItem {
|
|
|
150
150
|
/** `true` for descending order. */
|
|
151
151
|
desc: boolean;
|
|
152
152
|
}
|
|
153
|
-
/**
|
|
154
|
-
|
|
153
|
+
/**
|
|
154
|
+
* The sort order: an empty array when unsorted. Several items sort by each in turn
|
|
155
|
+
* (the first decides, the next breaks ties). A header click replaces the order with
|
|
156
|
+
* that one column; sorting by several columns is set by the host or a plugin.
|
|
157
|
+
*/
|
|
158
|
+
type SortState = readonly SortItem[];
|
|
159
|
+
/**
|
|
160
|
+
* A header over several columns (`columnGroups`). Groups nest: a group lists column
|
|
161
|
+
* ids and other groups, and each level of nesting adds a header row above the
|
|
162
|
+
* column headers. The columns of a group stay next to each other in the column
|
|
163
|
+
* order; a group whose columns are pinned to different sides shows once per side.
|
|
164
|
+
*/
|
|
165
|
+
interface ColumnGroup$1<TContent = unknown> {
|
|
166
|
+
/** Stable key. Unique among groups; it may equal a column id. */
|
|
167
|
+
id: string;
|
|
168
|
+
/** Header content, or a function returning it. Default: the id. */
|
|
169
|
+
header?: TContent | (() => TContent);
|
|
170
|
+
/**
|
|
171
|
+
* Whether the group can be moved as a whole (a drag on its header, Alt+Shift+Arrow
|
|
172
|
+
* on it). Default: `true`. Its columns can still move within it.
|
|
173
|
+
*/
|
|
174
|
+
reorderable?: boolean;
|
|
175
|
+
/**
|
|
176
|
+
* The group's columns (by id) and groups, in order. Unknown ids are ignored, and
|
|
177
|
+
* a column listed twice belongs to the first group that lists it.
|
|
178
|
+
*/
|
|
179
|
+
columns: readonly (string | ColumnGroup$1<TContent>)[];
|
|
180
|
+
}
|
|
155
181
|
/** Column widths in px set by resizing, keyed by column id. */
|
|
156
182
|
type ColumnSizingState = Record<string, number>;
|
|
157
183
|
/**
|
|
158
184
|
* The column order: column ids as the table shows them (start-pinned, scrolling,
|
|
159
185
|
* end-pinned). An empty array means the order of `columns`.
|
|
160
186
|
*/
|
|
161
|
-
type ColumnOrderState = string[];
|
|
187
|
+
type ColumnOrderState = readonly string[];
|
|
162
188
|
/**
|
|
163
189
|
* Pins set at runtime, keyed by column id: `'start'` or `'end'` pins a column, `false`
|
|
164
190
|
* unpins a column whose definition pins it. A column not listed keeps its `pin`.
|
|
@@ -208,7 +234,7 @@ interface DateFilter {
|
|
|
208
234
|
/** Keeps rows whose value is one of `values` (`null` stands for an empty value). */
|
|
209
235
|
interface SetFilter {
|
|
210
236
|
kind: 'set';
|
|
211
|
-
values: FilterValue[];
|
|
237
|
+
values: readonly FilterValue[];
|
|
212
238
|
}
|
|
213
239
|
/** One column's filter. */
|
|
214
240
|
type ColumnFilter = TextFilter | NumberFilter | DateFilter | SetFilter;
|
|
@@ -223,20 +249,27 @@ type ColumnFilterState = Record<string, ColumnFilter>;
|
|
|
223
249
|
*/
|
|
224
250
|
type SelectionMode = 'none' | 'single' | 'multi';
|
|
225
251
|
/** The selected rows, as row ids (from `getRowId`, or the row's index as a string). */
|
|
226
|
-
type SelectionState = string[];
|
|
252
|
+
type SelectionState = readonly string[];
|
|
227
253
|
/**
|
|
228
254
|
* Where the body is scrolled: the row at the top, as an index in the current row
|
|
229
255
|
* order, and the inline offset in px from the start edge (positive in RTL too).
|
|
230
256
|
*/
|
|
231
257
|
interface ScrollState {
|
|
258
|
+
/** The row at the top, as an index in the current row order. */
|
|
232
259
|
row: number;
|
|
233
|
-
|
|
260
|
+
/** The inline offset in px from the start edge, positive in RTL too. */
|
|
261
|
+
inline: number;
|
|
234
262
|
}
|
|
235
263
|
/**
|
|
236
264
|
* The state users change, as one object of plain JSON, for saving a user's layout:
|
|
237
265
|
* `getState()` returns every key, and `setState()` applies the keys it is given.
|
|
238
266
|
*/
|
|
239
267
|
interface TableState {
|
|
268
|
+
/**
|
|
269
|
+
* The format of the object: `1`. `getState()` sets it; `setState()` ignores an
|
|
270
|
+
* object with another version, and takes one without it as version 1.
|
|
271
|
+
*/
|
|
272
|
+
version?: 1;
|
|
240
273
|
sorting?: SortState;
|
|
241
274
|
columnSizing?: ColumnSizingState;
|
|
242
275
|
columnOrder?: ColumnOrderState;
|
|
@@ -247,54 +280,60 @@ interface TableState {
|
|
|
247
280
|
quickFilter?: string;
|
|
248
281
|
scroll?: ScrollState;
|
|
249
282
|
}
|
|
250
|
-
/** `detail` of `argus-
|
|
251
|
-
interface
|
|
283
|
+
/** `detail` of `argus-selection-change`. */
|
|
284
|
+
interface SelectionChangeDetail {
|
|
252
285
|
/** The selected row ids: the new ones, or the proposed ones when `selection` is controlled. */
|
|
253
286
|
selection: SelectionState;
|
|
254
287
|
}
|
|
255
|
-
/** `detail` of `argus-
|
|
256
|
-
interface
|
|
288
|
+
/** `detail` of `argus-sorting-change`. */
|
|
289
|
+
interface SortingChangeDetail {
|
|
290
|
+
/** The sort order: the new one, or the proposed one when `sorting` is controlled. */
|
|
257
291
|
sorting: SortState;
|
|
258
292
|
}
|
|
259
|
-
/** `detail` of `argus-column-
|
|
260
|
-
interface
|
|
293
|
+
/** `detail` of `argus-column-sizing-change`: fires once per column that changed width. */
|
|
294
|
+
interface ColumnSizingChangeDetail {
|
|
295
|
+
/** The whole new sizing state, or the proposed one when `columnSizing` is controlled. */
|
|
296
|
+
columnSizing: ColumnSizingState;
|
|
297
|
+
/** The column resized. */
|
|
261
298
|
columnId: string;
|
|
299
|
+
/** Its new width in px. */
|
|
262
300
|
width: number;
|
|
263
|
-
sizing: ColumnSizingState;
|
|
264
301
|
}
|
|
265
|
-
/** `detail` of `argus-column-
|
|
266
|
-
interface
|
|
267
|
-
/** The
|
|
302
|
+
/** `detail` of `argus-column-order-change`. */
|
|
303
|
+
interface ColumnOrderChangeDetail {
|
|
304
|
+
/** The whole new order, or the proposed one when `columnOrder` is controlled. */
|
|
305
|
+
columnOrder: ColumnOrderState;
|
|
306
|
+
/** The column that moved; for a group, its first column that moved. */
|
|
268
307
|
columnId: string;
|
|
269
|
-
/** The
|
|
270
|
-
|
|
308
|
+
/** The group that moved, when a group header was moved rather than a column. */
|
|
309
|
+
groupId?: string;
|
|
271
310
|
}
|
|
272
|
-
/** `detail` of `argus-column-
|
|
273
|
-
interface
|
|
311
|
+
/** `detail` of `argus-column-pinning-change`: fires when a column is pinned and when it is unpinned. */
|
|
312
|
+
interface ColumnPinningChangeDetail {
|
|
313
|
+
/** The whole new pinning state, or the proposed one when `columnPinning` is controlled. */
|
|
314
|
+
columnPinning: ColumnPinningState;
|
|
274
315
|
/** The column pinned or unpinned. */
|
|
275
316
|
columnId: string;
|
|
276
317
|
/** Its new pin, or `false` when it no longer is pinned. */
|
|
277
318
|
pin: ColumnPin | false;
|
|
278
|
-
/** The whole new pinning state. */
|
|
279
|
-
pinning: ColumnPinningState;
|
|
280
319
|
}
|
|
281
|
-
/** `detail` of `argus-column-
|
|
282
|
-
interface
|
|
320
|
+
/** `detail` of `argus-column-visibility-change`: fires when a column is hidden and when it is shown. */
|
|
321
|
+
interface ColumnVisibilityChangeDetail {
|
|
322
|
+
/** The whole new visibility state, or the proposed one when `columnVisibility` is controlled. */
|
|
323
|
+
columnVisibility: ColumnVisibilityState;
|
|
283
324
|
/** The column hidden or shown. */
|
|
284
325
|
columnId: string;
|
|
285
|
-
/** `true` when the column was
|
|
286
|
-
|
|
287
|
-
/** The whole new visibility state. */
|
|
288
|
-
visibility: ColumnVisibilityState;
|
|
326
|
+
/** `true` when the column was shown, `false` when it was hidden: as in `columnVisibility`. */
|
|
327
|
+
visible: boolean;
|
|
289
328
|
}
|
|
290
|
-
/** `detail` of `argus-column-
|
|
291
|
-
interface
|
|
329
|
+
/** `detail` of `argus-column-filters-change`: fires when a column's filter is set, changed or cleared. */
|
|
330
|
+
interface ColumnFiltersChangeDetail {
|
|
331
|
+
/** The whole new filter state, or the proposed one when `columnFilters` is controlled. */
|
|
332
|
+
columnFilters: ColumnFilterState;
|
|
292
333
|
/** The column filtered. */
|
|
293
334
|
columnId: string;
|
|
294
335
|
/** Its new filter, or `undefined` when it was cleared. */
|
|
295
|
-
|
|
296
|
-
/** The whole new filter state. */
|
|
297
|
-
filters: ColumnFilterState;
|
|
336
|
+
columnFilter: ColumnFilter | undefined;
|
|
298
337
|
}
|
|
299
338
|
/** `detail` of `argus-row-click`. */
|
|
300
339
|
interface RowClickDetail<TData> {
|
|
@@ -308,15 +347,23 @@ interface RowClickDetail<TData> {
|
|
|
308
347
|
/** `detail` of `argus-cell-click`. */
|
|
309
348
|
interface CellClickDetail<TData> {
|
|
310
349
|
row: TData;
|
|
350
|
+
rowId: string;
|
|
351
|
+
/** Index of the row in the current row order; for a pinned row, its index in its list. */
|
|
352
|
+
index: number;
|
|
311
353
|
columnId: string;
|
|
312
354
|
value: unknown;
|
|
313
355
|
/** Set when the row is from `pinnedRows`: the side it is pinned to. */
|
|
314
356
|
pinned?: RowPin;
|
|
315
357
|
}
|
|
316
|
-
/**
|
|
358
|
+
/**
|
|
359
|
+
* `detail` of `argus-range-change`: the first and last row in view, as indexes in the
|
|
360
|
+
* current order (both inclusive). Rows rendered ahead of the scroll position don't count.
|
|
361
|
+
*/
|
|
317
362
|
interface RangeChangeDetail {
|
|
318
|
-
|
|
319
|
-
|
|
363
|
+
/** Index of the first row in view. */
|
|
364
|
+
first: number;
|
|
365
|
+
/** Index of the last row in view, inclusive. */
|
|
366
|
+
last: number;
|
|
320
367
|
}
|
|
321
368
|
/** What `getRows()` receives: a range of rows, the sort order, the filters and an abort signal. */
|
|
322
369
|
interface RowsRequest {
|
|
@@ -359,6 +406,9 @@ interface LoadErrorDetail {
|
|
|
359
406
|
end: number;
|
|
360
407
|
}
|
|
361
408
|
|
|
409
|
+
/** Sort direction of a column, or `false` when it isn't sorted. */
|
|
410
|
+
type SortDirection = 'asc' | 'desc' | false;
|
|
411
|
+
|
|
362
412
|
/**
|
|
363
413
|
* Renders content the table doesn't render itself, such as React elements, Vue
|
|
364
414
|
* VNodes or Angular templates, into a target element the table keeps. Set it as the
|
|
@@ -397,6 +447,8 @@ declare const content: any;
|
|
|
397
447
|
*
|
|
398
448
|
* Set `columns`, and `data` or `dataSource`, as properties. Columns can also be
|
|
399
449
|
* written as `<argus-column>` children; a non-empty `columns` wins over them.
|
|
450
|
+
* `columnGroups` (or `<argus-column-group>` children) adds headers over several
|
|
451
|
+
* columns, a header row per level of nesting.
|
|
400
452
|
* Header and cell content is rendered into the element's light DOM and slotted
|
|
401
453
|
* into the cells, so page CSS and the page's own components work inside cells.
|
|
402
454
|
*
|
|
@@ -408,35 +460,45 @@ declare const content: any;
|
|
|
408
460
|
*
|
|
409
461
|
* @summary Data table with pinned rows and columns and infinite loading.
|
|
410
462
|
*
|
|
411
|
-
* @fires {CustomEvent<
|
|
412
|
-
* @fires {CustomEvent<
|
|
413
|
-
* @fires {CustomEvent<
|
|
414
|
-
* @fires {CustomEvent<
|
|
415
|
-
* @fires {CustomEvent<
|
|
416
|
-
* @fires {CustomEvent<
|
|
417
|
-
* @fires {CustomEvent<
|
|
463
|
+
* @fires {CustomEvent<SortingChangeDetail>} argus-sorting-change - `sorting` changed: a sortable header was clicked, or activated with Enter or Space. `detail: { sorting }`. The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
464
|
+
* @fires {CustomEvent<ColumnSizingChangeDetail>} argus-column-sizing-change - `columnSizing` changed: a column was resized by dragging its handle, with Alt+Arrow on its header, by a double-click on its handle (fit to content) or by `autosizeColumns()`. `detail: { columnSizing, columnId, width }`. Fires on every frame of a drag, and once per column that changes (a group resize, `autosizeColumns()`). The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
465
|
+
* @fires {CustomEvent<ColumnOrderChangeDetail>} argus-column-order-change - `columnOrder` changed: a column or column group was moved by dragging its header, or with Alt+Shift+Arrow on its focused header. Columns move within their pin side (start-pinned, scrolling, end-pinned) and their column group; groups move as a whole. `detail: { columnOrder, columnId, groupId? }`: `groupId` is set when a group moved, and `columnId` is then its first column. Fires once per move, on drop. The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
466
|
+
* @fires {CustomEvent<ColumnPinningChangeDetail>} argus-column-pinning-change - `columnPinning` changed: a column was pinned to a side or unpinned, through a plugin such as the column menu. `detail: { columnPinning, columnId, pin }`: `pin` is `'start'`, `'end'` or `false`. The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
467
|
+
* @fires {CustomEvent<ColumnVisibilityChangeDetail>} argus-column-visibility-change - `columnVisibility` changed: a column was hidden or shown, through a plugin such as the column menu. `detail: { columnVisibility, columnId, visible }`: `visible` is `false` when it was hidden. The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
468
|
+
* @fires {CustomEvent<ColumnFiltersChangeDetail>} argus-column-filters-change - `columnFilters` changed: a column's filter was set, changed or cleared, through a plugin such as the column menu. `detail: { columnFilters, columnId, columnFilter }`: `columnFilter` is the column's new filter, or `undefined` when it was cleared. The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
469
|
+
* @fires {CustomEvent<SelectionChangeDetail>} argus-selection-change - `selection` changed: by a click on a row (Ctrl/Cmd toggles, Shift selects a range), with Space, Shift+Arrow or Shift+PageUp/PageDown on a body cell, or with Ctrl/Cmd+A. Only with a `selectionMode`. `detail: { selection }`. The new value fires after the update that applied it; when the property is controlled, the proposed value fires right away and nothing changes until the host sets it.
|
|
470
|
+
* @fires {CustomEvent<CellClickDetail<T>>} argus-cell-click - A body or pinned-row cell was clicked, or Enter was pressed on it. `detail: { row, rowId, index, columnId, value, pinned? }`; `pinned` is `'top'` or `'bottom'` for a pinned row, and `index` is then its index in its list. Fires before `argus-row-click`.
|
|
418
471
|
* @fires {CustomEvent<RowClickDetail<T>>} argus-row-click - A body or pinned row was clicked, or Enter was pressed on one of its cells. `detail: { row, rowId, index, pinned? }`; for a pinned row, `index` is its index in its list.
|
|
419
|
-
* @fires {CustomEvent<RangeChangeDetail>} argus-range-change - The
|
|
420
|
-
* @fires {CustomEvent<RowSelectDetail>} argus-row-select - The selected rows changed: by a click on a row (Ctrl/Cmd toggles, Shift selects a range), with Space, Shift+Arrow or Shift+PageUp/PageDown on a body cell, or with Ctrl/Cmd+A. Only with a `selectionMode`. `detail: { selection }`: the new row ids, or the proposed ones when `selection` is controlled.
|
|
472
|
+
* @fires {CustomEvent<RangeChangeDetail>} argus-range-change - The rows in view changed (rows rendered ahead of the scroll position not counted). `detail: { first, last }` (row indices in the current order, both inclusive).
|
|
421
473
|
* @fires {CustomEvent<LoadErrorDetail>} argus-load-error - A `dataSource` page failed to load: `getRows()` rejected or threw. `detail: { error, start, end }` (`end` exclusive). The rows show a Retry button.
|
|
422
474
|
*
|
|
423
475
|
* @slot empty - Shown instead of the body when there are no rows. Default: "No rows".
|
|
424
476
|
*
|
|
425
477
|
* @csspart table - The scroll container that holds header and body.
|
|
426
478
|
* @csspart header - The sticky header row group.
|
|
427
|
-
* @csspart header-row - The header row.
|
|
428
|
-
* @csspart header-
|
|
429
|
-
* @csspart header-cell
|
|
479
|
+
* @csspart header-row - The row of column headers: the last header row when there are column groups.
|
|
480
|
+
* @csspart header-group-row - A row of column group headers (`columnGroups`), one per level of nesting, above `header-row`.
|
|
481
|
+
* @csspart header-group-cell - A column group's header, spanning its columns.
|
|
482
|
+
* @csspart header-group-cell-dragging - Added to `header-group-cell` on the group being dragged to a new position.
|
|
483
|
+
* @csspart header-group-filler - The empty cell of a group row over columns without a group at that level.
|
|
484
|
+
* @csspart header-cell - Every column header.
|
|
485
|
+
* @csspart header-cell-sorted - Added to `header-cell` on the headers of sorted columns. The direction is also in `aria-sort`.
|
|
486
|
+
* @csspart header-cell-sorted-asc - Added to `header-cell` on the headers of columns sorted ascending, next to `header-cell-sorted`.
|
|
487
|
+
* @csspart header-cell-sorted-desc - Added to `header-cell` on the headers of columns sorted descending, next to `header-cell-sorted`.
|
|
488
|
+
* @csspart header-cell-pinned - Added to `header-cell` on the headers of pinned columns, on either side.
|
|
489
|
+
* @csspart header-cell-pinned-edge - Added to `header-cell-pinned` on the pinned header next to the scrolling columns (one per pinned side).
|
|
490
|
+
* @csspart sort-indicator - The chevron in a sortable column's header, shown while it is sorted and pointing the way it sorts. It is drawn with borders in `currentColor`.
|
|
430
491
|
* @csspart header-cell-filtered - Added to `header-cell` on the headers of filtered columns.
|
|
431
492
|
* @csspart filter-indicator - The mark in the header of a filtered column, after the sort indicator.
|
|
432
|
-
* @csspart header-cell-dragging - Added to `header-cell` on the header being dragged to a new position.
|
|
433
|
-
* @csspart drop-indicator - The line on the edge of the header where a dragged column would land.
|
|
434
|
-
* @csspart resize-handle - The drag handle on the inline-end edge of a resizable column's header. A double-click fits the column to its content.
|
|
493
|
+
* @csspart header-cell-dragging - Added to `header-cell` on the header being dragged to a new position, and on the headers of a dragged group's columns.
|
|
494
|
+
* @csspart drop-indicator - The line on the edge of the header where a dragged column or group would land.
|
|
495
|
+
* @csspart resize-handle - The drag handle on the inline-end edge of a resizable column's header, and of a column group's header with resizable columns. A double-click fits the column (or the group's columns) to its content.
|
|
435
496
|
* @csspart body - The row group holding the rendered body rows.
|
|
436
497
|
* @csspart row - Every body row.
|
|
437
498
|
* @csspart row-even - Body rows with an even index (0-based).
|
|
438
499
|
* @csspart row-odd - Body rows with an odd index.
|
|
439
500
|
* @csspart row-loading - Body rows whose `dataSource` page hasn't loaded yet, or failed.
|
|
501
|
+
* @csspart row-error - Added to `row-loading` on body rows whose `dataSource` page failed to load.
|
|
440
502
|
* @csspart row-selected - Body rows whose id is in `selection`.
|
|
441
503
|
* @csspart cell-selection - Added to `cell` in the checkbox column (`selectionCheckboxes`), pinned rows included.
|
|
442
504
|
* @csspart header-cell-selection - Added to `header-cell` on the checkbox column's header.
|
|
@@ -444,11 +506,11 @@ declare const content: any;
|
|
|
444
506
|
* @csspart row-pinned - Every row from `pinnedRows`, on either side. Also has `row`, but no `row-even`/`row-odd`.
|
|
445
507
|
* @csspart row-pinned-top - The rows pinned below the header.
|
|
446
508
|
* @csspart row-pinned-bottom - The rows pinned to the bottom.
|
|
447
|
-
* @csspart cell-pinned-row - Every cell of a pinned row (next to `cell`).
|
|
509
|
+
* @csspart cell-in-pinned-row - Every cell of a pinned row (next to `cell`).
|
|
448
510
|
* @csspart cell - Every body cell.
|
|
449
|
-
* @csspart cell-sorted - Body cells in the sorted column.
|
|
450
|
-
* @csspart cell-pinned - Body cells in a pinned column, on either side.
|
|
451
|
-
* @csspart cell-pinned-edge - The pinned
|
|
511
|
+
* @csspart cell-sorted - Body and pinned-row cells in the sorted column.
|
|
512
|
+
* @csspart cell-pinned - Body and pinned-row cells in a pinned column, on either side.
|
|
513
|
+
* @csspart cell-pinned-edge - The pinned cell next to the scrolling columns (one per pinned side), in body and pinned rows.
|
|
452
514
|
* @csspart skeleton - The placeholder bar in each cell of a row that is still loading.
|
|
453
515
|
* @csspart skeleton-error - Added to `skeleton` in a row whose page failed to load.
|
|
454
516
|
* @csspart retry - The Retry button in the first cell of a failed page's first visible row.
|
|
@@ -461,19 +523,19 @@ declare const content: any;
|
|
|
461
523
|
* @cssprop [--argus-header-fg=inherit] - Header text colour.
|
|
462
524
|
* @cssprop [--argus-border-color] - Colour of the row borders.
|
|
463
525
|
* @cssprop [--argus-border-width=1px] - Width of the row borders.
|
|
464
|
-
* @cssprop [--argus-
|
|
465
|
-
* @cssprop [--argus-radius=0] - Corner radius of the table. Header, rows and pinned columns are clipped to it.
|
|
466
|
-
* @cssprop [--argus-row-height] - Height of a row. Default per density: 32px, 40px, 52px. With `rowHeight: 'auto'`: the header
|
|
526
|
+
* @cssprop [--argus-border=none] - Border around the whole table, as a `border` shorthand (`1px solid …`). Inside the element's size. The lines between rows are `--argus-border-width` and `--argus-border-color`.
|
|
527
|
+
* @cssprop [--argus-border-radius=0] - Corner radius of the table. Header, rows and pinned columns are clipped to it.
|
|
528
|
+
* @cssprop [--argus-row-height] - Height of a row, and of each header row. Default per density: 32px, 40px, 52px. With `rowHeight: 'auto'`: the height of each header row and the least a body or pinned row is.
|
|
467
529
|
* @cssprop [--argus-cell-padding-inline] - Inline padding of cells. Default per density: 8px, 12px, 16px.
|
|
468
530
|
* @cssprop [--argus-cell-padding-block] - Block padding of body and pinned-row cells with `rowHeight: 'auto'`, where content sits at the top of the cell. Default: what centres one line of text in `--argus-row-height`.
|
|
469
|
-
* @cssprop [--argus-row-
|
|
531
|
+
* @cssprop [--argus-row-odd-bg] - Background of odd rows. Default: no stripes.
|
|
470
532
|
* @cssprop [--argus-pinned-shadow] - Shadow on the pinned edge, as a `box-shadow` falling toward the end side (`4px 0 6px -4px …`). Mirrored for the end edge and in RTL; `none` removes it.
|
|
471
533
|
* @cssprop [--argus-resize-handle-color] - Colour of the resize handle's line, shown on hover, focus and drag.
|
|
472
534
|
* @cssprop [--argus-focus-ring=2px solid Highlight] - Outline of the focused header or cell.
|
|
473
535
|
* @cssprop [--argus-filter-indicator-color=currentColor] - Colour of the mark in the header of a filtered column.
|
|
474
536
|
* @cssprop [--argus-drop-indicator-color=Highlight] - Colour of the line that marks where a dragged column would land.
|
|
475
537
|
* @cssprop [--argus-row-hover-bg] - Background of the hovered row. Default: no change.
|
|
476
|
-
* @cssprop [--argus-pinned-
|
|
538
|
+
* @cssprop [--argus-row-pinned-bg=var(--argus-bg)] - Background of the pinned rows, pinned columns included.
|
|
477
539
|
* @cssprop [--argus-skeleton-bg] - Colour of the skeleton bars in rows still loading. Default: the text colour at low opacity.
|
|
478
540
|
* @cssprop [--argus-row-selected-bg] - Background of selected rows, pinned columns included. Default: the system highlight colour, mixed into `--argus-bg`. It wins over `--argus-row-hover-bg`.
|
|
479
541
|
*/
|
|
@@ -487,6 +549,17 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
487
549
|
*/
|
|
488
550
|
get columns(): readonly ColumnDef<T>[];
|
|
489
551
|
set columns(value: readonly ColumnDef<T>[] | null | undefined);
|
|
552
|
+
/**
|
|
553
|
+
* Headers over several columns: `{ id, header, columns }`, where `columns` lists
|
|
554
|
+
* column ids and nested groups. Each level of nesting adds a header row. A group's
|
|
555
|
+
* columns stay next to each other: they move within the group, and the group
|
|
556
|
+
* moves as a whole (drag its header, or Alt+Shift+Arrow). A group whose columns
|
|
557
|
+
* are pinned to different sides shows on each side. Property only. While empty
|
|
558
|
+
* and `columns` is too, the table reads its `<argus-column-group>` children.
|
|
559
|
+
* `null` or `undefined` means `[]`.
|
|
560
|
+
*/
|
|
561
|
+
get columnGroups(): readonly ColumnGroup[];
|
|
562
|
+
set columnGroups(value: readonly ColumnGroup[] | null | undefined);
|
|
490
563
|
/**
|
|
491
564
|
* The rows to show. Replace the array to update; changes inside it aren't
|
|
492
565
|
* detected. `null` or `undefined` means `[]`.
|
|
@@ -495,11 +568,12 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
495
568
|
set data(value: readonly T[] | null | undefined);
|
|
496
569
|
/**
|
|
497
570
|
* Loads rows page by page as they scroll into view, instead of `data`:
|
|
498
|
-
* `{ getRows({ start, end, sorting, signal }), pageSize? }`,
|
|
499
|
-
* exclusive and `getRows` resolves to `{ rows, total? }`. Without a
|
|
500
|
-
* the table grows as pages arrive and a short page marks the end. Sorting
|
|
501
|
-
*
|
|
502
|
-
* over `data`. Replace the object to change `getRows` or
|
|
571
|
+
* `{ getRows({ start, end, sorting, filters, quickFilter, signal }), pageSize? }`,
|
|
572
|
+
* where `end` is exclusive and `getRows` resolves to `{ rows, total? }`. Without a
|
|
573
|
+
* `total`, the table grows as pages arrive and a short page marks the end. Sorting
|
|
574
|
+
* and filtering happen on the server: a new order or filter reloads from the top.
|
|
575
|
+
* While set, it wins over `data`. Replace the object to change `getRows` or
|
|
576
|
+
* `pageSize`.
|
|
503
577
|
*/
|
|
504
578
|
dataSource?: DataSource<T>;
|
|
505
579
|
/**
|
|
@@ -535,12 +609,13 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
535
609
|
* explicitly, so page CSS that relies on their order in the DOM (`:nth-child`
|
|
536
610
|
* on cells) doesn't apply. `autosizeColumns()` and `width: 'auto'` columns
|
|
537
611
|
* still measure columns out of view: they render for the measurement.
|
|
612
|
+
* As an attribute, `virtualize-columns="false"` is off, like no attribute.
|
|
538
613
|
*/
|
|
539
614
|
virtualizeColumns: boolean;
|
|
540
615
|
/**
|
|
541
616
|
* The sort order, e.g. `[{ id: 'total', desc: true }]`; `[]` when unsorted. Unset,
|
|
542
617
|
* the table keeps it itself and header clicks change it. Once set, it is
|
|
543
|
-
* controlled: a click only fires `argus-
|
|
618
|
+
* controlled: a click only fires `argus-sorting-change` with the proposed order,
|
|
544
619
|
* and nothing changes until you set the property. Set `undefined` to hand it back.
|
|
545
620
|
*/
|
|
546
621
|
get sorting(): SortState;
|
|
@@ -548,7 +623,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
548
623
|
/**
|
|
549
624
|
* Resized widths in px by column id, e.g. `{ name: 240 }`. A resized flex column
|
|
550
625
|
* becomes fixed. Uncontrolled until set, like `sorting`: once set, a resize only
|
|
551
|
-
* fires `argus-column-
|
|
626
|
+
* fires `argus-column-sizing-change` with the proposed widths. `undefined` hands it back.
|
|
552
627
|
*/
|
|
553
628
|
get columnSizing(): ColumnSizingState;
|
|
554
629
|
set columnSizing(value: ColumnSizingState | undefined);
|
|
@@ -558,7 +633,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
558
633
|
* Each pin group (start-pinned, scrolling, end-pinned) takes its columns in this
|
|
559
634
|
* order; unknown ids are ignored and columns it doesn't list follow the listed
|
|
560
635
|
* ones of their group. After a move it holds every column id. Uncontrolled
|
|
561
|
-
* until set, like `sorting`: once set, a move only fires `argus-column-
|
|
636
|
+
* until set, like `sorting`: once set, a move only fires `argus-column-order-change`
|
|
562
637
|
* with the proposed order. `undefined` hands it back.
|
|
563
638
|
*/
|
|
564
639
|
get columnOrder(): ColumnOrderState;
|
|
@@ -569,7 +644,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
569
644
|
* `{ total: 'end', id: false }`. Columns it doesn't list keep their `pin`. A pinned
|
|
570
645
|
* column joins the edge of its group nearest its place in `columnOrder`, and stops
|
|
571
646
|
* flexing. Uncontrolled until set, like `sorting`: once set, pinning from a plugin
|
|
572
|
-
* only fires `argus-column-
|
|
647
|
+
* only fires `argus-column-pinning-change` with the proposed pins. `undefined` hands it back.
|
|
573
648
|
*/
|
|
574
649
|
get columnPinning(): ColumnPinningState;
|
|
575
650
|
set columnPinning(value: ColumnPinningState | undefined);
|
|
@@ -579,7 +654,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
579
654
|
* doesn't list keep their `hidden`. A hidden column isn't rendered, but sorting by
|
|
580
655
|
* it still works and it keeps its place in `columnOrder`. Uncontrolled until set,
|
|
581
656
|
* like `sorting`: once set, hiding or showing from a plugin only fires
|
|
582
|
-
* `argus-column-
|
|
657
|
+
* `argus-column-visibility-change` with the proposed visibility. `undefined` hands it back.
|
|
583
658
|
*/
|
|
584
659
|
get columnVisibility(): ColumnVisibilityState;
|
|
585
660
|
set columnVisibility(value: ColumnVisibilityState | undefined);
|
|
@@ -591,7 +666,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
591
666
|
* `dataSource`, the filters go to `getRows()` and the server filters. Users set
|
|
592
667
|
* filters through plugins (the column menu) on columns with a `filter` kind.
|
|
593
668
|
* Uncontrolled until set, like `sorting`: once set, a change from a plugin only
|
|
594
|
-
* fires `argus-column-
|
|
669
|
+
* fires `argus-column-filters-change` with the proposed filters. `undefined` hands it back.
|
|
595
670
|
*/
|
|
596
671
|
get columnFilters(): ColumnFilterState;
|
|
597
672
|
set columnFilters(value: ColumnFilterState | undefined);
|
|
@@ -619,12 +694,13 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
619
694
|
* every row, or clears the selection when all are selected. Space on a
|
|
620
695
|
* focused checkbox cell does the same. The column isn't part of `columns`,
|
|
621
696
|
* `columnOrder` or `columnSizing`, and it fires no `argus-cell-click`.
|
|
697
|
+
* As an attribute, `selection-checkboxes="false"` is off, like no attribute.
|
|
622
698
|
*/
|
|
623
699
|
selectionCheckboxes: boolean;
|
|
624
700
|
/**
|
|
625
701
|
* The selected rows, as row ids (from `getRowId`, or the row's index as a
|
|
626
702
|
* string), e.g. `['p4', 'p7']`. Uncontrolled until set, like `sorting`: once
|
|
627
|
-
* set, a click only fires `argus-
|
|
703
|
+
* set, a click only fires `argus-selection-change` with the proposed ids.
|
|
628
704
|
* `undefined` hands it back. The table never drops ids on its own: they stay
|
|
629
705
|
* through sorting, a new `data` or reloaded pages. With a `dataSource`,
|
|
630
706
|
* Ctrl/Cmd+A selects the loaded rows only.
|
|
@@ -662,7 +738,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
662
738
|
/**
|
|
663
739
|
* Fits columns to their content: the header, the pinned rows and the body rows
|
|
664
740
|
* rendered now (rows out of view aren't measured). It resizes them like a drag
|
|
665
|
-
* would, so `argus-column-
|
|
741
|
+
* would, so `argus-column-sizing-change` fires for each column that changes, and with a
|
|
666
742
|
* controlled `columnSizing` nothing changes until you set it. Without `ids`, fits
|
|
667
743
|
* every resizable column; columns with `resizable: false` keep their width.
|
|
668
744
|
* With `virtualizeColumns`, columns out of view render for the measurement.
|
|
@@ -675,7 +751,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
675
751
|
* The state users change, as one object of plain JSON for saving a user's
|
|
676
752
|
* layout: `sorting`, `columnSizing`, `columnOrder`, `columnPinning`,
|
|
677
753
|
* `columnVisibility`, `columnFilters`, `selection`, `quickFilter`, and `scroll`
|
|
678
|
-
* (the row at the top and the
|
|
754
|
+
* (the row at the top and the inline offset), with `version: 1`. Controlled properties are
|
|
679
755
|
* included with the values you set. The object is a copy: changing it changes
|
|
680
756
|
* nothing in the table.
|
|
681
757
|
*/
|
|
@@ -683,7 +759,7 @@ declare class ArgusTable<T = unknown> extends LitElement {
|
|
|
683
759
|
/**
|
|
684
760
|
* Restores state from `getState()`, for example a layout saved in
|
|
685
761
|
* `localStorage`. Only the keys given change; ids of columns that no longer
|
|
686
|
-
* exist are ignored. Properties you control are left alone (set them
|
|
762
|
+
* exist are ignored. State of another `version` is ignored as a whole. Properties you control are left alone (set them
|
|
687
763
|
* yourself), and the others stay uncontrolled. No change events fire.
|
|
688
764
|
* `quickFilter` is set like the property: a search box of yours shows it only
|
|
689
765
|
* if you read it back. `scroll` is applied after the rest, so with a
|
|
@@ -717,15 +793,35 @@ interface ArgusPlugin<T = unknown> {
|
|
|
717
793
|
* runs when the plugin leaves `plugins` or the table is disconnected.
|
|
718
794
|
*/
|
|
719
795
|
connect?(host: PluginHost<T>): (() => void) | undefined;
|
|
796
|
+
/**
|
|
797
|
+
* Runs at the start of each update of the table, before the `columns` and
|
|
798
|
+
* `columnGroups` transforms, with the names of the table's properties that
|
|
799
|
+
* changed (`data`, `columnFilters`, `quickFilter`, `columnVisibility`, …).
|
|
800
|
+
* Call `host.invalidateColumns()` here to have `columns` run again in this same
|
|
801
|
+
* update, for columns that depend on more than the column definitions.
|
|
802
|
+
*/
|
|
803
|
+
willUpdate?(changed: ReadonlySet<string>, host: PluginHost<T>): void;
|
|
720
804
|
/**
|
|
721
805
|
* Changes the column definitions before the table reads them: add computed
|
|
722
806
|
* columns, wrap `header` content, change defaults. Gets the output of the
|
|
723
807
|
* plugin before it (the first one gets `columns` or the `<argus-column>`
|
|
724
808
|
* children). Runs again only when those columns or `plugins` change, or after
|
|
725
809
|
* `host.invalidateColumns()`; a `header` or `cell` function it returns still
|
|
726
|
-
* runs on every render.
|
|
810
|
+
* runs on every render. Return `undefined` to leave them as they are.
|
|
811
|
+
*
|
|
812
|
+
* Content is `unknown` here: in the framework wrappers, `header` and `cell` return
|
|
813
|
+
* React nodes or Vue VNodes. Nest a column's own content in a template of the
|
|
814
|
+
* plugin's through `host.content()`.
|
|
727
815
|
*/
|
|
728
|
-
columns?(defs: readonly ColumnDef<T>[], host: PluginHost<T>): readonly ColumnDef<T>[];
|
|
816
|
+
columns?(defs: readonly ColumnDef<T, unknown>[], host: PluginHost<T>): readonly ColumnDef<T, unknown>[] | undefined;
|
|
817
|
+
/**
|
|
818
|
+
* Changes the column groups before the table reads them, as `columns` does the
|
|
819
|
+
* columns: wrap a group's `header`, for example. Gets the output of the plugin
|
|
820
|
+
* before it (the first one gets `columnGroups` or the `<argus-column-group>`
|
|
821
|
+
* children). Runs again only when those groups or `plugins` change, or after
|
|
822
|
+
* `host.invalidateColumns()`. Return `undefined` to leave them as they are.
|
|
823
|
+
*/
|
|
824
|
+
columnGroups?(groups: readonly ColumnGroup<unknown>[], host: PluginHost<T>): readonly ColumnGroup<unknown>[] | undefined;
|
|
729
825
|
/**
|
|
730
826
|
* A key pressed on a focused header or cell, before the table handles it.
|
|
731
827
|
* Return `true` to claim the key: the table then ignores it (call
|
|
@@ -760,19 +856,17 @@ interface ColumnInfo {
|
|
|
760
856
|
/** Current width in px. */
|
|
761
857
|
width: number;
|
|
762
858
|
/** The sort direction, if the table is sorted by this column. */
|
|
763
|
-
sorted:
|
|
764
|
-
/**
|
|
765
|
-
|
|
766
|
-
* can't filter it. Optional, like any later addition.
|
|
767
|
-
*/
|
|
768
|
-
filter?: FilterKind | undefined;
|
|
859
|
+
sorted: SortDirection | undefined;
|
|
860
|
+
/** The kind of filter users can set (the column's `filter`), or `undefined` when they can't filter it. */
|
|
861
|
+
filter: FilterKind | undefined;
|
|
769
862
|
/** The column's filter in `columnFilters`, if it has one. */
|
|
770
|
-
|
|
863
|
+
columnFilter: ColumnFilter | undefined;
|
|
771
864
|
}
|
|
772
865
|
/**
|
|
773
|
-
* What the table offers a plugin. Plugins get it; they don't implement it
|
|
774
|
-
*
|
|
775
|
-
*
|
|
866
|
+
* What the table offers a plugin. Plugins get it; they don't implement it, so
|
|
867
|
+
* members added in later versions are there too (check the table's version, not
|
|
868
|
+
* the member). The table's public API (`sorting`, `columnSizing`,
|
|
869
|
+
* `autosizeColumns()`, `updateComplete`) is on `element`.
|
|
776
870
|
*/
|
|
777
871
|
interface PluginHost<T = unknown> {
|
|
778
872
|
readonly element: ArgusTable<T>;
|
|
@@ -785,52 +879,61 @@ interface PluginHost<T = unknown> {
|
|
|
785
879
|
* Every column, hidden ones included, in the column order (start-pinned,
|
|
786
880
|
* scrolling, end-pinned), for lists such as "show hidden columns".
|
|
787
881
|
*/
|
|
788
|
-
columns
|
|
882
|
+
columns(): ColumnInfo[];
|
|
789
883
|
/** The header or cell an event happened in, if any. */
|
|
790
884
|
cellOf(event: Event): CellTarget | undefined;
|
|
791
885
|
/**
|
|
792
|
-
* Sorts by a column, or (`
|
|
886
|
+
* Sorts by a column, or (`undefined`) clears the sort if it is by that column.
|
|
793
887
|
* Follows the `sorting` rules: when it is controlled, only
|
|
794
|
-
* `argus-
|
|
888
|
+
* `argus-sorting-change` fires with the proposed order. Does nothing for a
|
|
795
889
|
* column that isn't sortable. Use this rather than setting `sorting`, which
|
|
796
890
|
* would make it controlled.
|
|
797
891
|
*/
|
|
798
|
-
setSort(columnId: string, direction:
|
|
892
|
+
setSort(columnId: string, direction: SortDirection | undefined): void;
|
|
799
893
|
/**
|
|
800
894
|
* Pins a column to a side, or (`false`) unpins it. Follows the `columnPinning`
|
|
801
|
-
* rules: when it is controlled, only `argus-column-
|
|
895
|
+
* rules: when it is controlled, only `argus-column-pinning-change` fires with the proposed
|
|
802
896
|
* pins. Does nothing for a column with `pinnable: false`, or without a change.
|
|
803
897
|
*/
|
|
804
|
-
setPin
|
|
898
|
+
setPin(columnId: string, pin: ColumnPin | false): void;
|
|
805
899
|
/**
|
|
806
900
|
* Hides or shows a column. Follows the `columnVisibility` rules: when it is
|
|
807
|
-
* controlled, only `argus-column-
|
|
901
|
+
* controlled, only `argus-column-visibility-change` fires with the proposed visibility. Does
|
|
808
902
|
* nothing without a change, when hiding a column with `hideable: false`, or
|
|
809
903
|
* when hiding the last column shown.
|
|
810
904
|
*/
|
|
811
|
-
setHidden
|
|
905
|
+
setHidden(columnId: string, hidden: boolean): void;
|
|
812
906
|
/**
|
|
813
907
|
* Sets a column's filter, or (`undefined`) clears it. Follows the `columnFilters`
|
|
814
|
-
* rules: when it is controlled, only `argus-column-
|
|
908
|
+
* rules: when it is controlled, only `argus-column-filters-change` fires with the proposed
|
|
815
909
|
* filters. Does nothing without a change, or when setting a filter on a column
|
|
816
910
|
* without `filter`.
|
|
817
911
|
*/
|
|
818
|
-
setFilter
|
|
912
|
+
setFilter(columnId: string, filter: ColumnFilter | undefined): void;
|
|
819
913
|
/**
|
|
820
914
|
* The values a `'set'` filter on the column can offer: its `filterOptions`, else the
|
|
821
915
|
* distinct values of the rows the other filters keep, sorted, at most `limit`
|
|
822
916
|
* (default 1000; `truncated` when there are more). `undefined` with a `dataSource`
|
|
823
917
|
* and no `filterOptions`, and for an unknown column.
|
|
824
918
|
*/
|
|
825
|
-
filterValues
|
|
919
|
+
filterValues(columnId: string, limit?: number): {
|
|
826
920
|
values: FilterValue[];
|
|
827
921
|
truncated: boolean;
|
|
828
922
|
} | undefined;
|
|
923
|
+
/**
|
|
924
|
+
* The indexes in `data` of the rows the column filters and the quick filter
|
|
925
|
+
* keep, ascending (not in the sorted order), leaving out the filters on the
|
|
926
|
+
* `except` columns and their text in the quick filter: for values computed over
|
|
927
|
+
* the rows shown, such as a share of a total. `undefined` with a `dataSource`.
|
|
928
|
+
* A column's `accessor` may call it while the table filters or sorts, as long as
|
|
929
|
+
* that column is one of `except` (the table doesn't read it for this list).
|
|
930
|
+
*/
|
|
931
|
+
filteredIndexes(except?: readonly string[]): readonly number[] | undefined;
|
|
829
932
|
/** Moves focus to a column's header, after the next update. */
|
|
830
933
|
focusHeader(columnId: string): void;
|
|
831
934
|
/** Says something to screen readers through a polite live region. */
|
|
832
935
|
announce(message: string): void;
|
|
833
|
-
/** Runs the plugins' `columns` again on the next update. */
|
|
936
|
+
/** Runs the plugins' `columns` and `columnGroups` again on the next update. */
|
|
834
937
|
invalidateColumns(): void;
|
|
835
938
|
/** Renders again: header and cell functions run with the plugin's new state. */
|
|
836
939
|
requestUpdate(): void;
|
|
@@ -838,14 +941,14 @@ interface PluginHost<T = unknown> {
|
|
|
838
941
|
* The body row at `index` in the current order (sorted, as shown), or
|
|
839
942
|
* `undefined` past the end and for a `dataSource` row that isn't loaded.
|
|
840
943
|
*/
|
|
841
|
-
row
|
|
944
|
+
row(index: number): T | undefined;
|
|
842
945
|
/**
|
|
843
946
|
* Wraps a column's own header or cell content for a template of the plugin's: in
|
|
844
947
|
* `html\`<b>${host.content(own)}</b>\``, framework content (React elements, Vue
|
|
845
948
|
* VNodes) still reaches the table's `contentRenderer`, and plain content renders
|
|
846
949
|
* as usual. Use it wherever a plugin nests what `header` or `cell` returned.
|
|
847
950
|
*/
|
|
848
|
-
content
|
|
951
|
+
content(value: unknown): unknown;
|
|
849
952
|
}
|
|
850
953
|
|
|
851
954
|
/**
|
|
@@ -861,6 +964,11 @@ type CellContent = TemplateResult | Node | string | number;
|
|
|
861
964
|
* `contentRenderer`.
|
|
862
965
|
*/
|
|
863
966
|
type ColumnDef<T = unknown, TContent = CellContent> = ColumnDef$1<T, TContent>;
|
|
967
|
+
/**
|
|
968
|
+
* A header over several columns (`columnGroups`): an `id`, a `header`, and the
|
|
969
|
+
* `columns` it spans, by id, with nested groups among them.
|
|
970
|
+
*/
|
|
971
|
+
type ColumnGroup<TContent = CellContent> = ColumnGroup$1<TContent>;
|
|
864
972
|
/** Row density. Each one sets defaults for `--argus-row-height` and `--argus-cell-padding-inline`. */
|
|
865
973
|
type Density = 'compact' | 'comfortable' | 'spacious';
|
|
866
974
|
|
|
@@ -868,8 +976,8 @@ type Density = 'compact' | 'comfortable' | 'spacious';
|
|
|
868
976
|
* One column of the parent `<argus-table>`, written as markup instead of an entry in
|
|
869
977
|
* its `columns` property. It is data only and renders nothing.
|
|
870
978
|
*
|
|
871
|
-
* Only direct children of the table
|
|
872
|
-
* property wins over the children. Adding, removing, moving or changing a column
|
|
979
|
+
* Only direct children of the table or of an `<argus-column-group>` count, in
|
|
980
|
+
* document order. A non-empty `columns` property wins over the children. Adding, removing, moving or changing a column
|
|
873
981
|
* updates the table; sizes, order and sorting are kept by `column-id`.
|
|
874
982
|
*
|
|
875
983
|
* A `<template>` child is the content of every cell in the column (static: the same
|
|
@@ -943,6 +1051,7 @@ declare class ArgusColumn<T = unknown> extends ReactiveElement {
|
|
|
943
1051
|
* The column as the table reads it. Unset fields stay `undefined`, which the
|
|
944
1052
|
* table reads as its defaults. An unknown `pin` is ignored and an unknown
|
|
945
1053
|
* `align` falls back to `start`.
|
|
1054
|
+
* @internal
|
|
946
1055
|
*/
|
|
947
1056
|
toColumnDef(): ColumnDef<T>;
|
|
948
1057
|
protected willUpdate(): void;
|
|
@@ -954,43 +1063,80 @@ declare global {
|
|
|
954
1063
|
}
|
|
955
1064
|
}
|
|
956
1065
|
|
|
957
|
-
/**
|
|
1066
|
+
/**
|
|
1067
|
+
* A header over the `<argus-column>` children it wraps, written as markup instead
|
|
1068
|
+
* of an entry in the table's `columnGroups` property. Groups nest: a group inside
|
|
1069
|
+
* a group adds a header row. It is data only and renders nothing.
|
|
1070
|
+
*
|
|
1071
|
+
* Only direct children of the table or of another group count. A non-empty
|
|
1072
|
+
* `columnGroups` property wins over the children, and a non-empty `columns`
|
|
1073
|
+
* property turns all column and group children off.
|
|
1074
|
+
*
|
|
1075
|
+
* @summary Declarative column group of an `<argus-table>`.
|
|
1076
|
+
*/
|
|
1077
|
+
declare class ArgusColumnGroup extends ReactiveElement {
|
|
1078
|
+
#private;
|
|
1079
|
+
/** Stable key. Must be unique among the table's groups; it may equal a column id. */
|
|
1080
|
+
groupId: string;
|
|
1081
|
+
/** Header content: text as an attribute; a Lit template, a node or a function as a property. Default: the id. */
|
|
1082
|
+
header?: CellContent | (() => CellContent);
|
|
1083
|
+
/** Whether the group can be moved as a whole. Default: `true`; `reorderable="false"` turns it off. */
|
|
1084
|
+
reorderable?: boolean;
|
|
1085
|
+
/** Data only: no shadow root, nothing rendered. */
|
|
1086
|
+
protected createRenderRoot(): HTMLElement;
|
|
1087
|
+
connectedCallback(): void;
|
|
1088
|
+
disconnectedCallback(): void;
|
|
1089
|
+
/**
|
|
1090
|
+
* The group as the table reads it, with its column and group children in document order.
|
|
1091
|
+
* @internal
|
|
1092
|
+
*/
|
|
1093
|
+
toColumnGroup(): ColumnGroup;
|
|
1094
|
+
protected willUpdate(): void;
|
|
1095
|
+
protected updated(): void;
|
|
1096
|
+
}
|
|
1097
|
+
declare global {
|
|
1098
|
+
interface HTMLElementTagNameMap {
|
|
1099
|
+
'argus-column-group': ArgusColumnGroup;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
/** Fired after an update when the rows in view changed. */
|
|
958
1104
|
declare const RANGE_CHANGE = "argus-range-change";
|
|
959
|
-
/**
|
|
960
|
-
declare const
|
|
961
|
-
/**
|
|
962
|
-
declare const
|
|
963
|
-
/**
|
|
964
|
-
declare const
|
|
965
|
-
/**
|
|
966
|
-
declare const
|
|
967
|
-
/**
|
|
968
|
-
declare const
|
|
969
|
-
/**
|
|
970
|
-
declare const
|
|
1105
|
+
/** `sorting` changed (uncontrolled), or the proposed order (controlled). */
|
|
1106
|
+
declare const SORTING_CHANGE = "argus-sorting-change";
|
|
1107
|
+
/** `columnSizing` changed (uncontrolled), or the proposed widths (controlled). Once per column. */
|
|
1108
|
+
declare const COLUMN_SIZING_CHANGE = "argus-column-sizing-change";
|
|
1109
|
+
/** `columnOrder` changed (uncontrolled), or the proposed order (controlled). */
|
|
1110
|
+
declare const COLUMN_ORDER_CHANGE = "argus-column-order-change";
|
|
1111
|
+
/** `columnPinning` changed (uncontrolled), or the proposed pins (controlled). */
|
|
1112
|
+
declare const COLUMN_PINNING_CHANGE = "argus-column-pinning-change";
|
|
1113
|
+
/** `columnVisibility` changed (uncontrolled), or the proposed visibility (controlled). */
|
|
1114
|
+
declare const COLUMN_VISIBILITY_CHANGE = "argus-column-visibility-change";
|
|
1115
|
+
/** `columnFilters` changed (uncontrolled), or the proposed filters (controlled). */
|
|
1116
|
+
declare const COLUMN_FILTERS_CHANGE = "argus-column-filters-change";
|
|
1117
|
+
/** `selection` changed (uncontrolled), or the proposed ids (controlled). */
|
|
1118
|
+
declare const SELECTION_CHANGE = "argus-selection-change";
|
|
971
1119
|
/** Fired when a body row was clicked, after `argus-cell-click`. */
|
|
972
1120
|
declare const ROW_CLICK = "argus-row-click";
|
|
973
1121
|
/** Fired when a body cell was clicked, before `argus-row-click`. */
|
|
974
1122
|
declare const CELL_CLICK = "argus-cell-click";
|
|
975
|
-
/** Fired when the selected rows changed (uncontrolled), or with the proposed ids (controlled). */
|
|
976
|
-
declare const ROW_SELECT = "argus-row-select";
|
|
977
1123
|
/** Fired after the update when a `dataSource` page failed to load. */
|
|
978
1124
|
declare const LOAD_ERROR = "argus-load-error";
|
|
979
1125
|
declare global {
|
|
980
1126
|
interface HTMLElementEventMap {
|
|
981
1127
|
'argus-range-change': CustomEvent<RangeChangeDetail>;
|
|
982
|
-
'argus-
|
|
983
|
-
'argus-column-
|
|
984
|
-
'argus-column-
|
|
985
|
-
'argus-column-
|
|
986
|
-
'argus-column-
|
|
987
|
-
'argus-column-
|
|
1128
|
+
'argus-sorting-change': CustomEvent<SortingChangeDetail>;
|
|
1129
|
+
'argus-column-sizing-change': CustomEvent<ColumnSizingChangeDetail>;
|
|
1130
|
+
'argus-column-order-change': CustomEvent<ColumnOrderChangeDetail>;
|
|
1131
|
+
'argus-column-pinning-change': CustomEvent<ColumnPinningChangeDetail>;
|
|
1132
|
+
'argus-column-visibility-change': CustomEvent<ColumnVisibilityChangeDetail>;
|
|
1133
|
+
'argus-column-filters-change': CustomEvent<ColumnFiltersChangeDetail>;
|
|
1134
|
+
'argus-selection-change': CustomEvent<SelectionChangeDetail>;
|
|
988
1135
|
'argus-row-click': CustomEvent<RowClickDetail<unknown>>;
|
|
989
1136
|
'argus-cell-click': CustomEvent<CellClickDetail<unknown>>;
|
|
990
1137
|
'argus-load-error': CustomEvent<LoadErrorDetail>;
|
|
991
|
-
'argus-row-select': CustomEvent<RowSelectDetail>;
|
|
992
1138
|
}
|
|
993
1139
|
}
|
|
994
1140
|
|
|
995
|
-
export { ArgusColumn, ArgusTable, CELL_CLICK,
|
|
996
|
-
export type { ArgusPlugin, CellClickDetail, CellContent, CellContext, CellTarget, ColumnAlign, ColumnDef, ColumnFilter,
|
|
1141
|
+
export { ArgusColumn, ArgusColumnGroup, ArgusTable, CELL_CLICK, COLUMN_FILTERS_CHANGE, COLUMN_ORDER_CHANGE, COLUMN_PINNING_CHANGE, COLUMN_SIZING_CHANGE, COLUMN_VISIBILITY_CHANGE, LOAD_ERROR, RANGE_CHANGE, ROW_CLICK, SELECTION_CHANGE, SORTING_CHANGE, content };
|
|
1142
|
+
export type { ArgusPlugin, CellClickDetail, CellContent, CellContext, CellTarget, ColumnAlign, ColumnDef, ColumnFilter, ColumnFilterState, ColumnFiltersChangeDetail, ColumnGroup, ColumnInfo, ColumnOrderChangeDetail, ColumnOrderState, ColumnPin, ColumnPinningChangeDetail, ColumnPinningState, ColumnSizingChangeDetail, ColumnSizingState, ColumnVisibilityChangeDetail, ColumnVisibilityState, ColumnWidth, ContentRenderer, DataSource, DateFilter, Density, FilterKind, FilterValue, LoadErrorDetail, NumberFilter, PinnedRows, PluginHost, RangeChangeDetail, RangeFilterOp, RowClickDetail, RowPin, RowsRequest, RowsResponse, ScrollState, SelectionChangeDetail, SelectionMode, SelectionState, SetFilter, SortDirection, SortItem, SortState, SortingChangeDetail, TableState, TextFilter, TextFilterOp };
|