-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2778 from raunak-dev-edu/cell_contentin_table_ins…
…pector_Cell_tab add cell tab in table inspector for showing cell content
- Loading branch information
Showing
4 changed files
with
103 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
mathesar_ui/src/systems/table-view/table-inspector/cell/CellMode.svelte
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<script lang="ts"> | ||
/** | ||
* @file | ||
* | ||
* NOTICE: There is some code duplication between this file and | ||
* `CellTab.svelte` used for the data explorer. It might be good to resolve | ||
* this duplication at some point. In the mean time, be mindful of propagating | ||
* changes to both files as necessary. | ||
*/ | ||
import { getTabularDataStoreFromContext } from '@mathesar/stores/table-data'; | ||
import CellFabric from '@mathesar/components/cell-fabric/CellFabric.svelte'; | ||
const tabularData = getTabularDataStoreFromContext(); | ||
$: ({ selection, recordsData, processedColumns } = $tabularData); | ||
$: ({ activeCell } = selection); | ||
$: ({ recordSummaries } = recordsData); | ||
$: cell = $activeCell; | ||
$: selectedCellValue = (() => { | ||
if (cell) { | ||
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; | ||
})(); | ||
$: recordSummary = | ||
column && | ||
$recordSummaries.get(String(column.id))?.get(String(selectedCellValue)); | ||
</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} | ||
{recordSummary} | ||
/> | ||
{/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 { | ||
white-space: pre-wrap; | ||
border: 1px solid var(--slate-300); | ||
padding: var(--size-xx-small); | ||
border-radius: var(--border-radius-m); | ||
margin-top: var(--size-x-small); | ||
} | ||
} | ||
} | ||
</style> |