@ixfx/components 0.17.1 → 0.18.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 +351 -11
- package/bundle/index.js +402 -361
- package/dist/ac-text.js +1 -1
- package/dist/ac-token.js +2 -2
- package/dist/{checked-select-BmwqpgGr.js → checked-select-CC-qSO1P.js} +2 -2
- package/dist/checked-select.js +1 -1
- package/dist/{crumb-navigation-D7dAC0H-.js → crumb-navigation-C78edQGt.js} +3 -3
- package/dist/{crumb-navigation-Tm4fnsvN.d.ts → crumb-navigation-DOfOS7li.d.ts} +1 -1
- package/dist/crumbs.d.ts +1 -1
- package/dist/crumbs.js +1 -1
- package/dist/{data-grid-vasJtjFP.d.ts → data-grid-BYMZZbNc.d.ts} +32 -3
- package/dist/{data-grid-BcO3SMac.js → data-grid-CJrbLzLr.js} +80 -18
- package/dist/data-grid.d.ts +2 -2
- package/dist/data-grid.js +1 -1
- package/dist/{detail-list-E9WdMVbE.d.ts → detail-list-CBgnKkEm.d.ts} +35 -3
- package/dist/{detail-list-vPVwE1CP.js → detail-list-Dk9oSvAZ.js} +75 -10
- package/dist/detail-list.d.ts +3 -3
- package/dist/detail-list.js +1 -1
- package/dist/{flat-list-CfutGqKY.d.ts → flat-list-D5glF_vD.d.ts} +5 -3
- package/dist/flat-list.d.ts +1 -1
- package/dist/flat-list.js +5 -3
- package/dist/{grid-list-D2hinM64.js → grid-list-0wC2xGBS.js} +104 -14
- package/dist/{grid-list-OCdjuhng.d.ts → grid-list-B3T_2N0N.d.ts} +34 -4
- package/dist/grid-list.d.ts +2 -2
- package/dist/grid-list.js +1 -1
- package/dist/{incr-search-C5114RxZ.js → incr-search-Bk4acsCM.js} +14 -6
- package/dist/incr-search.d.ts +1 -1
- package/dist/incr-search.js +1 -1
- package/dist/{index-88ra6YHP.d.ts → index-BIv_Hu7C.d.ts} +4 -4
- package/dist/{index-CRLTVAyt.d.ts → index-BuvySJEc.d.ts} +5 -1
- package/dist/{index-CzhYJJsx.d.ts → index-fhZCKSY6.d.ts} +3 -3
- package/dist/index.d.ts +134 -26
- package/dist/index.js +479 -130
- package/dist/interaction-DNuFnTm0.js +3 -0
- package/dist/item-tags-Dz-jQq-4.d.ts +65 -0
- package/dist/{list-native-drag-controller-ByftBooJ.js → list-native-drag-controller-B_INa6_G.js} +109 -1
- package/dist/{list-native-drag-controller-CgXKdmjr.d.ts → list-native-drag-controller-Cs-Tmtaa.d.ts} +1 -1
- package/dist/{menu-C3DhTjHx.js → menu-CgT60B3-.js} +3 -3
- package/dist/{menu-item-BSxhlWnW.js → menu-item-CbywH4Xo.js} +3 -3
- package/dist/menu.js +2 -2
- package/dist/{miller-DqDEaXqT.js → miller-Dyv4UM7k.js} +3 -3
- package/dist/miller.d.ts +2 -2
- package/dist/miller.js +1 -1
- package/dist/narrowed-text.js +3 -3
- package/dist/{node-graph-DqEGv5QR.js → node-graph-yrbOLbYo.js} +1 -1
- package/dist/node-graph.js +1 -1
- package/dist/{notification-pill-BiHEJk-o.d.ts → notification-pill-BJonE_wo.d.ts} +14 -1
- package/dist/notifier.d.ts +1 -1
- package/dist/select-horiz.js +2 -2
- package/dist/sunburst-tree.d.ts +1 -1
- package/dist/sunburst-tree.js +1 -1
- package/dist/{sunbursttree-list-C-FuZB5z.js → sunbursttree-list-CJdznPzN.js} +2 -2
- package/dist/{sunbursttree-list-CsrmVSB8.d.ts → sunbursttree-list-CmydFG66.d.ts} +2 -2
- package/dist/{tickled-controller-BVhGKzjZ.js → tickled-controller-BsFFr_1N.js} +1 -1
- package/dist/{tickled-controller-DSPoG551.d.ts → tickled-controller-Dz0UqwlQ.d.ts} +5 -0
- package/dist/{tree-BP5fxvEX.js → tree-C3rgEEmm.js} +4 -4
- package/dist/{tree-component-DNuzfo6R.d.ts → tree-component-BE7OEIiH.d.ts} +7 -1
- package/dist/tree.d.ts +2 -2
- package/dist/tree.js +1 -1
- package/dist/{vertical-list-B9z1lbjM.js → vertical-list-By-yuhkw.js} +61 -6
- package/dist/{vertical-list-BzeXehBt.d.ts → vertical-list-C4z3La0C.d.ts} +26 -2
- package/dist/vertical-list.d.ts +2 -2
- package/dist/vertical-list.js +1 -1
- package/docs-user/README.md +1 -0
- package/docs-user/button.md +31 -1
- package/docs-user/data-grid.md +3 -0
- package/docs-user/detail-list.md +3 -0
- package/docs-user/grid-list.md +8 -0
- package/docs-user/index.json +6 -2
- package/docs-user/llms.txt +1 -0
- package/docs-user/multicol-list.md +3 -0
- package/docs-user/notifier.md +28 -0
- package/docs-user/user-item-tags.md +68 -0
- package/llms.txt +1 -0
- package/package.json +3 -3
- package/dist/interaction-8Kbbf6xN.js +0 -3
package/dist/ac-text.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as clearHighlights, t as applyHighlights } from "./highlight-noLHFSKZ.js";
|
|
2
|
-
import { t as TickledController } from "./tickled-controller-
|
|
2
|
+
import { t as TickledController } from "./tickled-controller-BsFFr_1N.js";
|
|
3
3
|
import { n as tickledStyles } from "./tickled-styles-pnieYweS.js";
|
|
4
4
|
import { t as themeFallbacks } from "./fallbacks-BPjjBoED.js";
|
|
5
5
|
import { t as popupSurfaceStyles } from "./popup-D8IxN1Eq.js";
|
package/dist/ac-token.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { t as DataController } from "./data-controller-q-rXRMzJ.js";
|
|
2
|
-
import { h as createAcCompletionProvider } from "./incr-search-
|
|
3
|
-
import { t as TickledController } from "./tickled-controller-
|
|
2
|
+
import { h as createAcCompletionProvider } from "./incr-search-Bk4acsCM.js";
|
|
3
|
+
import { t as TickledController } from "./tickled-controller-BsFFr_1N.js";
|
|
4
4
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-pnieYweS.js";
|
|
5
5
|
import { t as themeFallbacks } from "./fallbacks-BPjjBoED.js";
|
|
6
6
|
import { n as safeCustomElement, t as __decorate } from "./decorate-Dxs8sFX8.js";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as TickledController } from "./tickled-controller-
|
|
1
|
+
import { t as TickledController } from "./tickled-controller-BsFFr_1N.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-pnieYweS.js";
|
|
3
|
-
import "./interaction-
|
|
3
|
+
import "./interaction-DNuFnTm0.js";
|
|
4
4
|
import { t as themeFallbacks } from "./fallbacks-BPjjBoED.js";
|
|
5
5
|
import { t as handleStyles } from "./handle-BVUWv97X.js";
|
|
6
6
|
import { n as safeCustomElement, t as __decorate } from "./decorate-Dxs8sFX8.js";
|
package/dist/checked-select.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import "./checkbox.js";
|
|
2
|
-
export { t as CheckedSelect } from "./checked-select-
|
|
2
|
+
export { t as CheckedSelect } from "./checked-select-CC-qSO1P.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as TickledController } from "./tickled-controller-
|
|
1
|
+
import { t as TickledController } from "./tickled-controller-BsFFr_1N.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-pnieYweS.js";
|
|
3
3
|
import { t as collectDataResult } from "./data-provider-C6ZNAcaT.js";
|
|
4
|
-
import "./interaction-
|
|
4
|
+
import "./interaction-DNuFnTm0.js";
|
|
5
5
|
import { t as themeFallbacks } from "./fallbacks-BPjjBoED.js";
|
|
6
6
|
import { t as scrollFadeStyles } from "./scroll-fade-DH8OXSqL.js";
|
|
7
7
|
import { n as safeCustomElement, t as __decorate } from "./decorate-Dxs8sFX8.js";
|
|
8
|
-
import "./menu-item-
|
|
8
|
+
import "./menu-item-CbywH4Xo.js";
|
|
9
9
|
import { t as ViewStateController } from "./view-state-controller-DiPAPiA7.js";
|
|
10
10
|
import "./narrowed-text.js";
|
|
11
11
|
import { LitElement, css, html, nothing } from "lit";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { M as TreeDataModel, a as TreeComponent, j as TreeTickleEvent, k as TreeSelectEvent, n as TreeActivateEvent, o as TreeComponentEventMap, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-
|
|
1
|
+
import { M as TreeDataModel, a as TreeComponent, j as TreeTickleEvent, k as TreeSelectEvent, n as TreeActivateEvent, o as TreeComponentEventMap, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-BE7OEIiH.js";
|
|
2
2
|
import { n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-6hpXRKt7.js";
|
|
3
3
|
import { a as ViewStateBase, t as GetViewStateOptions } from "./types-16GC5k1z.js";
|
|
4
4
|
import "./index-Cdcek1Oj.js";
|
package/dist/crumbs.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as CrumbNavigationExpandDetail, c as CrumbNavigationItemClickEvent, i as CrumbNavigationElementEventMap, l as CrumbNavigationViewState, n as CrumbNavigationChangeEvent, o as CrumbNavigationExpandEvent, r as CrumbNavigationElement, s as CrumbNavigationItemClickDetail, t as CrumbNavigationChangeDetail } from "./crumb-navigation-
|
|
1
|
+
import { a as CrumbNavigationExpandDetail, c as CrumbNavigationItemClickEvent, i as CrumbNavigationElementEventMap, l as CrumbNavigationViewState, n as CrumbNavigationChangeEvent, o as CrumbNavigationExpandEvent, r as CrumbNavigationElement, s as CrumbNavigationItemClickDetail, t as CrumbNavigationChangeDetail } from "./crumb-navigation-DOfOS7li.js";
|
|
2
2
|
export { CrumbNavigationChangeDetail, CrumbNavigationChangeEvent, CrumbNavigationElement, CrumbNavigationElementEventMap, CrumbNavigationExpandDetail, CrumbNavigationExpandEvent, CrumbNavigationItemClickDetail, CrumbNavigationItemClickEvent, type CrumbNavigationViewState };
|
package/dist/crumbs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { t as CrumbNavigationElement } from "./crumb-navigation-
|
|
1
|
+
export { t as CrumbNavigationElement } from "./crumb-navigation-C78edQGt.js";
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { i as ItemTagKeys, n as ItemTagBehaviour } from "./item-tags-Dz-jQq-4.js";
|
|
2
|
+
import { H as ListNativeDragStartEvent, P as ListDragDataTransferWriter, R as ListDragPreviewRenderer, z as ListDragPreviewSourceResolver } from "./tree-component-BE7OEIiH.js";
|
|
3
3
|
import { a as ViewStateBase, t as GetViewStateOptions } from "./types-16GC5k1z.js";
|
|
4
|
+
import { m as ListSelectKeysDetail, u as ListSelectIntentDetail } from "./list-selection-types-CKTt7Rrw.js";
|
|
4
5
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BJ8c6qur.js";
|
|
5
6
|
import "./index-Cdcek1Oj.js";
|
|
6
|
-
import { S as ListSearchController } from "./index-
|
|
7
|
+
import { S as ListSearchController } from "./index-BuvySJEc.js";
|
|
7
8
|
import "./icon-Bhz0c6Yf.js";
|
|
8
9
|
import "./index-0smh4WCH.js";
|
|
9
10
|
import "./pan-text-DKe2zinH.js";
|
|
@@ -273,6 +274,12 @@ declare class DataGridElement extends LitElement {
|
|
|
273
274
|
* built-in HTML+canvas preview.
|
|
274
275
|
*/
|
|
275
276
|
dragPreviewRenderer: ListDragPreviewRenderer<unknown> | undefined;
|
|
277
|
+
/**
|
|
278
|
+
* Write an application payload onto the drag's `DataTransfer` (e.g. a custom
|
|
279
|
+
* MIME type). Called once per drag, synchronously inside `dragstart`, after a
|
|
280
|
+
* non-cancelled `list-native-drag-start`.
|
|
281
|
+
*/
|
|
282
|
+
writeDataTransfer: ListDragDataTransferWriter<unknown> | undefined;
|
|
276
283
|
dragPreviewSource: ListDragPreviewSourceResolver<unknown> | undefined;
|
|
277
284
|
/**
|
|
278
285
|
* Default icon name for column header buttons. Defaults to `ellipsis`.
|
|
@@ -356,6 +363,28 @@ declare class DataGridElement extends LitElement {
|
|
|
356
363
|
*/
|
|
357
364
|
get partialKeys(): ReadonlySet<string>;
|
|
358
365
|
set partialKeys(keys: Iterable<string>);
|
|
366
|
+
/**
|
|
367
|
+
* Caller-assigned tags for a row (`undefined` ⇒ none). Each tag is exposed on
|
|
368
|
+
* the row as a `tag-<name>` `part` token (`::part(item tag-foo)`) and in
|
|
369
|
+
* `data-tags` (`[data-tags~="foo"]`); `tagBehaviour` can switch off selection,
|
|
370
|
+
* focus, drag or search per tag. `index` is the row's position in the sorted
|
|
371
|
+
* order. Re-read on every render; call {@link refreshTags} after mutating
|
|
372
|
+
* data the hook reads.
|
|
373
|
+
*/
|
|
374
|
+
tags: ((row: unknown, index: number) => readonly string[] | undefined) | undefined;
|
|
375
|
+
/** Tags by row key, apart from the row data (like {@link partialKeys}): tag name → keys. Merged with the `tags` hook. */
|
|
376
|
+
get tagKeys(): ItemTagKeys | undefined;
|
|
377
|
+
set tagKeys(value: ItemTagKeys | undefined);
|
|
378
|
+
/**
|
|
379
|
+
* Interaction flags per tag name: `selectable`, `focusable`, `draggable`,
|
|
380
|
+
* `searchable` (`false` switches one off; omitted keeps the default). With
|
|
381
|
+
* several tags the most restrictive wins. Rows stay rendered and keep their
|
|
382
|
+
* place in layout and scroll.
|
|
383
|
+
*/
|
|
384
|
+
get tagBehaviour(): ItemTagBehaviour | undefined;
|
|
385
|
+
set tagBehaviour(value: ItemTagBehaviour | undefined);
|
|
386
|
+
/** Re-evaluate tags and re-render (the `tags` hook is read live; this drops cached cursor state). */
|
|
387
|
+
refreshTags(): void;
|
|
359
388
|
/** Replace the selection with these row keys (clamped to known rows). */
|
|
360
389
|
set selectedKeys(keys: Iterable<string>);
|
|
361
390
|
/**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { t as TickledController } from "./tickled-controller-
|
|
1
|
+
import { t as TickledController } from "./tickled-controller-BsFFr_1N.js";
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-pnieYweS.js";
|
|
3
3
|
import { n as appearanceColor, t as appearanceAbsent } from "./item-appearance-FRO3TRFI.js";
|
|
4
|
-
import { i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES } from "./incr-search-
|
|
5
|
-
import "./interaction-
|
|
6
|
-
import { a as listItemFadeKeyframes, t as ListNativeDragController } from "./list-native-drag-controller-
|
|
4
|
+
import { i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES } from "./incr-search-Bk4acsCM.js";
|
|
5
|
+
import "./interaction-DNuFnTm0.js";
|
|
6
|
+
import { a as listItemFadeKeyframes, d as ItemTagResolver, g as sameTagKeys, t as ListNativeDragController, v as tagPartTokens, y as tagsAttribute } from "./list-native-drag-controller-B_INa6_G.js";
|
|
7
7
|
import { i as sameKeySet, r as isPartialKey, t as PARTIAL_DESCRIPTION } from "./partial-keys-D4l_ede_.js";
|
|
8
8
|
import { t as themeFallbacks } from "./fallbacks-BPjjBoED.js";
|
|
9
9
|
import { a as capKeys, l as keysToArray, n as EMPTY_KEYS, o as flagsFromRecord, r as MAX_PENDING_KEYS } from "./pending-Afl4LT64.js";
|
|
@@ -13,12 +13,13 @@ import { n as safeCustomElement, t as __decorate } from "./decorate-Dxs8sFX8.js"
|
|
|
13
13
|
import { n as anchorFromRow, o as scrollToOffset, t as ViewStateController } from "./view-state-controller-DiPAPiA7.js";
|
|
14
14
|
import { t as createDragGhost } from "./drag-ghost-DNWu_RyN.js";
|
|
15
15
|
import "./icon-DvTQuylG.js";
|
|
16
|
-
import "./menu-
|
|
16
|
+
import "./menu-CgT60B3-.js";
|
|
17
17
|
import "./pan-text-DrJYKQKN.js";
|
|
18
18
|
import { LitElement, css, html, nothing } from "lit";
|
|
19
19
|
import { property, query, state } from "lit/decorators.js";
|
|
20
20
|
import { createCommandRegistry } from "@clinth/ui-commands";
|
|
21
21
|
import { repeat } from "lit/directives/repeat.js";
|
|
22
|
+
import { ifDefined } from "lit/directives/if-defined.js";
|
|
22
23
|
// src/data-grid/data-grid-view-state.ts
|
|
23
24
|
const EMPTY_COLUMNS = /* @__PURE__ */ new Map();
|
|
24
25
|
const EMPTY_ORDER = /* @__PURE__ */ new Map();
|
|
@@ -317,10 +318,18 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
317
318
|
this._lastClickedCell = null;
|
|
318
319
|
this._editValue = ``;
|
|
319
320
|
this._tickled = new TickledController(this, {
|
|
320
|
-
getItems: () => this.#tickledItems ??= this._flat.map((f) =>
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
321
|
+
getItems: () => this.#tickledItems ??= this._flat.map((f) => {
|
|
322
|
+
if (f.type !== `row`) return {
|
|
323
|
+
id: f.key,
|
|
324
|
+
enabled: false
|
|
325
|
+
};
|
|
326
|
+
const flags = this.#flagsForEntry(f);
|
|
327
|
+
return {
|
|
328
|
+
id: f.key,
|
|
329
|
+
enabled: flags.selectable,
|
|
330
|
+
focusable: flags.focusable
|
|
331
|
+
};
|
|
332
|
+
}),
|
|
324
333
|
onStateChange: () => this.requestUpdate(),
|
|
325
334
|
hoverDisabled: () => this.#nativeDrag.isDragging
|
|
326
335
|
});
|
|
@@ -417,6 +426,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
417
426
|
});
|
|
418
427
|
};
|
|
419
428
|
this._partialKeys = /* @__PURE__ */ new Set();
|
|
429
|
+
this.#tagResolver = new ItemTagResolver();
|
|
420
430
|
this._onKeyDown = (e) => {
|
|
421
431
|
const before = this._tickled.tickledId;
|
|
422
432
|
this.#handleKeyDown(e);
|
|
@@ -657,7 +667,8 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
657
667
|
#nativeDrag;
|
|
658
668
|
#prepareNativeDrag(originKey) {
|
|
659
669
|
const rows = this._flat.filter((f) => f.type === `row`);
|
|
660
|
-
|
|
670
|
+
const originEntry = rows.find((f) => f.key === originKey);
|
|
671
|
+
if (!originEntry || !this.#flagsForEntry(originEntry).draggable || !this.#flagsForEntry(originEntry).selectable) return void 0;
|
|
661
672
|
if (!this._selectedKeys.has(originKey)) this._replaceSelection(originKey);
|
|
662
673
|
const selected = [];
|
|
663
674
|
let displayIndex = 0;
|
|
@@ -719,7 +730,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
719
730
|
getItems: () => {
|
|
720
731
|
this.#searchKeyByRow.clear();
|
|
721
732
|
this._sortedRows.forEach((r, i) => this.#searchKeyByRow.set(r, this.getRowKey(r, i)));
|
|
722
|
-
return this._sortedRows;
|
|
733
|
+
return this.tagBehaviour === void 0 ? this._sortedRows : this._sortedRows.filter((r, i) => this.#flagsFor(this.#searchKeyByRow.get(r), r, i).searchable);
|
|
723
734
|
},
|
|
724
735
|
getLabel: (row) => this.#rowSearchText(row),
|
|
725
736
|
getKey: (row) => this.#searchKeyByRow.get(row) ?? String(this._sortedRows.indexOf(row)),
|
|
@@ -1170,7 +1181,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1170
1181
|
}
|
|
1171
1182
|
/** Select only `key`. In `manual` mode (or when cancelled) only the anchor moves. */
|
|
1172
1183
|
#requestReplace(key, source) {
|
|
1173
|
-
if (this.selectionMode === `none`) return;
|
|
1184
|
+
if (this.selectionMode === `none` || !this.#canSelectKey(key)) return;
|
|
1174
1185
|
if (this.#intercepted({
|
|
1175
1186
|
kind: `replace`,
|
|
1176
1187
|
keys: [key],
|
|
@@ -1183,6 +1194,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1183
1194
|
}
|
|
1184
1195
|
/** Flip `key`. `applyInManual`: Space has always toggled in `manual` mode. */
|
|
1185
1196
|
#requestToggle(key, source, applyInManual = false) {
|
|
1197
|
+
if (!this.#canSelectKey(key)) return;
|
|
1186
1198
|
if (this.#intercepted({
|
|
1187
1199
|
kind: `toggle`,
|
|
1188
1200
|
keys: [key],
|
|
@@ -1193,7 +1205,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1193
1205
|
}
|
|
1194
1206
|
/** Extend the range from the anchor to `key`. */
|
|
1195
1207
|
#requestExtend(key, source) {
|
|
1196
|
-
if (this.selectionMode === `none`) return;
|
|
1208
|
+
if (this.selectionMode === `none` || !this.#canSelectKey(key)) return;
|
|
1197
1209
|
const range = this._anchorKey === void 0 ? void 0 : this.#rangeKeys(key);
|
|
1198
1210
|
if (this.#intercepted({
|
|
1199
1211
|
kind: `extend`,
|
|
@@ -1211,7 +1223,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1211
1223
|
/** Row keys between the anchor and `key` (inclusive), or `undefined` when the range degrades to a replace. */
|
|
1212
1224
|
#rangeKeys(key) {
|
|
1213
1225
|
if (!this._anchorKey) return void 0;
|
|
1214
|
-
let keys = this._flat.filter((f) => f.type === `row`).map((f) => f.key);
|
|
1226
|
+
let keys = this._flat.filter((f) => f.type === `row` && this.#flagsForEntry(f).selectable).map((f) => f.key);
|
|
1215
1227
|
if (this.groupBy && !this.crossGroupSelection) {
|
|
1216
1228
|
const group = this._getGroupKey(this._getRowForKey(this._anchorKey) ?? { key: this._anchorKey });
|
|
1217
1229
|
if (group !== this._getGroupKey(this._getRowForKey(key) ?? { key })) return void 0;
|
|
@@ -1381,6 +1393,50 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1381
1393
|
const next = new Set(keys);
|
|
1382
1394
|
if (!sameKeySet(next, this._partialKeys)) this._partialKeys = next;
|
|
1383
1395
|
}
|
|
1396
|
+
#tagResolver;
|
|
1397
|
+
/** Tags by row key, apart from the row data (like {@link partialKeys}): tag name → keys. Merged with the `tags` hook. */
|
|
1398
|
+
get tagKeys() {
|
|
1399
|
+
return this.#tagResolver.tagKeys;
|
|
1400
|
+
}
|
|
1401
|
+
set tagKeys(value) {
|
|
1402
|
+
if (sameTagKeys(value, this.#tagResolver.tagKeys)) return;
|
|
1403
|
+
this.#tagResolver.tagKeys = value;
|
|
1404
|
+
this.refreshTags();
|
|
1405
|
+
}
|
|
1406
|
+
/**
|
|
1407
|
+
* Interaction flags per tag name: `selectable`, `focusable`, `draggable`,
|
|
1408
|
+
* `searchable` (`false` switches one off; omitted keeps the default). With
|
|
1409
|
+
* several tags the most restrictive wins. Rows stay rendered and keep their
|
|
1410
|
+
* place in layout and scroll.
|
|
1411
|
+
*/
|
|
1412
|
+
get tagBehaviour() {
|
|
1413
|
+
return this.#tagResolver.behaviour;
|
|
1414
|
+
}
|
|
1415
|
+
set tagBehaviour(value) {
|
|
1416
|
+
if (value === this.#tagResolver.behaviour) return;
|
|
1417
|
+
this.#tagResolver.behaviour = value;
|
|
1418
|
+
this.refreshTags();
|
|
1419
|
+
}
|
|
1420
|
+
/** Re-evaluate tags and re-render (the `tags` hook is read live; this drops cached cursor state). */
|
|
1421
|
+
refreshTags() {
|
|
1422
|
+
this.#tickledItems = void 0;
|
|
1423
|
+
this.requestUpdate();
|
|
1424
|
+
}
|
|
1425
|
+
#tagsFor(key, row, index) {
|
|
1426
|
+
return this.#tagResolver.tagsFor(key, this.tags?.(row, index));
|
|
1427
|
+
}
|
|
1428
|
+
#flagsFor(key, row, index) {
|
|
1429
|
+
if (this.tags === void 0 && this.#tagResolver.tagKeys === void 0) return this.#tagResolver.flagsFor([]);
|
|
1430
|
+
return this.#tagResolver.flagsFor(this.#tagsFor(key, row, index));
|
|
1431
|
+
}
|
|
1432
|
+
#flagsForEntry(entry) {
|
|
1433
|
+
return this.#flagsFor(entry.key, entry.row, entry.idx);
|
|
1434
|
+
}
|
|
1435
|
+
#canSelectKey(key) {
|
|
1436
|
+
if (this.tags === void 0 && this.#tagResolver.tagKeys === void 0) return true;
|
|
1437
|
+
const entry = this.#rowEntry(key);
|
|
1438
|
+
return entry === void 0 || this.#flagsFor(key, entry.row, entry.idx).selectable;
|
|
1439
|
+
}
|
|
1384
1440
|
/** Replace the selection with these row keys (clamped to known rows). */
|
|
1385
1441
|
set selectedKeys(keys) {
|
|
1386
1442
|
this.selectKeys(keys);
|
|
@@ -1393,7 +1449,7 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1393
1449
|
*/
|
|
1394
1450
|
selectKeys(keys) {
|
|
1395
1451
|
this.#pendingSelected = EMPTY_KEYS;
|
|
1396
|
-
let next = new Set([...keys].filter((k) => this._getRowForKey(k) !== void 0));
|
|
1452
|
+
let next = new Set([...keys].filter((k) => this._getRowForKey(k) !== void 0 && this.#canSelectKey(k)));
|
|
1397
1453
|
if (this.selectionMode === `none`) next = /* @__PURE__ */ new Set();
|
|
1398
1454
|
else if (!this.#isMultiSelect() && next.size > 1) {
|
|
1399
1455
|
const last = [...next].at(-1);
|
|
@@ -1541,8 +1597,8 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
1541
1597
|
source: `keyboard`
|
|
1542
1598
|
})) return;
|
|
1543
1599
|
const prev = new Set(this._selectedKeys);
|
|
1544
|
-
if (group !== void 0) this._selectedKeys = new Set(this._flat.filter((f) => f.type === `row` && this._getGroupKey(f.row) === group).map((f) => f.key));
|
|
1545
|
-
else this._selectedKeys = new Set(this._flat.filter((f) => f.type === `row`).map((f) => f.key));
|
|
1600
|
+
if (group !== void 0) this._selectedKeys = new Set(this._flat.filter((f) => f.type === `row` && this.#flagsForEntry(f).selectable && this._getGroupKey(f.row) === group).map((f) => f.key));
|
|
1601
|
+
else this._selectedKeys = new Set(this._flat.filter((f) => f.type === `row` && this.#flagsForEntry(f).selectable).map((f) => f.key));
|
|
1546
1602
|
this.#dispatchSelect(prev);
|
|
1547
1603
|
}
|
|
1548
1604
|
return;
|
|
@@ -2299,11 +2355,15 @@ let DataGridElement = class DataGridElement extends LitElement {
|
|
|
2299
2355
|
const selected = this._selectedKeys.has(rowKey);
|
|
2300
2356
|
const partial = isPartialKey(rowKey, this._partialKeys, selected);
|
|
2301
2357
|
const tickled = this._tickled.isTickled(rowKey);
|
|
2358
|
+
const rowTags = this.#tagsFor(rowKey, row, absIdx2);
|
|
2359
|
+
const rowFlags = this.#tagResolver.flagsFor(rowTags);
|
|
2302
2360
|
return html`
|
|
2303
2361
|
<div class="row item ${selected ? `selected` : ``} ${partial ? `partial` : ``} ${tickled ? `tickled` : ``} ${this.zebraStripes && absIdx2 % 2 === 1 ? `zebra-odd` : ``} ${this.#enteringRowKeys.has(rowKey) ? `entering` : ``} ${this.#nativeDragging && rowKey === this.#dragOriginKey ? `dragging-origin` : ``}" role="row" aria-rowindex=${absIdx + 2} aria-selected=${selected ? `true` : `false`} aria-description=${partial ? PARTIAL_DESCRIPTION : nothing} style="top:${absIdx * rh}px; height:${rh}px"
|
|
2304
2362
|
data-key=${rowKey}
|
|
2363
|
+
part="item${tagPartTokens(rowTags)}"
|
|
2364
|
+
data-tags=${ifDefined(tagsAttribute(rowTags))}
|
|
2305
2365
|
?data-partial=${partial}
|
|
2306
|
-
draggable=${this.#nativeDrag.draggableAttr}
|
|
2366
|
+
draggable=${rowFlags.draggable && rowFlags.selectable ? this.#nativeDrag.draggableAttr : `false`}
|
|
2307
2367
|
@click=${(e) => {
|
|
2308
2368
|
this._onRowClick(rowKey, null, e);
|
|
2309
2369
|
this.dispatchEvent(new CustomEvent(`datagrid-cell-click`, {
|
|
@@ -2596,6 +2656,7 @@ __decorate([property({
|
|
|
2596
2656
|
reflect: true
|
|
2597
2657
|
})], DataGridElement.prototype, "itemsDraggable", void 0);
|
|
2598
2658
|
__decorate([property({ attribute: false })], DataGridElement.prototype, "dragPreviewRenderer", void 0);
|
|
2659
|
+
__decorate([property({ attribute: false })], DataGridElement.prototype, "writeDataTransfer", void 0);
|
|
2599
2660
|
__decorate([property({ attribute: false })], DataGridElement.prototype, "dragPreviewSource", void 0);
|
|
2600
2661
|
__decorate([property({
|
|
2601
2662
|
type: String,
|
|
@@ -2615,5 +2676,6 @@ __decorate([state()], DataGridElement.prototype, "_editValue", void 0);
|
|
|
2615
2676
|
__decorate([query(`.viewport`)], DataGridElement.prototype, "_viewportEl", void 0);
|
|
2616
2677
|
__decorate([query(`.header-row`)], DataGridElement.prototype, "_headerRowEl", void 0);
|
|
2617
2678
|
__decorate([state()], DataGridElement.prototype, "_partialKeys", void 0);
|
|
2679
|
+
__decorate([property({ attribute: false })], DataGridElement.prototype, "tags", void 0);
|
|
2618
2680
|
DataGridElement = __decorate([safeCustomElement(`ixfx-data-grid`)], DataGridElement);
|
|
2619
2681
|
export { DataGridElement as t };
|
package/dist/data-grid.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { B as
|
|
2
|
-
import { A as DataGridColumn, B as DataGridInteractionMode, C as DataGridSortEvent, D as DataGridViewState, E as DataGridColumnViewState, F as DataGridEditorFactory, G as GlobalFormatter, H as DataGridSelectionMode, I as DataGridEditorType, L as DataGridGetRowKey, M as DataGridDataType, N as DataGridEditability, O as BuiltInFormatterName, P as DataGridEditorContext, R as DataGridGroupBy, S as DataGridSortDetail, T as DataGridViewportChangeEvent, U as DataGridSortDirection, V as DataGridRowLook, W as DataGridSortState, _ as DataGridRowActivateDetail, a as DataGridColumnReorderDetail, b as DataGridSelectEvent, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridListSelectEvent, h as DataGridListSelectDetail, i as DataGridCellEditEvent, j as DataGridColumnMenu, k as BuiltInFormatterOptions, 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 DataGridRowActivateEvent, w as DataGridViewportChangeDetail, x as DataGridSelectIntentEvent, y as DataGridSelectDetail, z as DataGridGroupLabel } from "./data-grid-
|
|
1
|
+
import { B as ListDragSource, F as ListDragEntry, H as ListNativeDragStartEvent, I as ListDragPreview, L as ListDragPreviewContext, R as ListDragPreviewRenderer, V as ListNativeDragStartDetail } from "./tree-component-BE7OEIiH.js";
|
|
2
|
+
import { A as DataGridColumn, B as DataGridInteractionMode, C as DataGridSortEvent, D as DataGridViewState, E as DataGridColumnViewState, F as DataGridEditorFactory, G as GlobalFormatter, H as DataGridSelectionMode, I as DataGridEditorType, L as DataGridGetRowKey, M as DataGridDataType, N as DataGridEditability, O as BuiltInFormatterName, P as DataGridEditorContext, R as DataGridGroupBy, S as DataGridSortDetail, T as DataGridViewportChangeEvent, U as DataGridSortDirection, V as DataGridRowLook, W as DataGridSortState, _ as DataGridRowActivateDetail, a as DataGridColumnReorderDetail, b as DataGridSelectEvent, c as DataGridColumnResizeEvent, d as DataGridElement, f as DataGridElementEventMap, g as DataGridListSelectEvent, h as DataGridListSelectDetail, i as DataGridCellEditEvent, j as DataGridColumnMenu, k as BuiltInFormatterOptions, 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 DataGridRowActivateEvent, w as DataGridViewportChangeDetail, x as DataGridSelectIntentEvent, y as DataGridSelectDetail, z as DataGridGroupLabel } from "./data-grid-BYMZZbNc.js";
|
|
3
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, DataGridListSelectDetail, DataGridListSelectEvent, DataGridRowActivateDetail, DataGridRowActivateEvent, type DataGridRowLook, DataGridSelectDetail, DataGridSelectEvent, DataGridSelectIntentEvent, 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 +1 @@
|
|
|
1
|
-
export { t as DataGridElement } from "./data-grid-
|
|
1
|
+
export { t as DataGridElement } from "./data-grid-CJrbLzLr.js";
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { r as IDataProvider } from "./data-provider-Cq_ylpET.js";
|
|
2
2
|
import { a as ListGroupEventMap, o as ListGroupInfo, s as ListGroupLabel } from "./grouping-OoQ8WaKc.js";
|
|
3
|
-
import {
|
|
3
|
+
import { i as ItemTagKeys, n as ItemTagBehaviour } from "./item-tags-Dz-jQq-4.js";
|
|
4
4
|
import { a as ViewStateBase, s as ViewStateChangeEvent, t as GetViewStateOptions } from "./types-16GC5k1z.js";
|
|
5
|
+
import { H as ListNativeDragStartEvent, P as ListDragDataTransferWriter, R as ListDragPreviewRenderer, z as ListDragPreviewSourceResolver } from "./tree-component-BE7OEIiH.js";
|
|
5
6
|
import { h as ListSelectionMode, i as ListInteractionMode, r as ListElementEventMap } from "./list-selection-types-CKTt7Rrw.js";
|
|
6
7
|
import { n as ListViewportChangeEvent } from "./list-viewport-types-BJ8c6qur.js";
|
|
7
8
|
import "./index-Cdcek1Oj.js";
|
|
8
|
-
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-
|
|
9
|
-
import { S as ListSearchController } from "./index-
|
|
9
|
+
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-C4z3La0C.js";
|
|
10
|
+
import { S as ListSearchController } from "./index-BuvySJEc.js";
|
|
10
11
|
import "./icon-Bhz0c6Yf.js";
|
|
11
12
|
import "./list-group-header.js";
|
|
12
13
|
import { LitElement, PropertyValues } from "lit";
|
|
@@ -95,6 +96,31 @@ declare class DetailListElement extends LitElement {
|
|
|
95
96
|
*/
|
|
96
97
|
badgeProperty: string;
|
|
97
98
|
keyProperty: string;
|
|
99
|
+
/**
|
|
100
|
+
* Caller-assigned tags for an object item (`undefined` ⇒ none). Each tag is
|
|
101
|
+
* mirrored on the row as `data-tags` (style with `li[data-tags~="foo"]`), and
|
|
102
|
+
* `tagBehaviour` can switch off selection, focus, drag or search per tag.
|
|
103
|
+
* Re-evaluated when `items`, `tags`, `tagKeys` or `tagBehaviour` change, or on
|
|
104
|
+
* {@link refreshTags}.
|
|
105
|
+
*/
|
|
106
|
+
tags: ((item: unknown, index: number) => readonly string[] | undefined) | undefined;
|
|
107
|
+
/**
|
|
108
|
+
* Tags assigned by key, apart from the item data (like `partialKeys`):
|
|
109
|
+
* tag name → keys carrying it. Merged with the `tags` hook; works for
|
|
110
|
+
* declarative rows too.
|
|
111
|
+
*/
|
|
112
|
+
get tagKeys(): ItemTagKeys | undefined;
|
|
113
|
+
set tagKeys(value: ItemTagKeys | undefined);
|
|
114
|
+
/**
|
|
115
|
+
* Interaction flags per tag name: `selectable`, `focusable`, `draggable`,
|
|
116
|
+
* `searchable` (`false` switches one off; omitted keeps the default). With
|
|
117
|
+
* several tags the most restrictive wins. Rows stay rendered and keep their
|
|
118
|
+
* place in layout.
|
|
119
|
+
*/
|
|
120
|
+
get tagBehaviour(): ItemTagBehaviour | undefined;
|
|
121
|
+
set tagBehaviour(value: ItemTagBehaviour | undefined);
|
|
122
|
+
/** Re-evaluate every row's tags (call after mutating data the `tags` hook reads). */
|
|
123
|
+
refreshTags(): void;
|
|
98
124
|
filterPredicate: ((el: Element) => boolean) | undefined;
|
|
99
125
|
/**
|
|
100
126
|
* Whether keyboard navigation wraps from last to first and vice versa.
|
|
@@ -121,6 +147,12 @@ declare class DetailListElement extends LitElement {
|
|
|
121
147
|
* built-in HTML+canvas preview.
|
|
122
148
|
*/
|
|
123
149
|
dragPreviewRenderer: ListDragPreviewRenderer<Element> | undefined;
|
|
150
|
+
/**
|
|
151
|
+
* Write an application payload onto the drag's `DataTransfer` (e.g. a custom
|
|
152
|
+
* MIME type). Called once per drag, synchronously inside `dragstart`, after a
|
|
153
|
+
* non-cancelled `list-native-drag-start`.
|
|
154
|
+
*/
|
|
155
|
+
writeDataTransfer: ListDragDataTransferWriter<Element> | undefined;
|
|
124
156
|
dragPreviewSource: ListDragPreviewSourceResolver<Element> | undefined;
|
|
125
157
|
/**
|
|
126
158
|
* Group rows under collapsible headers that flow inline in the columns. A
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { t as DataController } from "./data-controller-q-rXRMzJ.js";
|
|
2
2
|
import { n as appearanceColor, t as appearanceAbsent } from "./item-appearance-FRO3TRFI.js";
|
|
3
|
-
import { c as createElementListSearchAdapter, d as keysOfElements, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-
|
|
3
|
+
import { c as createElementListSearchAdapter, d as keysOfElements, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-Bk4acsCM.js";
|
|
4
4
|
import { a as toGroupKey, r as partitionByGroup } from "./grouping-kENdqzSV.js";
|
|
5
|
+
import { d as ItemTagResolver, g as sameTagKeys, i as animateListItemOut, r as animateListItemIn, t as ListNativeDragController, u as DEFAULT_ITEM_TAG_FLAGS, y as tagsAttribute } from "./list-native-drag-controller-B_INa6_G.js";
|
|
5
6
|
import { i as ListDragSelectController, n as gestureOf, t as ListSelectionController } from "./list-selection-controller-Dkh3m3hX.js";
|
|
6
|
-
import { i as animateListItemOut, r as animateListItemIn, t as ListNativeDragController } from "./list-native-drag-controller-ByftBooJ.js";
|
|
7
7
|
import { i as sameKeySet, n as applyPartialAttributes, r as isPartialKey } from "./partial-keys-D4l_ede_.js";
|
|
8
|
-
import { t as TickledController } from "./tickled-controller-
|
|
8
|
+
import { t as TickledController } from "./tickled-controller-BsFFr_1N.js";
|
|
9
9
|
import { t as themeFallbacks } from "./fallbacks-BPjjBoED.js";
|
|
10
10
|
import { a as capKeys, d as partitionKeys, l as keysToArray, o as flagsFromRecord } from "./pending-Afl4LT64.js";
|
|
11
11
|
import { t as scrollFadeStyles } from "./scroll-fade-DH8OXSqL.js";
|
|
@@ -290,6 +290,8 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
290
290
|
this.textColorProperty = ``;
|
|
291
291
|
this.badgeProperty = ``;
|
|
292
292
|
this.keyProperty = ``;
|
|
293
|
+
this.#tagResolver = new ItemTagResolver();
|
|
294
|
+
this.#rowFlags = /* @__PURE__ */ new WeakMap();
|
|
293
295
|
this.itemWrap = `stop`;
|
|
294
296
|
this.itemsDraggable = false;
|
|
295
297
|
this.groupBy = null;
|
|
@@ -354,7 +356,8 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
354
356
|
const visible = this._getVisibleItems();
|
|
355
357
|
this.#tickledItemsCache ??= visible.map((el) => ({
|
|
356
358
|
id: el,
|
|
357
|
-
enabled: !el.hasAttribute(`not-checked`)
|
|
359
|
+
enabled: !el.hasAttribute(`not-checked`) && this.#flagsOf(el).selectable,
|
|
360
|
+
focusable: this.#flagsOf(el).focusable
|
|
358
361
|
}));
|
|
359
362
|
return this.#tickledItemsCache;
|
|
360
363
|
},
|
|
@@ -435,6 +438,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
435
438
|
this.search = new ListSearchController(this, { adapter: createElementListSearchAdapter(this, {
|
|
436
439
|
itemSelector: ITEM_SELECTOR,
|
|
437
440
|
getLabel: (el) => el.getAttribute(`data-search-label`) ?? el.textContent?.trim() ?? ``,
|
|
441
|
+
isSearchable: (el) => this.#flagsOf(el).searchable,
|
|
438
442
|
highlightKey: SEARCH_HIGHLIGHT_KEY
|
|
439
443
|
}) });
|
|
440
444
|
this.#partialKeys = /* @__PURE__ */ new Set();
|
|
@@ -544,6 +548,62 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
544
548
|
this._listEl.scrollLeft += delta;
|
|
545
549
|
};
|
|
546
550
|
}
|
|
551
|
+
#tagResolver;
|
|
552
|
+
#rowFlags;
|
|
553
|
+
/**
|
|
554
|
+
* Tags assigned by key, apart from the item data (like `partialKeys`):
|
|
555
|
+
* tag name → keys carrying it. Merged with the `tags` hook; works for
|
|
556
|
+
* declarative rows too.
|
|
557
|
+
*/
|
|
558
|
+
get tagKeys() {
|
|
559
|
+
return this.#tagResolver.tagKeys;
|
|
560
|
+
}
|
|
561
|
+
set tagKeys(value) {
|
|
562
|
+
if (sameTagKeys(value, this.#tagResolver.tagKeys)) return;
|
|
563
|
+
this.#tagResolver.tagKeys = value;
|
|
564
|
+
this.refreshTags();
|
|
565
|
+
}
|
|
566
|
+
/**
|
|
567
|
+
* Interaction flags per tag name: `selectable`, `focusable`, `draggable`,
|
|
568
|
+
* `searchable` (`false` switches one off; omitted keeps the default). With
|
|
569
|
+
* several tags the most restrictive wins. Rows stay rendered and keep their
|
|
570
|
+
* place in layout.
|
|
571
|
+
*/
|
|
572
|
+
get tagBehaviour() {
|
|
573
|
+
return this.#tagResolver.behaviour;
|
|
574
|
+
}
|
|
575
|
+
set tagBehaviour(value) {
|
|
576
|
+
if (value === this.#tagResolver.behaviour) return;
|
|
577
|
+
this.#tagResolver.behaviour = value;
|
|
578
|
+
this.refreshTags();
|
|
579
|
+
}
|
|
580
|
+
/** Re-evaluate every row's tags (call after mutating data the `tags` hook reads). */
|
|
581
|
+
refreshTags() {
|
|
582
|
+
if (!this.isConnected) return;
|
|
583
|
+
this.#tickledItemsCache = void 0;
|
|
584
|
+
for (const el of this.#allItems()) {
|
|
585
|
+
const data = el instanceof HTMLLIElement ? this.#itemData.get(el) : void 0;
|
|
586
|
+
const index = el instanceof HTMLLIElement ? this.#itemIndex.get(el) : void 0;
|
|
587
|
+
const hook = data !== void 0 && index !== void 0 ? this.tags?.(data, index) : void 0;
|
|
588
|
+
const tags = this.#tagResolver.tagsFor(keyForElement(el) ?? void 0, hook);
|
|
589
|
+
const value = tagsAttribute(tags);
|
|
590
|
+
if (value === void 0) {
|
|
591
|
+
if (el.hasAttribute(`data-tags`)) el.removeAttribute(`data-tags`);
|
|
592
|
+
} else if (el.getAttribute(`data-tags`) !== value) el.setAttribute(`data-tags`, value);
|
|
593
|
+
const flags = this.#tagResolver.flagsFor(tags);
|
|
594
|
+
if (flags === DEFAULT_ITEM_TAG_FLAGS) this.#rowFlags.delete(el);
|
|
595
|
+
else this.#rowFlags.set(el, flags);
|
|
596
|
+
}
|
|
597
|
+
this._syncNativeDraggable();
|
|
598
|
+
}
|
|
599
|
+
#flagsOf(el) {
|
|
600
|
+
return this.#rowFlags.get(el) ?? DEFAULT_ITEM_TAG_FLAGS;
|
|
601
|
+
}
|
|
602
|
+
/** Keyboard cursor and hover may land here. */
|
|
603
|
+
#isNavigable(el) {
|
|
604
|
+
const flags = this.#flagsOf(el);
|
|
605
|
+
return this._isCheckable(el) && flags.focusable;
|
|
606
|
+
}
|
|
547
607
|
#itemData;
|
|
548
608
|
/** The `index` each object item was formatted with — reuse is only safe at the same index. */
|
|
549
609
|
#itemIndex;
|
|
@@ -607,7 +667,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
607
667
|
#prepareNativeDrag(originKey) {
|
|
608
668
|
const visible = this._getVisibleItems();
|
|
609
669
|
const originEl = visible.find((el) => keyForElement(el) === originKey);
|
|
610
|
-
if (!originEl || !this._isCheckable(originEl)) return void 0;
|
|
670
|
+
if (!originEl || !this._isCheckable(originEl) || !this.#flagsOf(originEl).draggable) return void 0;
|
|
611
671
|
if (!this.selection.selected.has(originEl)) this.selection.replace(originEl);
|
|
612
672
|
const selected = [];
|
|
613
673
|
visible.forEach((el, index) => {
|
|
@@ -631,7 +691,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
631
691
|
if (!this.isConnected) return;
|
|
632
692
|
if (!this.itemsDraggable && !this.#draggableApplied) return;
|
|
633
693
|
this.#draggableApplied = this.itemsDraggable;
|
|
634
|
-
for (const el of this.querySelectorAll(`li`)) if (el instanceof HTMLElement) el.draggable = this.itemsDraggable && this._isCheckable(el);
|
|
694
|
+
for (const el of this.querySelectorAll(`li`)) if (el instanceof HTMLElement) el.draggable = this.itemsDraggable && this._isCheckable(el) && this.#flagsOf(el).draggable;
|
|
635
695
|
}
|
|
636
696
|
#startPostDragSuppressTimer() {
|
|
637
697
|
if (this.#postDragSuppressTimer) clearTimeout(this.#postDragSuppressTimer);
|
|
@@ -817,6 +877,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
817
877
|
}
|
|
818
878
|
}
|
|
819
879
|
if (changed.has(`searchModes`)) this.#syncSearchCommands();
|
|
880
|
+
if (changed.has(`tags`)) this.refreshTags();
|
|
820
881
|
if (changed.has(`provider`)) {
|
|
821
882
|
this.#builtFromProvider = [];
|
|
822
883
|
this.#providerBuilt = 0;
|
|
@@ -1185,6 +1246,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1185
1246
|
}
|
|
1186
1247
|
if (this.sort !== `none`) this.#applySort();
|
|
1187
1248
|
if (this.interactionMode === `checked`) this._syncCheckboxes();
|
|
1249
|
+
this.refreshTags();
|
|
1188
1250
|
this._syncItemStates();
|
|
1189
1251
|
this.#scheduleGeometry();
|
|
1190
1252
|
this.#scheduleGroups();
|
|
@@ -1583,16 +1645,16 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1583
1645
|
continue;
|
|
1584
1646
|
}
|
|
1585
1647
|
const item = this.#itemAt(col, row);
|
|
1586
|
-
if (item && this
|
|
1648
|
+
if (item && this.#isNavigable(item)) return item;
|
|
1587
1649
|
row += deltaRow;
|
|
1588
1650
|
}
|
|
1589
1651
|
}
|
|
1590
1652
|
#findFirstCheckable() {
|
|
1591
|
-
return this._getVisibleItems().find((item) => this
|
|
1653
|
+
return this._getVisibleItems().find((item) => this.#isNavigable(item));
|
|
1592
1654
|
}
|
|
1593
1655
|
#findLastCheckable() {
|
|
1594
1656
|
const visibleItems = this._getVisibleItems();
|
|
1595
|
-
for (let i = visibleItems.length - 1; i >= 0; i--) if (this
|
|
1657
|
+
for (let i = visibleItems.length - 1; i >= 0; i--) if (this.#isNavigable(visibleItems[i])) return visibleItems[i];
|
|
1596
1658
|
}
|
|
1597
1659
|
#navigateDown() {
|
|
1598
1660
|
this.#ensureGeometry();
|
|
@@ -1629,7 +1691,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1629
1691
|
let best;
|
|
1630
1692
|
let bestDelta = Number.POSITIVE_INFINITY;
|
|
1631
1693
|
for (const el of column) {
|
|
1632
|
-
if (!this
|
|
1694
|
+
if (!this.#isNavigable(el)) continue;
|
|
1633
1695
|
const delta = Math.abs((this.#geometry.tops.get(el) ?? Number.POSITIVE_INFINITY) - top);
|
|
1634
1696
|
if (delta < bestDelta) {
|
|
1635
1697
|
best = el;
|
|
@@ -1727,6 +1789,7 @@ let DetailListElement = class DetailListElement extends LitElement {
|
|
|
1727
1789
|
return width;
|
|
1728
1790
|
}
|
|
1729
1791
|
_isCheckable(item) {
|
|
1792
|
+
if (!this.#flagsOf(item).selectable) return false;
|
|
1730
1793
|
if (this.interactionMode !== `checked`) return true;
|
|
1731
1794
|
return !item.hasAttribute(`not-checked`);
|
|
1732
1795
|
}
|
|
@@ -2241,6 +2304,7 @@ __decorate([property({
|
|
|
2241
2304
|
type: String,
|
|
2242
2305
|
attribute: `key-property`
|
|
2243
2306
|
})], DetailListElement.prototype, "keyProperty", void 0);
|
|
2307
|
+
__decorate([property({ attribute: false })], DetailListElement.prototype, "tags", void 0);
|
|
2244
2308
|
__decorate([property({ attribute: false })], DetailListElement.prototype, "filterPredicate", void 0);
|
|
2245
2309
|
__decorate([property({
|
|
2246
2310
|
type: String,
|
|
@@ -2258,6 +2322,7 @@ __decorate([property({
|
|
|
2258
2322
|
reflect: true
|
|
2259
2323
|
})], DetailListElement.prototype, "itemsDraggable", void 0);
|
|
2260
2324
|
__decorate([property({ attribute: false })], DetailListElement.prototype, "dragPreviewRenderer", void 0);
|
|
2325
|
+
__decorate([property({ attribute: false })], DetailListElement.prototype, "writeDataTransfer", void 0);
|
|
2261
2326
|
__decorate([property({ attribute: false })], DetailListElement.prototype, "dragPreviewSource", void 0);
|
|
2262
2327
|
__decorate([property({ attribute: `group-by` })], DetailListElement.prototype, "groupBy", void 0);
|
|
2263
2328
|
__decorate([property({ attribute: false })], DetailListElement.prototype, "groupLabel", void 0);
|
package/dist/detail-list.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as
|
|
1
|
+
import { B as ListDragSource, F as ListDragEntry, H as ListNativeDragStartEvent, I as ListDragPreview, L as ListDragPreviewContext, R as ListDragPreviewRenderer, V as ListNativeDragStartDetail } from "./tree-component-BE7OEIiH.js";
|
|
2
2
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BJ8c6qur.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-OoQ8WaKc.js";
|
|
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-
|
|
5
|
-
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-
|
|
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-CBgnKkEm.js";
|
|
5
|
+
import { n as CustomCheckboxOptions, t as AddItemOptions } from "./vertical-list-C4z3La0C.js";
|
|
6
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
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { t as DetailListElement } from "./detail-list-
|
|
1
|
+
export { t as DetailListElement } from "./detail-list-Dk9oSvAZ.js";
|
|
2
2
|
import "./list-group-header.js";
|