@oicl/openbridge-webcomponents-full-bundle 2.0.0-next.153 → 2.0.0-next.154

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -197,6 +197,9 @@ export type ObcTableExpandToggleEvent = CustomEvent<{
197
197
  expanded: boolean;
198
198
  }>;
199
199
 
200
+ const INTERACTIVE_SELECTOR =
201
+ 'button, a[href], input, select, textarea, [role="button"], [role="link"], [role="checkbox"]';
202
+
200
203
  function cssPart(value: ObcTableCellData, subpart: string): string | undefined {
201
204
  if (value.cssPart) {
202
205
  return `${value.cssPart} ${subpart}`;
@@ -397,7 +400,16 @@ export class ObcTable extends LitElement {
397
400
  }
398
401
  }
399
402
 
400
- private _handleRowClick(row: ObcTableRow) {
403
+ private _handleRowClick(event: MouseEvent, row: ObcTableRow) {
404
+ const rowElement = event.currentTarget;
405
+ for (const node of event.composedPath()) {
406
+ if (node === rowElement) break;
407
+ // Stopping propagation in the cell instead would break listeners
408
+ // delegated to the document, such as Svelte's.
409
+ if (node instanceof Element && node.matches(INTERACTIVE_SELECTOR)) {
410
+ return;
411
+ }
412
+ }
401
413
  this.dispatchEvent(
402
414
  new CustomEvent('row-click', {detail: {row}}) as ObcTableRowClickEvent
403
415
  );
@@ -883,7 +895,8 @@ export class ObcTable extends LitElement {
883
895
  'selected-with-next': isRowSelected && hasSelectedNextRow,
884
896
  striped: isStriped,
885
897
  })}
886
- @click=${() => this._handleRowClick(row)}
898
+ @click=${(event: MouseEvent) =>
899
+ this._handleRowClick(event, row)}
887
900
  @keydown=${this._handleRowKeyDown}
888
901
  data-row-id=${row.id}
889
902
  style="grid-row: ${rowIndex + 1}"