/** Skip row-click expand when the user interacts with controls inside the row. */
export function isExpandRowInteractiveClick(target: EventTarget | null): boolean {
  if (!(target instanceof HTMLElement)) return false;
  return !!target.closest(
    '.action-btns, .el-button, .el-link, a, input, textarea, .el-input, .el-select, .el-checkbox, .el-switch, .el-dropdown',
  );
}

export function shouldToggleExpandOnRowClick(event: MouseEvent): boolean {
  const el = event.target as HTMLElement;
  if (el.closest('.el-table__expand-icon')) return false;
  return !isExpandRowInteractiveClick(event.target);
}

export function expandableTableRowClassName(): string {
  return 'row-expandable';
}
