@ixfx/components 0.15.5 → 0.16.1
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 +986 -49
- package/bundle/index.js +765 -729
- package/dist/ac-token.js +1 -1
- package/dist/crumb-navigation-BbqfmkYs.d.ts +147 -0
- package/dist/crumb-navigation-YnFVFqrx.js +1290 -0
- package/dist/crumbs.d.ts +2 -115
- package/dist/crumbs.js +1 -1179
- package/dist/{data-grid-C1sZX6n9.js → data-grid-Cqxuwgbb.js} +615 -210
- package/dist/{data-grid-D7qzmMMp.d.ts → data-grid-Csh5EJW9.d.ts} +55 -4
- package/dist/data-grid.d.ts +3 -3
- package/dist/data-grid.js +1 -1
- package/dist/{detail-list-q8bs67BM.js → detail-list-Bo5ze3SN.js} +234 -9
- package/dist/{detail-list-CKIKlszv.d.ts → detail-list-DSZ1DDor.d.ts} +48 -4
- package/dist/detail-list.d.ts +4 -4
- package/dist/detail-list.js +1 -1
- package/dist/{flat-list-DXMyDiSH.d.ts → flat-list-CT9kX3TQ.d.ts} +27 -4
- package/dist/flat-list.d.ts +2 -2
- package/dist/flat-list.js +123 -4
- package/dist/{grid-list-y6dWJYu3.js → grid-list-D0dJNVEF.js} +278 -76
- package/dist/{grid-list-0e7snW6t.d.ts → grid-list-DDLrWRxm.d.ts} +128 -22
- package/dist/grid-list.d.ts +3 -3
- package/dist/grid-list.js +1 -1
- package/dist/{incr-search-JIhwB49y.js → incr-search-CgbL-OlS.js} +140 -10
- package/dist/incr-search.d.ts +1 -1
- package/dist/incr-search.js +1 -1
- package/dist/index-9ttcdwlL.d.ts +71 -0
- package/dist/index-Bnm-kKGC.d.ts +475 -0
- package/dist/{index-KN2MW_xD.d.ts → index-CUErGhCg.d.ts} +31 -4
- package/dist/{index-DEVyVIn8.d.ts → index-D-lZNlHa.d.ts} +52 -6
- package/dist/index.d.ts +341 -21
- package/dist/index.js +2286 -884
- package/dist/{list-native-drag-controller-O2Nruqpi.d.ts → list-native-drag-controller-D_UrXipS.d.ts} +1 -1
- package/dist/{list-selection-controller-BeE70lbB.js → list-selection-controller-5L0Nj9tR.js} +87 -2
- package/dist/miller-DUqiUAWQ.js +2230 -0
- package/dist/miller.d.ts +4 -437
- package/dist/miller.js +1 -1815
- package/dist/narrowed-text.js +1 -1
- package/dist/pending-BGidHppL.js +91 -0
- package/dist/scroll-hover-guard-Cjw6179Q.js +35 -0
- package/dist/{split-layout-JK3xWVX2.d.ts → split-layout-CophkNeU.d.ts} +41 -3
- package/dist/{split-layout-Deoxy47d.js → split-layout-DTY4PJRp.js} +251 -19
- package/dist/split-layout.d.ts +1 -1
- package/dist/split-layout.js +1 -1
- package/dist/sunburst-tree.d.ts +2 -2
- package/dist/sunburst-tree.js +1 -1
- package/dist/{sunbursttree-list-yXwS-uEI.js → sunbursttree-list-B_M0YTEA.js} +299 -80
- package/dist/{sunbursttree-list--Z0uyh8O.d.ts → sunbursttree-list-DePuFYlU.d.ts} +40 -3
- package/dist/tree-CftHwtEb.js +146 -0
- package/dist/{tree-D8VxvR9u.js → tree-DAlgvaHB.js} +276 -48
- package/dist/{tree-component-C6UHO-w9.d.ts → tree-component-DgfkxmVY.d.ts} +19 -8
- package/dist/tree.d.ts +3 -3
- package/dist/tree.js +1 -1
- package/dist/types-LU1u0CB8.d.ts +87 -0
- package/dist/vertical-list-DyKPKGxK.js +1993 -0
- package/dist/{vertical-list-D8MksoTp.d.ts → vertical-list-SAx56U-l.d.ts} +31 -3
- package/dist/vertical-list.d.ts +3 -3
- package/dist/vertical-list.js +1 -1789
- package/dist/view-state-controller-BdyXWUUM.js +305 -0
- package/docs-user/README.md +2 -0
- package/docs-user/crumbs.md +27 -0
- package/docs-user/data-grid.md +79 -5
- package/docs-user/detail-list.md +69 -0
- package/docs-user/dock.md +63 -12
- package/docs-user/flat-list.md +27 -0
- package/docs-user/grid-list.md +69 -13
- package/docs-user/hyperbolic-tree.md +31 -4
- package/docs-user/icicle-tree.md +36 -0
- package/docs-user/index.json +12 -2
- package/docs-user/llms.txt +2 -0
- package/docs-user/miller.md +52 -21
- package/docs-user/multicol-list.md +50 -8
- package/docs-user/split-layout.md +45 -17
- package/docs-user/sunburst-tree.md +32 -2
- package/docs-user/tree.md +45 -6
- package/docs-user/treemap.md +32 -0
- package/docs-user/twosplit-layout.md +22 -0
- package/docs-user/user-catalog.md +1 -1
- package/docs-user/vertical-list.md +55 -7
- package/llms.txt +2 -0
- package/package.json +2 -2
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import "./icon-CDGprSdE.js";
|
|
2
|
-
import {
|
|
2
|
+
import { L as ListDragPreviewRenderer, R as ListDragPreviewSourceResolver, V as ListNativeDragStartEvent } from "./tree-component-DgfkxmVY.js";
|
|
3
|
+
import { a as ViewStateBase, t as GetViewStateOptions } from "./types-LU1u0CB8.js";
|
|
4
|
+
import "./index-9ttcdwlL.js";
|
|
3
5
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BRZsLcvp.js";
|
|
4
|
-
import { S as ListSearchController } from "./index-
|
|
6
|
+
import { S as ListSearchController } from "./index-CUErGhCg.js";
|
|
5
7
|
import "./index-DxyyVqzA.js";
|
|
6
8
|
import "./pan-text-CoYmt2qd.js";
|
|
7
9
|
import { LitElement } from "lit";
|
|
@@ -99,6 +101,31 @@ type DataGridGroupLabel = (groupKey: string, rows: readonly unknown[]) => string
|
|
|
99
101
|
/** Whether the data-grid renders its built-in header column/group menu. */
|
|
100
102
|
type DataGridColumnMenu = `auto` | `none`;
|
|
101
103
|
//#endregion
|
|
104
|
+
//#region src/data-grid/data-grid-view-state.d.ts
|
|
105
|
+
/**
|
|
106
|
+
* Pure view-state helpers for `ixfx-data-grid`. The grid runs these whenever
|
|
107
|
+
* its rows or columns change, so state keyed to rows / columns that left the
|
|
108
|
+
* data goes pending and comes back when those keys reappear.
|
|
109
|
+
*/
|
|
110
|
+
/** Saved layout for one column, keyed by column key in {@link DataGridViewState.columns}. */
|
|
111
|
+
type DataGridColumnViewState = {
|
|
112
|
+
readonly width?: number;
|
|
113
|
+
readonly visible?: boolean;
|
|
114
|
+
/** Rank among the saved columns (lower is further left). */
|
|
115
|
+
readonly order?: number;
|
|
116
|
+
};
|
|
117
|
+
/**
|
|
118
|
+
* `ixfx-data-grid` view state. `expanded` is keyed by group key; groups
|
|
119
|
+
* default to open, so a collapsed group is `false`.
|
|
120
|
+
*/
|
|
121
|
+
type DataGridViewState = ViewStateBase & {
|
|
122
|
+
readonly columns?: Readonly<Record<string, DataGridColumnViewState>>;
|
|
123
|
+
/** Sorted column + direction; `null` means unsorted. */
|
|
124
|
+
readonly sort?: DataGridSortState;
|
|
125
|
+
/** Group-by column key (`null` = ungrouped). Only recorded when `allowGrouping` is on. */
|
|
126
|
+
readonly groupBy?: string | null;
|
|
127
|
+
};
|
|
128
|
+
//#endregion
|
|
102
129
|
//#region src/data-grid/data-grid.d.ts
|
|
103
130
|
type DataGridSortDetail = {
|
|
104
131
|
readonly sort: DataGridSortState;
|
|
@@ -214,8 +241,17 @@ declare class DataGridElement extends LitElement {
|
|
|
214
241
|
* view and navigation.
|
|
215
242
|
*/
|
|
216
243
|
filterPredicate?: (row: unknown) => boolean;
|
|
217
|
-
/**
|
|
244
|
+
/**
|
|
245
|
+
* Text a row is matched against by incremental search. Overrides
|
|
246
|
+
* `searchColumn`; matches against it aren't highlighted, since they can't be
|
|
247
|
+
* mapped onto a cell.
|
|
248
|
+
*/
|
|
218
249
|
rowSearchText?: (row: unknown) => string;
|
|
250
|
+
/**
|
|
251
|
+
* Key of the column incremental search matches against, using the cell's
|
|
252
|
+
* displayed (formatted) text. Default: the first visible column.
|
|
253
|
+
*/
|
|
254
|
+
searchColumn: string;
|
|
219
255
|
/**
|
|
220
256
|
* Space-separated subset of `navigate select filter` — limits which
|
|
221
257
|
* incremental-search modes are offered. Unset ⇒ all three; empty ⇒ search
|
|
@@ -376,6 +412,21 @@ declare class DataGridElement extends LitElement {
|
|
|
376
412
|
autoSizeColumn(key: string): boolean;
|
|
377
413
|
private _columnResizeAnimationMs;
|
|
378
414
|
private _onResizePointerDown;
|
|
415
|
+
/**
|
|
416
|
+
* Snapshot selection, cursor, scroll, collapsed groups, column layout, sort
|
|
417
|
+
* and (with `allowGrouping`) grouping as plain JSON, keyed by row / group /
|
|
418
|
+
* column key. Includes pending state for keys not currently present. Rows
|
|
419
|
+
* keyed by index (no `key` / `id` under the default `getRowKey`) are never
|
|
420
|
+
* recorded.
|
|
421
|
+
*/
|
|
422
|
+
getViewState(options?: GetViewStateOptions<DataGridViewState>): DataGridViewState;
|
|
423
|
+
/**
|
|
424
|
+
* Apply saved view state. Fields present replace the current ones; row and
|
|
425
|
+
* column keys that aren't defined yet are applied as they appear (including
|
|
426
|
+
* rows streamed in with `appendRows()`).
|
|
427
|
+
*/
|
|
428
|
+
setViewState(state: Partial<DataGridViewState>): void;
|
|
429
|
+
clearPendingViewState(): void;
|
|
379
430
|
getVisibleRange(): {
|
|
380
431
|
startRow: number;
|
|
381
432
|
endRow: number;
|
|
@@ -398,4 +449,4 @@ interface DataGridElement {
|
|
|
398
449
|
removeEventListener: (<K extends keyof DataGridElementEventMap>(type: K, listener: (this: DataGridElement, event: DataGridElementEventMap[K]) => void, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
|
|
399
450
|
}
|
|
400
451
|
//#endregion
|
|
401
|
-
export {
|
|
452
|
+
export { DataGridEditability as A, DataGridSortDirection as B, DataGridColumnViewState as C, DataGridColumn as D, BuiltInFormatterOptions as E, DataGridGroupBy as F, GlobalFormatter as H, DataGridGroupLabel as I, DataGridInteractionMode as L, DataGridEditorFactory as M, DataGridEditorType as N, DataGridColumnMenu as O, DataGridGetRowKey as P, DataGridRowLook as R, DataGridViewportChangeEvent as S, BuiltInFormatterName as T, DataGridSortState as V, DataGridSelectDetail as _, DataGridColumnReorderDetail as a, DataGridSortEvent as b, DataGridColumnResizeEvent as c, DataGridElement as d, DataGridElementEventMap as f, DataGridRowActivateEvent as g, DataGridRowActivateDetail as h, DataGridCellEditEvent as i, DataGridEditorContext as j, DataGridDataType as k, 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, DataGridSelectEvent as v, DataGridViewState as w, DataGridViewportChangeDetail as x, DataGridSortDetail as y, DataGridSelectionMode as z };
|
package/dist/data-grid.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { A as
|
|
3
|
-
export { type BuiltInFormatterName, type BuiltInFormatterOptions, DataGridCellClickDetail, DataGridCellClickEvent, DataGridCellEditDetail, DataGridCellEditEvent, type DataGridColumn, type DataGridColumnMenu, DataGridColumnReorderDetail, DataGridColumnReorderEvent, DataGridColumnResizeDetail, DataGridColumnResizeEvent, DataGridColumnVisibilityDetail, DataGridColumnVisibilityEvent, type DataGridDataType, type DataGridEditability, type DataGridEditorContext, type DataGridEditorFactory, type DataGridEditorType, DataGridElement, DataGridElementEventMap, type DataGridGetRowKey, type DataGridGroupBy, DataGridGroupChangeDetail, DataGridGroupChangeEvent, type DataGridGroupLabel, type DataGridInteractionMode, DataGridRowActivateDetail, DataGridRowActivateEvent, type DataGridRowLook, DataGridSelectDetail, DataGridSelectEvent, type DataGridSelectionMode, DataGridSortDetail, type DataGridSortDirection, DataGridSortEvent, type DataGridSortState, DataGridViewportChangeDetail, DataGridViewportChangeEvent, type GlobalFormatter, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListNativeDragStartDetail, type ListNativeDragStartEvent };
|
|
1
|
+
import { B as ListNativeDragStartDetail, F as ListDragPreview, I as ListDragPreviewContext, L as ListDragPreviewRenderer, P as ListDragEntry, V as ListNativeDragStartEvent, z as ListDragSource } from "./tree-component-DgfkxmVY.js";
|
|
2
|
+
import { A as DataGridEditability, B as DataGridSortDirection, C as DataGridColumnViewState, D as DataGridColumn, E as BuiltInFormatterOptions, F as DataGridGroupBy, H as GlobalFormatter, I as DataGridGroupLabel, L as DataGridInteractionMode, M as DataGridEditorFactory, N as DataGridEditorType, O as DataGridColumnMenu, P as DataGridGetRowKey, R as DataGridRowLook, S as DataGridViewportChangeEvent, T as BuiltInFormatterName, V as DataGridSortState, _ as DataGridSelectDetail, a as DataGridColumnReorderDetail, b as DataGridSortEvent, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridRowActivateEvent, h as DataGridRowActivateDetail, i as DataGridCellEditEvent, j as DataGridEditorContext, k as DataGridDataType, 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 DataGridSelectEvent, w as DataGridViewState, x as DataGridViewportChangeDetail, y as DataGridSortDetail, z as DataGridSelectionMode } from "./data-grid-Csh5EJW9.js";
|
|
3
|
+
export { type BuiltInFormatterName, type BuiltInFormatterOptions, DataGridCellClickDetail, DataGridCellClickEvent, DataGridCellEditDetail, DataGridCellEditEvent, type DataGridColumn, type DataGridColumnMenu, DataGridColumnReorderDetail, DataGridColumnReorderEvent, DataGridColumnResizeDetail, DataGridColumnResizeEvent, type DataGridColumnViewState, DataGridColumnVisibilityDetail, DataGridColumnVisibilityEvent, type DataGridDataType, type DataGridEditability, type DataGridEditorContext, type DataGridEditorFactory, type DataGridEditorType, DataGridElement, DataGridElementEventMap, type DataGridGetRowKey, type DataGridGroupBy, DataGridGroupChangeDetail, DataGridGroupChangeEvent, type DataGridGroupLabel, type DataGridInteractionMode, DataGridRowActivateDetail, DataGridRowActivateEvent, type DataGridRowLook, DataGridSelectDetail, DataGridSelectEvent, type DataGridSelectionMode, DataGridSortDetail, type DataGridSortDirection, DataGridSortEvent, type DataGridSortState, type DataGridViewState, DataGridViewportChangeDetail, DataGridViewportChangeEvent, type GlobalFormatter, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListNativeDragStartDetail, type ListNativeDragStartEvent };
|
package/dist/data-grid.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as DataGridElement } from "./data-grid-
|
|
1
|
+
import { t as DataGridElement } from "./data-grid-Cqxuwgbb.js";
|
|
2
2
|
export { DataGridElement };
|
|
@@ -3,10 +3,12 @@ import { t as themeFallbacks } from "./fallbacks-DQ_5OsmR.js";
|
|
|
3
3
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
4
4
|
import "./icon-1gpwtPx8.js";
|
|
5
5
|
import { t as DataController } from "./data-controller-DOlmqNKb.js";
|
|
6
|
-
import { c as createElementListSearchAdapter, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-
|
|
6
|
+
import { c as createElementListSearchAdapter, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-CgbL-OlS.js";
|
|
7
7
|
import { a as toGroupKey, r as partitionByGroup } from "./grouping-RYPnHkrS.js";
|
|
8
8
|
import { i as animateListItemOut, r as animateListItemIn, t as ListNativeDragController } from "./list-native-drag-controller-CcXoS0YX.js";
|
|
9
|
-
import { r as ListDragSelectController, t as ListSelectionController } from "./list-selection-controller-
|
|
9
|
+
import { r as ListDragSelectController, t as ListSelectionController } from "./list-selection-controller-5L0Nj9tR.js";
|
|
10
|
+
import { a as capKeys, d as partitionKeys, l as keysToArray, o as flagsFromRecord } from "./pending-BGidHppL.js";
|
|
11
|
+
import { a as restoreElementScroll, o as scrollToOffset, r as captureElementScroll, t as ViewStateController } from "./view-state-controller-BdyXWUUM.js";
|
|
10
12
|
import { t as scrollFadeStyles } from "./scroll-fade-Xx28D7mH.js";
|
|
11
13
|
import { n as appearanceColor, t as appearanceAbsent } from "./item-appearance-BjcMyauw.js";
|
|
12
14
|
import "./list-group-header.js";
|
|
@@ -130,6 +132,62 @@ function itemsInSpanByOrder(items, origin, start, end) {
|
|
|
130
132
|
return items.slice(from, to);
|
|
131
133
|
}
|
|
132
134
|
//#endregion
|
|
135
|
+
//#region src/detail-list/detail-list-view-state.ts
|
|
136
|
+
const DETAIL_LIST_VIEW_STATE_KIND = `detail-list`;
|
|
137
|
+
/**
|
|
138
|
+
* Collapsed group keys as an `expanded` record. Collapsed keys whose group
|
|
139
|
+
* isn't currently present are pending; `includePending` decides whether they
|
|
140
|
+
* are written.
|
|
141
|
+
*/
|
|
142
|
+
function collapsedToRecord(collapsed, present, includePending) {
|
|
143
|
+
const out = {};
|
|
144
|
+
for (const key of collapsed) if (includePending || present.has(key)) out[key] = false;
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/** `expanded` record → collapsed group keys (only `false` entries collapse). */
|
|
148
|
+
function collapsedFromRecord(record) {
|
|
149
|
+
const out = /* @__PURE__ */ new Set();
|
|
150
|
+
for (const [key, open] of flagsFromRecord(record)) if (!open) out.add(key);
|
|
151
|
+
return capKeys(out);
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* The collapsed keys whose group isn't present (pending) — what survives a
|
|
155
|
+
* `groupBy` change: the user's collapses belong to the old grouping, but
|
|
156
|
+
* restored keys that never matched are still waiting for theirs.
|
|
157
|
+
*/
|
|
158
|
+
function pendingCollapsed(collapsed, present) {
|
|
159
|
+
const { missing } = partitionKeys(collapsed, (key) => present.has(key));
|
|
160
|
+
return missing;
|
|
161
|
+
}
|
|
162
|
+
/** Key → element over a slice of items (first wins), for O(slice) pending resolution. */
|
|
163
|
+
function indexByKey(items) {
|
|
164
|
+
const out = /* @__PURE__ */ new Map();
|
|
165
|
+
for (const el of items) {
|
|
166
|
+
const key = keyForElement(el);
|
|
167
|
+
if (key !== void 0 && !out.has(key)) out.set(key, el);
|
|
168
|
+
}
|
|
169
|
+
return out;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Snapshot the horizontal scroll of the column flow. `visible` must be the
|
|
173
|
+
* visible items in DOM (= column) order.
|
|
174
|
+
*/
|
|
175
|
+
function captureListScroll(viewport, visible) {
|
|
176
|
+
return captureElementScroll(viewport, visible, keyForElement, `horizontal`);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Apply a saved scroll. With an anchor, `resolve` must return the anchor item
|
|
180
|
+
* only while it is laid out (present and visible); until then this returns
|
|
181
|
+
* `false` so it is retried. Returns `true` once the position was reached.
|
|
182
|
+
*/
|
|
183
|
+
function applyListScroll(viewport, scroll, resolve) {
|
|
184
|
+
if (scroll.anchor) {
|
|
185
|
+
const el = resolve(scroll.anchor.key);
|
|
186
|
+
return el === void 0 ? false : restoreElementScroll(viewport, el, scroll.anchor.offset, `horizontal`);
|
|
187
|
+
}
|
|
188
|
+
return scrollToOffset(viewport, scroll.left ?? 0, `horizontal`);
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
133
191
|
//#region src/detail-list/detail-list.ts
|
|
134
192
|
const ITEM_SELECTOR = `:scope > li`;
|
|
135
193
|
const GROUP_HEADER_ATTR = `data-ixfx-group-header`;
|
|
@@ -262,6 +320,10 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
262
320
|
this.#groupByChanged = false;
|
|
263
321
|
this.#providerBuilt = 0;
|
|
264
322
|
this.#data = new DataController(this);
|
|
323
|
+
this.#viewState = new ViewStateController(this, {
|
|
324
|
+
kind: DETAIL_LIST_VIEW_STATE_KIND,
|
|
325
|
+
capture: () => this.getViewState()
|
|
326
|
+
});
|
|
265
327
|
this.selection = new ListSelectionController({
|
|
266
328
|
getOrderedItems: () => this._getVisibleItems(),
|
|
267
329
|
isSelectable: (el) => this._isCheckable(el),
|
|
@@ -283,6 +345,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
283
345
|
previous,
|
|
284
346
|
selectedKeys: this.selection.selectedKeys
|
|
285
347
|
});
|
|
348
|
+
this.#viewState.notify();
|
|
286
349
|
}
|
|
287
350
|
});
|
|
288
351
|
this.tickled = new TickledController(this, {
|
|
@@ -296,6 +359,8 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
296
359
|
},
|
|
297
360
|
onTickle: (id) => {
|
|
298
361
|
if (id !== void 0) this._dispatch(`list-tickle`, { item: id });
|
|
362
|
+
if (!this.#viewState.isRestoring) this.#pendingFocus = void 0;
|
|
363
|
+
if (this.tickled.inputMode === `keyboard`) this.#viewState.notify();
|
|
299
364
|
},
|
|
300
365
|
onStateChange: () => this._syncItemStates(),
|
|
301
366
|
itemWrap: this.itemWrap,
|
|
@@ -372,6 +437,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
372
437
|
highlightKey: SEARCH_HIGHLIGHT_KEY
|
|
373
438
|
}) });
|
|
374
439
|
this.#onListScroll = () => {
|
|
440
|
+
if (!this.#viewState.pendingScroll) this.#viewState.notify();
|
|
375
441
|
if (this.#viewportScrollRaf !== 0) return;
|
|
376
442
|
this.#viewportScrollRaf = requestAnimationFrame(() => {
|
|
377
443
|
this.#viewportScrollRaf = 0;
|
|
@@ -525,6 +591,11 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
525
591
|
#groupObserver;
|
|
526
592
|
#providerBuilt;
|
|
527
593
|
#data;
|
|
594
|
+
#viewState;
|
|
595
|
+
/** Saved cursor key not (yet) present. Pending selection lives in `selection`. */
|
|
596
|
+
#pendingFocus;
|
|
597
|
+
/** The pending scroll's anchor item, once it exists. */
|
|
598
|
+
#scrollAnchorEl;
|
|
528
599
|
#nativeDragging;
|
|
529
600
|
#postDragSuppressTimer;
|
|
530
601
|
#blankItemPressPending;
|
|
@@ -639,6 +710,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
639
710
|
this.#resizeObserver.observe(this);
|
|
640
711
|
this.#mutationObserver = new MutationObserver((records) => {
|
|
641
712
|
this.#processAddedChildren(records);
|
|
713
|
+
this.#reconcileMutations(records);
|
|
642
714
|
this.#animateChildMutations(records);
|
|
643
715
|
this.#scheduleGeometry();
|
|
644
716
|
this.#scheduleGroups();
|
|
@@ -662,6 +734,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
662
734
|
this.#searchRegistry ??= createCommandRegistry();
|
|
663
735
|
this.#syncSearchCommands();
|
|
664
736
|
this.#scheduleGroups();
|
|
737
|
+
this.#viewState.observeScrollTarget(this);
|
|
665
738
|
}
|
|
666
739
|
/**
|
|
667
740
|
* Collapse-in items appended to the light DOM (however they got there). A bulk
|
|
@@ -726,7 +799,8 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
726
799
|
willUpdate(changed) {
|
|
727
800
|
super.willUpdate(changed);
|
|
728
801
|
if (changed.has(`groupBy`) && this.hasUpdated) {
|
|
729
|
-
|
|
802
|
+
const keep = pendingCollapsed(this._collapsedGroups, this.#presentGroupKeys());
|
|
803
|
+
if (keep !== this._collapsedGroups) this._collapsedGroups = keep;
|
|
730
804
|
this.#groupByChanged = true;
|
|
731
805
|
}
|
|
732
806
|
}
|
|
@@ -749,8 +823,9 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
749
823
|
});
|
|
750
824
|
return;
|
|
751
825
|
}
|
|
752
|
-
const shapeChanged = changed.has(`displayProperty`) || changed.has(`formatter`) || changed.has(`iconProperty`) || changed.has(`iconColorProperty`) || changed.has(`textColorProperty`) || changed.has(`badgeProperty`) || changed.has(`keyProperty`);
|
|
826
|
+
const shapeChanged = changed.has(`displayProperty`) || changed.has(`formatter`) || changed.has(`searchText`) || changed.has(`iconProperty`) || changed.has(`iconColorProperty`) || changed.has(`textColorProperty`) || changed.has(`badgeProperty`) || changed.has(`keyProperty`);
|
|
753
827
|
if ((changed.has(`items`) || shapeChanged) && this.provider === void 0 && this.items.length > 0) this.#rebuildFromObjects(this.items, !shapeChanged);
|
|
828
|
+
else if (shapeChanged && this.provider !== void 0 && this.#builtFromProvider.length > 0) this.#rebuildFromObjects(this.#builtFromProvider);
|
|
754
829
|
this.#syncFromProvider();
|
|
755
830
|
if (changed.has(`sort`) || changed.has(`sortBy`) || changed.has(`sortComparator`)) this.#applySort();
|
|
756
831
|
if (changed.has(`filterPredicate`)) {
|
|
@@ -786,6 +861,16 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
786
861
|
this.#recomputeGeometry();
|
|
787
862
|
this.#scheduleViewportChangeEmit();
|
|
788
863
|
}
|
|
864
|
+
/**
|
|
865
|
+
* Rebuild every object-item row, for when something the `formatter` (or
|
|
866
|
+
* `searchText`) reads has changed but the items themselves haven't —
|
|
867
|
+
* reassigning the same objects keeps their rows as they are. Assigning a new
|
|
868
|
+
* `formatter` function has the same effect.
|
|
869
|
+
*/
|
|
870
|
+
reformat() {
|
|
871
|
+
const items = this.provider === void 0 ? this.items : this.#builtFromProvider;
|
|
872
|
+
if (items.length > 0) this.#rebuildFromObjects(items);
|
|
873
|
+
}
|
|
789
874
|
addItem(item, options) {
|
|
790
875
|
let el;
|
|
791
876
|
if (typeof item === `string`) {
|
|
@@ -799,6 +884,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
799
884
|
if (this.sort !== `none`) this.#applySort();
|
|
800
885
|
if (this.interactionMode === `checked`) this._syncCheckboxes();
|
|
801
886
|
this.#scheduleGroups();
|
|
887
|
+
this.#adoptItems([el]);
|
|
802
888
|
}
|
|
803
889
|
/**
|
|
804
890
|
* Collapse + fade `item` out, then detach it; the rows after it slide up to
|
|
@@ -839,6 +925,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
839
925
|
if (this.sort !== `none`) this.#applySort();
|
|
840
926
|
if (this.interactionMode === `checked`) this._syncCheckboxes();
|
|
841
927
|
this.#scheduleGroups();
|
|
928
|
+
this.#adoptItems(items);
|
|
842
929
|
}
|
|
843
930
|
/**
|
|
844
931
|
* Get the source object behind an `<li>` built from an `items` array or
|
|
@@ -946,20 +1033,151 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
946
1033
|
if (wanted(el)) yield el;
|
|
947
1034
|
}
|
|
948
1035
|
}
|
|
1036
|
+
/**
|
|
1037
|
+
* Snapshot selection, collapsed groups, cursor and scroll as plain JSON,
|
|
1038
|
+
* keyed by item / group key. Includes pending state for keys not present.
|
|
1039
|
+
*/
|
|
1040
|
+
getViewState(options) {
|
|
1041
|
+
const withPending = options?.includePending ?? true;
|
|
1042
|
+
const focus = this.tickled.inputMode === `keyboard` ? this.tickledKey : void 0;
|
|
1043
|
+
return this.#viewState.shape({
|
|
1044
|
+
selected: keysToArray(this.selection.selectedKeys, withPending ? this.selection.pendingKeys : []),
|
|
1045
|
+
expanded: collapsedToRecord(this._collapsedGroups, this.#presentGroupKeys(), withPending),
|
|
1046
|
+
focus: focus ?? (withPending ? this.#pendingFocus : void 0),
|
|
1047
|
+
scroll: (withPending ? this.#viewState.pendingScroll : void 0) ?? this.#captureScroll()
|
|
1048
|
+
}, options);
|
|
1049
|
+
}
|
|
1050
|
+
/**
|
|
1051
|
+
* Apply saved view state. Fields present replace the current ones; keys not
|
|
1052
|
+
* in the data are applied as matching items arrive (rebuilds, provider
|
|
1053
|
+
* batches, `addItem`, light-DOM appends).
|
|
1054
|
+
*/
|
|
1055
|
+
setViewState(state) {
|
|
1056
|
+
if (!this.#viewState.accepts(state)) return;
|
|
1057
|
+
const index = indexByKey(this.#allItems());
|
|
1058
|
+
const resolve = (key) => index.get(key);
|
|
1059
|
+
this.#viewState.restoring(() => {
|
|
1060
|
+
if (state.expanded) this.#restoreCollapsed(collapsedFromRecord(state.expanded));
|
|
1061
|
+
if (state.selected) this.selection.restoreKeys(state.selected, resolve);
|
|
1062
|
+
if (state.focus !== void 0) {
|
|
1063
|
+
this.#pendingFocus = state.focus;
|
|
1064
|
+
this.#resolveFocus(resolve);
|
|
1065
|
+
}
|
|
1066
|
+
if (state.scroll) {
|
|
1067
|
+
this.#viewState.pendingScroll = state.scroll;
|
|
1068
|
+
this.#scrollAnchorEl = state.scroll.anchor ? resolve(state.scroll.anchor.key) : void 0;
|
|
1069
|
+
this.#scheduleGeometry();
|
|
1070
|
+
}
|
|
1071
|
+
this.#viewState.notify();
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
clearPendingViewState() {
|
|
1075
|
+
this.selection.clearPending();
|
|
1076
|
+
this.#pendingFocus = void 0;
|
|
1077
|
+
this.#viewState.pendingScroll = void 0;
|
|
1078
|
+
this.#scrollAnchorEl = void 0;
|
|
1079
|
+
const present = this.#presentGroupKeys();
|
|
1080
|
+
if ([...this._collapsedGroups].some((key) => !present.has(key))) this._collapsedGroups = new Set([...this._collapsedGroups].filter((key) => present.has(key)));
|
|
1081
|
+
}
|
|
1082
|
+
/** Group keys currently shown (empty while ungrouped). */
|
|
1083
|
+
#presentGroupKeys() {
|
|
1084
|
+
return new Set(this.#groupList.map((g) => g.key));
|
|
1085
|
+
}
|
|
1086
|
+
/** Replace the collapsed set; fires `list-group-toggle` for present groups that change. */
|
|
1087
|
+
#restoreCollapsed(next) {
|
|
1088
|
+
const prev = this._collapsedGroups;
|
|
1089
|
+
this._collapsedGroups = next;
|
|
1090
|
+
for (const { key } of this.#groupList) if (prev.has(key) !== next.has(key)) this._dispatch(`list-group-toggle`, {
|
|
1091
|
+
groupKey: key,
|
|
1092
|
+
collapsed: next.has(key)
|
|
1093
|
+
});
|
|
1094
|
+
}
|
|
1095
|
+
/**
|
|
1096
|
+
* Apply pending state to items that just arrived. Only `items` is searched,
|
|
1097
|
+
* so a provider batch costs O(batch), not O(list).
|
|
1098
|
+
*/
|
|
1099
|
+
#adoptItems(items) {
|
|
1100
|
+
const anchorKey = this.#viewState.pendingScroll?.anchor?.key;
|
|
1101
|
+
if (this.selection.pendingKeys.size === 0 && this.#pendingFocus === void 0 && anchorKey === void 0) return;
|
|
1102
|
+
const index = indexByKey(items);
|
|
1103
|
+
if (index.size === 0) return;
|
|
1104
|
+
const resolve = (key) => index.get(key);
|
|
1105
|
+
this.#viewState.restoring(() => {
|
|
1106
|
+
this.selection.resolvePending(resolve);
|
|
1107
|
+
this.#resolveFocus(resolve);
|
|
1108
|
+
});
|
|
1109
|
+
if (anchorKey !== void 0 && index.has(anchorKey)) this.#scrollAnchorEl = index.get(anchorKey);
|
|
1110
|
+
}
|
|
1111
|
+
/** Light-DOM changes: removed items go pending (silently), added items pick up pending state. */
|
|
1112
|
+
#reconcileMutations(records) {
|
|
1113
|
+
const gone = [];
|
|
1114
|
+
const added = [];
|
|
1115
|
+
const tickled = this.tickled.tickledId;
|
|
1116
|
+
let tickledGone = false;
|
|
1117
|
+
for (const record of records) {
|
|
1118
|
+
for (const node of record.removedNodes) {
|
|
1119
|
+
if (!(node instanceof Element) || node.parentElement === this) continue;
|
|
1120
|
+
if (this.selection.selected.has(node)) gone.push(node);
|
|
1121
|
+
if (node === tickled) tickledGone = true;
|
|
1122
|
+
}
|
|
1123
|
+
for (const node of record.addedNodes) if (node instanceof HTMLLIElement && node.parentElement === this) added.push(node);
|
|
1124
|
+
}
|
|
1125
|
+
if (gone.length > 0 && this.selection.demote(gone)) this._syncItemStates();
|
|
1126
|
+
if (tickledGone && tickled) {
|
|
1127
|
+
const key = keyForElement(tickled);
|
|
1128
|
+
this.#viewState.restoring(() => {
|
|
1129
|
+
if (key !== void 0 && this.tickled.inputMode === `keyboard`) this.#pendingFocus ??= key;
|
|
1130
|
+
this.tickled.setTickled(void 0);
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
if (added.length > 0) this.#adoptItems(added);
|
|
1134
|
+
}
|
|
1135
|
+
/** Whether `el` is in the list and laid out (not hidden, filtered or collapsed). */
|
|
1136
|
+
#isLaidOut(el) {
|
|
1137
|
+
return el !== void 0 && el.parentElement === this && this.#isItemVisible(el) && !el.hasAttribute(GROUP_COLLAPSED_ATTR);
|
|
1138
|
+
}
|
|
1139
|
+
#resolveFocus(resolve) {
|
|
1140
|
+
const key = this.#pendingFocus;
|
|
1141
|
+
if (key === void 0) return;
|
|
1142
|
+
const el = resolve(key);
|
|
1143
|
+
if (!this.#isLaidOut(el)) return;
|
|
1144
|
+
this.#pendingFocus = void 0;
|
|
1145
|
+
this.tickled.setInputMode(`keyboard`);
|
|
1146
|
+
this.tickled.setTickled(el);
|
|
1147
|
+
}
|
|
1148
|
+
#captureScroll() {
|
|
1149
|
+
return this._listEl ? captureListScroll(this._listEl, this._getVisibleItems()) : void 0;
|
|
1150
|
+
}
|
|
1151
|
+
/** Try the pending scroll; kept until its anchor is laid out and the columns are wide enough. */
|
|
1152
|
+
#applyPendingScroll() {
|
|
1153
|
+
const viewport = this._listEl;
|
|
1154
|
+
if (!viewport || !this.isConnected || !this.#viewState.pendingScroll) return;
|
|
1155
|
+
this.#viewState.applyPendingScroll((scroll) => applyListScroll(viewport, scroll, () => this.#isLaidOut(this.#scrollAnchorEl) ? this.#scrollAnchorEl : void 0));
|
|
1156
|
+
if (!this.#viewState.pendingScroll) this.#scrollAnchorEl = void 0;
|
|
1157
|
+
}
|
|
949
1158
|
#rebuildFromObjects(items, reuseRows = false) {
|
|
950
1159
|
const keyOf = (el) => el.getAttribute(`data-key`) ?? el.getAttribute(`data-search-label`) ?? null;
|
|
951
|
-
const
|
|
1160
|
+
const previous = [...this.selection.selected];
|
|
1161
|
+
const previousKeys = new Set(previous.map(keyOf).filter((k) => k !== null));
|
|
952
1162
|
const anchorKey = this.selection.anchor ? keyOf(this.selection.anchor) : null;
|
|
953
1163
|
if (reuseRows) this.#reconcileObjectRows(items);
|
|
954
1164
|
else this.replaceChildren(...items.map((item, index) => this.#createItemEl(item, index)));
|
|
955
|
-
if (
|
|
1165
|
+
if (previous.length > 0 || anchorKey !== null) {
|
|
956
1166
|
const next = [];
|
|
1167
|
+
const matched = /* @__PURE__ */ new Set();
|
|
957
1168
|
let anchor;
|
|
958
1169
|
for (const el of this.querySelectorAll(ITEM_SELECTOR)) {
|
|
959
1170
|
const key = keyOf(el);
|
|
960
|
-
if (key !== null && previousKeys.has(key))
|
|
1171
|
+
if (key !== null && previousKeys.has(key)) {
|
|
1172
|
+
next.push(el);
|
|
1173
|
+
matched.add(key);
|
|
1174
|
+
}
|
|
961
1175
|
if (key !== null && key === anchorKey) anchor = el;
|
|
962
1176
|
}
|
|
1177
|
+
this.selection.demote(previous.filter((el) => {
|
|
1178
|
+
const key = keyOf(el);
|
|
1179
|
+
return key === null || !matched.has(key);
|
|
1180
|
+
}));
|
|
963
1181
|
this.selection.seed(next, anchor);
|
|
964
1182
|
}
|
|
965
1183
|
if (this.sort !== `none`) this.#applySort();
|
|
@@ -967,6 +1185,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
967
1185
|
this._syncItemStates();
|
|
968
1186
|
this.#scheduleGeometry();
|
|
969
1187
|
this.#scheduleGroups();
|
|
1188
|
+
this.#adoptItems(this.#allItems());
|
|
970
1189
|
}
|
|
971
1190
|
/**
|
|
972
1191
|
* Update the rows to match `items`, keeping the `<li>` of every object that
|
|
@@ -1015,6 +1234,8 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1015
1234
|
li.appendChild(content);
|
|
1016
1235
|
if (textColor !== void 0) li.style.color = textColor;
|
|
1017
1236
|
}
|
|
1237
|
+
const searchText = this.searchText?.(item, index);
|
|
1238
|
+
if (searchText !== void 0) li.setAttribute(`data-search-label`, searchText);
|
|
1018
1239
|
if (this.keyProperty) {
|
|
1019
1240
|
const key = this.#propertyValue(item, this.keyProperty);
|
|
1020
1241
|
if (key !== void 0 && key !== null) li.setAttribute(`data-key`, String(key));
|
|
@@ -1038,8 +1259,8 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1038
1259
|
let prefix = 0;
|
|
1039
1260
|
while (prefix < this.#builtFromProvider.length && prefix < items.length && this.#builtFromProvider[prefix] === items[prefix]) prefix++;
|
|
1040
1261
|
if (prefix === this.#builtFromProvider.length && prefix <= items.length) {
|
|
1041
|
-
const tail = items.slice(prefix);
|
|
1042
|
-
for (const
|
|
1262
|
+
const tail = items.slice(prefix).map((item) => this.#createItemEl(item, this.#providerBuilt++));
|
|
1263
|
+
for (const li of tail) this.appendChild(li);
|
|
1043
1264
|
if (this.sort !== `none`) {
|
|
1044
1265
|
cancelAnimationFrame(this.#sortRaf);
|
|
1045
1266
|
this.#sortRaf = requestAnimationFrame(() => this.#applySort());
|
|
@@ -1048,6 +1269,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1048
1269
|
this._syncItemStates();
|
|
1049
1270
|
this.#scheduleGeometry();
|
|
1050
1271
|
this.#scheduleGroups();
|
|
1272
|
+
this.#adoptItems(tail);
|
|
1051
1273
|
} else {
|
|
1052
1274
|
this.#providerBuilt = 0;
|
|
1053
1275
|
this.#rebuildFromObjects(items);
|
|
@@ -1227,6 +1449,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1227
1449
|
groupKey,
|
|
1228
1450
|
collapsed
|
|
1229
1451
|
});
|
|
1452
|
+
this.#viewState.notify();
|
|
1230
1453
|
}
|
|
1231
1454
|
toggleGroup(groupKey) {
|
|
1232
1455
|
this.setGroupCollapsed(groupKey, !this._collapsedGroups.has(groupKey));
|
|
@@ -1255,6 +1478,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1255
1478
|
this.#geometryScheduled = true;
|
|
1256
1479
|
requestAnimationFrame(() => {
|
|
1257
1480
|
this.#geometryScheduled = false;
|
|
1481
|
+
this.#applyPendingScroll();
|
|
1258
1482
|
this.#emitViewportChangeIfChanged();
|
|
1259
1483
|
});
|
|
1260
1484
|
}
|
|
@@ -1946,6 +2170,7 @@ __decorate([property({
|
|
|
1946
2170
|
attribute: `display-property`
|
|
1947
2171
|
})], DetailListElement.prototype, "displayProperty", void 0);
|
|
1948
2172
|
__decorate([property({ attribute: false })], DetailListElement.prototype, "formatter", void 0);
|
|
2173
|
+
__decorate([property({ attribute: false })], DetailListElement.prototype, "searchText", void 0);
|
|
1949
2174
|
__decorate([property({
|
|
1950
2175
|
type: String,
|
|
1951
2176
|
attribute: `icon-property`
|
|
@@ -1,14 +1,31 @@
|
|
|
1
1
|
import "./icon-CDGprSdE.js";
|
|
2
2
|
import { r as IDataProvider } from "./data-provider-BAn_-oR1.js";
|
|
3
|
-
import {
|
|
3
|
+
import { L as ListDragPreviewRenderer, R as ListDragPreviewSourceResolver, V as ListNativeDragStartEvent } from "./tree-component-DgfkxmVY.js";
|
|
4
|
+
import { a as ViewStateBase, s as ViewStateChangeEvent, t as GetViewStateOptions } from "./types-LU1u0CB8.js";
|
|
5
|
+
import "./index-9ttcdwlL.js";
|
|
4
6
|
import { n as ListViewportChangeEvent } from "./list-viewport-types-BRZsLcvp.js";
|
|
5
|
-
import { S as ListSearchController } from "./index-
|
|
7
|
+
import { S as ListSearchController } from "./index-CUErGhCg.js";
|
|
6
8
|
import { a as ListGroupEventMap, o as ListGroupInfo, s as ListGroupLabel } from "./grouping-CUKgmkMm.js";
|
|
7
9
|
import { i as ListInteractionMode, l as ListSelectionMode, r as ListElementEventMap } from "./list-selection-types-PjKdhF-a.js";
|
|
8
|
-
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-
|
|
10
|
+
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-SAx56U-l.js";
|
|
9
11
|
import "./list-group-header.js";
|
|
10
12
|
import { LitElement, PropertyValues } from "lit";
|
|
11
13
|
import { CommandId, CommandRegistry } from "@clinth/ui-commands";
|
|
14
|
+
//#region src/detail-list/detail-list-view-state.d.ts
|
|
15
|
+
/**
|
|
16
|
+
* Pure helpers behind `ixfx-detail-list`'s view state (see
|
|
17
|
+
* `docs/infra-view-state.md`). The component keeps only the wiring.
|
|
18
|
+
*
|
|
19
|
+
* - `selected` — selected item keys (in `checked` mode, the checked set:
|
|
20
|
+
* `data-checked` is derived from the selection, not stored separately).
|
|
21
|
+
* - `expanded` — `{ [groupKey]: false }` for collapsed groups. Groups default
|
|
22
|
+
* open, so only collapses are recorded; `true` re-opens.
|
|
23
|
+
* - `focus` — keyboard-cursor key.
|
|
24
|
+
* - `scroll` — horizontal: `left` plus an anchor on the top item of the first
|
|
25
|
+
* visible column.
|
|
26
|
+
*/
|
|
27
|
+
type DetailListViewState = ViewStateBase;
|
|
28
|
+
//#endregion
|
|
12
29
|
//#region src/detail-list/types.d.ts
|
|
13
30
|
/** Sort direction applied to the item columns. */
|
|
14
31
|
type DetailSortMode = `none` | `ascending` | `descending`;
|
|
@@ -58,6 +75,13 @@ declare class DetailListElement extends LitElement {
|
|
|
58
75
|
provider: IDataProvider<void, unknown> | undefined;
|
|
59
76
|
displayProperty: string;
|
|
60
77
|
formatter: DetailFormatter | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Text incremental search matches for an object item. Defaults to the
|
|
80
|
+
* caption when it is a string (`displayProperty` or a string `formatter`),
|
|
81
|
+
* else the row's whole text — set this when `formatter` returns a `Node`
|
|
82
|
+
* carrying more than the name (sublines, sizes, dates).
|
|
83
|
+
*/
|
|
84
|
+
searchText: ((item: unknown, index: number) => string) | undefined;
|
|
61
85
|
iconProperty: string;
|
|
62
86
|
/**
|
|
63
87
|
* Property on each `items` entry holding a CSS colour for the item's
|
|
@@ -141,6 +165,13 @@ declare class DetailListElement extends LitElement {
|
|
|
141
165
|
* changed by outside forces (e.g. an external font load).
|
|
142
166
|
*/
|
|
143
167
|
refreshLayout(): void;
|
|
168
|
+
/**
|
|
169
|
+
* Rebuild every object-item row, for when something the `formatter` (or
|
|
170
|
+
* `searchText`) reads has changed but the items themselves haven't —
|
|
171
|
+
* reassigning the same objects keeps their rows as they are. Assigning a new
|
|
172
|
+
* `formatter` function has the same effect.
|
|
173
|
+
*/
|
|
174
|
+
reformat(): void;
|
|
144
175
|
addItem(item: Element | string, options?: AddItemOptions): void;
|
|
145
176
|
/**
|
|
146
177
|
* Collapse + fade `item` out, then detach it; the rows after it slide up to
|
|
@@ -194,6 +225,18 @@ declare class DetailListElement extends LitElement {
|
|
|
194
225
|
/** Move the cursor to the item with this key and scroll it into view. */
|
|
195
226
|
focusKey(key: string): void;
|
|
196
227
|
selectedFilter(kind: `selected` | `checked` | `either`): Generator<Element>;
|
|
228
|
+
/**
|
|
229
|
+
* Snapshot selection, collapsed groups, cursor and scroll as plain JSON,
|
|
230
|
+
* keyed by item / group key. Includes pending state for keys not present.
|
|
231
|
+
*/
|
|
232
|
+
getViewState(options?: GetViewStateOptions<DetailListViewState>): DetailListViewState;
|
|
233
|
+
/**
|
|
234
|
+
* Apply saved view state. Fields present replace the current ones; keys not
|
|
235
|
+
* in the data are applied as matching items arrive (rebuilds, provider
|
|
236
|
+
* batches, `addItem`, light-DOM appends).
|
|
237
|
+
*/
|
|
238
|
+
setViewState(state: Partial<DetailListViewState>): void;
|
|
239
|
+
clearPendingViewState(): void;
|
|
197
240
|
/** Groups in display order (empty when ungrouped). */
|
|
198
241
|
get groups(): readonly ListGroupInfo[];
|
|
199
242
|
/** Collapse or expand one group. Fires `list-group-toggle` when the state changes. */
|
|
@@ -258,6 +301,7 @@ declare global {
|
|
|
258
301
|
interface DetailListElementEventMap extends ListElementEventMap, ListGroupEventMap {
|
|
259
302
|
'detail-list-viewport-change': ListViewportChangeEvent;
|
|
260
303
|
'list-native-drag-start': ListNativeDragStartEvent<Element>;
|
|
304
|
+
'view-state-change': ViewStateChangeEvent<DetailListViewState>;
|
|
261
305
|
}
|
|
262
306
|
//#endregion
|
|
263
|
-
export { DetailSortComparator as a, DetailGroupBy as i, DetailListElementEventMap as n, DetailSortItem as o, DetailFormatter as r, DetailSortMode as s, DetailListElement as t };
|
|
307
|
+
export { DetailSortComparator as a, DetailListViewState as c, DetailGroupBy as i, DetailListElementEventMap as n, DetailSortItem as o, DetailFormatter as r, DetailSortMode as s, DetailListElement as t };
|
package/dist/detail-list.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { B as ListNativeDragStartDetail, F as ListDragPreview, I as ListDragPreviewContext, L as ListDragPreviewRenderer, P as ListDragEntry, V as ListNativeDragStartEvent, z as ListDragSource } from "./tree-component-DgfkxmVY.js";
|
|
2
2
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BRZsLcvp.js";
|
|
3
3
|
import { i as ListGroupChangeEvent, l as ListGroupToggleDetail, n as ListGroupBy, o as ListGroupInfo, r as ListGroupChangeDetail, s as ListGroupLabel, u as ListGroupToggleEvent } from "./grouping-CUKgmkMm.js";
|
|
4
|
-
import { n as
|
|
5
|
-
import {
|
|
6
|
-
export { type AddItemOptions, type CustomCheckboxOptions, type DetailFormatter, type DetailGroupBy, DetailListElement, DetailListElementEventMap, type DetailSortComparator, type DetailSortItem, type DetailSortMode, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListGroupBy, type ListGroupChangeDetail, type ListGroupChangeEvent, type ListGroupInfo, type ListGroupLabel, type ListGroupToggleDetail, type ListGroupToggleEvent, type ListNativeDragStartDetail, type ListNativeDragStartEvent, type ListViewportChangeDetail, type ListViewportChangeEvent };
|
|
4
|
+
import { a as DetailSortComparator, c as DetailListViewState, i as DetailGroupBy, n as DetailListElementEventMap, o as DetailSortItem, r as DetailFormatter, s as DetailSortMode, t as DetailListElement } from "./detail-list-DSZ1DDor.js";
|
|
5
|
+
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-SAx56U-l.js";
|
|
6
|
+
export { type AddItemOptions, type CustomCheckboxOptions, type DetailFormatter, type DetailGroupBy, DetailListElement, DetailListElementEventMap, type DetailListViewState, type DetailSortComparator, type DetailSortItem, type DetailSortMode, type ListDragEntry, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListGroupBy, type ListGroupChangeDetail, type ListGroupChangeEvent, type ListGroupInfo, type ListGroupLabel, type ListGroupToggleDetail, type ListGroupToggleEvent, type ListNativeDragStartDetail, type ListNativeDragStartEvent, type ListViewportChangeDetail, type ListViewportChangeEvent };
|
package/dist/detail-list.js
CHANGED