@ixfx/components 0.7.2 → 0.7.4
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/bundle/index.d.ts +805 -137
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +2168 -42
- package/bundle/index.js.map +1 -1
- package/dist/ac-text.js +1 -1
- package/dist/ac-token.js +1 -1
- package/dist/crumbs.js +3 -3
- package/dist/{data-grid-Bh4YrQGK.d.ts → data-grid-BddUjAti.d.ts} +33 -1
- package/dist/data-grid-BddUjAti.d.ts.map +1 -0
- package/dist/data-grid.d.ts +1 -1
- package/dist/data-grid.js +180 -7
- package/dist/data-grid.js.map +1 -1
- package/dist/detail-list-Br0WAnry.d.ts +167 -0
- package/dist/detail-list-Br0WAnry.d.ts.map +1 -0
- package/dist/detail-list.d.ts +3 -0
- package/dist/detail-list.js +1115 -0
- package/dist/detail-list.js.map +1 -0
- package/dist/grid-list-B_orPsot.d.ts +304 -0
- package/dist/grid-list-B_orPsot.d.ts.map +1 -0
- package/dist/grid-list.d.ts +3 -0
- package/dist/grid-list.js +933 -0
- package/dist/grid-list.js.map +1 -0
- package/dist/{grouped-item-lister-DnWB-eFT.d.ts → grouped-item-lister-fdZHVxFM.d.ts} +2 -2
- package/dist/{grouped-item-lister-DnWB-eFT.d.ts.map → grouped-item-lister-fdZHVxFM.d.ts.map} +1 -1
- package/dist/grouped-item-lister.d.ts +1 -1
- package/dist/index.d.ts +267 -124
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +469 -979
- package/dist/index.js.map +1 -1
- package/dist/interaction-Cr13azbM.js +3 -0
- package/dist/list-item-animation-DuiwgN3l.js +112 -0
- package/dist/list-item-animation-DuiwgN3l.js.map +1 -0
- package/dist/list-selection-controller-CUo-Hhcm.js +338 -0
- package/dist/list-selection-controller-CUo-Hhcm.js.map +1 -0
- package/dist/{list-selection-types-DSuRNWpx.d.ts → list-selection-types-B5ioL-dG.d.ts} +6 -1
- package/dist/list-selection-types-B5ioL-dG.d.ts.map +1 -0
- package/dist/{menu-CXDFJxNm.js → menu-Bg90Qr0B.js} +7 -7
- package/dist/menu-Bg90Qr0B.js.map +1 -0
- package/dist/{menu-item-D2S4i8u1.js → menu-item-Bx-Fs7jq.js} +3 -3
- package/dist/{menu-item-D2S4i8u1.js.map → menu-item-Bx-Fs7jq.js.map} +1 -1
- package/dist/menu.js +2 -2
- package/dist/miller.d.ts +1 -1
- package/dist/miller.js +2 -2
- package/dist/narrowed-text.js +2 -2
- package/dist/plots.js +1 -1
- package/dist/select-horiz.js +2 -2
- package/dist/{tickled-controller-CRzdIEjJ.d.ts → tickled-controller-Bn3YdQsM.d.ts} +13 -2
- package/dist/{tickled-controller-CRzdIEjJ.d.ts.map → tickled-controller-Bn3YdQsM.d.ts.map} +1 -1
- package/dist/{tickled-controller-h9GmJ_bU.js → tickled-controller-C66DgJHl.js} +16 -1
- package/dist/tickled-controller-C66DgJHl.js.map +1 -0
- package/dist/{tree-Ch4W8qXQ.js → tree-B74zdI60.js} +116 -17
- package/dist/tree-B74zdI60.js.map +1 -0
- package/dist/tree.d.ts +6 -3
- package/dist/tree.d.ts.map +1 -1
- package/dist/tree.js +1 -1
- package/dist/vertical-list-CQSEVeOT.d.ts +140 -0
- package/dist/vertical-list-CQSEVeOT.d.ts.map +1 -0
- package/dist/vertical-list.d.ts +3 -121
- package/dist/vertical-list.js +710 -1
- package/dist/vertical-list.js.map +1 -0
- package/dist/{xy-axis-DWizs0bt.js → xy-axis-VrX8dmvS.js} +2 -2
- package/dist/{xy-axis-DWizs0bt.js.map → xy-axis-VrX8dmvS.js.map} +1 -1
- package/docs-user/README.md +2 -0
- package/docs-user/data-grid.md +51 -2
- package/docs-user/detail-list.md +80 -15
- package/docs-user/grid-list.md +274 -0
- package/docs-user/index.json +11 -2
- package/docs-user/infra-tickled.md +163 -0
- package/docs-user/llms.txt +2 -0
- package/docs-user/tree.md +13 -0
- package/docs-user/vertical-list.md +51 -1
- package/llms.txt +2 -0
- package/package.json +17 -2
- package/dist/data-grid-Bh4YrQGK.d.ts.map +0 -1
- package/dist/interaction-D5XdKzbR.js +0 -2
- package/dist/list-selection-types-DSuRNWpx.d.ts.map +0 -1
- package/dist/menu-CXDFJxNm.js.map +0 -1
- package/dist/tickled-controller-h9GmJ_bU.js.map +0 -1
- package/dist/tree-Ch4W8qXQ.js.map +0 -1
- package/dist/vertical-list-ClnqTkF3.js +0 -814
- package/dist/vertical-list-ClnqTkF3.js.map +0 -1
- package/dist/vertical-list.d.ts.map +0 -1
package/dist/ac-text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as clearHighlights, t as applyHighlights } from "./highlight-B-eQrhhb.js";
|
|
2
|
-
import { t as TickledController } from "./tickled-controller-
|
|
2
|
+
import { t as TickledController } from "./tickled-controller-C66DgJHl.js";
|
|
3
3
|
import { n as tickledStyles } from "./tickled-styles-BrAHEj1q.js";
|
|
4
4
|
import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
|
|
5
5
|
import { t as popupSurfaceStyles } from "./popup-D80sj2QC.js";
|
package/dist/ac-token.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as TickledController } from "./tickled-controller-
|
|
1
|
+
import { t as TickledController } from "./tickled-controller-C66DgJHl.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-BrAHEj1q.js";
|
|
3
3
|
import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
|
|
4
4
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
package/dist/crumbs.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as TickledController } from "./tickled-controller-
|
|
1
|
+
import { t as TickledController } from "./tickled-controller-C66DgJHl.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-BrAHEj1q.js";
|
|
3
3
|
import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
|
|
4
4
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
5
|
-
import "./interaction-
|
|
6
|
-
import "./menu-item-
|
|
5
|
+
import "./interaction-Cr13azbM.js";
|
|
6
|
+
import "./menu-item-Bx-Fs7jq.js";
|
|
7
7
|
import { t as collectDataResult } from "./data-provider-35TyWclX.js";
|
|
8
8
|
import { t as scrollFadeStyles } from "./scroll-fade-CAs1EabA.js";
|
|
9
9
|
import "./narrowed-text.js";
|
|
@@ -51,6 +51,8 @@ type BuiltInFormatterOptions = {
|
|
|
51
51
|
type DataGridGetRowKey<R> = (row: R, index: number) => string;
|
|
52
52
|
type DataGridGroupBy<R> = string | ((row: R) => string);
|
|
53
53
|
type DataGridGroupLabel = (groupKey: string, rows: readonly unknown[]) => string;
|
|
54
|
+
/** Whether the data-grid renders its built-in header column/group menu. */
|
|
55
|
+
type DataGridColumnMenu = `auto` | `none`;
|
|
54
56
|
//#endregion
|
|
55
57
|
//#region src/data-grid/data-grid.d.ts
|
|
56
58
|
type DataGridSortDetail = {
|
|
@@ -108,6 +110,7 @@ interface DataGridElementEventMap {
|
|
|
108
110
|
'datagrid-group-change': DataGridGroupChangeEvent;
|
|
109
111
|
}
|
|
110
112
|
declare class DataGridElement extends LitElement {
|
|
113
|
+
#private;
|
|
111
114
|
static styles: import("lit").CSSResult[];
|
|
112
115
|
columns: DataGridColumn[];
|
|
113
116
|
rows: unknown[];
|
|
@@ -125,6 +128,12 @@ declare class DataGridElement extends LitElement {
|
|
|
125
128
|
/** Columns keys that can be grouped by; undefined = all groupable columns */
|
|
126
129
|
groupableColumns: string[] | undefined;
|
|
127
130
|
crossGroupSelection: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* `auto` (default): render the built-in header column/group menu.
|
|
133
|
+
* `none`: don't render it — for hosts that supply their own column UI via
|
|
134
|
+
* `column.visible` + `datagrid-column-visibility`.
|
|
135
|
+
*/
|
|
136
|
+
columnMenu: DataGridColumnMenu;
|
|
128
137
|
globalFormatter?: GlobalFormatter;
|
|
129
138
|
private _columnFormatters;
|
|
130
139
|
private _selectedKeys;
|
|
@@ -169,6 +178,29 @@ declare class DataGridElement extends LitElement {
|
|
|
169
178
|
private _anchorKey;
|
|
170
179
|
private _scrollRowIntoView;
|
|
171
180
|
private _getRowForKey;
|
|
181
|
+
/** The selected row keys (read-only). */
|
|
182
|
+
get selectedKeys(): ReadonlySet<string>;
|
|
183
|
+
/** Replace the selection with these row keys (clamped to known rows). */
|
|
184
|
+
set selectedKeys(keys: Iterable<string>);
|
|
185
|
+
/**
|
|
186
|
+
* Replace the selection with the given row keys. Unknown keys are dropped;
|
|
187
|
+
* in a single-select mode only the last surviving key is kept;
|
|
188
|
+
* `selectionMode="none"` clears. Fires `datagrid-select` with the previous
|
|
189
|
+
* set when the selection actually changes.
|
|
190
|
+
*/
|
|
191
|
+
selectKeys(keys: Iterable<string>): void;
|
|
192
|
+
/** The row key under the cursor, or `undefined`. */
|
|
193
|
+
get tickledKey(): string | undefined;
|
|
194
|
+
/** Move the cursor to this row key and scroll it into view. */
|
|
195
|
+
tickleRow(key: string): void;
|
|
196
|
+
/**
|
|
197
|
+
* Append rows without the full O(n log n) rebuild that reassigning `rows`
|
|
198
|
+
* incurs. `rows` still gets a new array reference (reactivity is preserved),
|
|
199
|
+
* but the derived arrays are extended over the appended slice only. When a
|
|
200
|
+
* sort is active the new rows show unsorted for one frame, then a single
|
|
201
|
+
* coalesced re-sort runs. Scroll position, selection and cursor are kept.
|
|
202
|
+
*/
|
|
203
|
+
appendRows(rows: readonly unknown[]): void;
|
|
172
204
|
private _replaceSelection;
|
|
173
205
|
private _toggleSelection;
|
|
174
206
|
private _rangeSelectTo;
|
|
@@ -212,4 +244,4 @@ interface DataGridElement {
|
|
|
212
244
|
}
|
|
213
245
|
//#endregion
|
|
214
246
|
export { DataGridSortDetail as _, DataGridColumnReorderDetail as a, DataGridColumnResizeEvent as c, DataGridElement as d, DataGridElementEventMap as f, DataGridSelectEvent as g, DataGridSelectDetail as h, DataGridCellEditEvent as i, DataGridColumnVisibilityDetail as l, DataGridGroupChangeEvent as m, DataGridCellClickEvent as n, DataGridColumnReorderEvent as o, DataGridGroupChangeDetail as p, DataGridCellEditDetail as r, DataGridColumnResizeDetail as s, DataGridCellClickDetail as t, DataGridColumnVisibilityEvent as u, DataGridSortEvent as v };
|
|
215
|
-
//# sourceMappingURL=data-grid-
|
|
247
|
+
//# sourceMappingURL=data-grid-BddUjAti.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"data-grid-BddUjAti.d.ts","names":[],"sources":["../src/data-grid/types.ts","../src/data-grid/data-grid.ts"],"mappings":";;;KAAY;KACA;KACA;KACA;WAA+B;WAAsB,WAAW;;KAChE;KAEA,sBAAsB;WACvB,KAAK;WACL,QAAQ,eAAe;WACvB;WACA;WACA;EACT,SAAS;EACT;;KAEU,sBAAsB,gBAAgB,KAAK,sBAAsB;KAEjE,eAAe;EACzB;EACA;EACA;EACA;EACA;EACA;EACA;EACA,UAAU,GAAG,GAAG,GAAG;EACnB;EACA;EACA;EACA,YAAY,KAAK,GAAG,KAAK,eAAe,IAAI;EAC5C;EACA;EACA;EACA,SAAS,qBAAqB,sBAAsB;EACpD,gBAAgB;IAAyB;IAAe;;EACxD,aAAa,gBAAgB,KAAK,GAAG,KAAK,eAAe;;KAG/C,mBAAmB,gBAAgB,oBAAoB;KAEvD;KAEA;KACA;EAA4B;;KAE5B,kBAAkB,MAAM,KAAK,GAAG;KAChC,gBAAgB,gBAAgB,KAAK;KACrC,sBAAsB,kBAAkB;;KAGxC;;;KCrCA;WAAgC,MAAM;WAA4B,UAAU;;KAC5E,oBAAoB,YAAY;KAChC;WAAkC,cAAc;WAA8B,UAAU;;KACxF,sBAAsB,YAAY;KAClC;WAAyC;WAAuB;WAAqB,kBAAkB;;KACvG,6BAA6B,YAAY;KACzC;WAAwC;WAAsB;;KAC9D,4BAA4B,YAAY;KACxC;WAA4C;WAAsB;;KAClE,gCAAgC,YAAY;KAC5C;WAAqC;WAAyB;WAAyB;WAA2B;;KAClH,yBAAyB,YAAY;KACrC;WAAoC;WAAyB;WAAyB;WAA4B;;KAClH,wBAAwB,YAAY;KAEpC;WAAuC,SAAS;;KAChD,2BAA2B,YAAY;UAClC;EACf,iBAAiB;EACjB,mBAAmB;EACnB,2BAA2B;EAC3B,0BAA0B;EAC1B,8BAA8B;EAC9B,uBAAuB;EACvB,sBAAsB;EACtB,yBAAyB;;cAId,wBAAwB;;SACnB,sBAAM;EAoGK,SAAS;EACT;EAC8B,eAAe;EACb,iBAAiB;EAC5C,WAAW;EACU;EACrB,WAAW;EACX,oBAAoB;EACpB,sBAAsB,cAAc,KAAK;EAC9B,aAAa;EAExB,SAAS;EACiB;EAC1B,YAAY;;EAEZ;EACgD;;;;;;EAM1B,YAAY;EAClC,kBAAkB;UAC1C;UAES;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UACA;UAEW;UACK;UAEzB;UAKA;UACA;UACA;UAMA;UACA;UACA;UACA;UAGA;EAEC;EAQA;UAWD;YAgBW;YAaA,QAAQ,SAAS;YAmBjB,WAAW,SAAS;UA4D/B;UAQA;UAiCA;UAOA;UAoBA;UAYA;UAcA;UA0BA;UAKA;UAMA;UAsFA;UAYA;UAEA;UAcA;;MAQJ,gBAAgB;;MAKhB,aAAa,MAAM;;;;;;;EAUvB,WAAW,MAAM;;MA0Bb;;EAKJ,UAAU;;;;;;;;EAcV,WAAW;UA8CH;UAiBA;UAsBA;UAmCA;UAsKA;UAUA;UAKA;UAQA;;EAeR,UAAU,gBAAgB;;EAK1B,aAAa;EAWb;EAIA,mBAAmB,mBAAmB,aAAa,8BAA8B,6BAA6B,UAAU;UAkBhH;UAWA;UAYA;UAyBA;UACA;UA2BA;UAYA;UAkCA;EAoBR;IAAqB;IAAkB;IAAgB;IAAkB;;UASjE;UAaA;YAQW,wBAAM;;QAyMnB;YACI;IAAwB,kBAAkB;;;UAErC;EACf,oBAAoB,gBAAgB,yBAAyB,MAAM,GAAG,WAAW,MAAM,iBAAiB,OAAO,wBAAwB,aAAa,oBAAoB,sCAAsC,cAAc,UAAU,oCAAoC,oBAAoB;EAC9R,uBAAuB,gBAAgB,yBAAyB,MAAM,GAAG,WAAW,MAAM,iBAAiB,OAAO,wBAAwB,aAAa,oBAAoB,mCAAmC,cAAc,UAAU,oCAAoC,oBAAoB"}
|
package/dist/data-grid.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { _ as DataGridSortDetail, a as DataGridColumnReorderDetail, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridSelectEvent, h as DataGridSelectDetail, i as DataGridCellEditEvent, l as DataGridColumnVisibilityDetail, m as DataGridGroupChangeEvent, n as DataGridCellClickEvent, o as DataGridColumnReorderEvent, p as DataGridGroupChangeDetail, r as DataGridCellEditDetail, s as DataGridColumnResizeDetail, t as DataGridCellClickDetail, u as DataGridColumnVisibilityEvent, v as DataGridSortEvent } from "./data-grid-
|
|
1
|
+
import { _ as DataGridSortDetail, a as DataGridColumnReorderDetail, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridSelectEvent, h as DataGridSelectDetail, i as DataGridCellEditEvent, l as DataGridColumnVisibilityDetail, m as DataGridGroupChangeEvent, n as DataGridCellClickEvent, o as DataGridColumnReorderEvent, p as DataGridGroupChangeDetail, r as DataGridCellEditDetail, s as DataGridColumnResizeDetail, t as DataGridCellClickDetail, u as DataGridColumnVisibilityEvent, v as DataGridSortEvent } from "./data-grid-BddUjAti.js";
|
|
2
2
|
export { DataGridCellClickDetail, DataGridCellClickEvent, DataGridCellEditDetail, DataGridCellEditEvent, DataGridColumnReorderDetail, DataGridColumnReorderEvent, DataGridColumnResizeDetail, DataGridColumnResizeEvent, DataGridColumnVisibilityDetail, DataGridColumnVisibilityEvent, DataGridElement, DataGridElementEventMap, DataGridGroupChangeDetail, DataGridGroupChangeEvent, DataGridSelectDetail, DataGridSelectEvent, DataGridSortDetail, DataGridSortEvent };
|
package/dist/data-grid.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { t as TickledController } from "./tickled-controller-
|
|
1
|
+
import { t as TickledController } from "./tickled-controller-C66DgJHl.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-BrAHEj1q.js";
|
|
3
3
|
import { t as themeFallbacks } from "./fallbacks-DNI9xt0F.js";
|
|
4
4
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
5
|
-
import "./
|
|
5
|
+
import { i as listItemFadeKeyframes } from "./list-item-animation-DuiwgN3l.js";
|
|
6
|
+
import "./interaction-Cr13azbM.js";
|
|
6
7
|
import { t as createDragGhost } from "./drag-ghost-DtSDvjri.js";
|
|
7
|
-
import "./menu-
|
|
8
|
+
import "./menu-Bg90Qr0B.js";
|
|
8
9
|
import { LitElement, css, html, nothing } from "lit";
|
|
9
10
|
import { property, query, state } from "lit/decorators.js";
|
|
10
11
|
import { repeat } from "lit/directives/repeat.js";
|
|
@@ -24,6 +25,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
24
25
|
this.groupBy = null;
|
|
25
26
|
this.allowGrouping = false;
|
|
26
27
|
this.crossGroupSelection = false;
|
|
28
|
+
this.columnMenu = `auto`;
|
|
27
29
|
this._columnFormatters = /* @__PURE__ */ new Map();
|
|
28
30
|
this._selectedKeys = /* @__PURE__ */ new Set();
|
|
29
31
|
this._scrollTop = 0;
|
|
@@ -46,10 +48,16 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
46
48
|
this._sortedRows = [];
|
|
47
49
|
this._flat = [];
|
|
48
50
|
this._flatKeys = [];
|
|
51
|
+
this.#prevFlatKeys = [];
|
|
52
|
+
this.#enteringRowKeys = /* @__PURE__ */ new Set();
|
|
53
|
+
this.#rowReflowTimer = 0;
|
|
54
|
+
this.#dataGridRenderedOnce = false;
|
|
49
55
|
this._visibleColumns = [];
|
|
50
56
|
this._colOffsets = [];
|
|
51
57
|
this._colWidthSum = 0;
|
|
52
58
|
this._raf = 0;
|
|
59
|
+
this.#appendInProgress = false;
|
|
60
|
+
this.#resortRaf = 0;
|
|
53
61
|
this._drag = null;
|
|
54
62
|
this._onFocusOut = (e) => {
|
|
55
63
|
if (this._suppressBlurCommit) return;
|
|
@@ -244,6 +252,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
244
252
|
themeFallbacks,
|
|
245
253
|
tickledStyles,
|
|
246
254
|
tickledItemStyles,
|
|
255
|
+
listItemFadeKeyframes,
|
|
247
256
|
css`
|
|
248
257
|
:host {
|
|
249
258
|
--data-grid-row-height: 28px;
|
|
@@ -300,6 +309,22 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
300
309
|
.row.item.tickled { background: var(--item-bg-tickled); border: var(--item-border-tickled); color: var(--item-text-tickled); }
|
|
301
310
|
.row.item.selected { background: var(--item-bg-selected); border: var(--item-border-selected); color: var(--item-text-selected); }
|
|
302
311
|
.row.item.selected.tickled { background: var(--item-bg-selected-tickled); }
|
|
312
|
+
|
|
313
|
+
/* Insertion / removal animation. Only while [reflowing] — the ~0.3s after
|
|
314
|
+
the row set changes — do rows slide (their top transitions) to make or
|
|
315
|
+
close a gap; a freshly inserted row also fades in. Kept scoped so it
|
|
316
|
+
never fires while scrolling the virtualised list. */
|
|
317
|
+
:host([reflowing]) .row.item,
|
|
318
|
+
:host([reflowing]) .group-row {
|
|
319
|
+
transition: top var(--data-grid-row-move-duration, 200ms) cubic-bezier(0.2, 0, 0, 1);
|
|
320
|
+
}
|
|
321
|
+
.row.item.entering {
|
|
322
|
+
animation: ixfx-list-item-in var(--data-grid-row-move-duration, 200ms) ease both;
|
|
323
|
+
}
|
|
324
|
+
@media (prefers-reduced-motion: reduce) {
|
|
325
|
+
:host([reflowing]) .row.item, :host([reflowing]) .group-row { transition: none; }
|
|
326
|
+
.row.item.entering { animation: none; }
|
|
327
|
+
}
|
|
303
328
|
.cell {
|
|
304
329
|
flex-shrink: 0; display: flex; align-items: center; padding: 0 var(--space-s);
|
|
305
330
|
overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-right: var(--border-subtle);
|
|
@@ -329,6 +354,13 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
329
354
|
`
|
|
330
355
|
];
|
|
331
356
|
}
|
|
357
|
+
/** Row-key snapshot from the previous update, for the insertion / removal animation. */
|
|
358
|
+
#prevFlatKeys;
|
|
359
|
+
#enteringRowKeys;
|
|
360
|
+
#rowReflowTimer;
|
|
361
|
+
#dataGridRenderedOnce;
|
|
362
|
+
#appendInProgress;
|
|
363
|
+
#resortRaf;
|
|
332
364
|
connectedCallback() {
|
|
333
365
|
super.connectedCallback();
|
|
334
366
|
if (!this.hasAttribute(`tabindex`)) this.tabIndex = 0;
|
|
@@ -340,6 +372,10 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
340
372
|
this.removeEventListener(`keydown`, this._onKeyDown);
|
|
341
373
|
this.removeEventListener(`focusout`, this._onFocusOut);
|
|
342
374
|
cancelAnimationFrame(this._raf);
|
|
375
|
+
if (this.#rowReflowTimer) {
|
|
376
|
+
clearTimeout(this.#rowReflowTimer);
|
|
377
|
+
this.#rowReflowTimer = 0;
|
|
378
|
+
}
|
|
343
379
|
}
|
|
344
380
|
firstUpdated() {
|
|
345
381
|
new ResizeObserver(() => {
|
|
@@ -366,8 +402,10 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
366
402
|
willUpdate(changed) {
|
|
367
403
|
super.willUpdate(changed);
|
|
368
404
|
this.setAttribute(`data-input-mode`, this._tickled.inputMode);
|
|
369
|
-
if (
|
|
370
|
-
|
|
405
|
+
if (!this.#appendInProgress) {
|
|
406
|
+
if (changed.has(`rows`) || changed.has(`sortState`) || changed.has(`columns`) || changed.has(`groupBy`) || changed.has(`groupLabel`)) this._sortedRows = this._applySort([...this.rows]);
|
|
407
|
+
this._rebuildFlat();
|
|
408
|
+
}
|
|
371
409
|
this._visibleColumns = this.columns.filter((c) => c.visible !== false);
|
|
372
410
|
let off = 0;
|
|
373
411
|
this._colOffsets = this._visibleColumns.map((c) => {
|
|
@@ -377,6 +415,40 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
377
415
|
});
|
|
378
416
|
this._colWidthSum = off;
|
|
379
417
|
if (this.interactionMode === `checked`) this._colWidthSum += 28;
|
|
418
|
+
this.#noteFlatMutation();
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Diff the row-key list against the previous update. Rows that appeared get an
|
|
422
|
+
* enter fade; any add/remove opens a short `[reflowing]` window so the rows
|
|
423
|
+
* that shift slide (their `top` transitions) instead of snapping. Bounded in
|
|
424
|
+
* time so it never bleeds into scroll virtualisation.
|
|
425
|
+
*/
|
|
426
|
+
#noteFlatMutation() {
|
|
427
|
+
const now = this._flatKeys;
|
|
428
|
+
const prev = this.#prevFlatKeys;
|
|
429
|
+
this.#prevFlatKeys = now.slice();
|
|
430
|
+
if (!this.#dataGridRenderedOnce) {
|
|
431
|
+
this.#dataGridRenderedOnce = true;
|
|
432
|
+
return;
|
|
433
|
+
}
|
|
434
|
+
if (prev.length === 0 || now.length === 0) {
|
|
435
|
+
this.#enteringRowKeys.clear();
|
|
436
|
+
return;
|
|
437
|
+
}
|
|
438
|
+
const before = new Set(prev);
|
|
439
|
+
const after = new Set(now);
|
|
440
|
+
const added = now.filter((k) => !before.has(k));
|
|
441
|
+
const removed = prev.filter((k) => !after.has(k));
|
|
442
|
+
if (added.length === now.length || added.length === 0 && removed.length === 0) return;
|
|
443
|
+
this.#enteringRowKeys = new Set(added);
|
|
444
|
+
this.toggleAttribute(`reflowing`, true);
|
|
445
|
+
if (this.#rowReflowTimer) clearTimeout(this.#rowReflowTimer);
|
|
446
|
+
this.#rowReflowTimer = window.setTimeout(() => {
|
|
447
|
+
this.#rowReflowTimer = 0;
|
|
448
|
+
this.#enteringRowKeys.clear();
|
|
449
|
+
this.toggleAttribute(`reflowing`, false);
|
|
450
|
+
this.requestUpdate();
|
|
451
|
+
}, 320);
|
|
380
452
|
}
|
|
381
453
|
_getGroupKey(row) {
|
|
382
454
|
if (!this.groupBy) return null;
|
|
@@ -624,6 +696,102 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
624
696
|
_getRowForKey(key) {
|
|
625
697
|
return this._flat.find((f) => f.key === key)?.row;
|
|
626
698
|
}
|
|
699
|
+
/** The selected row keys (read-only). */
|
|
700
|
+
get selectedKeys() {
|
|
701
|
+
return this._selectedKeys;
|
|
702
|
+
}
|
|
703
|
+
/** Replace the selection with these row keys (clamped to known rows). */
|
|
704
|
+
set selectedKeys(keys) {
|
|
705
|
+
this.selectKeys(keys);
|
|
706
|
+
}
|
|
707
|
+
/**
|
|
708
|
+
* Replace the selection with the given row keys. Unknown keys are dropped;
|
|
709
|
+
* in a single-select mode only the last surviving key is kept;
|
|
710
|
+
* `selectionMode="none"` clears. Fires `datagrid-select` with the previous
|
|
711
|
+
* set when the selection actually changes.
|
|
712
|
+
*/
|
|
713
|
+
selectKeys(keys) {
|
|
714
|
+
const known = new Set(this._flat.filter((f) => f.type === `row`).map((f) => f.key));
|
|
715
|
+
let next = new Set([...keys].filter((k) => known.has(k)));
|
|
716
|
+
const multi = this.selectionMode === `multiple` || this.interactionMode === `checked` || this.interactionMode === `sticky` || this.interactionMode === `vscode`;
|
|
717
|
+
if (this.selectionMode === `none`) next = /* @__PURE__ */ new Set();
|
|
718
|
+
else if (!multi && next.size > 1) {
|
|
719
|
+
const last = [...next].at(-1);
|
|
720
|
+
next = last === void 0 ? /* @__PURE__ */ new Set() : /* @__PURE__ */ new Set([last]);
|
|
721
|
+
}
|
|
722
|
+
const prev = new Set(this._selectedKeys);
|
|
723
|
+
if (prev.size === next.size && [...next].every((k) => prev.has(k))) return;
|
|
724
|
+
this._selectedKeys = next;
|
|
725
|
+
this._anchorKey = [...next].at(-1);
|
|
726
|
+
this.dispatchEvent(new CustomEvent(`datagrid-select`, {
|
|
727
|
+
detail: {
|
|
728
|
+
selectedKeys: new Set(next),
|
|
729
|
+
previous: prev
|
|
730
|
+
},
|
|
731
|
+
bubbles: true,
|
|
732
|
+
composed: true
|
|
733
|
+
}));
|
|
734
|
+
}
|
|
735
|
+
/** The row key under the cursor, or `undefined`. */
|
|
736
|
+
get tickledKey() {
|
|
737
|
+
return this._tickled.tickledId;
|
|
738
|
+
}
|
|
739
|
+
/** Move the cursor to this row key and scroll it into view. */
|
|
740
|
+
tickleRow(key) {
|
|
741
|
+
if (!this._flatKeys.includes(key)) return;
|
|
742
|
+
this._tickled.focus(key);
|
|
743
|
+
this._scrollRowIntoView(key);
|
|
744
|
+
}
|
|
745
|
+
/**
|
|
746
|
+
* Append rows without the full O(n log n) rebuild that reassigning `rows`
|
|
747
|
+
* incurs. `rows` still gets a new array reference (reactivity is preserved),
|
|
748
|
+
* but the derived arrays are extended over the appended slice only. When a
|
|
749
|
+
* sort is active the new rows show unsorted for one frame, then a single
|
|
750
|
+
* coalesced re-sort runs. Scroll position, selection and cursor are kept.
|
|
751
|
+
*/
|
|
752
|
+
appendRows(rows) {
|
|
753
|
+
if (rows.length === 0) return;
|
|
754
|
+
const startIdx = this.rows.length;
|
|
755
|
+
this.#appendInProgress = true;
|
|
756
|
+
this.rows = [...this.rows, ...rows];
|
|
757
|
+
const appended = this.rows.slice(startIdx);
|
|
758
|
+
if (this._sortedRows.length === startIdx) this._sortedRows = [...this._sortedRows, ...appended];
|
|
759
|
+
else {
|
|
760
|
+
this._sortedRows = this._applySort([...this.rows]);
|
|
761
|
+
this._rebuildFlat();
|
|
762
|
+
this.#appendInProgress = false;
|
|
763
|
+
this.requestUpdate();
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
this.#appendToFlat(appended, startIdx);
|
|
767
|
+
this.#appendInProgress = false;
|
|
768
|
+
this.requestUpdate();
|
|
769
|
+
if (this.sortState != null) {
|
|
770
|
+
cancelAnimationFrame(this.#resortRaf);
|
|
771
|
+
this.#resortRaf = requestAnimationFrame(() => {
|
|
772
|
+
this._sortedRows = this._applySort([...this.rows]);
|
|
773
|
+
this._rebuildFlat();
|
|
774
|
+
this.requestUpdate();
|
|
775
|
+
});
|
|
776
|
+
}
|
|
777
|
+
}
|
|
778
|
+
#appendToFlat(appended, startIdx) {
|
|
779
|
+
if (this.groupBy) {
|
|
780
|
+
this._rebuildFlat();
|
|
781
|
+
return;
|
|
782
|
+
}
|
|
783
|
+
for (let j = 0; j < appended.length; j++) {
|
|
784
|
+
const idx = startIdx + j;
|
|
785
|
+
const key = this.getRowKey(appended[j], idx);
|
|
786
|
+
this._flat.push({
|
|
787
|
+
type: `row`,
|
|
788
|
+
key,
|
|
789
|
+
row: appended[j],
|
|
790
|
+
idx
|
|
791
|
+
});
|
|
792
|
+
this._flatKeys.push(key);
|
|
793
|
+
}
|
|
794
|
+
}
|
|
627
795
|
_replaceSelection(key) {
|
|
628
796
|
if (this.selectionMode === `none`) return;
|
|
629
797
|
const prev = new Set(this._selectedKeys);
|
|
@@ -979,6 +1147,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
979
1147
|
return last >= 0 ? this._colOffsets[last] + (this._visibleColumns[last].width ?? 150) : 0;
|
|
980
1148
|
})()}px"></div>` : nothing}
|
|
981
1149
|
</div>
|
|
1150
|
+
${this.columnMenu === `none` ? nothing : html`
|
|
982
1151
|
<ixfx-menu-trigger label="⚙" placement="bottom-end" @menu-command=${(e) => {
|
|
983
1152
|
const cmd = e.detail.command;
|
|
984
1153
|
const checked = e.detail.checked;
|
|
@@ -1018,7 +1187,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1018
1187
|
</ixfx-menu-radio-group>
|
|
1019
1188
|
` : nothing}
|
|
1020
1189
|
</ixfx-menu-container>
|
|
1021
|
-
</ixfx-menu-trigger
|
|
1190
|
+
</ixfx-menu-trigger>`}
|
|
1022
1191
|
</div>
|
|
1023
1192
|
<div class="viewport" @scroll=${this._onScroll}>
|
|
1024
1193
|
<div class="spacer" style="height:${this._flat.length * rh}px; width:${this._colWidthSum}px">
|
|
@@ -1035,7 +1204,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1035
1204
|
const selected = this._selectedKeys.has(rowKey);
|
|
1036
1205
|
const tickled = this._tickled.isTickled(rowKey);
|
|
1037
1206
|
return html`
|
|
1038
|
-
<div class="row item ${selected ? `selected` : ``} ${tickled ? `tickled` : ``}" style="top:${absIdx * rh}px; height:${rh}px"
|
|
1207
|
+
<div class="row item ${selected ? `selected` : ``} ${tickled ? `tickled` : ``} ${this.#enteringRowKeys.has(rowKey) ? `entering` : ``}" style="top:${absIdx * rh}px; height:${rh}px"
|
|
1039
1208
|
data-key=${rowKey}
|
|
1040
1209
|
@click=${(e) => {
|
|
1041
1210
|
this._onRowClick(rowKey, null, e);
|
|
@@ -1206,6 +1375,10 @@ __decorate([property({
|
|
|
1206
1375
|
attribute: `cross-group-selection`,
|
|
1207
1376
|
reflect: true
|
|
1208
1377
|
})], DataGridElement.prototype, "crossGroupSelection", void 0);
|
|
1378
|
+
__decorate([property({
|
|
1379
|
+
type: String,
|
|
1380
|
+
attribute: `column-menu`
|
|
1381
|
+
})], DataGridElement.prototype, "columnMenu", void 0);
|
|
1209
1382
|
__decorate([property({ attribute: false })], DataGridElement.prototype, "globalFormatter", void 0);
|
|
1210
1383
|
__decorate([state()], DataGridElement.prototype, "_selectedKeys", void 0);
|
|
1211
1384
|
__decorate([state()], DataGridElement.prototype, "_scrollTop", void 0);
|