@rivet-health/design-system 41.2.2 → 41.2.4

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.
@@ -16320,6 +16320,10 @@ var RivTableClipboard;
16320
16320
  return target instanceof Element && target.closest(editableSelector) !== null;
16321
16321
  }
16322
16322
  RivTableClipboard.isEditable = isEditable;
16323
+ function selectsTextIn(selection, element) {
16324
+ return !!selection && !selection.isCollapsed && [selection.anchorNode, selection.focusNode].some((node) => !!node && element.contains(node));
16325
+ }
16326
+ RivTableClipboard.selectsTextIn = selectsTextIn;
16323
16327
  function ownsSelection(host, isSelected) {
16324
16328
  return Array.from(document.querySelectorAll(host.localName)).find((element) => isSelected(element)) === host;
16325
16329
  }
@@ -16417,6 +16421,7 @@ var TableComponent = class TableComponent {
16417
16421
  this.selectionCalloutPosition = this.containerSize.pipe(map((rect) => new DOMRect(rect.x + 44, rect.y - 12, 0, 0)));
16418
16422
  this.hoveredRow = null;
16419
16423
  this.rowHoverCleanup = null;
16424
+ this.rowLinkSelectionCleanup = null;
16420
16425
  this.handleDragOver = (event) => {
16421
16426
  const target = event.target;
16422
16427
  if (this.draggedOverColumnIdx != null && target.closest(".drop-zone")) event.preventDefault();
@@ -16456,10 +16461,12 @@ var TableComponent = class TableComponent {
16456
16461
  });
16457
16462
  document.addEventListener("dragover", this.handleDragOver);
16458
16463
  this.setupRowSpanHover();
16464
+ this.rowLinkSelectionCleanup = this.preserveTextSelectionInRowLinks();
16459
16465
  }
16460
16466
  ngOnDestroy() {
16461
16467
  document.removeEventListener("dragover", this.handleDragOver);
16462
16468
  this.rowHoverCleanup?.();
16469
+ this.rowLinkSelectionCleanup?.();
16463
16470
  this.destroy.next(null);
16464
16471
  }
16465
16472
  setWidth(column, width) {
@@ -16609,6 +16616,19 @@ var TableComponent = class TableComponent {
16609
16616
  };
16610
16617
  });
16611
16618
  }
16619
+ preserveTextSelectionInRowLinks() {
16620
+ const host = this.elementRef.nativeElement;
16621
+ const onClick = (event) => {
16622
+ if (!(event.target instanceof Element) || event.ctrlKey || event.metaKey || event.target.closest("button, input, select, textarea, label, [role=\"button\"], td.selection-body, td.menu-body")) return;
16623
+ const row = event.target.closest("a.row-link");
16624
+ if (row && RivTableClipboard.selectsTextIn(document.getSelection(), row)) {
16625
+ event.preventDefault();
16626
+ event.stopPropagation();
16627
+ }
16628
+ };
16629
+ this.zone.runOutsideAngular(() => host.addEventListener("click", onClick, true));
16630
+ return () => host.removeEventListener("click", onClick, true);
16631
+ }
16612
16632
  applyRowSpanHover(row) {
16613
16633
  this.forEachCoveringRowSpanCell(row, (cell) => cell.classList.add("rs-hover"));
16614
16634
  }