Merge pull request #658 from alixander/sql-fixes
sql_table: Fix tooltip/link, fix connection attributes
This commit is contained in:
commit
7bea56301c
10 changed files with 1181 additions and 19 deletions
|
|
@ -10,3 +10,5 @@
|
||||||
#### Bugfixes ⛑️
|
#### Bugfixes ⛑️
|
||||||
|
|
||||||
- Fixes arrowheads sometimes appearing broken in dagre layouts. [#649](https://github.com/terrastruct/d2/pull/649)
|
- Fixes arrowheads sometimes appearing broken in dagre layouts. [#649](https://github.com/terrastruct/d2/pull/649)
|
||||||
|
- Fixes attributes being ignored for `sql_table` to `sql_table` connections. [#658](https://github.com/terrastruct/d2/pull/658)
|
||||||
|
- Fixes tooltip/link attributes being ignored for `sql_table` and `class`. [#658](https://github.com/terrastruct/d2/pull/658)
|
||||||
|
|
|
||||||
|
|
@ -757,13 +757,15 @@ func flattenContainer(g *d2graph.Graph, obj *d2graph.Object) {
|
||||||
// TODO more attributes
|
// TODO more attributes
|
||||||
if e.SrcTableColumnIndex != nil {
|
if e.SrcTableColumnIndex != nil {
|
||||||
newEdge.SrcTableColumnIndex = new(int)
|
newEdge.SrcTableColumnIndex = new(int)
|
||||||
|
newEdge.SrcArrowhead = e.SrcArrowhead
|
||||||
*newEdge.SrcTableColumnIndex = *e.SrcTableColumnIndex
|
*newEdge.SrcTableColumnIndex = *e.SrcTableColumnIndex
|
||||||
}
|
}
|
||||||
if e.DstTableColumnIndex != nil {
|
if e.DstTableColumnIndex != nil {
|
||||||
newEdge.DstTableColumnIndex = new(int)
|
newEdge.DstTableColumnIndex = new(int)
|
||||||
|
newEdge.DstArrowhead = e.DstArrowhead
|
||||||
*newEdge.DstTableColumnIndex = *e.DstTableColumnIndex
|
*newEdge.DstTableColumnIndex = *e.DstTableColumnIndex
|
||||||
}
|
}
|
||||||
newEdge.Attributes.Label = e.Attributes.Label
|
newEdge.Attributes = e.Attributes
|
||||||
newEdge.References = e.References
|
newEdge.References = e.References
|
||||||
}
|
}
|
||||||
updatedEdges := []*d2graph.Edge{}
|
updatedEdges := []*d2graph.Edge{}
|
||||||
|
|
|
||||||
|
|
@ -1597,6 +1597,25 @@ b`, g.Objects[0].Attributes.Label.Value)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "table_connection_attr",
|
||||||
|
|
||||||
|
text: `x: {
|
||||||
|
shape: sql_table
|
||||||
|
y
|
||||||
|
}
|
||||||
|
a: {
|
||||||
|
shape: sql_table
|
||||||
|
b
|
||||||
|
}
|
||||||
|
x.y -> a.b: {
|
||||||
|
style.animated: true
|
||||||
|
}
|
||||||
|
`,
|
||||||
|
assertions: func(t *testing.T, g *d2graph.Graph) {
|
||||||
|
tassert.Equal(t, "true", g.Edges[0].Attributes.Style.Animated.Value)
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: "class_paren",
|
name: "class_paren",
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -687,6 +687,7 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske
|
||||||
} else {
|
} else {
|
||||||
drawClass(writer, targetShape)
|
drawClass(writer, targetShape)
|
||||||
}
|
}
|
||||||
|
addAppendixItems(writer, targetShape)
|
||||||
fmt.Fprintf(writer, `</g>`)
|
fmt.Fprintf(writer, `</g>`)
|
||||||
fmt.Fprintf(writer, closingTag)
|
fmt.Fprintf(writer, closingTag)
|
||||||
return labelMask, nil
|
return labelMask, nil
|
||||||
|
|
@ -700,6 +701,7 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske
|
||||||
} else {
|
} else {
|
||||||
drawTable(writer, targetShape)
|
drawTable(writer, targetShape)
|
||||||
}
|
}
|
||||||
|
addAppendixItems(writer, targetShape)
|
||||||
fmt.Fprintf(writer, `</g>`)
|
fmt.Fprintf(writer, `</g>`)
|
||||||
fmt.Fprintf(writer, closingTag)
|
fmt.Fprintf(writer, closingTag)
|
||||||
return labelMask, nil
|
return labelMask, nil
|
||||||
|
|
@ -899,29 +901,33 @@ func drawShape(writer io.Writer, targetShape d2target.Shape, sketchRunner *d2ske
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rightPadForTooltip := 0
|
addAppendixItems(writer, targetShape)
|
||||||
if targetShape.Tooltip != "" {
|
|
||||||
rightPadForTooltip = 2 * appendixIconRadius
|
|
||||||
fmt.Fprintf(writer, `<g transform="translate(%d %d)" class="appendix-icon">%s</g>`,
|
|
||||||
targetShape.Pos.X+targetShape.Width-appendixIconRadius,
|
|
||||||
targetShape.Pos.Y-appendixIconRadius,
|
|
||||||
TooltipIcon,
|
|
||||||
)
|
|
||||||
fmt.Fprintf(writer, `<title>%s</title>`, targetShape.Tooltip)
|
|
||||||
}
|
|
||||||
|
|
||||||
if targetShape.Link != "" {
|
|
||||||
fmt.Fprintf(writer, `<g transform="translate(%d %d)" class="appendix-icon">%s</g>`,
|
|
||||||
targetShape.Pos.X+targetShape.Width-appendixIconRadius-rightPadForTooltip,
|
|
||||||
targetShape.Pos.Y-appendixIconRadius,
|
|
||||||
LinkIcon,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt.Fprintf(writer, closingTag)
|
fmt.Fprintf(writer, closingTag)
|
||||||
return labelMask, nil
|
return labelMask, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func addAppendixItems(writer io.Writer, shape d2target.Shape) {
|
||||||
|
rightPadForTooltip := 0
|
||||||
|
if shape.Tooltip != "" {
|
||||||
|
rightPadForTooltip = 2 * appendixIconRadius
|
||||||
|
fmt.Fprintf(writer, `<g transform="translate(%d %d)" class="appendix-icon">%s</g>`,
|
||||||
|
shape.Pos.X+shape.Width-appendixIconRadius,
|
||||||
|
shape.Pos.Y-appendixIconRadius,
|
||||||
|
TooltipIcon,
|
||||||
|
)
|
||||||
|
fmt.Fprintf(writer, `<title>%s</title>`, shape.Tooltip)
|
||||||
|
}
|
||||||
|
|
||||||
|
if shape.Link != "" {
|
||||||
|
fmt.Fprintf(writer, `<g transform="translate(%d %d)" class="appendix-icon">%s</g>`,
|
||||||
|
shape.Pos.X+shape.Width-appendixIconRadius-rightPadForTooltip,
|
||||||
|
shape.Pos.Y-appendixIconRadius,
|
||||||
|
LinkIcon,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func RenderText(text string, x, height float64) string {
|
func RenderText(text string, x, height float64) string {
|
||||||
if !strings.Contains(text, "\n") {
|
if !strings.Contains(text, "\n") {
|
||||||
return svg.EscapeText(text)
|
return svg.EscapeText(text)
|
||||||
|
|
|
||||||
|
|
@ -1795,6 +1795,26 @@ Listen <-> Talk: {
|
||||||
target-arrowhead.shape: diamond
|
target-arrowhead.shape: diamond
|
||||||
label: hear
|
label: hear
|
||||||
}
|
}
|
||||||
|
`,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "sql_table_tooltip_animated",
|
||||||
|
script: `
|
||||||
|
x: {
|
||||||
|
shape: sql_table
|
||||||
|
y
|
||||||
|
tooltip: I like turtles
|
||||||
|
}
|
||||||
|
|
||||||
|
a: {
|
||||||
|
shape: sql_table
|
||||||
|
b
|
||||||
|
}
|
||||||
|
|
||||||
|
x.y -> a.b: {
|
||||||
|
style.animated: true
|
||||||
|
target-arrowhead.shape: cf-many
|
||||||
|
}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
198
e2etests/testdata/stable/sql_table_tooltip_animated/dagre/board.exp.json
generated
vendored
Normal file
198
e2etests/testdata/stable/sql_table_tooltip_animated/dagre/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,198 @@
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"fontFamily": "SourceSansPro",
|
||||||
|
"shapes": [
|
||||||
|
{
|
||||||
|
"id": "x",
|
||||||
|
"type": "sql_table",
|
||||||
|
"pos": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 0
|
||||||
|
},
|
||||||
|
"width": 60,
|
||||||
|
"height": 72,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#0A0F25",
|
||||||
|
"stroke": "#FFFFFF",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "I like turtles",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"label": "y",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 10,
|
||||||
|
"labelHeight": 26
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"constraint": "",
|
||||||
|
"reference": "a.b"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"label": "x",
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": true,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 17,
|
||||||
|
"labelHeight": 36,
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1,
|
||||||
|
"primaryAccentColor": "#0D32B2",
|
||||||
|
"secondaryAccentColor": "#4A6FF3",
|
||||||
|
"neutralAccentColor": "#676C7E"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"type": "sql_table",
|
||||||
|
"pos": {
|
||||||
|
"x": 0,
|
||||||
|
"y": 172
|
||||||
|
},
|
||||||
|
"width": 60,
|
||||||
|
"height": 72,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#0A0F25",
|
||||||
|
"stroke": "#FFFFFF",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"label": "b",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 10,
|
||||||
|
"labelHeight": 26
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"constraint": "",
|
||||||
|
"reference": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"label": "a",
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": true,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 16,
|
||||||
|
"labelHeight": 36,
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1,
|
||||||
|
"primaryAccentColor": "#0D32B2",
|
||||||
|
"secondaryAccentColor": "#4A6FF3",
|
||||||
|
"neutralAccentColor": "#676C7E"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"connections": [
|
||||||
|
{
|
||||||
|
"id": "(x -> a)[0]",
|
||||||
|
"src": "x",
|
||||||
|
"srcArrow": "none",
|
||||||
|
"srcLabel": "",
|
||||||
|
"dst": "a",
|
||||||
|
"dstArrow": "cf-many",
|
||||||
|
"dstLabel": "",
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#676C7E",
|
||||||
|
"italic": true,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0,
|
||||||
|
"labelPosition": "",
|
||||||
|
"labelPercentage": 0,
|
||||||
|
"route": [
|
||||||
|
{
|
||||||
|
"x": 30,
|
||||||
|
"y": 72
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 30,
|
||||||
|
"y": 112
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 30,
|
||||||
|
"y": 132
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 30,
|
||||||
|
"y": 172
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"isCurve": true,
|
||||||
|
"animated": true,
|
||||||
|
"tooltip": "",
|
||||||
|
"icon": null,
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
78
e2etests/testdata/stable/sql_table_tooltip_animated/dagre/sketch.exp.svg
vendored
Normal file
78
e2etests/testdata/stable/sql_table_tooltip_animated/dagre/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 329 KiB |
189
e2etests/testdata/stable/sql_table_tooltip_animated/elk/board.exp.json
generated
vendored
Normal file
189
e2etests/testdata/stable/sql_table_tooltip_animated/elk/board.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,189 @@
|
||||||
|
{
|
||||||
|
"name": "",
|
||||||
|
"fontFamily": "SourceSansPro",
|
||||||
|
"shapes": [
|
||||||
|
{
|
||||||
|
"id": "x",
|
||||||
|
"type": "sql_table",
|
||||||
|
"pos": {
|
||||||
|
"x": 12,
|
||||||
|
"y": 12
|
||||||
|
},
|
||||||
|
"width": 60,
|
||||||
|
"height": 72,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#0A0F25",
|
||||||
|
"stroke": "#FFFFFF",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "I like turtles",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"label": "y",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 10,
|
||||||
|
"labelHeight": 26
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"constraint": "",
|
||||||
|
"reference": "a.b"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"label": "x",
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": true,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 17,
|
||||||
|
"labelHeight": 36,
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1,
|
||||||
|
"primaryAccentColor": "#0D32B2",
|
||||||
|
"secondaryAccentColor": "#4A6FF3",
|
||||||
|
"neutralAccentColor": "#676C7E"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"type": "sql_table",
|
||||||
|
"pos": {
|
||||||
|
"x": 12,
|
||||||
|
"y": 184
|
||||||
|
},
|
||||||
|
"width": 60,
|
||||||
|
"height": 72,
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"borderRadius": 0,
|
||||||
|
"fill": "#0A0F25",
|
||||||
|
"stroke": "#FFFFFF",
|
||||||
|
"shadow": false,
|
||||||
|
"3d": false,
|
||||||
|
"multiple": false,
|
||||||
|
"tooltip": "",
|
||||||
|
"link": "",
|
||||||
|
"icon": null,
|
||||||
|
"iconPosition": "",
|
||||||
|
"blend": false,
|
||||||
|
"fields": null,
|
||||||
|
"methods": null,
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"label": "b",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 10,
|
||||||
|
"labelHeight": 26
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"constraint": "",
|
||||||
|
"reference": ""
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"label": "a",
|
||||||
|
"fontSize": 20,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#0A0F25",
|
||||||
|
"italic": false,
|
||||||
|
"bold": true,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 16,
|
||||||
|
"labelHeight": 36,
|
||||||
|
"zIndex": 0,
|
||||||
|
"level": 1,
|
||||||
|
"primaryAccentColor": "#0D32B2",
|
||||||
|
"secondaryAccentColor": "#4A6FF3",
|
||||||
|
"neutralAccentColor": "#676C7E"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"connections": [
|
||||||
|
{
|
||||||
|
"id": "(x -> a)[0]",
|
||||||
|
"src": "x",
|
||||||
|
"srcArrow": "none",
|
||||||
|
"srcLabel": "",
|
||||||
|
"dst": "a",
|
||||||
|
"dstArrow": "cf-many",
|
||||||
|
"dstLabel": "",
|
||||||
|
"opacity": 1,
|
||||||
|
"strokeDash": 0,
|
||||||
|
"strokeWidth": 2,
|
||||||
|
"stroke": "#0D32B2",
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 16,
|
||||||
|
"fontFamily": "DEFAULT",
|
||||||
|
"language": "",
|
||||||
|
"color": "#676C7E",
|
||||||
|
"italic": true,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0,
|
||||||
|
"labelPosition": "",
|
||||||
|
"labelPercentage": 0,
|
||||||
|
"route": [
|
||||||
|
{
|
||||||
|
"x": 42,
|
||||||
|
"y": 84
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"x": 42,
|
||||||
|
"y": 184
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"animated": true,
|
||||||
|
"tooltip": "",
|
||||||
|
"icon": null,
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
78
e2etests/testdata/stable/sql_table_tooltip_animated/elk/sketch.exp.svg
vendored
Normal file
78
e2etests/testdata/stable/sql_table_tooltip_animated/elk/sketch.exp.svg
vendored
Normal file
File diff suppressed because one or more lines are too long
|
After Width: | Height: | Size: 329 KiB |
570
testdata/d2compiler/TestCompile/table_connection_attr.exp.json
generated
vendored
Normal file
570
testdata/d2compiler/TestCompile/table_connection_attr.exp.json
generated
vendored
Normal file
|
|
@ -0,0 +1,570 @@
|
||||||
|
{
|
||||||
|
"graph": {
|
||||||
|
"ast": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:0:0-11:0:99",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:0:0-3:1:29",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:3:3-3:0:28",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,1:2:7-1:18:23",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,1:2:7-1:7:12",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,1:2:7-1:7:12",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "shape",
|
||||||
|
"raw_string": "shape"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,1:9:14-1:18:23",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "sql_table",
|
||||||
|
"raw_string": "sql_table"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,2:2:26-2:3:27",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,2:2:26-2:3:27",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,2:2:26-2:3:27",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,4:0:30-7:1:59",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,4:0:30-4:1:31",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,4:0:30-4:1:31",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,4:3:33-7:0:58",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,5:2:37-5:18:53",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,5:2:37-5:7:42",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,5:2:37-5:7:42",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "shape",
|
||||||
|
"raw_string": "shape"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,5:9:44-5:18:53",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "sql_table",
|
||||||
|
"raw_string": "sql_table"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,6:2:56-6:3:57",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,6:2:56-6:3:57",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,6:2:56-6:3:57",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:0:60-10:1:98",
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:0:60-8:10:70",
|
||||||
|
"src": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:0:60-8:4:64",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:0:60-8:1:61",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:2:62-8:3:63",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"src_arrow": "",
|
||||||
|
"dst": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:6:66-8:10:70",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:7:67-8:8:68",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:9:69-8:10:70",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"dst_arrow": ">"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"map": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:12:72-10:0:97",
|
||||||
|
"nodes": [
|
||||||
|
{
|
||||||
|
"map_key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,9:2:76-9:22:96",
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,9:2:76-9:16:90",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,9:2:76-9:7:81",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "style",
|
||||||
|
"raw_string": "style"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,9:8:82-9:16:90",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "animated",
|
||||||
|
"raw_string": "animated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"primary": {},
|
||||||
|
"value": {
|
||||||
|
"boolean": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,9:18:92-9:22:96",
|
||||||
|
"value": true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"root": {
|
||||||
|
"id": "",
|
||||||
|
"id_val": "",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
"edges": [
|
||||||
|
{
|
||||||
|
"index": 0,
|
||||||
|
"minWidth": 0,
|
||||||
|
"minHeight": 0,
|
||||||
|
"srcTableColumnIndex": 0,
|
||||||
|
"dstTableColumnIndex": 0,
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"isCurve": false,
|
||||||
|
"src_arrow": false,
|
||||||
|
"dst_arrow": true,
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"style": {
|
||||||
|
"animated": {
|
||||||
|
"value": "true"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": ""
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"objects": [
|
||||||
|
{
|
||||||
|
"id": "x",
|
||||||
|
"id_val": "x",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:0:0-0:1:1",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,0:0:0-0:1:1",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:0:60-8:4:64",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:0:60-8:1:61",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "x",
|
||||||
|
"raw_string": "x"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:2:62-8:3:63",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "y",
|
||||||
|
"raw_string": "y"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sql_table": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"label": "y",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"constraint": "",
|
||||||
|
"reference": "a.b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "x"
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "sql_table"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "a",
|
||||||
|
"id_val": "a",
|
||||||
|
"label_dimensions": {
|
||||||
|
"width": 0,
|
||||||
|
"height": 0
|
||||||
|
},
|
||||||
|
"references": [
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,4:0:30-4:1:31",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,4:0:30-4:1:31",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:6:66-8:10:70",
|
||||||
|
"path": [
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:7:67-8:8:68",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "a",
|
||||||
|
"raw_string": "a"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"unquoted_string": {
|
||||||
|
"range": "d2/testdata/d2compiler/TestCompile/table_connection_attr.d2,8:9:69-8:10:70",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"string": "b",
|
||||||
|
"raw_string": "b"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"key_path_index": 0,
|
||||||
|
"map_key_edge_index": 0
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"sql_table": {
|
||||||
|
"columns": [
|
||||||
|
{
|
||||||
|
"name": {
|
||||||
|
"label": "b",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"label": "",
|
||||||
|
"fontSize": 0,
|
||||||
|
"fontFamily": "",
|
||||||
|
"language": "",
|
||||||
|
"color": "",
|
||||||
|
"italic": false,
|
||||||
|
"bold": false,
|
||||||
|
"underline": false,
|
||||||
|
"labelWidth": 0,
|
||||||
|
"labelHeight": 0
|
||||||
|
},
|
||||||
|
"constraint": "",
|
||||||
|
"reference": ""
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"attributes": {
|
||||||
|
"label": {
|
||||||
|
"value": "a"
|
||||||
|
},
|
||||||
|
"style": {},
|
||||||
|
"near_key": null,
|
||||||
|
"shape": {
|
||||||
|
"value": "sql_table"
|
||||||
|
},
|
||||||
|
"direction": {
|
||||||
|
"value": ""
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"zIndex": 0
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"err": null
|
||||||
|
}
|
||||||
Loading…
Reference in a new issue