Comparing version 2.0.0-beta-6 to 2.0.0-beta-7
{ | ||
"name": "mscgenjs", | ||
"version": "2.0.0-beta-6", | ||
"version": "2.0.0-beta-7", | ||
"description": "Sequence chart rendering library", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -58,2 +58,2 @@ /* istanbul ignore else */ | ||
along with mscgen_js. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
*/ |
@@ -83,3 +83,3 @@ /* istanbul ignore else */ | ||
version: "2.0.0-beta-6", | ||
version: "2.0.0-beta-7", | ||
@@ -86,0 +86,0 @@ getAllowedValues: function() { |
@@ -15,3 +15,3 @@ /* istanbul ignore else */ | ||
function(pValidValue){ | ||
return pValidValue === pValue; | ||
return pValidValue.name === pValue; | ||
} | ||
@@ -28,3 +28,3 @@ )){ | ||
pVerticalAlignment, | ||
allowedValues.regularArcTextVerticalAlignment.map(function(pObject) { return pObject.name; }), | ||
allowedValues.regularArcTextVerticalAlignment, | ||
"middle" | ||
@@ -37,3 +37,3 @@ ); | ||
pInputType, | ||
allowedValues.inputType.map(function(pObject) { return pObject.name; }), | ||
allowedValues.inputType, | ||
"mscgen" | ||
@@ -43,2 +43,10 @@ ); | ||
function normalizeAdditionalTemplate(pAdditionalTemplate){ | ||
return normalizeValueFromValidValues( | ||
pAdditionalTemplate, | ||
allowedValues.namedStyle, | ||
"basic" | ||
); | ||
} | ||
function booleanize(pValue, pDefault) { | ||
@@ -59,3 +67,3 @@ return typeof pValue === 'boolean' ? pValue : pDefault; | ||
styleAdditions : pOptions.styleAdditions || null, | ||
additionalTemplate : pOptions.additionalTemplate || null, | ||
additionalTemplate : normalizeAdditionalTemplate(pOptions.additionalTemplate), | ||
mirrorEntitiesOnBottom : booleanize(pOptions.mirrorEntitiesOnBottom, false), | ||
@@ -62,0 +70,0 @@ regularArcTextVerticalAlignment: normalizeVerticalAlignment(pOptions.regularArcTextVerticalAlignment) |
@@ -285,7 +285,5 @@ /* istanbul ignore else */ | ||
function renderEntities(pEntities, pEntityYPos, pOptions) { | ||
if (pEntities) { | ||
gChart.layer.sequence.appendChild( | ||
entities.renderEntities(pEntities, pEntityYPos, pOptions) | ||
); | ||
} | ||
gChart.layer.sequence.appendChild( | ||
entities.renderEntities(pEntities, pEntityYPos, pOptions) | ||
); | ||
gChart.arcEndX = | ||
@@ -292,0 +290,0 @@ entities.getDims().entityXHWM - |
@@ -114,4 +114,3 @@ /* istanbul ignore else */ | ||
function findNamedStyle(pAdditionalTemplate) { | ||
var lRetval = null; | ||
var lNamedStyles = csstemplates.namedStyles.filter( | ||
return csstemplates.namedStyles.find( | ||
function(tpl) { | ||
@@ -121,6 +120,2 @@ return tpl.name === pAdditionalTemplate; | ||
); | ||
if (lNamedStyles.length > 0) { | ||
lRetval = lNamedStyles[0]; | ||
} | ||
return lRetval; | ||
} | ||
@@ -130,54 +125,21 @@ | ||
var lRetval = ""; | ||
var lNamedStyle = {}; | ||
var lNamedStyle = findNamedStyle(pOptions.additionalTemplate); | ||
/* istanbul ignore if */ | ||
if (!Boolean(pOptions)) { | ||
return ""; | ||
if (Boolean(lNamedStyle)){ | ||
lRetval = lNamedStyle.renderMagic; | ||
} | ||
if (Boolean(pOptions.additionalTemplate)) { | ||
lNamedStyle = findNamedStyle(pOptions.additionalTemplate); | ||
if (Boolean(lNamedStyle)){ | ||
lRetval = lNamedStyle.renderMagic; | ||
} | ||
} | ||
return lRetval; | ||
} | ||
function distillCSS(pOptions, pPosition) { | ||
var lStyleString = ""; | ||
var lNamedStyle = {}; | ||
/* istanbul ignore if */ | ||
if (!Boolean(pOptions)) { | ||
return ""; | ||
} | ||
if (Boolean(pOptions.additionalTemplate)) { | ||
lNamedStyle = findNamedStyle(pOptions.additionalTemplate); | ||
if (Boolean(lNamedStyle)){ | ||
lStyleString = lNamedStyle[pPosition]; | ||
} | ||
} | ||
return lStyleString; | ||
function composeStyleSheetTemplate(pNamedStyle, pStyleAdditions){ | ||
return (pNamedStyle.cssBefore || "") + | ||
csstemplates.baseTemplate + | ||
(pNamedStyle.cssAfter || "") + | ||
(pStyleAdditions || ""); | ||
} | ||
function distillAfterCSS(pOptions) { | ||
var lStyleString = distillCSS(pOptions, "cssAfter"); | ||
if (Boolean(pOptions.styleAdditions)) { | ||
lStyleString += pOptions.styleAdditions; | ||
} | ||
return lStyleString; | ||
} | ||
function distillBeforeCSS(pOptions) { | ||
return distillCSS(pOptions, "cssBefore"); | ||
} | ||
function setupStyleElement(pOptions, pSvgElementId) { | ||
return (distillBeforeCSS(pOptions) + csstemplates.baseTemplate + distillAfterCSS(pOptions)) | ||
var lNamedStyle = findNamedStyle(pOptions.additionalTemplate) || {}; | ||
return (composeStyleSheetTemplate(lNamedStyle, pOptions.styleAdditions)) | ||
.replace(/<%=fontSize%>/g, constants.FONT_SIZE) | ||
@@ -217,7 +179,2 @@ .replace(/<%=lineWidth%>/g, constants.LINE_WIDTH) | ||
}); | ||
/* eslint security/detect-object-injection: 0*/ | ||
/* The 'generic object injection sink' is to a frozen object, | ||
attempts to modify it will be moot => we can safely use the [] | ||
notation | ||
*/ | ||
/* | ||
@@ -224,0 +181,0 @@ This file is part of mscgen_js. |
@@ -61,11 +61,8 @@ /* istanbul ignore else */ | ||
getByRealRowNumber: function (pRealRowNumber) { | ||
var lRetval = 0; | ||
var lRowInfoArray = gRowInfoArray.filter(function(pRowInfo){ | ||
var lRetval = gRowInfoArray.find(function(pRowInfo){ | ||
return pRowInfo.realRowNumber === pRealRowNumber; | ||
}); | ||
if (lRowInfoArray.length > 0){ | ||
lRetval = lRowInfoArray[0]; | ||
} else { // most likely asking for something below the bottom of the chart => return the bottom | ||
if (typeof lRetval === 'undefined'){ | ||
// most likely asking for something below the bottom of the chart => return the bottom | ||
lRetval = getLast(); | ||
@@ -72,0 +69,0 @@ } |
Sorry, the diff of this file is too big to display
927438
20225