Returns the next sort direction of the active sortable, checking for potential overrides.
(sortable: MatSortable)
| 171 | |
| 172 | /** Returns the next sort direction of the active sortable, checking for potential overrides. */ |
| 173 | getNextSortDirection(sortable: MatSortable): SortDirection { |
| 174 | if (!sortable) { |
| 175 | return ''; |
| 176 | } |
| 177 | |
| 178 | // Get the sort direction cycle with the potential sortable overrides. |
| 179 | const disableClear = |
| 180 | sortable?.disableClear ?? this.disableClear ?? !!this._defaultOptions?.disableClear; |
| 181 | let sortDirectionCycle = getSortDirectionCycle(sortable.start || this.start, disableClear); |
| 182 | |
| 183 | // Get and return the next direction in the cycle |
| 184 | let nextDirectionIndex = sortDirectionCycle.indexOf(this.direction) + 1; |
| 185 | if (nextDirectionIndex >= sortDirectionCycle.length) { |
| 186 | nextDirectionIndex = 0; |
| 187 | } |
| 188 | return sortDirectionCycle[nextDirectionIndex]; |
| 189 | } |
| 190 | |
| 191 | ngOnInit() { |
| 192 | this._initializedStream.next(); |
no test coverage detected