UNPKG

@d3fc/d3fc-data-join

Version:

A component that simplifies the D3 data join and supports the d3fc decorate pattern

2 lines (1 loc) 1.24 kB
(function(a,b){"object"==typeof exports&&"undefined"!=typeof module?b(exports):"function"==typeof define&&define.amd?define(["exports"],b):(a="undefined"==typeof globalThis?a||self:globalThis,b(a.fc=a.fc||{}))})(this,function(a){'use strict';var b=1e-6,c=function(a){return a.selection()!==a};a.dataJoin=function(a,d){a=a||"g";var e=function(a,b){return b},f=null,g=function(g,h){h=h||function(a){return a};var i=g.selection(),j=c(g)?g:null,k=i.selectChildren(null==d?a:"".concat(a,".").concat(d)),l=k.data(h,e),m=l.enter().append(a).attr("class",d),n=l.exit();l=l.merge(m);var o=j||f;return o&&(l=l.transition(o).style("opacity",1),m.style("opacity",b),n=n.transition(o).style("opacity",b)),n.remove(),l.enter=function(){return m},l.exit=function(){return n},l};return g.element=function(){return arguments.length?(a=0>=arguments.length?void 0:arguments[0],g):a},g.className=function(){return arguments.length?(d=0>=arguments.length?void 0:arguments[0],g):d},g.key=function(){return arguments.length?(e=0>=arguments.length?void 0:arguments[0],g):e},g.transition=function(){return arguments.length?(f=0>=arguments.length?void 0:arguments[0],g):f},g},a.effectivelyZero=b,a.isTransition=c,Object.defineProperty(a,"__esModule",{value:!0})});