{ active_cell_menu = null; active_header_menu = null; }} />
{#if (label && label.length !== 0 && show_label) || (buttons === null ? true : buttons.includes("fullscreen")) || (buttons === null ? true : buttons.includes("copy")) || show_search !== "none"}
{#if label && label.length !== 0 && show_label}

{label}

{/if} handle_search(query)} {onfullscreen} on_commit_filter={commit_filter} current_search_query={global_filter || null} />
{/if}
{#if label && label.length !== 0} {label} {/if} {#if show_row_numbers} {/if} {#each header_groups as headerGroup (headerGroup.id)} {#each headerGroup.headers as header (header.id)} {@const col_idx = (header.column.columnDef.meta as any)?.colIndex ?? 0} 1} is_filtered={get_filter_active(col_idx)} show_menu_button={col_count[1] === "dynamic"} is_first_column={col_idx === 0 && !show_row_numbers} {latex_delimiters} {line_breaks} {editable} {max_chars} {i18n} onclick={handle_header_click} on_menu_click={toggle_header_menu} on_end_edit={end_header_edit} /> {/each} {/each} {#if rows.length > 0} {@const sizing_row = rows.reduce((widest, row) => { const cells = row.getVisibleCells(); cells.forEach((cell, i) => { const val = String(cell.getValue() ?? ""); if (!widest[i] || val.length > widest[i].length) { widest[i] = val; } }); return widest; }, [] as string[])} {#if show_row_numbers} {/if} {#each sizing_row as val, ci} {@const dtype = get_dtype(ci)} {/each} {/if}
 
{#each virtual_items as virtual_row (virtual_row.key)} {@const row = rows[virtual_row.index]} {@const row_idx = row?.original._index ?? virtual_row.index} {#if row}
{#if show_row_numbers}
{row_idx + 1}
{/if} {#each row.getVisibleCells() as cell, ci (cell.id)} {@const col_idx = (cell.column.columnDef.meta as any)?.colIndex ?? 0} {@const is_sel = is_cell_in_selection( [row_idx, col_idx], selected_cells )} handle_cell_click(e, row_idx, col_idx)} ondblclick={(e) => handle_cell_dblclick(e, row_idx, col_idx)} oncontextmenu={(e) => { e.preventDefault(); toggle_cell_menu(e, row_idx, col_idx); }} onblur={handle_blur} on_menu_click={(e) => toggle_cell_menu(e, row_idx, col_idx)} on_select_column={(c) => { selected_cells = rows.map( (_, r) => [r, c] as CellCoordinate ); selected = selected_cells[0]; }} on_select_row={(r) => { selected_cells = resolved_headers.map( (_, c) => [r, c] as CellCoordinate ); selected = selected_cells[0]; }} /> {/each}
{/if} {/each}
{#if show_scroll_button} {/if}
{#if active_cell_menu || active_header_menu} add_row_at(active_cell_menu?.row ?? -1, "above")} on_add_row_below={() => add_row_at(active_cell_menu?.row ?? -1, "below")} on_add_column_left={() => add_col_at( active_cell_menu?.col ?? active_header_menu?.col ?? -1, "left" )} on_add_column_right={() => add_col_at( active_cell_menu?.col ?? active_header_menu?.col ?? -1, "right" )} on_delete_row={() => delete_row_at(active_cell_menu?.row ?? -1)} on_delete_col={() => delete_col_at(active_cell_menu?.col ?? active_header_menu?.col ?? -1)} {editable} can_delete_rows={!active_header_menu && values.length > 1 && editable} can_delete_cols={values.length > 0 && (values[0]?.length ?? 0) > 1 && editable} {i18n} on_sort={active_header_menu ? (direction) => { handle_sort(active_header_menu!.col, direction); active_header_menu = null; } : undefined} on_clear_sort={active_header_menu ? () => { clear_sort(); active_header_menu = null; } : undefined} sort_direction={active_header_menu ? get_sort_info(active_header_menu.col).direction : null} sort_priority={active_header_menu ? get_sort_info(active_header_menu.col).priority : null} on_filter={active_header_menu ? (dtype, filter, fvalue) => { handle_filter(active_header_menu!.col, dtype, filter, fvalue); active_header_menu = null; } : undefined} on_clear_filter={active_header_menu ? () => { clear_filter(); active_header_menu = null; } : undefined} filter_active={active_header_menu ? get_filter_active(active_header_menu.col) : null} /> {/if} {#if values.length === 0 && editable && row_count[1] === "dynamic"} add_row()} /> {/if}