@ixfx/components 0.16.1 → 0.16.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 +272 -58
- package/bundle/index.js +400 -337
- package/dist/ac-token.js +1 -1
- package/dist/{crumb-navigation-YnFVFqrx.js → crumb-navigation-D3ndPgFg.js} +2 -2
- package/dist/crumbs.js +1 -1
- package/dist/{data-grid-Cqxuwgbb.js → data-grid-8TsiF2ES.js} +142 -60
- package/dist/{data-grid-Csh5EJW9.d.ts → data-grid-CslzF16R.d.ts} +21 -3
- package/dist/data-grid.d.ts +2 -2
- package/dist/data-grid.js +1 -1
- package/dist/{detail-list-DSZ1DDor.d.ts → detail-list-n1MbNbhF.d.ts} +11 -3
- package/dist/{detail-list-Bo5ze3SN.js → detail-list-w3GXKO2k.js} +71 -19
- package/dist/detail-list.d.ts +2 -2
- package/dist/detail-list.js +1 -1
- package/dist/{flat-list-CT9kX3TQ.d.ts → flat-list-D_4y3wgn.d.ts} +7 -2
- package/dist/flat-list.d.ts +1 -1
- package/dist/flat-list.js +5 -2
- package/dist/{grid-list-DDLrWRxm.d.ts → grid-list-CqYS28NY.d.ts} +60 -14
- package/dist/{grid-list-D0dJNVEF.js → grid-list-Cz2tKcNZ.js} +55 -17
- package/dist/grid-list.d.ts +2 -2
- package/dist/grid-list.js +1 -1
- package/dist/{grouped-item-lister-DETte0Dh.d.ts → grouped-item-lister-CS4yInuw.d.ts} +1 -1
- package/dist/grouped-item-lister.d.ts +1 -1
- package/dist/{incr-search-CgbL-OlS.js → incr-search-Dc6gYpJG.js} +34 -5
- package/dist/incr-search.d.ts +1 -1
- package/dist/incr-search.js +1 -1
- package/dist/{index-CUErGhCg.d.ts → index-Bm9a9S3_.d.ts} +2 -1
- package/dist/{index-Bnm-kKGC.d.ts → index-DyaHA9Kk.d.ts} +20 -1
- package/dist/{index-D-lZNlHa.d.ts → index-VAs9akt4.d.ts} +18 -2
- package/dist/{index-DxyyVqzA.d.ts → index-ZaA90u09.d.ts} +1 -0
- package/dist/index.d.ts +45 -14
- package/dist/index.js +93 -17
- package/dist/{list-selection-controller-5L0Nj9tR.js → list-selection-controller-D4iIrvJH.js} +199 -57
- package/dist/list-selection-types-Dnamh2Lu.d.ts +109 -0
- package/dist/{menu-CU9KAm8s.js → menu-BX1FHxY8.js} +16 -1
- package/dist/{menu-item-BUv8An2k.js → menu-item-oxU1VKiJ.js} +34 -9
- package/dist/menu.d.ts +1 -1
- package/dist/menu.js +2 -2
- package/dist/{miller-DUqiUAWQ.js → miller-Be7x4ufN.js} +142 -10
- package/dist/miller.d.ts +1 -1
- package/dist/miller.js +1 -1
- package/dist/narrowed-text.js +1 -1
- package/dist/partial-keys-Ck6CiprB.js +32 -0
- package/dist/sunburst-tree.d.ts +1 -1
- package/dist/sunburst-tree.js +1 -1
- package/dist/{sunbursttree-list-DePuFYlU.d.ts → sunbursttree-list-Bk20giTF.d.ts} +1 -1
- package/dist/{sunbursttree-list-B_M0YTEA.js → sunbursttree-list-DQF6DcsS.js} +1 -1
- package/dist/timeline.d.ts +1 -1
- package/dist/{tree-DAlgvaHB.js → tree-BaXYyt5U.js} +185 -69
- package/dist/tree.d.ts +1 -1
- package/dist/tree.js +1 -1
- package/dist/{vertical-list-SAx56U-l.d.ts → vertical-list-DtHX26JO.d.ts} +11 -2
- package/dist/{vertical-list-DyKPKGxK.js → vertical-list-o5hfqH87.js} +54 -19
- 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/data-grid.md +10 -3
- package/docs-user/detail-list.md +1 -1
- package/docs-user/grid-list.md +4 -1
- package/docs-user/index.json +6 -2
- package/docs-user/llms.txt +1 -0
- package/docs-user/menu.md +11 -1
- package/docs-user/miller.md +4 -0
- package/docs-user/multicol-list.md +6 -0
- package/docs-user/select-horiz.md +1 -1
- package/docs-user/tree.md +6 -0
- package/docs-user/user-selection-intents.md +86 -0
- package/docs-user/vertical-list.md +9 -1
- package/llms.txt +1 -0
- package/package.json +1 -1
- package/dist/list-selection-types-PjKdhF-a.d.ts +0 -45
- /package/dist/{index-DV3iaUBW.d.ts → index-DV3iaUBW2.d.ts} +0 -0
|
@@ -2,9 +2,10 @@ import { t as TickledController } from "./tickled-controller-D-HZymaZ.js";
|
|
|
2
2
|
import { n as tickledStyles, t as tickledItemStyles } from "./tickled-styles-BrAHEj1q.js";
|
|
3
3
|
import { t as themeFallbacks } from "./fallbacks-DQ_5OsmR.js";
|
|
4
4
|
import { n as safeCustomElement, t as __decorate } from "./decorate-VRK8rslU.js";
|
|
5
|
-
import { i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, t as createTreeListSearchAdapter } from "./incr-search-
|
|
5
|
+
import { i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, t as createTreeListSearchAdapter } from "./incr-search-Dc6gYpJG.js";
|
|
6
6
|
import { i as animateListItemOut, o as prefersReducedMotion, r as animateListItemIn, t as ListNativeDragController } from "./list-native-drag-controller-CcXoS0YX.js";
|
|
7
7
|
import { a as capKeys, c as keysAsFlags, f as withoutFlag, i as capFlags, l as keysToArray, n as EMPTY_KEYS, o as flagsFromRecord, s as flagsToRecord, t as EMPTY_FLAGS } from "./pending-BGidHppL.js";
|
|
8
|
+
import { i as sameKeySet, r as isPartialKey, t as PARTIAL_DESCRIPTION } from "./partial-keys-Ck6CiprB.js";
|
|
8
9
|
import { n as createScrollHoverGuard } from "./scroll-hover-guard-Cjw6179Q.js";
|
|
9
10
|
import "./interaction-E-uMGHkJ.js";
|
|
10
11
|
import { t as collectDataResult } from "./data-provider-35TyWclX.js";
|
|
@@ -1320,7 +1321,12 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
1320
1321
|
if (nodes.length === 0) return;
|
|
1321
1322
|
if ((event.ctrlKey || event.metaKey) && event.key === `a`) {
|
|
1322
1323
|
event.preventDefault();
|
|
1323
|
-
this
|
|
1324
|
+
if (this.#intercepted({
|
|
1325
|
+
kind: `all`,
|
|
1326
|
+
keys: [],
|
|
1327
|
+
source: `keyboard`
|
|
1328
|
+
})) return;
|
|
1329
|
+
this.#applySelectAll({ visibleOnly: true });
|
|
1324
1330
|
return;
|
|
1325
1331
|
}
|
|
1326
1332
|
if ([
|
|
@@ -1402,7 +1408,10 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
1402
1408
|
event.preventDefault();
|
|
1403
1409
|
const current = nodes[currentIdx];
|
|
1404
1410
|
if (current) {
|
|
1405
|
-
if (this.interactionMode !== `manual` && this.interactionMode !== `checked`)
|
|
1411
|
+
if (this.interactionMode !== `manual` && this.interactionMode !== `checked`) {
|
|
1412
|
+
this.#requestReplace(current.node, `keyboard`, false);
|
|
1413
|
+
this.requestUpdate();
|
|
1414
|
+
}
|
|
1406
1415
|
this.dispatchEvent(new CustomEvent(`activate`, {
|
|
1407
1416
|
detail: {
|
|
1408
1417
|
node: current.node,
|
|
@@ -1419,7 +1428,7 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
1419
1428
|
event.preventDefault();
|
|
1420
1429
|
const current = nodes[currentIdx];
|
|
1421
1430
|
if (!current) break;
|
|
1422
|
-
if (this.interactionMode === `checked`) this._handleCheckboxClick(new MouseEvent(`click`), current.node, current.depth);
|
|
1431
|
+
if (this.interactionMode === `checked`) this._handleCheckboxClick(new MouseEvent(`click`), current.node, current.depth, `keyboard`);
|
|
1423
1432
|
else if (this.interactionMode === `standard` || this.interactionMode === `vscode` || this.interactionMode === `manual`) this.#toggleSelection(current.node, current.depth);
|
|
1424
1433
|
break;
|
|
1425
1434
|
}
|
|
@@ -2699,6 +2708,14 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
2699
2708
|
* descendants, so `visibleOnly` makes no difference there.
|
|
2700
2709
|
*/
|
|
2701
2710
|
selectAll(options = {}) {
|
|
2711
|
+
if (this.#intercepted({
|
|
2712
|
+
kind: `all`,
|
|
2713
|
+
keys: [],
|
|
2714
|
+
source: `api`
|
|
2715
|
+
})) return;
|
|
2716
|
+
this.#applySelectAll(options);
|
|
2717
|
+
}
|
|
2718
|
+
#applySelectAll(options) {
|
|
2702
2719
|
const prev = new Set(this._selectedNodes);
|
|
2703
2720
|
for (const node of this.#bulkSelectionScope(options)) if (this.#canSelect(node)) this._selectedNodes.add(node);
|
|
2704
2721
|
if (this.selectedNode === void 0 || !this._selectedNodes.has(this.selectedNode)) this.selectedNode = [...this._selectedNodes].at(-1);
|
|
@@ -2912,6 +2929,15 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
2912
2929
|
bubbles: true,
|
|
2913
2930
|
composed: true
|
|
2914
2931
|
}));
|
|
2932
|
+
this.dispatchEvent(new CustomEvent(`list-select`, {
|
|
2933
|
+
detail: {
|
|
2934
|
+
selectedKeys: new Set([...this._selectedNodes].map((n) => n.item.key)),
|
|
2935
|
+
previousKeys: new Set([...previous].map((n) => n.item.key)),
|
|
2936
|
+
previous
|
|
2937
|
+
},
|
|
2938
|
+
bubbles: true,
|
|
2939
|
+
composed: true
|
|
2940
|
+
}));
|
|
2915
2941
|
}
|
|
2916
2942
|
#findNodePath(nodes, predicate, prefix = []) {
|
|
2917
2943
|
for (const node of nodes) {
|
|
@@ -2976,8 +3002,56 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
2976
3002
|
if (!(target instanceof Element)) return false;
|
|
2977
3003
|
return target.closest(`.tree-caret`) !== null;
|
|
2978
3004
|
}
|
|
3005
|
+
/** Report an intent before changing the selection; `true` when the caller took over. */
|
|
3006
|
+
#intercepted(intent) {
|
|
3007
|
+
return !this.dispatchEvent(new CustomEvent(`list-select-intent`, {
|
|
3008
|
+
detail: intent,
|
|
3009
|
+
bubbles: true,
|
|
3010
|
+
composed: true,
|
|
3011
|
+
cancelable: true
|
|
3012
|
+
}));
|
|
3013
|
+
}
|
|
3014
|
+
/** The anchor node's key and the selectable keys in the flat range anchor..`node`, when there is an anchor. */
|
|
3015
|
+
#rangeIntent(node) {
|
|
3016
|
+
const flat = this.#getFlat();
|
|
3017
|
+
const anchorIdx = this.#anchor ? flat.indexByKey.get(this.#anchor.node.item.key) ?? -1 : -1;
|
|
3018
|
+
const targetIdx = flat.indexByKey.get(node.item.key) ?? -1;
|
|
3019
|
+
const keys = anchorIdx >= 0 && targetIdx >= 0 ? flat.rows.slice(Math.min(anchorIdx, targetIdx), Math.max(anchorIdx, targetIdx) + 1).map((r) => r.node).filter((n) => this.#canSelect(n)).map((n) => n.item.key) : [node.item.key];
|
|
3020
|
+
return {
|
|
3021
|
+
...this.#anchor ? { anchorKey: this.#anchor.node.item.key } : {},
|
|
3022
|
+
targetKey: node.item.key,
|
|
3023
|
+
keys
|
|
3024
|
+
};
|
|
3025
|
+
}
|
|
3026
|
+
/** Replace-select `node` (a plain click / Enter) unless the caller takes over; the anchor moves either way. */
|
|
3027
|
+
#requestReplace(node, source, setAnchor = true) {
|
|
3028
|
+
if (!this.#canSelect(node)) return;
|
|
3029
|
+
const intercepted = this.#intercepted({
|
|
3030
|
+
kind: `replace`,
|
|
3031
|
+
keys: [node.item.key],
|
|
3032
|
+
source
|
|
3033
|
+
});
|
|
3034
|
+
if (setAnchor) this.#anchor = {
|
|
3035
|
+
node,
|
|
3036
|
+
flatIndex: this.#getFlatIndexOf(node)
|
|
3037
|
+
};
|
|
3038
|
+
if (intercepted) return;
|
|
3039
|
+
const prev = new Set(this._selectedNodes);
|
|
3040
|
+
this._selectedNodes.clear();
|
|
3041
|
+
this._selectedNodes.add(node);
|
|
3042
|
+
this.selectedNode = node;
|
|
3043
|
+
if (!prev.has(node) || prev.size !== 1) this.#dispatchSelect(prev);
|
|
3044
|
+
}
|
|
2979
3045
|
#handleImplicitClick(node, depth, event) {
|
|
2980
3046
|
if (!this.#clickedOnCaret(node, event) && this.#canSelect(node)) {
|
|
3047
|
+
if (this.#intercepted({
|
|
3048
|
+
kind: `replace`,
|
|
3049
|
+
keys: [node.item.key],
|
|
3050
|
+
source: `pointer`
|
|
3051
|
+
})) {
|
|
3052
|
+
this.#toggleExpand(node, depth);
|
|
3053
|
+
return;
|
|
3054
|
+
}
|
|
2981
3055
|
const prev = new Set(this._selectedNodes);
|
|
2982
3056
|
this._selectedNodes.clear();
|
|
2983
3057
|
this._selectedNodes.add(node);
|
|
@@ -2990,51 +3064,60 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
2990
3064
|
const isMeta = event ? event.metaKey || event.ctrlKey : false;
|
|
2991
3065
|
const isShift = event ? event.shiftKey : false;
|
|
2992
3066
|
if (isMeta) {
|
|
2993
|
-
|
|
2994
|
-
const prev = new Set(this._selectedNodes);
|
|
2995
|
-
if (this._selectedNodes.has(node)) {
|
|
2996
|
-
this._selectedNodes.delete(node);
|
|
2997
|
-
if (this.selectedNode === node) this.selectedNode = [...this._selectedNodes].at(-1);
|
|
2998
|
-
} else {
|
|
2999
|
-
this._selectedNodes.add(node);
|
|
3000
|
-
this.selectedNode = node;
|
|
3001
|
-
this.#anchor = {
|
|
3002
|
-
node,
|
|
3003
|
-
flatIndex: this.#getFlatIndexOf(node)
|
|
3004
|
-
};
|
|
3005
|
-
}
|
|
3006
|
-
this.#dispatchSelect(prev);
|
|
3007
|
-
}
|
|
3067
|
+
this.#applyToggleClick(node);
|
|
3008
3068
|
return;
|
|
3009
3069
|
}
|
|
3010
3070
|
if (isShift && this.#anchor) {
|
|
3011
|
-
|
|
3012
|
-
const visible = flat.rows;
|
|
3013
|
-
const anchorIdx = flat.indexByKey.get(this.#anchor.node.item.key) ?? -1;
|
|
3014
|
-
const targetIdx = flat.indexByKey.get(node.item.key) ?? -1;
|
|
3015
|
-
if (anchorIdx >= 0 && targetIdx >= 0) {
|
|
3016
|
-
const prev = new Set(this._selectedNodes);
|
|
3017
|
-
const from = Math.min(anchorIdx, targetIdx);
|
|
3018
|
-
const to = Math.max(anchorIdx, targetIdx);
|
|
3019
|
-
const rangeNodes = visible.slice(from, to + 1).map((n) => n.node).filter((n) => this.#canSelect(n));
|
|
3020
|
-
this._selectedNodes = new Set(rangeNodes);
|
|
3021
|
-
this.selectedNode = node;
|
|
3022
|
-
this.#dispatchSelect(prev);
|
|
3023
|
-
}
|
|
3071
|
+
this.#applyExtendClick(node);
|
|
3024
3072
|
return;
|
|
3025
3073
|
}
|
|
3026
|
-
if (!this.#clickedOnCaret(node, event)
|
|
3027
|
-
|
|
3028
|
-
|
|
3074
|
+
if (!this.#clickedOnCaret(node, event)) this.#requestReplace(node, `pointer`);
|
|
3075
|
+
this.#toggleExpand(node, depth);
|
|
3076
|
+
}
|
|
3077
|
+
/** Ctrl/Cmd+click: flip `node`. */
|
|
3078
|
+
#applyToggleClick(node) {
|
|
3079
|
+
if (!this.#canSelect(node)) return;
|
|
3080
|
+
if (this.#intercepted({
|
|
3081
|
+
kind: `toggle`,
|
|
3082
|
+
keys: [node.item.key],
|
|
3083
|
+
source: `pointer`
|
|
3084
|
+
})) {
|
|
3085
|
+
this.#anchor = {
|
|
3086
|
+
node,
|
|
3087
|
+
flatIndex: this.#getFlatIndexOf(node)
|
|
3088
|
+
};
|
|
3089
|
+
return;
|
|
3090
|
+
}
|
|
3091
|
+
const prev = new Set(this._selectedNodes);
|
|
3092
|
+
if (this._selectedNodes.has(node)) {
|
|
3093
|
+
this._selectedNodes.delete(node);
|
|
3094
|
+
if (this.selectedNode === node) this.selectedNode = [...this._selectedNodes].at(-1);
|
|
3095
|
+
} else {
|
|
3029
3096
|
this._selectedNodes.add(node);
|
|
3030
3097
|
this.selectedNode = node;
|
|
3031
3098
|
this.#anchor = {
|
|
3032
3099
|
node,
|
|
3033
3100
|
flatIndex: this.#getFlatIndexOf(node)
|
|
3034
3101
|
};
|
|
3035
|
-
if (!prev.has(node) || prev.size !== 1) this.#dispatchSelect(prev);
|
|
3036
3102
|
}
|
|
3037
|
-
this.#
|
|
3103
|
+
this.#dispatchSelect(prev);
|
|
3104
|
+
}
|
|
3105
|
+
/** Shift+click: select the flat range from the anchor to `node`. */
|
|
3106
|
+
#applyExtendClick(node) {
|
|
3107
|
+
const flat = this.#getFlat();
|
|
3108
|
+
const anchorIdx = this.#anchor ? flat.indexByKey.get(this.#anchor.node.item.key) ?? -1 : -1;
|
|
3109
|
+
const targetIdx = flat.indexByKey.get(node.item.key) ?? -1;
|
|
3110
|
+
if (anchorIdx < 0 || targetIdx < 0) return;
|
|
3111
|
+
if (this.#intercepted({
|
|
3112
|
+
kind: `extend`,
|
|
3113
|
+
...this.#rangeIntent(node),
|
|
3114
|
+
source: `pointer`
|
|
3115
|
+
})) return;
|
|
3116
|
+
const prev = new Set(this._selectedNodes);
|
|
3117
|
+
const rangeNodes = flat.rows.slice(Math.min(anchorIdx, targetIdx), Math.max(anchorIdx, targetIdx) + 1).map((n) => n.node).filter((n) => this.#canSelect(n));
|
|
3118
|
+
this._selectedNodes = new Set(rangeNodes);
|
|
3119
|
+
this.selectedNode = node;
|
|
3120
|
+
this.#dispatchSelect(prev);
|
|
3038
3121
|
}
|
|
3039
3122
|
#handleExpandOnly(node, depth) {
|
|
3040
3123
|
this.#toggleExpand(node, depth);
|
|
@@ -3043,43 +3126,27 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
3043
3126
|
const isMeta = event ? event.metaKey || event.ctrlKey : false;
|
|
3044
3127
|
const isShift = event ? event.shiftKey : false;
|
|
3045
3128
|
if (isMeta) {
|
|
3046
|
-
|
|
3047
|
-
const prev = new Set(this._selectedNodes);
|
|
3048
|
-
if (this._selectedNodes.has(node)) {
|
|
3049
|
-
this._selectedNodes.delete(node);
|
|
3050
|
-
if (this.selectedNode === node) this.selectedNode = [...this._selectedNodes].at(-1);
|
|
3051
|
-
} else {
|
|
3052
|
-
this._selectedNodes.add(node);
|
|
3053
|
-
this.selectedNode = node;
|
|
3054
|
-
this.#anchor = {
|
|
3055
|
-
node,
|
|
3056
|
-
flatIndex: this.#getFlatIndexOf(node)
|
|
3057
|
-
};
|
|
3058
|
-
}
|
|
3059
|
-
this.#dispatchSelect(prev);
|
|
3060
|
-
}
|
|
3129
|
+
this.#applyToggleClick(node);
|
|
3061
3130
|
return;
|
|
3062
3131
|
}
|
|
3063
3132
|
if (isShift && this.#anchor) {
|
|
3064
|
-
|
|
3065
|
-
const visible = flat.rows;
|
|
3066
|
-
const anchorIdx = flat.indexByKey.get(this.#anchor.node.item.key) ?? -1;
|
|
3067
|
-
const targetIdx = flat.indexByKey.get(node.item.key) ?? -1;
|
|
3068
|
-
if (anchorIdx >= 0 && targetIdx >= 0) {
|
|
3069
|
-
const prev = new Set(this._selectedNodes);
|
|
3070
|
-
const from = Math.min(anchorIdx, targetIdx);
|
|
3071
|
-
const to = Math.max(anchorIdx, targetIdx);
|
|
3072
|
-
const rangeNodes = visible.slice(from, to + 1).map((n) => n.node).filter((n) => this.#canSelect(n));
|
|
3073
|
-
this._selectedNodes = new Set(rangeNodes);
|
|
3074
|
-
this.selectedNode = node;
|
|
3075
|
-
this.#dispatchSelect(prev);
|
|
3076
|
-
}
|
|
3133
|
+
this.#applyExtendClick(node);
|
|
3077
3134
|
return;
|
|
3078
3135
|
}
|
|
3136
|
+
if (!this.#clickedOnCaret(node, event) && this.#canSelect(node)) this.#intercepted({
|
|
3137
|
+
kind: `replace`,
|
|
3138
|
+
keys: [node.item.key],
|
|
3139
|
+
source: `pointer`
|
|
3140
|
+
});
|
|
3079
3141
|
this.#toggleExpand(node, depth);
|
|
3080
3142
|
}
|
|
3081
3143
|
#toggleSelection(node, _depth) {
|
|
3082
3144
|
if (!this.#canSelect(node)) return;
|
|
3145
|
+
if (this.#intercepted({
|
|
3146
|
+
kind: `toggle`,
|
|
3147
|
+
keys: [node.item.key],
|
|
3148
|
+
source: `keyboard`
|
|
3149
|
+
})) return;
|
|
3083
3150
|
const prev = new Set(this._selectedNodes);
|
|
3084
3151
|
if (this._selectedNodes.has(node)) {
|
|
3085
3152
|
this._selectedNodes.delete(node);
|
|
@@ -3094,10 +3161,23 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
3094
3161
|
}
|
|
3095
3162
|
this.#dispatchSelect(prev);
|
|
3096
3163
|
}
|
|
3097
|
-
_handleCheckboxClick(event, node, _depth) {
|
|
3164
|
+
_handleCheckboxClick(event, node, _depth, source = `pointer`) {
|
|
3098
3165
|
event.stopPropagation();
|
|
3099
3166
|
const prev = new Set(this._selectedNodes);
|
|
3100
3167
|
const allSelected = this.#allSelectableDescendantsSelected(node);
|
|
3168
|
+
const affected = [];
|
|
3169
|
+
const collect = (n) => {
|
|
3170
|
+
if (this.#canSelect(n)) affected.push(n.item.key);
|
|
3171
|
+
n.children?.forEach(collect);
|
|
3172
|
+
};
|
|
3173
|
+
collect(node);
|
|
3174
|
+
if (this.#intercepted({
|
|
3175
|
+
kind: `toggle`,
|
|
3176
|
+
keys: affected,
|
|
3177
|
+
descendants: true,
|
|
3178
|
+
checked: !allSelected,
|
|
3179
|
+
source
|
|
3180
|
+
})) return;
|
|
3101
3181
|
this.#applyCheckedToggle(node, !allSelected);
|
|
3102
3182
|
if (this.selectedNode === void 0 || !this._selectedNodes.has(this.selectedNode)) this.selectedNode = [...this._selectedNodes].at(-1);
|
|
3103
3183
|
this.#dispatchSelect(prev);
|
|
@@ -3164,6 +3244,12 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
3164
3244
|
if (anchorIdx < 0) return;
|
|
3165
3245
|
const from = Math.min(anchorIdx, toIdx);
|
|
3166
3246
|
const to = Math.max(anchorIdx, toIdx);
|
|
3247
|
+
const targetNode = nodes[toIdx]?.node;
|
|
3248
|
+
if (targetNode && this.#intercepted({
|
|
3249
|
+
kind: `extend`,
|
|
3250
|
+
...this.#rangeIntent(targetNode),
|
|
3251
|
+
source: `keyboard`
|
|
3252
|
+
})) return;
|
|
3167
3253
|
if (this.interactionMode === `vscode`) {
|
|
3168
3254
|
if (!this.#anchor.selectionSnapshot) this.#anchor = {
|
|
3169
3255
|
...this.#anchor,
|
|
@@ -3371,7 +3457,7 @@ let TreeBaseElement = class TreeBaseElement extends LitElement {
|
|
|
3371
3457
|
}
|
|
3372
3458
|
/** Move the cursor to `nextIdx`, applying the interaction mode's selection side effects. */
|
|
3373
3459
|
#navigateToIndex(nodes, currentIdx, nextIdx, shiftKey) {
|
|
3374
|
-
if (this.interactionMode === `implicit`) this
|
|
3460
|
+
if (this.interactionMode === `implicit`) this.#requestReplace(nodes[nextIdx].node, `keyboard`, false);
|
|
3375
3461
|
this.#setFocusedIndex(nextIdx);
|
|
3376
3462
|
if (shiftKey && (this.interactionMode === `standard` || this.interactionMode === `vscode`)) this.#extendRangeSelection(nodes, currentIdx, nextIdx);
|
|
3377
3463
|
else if (this.interactionMode === `vscode`) this.#anchor = void 0;
|
|
@@ -3826,6 +3912,22 @@ let TreeListElement = class TreeListElement extends TreeBaseElement {
|
|
|
3826
3912
|
constructor(..._args) {
|
|
3827
3913
|
super(..._args);
|
|
3828
3914
|
this.alignCheckboxes = false;
|
|
3915
|
+
this._partialKeys = /* @__PURE__ */ new Set();
|
|
3916
|
+
}
|
|
3917
|
+
/**
|
|
3918
|
+
* Nodes shown as *partially* selected (a part of the resource is selected):
|
|
3919
|
+
* `data-partial`, an indeterminate checkbox in `checked` mode, and an
|
|
3920
|
+
* accessible description otherwise. Independent of the selection — a key in
|
|
3921
|
+
* both counts as selected. In `checked` mode it combines with the state
|
|
3922
|
+
* derived from loaded descendants: a node is indeterminate if either says so.
|
|
3923
|
+
* Replace-on-set.
|
|
3924
|
+
*/
|
|
3925
|
+
get partialKeys() {
|
|
3926
|
+
return this._partialKeys;
|
|
3927
|
+
}
|
|
3928
|
+
set partialKeys(keys) {
|
|
3929
|
+
const next = new Set(keys);
|
|
3930
|
+
if (!sameKeySet(next, this._partialKeys)) this._partialKeys = next;
|
|
3829
3931
|
}
|
|
3830
3932
|
/** Checkbox tri-states for the whole loaded tree, rebuilt only when the structure or selection changes. */
|
|
3831
3933
|
#checkboxCache;
|
|
@@ -3865,11 +3967,15 @@ let TreeListElement = class TreeListElement extends TreeBaseElement {
|
|
|
3865
3967
|
`;
|
|
3866
3968
|
if (this.interactionMode === `checked`) {
|
|
3867
3969
|
if (node.item.selectable === false) return this.alignCheckboxes ? html`<span class="tree-checkbox-spacer" aria-hidden="true"></span>${caretAndLabel}` : caretAndLabel;
|
|
3868
|
-
const
|
|
3970
|
+
const derived = this.#checkboxCache?.states.get(node.item.key) ?? `unchecked`;
|
|
3971
|
+
const state = derived === `unchecked` && this.#isPartial(node) ? `indeterminate` : derived;
|
|
3869
3972
|
return html`${this.#renderCheckbox(node, depth, state)}${caretAndLabel}`;
|
|
3870
3973
|
}
|
|
3871
3974
|
return caretAndLabel;
|
|
3872
3975
|
}
|
|
3976
|
+
#isPartial(node) {
|
|
3977
|
+
return isPartialKey(node.item.key, this._partialKeys, this._isSelected(node));
|
|
3978
|
+
}
|
|
3873
3979
|
#renderCheckbox(node, depth, state) {
|
|
3874
3980
|
const onClick = (e) => this._handleCheckboxClick(e, node, depth);
|
|
3875
3981
|
if (this.checkboxRenderer) return html`
|
|
@@ -3895,6 +4001,7 @@ let TreeListElement = class TreeListElement extends TreeBaseElement {
|
|
|
3895
4001
|
}
|
|
3896
4002
|
_renderNode(node, depth) {
|
|
3897
4003
|
const selected = this._isSelected(node);
|
|
4004
|
+
const partial = this.#isPartial(node);
|
|
3898
4005
|
const tickled = this._isFocused(node);
|
|
3899
4006
|
const isBranch = node.item.isLeaf !== true;
|
|
3900
4007
|
const isExpanded = this._isExpanded(node, depth);
|
|
@@ -3904,10 +4011,12 @@ let TreeListElement = class TreeListElement extends TreeBaseElement {
|
|
|
3904
4011
|
const dnd = this._dndRowState(node);
|
|
3905
4012
|
return html`
|
|
3906
4013
|
<li
|
|
3907
|
-
class="item ${selected ? `selected` : ``} ${tickled ? `tickled` : ``} ${isBranch ? `branch` : `leaf`} ${hasIconAtDepth ? `has-icon-at-depth` : ``} ${isLeaving ? `leaving` : ``} ${dnd.dragging ? `dragging` : ``} ${dnd.dropTarget && dnd.dropPosition === `inside` ? `drop-into` : ``}"
|
|
4014
|
+
class="item ${selected ? `selected` : ``} ${partial ? `partial` : ``} ${tickled ? `tickled` : ``} ${isBranch ? `branch` : `leaf`} ${hasIconAtDepth ? `has-icon-at-depth` : ``} ${isLeaving ? `leaving` : ``} ${dnd.dragging ? `dragging` : ``} ${dnd.dropTarget && dnd.dropPosition === `inside` ? `drop-into` : ``}"
|
|
3908
4015
|
data-key=${node.item.key}
|
|
3909
4016
|
role="treeitem"
|
|
3910
4017
|
aria-selected=${selected}
|
|
4018
|
+
aria-description=${partial && this.interactionMode !== `checked` ? PARTIAL_DESCRIPTION : nothing}
|
|
4019
|
+
?data-partial=${partial}
|
|
3911
4020
|
aria-expanded=${isBranch ? isExpanded : nothing}
|
|
3912
4021
|
aria-hidden=${isLeaving ? `true` : nothing}
|
|
3913
4022
|
aria-level=${depth + 1}
|
|
@@ -3955,6 +4064,12 @@ let TreeListElement = class TreeListElement extends TreeBaseElement {
|
|
|
3955
4064
|
transition: transform var(--transition, 0.15s ease-out);
|
|
3956
4065
|
}
|
|
3957
4066
|
|
|
4067
|
+
.item.partial:not(.selected) {
|
|
4068
|
+
background: var(--item-bg-partial, color-mix(in srgb, var(--item-bg-selected, var(--accent)) 35%, transparent));
|
|
4069
|
+
outline: 1px dashed var(--item-border-partial, var(--border));
|
|
4070
|
+
outline-offset: -1px;
|
|
4071
|
+
}
|
|
4072
|
+
|
|
3958
4073
|
.item.selected .caret-icon {
|
|
3959
4074
|
color: var(--accent-text);
|
|
3960
4075
|
}
|
|
@@ -4032,6 +4147,7 @@ __decorate([property({
|
|
|
4032
4147
|
reflect: true,
|
|
4033
4148
|
attribute: `align-checkboxes`
|
|
4034
4149
|
})], TreeListElement.prototype, "alignCheckboxes", void 0);
|
|
4150
|
+
__decorate([state()], TreeListElement.prototype, "_partialKeys", void 0);
|
|
4035
4151
|
TreeListElement = __decorate([safeCustomElement(`ixfx-tree-list`)], TreeListElement);
|
|
4036
4152
|
//#endregion
|
|
4037
4153
|
//#region src/tree/tree-controller.ts
|
package/dist/tree.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { A as TreeTickleDetail, M as TreeDataModel, N as TreeDataModelOptions, O as TreeSelectDetail, T as TreeRevealMode, _ as TreeDropTarget, b as TreeItemClickDetail, c as TreeDragContext, d as TreeDragStartEvent, g as TreeDropPosition, h as TreeDropEvent, i as TreeCollapseEvent, j as TreeTickleEvent, k as TreeSelectEvent, 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, w as TreeNavigateOptions, x as TreeItemClickEvent, y as TreeExpandEvent } from "./tree-component-DgfkxmVY.js";
|
|
2
2
|
import { a as TreeItem, n as TreeExclusivity, o as TreeNode, r as TreeFilterPredicate, s as TreeSelectionFilter, t as LoadChildrenCallback } from "./types-Jky6oNAp.js";
|
|
3
|
-
import { a as TreeDropVisibleRow, c as TreeListElement, d as TreeBaseElement, f as TreeBaseElementEventMap, h as TreeConfig, i as TreeDropRowInfo, l as TreeCheckboxState, m as TreeListViewState, n as TreeDropControllerConfig, o as TreeController, p as TreeVirtualize, r as TreeDropResolvedDrag, s as TreeControllerOptions, t as TreeDropController, u as TreeAnimation } from "./index-
|
|
3
|
+
import { a as TreeDropVisibleRow, c as TreeListElement, d as TreeBaseElement, f as TreeBaseElementEventMap, h as TreeConfig, i as TreeDropRowInfo, l as TreeCheckboxState, m as TreeListViewState, n as TreeDropControllerConfig, o as TreeController, p as TreeVirtualize, r as TreeDropResolvedDrag, s as TreeControllerOptions, t as TreeDropController, u as TreeAnimation } from "./index-VAs9akt4.js";
|
|
4
4
|
export { type LoadChildrenCallback, type TreeActivateDetail, type TreeActivateEvent, TreeAnimation, 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 TreeListViewState, type TreeNavigateOptions, type TreeNode, type TreeRevealMode, 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-BaXYyt5U.js";
|
|
2
2
|
export { TreeBaseElement, TreeController, TreeDataModel, TreeDropController, TreeListElement };
|
|
@@ -2,8 +2,8 @@ import { L as ListDragPreviewRenderer, R as ListDragPreviewSourceResolver, V as
|
|
|
2
2
|
import { a as ViewStateBase, t as GetViewStateOptions } from "./types-LU1u0CB8.js";
|
|
3
3
|
import "./index-9ttcdwlL.js";
|
|
4
4
|
import { n as ListViewportChangeEvent } from "./list-viewport-types-BRZsLcvp.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { h as ListSelectionMode, i as ListInteractionMode, r as ListElementEventMap } from "./list-selection-types-Dnamh2Lu.js";
|
|
6
|
+
import { S as ListSearchController } from "./index-Bm9a9S3_.js";
|
|
7
7
|
import "./editable-label-rzXkjf1H.js";
|
|
8
8
|
import { LitElement, PropertyValues } from "lit";
|
|
9
9
|
import { CommandId, CommandRegistry } from "@clinth/ui-commands";
|
|
@@ -262,6 +262,15 @@ declare class VerticalListElement extends LitElement {
|
|
|
262
262
|
selectAll(): void;
|
|
263
263
|
/** The selection as stable `data-key` / `data-value` strings. */
|
|
264
264
|
get selectedKeys(): ReadonlySet<string>;
|
|
265
|
+
/**
|
|
266
|
+
* Rows shown as *partially* selected (a part of the resource is selected):
|
|
267
|
+
* `data-partial`, an indeterminate checkbox in `checked` mode, and an
|
|
268
|
+
* accessible description. Independent of `selectedKeys` — a key in both
|
|
269
|
+
* counts as selected. Replace-on-set; keys without a row are kept for when
|
|
270
|
+
* the row appears.
|
|
271
|
+
*/
|
|
272
|
+
get partialKeys(): ReadonlySet<string>;
|
|
273
|
+
set partialKeys(keys: Iterable<string>);
|
|
265
274
|
/** The key of the item under the cursor, or `undefined`. */
|
|
266
275
|
get tickledKey(): string | undefined;
|
|
267
276
|
/** Replace the selection with the items carrying these keys (unknown keys ignored). */
|
|
@@ -1,12 +1,13 @@
|
|
|
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, d as keysOfElements, i as ListSearchController, n as listSearchStyles, o as registerListSearchCommands, r as LIST_SEARCH_MODES, u as keyForElement } from "./incr-search-Dc6gYpJG.js";
|
|
5
5
|
import { i as animateListItemOut, r as animateListItemIn, t as ListNativeDragController } from "./list-native-drag-controller-CcXoS0YX.js";
|
|
6
|
-
import {
|
|
6
|
+
import { i as ListDragSelectController, n as gestureOf, t as ListSelectionController } from "./list-selection-controller-D4iIrvJH.js";
|
|
7
7
|
import { l as keysToArray } from "./pending-BGidHppL.js";
|
|
8
|
-
import {
|
|
8
|
+
import { i as sameKeySet, n as applyPartialAttributes, r as isPartialKey } from "./partial-keys-Ck6CiprB.js";
|
|
9
9
|
import { t as scrollFadeStyles } from "./scroll-fade-Xx28D7mH.js";
|
|
10
|
+
import { a as restoreElementScroll, n as anchorFromRow, o as scrollToOffset, r as captureElementScroll, t as ViewStateController } from "./view-state-controller-BdyXWUUM.js";
|
|
10
11
|
import { n as appearanceColor, t as appearanceAbsent } from "./item-appearance-BjcMyauw.js";
|
|
11
12
|
import "./editable-label.js";
|
|
12
13
|
import { LitElement, css, html, render } from "lit";
|
|
@@ -153,13 +154,15 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
153
154
|
interactionMode: this.interactionMode
|
|
154
155
|
}),
|
|
155
156
|
getKey: keyForElement,
|
|
157
|
+
onIntent: (intent) => this._dispatchCancelable(`list-select-intent`, intent) === false,
|
|
156
158
|
onChange: (selected, previous) => {
|
|
157
159
|
this._syncItemStates();
|
|
158
160
|
this.#viewState.notify();
|
|
159
161
|
this._dispatch(`list-select`, {
|
|
160
162
|
selected,
|
|
161
163
|
previous,
|
|
162
|
-
selectedKeys: this.selection.selectedKeys
|
|
164
|
+
selectedKeys: this.selection.selectedKeys,
|
|
165
|
+
previousKeys: keysOfElements(previous)
|
|
163
166
|
});
|
|
164
167
|
}
|
|
165
168
|
});
|
|
@@ -245,6 +248,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
245
248
|
getAllItems: () => this.#selectionOrder(),
|
|
246
249
|
observeContainer: false
|
|
247
250
|
}) });
|
|
251
|
+
this.#partialKeys = /* @__PURE__ */ new Set();
|
|
248
252
|
this.#onScroll = () => {
|
|
249
253
|
if (!this.#viewState.pendingScroll) this.#viewState.notify();
|
|
250
254
|
if (this.#scrollRaf !== 0) return;
|
|
@@ -275,7 +279,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
275
279
|
if ((e.ctrlKey || e.metaKey) && e.key === `a`) {
|
|
276
280
|
if (this.selection.canSelectAll()) {
|
|
277
281
|
e.preventDefault();
|
|
278
|
-
this.selection.selectAll();
|
|
282
|
+
this.selection.selectAll(`keyboard`);
|
|
279
283
|
}
|
|
280
284
|
return;
|
|
281
285
|
}
|
|
@@ -284,18 +288,18 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
284
288
|
e.preventDefault();
|
|
285
289
|
this.tickled.handleKeyboardNavigation(`next`);
|
|
286
290
|
this.#revealCursor();
|
|
287
|
-
if (e.shiftKey && this.interactionMode === `vscode`) {
|
|
291
|
+
if (e.shiftKey && (this.interactionMode === `vscode` || this.interactionMode === `manual`)) {
|
|
288
292
|
const cur = this.tickled.tickledId;
|
|
289
|
-
if (cur) this.selection.
|
|
293
|
+
if (cur) this.selection.handleExtend(cur);
|
|
290
294
|
}
|
|
291
295
|
break;
|
|
292
296
|
case `ArrowUp`:
|
|
293
297
|
e.preventDefault();
|
|
294
298
|
this.tickled.handleKeyboardNavigation(`previous`);
|
|
295
299
|
this.#revealCursor();
|
|
296
|
-
if (e.shiftKey && this.interactionMode === `vscode`) {
|
|
300
|
+
if (e.shiftKey && (this.interactionMode === `vscode` || this.interactionMode === `manual`)) {
|
|
297
301
|
const cur = this.tickled.tickledId;
|
|
298
|
-
if (cur) this.selection.
|
|
302
|
+
if (cur) this.selection.handleExtend(cur);
|
|
299
303
|
}
|
|
300
304
|
break;
|
|
301
305
|
case `Home`:
|
|
@@ -321,7 +325,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
321
325
|
if (id) {
|
|
322
326
|
e.preventDefault();
|
|
323
327
|
this._dispatch(`list-item-click`, { item: id });
|
|
324
|
-
this._activateItem(id);
|
|
328
|
+
this._activateItem(id, `keyboard`);
|
|
325
329
|
}
|
|
326
330
|
break;
|
|
327
331
|
}
|
|
@@ -333,7 +337,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
333
337
|
}
|
|
334
338
|
break;
|
|
335
339
|
}
|
|
336
|
-
case `Escape`: this.selection.
|
|
340
|
+
case `Escape`: this.selection.handleClear(`keyboard`);
|
|
337
341
|
}
|
|
338
342
|
};
|
|
339
343
|
this._onClick = (e) => {
|
|
@@ -342,7 +346,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
342
346
|
const item = this._findListItem(e.composedPath());
|
|
343
347
|
if (!item) return;
|
|
344
348
|
this._dispatch(`list-item-click`, { item });
|
|
345
|
-
this.selection.handleClick(item, e);
|
|
349
|
+
this.selection.handleClick(item, gestureOf(e));
|
|
346
350
|
};
|
|
347
351
|
this._onDblClick = (e) => {
|
|
348
352
|
if (this.#isEditEvent(e)) return;
|
|
@@ -773,6 +777,23 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
773
777
|
get selectedKeys() {
|
|
774
778
|
return this.selection.selectedKeys;
|
|
775
779
|
}
|
|
780
|
+
#partialKeys;
|
|
781
|
+
/**
|
|
782
|
+
* Rows shown as *partially* selected (a part of the resource is selected):
|
|
783
|
+
* `data-partial`, an indeterminate checkbox in `checked` mode, and an
|
|
784
|
+
* accessible description. Independent of `selectedKeys` — a key in both
|
|
785
|
+
* counts as selected. Replace-on-set; keys without a row are kept for when
|
|
786
|
+
* the row appears.
|
|
787
|
+
*/
|
|
788
|
+
get partialKeys() {
|
|
789
|
+
return this.#partialKeys;
|
|
790
|
+
}
|
|
791
|
+
set partialKeys(keys) {
|
|
792
|
+
const next = new Set(keys);
|
|
793
|
+
if (sameKeySet(next, this.#partialKeys)) return;
|
|
794
|
+
this.#partialKeys = next;
|
|
795
|
+
this._syncItemStates();
|
|
796
|
+
}
|
|
776
797
|
/** The key of the item under the cursor, or `undefined`. */
|
|
777
798
|
get tickledKey() {
|
|
778
799
|
const id = this.tickled.tickledId;
|
|
@@ -1468,6 +1489,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1468
1489
|
const item = this.#customWrappers.get(el) ?? el;
|
|
1469
1490
|
el.toggleAttribute(`data-tickled`, this.tickled.isTickled(el));
|
|
1470
1491
|
el.toggleAttribute(`data-selected`, this.selection.selected.has(el));
|
|
1492
|
+
applyPartialAttributes(el, isPartialKey(keyForElement(el), this.#partialKeys, this.selection.selected.has(el)));
|
|
1471
1493
|
if (el.hasAttribute(`data-aria-role`)) el.setAttribute(`aria-selected`, String(this.selection.selected.has(el)));
|
|
1472
1494
|
if (this.interactionMode === `checked`) el.toggleAttribute(`data-checked`, !item.hasAttribute(`not-checked`) && this.selection.selected.has(el));
|
|
1473
1495
|
else el.removeAttribute(`data-checked`);
|
|
@@ -1532,16 +1554,22 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1532
1554
|
el.prepend(cb);
|
|
1533
1555
|
}
|
|
1534
1556
|
const checked = this.selection.selected.has(el);
|
|
1557
|
+
const partial = isPartialKey(keyForElement(el), this.#partialKeys, checked);
|
|
1535
1558
|
if (wantsCustom) {
|
|
1536
|
-
cb.setAttribute(`aria-checked`, String(checked));
|
|
1559
|
+
cb.setAttribute(`aria-checked`, partial ? `mixed` : String(checked));
|
|
1537
1560
|
cb.toggleAttribute(`data-checked`, checked);
|
|
1561
|
+
cb.toggleAttribute(`data-partial`, partial);
|
|
1538
1562
|
if (this.checkboxRenderer) {
|
|
1539
1563
|
const renderer = typeof this.checkboxRenderer === `function` ? this.checkboxRenderer : this.checkboxRenderer.renderer;
|
|
1540
1564
|
render(renderer(checked), cb);
|
|
1541
1565
|
}
|
|
1542
1566
|
} else {
|
|
1543
1567
|
const input = cb.querySelector(`input.ixfx-list-checkbox`);
|
|
1544
|
-
if (input)
|
|
1568
|
+
if (input) {
|
|
1569
|
+
input.checked = checked;
|
|
1570
|
+
input.indeterminate = partial;
|
|
1571
|
+
}
|
|
1572
|
+
cb.setAttribute(`aria-checked`, partial ? `mixed` : String(checked));
|
|
1545
1573
|
}
|
|
1546
1574
|
}
|
|
1547
1575
|
}
|
|
@@ -1560,7 +1588,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1560
1588
|
cell.setAttribute(`part`, `checkbox`);
|
|
1561
1589
|
cell.addEventListener(`click`, (e) => {
|
|
1562
1590
|
e.stopPropagation();
|
|
1563
|
-
this.selection.
|
|
1591
|
+
this.selection.handleCheckbox(el);
|
|
1564
1592
|
});
|
|
1565
1593
|
const input = document.createElement(`input`);
|
|
1566
1594
|
input.type = `checkbox`;
|
|
@@ -1582,7 +1610,7 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1582
1610
|
span.setAttribute(`part`, `checkbox`);
|
|
1583
1611
|
span.addEventListener(`click`, (e) => {
|
|
1584
1612
|
e.stopPropagation();
|
|
1585
|
-
this.selection.
|
|
1613
|
+
this.selection.handleCheckbox(el);
|
|
1586
1614
|
});
|
|
1587
1615
|
return span;
|
|
1588
1616
|
}
|
|
@@ -1608,13 +1636,13 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1608
1636
|
cancelable: true
|
|
1609
1637
|
}));
|
|
1610
1638
|
}
|
|
1611
|
-
_activateItem(item) {
|
|
1612
|
-
|
|
1639
|
+
_activateItem(item, source = `pointer`) {
|
|
1640
|
+
this.selection.handleReplace(item, source);
|
|
1613
1641
|
this._dispatch(`list-activate`, { item });
|
|
1614
1642
|
}
|
|
1615
1643
|
activateKey(key) {
|
|
1616
1644
|
const item = this.#itemForKey(key);
|
|
1617
|
-
if (item) this._activateItem(item);
|
|
1645
|
+
if (item) this._activateItem(item, `api`);
|
|
1618
1646
|
}
|
|
1619
1647
|
/** The row (or `undefined` for empty space) the last `list-drag-over` was fired for. */
|
|
1620
1648
|
#dragOver;
|
|
@@ -1862,6 +1890,13 @@ let VerticalListElement = class VerticalListElement extends LitElement {
|
|
|
1862
1890
|
outline: 1px solid transparent;
|
|
1863
1891
|
}
|
|
1864
1892
|
|
|
1893
|
+
/* Partially selected: a dashed edge, lighter than a full selection. Hook: --item-bg-partial. */
|
|
1894
|
+
::slotted([data-partial]) {
|
|
1895
|
+
background: var(--item-bg-partial, color-mix(in srgb, var(--item-bg-selected) 35%, transparent));
|
|
1896
|
+
outline: 1px dashed var(--item-border-partial, var(--border));
|
|
1897
|
+
outline-offset: -1px;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1865
1900
|
::slotted([data-selected][data-tickled]) {
|
|
1866
1901
|
background: var(--item-bg-selected-tickled);
|
|
1867
1902
|
outline: 2px dashed var(--surface-3);
|
package/dist/vertical-list.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { B as ListNativeDragStartDetail, F as ListDragPreview, I as ListDragPreviewContext, L as ListDragPreviewRenderer, P as ListDragEntry, V as ListNativeDragStartEvent, z as ListDragSource } from "./tree-component-DgfkxmVY.js";
|
|
2
2
|
import { n as ListViewportChangeEvent, t as ListViewportChangeDetail } from "./list-viewport-types-BRZsLcvp.js";
|
|
3
|
-
import { a as ListItemClickDetail, c as
|
|
4
|
-
import { a as VerticalListViewState, c as ListDragLeaveDetail, d as ListDropDetail, f as ListDropEvent, g as ListEditCommitEvent, h as ListEditCommitDetail, i as VerticalListElementEventMap, l as ListDragLeaveEvent, m as ListEditCancelEvent, n as CustomCheckboxOptions, o as ListContextMenuDetail, p as ListEditCancelDetail, r as VerticalListElement, s as ListContextMenuEvent, t as AddItemOptions, u as ListDragOverEvent } from "./vertical-list-
|
|
3
|
+
import { _ as ListTickleEvent, a as ListItemClickDetail, c as ListSelectDetail, g as ListTickleDetail, h as ListSelectionMode, i as ListInteractionMode, l as ListSelectEvent, n as ListActivateEvent, o as ListItemClickEvent, r as ListElementEventMap, t as ListActivateDetail } from "./list-selection-types-Dnamh2Lu.js";
|
|
4
|
+
import { a as VerticalListViewState, c as ListDragLeaveDetail, d as ListDropDetail, f as ListDropEvent, g as ListEditCommitEvent, h as ListEditCommitDetail, i as VerticalListElementEventMap, l as ListDragLeaveEvent, m as ListEditCancelEvent, n as CustomCheckboxOptions, o as ListContextMenuDetail, p as ListEditCancelDetail, r as VerticalListElement, s as ListContextMenuEvent, t as AddItemOptions, u as ListDragOverEvent } from "./vertical-list-DtHX26JO.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, type VerticalListViewState };
|