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

add cell tab in table inspector for showing cell content #2778

Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import type { ComponentType } from 'svelte';
import ColumnMode from './column/ColumnMode.svelte';
import RecordMode from './record/RecordMode.svelte';
import CellMode from './cell/CellMode.svelte';

import TableMode from './table/TableMode.svelte';

Expand All @@ -24,6 +25,11 @@
component: RecordMode,
id: 3,
},
{
label: 'Cell',
component: CellMode,
id: 4,
},
];

let activeTab: TabItem;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<script lang="ts">

Check failure on line 1 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
import { getTabularDataStoreFromContext } from '@mathesar/stores/table-data';

Check failure on line 2 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
import CellFabric from '@mathesar/components/cell-fabric/CellFabric.svelte';

Check failure on line 3 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected 1 empty line after import statement not followed by another import

Check failure on line 3 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
const tabularData = getTabularDataStoreFromContext();

Check failure on line 4 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
$: ({ selection, recordsData, processedColumns } = $tabularData);

Check failure on line 5 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
$: ({ activeCell } = selection);

Check failure on line 6 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
$: cell = $activeCell;

Check failure on line 7 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
$: selectedCellValue = (() => {

Check failure on line 8 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
if (cell) {

Check failure on line 9 in mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte

View workflow job for this annotation

GitHub Actions / lint

Expected linebreaks to be 'LF' but found 'CRLF'
const rows = recordsData.getRecordRows();
if (rows[cell.rowIndex]) {
return rows[cell.rowIndex].record[cell.columnId];
}
}
return undefined;
})();
$: column = (() => {
if (cell) {
const processedColumn = $processedColumns.get(Number(cell.columnId));
if (processedColumn) {
return processedColumn;
}
}
return undefined;
})();
</script>

<div class="section-content">
{#if selectedCellValue !== undefined}
<section class="cell-content">
<header>Content</header>
<div class="content">
{#if column}
<CellFabric
isIndependentOfSheet={true}
disabled={true}
columnFabric={column}
value={selectedCellValue}
/>
{/if}
</div>
</section>
{:else}
Select a cell to view it's properties.
{/if}
</div>

<style lang="scss">
.section-content {
padding: var(--size-x-small);
.cell-content {
header {
font-weight: 500;
}
.content {
word-wrap: anywhere;
border: 1px solid var(--slate-300);
padding: var(--size-xx-small);
border-radius: var(--border-radius-m);
margin-top: var(--size-x-small);
}
}
}
</style>