mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-14 21:09:50 +02:00
Lint fixes
This commit is contained in:
@@ -49,21 +49,21 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
const startLabelElement = createLabel(edge.startLabelLeft, edge.labelStyle);
|
const startLabelElement = createLabel(edge.startLabelLeft, edge.labelStyle);
|
||||||
const startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
const startEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
||||||
const inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');
|
const inner = startEdgeLabelLeft.insert('g').attr('class', 'inner');
|
||||||
fo=inner.node().appendChild(startLabelElement);
|
fo = inner.node().appendChild(startLabelElement);
|
||||||
const slBox = startLabelElement.getBBox();
|
const slBox = startLabelElement.getBBox();
|
||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
if (!terminalLabels[edge.id]) {
|
if (!terminalLabels[edge.id]) {
|
||||||
terminalLabels[edge.id] = {};
|
terminalLabels[edge.id] = {};
|
||||||
}
|
}
|
||||||
terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
|
terminalLabels[edge.id].startLeft = startEdgeLabelLeft;
|
||||||
setTerminalWidth(fo,bbox);
|
setTerminalWidth(fo, bbox);
|
||||||
}
|
}
|
||||||
if (edge.startLabelRight) {
|
if (edge.startLabelRight) {
|
||||||
// Create the actual text element
|
// Create the actual text element
|
||||||
const startLabelElement = createLabel(edge.startLabelRight, edge.labelStyle);
|
const startLabelElement = createLabel(edge.startLabelRight, edge.labelStyle);
|
||||||
const startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
const startEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
||||||
const inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
|
const inner = startEdgeLabelRight.insert('g').attr('class', 'inner');
|
||||||
fo=startEdgeLabelRight.node().appendChild(startLabelElement);
|
fo = startEdgeLabelRight.node().appendChild(startLabelElement);
|
||||||
inner.node().appendChild(startLabelElement);
|
inner.node().appendChild(startLabelElement);
|
||||||
const slBox = startLabelElement.getBBox();
|
const slBox = startLabelElement.getBBox();
|
||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
@@ -72,15 +72,14 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
terminalLabels[edge.id] = {};
|
terminalLabels[edge.id] = {};
|
||||||
}
|
}
|
||||||
terminalLabels[edge.id].startRight = startEdgeLabelRight;
|
terminalLabels[edge.id].startRight = startEdgeLabelRight;
|
||||||
setTerminalWidth(fo,bbox);
|
setTerminalWidth(fo, bbox);
|
||||||
|
|
||||||
}
|
}
|
||||||
if (edge.endLabelLeft) {
|
if (edge.endLabelLeft) {
|
||||||
// Create the actual text element
|
// Create the actual text element
|
||||||
const endLabelElement = createLabel(edge.endLabelLeft, edge.labelStyle);
|
const endLabelElement = createLabel(edge.endLabelLeft, edge.labelStyle);
|
||||||
const endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
const endEdgeLabelLeft = elem.insert('g').attr('class', 'edgeTerminals');
|
||||||
const inner = endEdgeLabelLeft.insert('g').attr('class', 'inner');
|
const inner = endEdgeLabelLeft.insert('g').attr('class', 'inner');
|
||||||
fo=inner.node().appendChild(endLabelElement);
|
fo = inner.node().appendChild(endLabelElement);
|
||||||
const slBox = endLabelElement.getBBox();
|
const slBox = endLabelElement.getBBox();
|
||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
|
|
||||||
@@ -90,7 +89,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
terminalLabels[edge.id] = {};
|
terminalLabels[edge.id] = {};
|
||||||
}
|
}
|
||||||
terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
|
terminalLabels[edge.id].endLeft = endEdgeLabelLeft;
|
||||||
setTerminalWidth(fo,bbox);
|
setTerminalWidth(fo, bbox);
|
||||||
}
|
}
|
||||||
if (edge.endLabelRight) {
|
if (edge.endLabelRight) {
|
||||||
// Create the actual text element
|
// Create the actual text element
|
||||||
@@ -98,7 +97,7 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
const endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
const endEdgeLabelRight = elem.insert('g').attr('class', 'edgeTerminals');
|
||||||
const inner = endEdgeLabelRight.insert('g').attr('class', 'inner');
|
const inner = endEdgeLabelRight.insert('g').attr('class', 'inner');
|
||||||
|
|
||||||
fo=inner.node().appendChild(endLabelElement);
|
fo = inner.node().appendChild(endLabelElement);
|
||||||
const slBox = endLabelElement.getBBox();
|
const slBox = endLabelElement.getBBox();
|
||||||
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
inner.attr('transform', 'translate(' + -slBox.width / 2 + ', ' + -slBox.height / 2 + ')');
|
||||||
|
|
||||||
@@ -107,15 +106,14 @@ export const insertEdgeLabel = (elem, edge) => {
|
|||||||
terminalLabels[edge.id] = {};
|
terminalLabels[edge.id] = {};
|
||||||
}
|
}
|
||||||
terminalLabels[edge.id].endRight = endEdgeLabelRight;
|
terminalLabels[edge.id].endRight = endEdgeLabelRight;
|
||||||
setTerminalWidth(fo,bbox);
|
setTerminalWidth(fo, bbox);
|
||||||
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function setTerminalWidth(fo, box){
|
function setTerminalWidth(fo, box) {
|
||||||
if(getConfig().flowchart.htmlLabels && fo){
|
if (getConfig().flowchart.htmlLabels && fo) {
|
||||||
fo.style.width=box.width;
|
fo.style.width = box.width;
|
||||||
fo.style.height=box.height;
|
fo.style.height = box.height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -674,8 +674,8 @@ const class_box = (parent, node) => {
|
|||||||
node.classData.members.forEach((str) => {
|
node.classData.members.forEach((str) => {
|
||||||
let parsedText = parseMember(str).displayText;
|
let parsedText = parseMember(str).displayText;
|
||||||
if (getConfig().flowchart.htmlLabels) {
|
if (getConfig().flowchart.htmlLabels) {
|
||||||
parsedText = parsedText.replace(/</g, '<').replace(/>/g, '>');
|
parsedText = parsedText.replace(/</g, '<').replace(/>/g, '>');
|
||||||
}
|
}
|
||||||
const lbl = labelContainer
|
const lbl = labelContainer
|
||||||
.node()
|
.node()
|
||||||
.appendChild(createLabel(parsedText, node.labelStyle, true, true));
|
.appendChild(createLabel(parsedText, node.labelStyle, true, true));
|
||||||
@@ -699,10 +699,10 @@ const class_box = (parent, node) => {
|
|||||||
const classMethods = [];
|
const classMethods = [];
|
||||||
node.classData.methods.forEach((str) => {
|
node.classData.methods.forEach((str) => {
|
||||||
const parsedInfo = parseMember(str);
|
const parsedInfo = parseMember(str);
|
||||||
let displayText =parsedInfo.displayText;
|
let displayText = parsedInfo.displayText;
|
||||||
if (getConfig().flowchart.htmlLabels) {
|
if (getConfig().flowchart.htmlLabels) {
|
||||||
displayText = displayText.replace(/</g, '<').replace(/>/g, '>');
|
displayText = displayText.replace(/</g, '<').replace(/>/g, '>');
|
||||||
}
|
}
|
||||||
const lbl = labelContainer
|
const lbl = labelContainer
|
||||||
.node()
|
.node()
|
||||||
.appendChild(
|
.appendChild(
|
||||||
|
@@ -156,7 +156,7 @@ export const draw = (txt, id) => {
|
|||||||
.attr('y', legendRectSize - legendSpacing)
|
.attr('y', legendRectSize - legendSpacing)
|
||||||
.text(function (d) {
|
.text(function (d) {
|
||||||
if (parser.yy.getShowData() || conf.showData || conf.pie.showData) {
|
if (parser.yy.getShowData() || conf.showData || conf.pie.showData) {
|
||||||
return d.data[0] + ' [' + d.data[1]+ ']';
|
return d.data[0] + ' [' + d.data[1] + ']';
|
||||||
} else {
|
} else {
|
||||||
return d.data[0];
|
return d.data[0];
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user