feat(table): 添加 ComponentCell 以支持表格单元格中嵌入可渲染组件

This commit is contained in:
webjoin111 2025-08-31 00:02:52 +08:00
parent fb0a9813e1
commit 25fa123d35
3 changed files with 13 additions and 0 deletions

View File

@ -12,6 +12,7 @@ from .components import (
from .core import (
BaseCell,
CodeElement,
ComponentCell,
HeadingElement,
ImageCell,
ImageElement,
@ -49,6 +50,7 @@ __all__ = [
"BaseCell",
"BaseChartData",
"CodeElement",
"ComponentCell",
"Divider",
"EChartsData",
"HeadingElement",

View File

@ -24,6 +24,7 @@ from .markdown import (
from .notebook import NotebookData, NotebookElement
from .table import (
BaseCell,
ComponentCell,
ImageCell,
RichTextCell,
StatusBadgeCell,
@ -38,6 +39,7 @@ __all__ = [
"BaseCell",
"CardData",
"CodeElement",
"ComponentCell",
"DetailsData",
"DetailsItem",
"HeadingElement",

View File

@ -10,6 +10,7 @@ from .text import TextSpan
__all__ = [
"BaseCell",
"ComponentCell",
"ImageCell",
"ProgressBarCell",
"RichTextCell",
@ -78,12 +79,20 @@ class RichTextCell(BaseCell):
"""片段之间的间距"""
class ComponentCell(BaseCell):
"""一个通用的单元格,可以容纳任何可渲染的组件。"""
type: str = "component"
component: RenderableComponent
TableCell = (
TextCell
| ImageCell
| StatusBadgeCell
| ProgressBarCell
| RichTextCell
| ComponentCell
| str
| int
| float