@universal-material/data-grid 0.1.0 → 0.3.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.
Files changed (55) hide show
  1. package/README.md +37 -20
  2. package/custom-elements.json +149 -22
  3. package/dist/data/data-source.d.ts +6 -2
  4. package/dist/data/data-source.js.map +1 -1
  5. package/dist/export/types.d.ts +1 -1
  6. package/dist/export/types.js.map +1 -1
  7. package/dist/export-xlsx/index.d.ts +2 -1
  8. package/dist/export-xlsx/index.js +4 -2
  9. package/dist/export-xlsx/index.js.map +1 -1
  10. package/dist/features/column-chooser.js +4 -3
  11. package/dist/features/column-chooser.js.map +1 -1
  12. package/dist/features/filter-row.d.ts +1 -0
  13. package/dist/features/filter-row.js +16 -10
  14. package/dist/features/filter-row.js.map +1 -1
  15. package/dist/features/header-filter.d.ts +9 -2
  16. package/dist/features/header-filter.js +22 -11
  17. package/dist/features/header-filter.js.map +1 -1
  18. package/dist/features/scroll-port.d.ts +51 -0
  19. package/dist/features/scroll-port.js +329 -0
  20. package/dist/features/scroll-port.js.map +1 -0
  21. package/dist/grid-column-def.d.ts +60 -14
  22. package/dist/grid-column-def.js +6 -2
  23. package/dist/grid-column-def.js.map +1 -1
  24. package/dist/grid-column.d.ts +31 -7
  25. package/dist/grid-column.js +40 -7
  26. package/dist/grid-column.js.map +1 -1
  27. package/dist/grid-i18n.js +14 -14
  28. package/dist/grid-i18n.js.map +1 -1
  29. package/dist/grid.d.ts +61 -14
  30. package/dist/grid.js +758 -165
  31. package/dist/grid.js.map +1 -1
  32. package/dist/grid.min.js +621 -474
  33. package/dist/grid.styles.js +153 -15
  34. package/dist/grid.styles.js.map +1 -1
  35. package/dist/render/cell.js +5 -2
  36. package/dist/render/cell.js.map +1 -1
  37. package/dist/render/group-row.js +2 -1
  38. package/dist/render/group-row.js.map +1 -1
  39. package/dist/render/header.d.ts +17 -1
  40. package/dist/render/header.js +23 -2
  41. package/dist/render/header.js.map +1 -1
  42. package/dist/render/virtualizer.d.ts +49 -1
  43. package/dist/render/virtualizer.js +229 -17
  44. package/dist/render/virtualizer.js.map +1 -1
  45. package/dist/row-model/columns.d.ts +40 -0
  46. package/dist/row-model/columns.js +25 -0
  47. package/dist/row-model/columns.js.map +1 -1
  48. package/dist/row-model/filter.d.ts +19 -4
  49. package/dist/row-model/filter.js +29 -9
  50. package/dist/row-model/filter.js.map +1 -1
  51. package/dist/row-model/format.js +1 -1
  52. package/dist/row-model/format.js.map +1 -1
  53. package/dist/state/grid-state.d.ts +2 -2
  54. package/dist/state/grid-state.js.map +1 -1
  55. package/package.json +7 -3
