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 all 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 recordPk={rowKey} {recordsData} {row} />
</ContextMenu>
{/if}
</div>
Expand Down Expand Up @@ -136,6 +136,7 @@
bind:value={row.record[columnId]}
{processedColumn}
{recordsData}
{rowKey}
/>
{/each}
{/if}
Expand Down
15 changes: 12 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 Down Expand Up @@ -32,6 +33,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 +45,7 @@
export let processedColumn: ProcessedColumn;
export let clientSideErrorMap: WritableMap<CellKey, string[]>;
export let value: unknown = undefined;
export let rowKey: string;

const userProfile = getUserProfileStoreFromContext();

Expand Down Expand Up @@ -107,7 +111,6 @@
if (type) {
originalEvent.stopPropagation();
originalEvent.preventDefault();

await checkTypeAndScroll(type);
}
}
Expand Down Expand Up @@ -196,6 +199,14 @@
Go To Linked Record
</LinkMenuItem>
{/if}
<MenuDivider />
<!-- Column Attributes -->
<ColumnHeaderContextMenu {processedColumn} />
<!-- Column Attributes end -->
<MenuDivider />
<!-- Row -->
<RowContextOptions recordPk={rowKey} {recordsData} {row} />
<!-- Row end -->
</ContextMenu>
{#if errors.length}
<CellErrors {errors} forceShowErrors={isActive} />
Expand All @@ -207,14 +218,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 recordPk: string;
export let recordsData: RecordsData;

const userProfile = getUserProfileStoreFromContext();
Expand Down Expand Up @@ -46,7 +46,7 @@
</script>

<LinkMenuItem
href={$storeToGetRecordPageUrl({ recordId }) || ''}
href={$storeToGetRecordPageUrl({ recordId: recordPk }) || ''}
icon={iconExternalLink}
>
Go to Record Page
Expand Down