Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions frontend/src/components/data-table/columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ const PopoutColumn = ({
<EmotionCacheProvider container={null}>
<Popover>
<PopoverTrigger
className={cn(cellStyles, "w-fit outline-hidden")}
className={cn(cellStyles, "max-w-fit outline-hidden")}
onClick={selectCell}
onMouseDown={(e) => {
// Prevent cell underneath from being selected
Expand Down Expand Up @@ -477,6 +477,8 @@ export function renderCellValue<TData, TValue>({
const dataType = column.columnDef.meta?.dataType;
const dtype = column.columnDef.meta?.dtype;

const isWrapped = column.getColumnWrapping?.() === "wrap";

if (dataType === "datetime" && typeof value === "string") {
try {
const date = new Date(value);
Expand Down Expand Up @@ -508,10 +510,13 @@ export function renderCellValue<TData, TValue>({
: String(renderValue());

const parts = parseContent(stringValue);
const hasMarkup = parts.some((part) => part.type !== "text");
if (hasMarkup || stringValue.length < MAX_STRING_LENGTH) {
const allMarkup = parts.every((part) => part.type !== "text");
if (allMarkup || stringValue.length < MAX_STRING_LENGTH || isWrapped) {
return (
<div onClick={selectCell} className={cellStyles}>
<div
onClick={selectCell}
className={cn(cellStyles, isWrapped && COLUMN_WRAPPING_STYLES)}
>
<UrlDetector parts={parts} />
</div>
);
Expand All @@ -522,9 +527,9 @@ export function renderCellValue<TData, TValue>({
cellStyles={cellStyles}
selectCell={selectCell}
rawStringValue={stringValue}
contentClassName="max-h-64 overflow-auto whitespace-pre-wrap break-words text-sm"
contentClassName="max-h-64 overflow-auto whitespace-pre-wrap break-words text-sm w-96"
buttonText="X"
wrapped={column.getColumnWrapping?.() === "wrap"}
wrapped={isWrapped}
>
<UrlDetector parts={parts} />
</PopoutColumn>
Expand Down Expand Up @@ -575,7 +580,7 @@ export function renderCellValue<TData, TValue>({
cellStyles={cellStyles}
selectCell={selectCell}
rawStringValue={rawStringValue}
wrapped={column.getColumnWrapping?.() === "wrap"}
wrapped={isWrapped}
>
<JsonOutput data={value} format="tree" className="max-h-64" />
</PopoutColumn>
Expand Down
14 changes: 11 additions & 3 deletions marimo/_smoke_tests/tables/rich_elements.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import marimo

__generated_with = "0.15.5"
__generated_with = "0.17.6"
app = marimo.App(width="medium")


Expand All @@ -15,7 +15,9 @@ def _():

@app.cell
def _(mo):
mo.md(r"""# Printing Rich Elements""")
mo.md(r"""
# Printing Rich Elements
""")
return


Expand Down Expand Up @@ -112,6 +114,10 @@ def simple_echo_model(messages, config):
"lorem_ipsum_dollar_sit" * 20,
"lorem_ipsum_dollar_sit" * 20,
],
"long_text_with_markup": [
"lorem link: https://www.google.com" * 4,
"lorem link: https://www.google.com" * 4,
],
"large_array": [
[1] * 60,
[2] * 60,
Expand Down Expand Up @@ -171,7 +177,9 @@ def _(data, mo, pl):

@app.cell
def _(mo, password):
mo.md(f"""### Password value: {password.value}""")
mo.md(f"""
### Password value: {password.value}
""")
return


Expand Down
Loading