@ixfx/components 0.13.1 → 0.13.3
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 +100 -14
- package/bundle/index.d.ts.map +1 -1
- package/bundle/index.js +2211 -636
- package/bundle/index.js.map +1 -1
- package/dist/ac-token.js +1 -1
- package/dist/{data-grid-Ck1Qx2H1.d.ts → data-grid-DHWJN66w.d.ts} +7 -5
- package/dist/{data-grid-Ck1Qx2H1.d.ts.map → data-grid-DHWJN66w.d.ts.map} +1 -1
- package/dist/data-grid.d.ts +1 -1
- package/dist/data-grid.js +210 -120
- package/dist/data-grid.js.map +1 -1
- package/dist/detail-list-C96B5Txz.js +2001 -0
- package/dist/detail-list-C96B5Txz.js.map +1 -0
- package/dist/{detail-list-C1xzr1z7.d.ts → detail-list-dX7jLO6b.d.ts} +12 -3
- package/dist/{detail-list-C1xzr1z7.d.ts.map → detail-list-dX7jLO6b.d.ts.map} +1 -1
- package/dist/detail-list.d.ts +2 -2
- package/dist/detail-list.js +1 -1680
- package/dist/{flat-list-DEDG6epz.d.ts → flat-list-Y98IqH00.d.ts} +5 -2
- package/dist/flat-list-Y98IqH00.d.ts.map +1 -0
- package/dist/flat-list.d.ts +1 -1
- package/dist/flat-list.js +33 -1
- package/dist/flat-list.js.map +1 -1
- package/dist/{grid-list-pefLORIr.d.ts → grid-list-CoT9e1jB.d.ts} +9 -2
- package/dist/{grid-list-pefLORIr.d.ts.map → grid-list-CoT9e1jB.d.ts.map} +1 -1
- package/dist/{grid-list-DjIl910A.js → grid-list-DeqAd9-h.js} +189 -40
- package/dist/grid-list-DeqAd9-h.js.map +1 -0
- package/dist/grid-list.d.ts +1 -1
- package/dist/grid-list.js +1 -1
- package/dist/{incr-search-D91M4Ozq.js → incr-search-JIhwB49y.js} +27 -5
- package/dist/incr-search-JIhwB49y.js.map +1 -0
- package/dist/incr-search.d.ts +1 -1
- package/dist/incr-search.js +1 -1
- package/dist/index-CnQPCywE.d.ts +325 -0
- package/dist/index-CnQPCywE.d.ts.map +1 -0
- package/dist/{index-CxZ61DO1.d.ts → index-Dlah7Zfi.d.ts} +8 -1
- package/dist/{index-CxZ61DO1.d.ts.map → index-Dlah7Zfi.d.ts.map} +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +46 -25
- package/dist/index.js.map +1 -1
- package/dist/miller.d.ts +1 -1
- package/dist/miller.d.ts.map +1 -1
- package/dist/miller.js +146 -100
- package/dist/miller.js.map +1 -1
- package/dist/narrowed-text.js +1 -1
- package/dist/split-layout-C5SYbDrq.d.ts.map +1 -1
- package/dist/{split-layout-CXotkdbx.js → split-layout-Deoxy47d.js} +6 -1
- package/dist/{split-layout-CXotkdbx.js.map → split-layout-Deoxy47d.js.map} +1 -1
- package/dist/split-layout.js +1 -1
- package/dist/{tab-list-v8mKX7Fu.d.ts → tab-list-D_dmImJM.d.ts} +2 -3
- package/dist/tab-list-D_dmImJM.d.ts.map +1 -0
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +22 -0
- package/dist/tabs.js.map +1 -1
- package/dist/{tree-DGveys4K.js → tree-DD8OaqsK.js} +1010 -230
- package/dist/tree-DD8OaqsK.js.map +1 -0
- package/dist/tree.d.ts +4 -267
- package/dist/tree.js +1 -1
- package/dist/{vertical-list-CqBc-t8w.d.ts → vertical-list-lj_19DCx.d.ts} +3 -2
- package/dist/{vertical-list-CqBc-t8w.d.ts.map → vertical-list-lj_19DCx.d.ts.map} +1 -1
- package/dist/vertical-list.d.ts +1 -1
- package/dist/vertical-list.js +113 -24
- package/dist/vertical-list.js.map +1 -1
- package/docs-user/data-grid.md +74 -4
- package/docs-user/detail-list.md +65 -0
- package/docs-user/flat-list.md +14 -2
- package/docs-user/grid-list.md +81 -4
- package/docs-user/index.json +2 -2
- package/docs-user/miller.md +59 -3
- package/docs-user/tree.md +63 -2
- package/docs-user/vertical-list.md +9 -1
- package/package.json +6 -1
- package/dist/detail-list.js.map +0 -1
- package/dist/flat-list-DEDG6epz.d.ts.map +0 -1
- package/dist/grid-list-DjIl910A.js.map +0 -1
- package/dist/incr-search-D91M4Ozq.js.map +0 -1
- package/dist/tab-list-v8mKX7Fu.d.ts.map +0 -1
- package/dist/tree-DGveys4K.js.map +0 -1
- package/dist/tree.d.ts.map +0 -1
package/dist/tree.d.ts
CHANGED
|
@@ -1,267 +1,4 @@
|
|
|
1
|
-
import { A as TreeDataModelOptions,
|
|
2
|
-
import { a as TreeItem,
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
import { n as TickledController } from "./tickled-controller-DodxD3eQ.js";
|
|
6
|
-
import { LitElement, PropertyValues, ReactiveController, ReactiveControllerHost, TemplateResult, nothing } from "lit";
|
|
7
|
-
import { CommandRegistry } from "@clinth/ui-commands";
|
|
8
|
-
import { TraversableTree } from "@ixfx/collections";
|
|
9
|
-
//#region src/tree/types.d.ts
|
|
10
|
-
/** Tree layout/display configuration (tree-specific, not shared). */
|
|
11
|
-
type TreeConfig = {
|
|
12
|
-
indent: number;
|
|
13
|
-
};
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/tree/tree-base.d.ts
|
|
16
|
-
declare class TreeBaseElement extends LitElement implements TreeComponent, TreeSearchHost {
|
|
17
|
-
#private;
|
|
18
|
-
root: TreeNode | undefined;
|
|
19
|
-
model: TreeDataModel | undefined;
|
|
20
|
-
/** Callback to lazily load children for a node. Superseded by `model` when both are set. */
|
|
21
|
-
loadChildren: LoadChildrenCallback | undefined;
|
|
22
|
-
exclusivity: TreeExclusivity;
|
|
23
|
-
selectionFilter: TreeSelectionFilter;
|
|
24
|
-
/** Controls how pointer/keyboard gestures map to selection changes. Default: `'standard'`. */
|
|
25
|
-
interactionMode: TreeInteractionMode;
|
|
26
|
-
selectedNode: TreeNode | undefined;
|
|
27
|
-
protected _selectedNodes: Set<TreeNode>;
|
|
28
|
-
get selectedNodes(): ReadonlySet<TreeNode>;
|
|
29
|
-
filterPredicate: TreeFilterPredicate | undefined;
|
|
30
|
-
disableKeyboardNavigation: boolean;
|
|
31
|
-
registry: CommandRegistry<unknown> | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Space-separated subset of `navigate select filter` — limits which
|
|
34
|
-
* incremental-search modes are offered. Unset ⇒ all three; empty ⇒ search
|
|
35
|
-
* disabled. See `docs/infra-incremental.md`.
|
|
36
|
-
*/
|
|
37
|
-
searchModes: string | undefined;
|
|
38
|
-
itemDnd: TreeDndMode;
|
|
39
|
-
acceptDropTypes: string | undefined;
|
|
40
|
-
dndExpandHoverMs: number;
|
|
41
|
-
/**
|
|
42
|
-
* Whether a drag that only reorders siblings (no dragged node changes parent)
|
|
43
|
-
* is honoured. Default `true`. Set `reorderable="false"` for models with no
|
|
44
|
-
* meaningful child order (e.g. a filesystem) — pure-reorder drags then get no
|
|
45
|
-
* drop indicator and emit no `tree-drop`. Reparenting is unaffected.
|
|
46
|
-
*/
|
|
47
|
-
reorderable: boolean;
|
|
48
|
-
/**
|
|
49
|
-
* VS Code-style sticky headers: while scrolling vertically, the ancestors of
|
|
50
|
-
* the top-visible row stick to the top of the list. Clicking a stuck header
|
|
51
|
-
* selects that ancestor and scrolls it into view; clicking its caret toggles
|
|
52
|
-
* expansion. On by default — set `sticky-headers="false"` to opt out.
|
|
53
|
-
*/
|
|
54
|
-
stickyHeaders: boolean;
|
|
55
|
-
dragPreviewRenderer: ListDragPreviewRenderer<TreeNode> | undefined;
|
|
56
|
-
dragPreviewSource: ListDragPreviewSourceResolver<TreeNode> | undefined;
|
|
57
|
-
canDrag: ((ctx: TreeDragContext) => boolean) | undefined;
|
|
58
|
-
canDrop: ((ctx: TreeDropContext) => boolean) | undefined;
|
|
59
|
-
parseExternalDrop: ((dt: DataTransfer) => TreeNode[] | undefined) | undefined;
|
|
60
|
-
applyInternalDrop: boolean;
|
|
61
|
-
protected _expandedKeys: Set<string>;
|
|
62
|
-
protected tickled: TickledController<string>;
|
|
63
|
-
protected _focusedDepth: number;
|
|
64
|
-
/** Incremental search (navigate / select / filter). See `docs/infra-incremental.md`. */
|
|
65
|
-
readonly search: ListSearchController<{
|
|
66
|
-
node: TreeNode;
|
|
67
|
-
depth: number;
|
|
68
|
-
}>;
|
|
69
|
-
/**
|
|
70
|
-
* Ancestor keys currently stuck to the top of the list (root-ward order).
|
|
71
|
-
* Recomputed on scroll and structural updates; empty when nothing is stuck.
|
|
72
|
-
*/
|
|
73
|
-
protected _stickyKeys: string[];
|
|
74
|
-
protected get nativeDrag(): ListNativeDragController<TreeNode>;
|
|
75
|
-
protected get dropState(): TreeDropTarget | undefined;
|
|
76
|
-
/** Keys of the nodes currently being dragged out of this tree. */
|
|
77
|
-
protected get nativeDragKeys(): ReadonlySet<string>;
|
|
78
|
-
willUpdate(changedProps: PropertyValues): void;
|
|
79
|
-
/** True while `node` is a fading ghost row (removed / collapsed, still animating out). */
|
|
80
|
-
protected _isLeaving(node: TreeNode): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* True when `filterPredicate` is set and neither `node` nor any descendant
|
|
83
|
-
* matches — the row should carry the `filtered` class (`display: none`).
|
|
84
|
-
*/
|
|
85
|
-
protected _isFilteredOut(node: TreeNode, depth: number): boolean;
|
|
86
|
-
updated(changedProps: PropertyValues): void;
|
|
87
|
-
connectedCallback(): void;
|
|
88
|
-
disconnectedCallback(): void;
|
|
89
|
-
getConfig(): TreeConfig;
|
|
90
|
-
setConfig(config: Partial<TreeConfig>): void;
|
|
91
|
-
select(node: TreeNode): void;
|
|
92
|
-
deselect(node: TreeNode): void;
|
|
93
|
-
clearSelection(): void;
|
|
94
|
-
selectAll(): void;
|
|
95
|
-
deselectAll(): void;
|
|
96
|
-
navigateTo(keys: readonly string[]): boolean;
|
|
97
|
-
navigateToNode(predicate: (node: TreeNode) => boolean): boolean;
|
|
98
|
-
/** Expand ancestors + move the cursor to `key`, without touching the selection (search "navigate" mode). */
|
|
99
|
-
revealKey(key: string): boolean;
|
|
100
|
-
/** Replace the selection with `nodes` (subject to `selectionFilter`) — search "select" mode. */
|
|
101
|
-
selectMany(nodes: Iterable<TreeNode>): void;
|
|
102
|
-
getNodes(): ReadonlyArray<{
|
|
103
|
-
node: TreeNode;
|
|
104
|
-
depth: number;
|
|
105
|
-
}>;
|
|
106
|
-
protected renderNodeContent(node: TreeNode, depth: number): TemplateResult | typeof nothing;
|
|
107
|
-
protected _handleItemClick(node: TreeNode, depth: number, event?: MouseEvent): void;
|
|
108
|
-
protected _handleCheckboxClick(event: MouseEvent, node: TreeNode, _depth: number): void;
|
|
109
|
-
protected _isSelected(node: TreeNode): boolean;
|
|
110
|
-
protected _isFocused(node: TreeNode): boolean;
|
|
111
|
-
protected _isExpanded(node: TreeNode, depth?: number): boolean;
|
|
112
|
-
protected get _pendingNode(): TreeNode | undefined;
|
|
113
|
-
protected renderLoadingIndicator(): TemplateResult | typeof nothing;
|
|
114
|
-
protected render(): TemplateResult<1>;
|
|
115
|
-
/** Shared drag-and-drop render state for a row, used by every `_renderNode` variant. */
|
|
116
|
-
protected _dndRowState(node: TreeNode): {
|
|
117
|
-
draggable: boolean;
|
|
118
|
-
dragging: boolean;
|
|
119
|
-
dropTarget: boolean;
|
|
120
|
-
dropPosition?: TreeDropTarget[`position`];
|
|
121
|
-
dropDepth?: number;
|
|
122
|
-
};
|
|
123
|
-
protected _renderNode(node: TreeNode, depth: number): TemplateResult;
|
|
124
|
-
static styles: import("lit").CSSResult[];
|
|
125
|
-
}
|
|
126
|
-
declare global {
|
|
127
|
-
interface HTMLElementTagNameMap {
|
|
128
|
-
'ixfx-tree-base': TreeBaseElement;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
interface TreeBaseElementEventMap extends TreeComponentEventMap {
|
|
132
|
-
'item-click': TreeItemClickEvent;
|
|
133
|
-
'item-dblclick': TreeItemDblClickEvent;
|
|
134
|
-
'expand': TreeExpandEvent;
|
|
135
|
-
'collapse': TreeCollapseEvent;
|
|
136
|
-
'select': TreeSelectEvent;
|
|
137
|
-
'tickle': TreeTickleEvent;
|
|
138
|
-
'activate': TreeActivateEvent;
|
|
139
|
-
'list-native-drag-start': CustomEvent<ListNativeDragStartDetail<TreeNode>>;
|
|
140
|
-
'tree-drag-start': TreeDragStartEvent;
|
|
141
|
-
'tree-drag-over': TreeDragOverEvent;
|
|
142
|
-
'tree-drop': TreeDropEvent;
|
|
143
|
-
'tree-drag-end': TreeDragEndEvent;
|
|
144
|
-
}
|
|
145
|
-
interface TreeBaseElement {
|
|
146
|
-
addEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void);
|
|
147
|
-
removeEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeBaseElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | EventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | EventListenerOptions) => void);
|
|
148
|
-
}
|
|
149
|
-
//#endregion
|
|
150
|
-
//#region src/tree/tree-list.d.ts
|
|
151
|
-
/** Checkbox tri-state in `checked` interactionMode: a branch node is `indeterminate` when some but not all of its descendants are selected. */
|
|
152
|
-
type TreeCheckboxState = `checked` | `unchecked` | `indeterminate`;
|
|
153
|
-
declare class TreeListElement extends TreeBaseElement {
|
|
154
|
-
#private;
|
|
155
|
-
/**
|
|
156
|
-
* Optional renderer for the checkbox shown in `checked` interactionMode.
|
|
157
|
-
* Receives the node's current tri-state (`checked` / `unchecked` / `indeterminate`,
|
|
158
|
-
* the latter when some but not all descendants are selected) and returns a Lit
|
|
159
|
-
* template.
|
|
160
|
-
*
|
|
161
|
-
* When set, the checkbox becomes a `<span role="checkbox">` whose contents are
|
|
162
|
-
* whatever this returns. When unset, a native `<input type="checkbox">` is used.
|
|
163
|
-
*
|
|
164
|
-
* @example
|
|
165
|
-
* list.checkboxRenderer = (state) => state === `unchecked`
|
|
166
|
-
* ? html``
|
|
167
|
-
* : html`<svg viewBox="0 0 16 16" width="14" height="14"
|
|
168
|
-
* fill="none" stroke="currentColor" stroke-width="2"
|
|
169
|
-
* stroke-linecap="round" stroke-linejoin="round"
|
|
170
|
-
* style="opacity:${state === `indeterminate` ? 0.35 : 0.6}">
|
|
171
|
-
* <polyline points="3,8 7,12 13,4" />
|
|
172
|
-
* </svg>`;
|
|
173
|
-
*/
|
|
174
|
-
checkboxRenderer: ((state: TreeCheckboxState) => unknown) | undefined;
|
|
175
|
-
protected render(): TemplateResult<1>;
|
|
176
|
-
protected renderNodeContent(node: TreeNode, depth: number): TemplateResult;
|
|
177
|
-
protected _renderNode(node: TreeNode, depth: number): TemplateResult;
|
|
178
|
-
static styles: import("lit").CSSResult[];
|
|
179
|
-
}
|
|
180
|
-
declare global {
|
|
181
|
-
interface HTMLElementTagNameMap {
|
|
182
|
-
'ixfx-tree-list': TreeListElement;
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
interface TreeListElement {
|
|
186
|
-
addEventListener: (<K extends keyof TreeBaseElementEventMap>(type: K, listener: (this: TreeListElement, event: TreeBaseElementEventMap[K]) => void, options?: boolean | AddEventListenerOptions) => void) & ((type: string, listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions) => void);
|
|
187
|
-
}
|
|
188
|
-
//#endregion
|
|
189
|
-
//#region src/tree/tree-controller.d.ts
|
|
190
|
-
type TreeControllerOptions<T> = {
|
|
191
|
-
valueToItem: (value: T, node: TraversableTree<T>) => TreeItem;
|
|
192
|
-
};
|
|
193
|
-
declare class TreeController<T> {
|
|
194
|
-
#private;
|
|
195
|
-
constructor(root: TraversableTree<T>, element: TreeBaseElement, options: TreeControllerOptions<T>);
|
|
196
|
-
connect(): void;
|
|
197
|
-
disconnect(): void;
|
|
198
|
-
navigateToValue(predicate: (value: T) => boolean): boolean;
|
|
199
|
-
}
|
|
200
|
-
//#endregion
|
|
201
|
-
//#region src/tree/tree-drop-controller.d.ts
|
|
202
|
-
interface TreeDropVisibleRow {
|
|
203
|
-
readonly key: string;
|
|
204
|
-
readonly node: TreeNode;
|
|
205
|
-
readonly depth: number;
|
|
206
|
-
readonly rect: DOMRect;
|
|
207
|
-
}
|
|
208
|
-
/** What a `dragover` / `drop` DataTransfer resolved to for this tree. */
|
|
209
|
-
interface TreeDropResolvedDrag {
|
|
210
|
-
readonly source: `internal` | `external`;
|
|
211
|
-
/** Keys of the dragged nodes (empty for external). */
|
|
212
|
-
readonly keys: readonly string[];
|
|
213
|
-
/** The dragged nodes — live nodes for internal, parsed payload for external. */
|
|
214
|
-
readonly nodes: readonly TreeNode[];
|
|
215
|
-
}
|
|
216
|
-
type TreeDropControllerConfig = {
|
|
217
|
-
getDndMode: () => `none` | `internal` | `external` | `both`;
|
|
218
|
-
getExpandHoverMs: () => number;
|
|
219
|
-
/** Visible rows in display order, each with a fresh viewport rect. Host may cache. */
|
|
220
|
-
getVisibleRows: () => TreeDropVisibleRow[];
|
|
221
|
-
getIndentPx: () => number;
|
|
222
|
-
getScrollContainer: () => HTMLElement | undefined;
|
|
223
|
-
/** True when `key` is `ancestorKey` or a descendant of it. */
|
|
224
|
-
isSelfOrDescendant: (ancestorKey: string, key: string) => boolean;
|
|
225
|
-
/** True when the node is currently expanded in the UI. */
|
|
226
|
-
isExpanded: (key: string) => boolean;
|
|
227
|
-
/**
|
|
228
|
-
* When `false`, an internal drop that would not change any dragged node's
|
|
229
|
-
* parent (pure sibling reorder, or dropping back into the current parent) is
|
|
230
|
-
* rejected outright — no indicator, no `tree-drop`.
|
|
231
|
-
*/
|
|
232
|
-
isReorderAllowed: () => boolean;
|
|
233
|
-
/** Current parent key of `key`, or `undefined` for a root-level node. */
|
|
234
|
-
getParentKey: (key: string) => string | undefined;
|
|
235
|
-
/**
|
|
236
|
-
* Decide whether this DataTransfer is acceptable and resolve the dragged set.
|
|
237
|
-
* `phase` is `hover` during dragenter/dragover (DataTransfer is read-protected —
|
|
238
|
-
* resolve internal drags from the drag registry) and `drop` during drop
|
|
239
|
-
* (getData is readable; external payloads may be parsed here). Return
|
|
240
|
-
* `undefined` to reject (the tree will not become a drop target).
|
|
241
|
-
*/
|
|
242
|
-
resolveDrag: (dataTransfer: DataTransfer, phase: `hover` | `drop`) => TreeDropResolvedDrag | undefined;
|
|
243
|
-
vet: (ctx: TreeDropContext) => boolean;
|
|
244
|
-
expandKey: (key: string) => void;
|
|
245
|
-
/** Fired whenever the resolved drop target changes (undefined = none / rejected). */
|
|
246
|
-
onDropStateChange: (state: TreeDropTarget | undefined) => void;
|
|
247
|
-
/** Fired when a drag enters / leaves this tree. */
|
|
248
|
-
onActiveChange: (active: boolean) => void;
|
|
249
|
-
commitDrop: (detail: TreeDropDetail) => boolean;
|
|
250
|
-
onDragEnd: (dropped: boolean) => void;
|
|
251
|
-
};
|
|
252
|
-
declare class TreeDropController implements ReactiveController {
|
|
253
|
-
#private;
|
|
254
|
-
constructor(host: ReactiveControllerHost & HTMLElement, config: TreeDropControllerConfig);
|
|
255
|
-
/** A drag is currently over this tree. */
|
|
256
|
-
get isDragging(): boolean;
|
|
257
|
-
/** A drag is over this tree but the current position is not a valid drop. */
|
|
258
|
-
get isRejected(): boolean;
|
|
259
|
-
get dropState(): TreeDropTarget | undefined;
|
|
260
|
-
hostConnected(): void;
|
|
261
|
-
/** Bind once the shadow `#container` exists (it does not yet at `hostConnected`). */
|
|
262
|
-
hostUpdated(): void;
|
|
263
|
-
hostDisconnected(): void;
|
|
264
|
-
}
|
|
265
|
-
//#endregion
|
|
266
|
-
export { type LoadChildrenCallback, type TreeActivateDetail, type TreeActivateEvent, TreeBaseElement, TreeBaseElementEventMap, TreeCheckboxState, type TreeCollapseDetail, type TreeCollapseEvent, type TreeComponentEventMap, TreeConfig, TreeController, TreeControllerOptions, TreeDataModel, type TreeDataModelOptions, type TreeDndMode, type TreeDragContext, type TreeDragEndEvent, type TreeDragOverEvent, type TreeDragStartEvent, type TreeDropContext, TreeDropController, TreeDropControllerConfig, type TreeDropDetail, type TreeDropEvent, type TreeDropPosition, TreeDropResolvedDrag, type TreeDropTarget, TreeDropVisibleRow, type TreeExclusivity, type TreeExpandDetail, type TreeExpandEvent, type TreeFilterPredicate, type TreeItem, type TreeItemClickDetail, type TreeItemClickEvent, TreeListElement, type TreeNode, type TreeSelectDetail, type TreeSelectEvent, type TreeSelectionFilter, type TreeTickleDetail, type TreeTickleEvent };
|
|
267
|
-
//# sourceMappingURL=tree.d.ts.map
|
|
1
|
+
import { A as TreeDataModelOptions, D as TreeTickleDetail, E as TreeSelectEvent, O as TreeTickleEvent, T as TreeSelectDetail, _ as TreeDropTarget, b as TreeItemClickDetail, c as TreeDragContext, d as TreeDragStartEvent, g as TreeDropPosition, h as TreeDropEvent, i as TreeCollapseEvent, k as TreeDataModel, l as TreeDragEndEvent, m as TreeDropDetail, n as TreeActivateEvent, o as TreeComponentEventMap, p as TreeDropContext, r as TreeCollapseDetail, s as TreeDndMode, t as TreeActivateDetail, u as TreeDragOverEvent, v as TreeExpandDetail, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-Cj8V3uar.js";
|
|
2
|
+
import { a as TreeItem, n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-DQ7KOUIj.js";
|
|
3
|
+
import { a as TreeDropVisibleRow, c as TreeListElement, d as TreeBaseElementEventMap, f as TreeVirtualize, i as TreeDropRowInfo, l as TreeCheckboxState, n as TreeDropControllerConfig, o as TreeController, p as TreeConfig, r as TreeDropResolvedDrag, s as TreeControllerOptions, t as TreeDropController, u as TreeBaseElement } from "./index-CnQPCywE.js";
|
|
4
|
+
export { type LoadChildrenCallback, type TreeActivateDetail, type TreeActivateEvent, TreeBaseElement, TreeBaseElementEventMap, type TreeCheckboxState, type TreeCollapseDetail, type TreeCollapseEvent, type TreeComponentEventMap, TreeConfig, TreeController, TreeControllerOptions, TreeDataModel, type TreeDataModelOptions, type TreeDndMode, type TreeDragContext, type TreeDragEndEvent, type TreeDragOverEvent, type TreeDragStartEvent, type TreeDropContext, TreeDropController, TreeDropControllerConfig, type TreeDropDetail, type TreeDropEvent, type TreeDropPosition, TreeDropResolvedDrag, TreeDropRowInfo, type TreeDropTarget, TreeDropVisibleRow, type TreeExclusivity, type TreeExpandDetail, type TreeExpandEvent, type TreeFilterPredicate, type TreeItem, type TreeItemClickDetail, type TreeItemClickEvent, TreeListElement, type TreeNode, type TreeSelectDetail, type TreeSelectEvent, type TreeSelectionFilter, type TreeTickleDetail, type TreeTickleEvent, TreeVirtualize };
|
package/dist/tree.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as TreeDataModel, i as TreeDropController, n as TreeListElement, r as TreeBaseElement, t as TreeController } from "./tree-
|
|
1
|
+
import { a as TreeDataModel, i as TreeDropController, n as TreeListElement, r as TreeBaseElement, t as TreeController } from "./tree-DD8OaqsK.js";
|
|
2
2
|
export { TreeBaseElement, TreeController, TreeDataModel, TreeDropController, TreeListElement };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { F as ListDragPreviewSourceResolver, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent } from "./tree-component-Cj8V3uar.js";
|
|
2
2
|
import { n as ListViewportChangeEvent } from "./list-viewport-types-BRZsLcvp.js";
|
|
3
|
-
import { S as ListSearchController } from "./index-
|
|
3
|
+
import { S as ListSearchController } from "./index-Dlah7Zfi.js";
|
|
4
4
|
import { i as ListInteractionMode, l as ListSelectionMode, r as ListElementEventMap } from "./list-selection-types-PjKdhF-a.js";
|
|
5
5
|
import "./editable-label-rzXkjf1H.js";
|
|
6
6
|
import { LitElement, PropertyValues } from "lit";
|
|
@@ -319,6 +319,7 @@ declare class VerticalListElement extends LitElement {
|
|
|
319
319
|
private _onClick;
|
|
320
320
|
private _onDblClick;
|
|
321
321
|
private _activateItem;
|
|
322
|
+
activateKey(key: string): void;
|
|
322
323
|
private _onDragOver;
|
|
323
324
|
private _onDragLeave;
|
|
324
325
|
private _onDrop;
|
|
@@ -358,4 +359,4 @@ interface VerticalListElementEventMap extends ListElementEventMap {
|
|
|
358
359
|
}
|
|
359
360
|
//#endregion
|
|
360
361
|
export { ListContextMenuDetail as a, ListDragLeaveEvent as c, ListDropEvent as d, ListEditCancelDetail as f, ListEditCommitEvent as h, VerticalListElementEventMap as i, ListDragOverEvent as l, ListEditCommitDetail as m, CustomCheckboxOptions as n, ListContextMenuEvent as o, ListEditCancelEvent as p, VerticalListElement as r, ListDragLeaveDetail as s, AddItemOptions as t, ListDropDetail as u };
|
|
361
|
-
//# sourceMappingURL=vertical-list-
|
|
362
|
+
//# sourceMappingURL=vertical-list-lj_19DCx.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertical-list-
|
|
1
|
+
{"version":3,"file":"vertical-list-lj_19DCx.d.ts","names":[],"sources":["../src/vertical-list/types.ts","../src/vertical-list/vertical-list.ts"],"mappings":";;;;;;;;;;;;KAuBY;WACD;WACA,MAAM;WACN,cAAc;;KAGb;WACD;;KAGC;WACD;WACA,MAAM;;WAEN;WACA;;WAEA,cAAc;;KAGb;WACD;WACA;;KAGC;WACD;;KAGC,oBAAoB,YAAY;KAChC,gBAAgB,YAAY;KAC5B,qBAAqB,YAAY;KACjC,uBAAuB,YAAY;KACnC,sBAAsB,YAAY;KAClC,sBAAsB,YAAY;;;UCgC7B;EACf,WAAW;EACX;EACA;;UAGe;;;;;;EAMf;;cAkCW,4BAA4B;;EAEvC,eAAe;EAGf,iBAAiB;EAGjB,mBAAmB,IAAI;;;;;;EAQvB;;;;;;;;;;;;;;;;;;;EAqBA,oBAAoB,gCAAgC;;;;;;EAQpD;;;;;;EAQA;;;;;EAOA,qBAAqB,wBAAwB;EAG7C,mBAAmB,8BAA8B;;;;;;;;;;;EAajD;;;;;EAOA;;;;;;;;;EAWA,aAAa,eAAe;;;;;;;EAS5B,QAAQ,eAAe;;;;;EAOvB,aAAa,eAAe;;;;;EAO5B,aAAa,eAAe;;;;;;EAQ5B,SAAS,eAAe;;;;;;;;;;;;;;;;;;EAoBxB;;;;;;EAQA;;;;;;;;EAUA;;;;;;;EASA,iBAAiB,eAAe;;;;;;EAQhC,WAAW,MAAM,qBAAqB,cAAc;mBAyCnC;UAeT;UAqFA;;WA6EC,QAAM,qBAAA;;MAcX,YAAY;EA2BP;EA0BA;;;;;;YAkCU;EAwDV,QAAQ,SAAS;;MAgFtB,gBAAgB;;MAKhB,iBAAiB,YAAY;EAIjC,QAAQ,MAAM,kBAAkB,UAAU;;;;;;;EA6B1C,WAAW,MAAM,UAAU;;EA2B3B,YAAY,OAAO,SAAS,WAAW;EAIvC;;;;;;EAoBA,SAAS,gBAAgB;;;;;;EA0BzB,SAAS,WAAW,WAAW,OAAO;EAItC,OAAO,MAAM;EAIb,WAAW,OAAO,SAAS;EAI3B,SAAS,MAAM;EAIf;EAIA;;MAQI,gBAAgB;;MAKhB;;EAMJ,WAAW,MAAM;;EAKjB,gBAAgB,MAAM;;EAKtB,mBAAmB,MAAM;;;;;;EASzB,SAAS;;EAkFT,aAAa,cAAc;;;;;;;;EAW3B;;;;;;;EAuBA;EAsBE,eAAe,0CAA0C,UAAU;;;;;EA2CrE,YAAY,MAAM;;;;;;;;;;;EAclB,WAAW,aAAa;UAmjBhB;UAgBA;UAOA;UAmBA;;;;;;;UA4GA;;;;;UAuBA;UAcA;UAYA;UAQA;UAWA;UAMA;UAIA;UAyFA;UAYA;UAQA;EAQR,YAAY;UAWJ;UA2BA;UAOA;UA0CA;;MAuCJ;;;;;;;;;;;;EAmBJ,UAAU;SAiEM,sBAAM;EAuLb,wBAAM;;QAuBT;YACI;IACR,sBAAsB;;YAGd,4BAA4B;;UAGvB,oCAAoC;EACnD,iCAAiC;EACjC,0BAA0B,yBAAyB;EACnD,kBAAkB;EAClB,aAAa;EACb,mBAAmB;EACnB,qBAAqB;EACrB,oBAAoB;EACpB,oBAAoB"}
|
package/dist/vertical-list.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { I as ListDragSource, L as ListNativeDragStartDetail, M as ListDragPreview, N as ListDragPreviewContext, P as ListDragPreviewRenderer, R as ListNativeDragStartEvent, j as ListDragEntry } from "./tree-component-Cj8V3uar.js";
|
|
2
2
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BRZsLcvp.js";
|
|
3
3
|
import { a as ListItemClickDetail, c as ListSelectEvent, d as ListTickleEvent, i as ListInteractionMode, l as ListSelectionMode, n as ListActivateEvent, o as ListItemClickEvent, r as ListElementEventMap, s as ListSelectDetail, t as ListActivateDetail, u as ListTickleDetail } from "./list-selection-types-PjKdhF-a.js";
|
|
4
|
-
import { a as ListContextMenuDetail, c as ListDragLeaveEvent, d as ListDropEvent, f as ListEditCancelDetail, h as ListEditCommitEvent, i as VerticalListElementEventMap, l as ListDragOverEvent, m as ListEditCommitDetail, n as CustomCheckboxOptions, o as ListContextMenuEvent, p as ListEditCancelEvent, r as VerticalListElement, s as ListDragLeaveDetail, t as AddItemOptions, u as ListDropDetail } from "./vertical-list-
|
|
4
|
+
import { a as ListContextMenuDetail, c as ListDragLeaveEvent, d as ListDropEvent, f as ListEditCancelDetail, h as ListEditCommitEvent, i as VerticalListElementEventMap, l as ListDragOverEvent, m as ListEditCommitDetail, n as CustomCheckboxOptions, o as ListContextMenuEvent, p as ListEditCancelEvent, r as VerticalListElement, s as ListDragLeaveDetail, t as AddItemOptions, u as ListDropDetail } from "./vertical-list-lj_19DCx.js";
|
|
5
5
|
export { AddItemOptions, CustomCheckboxOptions, type ListActivateDetail, type ListActivateEvent, type ListContextMenuDetail, type ListContextMenuEvent, type ListDragEntry, type ListDragLeaveDetail, type ListDragLeaveEvent, type ListDragOverEvent, type ListDragPreview, type ListDragPreviewContext, type ListDragPreviewRenderer, type ListDragSource, type ListDropDetail, type ListDropEvent, type ListEditCancelDetail, type ListEditCancelEvent, type ListEditCommitDetail, type ListEditCommitEvent, type ListElementEventMap, type ListInteractionMode, type ListItemClickDetail, type ListItemClickEvent, type ListNativeDragStartDetail, type ListNativeDragStartEvent, type ListSelectDetail, type ListSelectEvent, type ListSelectionMode, type ListTickleDetail, type ListTickleEvent, type ListViewportChangeDetail, type ListViewportChangeEvent, VerticalListElement, VerticalListElementEventMap };
|
package/dist/vertical-list.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as TickledController } from "./tickled-controller-D-HZymaZ.js";
|
|
2
2
|
import { t as themeFallbacks } from "./fallbacks-DQ_5OsmR.js";
|
|
3
3
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
4
|
-
import { c as createElementListSearchAdapter, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-
|
|
4
|
+
import { c as createElementListSearchAdapter, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-JIhwB49y.js";
|
|
5
5
|
import { t as ListNativeDragController } from "./list-native-drag-controller-B9xO0XWn.js";
|
|
6
6
|
import { r as ListDragSelectController, t as ListSelectionController } from "./list-selection-controller-BeE70lbB.js";
|
|
7
7
|
import { n as animateListItemIn, r as animateListItemOut } from "./list-item-animation-BUoEKi5s.js";
|
|
@@ -11,6 +11,7 @@ import "./editable-label.js";
|
|
|
11
11
|
import { LitElement, css, html, render } from "lit";
|
|
12
12
|
import { property } from "lit/decorators.js";
|
|
13
13
|
import { createCommandRegistry } from "@clinth/ui-commands";
|
|
14
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
14
15
|
//#region src/vertical-list/vertical-list.ts
|
|
15
16
|
const ITEM_SELECTOR = `li:not([data-virtual-spacer]), [data-list-item]:not([data-virtual-spacer])`;
|
|
16
17
|
/**
|
|
@@ -75,8 +76,8 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
|
-
this.tickled = new TickledController(
|
|
79
|
-
getItems: () =>
|
|
79
|
+
this.tickled = ((self) => new TickledController(self, {
|
|
80
|
+
getItems: () => self.#selectionOrder().map((el) => ({
|
|
80
81
|
id: el,
|
|
81
82
|
enabled: !el.hasAttribute(`not-checked`)
|
|
82
83
|
})),
|
|
@@ -84,9 +85,11 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
84
85
|
if (id !== void 0) this._dispatch(`list-tickle`, { item: id });
|
|
85
86
|
},
|
|
86
87
|
onStateChange: () => this._syncItemStates(),
|
|
87
|
-
itemWrap
|
|
88
|
+
get itemWrap() {
|
|
89
|
+
return self.itemWrap;
|
|
90
|
+
},
|
|
88
91
|
hoverDisabled: () => this.#dragSelect.isDragging || this.#nativeDrag.isDragging
|
|
89
|
-
});
|
|
92
|
+
}))(this);
|
|
90
93
|
this.#nativeDragging = false;
|
|
91
94
|
this.#postDragSuppressTimer = 0;
|
|
92
95
|
this.#nativeDrag = new ListNativeDragController(this, {
|
|
@@ -118,6 +121,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
118
121
|
this.toggleAttribute(`data-native-dragging`, false);
|
|
119
122
|
this.removeAttribute(`aria-label`);
|
|
120
123
|
for (const el of this._getVisibleItems()) el.removeAttribute(`data-drag-origin`);
|
|
124
|
+
if (this.#virtualActive()) for (const el of this.#allItems) el.removeAttribute(`data-drag-origin`);
|
|
121
125
|
this.#startPostDragSuppressTimer();
|
|
122
126
|
},
|
|
123
127
|
syncLightDomDraggable: () => this._syncNativeDraggable()
|
|
@@ -146,7 +150,9 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
146
150
|
this.search = new ListSearchController(this, { adapter: createElementListSearchAdapter(this, {
|
|
147
151
|
itemSelector: ITEM_SELECTOR,
|
|
148
152
|
getLabel: (el) => el.getAttribute(`data-search-label`) ?? el.textContent?.trim() ?? ``,
|
|
149
|
-
highlightKey: `vertical-list-search
|
|
153
|
+
highlightKey: `vertical-list-search`,
|
|
154
|
+
getAllItems: () => this.#selectionOrder(),
|
|
155
|
+
observeContainer: false
|
|
150
156
|
}) });
|
|
151
157
|
this.#onScroll = () => {
|
|
152
158
|
if (this.#scrollRaf !== 0) return;
|
|
@@ -185,10 +191,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
185
191
|
case `ArrowDown`:
|
|
186
192
|
e.preventDefault();
|
|
187
193
|
this.tickled.handleKeyboardNavigation(`next`);
|
|
188
|
-
this
|
|
189
|
-
block: `nearest`,
|
|
190
|
-
inline: `nearest`
|
|
191
|
-
});
|
|
194
|
+
this.#revealCursor();
|
|
192
195
|
if (e.shiftKey && this.interactionMode === `vscode`) {
|
|
193
196
|
const cur = this.tickled.tickledId;
|
|
194
197
|
if (cur) this.selection.rangeTo(cur);
|
|
@@ -197,15 +200,30 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
197
200
|
case `ArrowUp`:
|
|
198
201
|
e.preventDefault();
|
|
199
202
|
this.tickled.handleKeyboardNavigation(`previous`);
|
|
200
|
-
this
|
|
201
|
-
block: `nearest`,
|
|
202
|
-
inline: `nearest`
|
|
203
|
-
});
|
|
203
|
+
this.#revealCursor();
|
|
204
204
|
if (e.shiftKey && this.interactionMode === `vscode`) {
|
|
205
205
|
const cur = this.tickled.tickledId;
|
|
206
206
|
if (cur) this.selection.rangeTo(cur);
|
|
207
207
|
}
|
|
208
208
|
break;
|
|
209
|
+
case `Home`:
|
|
210
|
+
e.preventDefault();
|
|
211
|
+
this.tickled.handleKeyboardNavigation(`first`);
|
|
212
|
+
this.#revealCursor();
|
|
213
|
+
break;
|
|
214
|
+
case `End`:
|
|
215
|
+
e.preventDefault();
|
|
216
|
+
this.tickled.handleKeyboardNavigation(`last`);
|
|
217
|
+
this.#revealCursor();
|
|
218
|
+
break;
|
|
219
|
+
case `PageDown`:
|
|
220
|
+
e.preventDefault();
|
|
221
|
+
this.#handlePage(1);
|
|
222
|
+
break;
|
|
223
|
+
case `PageUp`:
|
|
224
|
+
e.preventDefault();
|
|
225
|
+
this.#handlePage(-1);
|
|
226
|
+
break;
|
|
209
227
|
case `Enter`: {
|
|
210
228
|
const id = this.tickled.tickledId;
|
|
211
229
|
if (id) {
|
|
@@ -327,16 +345,17 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
327
345
|
#postDragSuppressTimer;
|
|
328
346
|
#nativeDrag;
|
|
329
347
|
#prepareNativeDrag(originKey) {
|
|
330
|
-
const
|
|
331
|
-
const originEl = visible.find((el) => keyForElement(el) === originKey);
|
|
348
|
+
const originEl = this.#itemForKey(originKey);
|
|
332
349
|
if (!originEl || !this._isCheckable(originEl)) return void 0;
|
|
333
350
|
if (!this.selection.selected.has(originEl)) this.selection.replace(originEl);
|
|
351
|
+
const ordered = this.#selectionOrder();
|
|
334
352
|
const selected = [];
|
|
335
|
-
|
|
353
|
+
ordered.forEach((el) => {
|
|
336
354
|
if (!this.selection.selected.has(el)) return;
|
|
355
|
+
const idx = this.#registryIndexOf(el);
|
|
337
356
|
selected.push({
|
|
338
357
|
key: keyForElement(el) ?? originKey,
|
|
339
|
-
index,
|
|
358
|
+
index: idx,
|
|
340
359
|
item: el,
|
|
341
360
|
element: el
|
|
342
361
|
});
|
|
@@ -563,6 +582,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
563
582
|
return;
|
|
564
583
|
}
|
|
565
584
|
if (this.interactionMode === `checked`) this._syncCheckboxes();
|
|
585
|
+
this.search.refresh();
|
|
566
586
|
}
|
|
567
587
|
/**
|
|
568
588
|
* Collapse + fade `item` out, then detach it. The rows below slide up to
|
|
@@ -599,6 +619,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
599
619
|
this.replaceChildren();
|
|
600
620
|
this.selection.reset();
|
|
601
621
|
this._syncItemStates();
|
|
622
|
+
this.search.refresh();
|
|
602
623
|
if (this.#virtualActive()) this.#syncVirtualWindow(true);
|
|
603
624
|
}
|
|
604
625
|
/**
|
|
@@ -614,11 +635,13 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
614
635
|
this.#allItems = [...items];
|
|
615
636
|
for (const el of this.#allItems) this.#animatedItems.add(el);
|
|
616
637
|
this.selection.reset();
|
|
638
|
+
this.search.refresh();
|
|
617
639
|
this.#syncVirtualWindow(true);
|
|
618
640
|
return;
|
|
619
641
|
}
|
|
620
642
|
for (const item of items) this.appendChild(item);
|
|
621
643
|
if (this.interactionMode === `checked`) this._syncCheckboxes();
|
|
644
|
+
this.search.refresh();
|
|
622
645
|
}
|
|
623
646
|
/**
|
|
624
647
|
* Dispatch a command to this list — used by `ixfx-grouped-item-lister` to
|
|
@@ -675,7 +698,16 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
675
698
|
if (index < 0) return;
|
|
676
699
|
const ul = this.renderRoot.querySelector(`ul`);
|
|
677
700
|
if (ul) {
|
|
678
|
-
|
|
701
|
+
const stride = this.itemHeight;
|
|
702
|
+
const viewportH = ul.clientHeight;
|
|
703
|
+
const top = index * stride;
|
|
704
|
+
const bottom = (index + 1) * stride;
|
|
705
|
+
const vt = ul.scrollTop;
|
|
706
|
+
const vh = viewportH;
|
|
707
|
+
let next = vt;
|
|
708
|
+
if (top < vt) next = top;
|
|
709
|
+
else if (bottom > vt + vh) next = bottom - vh;
|
|
710
|
+
if (next !== vt) ul.scrollTop = next;
|
|
679
711
|
this.#syncVirtualWindow(true);
|
|
680
712
|
}
|
|
681
713
|
}
|
|
@@ -687,6 +719,33 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
687
719
|
inline: `nearest`
|
|
688
720
|
});
|
|
689
721
|
}
|
|
722
|
+
#revealCursor() {
|
|
723
|
+
const el = this.tickled.tickledId;
|
|
724
|
+
const key = el ? keyForElement(el) : void 0;
|
|
725
|
+
if (key !== void 0) this.focusKey(key);
|
|
726
|
+
}
|
|
727
|
+
#pageSize() {
|
|
728
|
+
const ul = this.#scrollList();
|
|
729
|
+
if (!ul) return 1;
|
|
730
|
+
const viewportH = ul.clientHeight;
|
|
731
|
+
if (this.#virtualActive()) return Math.max(1, Math.floor(viewportH / this.itemHeight));
|
|
732
|
+
const first = this.querySelector(`li[data-key]`);
|
|
733
|
+
if (!first) return 1;
|
|
734
|
+
const firstH = first.offsetHeight || this.itemHeight;
|
|
735
|
+
return Math.max(1, Math.floor(viewportH / firstH));
|
|
736
|
+
}
|
|
737
|
+
/** Move the cursor one page up (-1) or down (1) across the whole registry. */
|
|
738
|
+
#handlePage(direction) {
|
|
739
|
+
const page = this.#pageSize();
|
|
740
|
+
const items = this.#selectionOrder().filter((el) => !el.hasAttribute(`not-checked`));
|
|
741
|
+
if (items.length === 0) return;
|
|
742
|
+
const currentKey = this.tickled.tickledId ? keyForElement(this.tickled.tickledId) : void 0;
|
|
743
|
+
const currentIdx = currentKey !== void 0 ? items.findIndex((i) => keyForElement(i) === currentKey) : -1;
|
|
744
|
+
const fallback = direction === 1 ? page - 1 : 0;
|
|
745
|
+
const nextIdx = currentIdx < 0 ? fallback : currentIdx + direction * page;
|
|
746
|
+
this.tickled.handleKeyboardNavigation(items[Math.min(items.length - 1, Math.max(0, nextIdx))]);
|
|
747
|
+
this.#revealCursor();
|
|
748
|
+
}
|
|
690
749
|
#itemForKey(key) {
|
|
691
750
|
if (this.#virtualActive()) return this.#allItems.find((el) => keyForElement(el) === key);
|
|
692
751
|
for (const el of this.querySelectorAll(ITEM_SELECTOR)) {
|
|
@@ -1035,6 +1094,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1035
1094
|
else this.#pendingAnimate.push(...fresh);
|
|
1036
1095
|
}
|
|
1037
1096
|
if (changed && this.interactionMode === `checked`) this._syncCheckboxes();
|
|
1097
|
+
if (changed) this.search.refresh();
|
|
1038
1098
|
return changed;
|
|
1039
1099
|
}
|
|
1040
1100
|
/** Consume queued observer records first so a sync never drops a row. */
|
|
@@ -1112,9 +1172,10 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1112
1172
|
this.#windowEnd = end;
|
|
1113
1173
|
if (this.interactionMode === `checked`) this._syncCheckboxes();
|
|
1114
1174
|
this._syncItemStates();
|
|
1175
|
+
const totalCount = this.#selectionOrder().length;
|
|
1115
1176
|
for (let i = start; i < end; i++) {
|
|
1116
1177
|
const el = this.#allItems[i];
|
|
1117
|
-
if (el) this.#applyRowState(el);
|
|
1178
|
+
if (el) this.#applyRowState(el, i + 1, totalCount);
|
|
1118
1179
|
}
|
|
1119
1180
|
const pending = this.#pendingAnimate;
|
|
1120
1181
|
this.#pendingAnimate = [];
|
|
@@ -1122,12 +1183,25 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1122
1183
|
this.#animatedItems.add(el);
|
|
1123
1184
|
if (el.parentNode === this) animateListItemIn(el);
|
|
1124
1185
|
}
|
|
1186
|
+
this.search.repaintHighlights();
|
|
1125
1187
|
}
|
|
1126
1188
|
/** Per-attach state the attached sweep can't cover (it only sees the window). */
|
|
1127
|
-
#applyRowState(el) {
|
|
1128
|
-
if (el instanceof HTMLElement)
|
|
1189
|
+
#applyRowState(el, posInSet, setSize) {
|
|
1190
|
+
if (el instanceof HTMLElement) {
|
|
1191
|
+
el.draggable = this.itemsDraggable && this._isCheckable(el) && !el.hasAttribute(`data-editing`);
|
|
1192
|
+
if (posInSet !== void 0 && setSize !== void 0) {
|
|
1193
|
+
el.setAttribute(`aria-setsize`, String(setSize));
|
|
1194
|
+
el.setAttribute(`aria-posinset`, String(posInSet));
|
|
1195
|
+
if (!el.hasAttribute(`role`) || el.hasAttribute(`data-aria-role`)) {
|
|
1196
|
+
el.setAttribute(`role`, `option`);
|
|
1197
|
+
el.setAttribute(`data-aria-role`, ``);
|
|
1198
|
+
el.setAttribute(`aria-selected`, String(this.selection.selected.has(el)));
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
}
|
|
1129
1202
|
el.removeAttribute(`data-marquee`);
|
|
1130
1203
|
el.removeAttribute(`data-drag-origin`);
|
|
1204
|
+
el.removeAttribute(`data-drop-target`);
|
|
1131
1205
|
}
|
|
1132
1206
|
/**
|
|
1133
1207
|
* Leave virtualization: reattach every registry row in order and drop the
|
|
@@ -1192,6 +1266,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1192
1266
|
const item = this.#customWrappers.get(el) ?? el;
|
|
1193
1267
|
el.toggleAttribute(`data-tickled`, this.tickled.isTickled(el));
|
|
1194
1268
|
el.toggleAttribute(`data-selected`, this.selection.selected.has(el));
|
|
1269
|
+
if (el.hasAttribute(`data-aria-role`)) el.setAttribute(`aria-selected`, String(this.selection.selected.has(el)));
|
|
1195
1270
|
if (this.interactionMode === `checked`) el.toggleAttribute(`data-checked`, !item.hasAttribute(`not-checked`) && this.selection.selected.has(el));
|
|
1196
1271
|
else el.removeAttribute(`data-checked`);
|
|
1197
1272
|
}
|
|
@@ -1335,6 +1410,10 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1335
1410
|
if (this.interactionMode !== `manual`) this.selection.replace(item);
|
|
1336
1411
|
this._dispatch(`list-activate`, { item });
|
|
1337
1412
|
}
|
|
1413
|
+
activateKey(key) {
|
|
1414
|
+
const item = this.#itemForKey(key);
|
|
1415
|
+
if (item) this._activateItem(item);
|
|
1416
|
+
}
|
|
1338
1417
|
/** The row (or `undefined` for empty space) the last `list-drag-over` was fired for. */
|
|
1339
1418
|
#dragOver;
|
|
1340
1419
|
/** Tell the consumer the drag left its last target and drop the highlight. */
|
|
@@ -1344,9 +1423,11 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1344
1423
|
this.#highlightDropTarget(void 0, false);
|
|
1345
1424
|
if (last) this._dispatch(`list-drag-leave`, { key: last.item ? keyForElement(last.item) : void 0 });
|
|
1346
1425
|
}
|
|
1426
|
+
#dropTargetEl;
|
|
1347
1427
|
/** Mark one row (or, for empty space, the host) as the drop target. */
|
|
1348
1428
|
#highlightDropTarget(item, active) {
|
|
1349
|
-
|
|
1429
|
+
this.#dropTargetEl?.removeAttribute(`data-drop-target`);
|
|
1430
|
+
this.#dropTargetEl = active ? item : void 0;
|
|
1350
1431
|
this.toggleAttribute(`data-drop-target`, active && item === void 0);
|
|
1351
1432
|
if (active && item) item.setAttribute(`data-drop-target`, ``);
|
|
1352
1433
|
}
|
|
@@ -1631,9 +1712,17 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1631
1712
|
];
|
|
1632
1713
|
}
|
|
1633
1714
|
render() {
|
|
1715
|
+
const role = this.getAttribute(`role`) ? void 0 : `listbox`;
|
|
1716
|
+
const ariaMulti = this.selectionMode === `multiple`;
|
|
1634
1717
|
return html`
|
|
1635
1718
|
<div class="container">
|
|
1636
|
-
<ul
|
|
1719
|
+
<ul
|
|
1720
|
+
part="list"
|
|
1721
|
+
class="scroll-fade-y"
|
|
1722
|
+
role=${ifDefined(role)}
|
|
1723
|
+
aria-multiselectable=${ariaMulti ? `true` : `false`}
|
|
1724
|
+
@scroll=${this.#onScroll}
|
|
1725
|
+
>
|
|
1637
1726
|
<slot></slot>
|
|
1638
1727
|
</ul>
|
|
1639
1728
|
${this.#marqueeRect ? html`<div class="marquee" part="marquee" style=${this.#marqueeStyle(this.#marqueeRect)}></div>` : ``}
|