mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-16 05:49:43 +02:00
Resolving som conflicts from merge
This commit is contained in:
@@ -96,12 +96,14 @@ export const addLink = function (start, end, type, linktext) {
|
|||||||
* @param pos
|
* @param pos
|
||||||
* @param interpolate
|
* @param interpolate
|
||||||
*/
|
*/
|
||||||
export const updateLinkInterpolate = function (pos, interp) {
|
export const updateLinkInterpolate = function (positions, interp) {
|
||||||
if (pos === 'default') {
|
positions.forEach(function (pos) {
|
||||||
edges.defaultInterpolate = interp
|
if (pos === 'default') {
|
||||||
} else {
|
edges.defaultInterpolate = interp
|
||||||
edges[pos].interpolate = interp
|
} else {
|
||||||
}
|
edges[pos].interpolate = interp
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -109,15 +111,17 @@ export const updateLinkInterpolate = function (pos, interp) {
|
|||||||
* @param pos
|
* @param pos
|
||||||
* @param style
|
* @param style
|
||||||
*/
|
*/
|
||||||
export const updateLink = function (pos, style) {
|
export const updateLink = function (positions, style) {
|
||||||
if (pos === 'default') {
|
positions.forEach(function (pos) {
|
||||||
edges.defaultStyle = style
|
if (pos === 'default') {
|
||||||
} else {
|
edges.defaultStyle = style
|
||||||
if (utils.isSubstringInArray('fill', style) === -1) {
|
} else {
|
||||||
style.push('fill:none')
|
if (utils.isSubstringInArray('fill', style) === -1) {
|
||||||
|
style.push('fill:none')
|
||||||
|
}
|
||||||
|
edges[pos].style = style
|
||||||
}
|
}
|
||||||
edges[pos].style = style
|
})
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const addClass = function (id, style) {
|
export const addClass = function (id, style) {
|
||||||
|
@@ -414,21 +414,27 @@ styleStatement:STYLE SPACE alphaNum SPACE stylesOpt
|
|||||||
|
|
||||||
linkStyleStatement
|
linkStyleStatement
|
||||||
: LINKSTYLE SPACE DEFAULT SPACE stylesOpt
|
: LINKSTYLE SPACE DEFAULT SPACE stylesOpt
|
||||||
{$$ = $1;yy.updateLink($3,$5);}
|
{$$ = $1;yy.updateLink([$3],$5);}
|
||||||
| LINKSTYLE SPACE NUM SPACE stylesOpt
|
| LINKSTYLE SPACE numList SPACE stylesOpt
|
||||||
{$$ = $1;yy.updateLink($3,$5);}
|
{$$ = $1;yy.updateLink($3,$5);}
|
||||||
| LINKSTYLE SPACE DEFAULT SPACE INTERPOLATE SPACE alphaNum SPACE stylesOpt
|
| LINKSTYLE SPACE DEFAULT SPACE INTERPOLATE SPACE alphaNum SPACE stylesOpt
|
||||||
{$$ = $1;yy.updateLinkInterpolate($3,$7);yy.updateLink($3,$9);}
|
{$$ = $1;yy.updateLinkInterpolate([$3],$7);yy.updateLink([$3],$9);}
|
||||||
| LINKSTYLE SPACE NUM SPACE INTERPOLATE SPACE alphaNum SPACE stylesOpt
|
| LINKSTYLE SPACE numList SPACE INTERPOLATE SPACE alphaNum SPACE stylesOpt
|
||||||
{$$ = $1;yy.updateLinkInterpolate($3,$7);yy.updateLink($3,$9);}
|
{$$ = $1;yy.updateLinkInterpolate($3,$7);yy.updateLink($3,$9);}
|
||||||
| LINKSTYLE SPACE DEFAULT SPACE INTERPOLATE SPACE alphaNum
|
| LINKSTYLE SPACE DEFAULT SPACE INTERPOLATE SPACE alphaNum
|
||||||
{$$ = $1;yy.updateLinkInterpolate($3,$7);}
|
{$$ = $1;yy.updateLinkInterpolate([$3],$7);}
|
||||||
| LINKSTYLE SPACE NUM SPACE INTERPOLATE SPACE alphaNum
|
| LINKSTYLE SPACE numList SPACE INTERPOLATE SPACE alphaNum
|
||||||
{$$ = $1;yy.updateLinkInterpolate($3,$7);}
|
{$$ = $1;yy.updateLinkInterpolate($3,$7);}
|
||||||
;
|
;
|
||||||
|
|
||||||
commentStatement: PCT PCT commentText;
|
commentStatement: PCT PCT commentText;
|
||||||
|
|
||||||
|
numList: NUM
|
||||||
|
{$$ = [$1]}
|
||||||
|
| numList COMMA NUM
|
||||||
|
{$1.push($3);$$ = $1;}
|
||||||
|
;
|
||||||
|
|
||||||
stylesOpt: style
|
stylesOpt: style
|
||||||
{$$ = [$1]}
|
{$$ = [$1]}
|
||||||
| stylesOpt COMMA style
|
| stylesOpt COMMA style
|
||||||
|
File diff suppressed because one or more lines are too long
@@ -453,6 +453,28 @@ describe('when parsing ', function () {
|
|||||||
expect(edges[0].type).toBe('arrow')
|
expect(edges[0].type).toBe('arrow')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should handle multi-numbered style definitons with more then 1 digit in a row', function () {
|
||||||
|
const res = flow.parser.parse('graph TD\n' +
|
||||||
|
'A-->B1\n' +
|
||||||
|
'A-->B2\n' +
|
||||||
|
'A-->B3\n' +
|
||||||
|
'A-->B4\n' +
|
||||||
|
'A-->B5\n' +
|
||||||
|
'A-->B6\n' +
|
||||||
|
'A-->B7\n' +
|
||||||
|
'A-->B8\n' +
|
||||||
|
'A-->B9\n' +
|
||||||
|
'A-->B10\n' +
|
||||||
|
'A-->B11\n' +
|
||||||
|
'A-->B12\n' +
|
||||||
|
'linkStyle 10,11 stroke-width:1px;')
|
||||||
|
|
||||||
|
const vert = flow.parser.yy.getVertices()
|
||||||
|
const edges = flow.parser.yy.getEdges()
|
||||||
|
|
||||||
|
expect(edges[0].type).toBe('arrow')
|
||||||
|
})
|
||||||
|
|
||||||
it('should handle line interpolation default definitions', function () {
|
it('should handle line interpolation default definitions', function () {
|
||||||
const res = flow.parser.parse('graph TD\n' +
|
const res = flow.parser.parse('graph TD\n' +
|
||||||
'A-->B\n' +
|
'A-->B\n' +
|
||||||
@@ -478,6 +500,19 @@ describe('when parsing ', function () {
|
|||||||
expect(edges[1].interpolate).toBe('cardinal')
|
expect(edges[1].interpolate).toBe('cardinal')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should handle line interpolation multi-numbered definitions', function () {
|
||||||
|
const res = flow.parser.parse('graph TD\n' +
|
||||||
|
'A-->B\n' +
|
||||||
|
'A-->C\n' +
|
||||||
|
'linkStyle 0,1 interpolate basis')
|
||||||
|
|
||||||
|
const vert = flow.parser.yy.getVertices()
|
||||||
|
const edges = flow.parser.yy.getEdges()
|
||||||
|
|
||||||
|
expect(edges[0].interpolate).toBe('basis')
|
||||||
|
expect(edges[1].interpolate).toBe('basis')
|
||||||
|
})
|
||||||
|
|
||||||
it('should handle line interpolation default with style', function () {
|
it('should handle line interpolation default with style', function () {
|
||||||
const res = flow.parser.parse('graph TD\n' +
|
const res = flow.parser.parse('graph TD\n' +
|
||||||
'A-->B\n' +
|
'A-->B\n' +
|
||||||
@@ -503,6 +538,19 @@ describe('when parsing ', function () {
|
|||||||
expect(edges[1].interpolate).toBe('cardinal')
|
expect(edges[1].interpolate).toBe('cardinal')
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('should handle line interpolation multi-numbered with style', function () {
|
||||||
|
const res = flow.parser.parse('graph TD\n' +
|
||||||
|
'A-->B\n' +
|
||||||
|
'A-->C\n' +
|
||||||
|
'linkStyle 0,1 interpolate basis stroke-width:1px;')
|
||||||
|
|
||||||
|
const vert = flow.parser.yy.getVertices()
|
||||||
|
const edges = flow.parser.yy.getEdges()
|
||||||
|
|
||||||
|
expect(edges[0].interpolate).toBe('basis')
|
||||||
|
expect(edges[1].interpolate).toBe('basis')
|
||||||
|
})
|
||||||
|
|
||||||
describe('it should handle interaction, ', function () {
|
describe('it should handle interaction, ', function () {
|
||||||
it('it should be possible to use click to a callback', function () {
|
it('it should be possible to use click to a callback', function () {
|
||||||
spyOn(flowDb, 'setClickEvent')
|
spyOn(flowDb, 'setClickEvent')
|
||||||
|
Reference in New Issue
Block a user