FilterTreeService
Defined in: filtering/tree/filter-tree.service.ts:55
Pure tree-manipulation service used by the filter-tree UI.
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new FilterTreeService():
FilterTreeService
Returns
Section titled “Returns”FilterTreeService
Methods
Section titled “Methods”applyDrop()
Section titled “applyDrop()”applyDrop(
root,dragId,position):FilterNode
Defined in: filtering/tree/filter-tree.service.ts:66
Apply a drop operation to the tree and return a new root.
Deep-clones the incoming root first so the caller’s reference is never mutated. All splice / replace operations happen on the clone.
Parameters
Section titled “Parameters”dragId
Section titled “dragId”string
position
Section titled “position”Returns
Section titled “Returns”canRedo()
Section titled “canRedo()”canRedo(
history):boolean
Defined in: filtering/tree/filter-tree.service.ts:179
Parameters
Section titled “Parameters”history
Section titled “history”Returns
Section titled “Returns”boolean
canUndo()
Section titled “canUndo()”canUndo(
history):boolean
Defined in: filtering/tree/filter-tree.service.ts:175
Parameters
Section titled “Parameters”history
Section titled “history”Returns
Section titled “Returns”boolean
commitState()
Section titled “commitState()”commitState(
history,newRoot):FilterTreeHistory
Defined in: filtering/tree/filter-tree.service.ts:152
Push a new tree state onto the history stack. Truncates any redo states beyond the current index.
Parameters
Section titled “Parameters”history
Section titled “history”newRoot
Section titled “newRoot”Returns
Section titled “Returns”currentRoot()
Section titled “currentRoot()”currentRoot(
history):FilterNode
Defined in: filtering/tree/filter-tree.service.ts:171
The tree at the current history position.
Parameters
Section titled “Parameters”history
Section titled “history”Returns
Section titled “Returns”deleteNode()
Section titled “deleteNode()”deleteNode(
root,nodeId):FilterNode
Defined in: filtering/tree/filter-tree.service.ts:131
Delete a node from the tree by ID.
Deep-clones the tree first, extracts the target node from the clone, enforces the >=2-children invariant, then returns the clone.
Parameters
Section titled “Parameters”nodeId
Section titled “nodeId”string
Returns
Section titled “Returns”initHistory()
Section titled “initHistory()”initHistory(
root):FilterTreeHistory
Defined in: filtering/tree/filter-tree.service.ts:144
Create a fresh history with a single initial state.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”redo()
Section titled “redo()”redo(
history):FilterTreeHistory|null
Defined in: filtering/tree/filter-tree.service.ts:165
Step forward one state. Returns null if already at the end.
Parameters
Section titled “Parameters”history
Section titled “history”Returns
Section titled “Returns”FilterTreeHistory | null
toggleConjunction()
Section titled “toggleConjunction()”toggleConjunction(
root,branchId):FilterNode
Defined in: filtering/tree/filter-tree.service.ts:116
Toggle a branch’s conjunction between ”&&” and ”||”. Deep-clones the tree first so the original is never mutated.
Parameters
Section titled “Parameters”branchId
Section titled “branchId”string
Returns
Section titled “Returns”undo()
Section titled “undo()”undo(
history):FilterTreeHistory|null
Defined in: filtering/tree/filter-tree.service.ts:159
Step back one state. Returns null if already at the beginning.
Parameters
Section titled “Parameters”history
Section titled “history”Returns
Section titled “Returns”FilterTreeHistory | null