@marimo-team/frontend 0.24.1-dev41 → 0.24.1-dev42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -334,12 +334,10 @@ const PromptArea = memo<PromptAreaProps>(
|
|
|
334
334
|
// sentence has to begin with '/' to trigger autocomplete
|
|
335
335
|
return {
|
|
336
336
|
triggerCompletionRegex: /^\/(\w+)?/,
|
|
337
|
-
completions: commands.map(
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
}),
|
|
342
|
-
),
|
|
337
|
+
completions: commands.map((prompt): Completion => ({
|
|
338
|
+
label: `/${prompt.name}`,
|
|
339
|
+
info: prompt.description,
|
|
340
|
+
})),
|
|
343
341
|
};
|
|
344
342
|
}, [commands]);
|
|
345
343
|
|
|
@@ -196,150 +196,148 @@ export function generateColumns<T>({
|
|
|
196
196
|
columnKeys.splice(indexColumnIdx, 1);
|
|
197
197
|
}
|
|
198
198
|
|
|
199
|
-
const columns = columnKeys.map(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
<div
|
|
218
|
-
className={cn(
|
|
219
|
-
"flex flex-row gap-1",
|
|
220
|
-
headerJustify === "center" && "justify-center",
|
|
221
|
-
headerJustify === "right" && "justify-end",
|
|
222
|
-
)}
|
|
223
|
-
>
|
|
224
|
-
<span className="text-xs text-muted-foreground">{dtype}</span>
|
|
225
|
-
{stats && typeof stats.nulls === "number" && stats.nulls > 0 && (
|
|
226
|
-
<span className="text-xs text-muted-foreground">
|
|
227
|
-
(nulls: {stats.nulls})
|
|
228
|
-
</span>
|
|
229
|
-
)}
|
|
230
|
-
</div>
|
|
231
|
-
) : null;
|
|
232
|
-
|
|
233
|
-
const headerName = (
|
|
234
|
-
<span
|
|
199
|
+
const columns = columnKeys.map((key, idx): ColumnDef<T> => ({
|
|
200
|
+
id: key || `${NAMELESS_COLUMN_PREFIX}${idx}`,
|
|
201
|
+
// Use an accessorFn instead of an accessorKey because column names
|
|
202
|
+
// may have periods in them ...
|
|
203
|
+
// https://github.com/TanStack/table/issues/1671
|
|
204
|
+
accessorFn: (row) => {
|
|
205
|
+
return row[key as keyof T];
|
|
206
|
+
},
|
|
207
|
+
enableHiding: !rowHeadersSet.has(key) && key !== "",
|
|
208
|
+
header: ({ column, table }) => {
|
|
209
|
+
const stats = chartSpecModel?.getColumnStats(key);
|
|
210
|
+
const dtype = column.columnDef.meta?.dtype;
|
|
211
|
+
const headerTitle = headerTooltip?.[key];
|
|
212
|
+
const headerJustify = textJustifyColumns?.[key];
|
|
213
|
+
|
|
214
|
+
const dtypeHeader =
|
|
215
|
+
showDataTypes && dtype ? (
|
|
216
|
+
<div
|
|
235
217
|
className={cn(
|
|
236
|
-
"
|
|
237
|
-
|
|
218
|
+
"flex flex-row gap-1",
|
|
219
|
+
headerJustify === "center" && "justify-center",
|
|
220
|
+
headerJustify === "right" && "justify-end",
|
|
238
221
|
)}
|
|
239
222
|
>
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
223
|
+
<span className="text-xs text-muted-foreground">{dtype}</span>
|
|
224
|
+
{stats && typeof stats.nulls === "number" && stats.nulls > 0 && (
|
|
225
|
+
<span className="text-xs text-muted-foreground">
|
|
226
|
+
(nulls: {stats.nulls})
|
|
227
|
+
</span>
|
|
228
|
+
)}
|
|
229
|
+
</div>
|
|
230
|
+
) : null;
|
|
243
231
|
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
232
|
+
const headerName = (
|
|
233
|
+
<span
|
|
234
|
+
className={cn(
|
|
235
|
+
"font-bold",
|
|
236
|
+
headerTitle && "underline decoration-dotted",
|
|
237
|
+
)}
|
|
238
|
+
>
|
|
239
|
+
{key === "" ? " " : key}
|
|
240
|
+
</span>
|
|
241
|
+
);
|
|
251
242
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
table={table}
|
|
260
|
-
/>
|
|
261
|
-
);
|
|
243
|
+
const headerWithTooltip = headerTitle ? (
|
|
244
|
+
<Tooltip content={headerTitle} delayDuration={300}>
|
|
245
|
+
{headerName}
|
|
246
|
+
</Tooltip>
|
|
247
|
+
) : (
|
|
248
|
+
headerName
|
|
249
|
+
);
|
|
262
250
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
251
|
+
const dataTableColumnHeader = (
|
|
252
|
+
<DataTableColumnHeader
|
|
253
|
+
header={headerWithTooltip}
|
|
254
|
+
subheader={dtypeHeader}
|
|
255
|
+
column={column}
|
|
256
|
+
justify={headerJustify}
|
|
257
|
+
calculateTopKRows={calculateTopKRows}
|
|
258
|
+
table={table}
|
|
259
|
+
/>
|
|
260
|
+
);
|
|
267
261
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
headerJustify === "center" && "items-center",
|
|
273
|
-
headerJustify === "right" && "items-end",
|
|
274
|
-
)}
|
|
275
|
-
>
|
|
276
|
-
{dataTableColumnHeader}
|
|
277
|
-
<TableColumnSummary columnId={key} />
|
|
278
|
-
</div>
|
|
279
|
-
);
|
|
280
|
-
},
|
|
262
|
+
// Row headers have no summaries
|
|
263
|
+
if (rowHeadersSet.has(key)) {
|
|
264
|
+
return dataTableColumnHeader;
|
|
265
|
+
}
|
|
281
266
|
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
267
|
+
return (
|
|
268
|
+
<div
|
|
269
|
+
className={cn(
|
|
270
|
+
"flex flex-col h-full pt-0.5 pb-3 justify-between items-start",
|
|
271
|
+
headerJustify === "center" && "items-center",
|
|
272
|
+
headerJustify === "right" && "items-end",
|
|
273
|
+
)}
|
|
274
|
+
>
|
|
275
|
+
{dataTableColumnHeader}
|
|
276
|
+
<TableColumnSummary columnId={key} />
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
},
|
|
287
280
|
|
|
288
|
-
|
|
281
|
+
cell: ({ column, renderValue, getValue, cell }) => {
|
|
282
|
+
function selectCell() {
|
|
283
|
+
if (selection !== "single-cell" && selection !== "multi-cell") {
|
|
284
|
+
return;
|
|
289
285
|
}
|
|
290
286
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
const isCellSelected = cell?.getIsSelected?.() || false;
|
|
294
|
-
const canSelectCell =
|
|
295
|
-
(selection === "single-cell" || selection === "multi-cell") &&
|
|
296
|
-
!isCellSelected;
|
|
297
|
-
|
|
298
|
-
const dataType = column.columnDef.meta?.dataType;
|
|
299
|
-
const isNumeric = isNumericType(dataType);
|
|
300
|
-
const cellStyles = getCellStyleClass({
|
|
301
|
-
justify,
|
|
302
|
-
wrapped,
|
|
303
|
-
canSelectCell,
|
|
304
|
-
isSelected: isCellSelected,
|
|
305
|
-
isNumeric,
|
|
306
|
-
});
|
|
307
|
-
|
|
308
|
-
const renderedCell = renderCellValue({
|
|
309
|
-
column,
|
|
310
|
-
renderValue,
|
|
311
|
-
getValue,
|
|
312
|
-
selectCell,
|
|
313
|
-
cellStyles,
|
|
314
|
-
});
|
|
315
|
-
|
|
316
|
-
// Row headers are bold
|
|
317
|
-
if (rowHeadersSet.has(key)) {
|
|
318
|
-
return <b>{renderedCell}</b>;
|
|
319
|
-
}
|
|
287
|
+
cell.toggleSelected?.();
|
|
288
|
+
}
|
|
320
289
|
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
290
|
+
const justify = getJustify(key);
|
|
291
|
+
const wrapped = wrappedColumns?.includes(key);
|
|
292
|
+
const isCellSelected = cell?.getIsSelected?.() || false;
|
|
293
|
+
const canSelectCell =
|
|
294
|
+
(selection === "single-cell" || selection === "multi-cell") &&
|
|
295
|
+
!isCellSelected;
|
|
296
|
+
|
|
297
|
+
const dataType = column.columnDef.meta?.dataType;
|
|
298
|
+
const isNumeric = isNumericType(dataType);
|
|
299
|
+
const cellStyles = getCellStyleClass({
|
|
300
|
+
justify,
|
|
301
|
+
wrapped,
|
|
302
|
+
canSelectCell,
|
|
303
|
+
isSelected: isCellSelected,
|
|
304
|
+
isNumeric,
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
const renderedCell = renderCellValue({
|
|
308
|
+
column,
|
|
309
|
+
renderValue,
|
|
310
|
+
getValue,
|
|
311
|
+
selectCell,
|
|
312
|
+
cellStyles,
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
// Row headers are bold
|
|
316
|
+
if (rowHeadersSet.has(key)) {
|
|
317
|
+
return <b>{renderedCell}</b>;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return renderedCell;
|
|
321
|
+
},
|
|
322
|
+
// Remove any default filtering
|
|
323
|
+
filterFn: undefined,
|
|
324
|
+
// Unnamed index columns and geometry columns are not sortable
|
|
325
|
+
enableSorting: !!key && getMeta(key).dataType !== "geometry",
|
|
326
|
+
meta: {
|
|
327
|
+
...getMeta(key),
|
|
328
|
+
width: columnWidths?.[key],
|
|
329
|
+
},
|
|
330
|
+
// size seeds the width before measurement; minSize/maxSize pin
|
|
331
|
+
// getSize() to the fixed width so the per-paint measurement writeback
|
|
332
|
+
// cannot drift the header width or sticky-pin offsets.
|
|
333
|
+
...(columnWidths?.[key] !== undefined
|
|
334
|
+
? {
|
|
335
|
+
size: columnWidths[key],
|
|
336
|
+
minSize: columnWidths[key],
|
|
337
|
+
maxSize: columnWidths[key],
|
|
338
|
+
}
|
|
339
|
+
: {}),
|
|
340
|
+
}));
|
|
343
341
|
|
|
344
342
|
if (selection === "single" || selection === "multi") {
|
|
345
343
|
columns.unshift({
|
|
@@ -94,23 +94,21 @@ const getLucideIconList = once(async (): Promise<Completion[]> => {
|
|
|
94
94
|
return `https://cdn.jsdelivr.net/npm/lucide-static@0.452.0/icons/${iconName}.svg`;
|
|
95
95
|
};
|
|
96
96
|
|
|
97
|
-
return Object.entries(iconList).map(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}),
|
|
113
|
-
);
|
|
97
|
+
return Object.entries(iconList).map(([iconName, aliases]): Completion => ({
|
|
98
|
+
label: `::${iconName}`,
|
|
99
|
+
displayLabel: iconName,
|
|
100
|
+
type: "lucide-icon",
|
|
101
|
+
boost: 10,
|
|
102
|
+
apply: `::lucide:${iconName}::`,
|
|
103
|
+
detail: aliases.join(", "),
|
|
104
|
+
info: () => {
|
|
105
|
+
const img = document.createElement("img");
|
|
106
|
+
img.src = asSvg(iconName);
|
|
107
|
+
img.style.width = "24px";
|
|
108
|
+
img.style.height = "24px";
|
|
109
|
+
return img;
|
|
110
|
+
},
|
|
111
|
+
}));
|
|
114
112
|
});
|
|
115
113
|
|
|
116
114
|
// Completion provider for LaTeX-style UTF-8 symbols
|