entitree-flex
Advanced tools
Comparing version 0.3.0 to 0.3.1
@@ -13,3 +13,3 @@ "use strict"; | ||
sibling.height = sibling.height || settings.nodeHeight; | ||
sibling.marginRight = settings.nextBeforeSpacing; //todo: check | ||
sibling.marginRight = settings.nextBeforeSpacing; | ||
sibling.marginBottom = settings.sourceTargetSpacing; | ||
@@ -23,6 +23,8 @@ }); | ||
partner.height = partner.height || settings.nodeHeight; | ||
if (partnerIndex === partners.length - 1) | ||
partner.marginRight = settings.differentGroupSpacing; | ||
if (partnerIndex === partners.length - 1) { | ||
//secondDegreeSpacing because you want more space between the last spouse and the next child, so the don't get confused as both children | ||
partner.marginRight = settings.secondDegreeSpacing; | ||
} | ||
else | ||
partner.marginRight = settings.nextBeforeSpacing; | ||
partner.marginRight = settings.nextAfterSpacing; | ||
partner.marginBottom = settings.sourceTargetSpacing; | ||
@@ -32,6 +34,13 @@ }); | ||
node.height = node.height || settings.nodeHeight; | ||
if (index === nodes.length - 1 && (!partners || !partners.length)) | ||
node.marginRight = settings.differentGroupSpacing; | ||
else | ||
node.marginRight = settings.nextBeforeSpacing; | ||
if (partners && partners.length) { | ||
node.marginRight = settings.nextAfterSpacing; //for sure there is an after node | ||
} | ||
else { | ||
if (index === nodes.length - 1) { | ||
node.marginRight = settings.secondDegreeSpacing; // there is a cousin next | ||
} | ||
else { | ||
node.marginRight = settings.firstDegreeSpacing; //there is sibling next | ||
} | ||
} | ||
node.marginBottom = settings.sourceTargetSpacing; | ||
@@ -38,0 +47,0 @@ }); |
@@ -5,17 +5,18 @@ "use strict"; | ||
exports.defaultSettings = { | ||
targetsAccessor: "children", | ||
differentGroupSpacing: 20, | ||
clone: false, | ||
enableFlex: true, | ||
firstDegreeSpacing: 15, | ||
nextAfterAccessor: "partners", | ||
nextAfterSpacing: 10, | ||
nextBeforeAccessor: "siblings", | ||
nextBeforeSpacing: 10, | ||
nodeHeight: 40, | ||
nodeWidth: 40, | ||
enableFlex: true, | ||
sourcesAccessor: "parents", | ||
nextAfterAccessor: "partners", | ||
rootX: 0, | ||
rootY: 0, | ||
nextBeforeAccessor: "siblings", | ||
nextBeforeSpacing: 10, | ||
nextAfterSpacing: 10, | ||
secondDegreeSpacing: 20, | ||
sourcesAccessor: "parents", | ||
sourceTargetSpacing: 10, | ||
clone: false, | ||
targetsAccessor: "children", | ||
}; | ||
//# sourceMappingURL=defaultSettings.js.map |
export declare type Settings = { | ||
clone: boolean; | ||
differentGroupSpacing: number; | ||
firstDegreeSpacing: number; | ||
secondDegreeSpacing: number; | ||
enableFlex: boolean; | ||
nextAfterAccessor: string; | ||
nextAfterSpacing: number; | ||
nextBeforeAccessor: string; | ||
nextBeforeSpacing: number; | ||
nodeHeight: number; | ||
nodeWidth: number; | ||
sourcesAccessor: string; | ||
nextAfterAccessor: string; | ||
rootX: number; | ||
rootY: number; | ||
nextBeforeAccessor: string; | ||
nextBeforeSpacing: number; | ||
nextAfterSpacing: number; | ||
sourcesAccessor: string; | ||
sourceTargetSpacing: number; | ||
targetsAccessor: string; | ||
sourceTargetSpacing: number; | ||
}; |
{ | ||
"name": "entitree-flex", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "Flexible Tree layout supporting ancestors, descendants and side nodes", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -130,16 +130,17 @@ # entitree-flex | ||
defaultSettings = { | ||
targetsAccessor: "children", // what prop to use to pick children | ||
differentGroupSpacing: 20, // spacing in px between "cousins" | ||
clone: false, // returns a copy of the input, if your application does not allow editing the original object | ||
firstDegreeSpacing: 15, // spacing in px between nodes belonging to the same source, eg children with same parent | ||
secondDegreeSpacing: 20, // spacing in px between nodes not belonging to same parent eg "cousin" nodes | ||
enableFlex: true, // has slightly better perfomance if turned off (node.width, node.height will not be read) | ||
nextAfterAccessor: "partners", // the side node prop used to go sideways, AFTER the current node | ||
nextAfterSpacing: 10, // the spacing of the "side" nodes AFTER the current node | ||
nextBeforeAccessor: "siblings", // the side node prop used to go sideways, BEFORE the current node | ||
nextBeforeSpacing: 10, // the spacing of the "side" nodes BEFORE the current node | ||
nodeHeight: 40, // default node height in px | ||
nodeWidth: 40, // default node width in px | ||
enableFlex: true, // has slightly better perfomance if turned off (node.width, node.height will not be read) | ||
rootX: 0, // set root position if other than 0 | ||
rootY: 0, // set root position if other than 0 | ||
sourcesAccessor: "parents", // the prop used to go up the ancestors | ||
nextAfterAccessor: "partners", // the side node prop used to go sideways, AFTER the current node | ||
rootX: 0, // default root position | ||
rootY: 0, // default root position | ||
nextBeforeAccessor: "siblings", // the side node prop used to go sideways, BEFORE the current node | ||
nextBeforeSpacing: 10, | ||
nextAfterSpacing: 10, | ||
sourceTargetSpacing: 10, | ||
clone: false, // returns a clone, if your application does not allow editing the original object | ||
sourceTargetSpacing: 10, // the "vertical" spacing in vertical layout | ||
targetsAccessor: "children", // what prop to use to pick up children | ||
}; | ||
@@ -146,0 +147,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
95866
1101
152