package/dist/grid.d.ts CHANGED
@@ -431,13 +431,14 @@ export interface GridColumnReorderEventDetail {
431
431
  * @cssprop --u-grid-toolbar-padding - Padding of the bar. Default `8px 16px`.
432
432
  * @cssprop --u-grid-toolbar-block-padding - Block padding of the bar. Default `8px`.
433
433
  * @cssprop --u-grid-toolbar-inline-padding - Inline padding of the bar. Default: the cell inline padding.
434
- * @cssprop --u-grid-header-cell-height - Height of the column header cells. Default `46px`.
434
+ * @cssprop --u-grid-toolbar-gap - Space between the bar items and between its lines (a `gap` value). Default `8px`. A change at runtime applies at the next toolbar layout (resize or item change).
435
+ * @cssprop --u-grid-header-cell-height - Minimum height of the column header cells (rows with `header-wrap` grow). Default `46px`.
435
436
  * @cssprop --u-grid-header-cell-padding - Header cell padding.
436
437
  * @cssprop --u-grid-header-cell-font-size - Header cell font size. Default `0.8125rem`.
437
438
  * @cssprop --u-grid-header-cell-font-weight - Header cell font weight.
438
- * @cssprop --u-grid-cell-padding - Data cell padding. Default `13px 16px`.
439
- * @cssprop --u-grid-cell-block-padding - Block padding of data and header cells. Default `13px`.
440
- * @cssprop --u-grid-cell-inline-padding - Inline padding of data and header cells. Default `16px`.
439
+ * @cssprop --u-grid-cell-padding - Data cell padding (shorthand; wins over the longhands). Default `13px 16px`.
440
+ * @cssprop --u-grid-cell-block-padding - Block padding of data and header cells; wins over the old `--u-table-cell-padding` and `--u-grid-data-cell-padding`. Default `13px`.
441
+ * @cssprop --u-grid-cell-inline-padding - Inline padding of data and header cells; wins over the old `--u-table-cell-padding` and `--u-grid-data-cell-padding`. Default `16px`.
441
442
  * @cssprop --u-grid-cell-font-size - Data cell font size. Default `0.875rem`.
442
443
  * @cssprop --u-grid-cell-font-weight - Data cell font weight.
443
444
  * @cssprop --u-grid-row-hover-opacity - Intensity of the row and header hover tint (`0%` disables it). Default: state-layer hover token or `8%`.
@@ -466,8 +467,8 @@ export interface GridColumnReorderEventDetail {
466
467
  * @cssprop --u-grid-sort-indicator-size - Size of the sort arrow. Default `1.125em`.
467
468
  * @cssprop --u-grid-drop-indicator-color - Drag-and-drop drop indicator color.
468
469
  * @cssprop --u-grid-drop-indicator-width - Drop indicator thickness. Default `3px`.
469
- * @cssprop --u-grid-resize-handle-width - Invisible resize hit area at the end of each header cell (over the end padding, capped to it; the cursor changes on hover). Default `8px`.
470
- * @cssprop --u-grid-column-header-menu-button-size - Size of the "⋮" column header menu button and of the header filter button. Default `24px` (WCAG 2.5.8).
470
+ * @cssprop --u-grid-resize-handle-width - Invisible resize area at the end of each header cell, over its end padding (the header buttons reach up to it). Default `8px`.
471
+ * @cssprop --u-grid-column-header-menu-button-size - Size of the header "⋮" and filter buttons, side by side. Default `24px` (WCAG 2.5.8; below it, add spacing).
471
472
  * @cssprop --u-grid-resize-handle-color - Color of the separator shown at the column edge while dragging to resize. Default: `--u-grid-drop-indicator-color`.
472
473
  * @cssprop --u-grid-fixed-shadow-color - Shadow at the edge of fixed columns while scrolling.
473
474
  * @cssprop --u-grid-column-chooser-background-color - Column chooser background.
@@ -483,7 +484,7 @@ export interface GridColumnReorderEventDetail {
483
484
  * @cssprop --u-grid-header-filter-background-color - Header filter popover background.
484
485
  * @cssprop --u-grid-header-filter-shape - Header filter popover corner radius. Default `12px`.
485
486
  * @cssprop --u-grid-load-panel-background-color - Background of the load panel.
486
- * @cssprop --u-grid-skeleton-row-color - Color of the placeholders in rows still loading.
487
+ * @cssprop --u-grid-skeleton-row-color - Color of the placeholders in rows still loading (remote rows, or `loading` with no rows).
487
488
  * @cssprop --u-grid-pager-height - Minimum height of the pager. Default `56px`.
488
489
  * @cssprop --u-grid-modified-cell-background-color - Background of edited, unsaved cells (`editMode="batch"`). Default: primary color at 10%.
489
490
  * @cssprop --u-grid-modified-cell-indicator-color - Corner mark of edited, unsaved cells (not shown by color alone). Default: primary color.
@@ -506,7 +507,7 @@ export interface GridColumnReorderEventDetail {
506
507
  * @csspart cell - Data cells (`<td>`).
507
508
  * @csspart selection-cell - Cells and header of the selection checkbox column.
508
509
  * @csspart selection-checkbox - The selection checkboxes (rows and "select all").
509
- * @csspart no-data - The cell rendered in the empty state.
510
+ * @csspart no-data - The cell rendered in the empty state, or the "Loading…" cell while `loading` has no rows.
510
511
  * @csspart header-cell - Column header cells (`<th>`), bands included.
511
512
  * @csspart band-header-cell - Band header cells (multi-level headers); they also match `header-cell`.
512
513
  * @csspart sort-indicator - The sort arrow (and priority number) in headers and group chips.
@@ -562,8 +563,8 @@ export interface GridColumnReorderEventDetail {
562
563
  * @csspart pager-button - Pager buttons (first, previous, page numbers, next, last).
563
564
  * @csspart page-size-select - The page size `<select>` of the pager.
564
565
  * @csspart page-info - The "Page x of y (n items)" text of the pager.
565
- * @csspart load-panel - The load panel shown while a data source loads.
566
- * @csspart skeleton-row - Rows of a remote source not loaded yet (with `row`).
566
+ * @csspart load-panel - The load panel shown while a data source loads or `loading` is set (with rows).
567
+ * @csspart skeleton-row - Rows of a remote source not loaded yet (with `row`), or placeholder rows while `loading` has no rows.
567
568
  * @csspart error-row - The bar shown when the data source failed.
568
569
  * @csspart retry-button - The "Retry" button of the error bar.
569
570
  * @csspart search-highlight - Search matches (`<mark>`) in native cells (not in `renderer` cells).
@@ -602,6 +603,24 @@ export declare class DataGrid extends LitElement {
602
603
  * the translated "No data" text.
603
604
  */
604
605
  noDataRenderer: GridNoDataRenderer | null;
606
+ /**
607
+ * Shows the grid as loading, for `items` you are still fetching. With rows
608
+ * on screen, the load panel (`::part(load-panel)`) covers them; with no rows
609
+ * yet, a "Loading…" row and placeholder rows (`::part(skeleton-row)`) take
610
+ * the place of the empty state (`noDataRenderer` is not called). Placeholder
611
+ * rows are never data: not exported, selected, counted or focusable by API.
612
+ * Does not fire `u-grid-loading`/`u-grid-load`; with `dataSource`, it adds
613
+ * to the source's own loading state (the getter returns only what you set).
614
+ */
615
+ loading: boolean;
616
+ /**
617
+ * Wraps the column header labels in several lines instead of an ellipsis
618
+ * (the header row grows; `--u-grid-header-cell-height` is its minimum). A
619
+ * column's `headerWrap` wins. Auto-size measures the label in one line. If
620
+ * the toolbar and the headers take more than half of the visible height,
621
+ * the headers stop sticking (WCAG 2.4.11).
622
+ */
623
+ headerWrap: boolean;
605
624
  /**
606
625
  * Builds the detail of a row (master-detail; property only). With it, a
607
626
  * toggle column appears at the start and each expanded row is followed by
@@ -778,6 +797,32 @@ export declare class DataGrid extends LitElement {
778
797
  * the end is reached (remote paging only; with `paging` the pager wins).
779
798
  */
780
799
  scrollMode: GridScrollMode;
800
+ /**
801
+ * Scrolls the grid with an outer container instead of its own scrollbar:
802
+ * the id of an ANCESTOR of the grid (the first ancestor with this id,
803
+ * crossing shadow boundaries, unlike IDREF attributes), or `window` for
804
+ * the page (wins over an element with `id="window"`). The grid grows to
805
+ * its content (do not give it a height), the container scrolls in both
806
+ * directions, and rows and columns are still virtualized by the visible
807
+ * part of the container; toolbar, headers, totals, fixed rows and columns
808
+ * stick to it. The container's `scroll-padding-top`/`-bottom` offsets
809
+ * what the page sticks there (an app bar). `<html>` (or the
810
+ * `document.scrollingElement`) means the window; `<body>` only when it is
811
+ * the scrolling element. Not found, not an ancestor or empty: a console
812
+ * warning and the grid's own scrolling. An element between the grid and
813
+ * the container that clips or scrolls (`overflow` other than
814
+ * `visible`/`clip`) also warns: sticky headers would stick to it. Resolved when
815
+ * the grid connects and when this changes (changing the ancestor's id
816
+ * later does not re-resolve). The attribute alone renders the outer mode
817
+ * on the server.
818
+ */
819
+ scrollContainer: string | null;
820
+ /**
821
+ * The outer scroll container by reference (wins over `scrollContainer`):
822
+ * an ancestor element, or `window`. `document.documentElement` (or the
823
+ * `document.scrollingElement`) means the window. See `scrollContainer`.
824
+ */
825
+ scrollContainerElement: HTMLElement | Window | null;
781
826
  /**
782
827
  * Row items (property only). The grid never mutates this array or its
783
828
  * items. Use either `items` or `dataSource` (both = console error, the
@@ -801,7 +846,7 @@ export declare class DataGrid extends LitElement {
801
846
  /** @deprecated Use `sortMode` (attribute `sort-mode`). */
802
847
  get sorting(): GridSortMode;
803
848
  set sorting(value: GridSortMode);
804
- /** Row height in px (rows with `wrap` columns can grow). */
849
+ /** Row height in px, padding included (rows with `wrap` columns or taller content grow; the virtualizer measures them). */
805
850
  rowHeight: number;
806
851
  /** Tints even rows. */
807
852
  striped: boolean;
@@ -914,8 +959,9 @@ export declare class DataGrid extends LitElement {
914
959
  * Column filter (property only): a serializable expression such as
915
960
  * `[['age', '>', 30], 'and', ['name', 'contains', 'an']]`. The filter row
916
961
  * and the header filter read and write it, so it always holds the current
917
- * filter. The grid keeps a frozen copy (never the host array). Setting it
918
- * does not fire `u-grid-filter-change`.
962
+ * filter. A condition refers to its column by `path` or, for a computed
963
+ * column (`valueGetter` without `path`), by `name`. The grid keeps a frozen
964
+ * copy (never the host array). Setting it does not fire `u-grid-filter-change`.
919
965
  */
920
966
  get filterValue(): GridFilterExpression | null;
921
967
  set filterValue(value: GridFilterExpression | null | undefined);
@@ -1251,7 +1297,8 @@ export declare class DataGrid extends LitElement {
1251
1297
  clearFilter(): void;
1252
1298
  /**
1253
1299
  * The effective filter: `filterValue` `and` the search, as an expression
1254
- * (copy). The search becomes `[path, 'contains', text]` joined by `or`
1300
+ * (copy). The search becomes `[field, 'contains', text]` (`field`: the
1301
+ * `path`, or the `name` of a computed column) joined by `or`
1255
1302
  * over the visible filterable columns (number and date columns included:
1256
1303
  * `contains` matches their displayed text). `null` without filter.
1257
1304
  */