Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Showed both row and column level context menu options in the cell level #2728 #2803

Merged
merged 16 commits into from
Apr 17, 2023
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion mathesar_ui/src/systems/table-view/row/Row.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
hasErrors={hasAnyErrors}
/>
<ContextMenu>
<RowContextOptions recordId={Number(rowKey)} {recordsData} {row} />
<RowContextOptions recordId={String(rowKey)} {recordsData} {row} />
</ContextMenu>
{/if}
</div>
Expand Down Expand Up @@ -136,6 +136,7 @@
bind:value={row.record[columnId]}
{processedColumn}
{recordsData}
{primaryKeyColumnId}
/>
{/each}
{/if}
Expand Down
17 changes: 14 additions & 3 deletions mathesar_ui/src/systems/table-view/row/RowCell.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
ButtonMenuItem,
LinkMenuItem,
WritableMap,
MenuDivider,
} from '@mathesar-component-library';
import {
rowHasNewRecord,
Expand All @@ -13,6 +14,7 @@
type CellKey,
type ProcessedColumn,
type TabularDataSelection,
getRowKey,
} from '@mathesar/stores/table-data';
import {
isCellActive,
Expand All @@ -32,6 +34,8 @@
import { currentDatabase } from '@mathesar/stores/databases';
import { currentSchema } from '@mathesar/stores/schemas';
import CellErrors from './CellErrors.svelte';
import ColumnHeaderContextMenu from '../header/header-cell/ColumnHeaderContextMenu.svelte';
import RowContextOptions from './RowContextOptions.svelte';

export let recordsData: RecordsData;
export let selection: TabularDataSelection;
Expand All @@ -42,6 +46,7 @@
export let processedColumn: ProcessedColumn;
export let clientSideErrorMap: WritableMap<CellKey, string[]>;
export let value: unknown = undefined;
export let primaryKeyColumnId: number | undefined;

const userProfile = getUserProfileStoreFromContext();

Expand All @@ -58,6 +63,7 @@
$: columnId = column.id;
$: ({ activeCell, selectedCells } = selection);
$: isActive = $activeCell && isCellActive($activeCell, row, processedColumn);
$: rowKey = getRowKey(row, primaryKeyColumnId);

/**
* The name indicates that this boolean is only true when more than one cell
Expand Down Expand Up @@ -107,7 +113,6 @@
if (type) {
originalEvent.stopPropagation();
originalEvent.preventDefault();

await checkTypeAndScroll(type);
}
}
Expand Down Expand Up @@ -191,6 +196,14 @@
>
Set to <Null />
</ButtonMenuItem>
<MenuDivider />
<!-- Column Attributes -->
<ColumnHeaderContextMenu {processedColumn} />
<!-- Column Attributes end -->
<MenuDivider />
<!-- Row -->
<RowContextOptions recordId={String(rowKey)} {recordsData} {row} />
<!-- Row end -->
{#if linkedRecordHref}
<LinkMenuItem icon={iconLinkToRecordPage} href={linkedRecordHref}>
Go To Linked Record
Expand All @@ -207,14 +220,12 @@
.editable-cell.cell {
user-select: none;
background: var(--cell-bg-color-base);

&.is-active {
z-index: var(--z-index__sheet__active-cell);
border-color: transparent;
min-height: 100%;
height: auto !important;
}

&.error,
&.is-processing {
color: var(--cell-text-color-processing);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import { currentSchema } from '@mathesar/stores/schemas';

export let row: RecordRow;
export let recordId: number;
export let recordId: string;
export let recordsData: RecordsData;

const userProfile = getUserProfileStoreFromContext();
Expand Down