Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4,189 changes: 2,167 additions & 2,022 deletions .pnp.cjs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed .yarn/cache/glob-npm-8.0.3-750f909025-50bcdea19d.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
7 changes: 5 additions & 2 deletions src/composables/selection/treeViewSelection.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,15 @@ export function useTreeViewSelection(treeModel, selectionMode, focusableNodeMode
}

/**
*
* Given a node that should remain selected, deselect another selected node.
* This is used only when one node at a time can be selected (Single/SelectionFollowsFocus).
* @param {TreeViewNode} node The node that should remain selected
*/
function exclusivelySelectNode(node) {
const nodeId = node[node.treeNodeSpec.idProperty];

depthFirstTraverse((current) => {
if (isSelected(current) && current.id !== node.id) {
if (isSelected(current) && current[current.treeNodeSpec.idProperty] !== nodeId) {
deselect(current);
return false;
}
Expand Down
26 changes: 26 additions & 0 deletions src/composables/selection/treeViewSelection.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,32 @@ describe('treeViewSelection.js', () => {
expect(nodes[0].children[0].treeNodeSpec.state.selected).to.be.true;
expect(nodes[1].treeNodeSpec.state.selected).to.be.false;
});

describe('and the nodes use a custom ID property', () => {

it('should deselect any nodes after the first (depth-first)', () => {
nodes = generateNodes(['sf', ['S'], 'S']);

nodes[0].newid = nodes[0].id;
nodes[0].treeNodeSpec.idProperty = 'newid';
delete nodes[0].id;
nodes[0].children[0].newid = nodes[0].children[0].id;
nodes[0].children[0].treeNodeSpec.idProperty = 'newid';
delete nodes[0].children[0].id;
nodes[1].newid = nodes[1].id;
nodes[1].treeNodeSpec.idProperty = 'newid';
delete nodes[1].id;

const selectionMode = ref(SelectionMode.Single);
const focusableNodeModel = ref(nodes[0]);
const { enforceSelectionMode } = useTreeViewSelection(ref(nodes), selectionMode, focusableNodeModel, emit);
enforceSelectionMode();

expect(nodes[0].treeNodeSpec.state.selected).to.be.false;
expect(nodes[0].children[0].treeNodeSpec.state.selected).to.be.true;
expect(nodes[1].treeNodeSpec.state.selected).to.be.false;
});
});
});

describe('and the selection mode is Selection Follows Focus', () => {
Expand Down
Loading