(e: MouseEvent)
| 294 | } |
| 295 | |
| 296 | _onClickCapture(e: MouseEvent) { |
| 297 | if (!this._table || this.mode !== TableSelectionMode.Multiple) { |
| 298 | return; |
| 299 | } |
| 300 | |
| 301 | if (isHeaderSelectionCell(e)) { |
| 302 | this._stopRangeSelection(); |
| 303 | return; |
| 304 | } |
| 305 | |
| 306 | if (!isSelectionCell(e)) { |
| 307 | this._stopRangeSelection(); |
| 308 | return; |
| 309 | } |
| 310 | |
| 311 | const row = findRowInPath(e.composedPath()); |
| 312 | |
| 313 | if (e.shiftKey && this._rangeSelection?.isMouse) { |
| 314 | const startRow = this._rangeSelection.rows[0]; |
| 315 | const startIndex = this._table.rows.indexOf(startRow); |
| 316 | const endIndex = this._table.rows.indexOf(row); |
| 317 | |
| 318 | const selectionState = this.isSelected(startRow); |
| 319 | |
| 320 | // When doing a range selection and clicking on an already selected row, the checked status should not change |
| 321 | // Therefore, we need to manually set the checked attribute again, as clicking it would deselect it and leads to |
| 322 | // a visual inconsistency. |
| 323 | row.shadowRoot?.querySelector("#selection-component")?.toggleAttribute("checked", selectionState); |
| 324 | e.stopPropagation(); |
| 325 | |
| 326 | if (startIndex === -1 || endIndex === -1 || row.rowKey === startRow.rowKey || row.rowKey === this._rangeSelection.rows[this._rangeSelection.rows.length - 1].rowKey) { |
| 327 | return; |
| 328 | } |
| 329 | |
| 330 | const change = endIndex - startIndex; |
| 331 | this._handleRangeSelection(row, change); |
| 332 | } else if (row) { |
| 333 | this._startRangeSelection(row, !this.isSelected(row), true); |
| 334 | } |
| 335 | } |
| 336 | |
| 337 | /** |
| 338 | * Start the range selection and initialises the range selection state |
nothing calls this directly
no test coverage detected