-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP]: S2 treeview haschildnodes #7694
base: s2-treeview-api-update
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -398,7 +398,7 @@ export class SelectionManager implements MultipleSelectionManager { | |
} | ||
|
||
// Add child keys. If cell selection is allowed, then include item children too. | ||
if (item?.hasChildNodes && (this.allowsCellSelection || item.type !== 'item')) { | ||
if (item && (item?.firstChildKey === undefined ? item?.hasChildNodes : item?.firstChildKey != null) && (this.allowsCellSelection || item.type !== 'item')) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. have to account for old collections which don't have |
||
addKeys(getFirstItem(getChildNodes(item, this.collection))?.key ?? null); | ||
} | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -215,6 +215,10 @@ export interface Node<T> { | |
prevKey?: Key | null, | ||
/** The key of the node after this node. */ | ||
nextKey?: Key | null, | ||
/** The key of the first child node. */ | ||
firstChildKey?: Key | null, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok to expose these? doesn't match old collections |
||
/** The key of the last child node. */ | ||
lastChildKey?: Key | null, | ||
/** Additional properties specific to a particular node type. */ | ||
props?: any, | ||
/** @private */ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,7 +58,7 @@ class TableCollection<T> extends BaseCollection<T> implements ITableCollection<T | |
switch (node.type) { | ||
case 'column': | ||
columnKeyMap.set(node.key, node); | ||
if (!node.hasChildNodes) { | ||
if (node.firstChildKey == null) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is technically what the old check was, is this still actually what we want to check, it's a bit of a strange check |
||
node.index = this.columns.length; | ||
this.columns.push(node); | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this really a valid assumption? what about branch children? other types of items?