diff --git a/CHANGELOG.md b/CHANGELOG.md index 4742743..a7b688c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ + +## [1.3.2](https://github.com/ErikGartner/dtree/compare/1.3.1...v1.3.2) (2016-07-21) + + + + ## [1.3.1](https://github.com/ErikGartner/dtree/compare/1.3.0...v1.3.1) (2016-03-08) diff --git a/README.md b/README.md index be90a05..1431f96 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ There are several ways to use dTree. One way is to simply include the compiled f Lastly dTree is also available through the RawGit CDN: ``` -https://cdn.rawgit.com/ErikGartner/dTree/1.3.1/dist/dTree.min.js +https://cdn.rawgit.com/ErikGartner/dTree/1.3.2/dist/dTree.min.js ``` ## Requirements diff --git a/dist/dTree.js b/dist/dTree.js index 83bf3c0..ae1efce 100644 --- a/dist/dTree.js +++ b/dist/dTree.js @@ -273,7 +273,7 @@ function _classCallCheck(instance, Constructor) { if (!(instance instanceof Cons var dTree = { - VERSION: '1.3.1', + VERSION: '1.3.2', init: function init(data) { var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; diff --git a/dist/dTree.js.map b/dist/dTree.js.map index 5cc67c0..f91f862 100644 --- a/dist/dTree.js.map +++ b/dist/dTree.js.map @@ -1 +1 @@ -{"version":3,"sources":["dTree.js"],"names":[],"mappings":";;;;AAAA,AAAC,CAAA,UAAU,MAAM,EAAE,OAAO,EAAE;AAC1B,SAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,MAAM,KAAK,WAAW,GAAG,MAAM,CAAC,OAAO,GAAG,OAAO,EAAE,GACzF,OAAO,MAAM,KAAK,UAAU,IAAI,MAAM,CAAC,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,GAC5D,MAAM,CAAC,KAAK,GAAG,OAAO,EAAE,CAAC;CAC1B,CAAA,CAAC,IAAI,EAAE,YAAY;AAAE,cAAY,CAAC;;MAE3B,WAAW;AAEJ,aAFP,WAAW,CAEH,IAAI,EAAE,QAA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,CAAC,IAAI,CAAC,UAAS,SAAS,EAAE,SAAS,EAAE;AAC5C,cAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;AACzB,cAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;AACzB,iBAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SACpE,CAAC,CAAC;OACJ;AACD,aAAO,SAAS,CAAC;KAClB;;GAEF,CAAC;;AAEF,SAAO,KAAK,CAAC;CAEd,CAAC,CAAE","file":"dTree.js","sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.dTree = factory();\n}(this, function () { 'use strict';\n\n class TreeBuilder {\n\n constructor(root, siblings, opts) {\n TreeBuilder.DEBUG_LEVEL = opts.debug ? 1 : 0;\n\n this.root = root;\n this.siblings = siblings;\n this.opts = opts;\n\n // flatten nodes\n this.allNodes = this._flatten(this.root);\n\n // Calculate node size\n var visibleNodes = _.filter(this.allNodes, function(n) {\n return !n.hidden;\n });\n this.nodeSize = opts.callbacks.nodeSize(visibleNodes,\n opts.nodeWidth, opts.callbacks.textRenderer);\n }\n\n create() {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var width = opts.width + opts.margin.left + opts.margin.right;\n var height = opts.height + opts.margin.top + opts.margin.bottom;\n\n var zoom = d3.behavior.zoom()\n .scaleExtent([0.1, 10])\n .on('zoom', _.bind(function() {\n svg.attr('transform', 'translate(' + d3.event.translate + ')' +\n ' scale(' + d3.event.scale + ')');\n }, this));\n\n //make an SVG\n var svg = this.svg = d3.select(opts.target)\n .append('svg')\n .attr('width', width)\n .attr('height', height)\n .call(zoom)\n .append('g')\n .attr('transform', 'translate(' + width / 2 + ',' + opts.margin.top + ')');\n\n zoom.translate([width / 2, opts.margin.top]);\n\n // Compute the layout.\n this.tree = d3.layout.tree()\n .nodeSize([nodeSize[0] * 2, nodeSize[1] * 2.5]);\n\n this.tree.separation(function separation(a, b) {\n if (a.hidden || b.hidden) {\n return 0.3;\n } else {\n return 0.6;\n }\n });\n\n this._update(this.root);\n\n }\n\n _update(source) {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var nodes = this.tree.nodes(source);\n\n var links = this.tree.links(nodes);\n\n // Create the link lines.\n this.svg.selectAll('.link')\n .data(links)\n .enter()\n .append('path')\n .attr('class', opts.styles.linage)\n .attr('d', this._elbow);\n\n var nodes = this.svg.selectAll('.node')\n .data(nodes)\n .enter();\n\n this._linkSiblings();\n\n // Draw siblings (marriage)\n this.svg.selectAll('.sibling')\n .data(this.siblings)\n .enter()\n .append('path')\n .attr('class', opts.styles.marriage)\n .attr('d', _.bind(this._siblingLine, this));\n\n // Create the node rectangles.\n nodes.append('foreignObject')\n .filter(function(d) {\n return d.hidden ? false : true;\n })\n .attr('x', function(d) {\n return d.x - d.cWidth / 2 + 'px';\n })\n .attr('y', function(d) {\n return d.y - d.cHeight / 2 + 'px';\n })\n .attr('width', function(d) {\n return d.cWidth + 'px';\n })\n .attr('height', function(d) {\n return d.cHeight + 'px';\n })\n .attr('id', function(d) {\n return d.id;\n })\n .html(function(d) {\n return opts.callbacks.nodeRenderer(\n d.name,\n d.x,\n d.y,\n nodeSize[0],\n nodeSize[1],\n d.extra,\n d.id,\n d.class,\n d.textClass,\n opts.callbacks.textRenderer);\n })\n .on('click', function(d) {\n if (d.hidden) {\n return;\n }\n opts.callbacks.nodeClick(d.name, d.extra, d.id);\n });\n }\n\n _flatten(root) {\n var n = [];\n var i = 0;\n\n function recurse(node) {\n if (node.children) {\n node.children.forEach(recurse);\n }\n if (!node.id) {\n node.id = ++i;\n }\n n.push(node);\n }\n recurse(root);\n return n;\n }\n\n _elbow(d, i) {\n if (d.target.noParent) {\n return 'M0,0L0,0';\n }\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n\n var linedata = [{\n x: d.target.x,\n y: d.target.y\n }, {\n x: d.target.x,\n y: ny\n }, {\n x: d.source.x,\n y: d.source.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('step-after');\n return fun(linedata);\n }\n\n _linkSiblings() {\n\n var allNodes = this.allNodes;\n\n _.forEach(this.siblings, function(d) {\n var start = allNodes.filter(function(v) {\n return d.source.id == v.id;\n });\n var end = allNodes.filter(function(v) {\n return d.target.id == v.id;\n });\n d.source.x = start[0].x;\n d.source.y = start[0].y;\n d.target.x = end[0].x;\n d.target.y = end[0].y;\n });\n\n }\n\n _siblingLine(d, i) {\n\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n var nodeWidth = this.nodeSize[0];\n var nodeHeight = this.nodeSize[1];\n\n // Not first marriage\n if (d.number > 0) {\n ny -= nodeHeight * 8 / 10;\n }\n\n var linedata = [{\n x: d.source.x,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: d.target.y\n }, {\n x: d.target.x,\n y: d.target.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('linear');\n return fun(linedata);\n }\n\n static _nodeSize(nodes, width, textRenderer) {\n var maxWidth = 0;\n var maxHeight = 0;\n var tmpSvg = document.createElement('svg');\n document.body.appendChild(tmpSvg);\n\n _.map(nodes, function(n) {\n var container = document.createElement('div');\n container.setAttribute('class', n.class);\n container.style.visibility = 'hidden';\n container.style.maxWidth = width + 'px';\n\n var text = textRenderer(n.name, n.extra, n.textClass);\n container.innerHTML = text;\n\n tmpSvg.appendChild(container);\n var height = container.offsetHeight;\n tmpSvg.removeChild(container);\n\n maxHeight = Math.max(maxHeight, height);\n n.cHeight = height;\n n.cWidth = width;\n });\n document.body.removeChild(tmpSvg);\n\n return [width, maxHeight];\n }\n\n static _nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n var node = '';\n node += '
\\n';\n node += name;\n node += '
\\n';\n return node;\n }\n\n static _debug(msg) {\n if (TreeBuilder.DEBUG_LEVEL > 0) {\n console.log(msg);\n }\n }\n\n }\n\n const dTree = {\n\n VERSION: '1.3.1',\n\n init: function(data, options = {}) {\n\n var opts = _.defaultsDeep(options || {}, {\n target: '#graph',\n debug: false,\n width: 600,\n height: 600,\n callbacks: {\n nodeClick: function(name, extra, id) {},\n nodeRenderer: function(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n return TreeBuilder._nodeRenderer(name, x, y, height, width, extra,\n id,nodeClass, textClass, textRenderer);\n },\n nodeSize: function(nodes, width, textRenderer) {\n return TreeBuilder._nodeSize(nodes, width, textRenderer);\n },\n nodeSorter: function(aName, aExtra, bName, bExtra) {return 0;},\n textRenderer: function(name, extra, textClass) {\n return TreeBuilder._textRenderer(name, extra, textClass);\n },\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n nodeWidth: 100,\n styles: {\n node: 'node',\n linage: 'linage',\n marriage: 'marriage',\n text: 'nodeText'\n }\n });\n\n var data = this._preprocess(data, opts);\n var treeBuilder = new TreeBuilder(data.root, data.siblings, opts);\n treeBuilder.create();\n\n },\n\n _preprocess: function(data, opts) {\n\n var siblings = [];\n var id = 0;\n\n var root = {\n name: '',\n id: id++,\n hidden: true,\n children: []\n };\n\n var reconstructTree = function(person, parent) {\n\n // convert to person to d3 node\n var node = {\n name: person.name,\n id: id++,\n hidden: false,\n children: [],\n extra: person.extra,\n textClass: person.textClass ? person.textClass : opts.styles.text,\n class: person.class ? person.class : opts.styles.node\n };\n\n // hide linages to the hidden root node\n if (parent == root) {\n node.noParent = true;\n }\n\n // apply depth offset\n for (var i = 0; i < person.depthOffset; i++) {\n var pushNode = {\n name: '',\n id: id++,\n hidden: true,\n children: [],\n noParent: node.noParent\n };\n parent.children.push(pushNode);\n parent = pushNode;\n }\n\n // sort children\n dTree._sortPersons(person.children, opts);\n\n // add \"direct\" children\n _.forEach(person.children, function(child) {\n reconstructTree(child, node);\n });\n\n parent.children.push(node);\n\n // DEPRECATED: Backwards-compatability for v1.x syntax, remove for 2.0\n if (person.marriage) {\n console.log('DEPRECATED: The data attribute \"marriage\" is deprecated in favor of \"marriages\" that takes an array. It will be removed in 2.0.');\n person.marriages = [person.marriage];\n }\n\n //sort marriages\n dTree._sortMarriages(person.marriages, opts);\n\n // go through marriage\n _.forEach(person.marriages, function(marriage, index) {\n\n var m = {\n name: '',\n id: id++,\n hidden: true,\n noParent: true,\n children: [],\n extra: marriage.extra\n };\n\n var sp = marriage.spouse;\n\n var spouse = {\n name: sp.name,\n id: id++,\n hidden: false,\n noParent: true,\n children: [],\n textClass: sp.textClass ? sp.textClass : opts.styles.text,\n class: sp.class ? sp.class : opts.styles.node,\n extra: sp.extra\n };\n\n parent.children.push(m, spouse);\n\n dTree._sortPersons(marriage.children, opts);\n _.forEach(marriage.children, function(child) {\n reconstructTree(child, m);\n });\n\n siblings.push({\n source: {\n id: node.id\n },\n target: {\n id: spouse.id\n },\n number: index\n });\n });\n\n };\n\n _.forEach(data, function(person) {\n reconstructTree(person, root);\n });\n\n return {\n root: root,\n siblings: siblings\n };\n\n },\n\n _sortPersons: function(persons, opts) {\n if (persons != undefined) {\n persons.sort(function(a, b) {\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return persons;\n },\n\n _sortMarriages: function(marriages, opts) {\n if (marriages != undefined && Array.isArray(marriages)) {\n marriages.sort(function(marriageA, marriageB) {\n var a = marriageA.spouse;\n var b = marriageB.spouse;\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\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CAAC;KAEH;;AAED,gBAAY,EAAE,sBAAS,OAAO,EAAE,IAAI,EAAE;AACpC,UAAI,OAAO,IAAI,SAAS,EAAE;AACxB,eAAO,CAAC,IAAI,CAAC,UAAS,CAAC,EAAE,CAAC,EAAE;AAC1B,iBAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SACpE,CAAC,CAAC;OACJ;AACD,aAAO,OAAO,CAAC;KAChB;;AAED,kBAAc,EAAE,wBAAS,SAAS,EAAE,IAAI,EAAE;AACxC,UAAI,SAAS,IAAI,SAAS,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;AACtD,iBAAS,CAAC,IAAI,CAAC,UAAS,SAAS,EAAE,SAAS,EAAE;AAC5C,cAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;AACzB,cAAI,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC;AACzB,iBAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC;SACpE,CAAC,CAAC;OACJ;AACD,aAAO,SAAS,CAAC;KAClB;;GAEF,CAAC;;AAEF,SAAO,KAAK,CAAC;CAEd,CAAC,CAAE","file":"dTree.js","sourcesContent":["(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.dTree = factory();\n}(this, function () { 'use strict';\n\n class TreeBuilder {\n\n constructor(root, siblings, opts) {\n TreeBuilder.DEBUG_LEVEL = opts.debug ? 1 : 0;\n\n this.root = root;\n this.siblings = siblings;\n this.opts = opts;\n\n // flatten nodes\n this.allNodes = this._flatten(this.root);\n\n // Calculate node size\n var visibleNodes = _.filter(this.allNodes, function(n) {\n return !n.hidden;\n });\n this.nodeSize = opts.callbacks.nodeSize(visibleNodes,\n opts.nodeWidth, opts.callbacks.textRenderer);\n }\n\n create() {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var width = opts.width + opts.margin.left + opts.margin.right;\n var height = opts.height + opts.margin.top + opts.margin.bottom;\n\n var zoom = d3.behavior.zoom()\n .scaleExtent([0.1, 10])\n .on('zoom', _.bind(function() {\n svg.attr('transform', 'translate(' + d3.event.translate + ')' +\n ' scale(' + d3.event.scale + ')');\n }, this));\n\n //make an SVG\n var svg = this.svg = d3.select(opts.target)\n .append('svg')\n .attr('width', width)\n .attr('height', height)\n .call(zoom)\n .append('g')\n .attr('transform', 'translate(' + width / 2 + ',' + opts.margin.top + ')');\n\n zoom.translate([width / 2, opts.margin.top]);\n\n // Compute the layout.\n this.tree = d3.layout.tree()\n .nodeSize([nodeSize[0] * 2, nodeSize[1] * 2.5]);\n\n this.tree.separation(function separation(a, b) {\n if (a.hidden || b.hidden) {\n return 0.3;\n } else {\n return 0.6;\n }\n });\n\n this._update(this.root);\n\n }\n\n _update(source) {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var nodes = this.tree.nodes(source);\n\n var links = this.tree.links(nodes);\n\n // Create the link lines.\n this.svg.selectAll('.link')\n .data(links)\n .enter()\n .append('path')\n .attr('class', opts.styles.linage)\n .attr('d', this._elbow);\n\n var nodes = this.svg.selectAll('.node')\n .data(nodes)\n .enter();\n\n this._linkSiblings();\n\n // Draw siblings (marriage)\n this.svg.selectAll('.sibling')\n .data(this.siblings)\n .enter()\n .append('path')\n .attr('class', opts.styles.marriage)\n .attr('d', _.bind(this._siblingLine, this));\n\n // Create the node rectangles.\n nodes.append('foreignObject')\n .filter(function(d) {\n return d.hidden ? false : true;\n })\n .attr('x', function(d) {\n return d.x - d.cWidth / 2 + 'px';\n })\n .attr('y', function(d) {\n return d.y - d.cHeight / 2 + 'px';\n })\n .attr('width', function(d) {\n return d.cWidth + 'px';\n })\n .attr('height', function(d) {\n return d.cHeight + 'px';\n })\n .attr('id', function(d) {\n return d.id;\n })\n .html(function(d) {\n return opts.callbacks.nodeRenderer(\n d.name,\n d.x,\n d.y,\n nodeSize[0],\n nodeSize[1],\n d.extra,\n d.id,\n d.class,\n d.textClass,\n opts.callbacks.textRenderer);\n })\n .on('click', function(d) {\n if (d.hidden) {\n return;\n }\n opts.callbacks.nodeClick(d.name, d.extra, d.id);\n });\n }\n\n _flatten(root) {\n var n = [];\n var i = 0;\n\n function recurse(node) {\n if (node.children) {\n node.children.forEach(recurse);\n }\n if (!node.id) {\n node.id = ++i;\n }\n n.push(node);\n }\n recurse(root);\n return n;\n }\n\n _elbow(d, i) {\n if (d.target.noParent) {\n return 'M0,0L0,0';\n }\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n\n var linedata = [{\n x: d.target.x,\n y: d.target.y\n }, {\n x: d.target.x,\n y: ny\n }, {\n x: d.source.x,\n y: d.source.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('step-after');\n return fun(linedata);\n }\n\n _linkSiblings() {\n\n var allNodes = this.allNodes;\n\n _.forEach(this.siblings, function(d) {\n var start = allNodes.filter(function(v) {\n return d.source.id == v.id;\n });\n var end = allNodes.filter(function(v) {\n return d.target.id == v.id;\n });\n d.source.x = start[0].x;\n d.source.y = start[0].y;\n d.target.x = end[0].x;\n d.target.y = end[0].y;\n });\n\n }\n\n _siblingLine(d, i) {\n\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n var nodeWidth = this.nodeSize[0];\n var nodeHeight = this.nodeSize[1];\n\n // Not first marriage\n if (d.number > 0) {\n ny -= nodeHeight * 8 / 10;\n }\n\n var linedata = [{\n x: d.source.x,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: d.target.y\n }, {\n x: d.target.x,\n y: d.target.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('linear');\n return fun(linedata);\n }\n\n static _nodeSize(nodes, width, textRenderer) {\n var maxWidth = 0;\n var maxHeight = 0;\n var tmpSvg = document.createElement('svg');\n document.body.appendChild(tmpSvg);\n\n _.map(nodes, function(n) {\n var container = document.createElement('div');\n container.setAttribute('class', n.class);\n container.style.visibility = 'hidden';\n container.style.maxWidth = width + 'px';\n\n var text = textRenderer(n.name, n.extra, n.textClass);\n container.innerHTML = text;\n\n tmpSvg.appendChild(container);\n var height = container.offsetHeight;\n tmpSvg.removeChild(container);\n\n maxHeight = Math.max(maxHeight, height);\n n.cHeight = height;\n n.cWidth = width;\n });\n document.body.removeChild(tmpSvg);\n\n return [width, maxHeight];\n }\n\n static _nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n var node = '';\n node += '\\n';\n node += name;\n node += '
\\n';\n return node;\n }\n\n static _debug(msg) {\n if (TreeBuilder.DEBUG_LEVEL > 0) {\n console.log(msg);\n }\n }\n\n }\n\n const dTree = {\n\n VERSION: '1.3.2',\n\n init: function(data, options = {}) {\n\n var opts = _.defaultsDeep(options || {}, {\n target: '#graph',\n debug: false,\n width: 600,\n height: 600,\n callbacks: {\n nodeClick: function(name, extra, id) {},\n nodeRenderer: function(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n return TreeBuilder._nodeRenderer(name, x, y, height, width, extra,\n id,nodeClass, textClass, textRenderer);\n },\n nodeSize: function(nodes, width, textRenderer) {\n return TreeBuilder._nodeSize(nodes, width, textRenderer);\n },\n nodeSorter: function(aName, aExtra, bName, bExtra) {return 0;},\n textRenderer: function(name, extra, textClass) {\n return TreeBuilder._textRenderer(name, extra, textClass);\n },\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n nodeWidth: 100,\n styles: {\n node: 'node',\n linage: 'linage',\n marriage: 'marriage',\n text: 'nodeText'\n }\n });\n\n var data = this._preprocess(data, opts);\n var treeBuilder = new TreeBuilder(data.root, data.siblings, opts);\n treeBuilder.create();\n\n },\n\n _preprocess: function(data, opts) {\n\n var siblings = [];\n var id = 0;\n\n var root = {\n name: '',\n id: id++,\n hidden: true,\n children: []\n };\n\n var reconstructTree = function(person, parent) {\n\n // convert to person to d3 node\n var node = {\n name: person.name,\n id: id++,\n hidden: false,\n children: [],\n extra: person.extra,\n textClass: person.textClass ? person.textClass : opts.styles.text,\n class: person.class ? person.class : opts.styles.node\n };\n\n // hide linages to the hidden root node\n if (parent == root) {\n node.noParent = true;\n }\n\n // apply depth offset\n for (var i = 0; i < person.depthOffset; i++) {\n var pushNode = {\n name: '',\n id: id++,\n hidden: true,\n children: [],\n noParent: node.noParent\n };\n parent.children.push(pushNode);\n parent = pushNode;\n }\n\n // sort children\n dTree._sortPersons(person.children, opts);\n\n // add \"direct\" children\n _.forEach(person.children, function(child) {\n reconstructTree(child, node);\n });\n\n parent.children.push(node);\n\n // DEPRECATED: Backwards-compatability for v1.x syntax, remove for 2.0\n if (person.marriage) {\n console.log('DEPRECATED: The data attribute \"marriage\" is deprecated in favor of \"marriages\" that takes an array. It will be removed in 2.0.');\n person.marriages = [person.marriage];\n }\n\n //sort marriages\n dTree._sortMarriages(person.marriages, opts);\n\n // go through marriage\n _.forEach(person.marriages, function(marriage, index) {\n\n var m = {\n name: '',\n id: id++,\n hidden: true,\n noParent: true,\n children: [],\n extra: marriage.extra\n };\n\n var sp = marriage.spouse;\n\n var spouse = {\n name: sp.name,\n id: id++,\n hidden: false,\n noParent: true,\n children: [],\n textClass: sp.textClass ? sp.textClass : opts.styles.text,\n class: sp.class ? sp.class : opts.styles.node,\n extra: sp.extra\n };\n\n parent.children.push(m, spouse);\n\n dTree._sortPersons(marriage.children, opts);\n _.forEach(marriage.children, function(child) {\n reconstructTree(child, m);\n });\n\n siblings.push({\n source: {\n id: node.id\n },\n target: {\n id: spouse.id\n },\n number: index\n });\n });\n\n };\n\n _.forEach(data, function(person) {\n reconstructTree(person, root);\n });\n\n return {\n root: root,\n siblings: siblings\n };\n\n },\n\n _sortPersons: function(persons, opts) {\n if (persons != undefined) {\n persons.sort(function(a, b) {\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return persons;\n },\n\n _sortMarriages: function(marriages, opts) {\n if (marriages != undefined && Array.isArray(marriages)) {\n marriages.sort(function(marriageA, marriageB) {\n var a = marriageA.spouse;\n var b = marriageB.spouse;\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return marriages;\n }\n\n };\n\n return dTree;\n\n}));"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/dTree.min.js b/dist/dTree.min.js index 6f936a6..646eaca 100644 --- a/dist/dTree.min.js +++ b/dist/dTree.min.js @@ -1,2 +1,2 @@ -function _classCallCheck(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var _createClass=function(){function e(e,t){for(var n=0;n\n',r+=e,r+="
\n"}},{key:"_debug",value:function(t){e.DEBUG_LEVEL>0&&console.log(t)}}]),e}(),t={VERSION:"1.3.1",init:function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=_.defaultsDeep(n||{},{target:"#graph",debug:!1,width:600,height:600,callbacks:{nodeClick:function(e,t,n){},nodeRenderer:function(t,n,r,a,i,s,o,l,d,c){return e._nodeRenderer(t,n,r,a,i,s,o,l,d,c)},nodeSize:function(t,n,r){return e._nodeSize(t,n,r)},nodeSorter:function(e,t,n,r){return 0},textRenderer:function(t,n,r){return e._textRenderer(t,n,r)}},margin:{top:0,right:0,bottom:0,left:0},nodeWidth:100,styles:{node:"node",linage:"linage",marriage:"marriage",text:"nodeText"}}),t=this._preprocess(t,r),a=new e(t.root,t.siblings,r);a.create()},_preprocess:function(e,n){var r=[],a=0,i={name:"",id:a++,hidden:!0,children:[]},s=function o(e,s){var l={name:e.name,id:a++,hidden:!1,children:[],extra:e.extra,textClass:e.textClass?e.textClass:n.styles.text,"class":e["class"]?e["class"]:n.styles.node};s==i&&(l.noParent=!0);for(var d=0;d\n',r+=e,r+="
\n"}},{key:"_debug",value:function(t){e.DEBUG_LEVEL>0&&console.log(t)}}]),e}(),t={VERSION:"1.3.2",init:function(t){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],r=_.defaultsDeep(n||{},{target:"#graph",debug:!1,width:600,height:600,callbacks:{nodeClick:function(e,t,n){},nodeRenderer:function(t,n,r,a,i,s,o,l,d,c){return e._nodeRenderer(t,n,r,a,i,s,o,l,d,c)},nodeSize:function(t,n,r){return e._nodeSize(t,n,r)},nodeSorter:function(e,t,n,r){return 0},textRenderer:function(t,n,r){return e._textRenderer(t,n,r)}},margin:{top:0,right:0,bottom:0,left:0},nodeWidth:100,styles:{node:"node",linage:"linage",marriage:"marriage",text:"nodeText"}}),t=this._preprocess(t,r),a=new e(t.root,t.siblings,r);a.create()},_preprocess:function(e,n){var r=[],a=0,i={name:"",id:a++,hidden:!0,children:[]},s=function o(e,s){var l={name:e.name,id:a++,hidden:!1,children:[],extra:e.extra,textClass:e.textClass?e.textClass:n.styles.text,"class":e["class"]?e["class"]:n.styles.node};s==i&&(l.noParent=!0);for(var d=0;d\\n';\n node += name;\n node += '
\\n';\n return node;\n }\n }, {\n key: '_debug',\n value: function _debug(msg) {\n if (TreeBuilder.DEBUG_LEVEL > 0) {\n console.log(msg);\n }\n }\n }]);\n\n return TreeBuilder;\n })();\n\n var dTree = {\n\n VERSION: '1.3.1',\n\n init: function init(data) {\n var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n var opts = _.defaultsDeep(options || {}, {\n target: '#graph',\n debug: false,\n width: 600,\n height: 600,\n callbacks: {\n nodeClick: function nodeClick(name, extra, id) {},\n nodeRenderer: function nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n return TreeBuilder._nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer);\n },\n nodeSize: function nodeSize(nodes, width, textRenderer) {\n return TreeBuilder._nodeSize(nodes, width, textRenderer);\n },\n nodeSorter: function nodeSorter(aName, aExtra, bName, bExtra) {\n return 0;\n },\n textRenderer: function textRenderer(name, extra, textClass) {\n return TreeBuilder._textRenderer(name, extra, textClass);\n }\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n nodeWidth: 100,\n styles: {\n node: 'node',\n linage: 'linage',\n marriage: 'marriage',\n text: 'nodeText'\n }\n });\n\n var data = this._preprocess(data, opts);\n var treeBuilder = new TreeBuilder(data.root, data.siblings, opts);\n treeBuilder.create();\n },\n\n _preprocess: function _preprocess(data, opts) {\n\n var siblings = [];\n var id = 0;\n\n var root = {\n name: '',\n id: id++,\n hidden: true,\n children: []\n };\n\n var reconstructTree = function reconstructTree(person, parent) {\n\n // convert to person to d3 node\n var node = {\n name: person.name,\n id: id++,\n hidden: false,\n children: [],\n extra: person.extra,\n textClass: person.textClass ? person.textClass : opts.styles.text,\n 'class': person['class'] ? person['class'] : opts.styles.node\n };\n\n // hide linages to the hidden root node\n if (parent == root) {\n node.noParent = true;\n }\n\n // apply depth offset\n for (var i = 0; i < person.depthOffset; i++) {\n var pushNode = {\n name: '',\n id: id++,\n hidden: true,\n children: [],\n noParent: node.noParent\n };\n parent.children.push(pushNode);\n parent = pushNode;\n }\n\n // sort children\n dTree._sortPersons(person.children, opts);\n\n // add \"direct\" children\n _.forEach(person.children, function (child) {\n reconstructTree(child, node);\n });\n\n parent.children.push(node);\n\n // DEPRECATED: Backwards-compatability for v1.x syntax, remove for 2.0\n if (person.marriage) {\n console.log('DEPRECATED: The data attribute \"marriage\" is deprecated in favor of \"marriages\" that takes an array. It will be removed in 2.0.');\n person.marriages = [person.marriage];\n }\n\n //sort marriages\n dTree._sortMarriages(person.marriages, opts);\n\n // go through marriage\n _.forEach(person.marriages, function (marriage, index) {\n\n var m = {\n name: '',\n id: id++,\n hidden: true,\n noParent: true,\n children: [],\n extra: marriage.extra\n };\n\n var sp = marriage.spouse;\n\n var spouse = {\n name: sp.name,\n id: id++,\n hidden: false,\n noParent: true,\n children: [],\n textClass: sp.textClass ? sp.textClass : opts.styles.text,\n 'class': sp['class'] ? sp['class'] : opts.styles.node,\n extra: sp.extra\n };\n\n parent.children.push(m, spouse);\n\n dTree._sortPersons(marriage.children, opts);\n _.forEach(marriage.children, function (child) {\n reconstructTree(child, m);\n });\n\n siblings.push({\n source: {\n id: node.id\n },\n target: {\n id: spouse.id\n },\n number: index\n });\n });\n };\n\n _.forEach(data, function (person) {\n reconstructTree(person, root);\n });\n\n return {\n root: root,\n siblings: siblings\n };\n },\n\n _sortPersons: function _sortPersons(persons, opts) {\n if (persons != undefined) {\n persons.sort(function (a, b) {\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return persons;\n },\n\n _sortMarriages: function _sortMarriages(marriages, opts) {\n if (marriages != undefined && Array.isArray(marriages)) {\n marriages.sort(function (marriageA, marriageB) {\n var a = marriageA.spouse;\n var b = marriageB.spouse;\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return marriages;\n }\n\n };\n\n return dTree;\n});\n//# sourceMappingURL=dTree.js.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.dTree = factory();\n}(this, function () { 'use strict';\n\n class TreeBuilder {\n\n constructor(root, siblings, opts) {\n TreeBuilder.DEBUG_LEVEL = opts.debug ? 1 : 0;\n\n this.root = root;\n this.siblings = siblings;\n this.opts = opts;\n\n // flatten nodes\n this.allNodes = this._flatten(this.root);\n\n // Calculate node size\n var visibleNodes = _.filter(this.allNodes, function(n) {\n return !n.hidden;\n });\n this.nodeSize = opts.callbacks.nodeSize(visibleNodes,\n opts.nodeWidth, opts.callbacks.textRenderer);\n }\n\n create() {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var width = opts.width + opts.margin.left + opts.margin.right;\n var height = opts.height + opts.margin.top + opts.margin.bottom;\n\n var zoom = d3.behavior.zoom()\n .scaleExtent([0.1, 10])\n .on('zoom', _.bind(function() {\n svg.attr('transform', 'translate(' + d3.event.translate + ')' +\n ' scale(' + d3.event.scale + ')');\n }, this));\n\n //make an SVG\n var svg = this.svg = d3.select(opts.target)\n .append('svg')\n .attr('width', width)\n .attr('height', height)\n .call(zoom)\n .append('g')\n .attr('transform', 'translate(' + width / 2 + ',' + opts.margin.top + ')');\n\n zoom.translate([width / 2, opts.margin.top]);\n\n // Compute the layout.\n this.tree = d3.layout.tree()\n .nodeSize([nodeSize[0] * 2, nodeSize[1] * 2.5]);\n\n this.tree.separation(function separation(a, b) {\n if (a.hidden || b.hidden) {\n return 0.3;\n } else {\n return 0.6;\n }\n });\n\n this._update(this.root);\n\n }\n\n _update(source) {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var nodes = this.tree.nodes(source);\n\n var links = this.tree.links(nodes);\n\n // Create the link lines.\n this.svg.selectAll('.link')\n .data(links)\n .enter()\n .append('path')\n .attr('class', opts.styles.linage)\n .attr('d', this._elbow);\n\n var nodes = this.svg.selectAll('.node')\n .data(nodes)\n .enter();\n\n this._linkSiblings();\n\n // Draw siblings (marriage)\n this.svg.selectAll('.sibling')\n .data(this.siblings)\n .enter()\n .append('path')\n .attr('class', opts.styles.marriage)\n .attr('d', _.bind(this._siblingLine, this));\n\n // Create the node rectangles.\n nodes.append('foreignObject')\n .filter(function(d) {\n return d.hidden ? false : true;\n })\n .attr('x', function(d) {\n return d.x - d.cWidth / 2 + 'px';\n })\n .attr('y', function(d) {\n return d.y - d.cHeight / 2 + 'px';\n })\n .attr('width', function(d) {\n return d.cWidth + 'px';\n })\n .attr('height', function(d) {\n return d.cHeight + 'px';\n })\n .attr('id', function(d) {\n return d.id;\n })\n .html(function(d) {\n return opts.callbacks.nodeRenderer(\n d.name,\n d.x,\n d.y,\n nodeSize[0],\n nodeSize[1],\n d.extra,\n d.id,\n d.class,\n d.textClass,\n opts.callbacks.textRenderer);\n })\n .on('click', function(d) {\n if (d.hidden) {\n return;\n }\n opts.callbacks.nodeClick(d.name, d.extra, d.id);\n });\n }\n\n _flatten(root) {\n var n = [];\n var i = 0;\n\n function recurse(node) {\n if (node.children) {\n node.children.forEach(recurse);\n }\n if (!node.id) {\n node.id = ++i;\n }\n n.push(node);\n }\n recurse(root);\n return n;\n }\n\n _elbow(d, i) {\n if (d.target.noParent) {\n return 'M0,0L0,0';\n }\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n\n var linedata = [{\n x: d.target.x,\n y: d.target.y\n }, {\n x: d.target.x,\n y: ny\n }, {\n x: d.source.x,\n y: d.source.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('step-after');\n return fun(linedata);\n }\n\n _linkSiblings() {\n\n var allNodes = this.allNodes;\n\n _.forEach(this.siblings, function(d) {\n var start = allNodes.filter(function(v) {\n return d.source.id == v.id;\n });\n var end = allNodes.filter(function(v) {\n return d.target.id == v.id;\n });\n d.source.x = start[0].x;\n d.source.y = start[0].y;\n d.target.x = end[0].x;\n d.target.y = end[0].y;\n });\n\n }\n\n _siblingLine(d, i) {\n\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n var nodeWidth = this.nodeSize[0];\n var nodeHeight = this.nodeSize[1];\n\n // Not first marriage\n if (d.number > 0) {\n ny -= nodeHeight * 8 / 10;\n }\n\n var linedata = [{\n x: d.source.x,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: d.target.y\n }, {\n x: d.target.x,\n y: d.target.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('linear');\n return fun(linedata);\n }\n\n static _nodeSize(nodes, width, textRenderer) {\n var maxWidth = 0;\n var maxHeight = 0;\n var tmpSvg = document.createElement('svg');\n document.body.appendChild(tmpSvg);\n\n _.map(nodes, function(n) {\n var container = document.createElement('div');\n container.setAttribute('class', n.class);\n container.style.visibility = 'hidden';\n container.style.maxWidth = width + 'px';\n\n var text = textRenderer(n.name, n.extra, n.textClass);\n container.innerHTML = text;\n\n tmpSvg.appendChild(container);\n var height = container.offsetHeight;\n tmpSvg.removeChild(container);\n\n maxHeight = Math.max(maxHeight, height);\n n.cHeight = height;\n n.cWidth = width;\n });\n document.body.removeChild(tmpSvg);\n\n return [width, maxHeight];\n }\n\n static _nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n var node = '';\n node += '\\n';\n node += name;\n node += '
\\n';\n return node;\n }\n\n static _debug(msg) {\n if (TreeBuilder.DEBUG_LEVEL > 0) {\n console.log(msg);\n }\n }\n\n }\n\n const dTree = {\n\n VERSION: '1.3.1',\n\n init: function(data, options = {}) {\n\n var opts = _.defaultsDeep(options || {}, {\n target: '#graph',\n debug: false,\n width: 600,\n height: 600,\n callbacks: {\n nodeClick: function(name, extra, id) {},\n nodeRenderer: function(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n return TreeBuilder._nodeRenderer(name, x, y, height, width, extra,\n id,nodeClass, textClass, textRenderer);\n },\n nodeSize: function(nodes, width, textRenderer) {\n return TreeBuilder._nodeSize(nodes, width, textRenderer);\n },\n nodeSorter: function(aName, aExtra, bName, bExtra) {return 0;},\n textRenderer: function(name, extra, textClass) {\n return TreeBuilder._textRenderer(name, extra, textClass);\n },\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n nodeWidth: 100,\n styles: {\n node: 'node',\n linage: 'linage',\n marriage: 'marriage',\n text: 'nodeText'\n }\n });\n\n var data = this._preprocess(data, opts);\n var treeBuilder = new TreeBuilder(data.root, data.siblings, opts);\n treeBuilder.create();\n\n },\n\n _preprocess: function(data, opts) {\n\n var siblings = [];\n var id = 0;\n\n var root = {\n name: '',\n id: id++,\n hidden: true,\n children: []\n };\n\n var reconstructTree = function(person, parent) {\n\n // convert to person to d3 node\n var node = {\n name: person.name,\n id: id++,\n hidden: false,\n children: [],\n extra: person.extra,\n textClass: person.textClass ? person.textClass : opts.styles.text,\n class: person.class ? person.class : opts.styles.node\n };\n\n // hide linages to the hidden root node\n if (parent == root) {\n node.noParent = true;\n }\n\n // apply depth offset\n for (var i = 0; i < person.depthOffset; i++) {\n var pushNode = {\n name: '',\n id: id++,\n hidden: true,\n children: [],\n noParent: node.noParent\n };\n parent.children.push(pushNode);\n parent = pushNode;\n }\n\n // sort children\n dTree._sortPersons(person.children, opts);\n\n // add \"direct\" children\n _.forEach(person.children, function(child) {\n reconstructTree(child, node);\n });\n\n parent.children.push(node);\n\n // DEPRECATED: Backwards-compatability for v1.x syntax, remove for 2.0\n if (person.marriage) {\n console.log('DEPRECATED: The data attribute \"marriage\" is deprecated in favor of \"marriages\" that takes an array. It will be removed in 2.0.');\n person.marriages = [person.marriage];\n }\n\n //sort marriages\n dTree._sortMarriages(person.marriages, opts);\n\n // go through marriage\n _.forEach(person.marriages, function(marriage, index) {\n\n var m = {\n name: '',\n id: id++,\n hidden: true,\n noParent: true,\n children: [],\n extra: marriage.extra\n };\n\n var sp = marriage.spouse;\n\n var spouse = {\n name: sp.name,\n id: id++,\n hidden: false,\n noParent: true,\n children: [],\n textClass: sp.textClass ? sp.textClass : opts.styles.text,\n class: sp.class ? sp.class : opts.styles.node,\n extra: sp.extra\n };\n\n parent.children.push(m, spouse);\n\n dTree._sortPersons(marriage.children, opts);\n _.forEach(marriage.children, function(child) {\n reconstructTree(child, m);\n });\n\n siblings.push({\n source: {\n id: node.id\n },\n target: {\n id: spouse.id\n },\n number: index\n });\n });\n\n };\n\n _.forEach(data, function(person) {\n reconstructTree(person, root);\n });\n\n return {\n root: root,\n siblings: siblings\n };\n\n },\n\n _sortPersons: function(persons, opts) {\n if (persons != undefined) {\n persons.sort(function(a, b) {\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return persons;\n },\n\n _sortMarriages: function(marriages, opts) {\n if (marriages != undefined && Array.isArray(marriages)) {\n marriages.sort(function(marriageA, marriageB) {\n var a = marriageA.spouse;\n var b = marriageB.spouse;\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return marriages;\n }\n\n };\n\n return dTree;\n\n}));"],"sourceRoot":"/source/"} \ No newline at end of file +{"version":3,"sources":["dTree.min.js","/source/dTree.js"],"names":["_classCallCheck","instance","Constructor","TypeError","_createClass","defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","protoProps","staticProps","prototype","global","factory","exports","module","define","amd","dTree","this","TreeBuilder","root","siblings","opts","DEBUG_LEVEL","debug","allNodes","_flatten","visibleNodes","_","filter","n","hidden","nodeSize","callbacks","nodeWidth","textRenderer","value","width","margin","left","right","height","top","bottom","zoom","d3","behavior","scaleExtent","on","bind","svg","attr","event","translate","scale","select","append","call","tree","layout","separation","a","b","_update","source","nodes","links","selectAll","data","enter","styles","linage","_elbow","_linkSiblings","marriage","_siblingLine","d","x","cWidth","y","cHeight","id","html","nodeRenderer","name","extra","textClass","nodeClick","recurse","node","children","forEach","push","noParent","ny","linedata","fun","line","interpolate","start","v","end","nodeHeight","number","maxHeight","tmpSvg","document","createElement","body","appendChild","map","container","setAttribute","style","visibility","maxWidth","text","innerHTML","offsetHeight","removeChild","Math","max","nodeClass","msg","console","log","VERSION","init","options","arguments","undefined","defaultsDeep","_nodeRenderer","_nodeSize","nodeSorter","aName","aExtra","bName","bExtra","_textRenderer","_preprocess","treeBuilder","create","reconstructTree","person","parent","class","depthOffset","pushNode","_sortPersons","child","marriages","_sortMarriages","index","m","sp","spouse","persons","sort","Array","isArray","marriageA","marriageB"],"mappings":"AAEA,QAASA,iBAAgBC,EAAUC,GAAe,KAAMD,YAAoBC,IAAgB,KAAM,IAAIC,WAAU,qCAFhH,GAAIC,cAAe,WAAe,QAASC,GAAiBC,EAAQC,GAAS,IAAK,GAAIC,GAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CAAE,GAAIE,GAAaH,EAAMC,EAAIE,GAAWC,WAAaD,EAAWC,aAAc,EAAOD,EAAWE,cAAe,EAAU,SAAWF,KAAYA,EAAWG,UAAW,GAAMC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAAiB,MAAO,UAAUR,EAAae,EAAYC,GAAiJ,MAA9HD,IAAYZ,EAAiBH,EAAYiB,UAAWF,GAAiBC,GAAab,EAAiBH,EAAagB,GAAqBhB,OCAjiB,SAAWkB,EAAQC,GACE,gBAAZC,UAA0C,mBAAXC,QAAyBA,OAAOD,QAAUD,IAC9D,kBAAXG,SAAyBA,OAAOC,IAAMD,OAAOH,GACpDD,EAAOM,MAAQL,KACfM,KAAM,WAAc,YDKpB,ICHMC,GAAW,WAEJ,QAFPA,GAEQC,EAAMC,EAAUC,GDG1B/B,gBAAgB2B,KCLdC,GAGFA,EAAYI,YAAcD,EAAKE,MAAQ,EAAI,EAE3CN,KAAKE,KAAOA,EACZF,KAAKG,SAAWA,EAChBH,KAAKI,KAAOA,EAGZJ,KAAKO,SAAWP,KAAKQ,SAASR,KAAKE,KAGnC,IAAIO,GAAeC,EAAEC,OAAOX,KAAKO,SAAU,SAASK,GAClD,OAAQA,EAAEC,QAEZb,MAAKc,SAAWV,EAAKW,UAAUD,SAASL,EACtCL,EAAKY,UAAWZ,EAAKW,UAAUE,cDuPnC,MAjPAxC,cCvBIwB,IDwBFZ,IAAK,SACL6B,MCLI,WAE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EAAE,SAASA,EAAE,SAASrI,EAAKgD,OAAOmB,KACzCJ,MAAOsE,EAAGtE,MAGZ4D,GAAOvD,SAASE,KAAK8D,EAAGE,GAExB3I,EAAMoI,aAAa3E,EAASgB,SAAUpE,GACtCM,EAAE+D,QAAQjB,EAASgB,SAAU,SAAS4D,GACpCP,EAAgBO,EAAOI,KAGzBrI,EAASuE,MACP5B,QACEiB,GAAIQ,EAAKR,IAEXpF,QACEoF,GAAI2E,EAAO3E,IAEbsB,OAAQkD,MAUd,OAJA7H,GAAE+D,QAAQvB,EAAM,SAAS4E,GACvBD,EAAgBC,EAAQ5H,MAIxBA,KAAMA,EACNC,SAAUA,IAKdgI,aAAc,SAASQ,EAASvI,GAM9B,MALe4G,SAAX2B,GACFA,EAAQC,KAAK,SAASjG,EAAGC,GACvB,MAAOxC,GAAKW,UAAUqG,WAAWzE,EAAEuB,KAAMvB,EAAEwB,MAAOvB,EAAEsB,KAAMtB,EAAEuB,SAGzDwE,GAGTL,eAAgB,SAASD,EAAWjI,GAQlC,MAPiB4G,SAAbqB,GAA0BQ,MAAMC,QAAQT,IAC1CA,EAAUO,KAAK,SAASG,EAAWC,GACjC,GAAIrG,GAAIoG,EAAUL,OACd9F,EAAIoG,EAAUN,MAClB,OAAOtI,GAAKW,UAAUqG,WAAWzE,EAAEuB,KAAMvB,EAAEwB,MAAOvB,EAAEsB,KAAMtB,EAAEuB,SAGzDkE,GAKX,OAAOtI","file":"dTree.min.js","sourcesContent":["var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } }\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : typeof define === 'function' && define.amd ? define(factory) : global.dTree = factory();\n})(this, function () {\n 'use strict';\n\n var TreeBuilder = (function () {\n function TreeBuilder(root, siblings, opts) {\n _classCallCheck(this, TreeBuilder);\n\n TreeBuilder.DEBUG_LEVEL = opts.debug ? 1 : 0;\n\n this.root = root;\n this.siblings = siblings;\n this.opts = opts;\n\n // flatten nodes\n this.allNodes = this._flatten(this.root);\n\n // Calculate node size\n var visibleNodes = _.filter(this.allNodes, function (n) {\n return !n.hidden;\n });\n this.nodeSize = opts.callbacks.nodeSize(visibleNodes, opts.nodeWidth, opts.callbacks.textRenderer);\n }\n\n _createClass(TreeBuilder, [{\n key: 'create',\n value: function create() {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var width = opts.width + opts.margin.left + opts.margin.right;\n var height = opts.height + opts.margin.top + opts.margin.bottom;\n\n var zoom = d3.behavior.zoom().scaleExtent([0.1, 10]).on('zoom', _.bind(function () {\n svg.attr('transform', 'translate(' + d3.event.translate + ')' + ' scale(' + d3.event.scale + ')');\n }, this));\n\n //make an SVG\n var svg = this.svg = d3.select(opts.target).append('svg').attr('width', width).attr('height', height).call(zoom).append('g').attr('transform', 'translate(' + width / 2 + ',' + opts.margin.top + ')');\n\n zoom.translate([width / 2, opts.margin.top]);\n\n // Compute the layout.\n this.tree = d3.layout.tree().nodeSize([nodeSize[0] * 2, nodeSize[1] * 2.5]);\n\n this.tree.separation(function separation(a, b) {\n if (a.hidden || b.hidden) {\n return 0.3;\n } else {\n return 0.6;\n }\n });\n\n this._update(this.root);\n }\n }, {\n key: '_update',\n value: function _update(source) {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var nodes = this.tree.nodes(source);\n\n var links = this.tree.links(nodes);\n\n // Create the link lines.\n this.svg.selectAll('.link').data(links).enter().append('path').attr('class', opts.styles.linage).attr('d', this._elbow);\n\n var nodes = this.svg.selectAll('.node').data(nodes).enter();\n\n this._linkSiblings();\n\n // Draw siblings (marriage)\n this.svg.selectAll('.sibling').data(this.siblings).enter().append('path').attr('class', opts.styles.marriage).attr('d', _.bind(this._siblingLine, this));\n\n // Create the node rectangles.\n nodes.append('foreignObject').filter(function (d) {\n return d.hidden ? false : true;\n }).attr('x', function (d) {\n return d.x - d.cWidth / 2 + 'px';\n }).attr('y', function (d) {\n return d.y - d.cHeight / 2 + 'px';\n }).attr('width', function (d) {\n return d.cWidth + 'px';\n }).attr('height', function (d) {\n return d.cHeight + 'px';\n }).attr('id', function (d) {\n return d.id;\n }).html(function (d) {\n return opts.callbacks.nodeRenderer(d.name, d.x, d.y, nodeSize[0], nodeSize[1], d.extra, d.id, d['class'], d.textClass, opts.callbacks.textRenderer);\n }).on('click', function (d) {\n if (d.hidden) {\n return;\n }\n opts.callbacks.nodeClick(d.name, d.extra, d.id);\n });\n }\n }, {\n key: '_flatten',\n value: function _flatten(root) {\n var n = [];\n var i = 0;\n\n function recurse(node) {\n if (node.children) {\n node.children.forEach(recurse);\n }\n if (!node.id) {\n node.id = ++i;\n }\n n.push(node);\n }\n recurse(root);\n return n;\n }\n }, {\n key: '_elbow',\n value: function _elbow(d, i) {\n if (d.target.noParent) {\n return 'M0,0L0,0';\n }\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n\n var linedata = [{\n x: d.target.x,\n y: d.target.y\n }, {\n x: d.target.x,\n y: ny\n }, {\n x: d.source.x,\n y: d.source.y\n }];\n\n var fun = d3.svg.line().x(function (d) {\n return d.x;\n }).y(function (d) {\n return d.y;\n }).interpolate('step-after');\n return fun(linedata);\n }\n }, {\n key: '_linkSiblings',\n value: function _linkSiblings() {\n\n var allNodes = this.allNodes;\n\n _.forEach(this.siblings, function (d) {\n var start = allNodes.filter(function (v) {\n return d.source.id == v.id;\n });\n var end = allNodes.filter(function (v) {\n return d.target.id == v.id;\n });\n d.source.x = start[0].x;\n d.source.y = start[0].y;\n d.target.x = end[0].x;\n d.target.y = end[0].y;\n });\n }\n }, {\n key: '_siblingLine',\n value: function _siblingLine(d, i) {\n\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n var nodeWidth = this.nodeSize[0];\n var nodeHeight = this.nodeSize[1];\n\n // Not first marriage\n if (d.number > 0) {\n ny -= nodeHeight * 8 / 10;\n }\n\n var linedata = [{\n x: d.source.x,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: d.target.y\n }, {\n x: d.target.x,\n y: d.target.y\n }];\n\n var fun = d3.svg.line().x(function (d) {\n return d.x;\n }).y(function (d) {\n return d.y;\n }).interpolate('linear');\n return fun(linedata);\n }\n }], [{\n key: '_nodeSize',\n value: function _nodeSize(nodes, width, textRenderer) {\n var maxWidth = 0;\n var maxHeight = 0;\n var tmpSvg = document.createElement('svg');\n document.body.appendChild(tmpSvg);\n\n _.map(nodes, function (n) {\n var container = document.createElement('div');\n container.setAttribute('class', n['class']);\n container.style.visibility = 'hidden';\n container.style.maxWidth = width + 'px';\n\n var text = textRenderer(n.name, n.extra, n.textClass);\n container.innerHTML = text;\n\n tmpSvg.appendChild(container);\n var height = container.offsetHeight;\n tmpSvg.removeChild(container);\n\n maxHeight = Math.max(maxHeight, height);\n n.cHeight = height;\n n.cWidth = width;\n });\n document.body.removeChild(tmpSvg);\n\n return [width, maxHeight];\n }\n }, {\n key: '_nodeRenderer',\n value: function _nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n var node = '';\n node += '\\n';\n node += name;\n node += '
\\n';\n return node;\n }\n }, {\n key: '_debug',\n value: function _debug(msg) {\n if (TreeBuilder.DEBUG_LEVEL > 0) {\n console.log(msg);\n }\n }\n }]);\n\n return TreeBuilder;\n })();\n\n var dTree = {\n\n VERSION: '1.3.2',\n\n init: function init(data) {\n var options = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1];\n\n var opts = _.defaultsDeep(options || {}, {\n target: '#graph',\n debug: false,\n width: 600,\n height: 600,\n callbacks: {\n nodeClick: function nodeClick(name, extra, id) {},\n nodeRenderer: function nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n return TreeBuilder._nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer);\n },\n nodeSize: function nodeSize(nodes, width, textRenderer) {\n return TreeBuilder._nodeSize(nodes, width, textRenderer);\n },\n nodeSorter: function nodeSorter(aName, aExtra, bName, bExtra) {\n return 0;\n },\n textRenderer: function textRenderer(name, extra, textClass) {\n return TreeBuilder._textRenderer(name, extra, textClass);\n }\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n nodeWidth: 100,\n styles: {\n node: 'node',\n linage: 'linage',\n marriage: 'marriage',\n text: 'nodeText'\n }\n });\n\n var data = this._preprocess(data, opts);\n var treeBuilder = new TreeBuilder(data.root, data.siblings, opts);\n treeBuilder.create();\n },\n\n _preprocess: function _preprocess(data, opts) {\n\n var siblings = [];\n var id = 0;\n\n var root = {\n name: '',\n id: id++,\n hidden: true,\n children: []\n };\n\n var reconstructTree = function reconstructTree(person, parent) {\n\n // convert to person to d3 node\n var node = {\n name: person.name,\n id: id++,\n hidden: false,\n children: [],\n extra: person.extra,\n textClass: person.textClass ? person.textClass : opts.styles.text,\n 'class': person['class'] ? person['class'] : opts.styles.node\n };\n\n // hide linages to the hidden root node\n if (parent == root) {\n node.noParent = true;\n }\n\n // apply depth offset\n for (var i = 0; i < person.depthOffset; i++) {\n var pushNode = {\n name: '',\n id: id++,\n hidden: true,\n children: [],\n noParent: node.noParent\n };\n parent.children.push(pushNode);\n parent = pushNode;\n }\n\n // sort children\n dTree._sortPersons(person.children, opts);\n\n // add \"direct\" children\n _.forEach(person.children, function (child) {\n reconstructTree(child, node);\n });\n\n parent.children.push(node);\n\n // DEPRECATED: Backwards-compatability for v1.x syntax, remove for 2.0\n if (person.marriage) {\n console.log('DEPRECATED: The data attribute \"marriage\" is deprecated in favor of \"marriages\" that takes an array. It will be removed in 2.0.');\n person.marriages = [person.marriage];\n }\n\n //sort marriages\n dTree._sortMarriages(person.marriages, opts);\n\n // go through marriage\n _.forEach(person.marriages, function (marriage, index) {\n\n var m = {\n name: '',\n id: id++,\n hidden: true,\n noParent: true,\n children: [],\n extra: marriage.extra\n };\n\n var sp = marriage.spouse;\n\n var spouse = {\n name: sp.name,\n id: id++,\n hidden: false,\n noParent: true,\n children: [],\n textClass: sp.textClass ? sp.textClass : opts.styles.text,\n 'class': sp['class'] ? sp['class'] : opts.styles.node,\n extra: sp.extra\n };\n\n parent.children.push(m, spouse);\n\n dTree._sortPersons(marriage.children, opts);\n _.forEach(marriage.children, function (child) {\n reconstructTree(child, m);\n });\n\n siblings.push({\n source: {\n id: node.id\n },\n target: {\n id: spouse.id\n },\n number: index\n });\n });\n };\n\n _.forEach(data, function (person) {\n reconstructTree(person, root);\n });\n\n return {\n root: root,\n siblings: siblings\n };\n },\n\n _sortPersons: function _sortPersons(persons, opts) {\n if (persons != undefined) {\n persons.sort(function (a, b) {\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return persons;\n },\n\n _sortMarriages: function _sortMarriages(marriages, opts) {\n if (marriages != undefined && Array.isArray(marriages)) {\n marriages.sort(function (marriageA, marriageB) {\n var a = marriageA.spouse;\n var b = marriageB.spouse;\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return marriages;\n }\n\n };\n\n return dTree;\n});\n//# sourceMappingURL=dTree.js.map\n","(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n global.dTree = factory();\n}(this, function () { 'use strict';\n\n class TreeBuilder {\n\n constructor(root, siblings, opts) {\n TreeBuilder.DEBUG_LEVEL = opts.debug ? 1 : 0;\n\n this.root = root;\n this.siblings = siblings;\n this.opts = opts;\n\n // flatten nodes\n this.allNodes = this._flatten(this.root);\n\n // Calculate node size\n var visibleNodes = _.filter(this.allNodes, function(n) {\n return !n.hidden;\n });\n this.nodeSize = opts.callbacks.nodeSize(visibleNodes,\n opts.nodeWidth, opts.callbacks.textRenderer);\n }\n\n create() {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var width = opts.width + opts.margin.left + opts.margin.right;\n var height = opts.height + opts.margin.top + opts.margin.bottom;\n\n var zoom = d3.behavior.zoom()\n .scaleExtent([0.1, 10])\n .on('zoom', _.bind(function() {\n svg.attr('transform', 'translate(' + d3.event.translate + ')' +\n ' scale(' + d3.event.scale + ')');\n }, this));\n\n //make an SVG\n var svg = this.svg = d3.select(opts.target)\n .append('svg')\n .attr('width', width)\n .attr('height', height)\n .call(zoom)\n .append('g')\n .attr('transform', 'translate(' + width / 2 + ',' + opts.margin.top + ')');\n\n zoom.translate([width / 2, opts.margin.top]);\n\n // Compute the layout.\n this.tree = d3.layout.tree()\n .nodeSize([nodeSize[0] * 2, nodeSize[1] * 2.5]);\n\n this.tree.separation(function separation(a, b) {\n if (a.hidden || b.hidden) {\n return 0.3;\n } else {\n return 0.6;\n }\n });\n\n this._update(this.root);\n\n }\n\n _update(source) {\n\n var opts = this.opts;\n var allNodes = this.allNodes;\n var nodeSize = this.nodeSize;\n\n var nodes = this.tree.nodes(source);\n\n var links = this.tree.links(nodes);\n\n // Create the link lines.\n this.svg.selectAll('.link')\n .data(links)\n .enter()\n .append('path')\n .attr('class', opts.styles.linage)\n .attr('d', this._elbow);\n\n var nodes = this.svg.selectAll('.node')\n .data(nodes)\n .enter();\n\n this._linkSiblings();\n\n // Draw siblings (marriage)\n this.svg.selectAll('.sibling')\n .data(this.siblings)\n .enter()\n .append('path')\n .attr('class', opts.styles.marriage)\n .attr('d', _.bind(this._siblingLine, this));\n\n // Create the node rectangles.\n nodes.append('foreignObject')\n .filter(function(d) {\n return d.hidden ? false : true;\n })\n .attr('x', function(d) {\n return d.x - d.cWidth / 2 + 'px';\n })\n .attr('y', function(d) {\n return d.y - d.cHeight / 2 + 'px';\n })\n .attr('width', function(d) {\n return d.cWidth + 'px';\n })\n .attr('height', function(d) {\n return d.cHeight + 'px';\n })\n .attr('id', function(d) {\n return d.id;\n })\n .html(function(d) {\n return opts.callbacks.nodeRenderer(\n d.name,\n d.x,\n d.y,\n nodeSize[0],\n nodeSize[1],\n d.extra,\n d.id,\n d.class,\n d.textClass,\n opts.callbacks.textRenderer);\n })\n .on('click', function(d) {\n if (d.hidden) {\n return;\n }\n opts.callbacks.nodeClick(d.name, d.extra, d.id);\n });\n }\n\n _flatten(root) {\n var n = [];\n var i = 0;\n\n function recurse(node) {\n if (node.children) {\n node.children.forEach(recurse);\n }\n if (!node.id) {\n node.id = ++i;\n }\n n.push(node);\n }\n recurse(root);\n return n;\n }\n\n _elbow(d, i) {\n if (d.target.noParent) {\n return 'M0,0L0,0';\n }\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n\n var linedata = [{\n x: d.target.x,\n y: d.target.y\n }, {\n x: d.target.x,\n y: ny\n }, {\n x: d.source.x,\n y: d.source.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('step-after');\n return fun(linedata);\n }\n\n _linkSiblings() {\n\n var allNodes = this.allNodes;\n\n _.forEach(this.siblings, function(d) {\n var start = allNodes.filter(function(v) {\n return d.source.id == v.id;\n });\n var end = allNodes.filter(function(v) {\n return d.target.id == v.id;\n });\n d.source.x = start[0].x;\n d.source.y = start[0].y;\n d.target.x = end[0].x;\n d.target.y = end[0].y;\n });\n\n }\n\n _siblingLine(d, i) {\n\n var ny = d.target.y + (d.source.y - d.target.y) * 0.50;\n var nodeWidth = this.nodeSize[0];\n var nodeHeight = this.nodeSize[1];\n\n // Not first marriage\n if (d.number > 0) {\n ny -= nodeHeight * 8 / 10;\n }\n\n var linedata = [{\n x: d.source.x,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: d.source.y\n }, {\n x: d.source.x + nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: ny\n }, {\n x: d.target.x - nodeWidth * 6 / 10,\n y: d.target.y\n }, {\n x: d.target.x,\n y: d.target.y\n }];\n\n var fun = d3.svg.line()\n .x(function(d) {\n return d.x;\n })\n .y(function(d) {\n return d.y;\n })\n .interpolate('linear');\n return fun(linedata);\n }\n\n static _nodeSize(nodes, width, textRenderer) {\n var maxWidth = 0;\n var maxHeight = 0;\n var tmpSvg = document.createElement('svg');\n document.body.appendChild(tmpSvg);\n\n _.map(nodes, function(n) {\n var container = document.createElement('div');\n container.setAttribute('class', n.class);\n container.style.visibility = 'hidden';\n container.style.maxWidth = width + 'px';\n\n var text = textRenderer(n.name, n.extra, n.textClass);\n container.innerHTML = text;\n\n tmpSvg.appendChild(container);\n var height = container.offsetHeight;\n tmpSvg.removeChild(container);\n\n maxHeight = Math.max(maxHeight, height);\n n.cHeight = height;\n n.cWidth = width;\n });\n document.body.removeChild(tmpSvg);\n\n return [width, maxHeight];\n }\n\n static _nodeRenderer(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n var node = '';\n node += '\\n';\n node += name;\n node += '
\\n';\n return node;\n }\n\n static _debug(msg) {\n if (TreeBuilder.DEBUG_LEVEL > 0) {\n console.log(msg);\n }\n }\n\n }\n\n const dTree = {\n\n VERSION: '1.3.2',\n\n init: function(data, options = {}) {\n\n var opts = _.defaultsDeep(options || {}, {\n target: '#graph',\n debug: false,\n width: 600,\n height: 600,\n callbacks: {\n nodeClick: function(name, extra, id) {},\n nodeRenderer: function(name, x, y, height, width, extra, id, nodeClass, textClass, textRenderer) {\n return TreeBuilder._nodeRenderer(name, x, y, height, width, extra,\n id,nodeClass, textClass, textRenderer);\n },\n nodeSize: function(nodes, width, textRenderer) {\n return TreeBuilder._nodeSize(nodes, width, textRenderer);\n },\n nodeSorter: function(aName, aExtra, bName, bExtra) {return 0;},\n textRenderer: function(name, extra, textClass) {\n return TreeBuilder._textRenderer(name, extra, textClass);\n },\n },\n margin: {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n },\n nodeWidth: 100,\n styles: {\n node: 'node',\n linage: 'linage',\n marriage: 'marriage',\n text: 'nodeText'\n }\n });\n\n var data = this._preprocess(data, opts);\n var treeBuilder = new TreeBuilder(data.root, data.siblings, opts);\n treeBuilder.create();\n\n },\n\n _preprocess: function(data, opts) {\n\n var siblings = [];\n var id = 0;\n\n var root = {\n name: '',\n id: id++,\n hidden: true,\n children: []\n };\n\n var reconstructTree = function(person, parent) {\n\n // convert to person to d3 node\n var node = {\n name: person.name,\n id: id++,\n hidden: false,\n children: [],\n extra: person.extra,\n textClass: person.textClass ? person.textClass : opts.styles.text,\n class: person.class ? person.class : opts.styles.node\n };\n\n // hide linages to the hidden root node\n if (parent == root) {\n node.noParent = true;\n }\n\n // apply depth offset\n for (var i = 0; i < person.depthOffset; i++) {\n var pushNode = {\n name: '',\n id: id++,\n hidden: true,\n children: [],\n noParent: node.noParent\n };\n parent.children.push(pushNode);\n parent = pushNode;\n }\n\n // sort children\n dTree._sortPersons(person.children, opts);\n\n // add \"direct\" children\n _.forEach(person.children, function(child) {\n reconstructTree(child, node);\n });\n\n parent.children.push(node);\n\n // DEPRECATED: Backwards-compatability for v1.x syntax, remove for 2.0\n if (person.marriage) {\n console.log('DEPRECATED: The data attribute \"marriage\" is deprecated in favor of \"marriages\" that takes an array. It will be removed in 2.0.');\n person.marriages = [person.marriage];\n }\n\n //sort marriages\n dTree._sortMarriages(person.marriages, opts);\n\n // go through marriage\n _.forEach(person.marriages, function(marriage, index) {\n\n var m = {\n name: '',\n id: id++,\n hidden: true,\n noParent: true,\n children: [],\n extra: marriage.extra\n };\n\n var sp = marriage.spouse;\n\n var spouse = {\n name: sp.name,\n id: id++,\n hidden: false,\n noParent: true,\n children: [],\n textClass: sp.textClass ? sp.textClass : opts.styles.text,\n class: sp.class ? sp.class : opts.styles.node,\n extra: sp.extra\n };\n\n parent.children.push(m, spouse);\n\n dTree._sortPersons(marriage.children, opts);\n _.forEach(marriage.children, function(child) {\n reconstructTree(child, m);\n });\n\n siblings.push({\n source: {\n id: node.id\n },\n target: {\n id: spouse.id\n },\n number: index\n });\n });\n\n };\n\n _.forEach(data, function(person) {\n reconstructTree(person, root);\n });\n\n return {\n root: root,\n siblings: siblings\n };\n\n },\n\n _sortPersons: function(persons, opts) {\n if (persons != undefined) {\n persons.sort(function(a, b) {\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return persons;\n },\n\n _sortMarriages: function(marriages, opts) {\n if (marriages != undefined && Array.isArray(marriages)) {\n marriages.sort(function(marriageA, marriageB) {\n var a = marriageA.spouse;\n var b = marriageB.spouse;\n return opts.callbacks.nodeSorter(a.name, a.extra, b.name, b.extra);\n });\n }\n return marriages;\n }\n\n };\n\n return dTree;\n\n}));"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/package.json b/package.json index 73ce8ee..6ff142a 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "d3-dtree", - "version": "1.3.1", + "version": "1.3.2", "description": "A library for visualizing data trees built on top of D3.", "main": "dist/dTree.js", "scripts": {