billboard.js 3.12.1 → 3.12.2-patch

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +1 -1
  2. package/dist/billboard.css +1 -1
  3. package/dist/billboard.js +46 -27
  4. package/dist/billboard.min.css +1 -1
  5. package/dist/billboard.min.js +9 -9
  6. package/dist/billboard.pkgd.js +46 -27
  7. package/dist/billboard.pkgd.min.js +16 -16
  8. package/dist/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  9. package/dist/plugin/billboardjs-plugin-bubblecompare.min.js +2 -2
  10. package/dist/plugin/billboardjs-plugin-sparkline.js +3 -3
  11. package/dist/plugin/billboardjs-plugin-sparkline.min.js +3 -3
  12. package/dist/plugin/billboardjs-plugin-stanford.js +3 -3
  13. package/dist/plugin/billboardjs-plugin-stanford.min.js +2 -2
  14. package/dist/plugin/billboardjs-plugin-tableview.js +3 -3
  15. package/dist/plugin/billboardjs-plugin-tableview.min.js +4 -4
  16. package/dist/plugin/billboardjs-plugin-textoverlap.js +3 -3
  17. package/dist/plugin/billboardjs-plugin-textoverlap.min.js +2 -2
  18. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.js +2 -2
  19. package/dist/plugin/pkgd/billboardjs-plugin-bubblecompare.pkgd.min.js +2 -2
  20. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.js +3 -3
  21. package/dist/plugin/pkgd/billboardjs-plugin-sparkline.pkgd.min.js +5 -5
  22. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.js +3 -3
  23. package/dist/plugin/pkgd/billboardjs-plugin-stanford.pkgd.min.js +6 -6
  24. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.js +3 -3
  25. package/dist/plugin/pkgd/billboardjs-plugin-tableview.pkgd.min.js +2 -2
  26. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.js +3 -3
  27. package/dist/plugin/pkgd/billboardjs-plugin-textoverlap.pkgd.min.js +2 -2
  28. package/dist/theme/dark.css +1 -1
  29. package/dist/theme/dark.min.css +1 -1
  30. package/dist/theme/datalab.css +1 -1
  31. package/dist/theme/datalab.min.css +1 -1
  32. package/dist/theme/graph.css +1 -1
  33. package/dist/theme/graph.min.css +1 -1
  34. package/dist/theme/insight.css +1 -1
  35. package/dist/theme/insight.min.css +1 -1
  36. package/dist/theme/modern.css +1 -1
  37. package/dist/theme/modern.min.css +1 -1
  38. package/dist-esm/billboard.js +56 -32
  39. package/dist-esm/plugin/billboardjs-plugin-bubblecompare.js +2 -2
  40. package/dist-esm/plugin/billboardjs-plugin-sparkline.js +2 -2
  41. package/dist-esm/plugin/billboardjs-plugin-stanford.js +2 -2
  42. package/dist-esm/plugin/billboardjs-plugin-tableview.js +2 -2
  43. package/dist-esm/plugin/billboardjs-plugin-textoverlap.js +2 -2
  44. package/package.json +12 -12
  45. package/src/ChartInternal/data/load.ts +3 -0
  46. package/src/ChartInternal/interactions/zoom.ts +0 -4
  47. package/src/ChartInternal/shape/funnel.ts +49 -25
  48. package/src/module/util.ts +2 -2
@@ -5,7 +5,7 @@
5
5
  * billboard.js, JavaScript chart library
6
6
  * https://naver.github.io/billboard.js/
7
7
  *
8
- * @version 3.12.1
8
+ * @version 3.12.2-patch
9
9
  *
10
10
  * All-in-one packaged file for ease use of 'billboard.js' with dependant d3.js modules & polyfills.
11
11
  * - @types/d3-selection ^3.0.0
@@ -25727,7 +25727,7 @@ function convertInputType(mouse, touch) {
25727
25727
  }
25728
25728
  }
25729
25729
  }
25730
- const hasMouse = mouse && ["any-hover:hover", "any-pointer:fine"].some((v) => matchMedia == null ? void 0 : matchMedia(`(${v})`).matches);
25730
+ const hasMouse = mouse && ((matchMedia == null ? void 0 : matchMedia("any-hover:hover").matches) || (matchMedia == null ? void 0 : matchMedia("any-pointer:fine").matches));
25731
25731
  return hasMouse && "mouse" || hasTouch && "touch" || "mouse";
25732
25732
  }
25733
25733
  function runUntil(fn, conditionFn) {
@@ -27708,6 +27708,7 @@ function callDone(fn, resizeAfter = false) {
27708
27708
  $$.data.targets = $$.data.targets.filter((t) => t.id !== id);
27709
27709
  hasLegendDefsPoint && ((_a2 = $el.defs) == null ? void 0 : _a2.select(`#${$$.getDefsPointId(suffixId)}`).remove());
27710
27710
  });
27711
+ state.hasFunnel && $$.updateFunnel($$.data.targets);
27711
27712
  state.hasTreemap && $$.updateTargetsForTreemap($$.data.targets);
27712
27713
  $$.updateTypesElements();
27713
27714
  }
@@ -37186,8 +37187,6 @@ util_extend(zoom, {
37186
37187
  const $$ = this;
37187
37188
  const { config, $el: { eventRect } } = $$;
37188
37189
  const behaviour = config.zoom_type === "drag" ? $$.zoomBehaviour : $$.zoom;
37189
- $$.$el.svg.on("wheel", () => {
37190
- });
37191
37190
  eventRect == null ? void 0 : eventRect.call(behaviour).on("dblclick.zoom", null);
37192
37191
  },
37193
37192
  /**
@@ -45205,13 +45204,16 @@ function getSize(checkNeck = false) {
45205
45204
  height: height - (config.legend_show ? $$.getLegendHeight() + 10 : 0) - (padding.top + padding.bottom)
45206
45205
  }, padding);
45207
45206
  if (checkNeck) {
45208
- const { width: neckWidth } = getNecklSize.call($$, {
45207
+ const { width: neckWidth, height: neckHeight } = getNecklSize.call($$, {
45209
45208
  width: size.width,
45210
45209
  height: size.height
45211
45210
  });
45212
45211
  if (size.width < neckWidth) {
45213
45212
  size.width = neckWidth;
45214
45213
  }
45214
+ if (size.height < neckHeight) {
45215
+ size.height = neckHeight;
45216
+ }
45215
45217
  }
45216
45218
  return size;
45217
45219
  }
@@ -45234,49 +45236,55 @@ function getNecklSize(current) {
45234
45236
  }
45235
45237
  function getCoord(d) {
45236
45238
  const $$ = this;
45237
- const { top, width } = getSize.call($$, true);
45239
+ const { top, left, width } = getSize.call($$, true);
45238
45240
  const coords = [];
45239
45241
  d.forEach((d2, i) => {
45240
45242
  const { ratio } = d2;
45241
45243
  const y = i > 0 ? coords[i - 1][2][1] : top;
45242
45244
  coords.push(d2.coords = [
45243
- [0, y],
45245
+ [left, y],
45244
45246
  // M
45245
- [width, y],
45247
+ [left + width, y],
45246
45248
  // 1
45247
- [width, i > 0 ? ratio + y : ratio + top],
45249
+ [left + width, i > 0 ? ratio + y : ratio + top],
45248
45250
  // 2
45249
- [0, i > 0 ? ratio + y : ratio + top],
45251
+ [left, i > 0 ? ratio + y : ratio + top],
45250
45252
  // 3
45251
- [0, y]
45253
+ [left, y]
45252
45254
  // 4
45253
45255
  ]);
45254
45256
  });
45255
45257
  return coords;
45256
45258
  }
45257
- function getNeckPath() {
45259
+ function getClipPath(forBackground = false) {
45258
45260
  const $$ = this;
45259
45261
  const { width, height, top, left } = getSize.call($$, true);
45260
45262
  const neck = getNecklSize.call($$, { width, height });
45261
- const rightX = (width + neck.width) / 2;
45262
45263
  const leftX = (width - neck.width) / 2;
45264
+ const rightX = (width + neck.width) / 2;
45263
45265
  const bodyHeigth = height - neck.height;
45264
45266
  const coords = [
45265
- [0 + left, 0 + top],
45267
+ [0, 0],
45266
45268
  // M
45267
- [width + left, 0 + top],
45269
+ [width, 0],
45268
45270
  // 1
45269
45271
  [rightX, bodyHeigth],
45270
45272
  // 2
45271
- [rightX, height + top],
45273
+ [rightX, height],
45272
45274
  // 3
45273
- [leftX, height + top],
45275
+ [leftX, height],
45274
45276
  // 4
45275
45277
  [leftX, bodyHeigth],
45276
45278
  // 5
45277
- [0 + left, 0 + top]
45279
+ [0, 0]
45278
45280
  // 6
45279
45281
  ];
45282
+ if (forBackground) {
45283
+ coords.forEach((d) => {
45284
+ d[0] += left;
45285
+ d[1] += top;
45286
+ });
45287
+ }
45280
45288
  return `M${coords.join("L")}z`;
45281
45289
  }
45282
45290
  function getFunnelData(d) {
@@ -45364,23 +45372,35 @@ function updateRatio(data) {
45364
45372
  mainFunnelEnter.append("path");
45365
45373
  funnel.path = mainFunnelEnter.merge(mainFunnelUpdate).attr("class", (d) => classChartFunnel(d)).select("path").attr("class", classFunnel).style("opacity", "0").style("fill", $$.color);
45366
45374
  },
45375
+ /**
45376
+ * Update funnel path selection
45377
+ * @param {object} targets Updated target data
45378
+ * @private
45379
+ */
45380
+ updateFunnel(targets) {
45381
+ const $$ = this;
45382
+ const { $el: { funnel } } = $$;
45383
+ const targetIds = targets.map(({ id }) => id);
45384
+ funnel.path = funnel.path.filter((d) => targetIds.indexOf(d.id) >= 0);
45385
+ },
45367
45386
  /**
45368
45387
  * Generate treemap coordinate points data
45369
45388
  * @returns {Array} Array of coordinate points
45370
45389
  * @private
45371
45390
  */
45372
45391
  generateGetFunnelPoints() {
45373
- var _a;
45374
45392
  const $$ = this;
45375
45393
  const { $el: { funnel } } = $$;
45376
45394
  const targets = $$.filterTargetsToShow(funnel.path);
45395
+ const { top, left, right } = getSize.call($$);
45396
+ const center = (left - right) / 2;
45377
45397
  const points = {};
45378
- let accumulatedHeight = (_a = getSize.call($$).top) != null ? _a : 0;
45398
+ let accumulatedHeight = top != null ? top : 0;
45379
45399
  targets.each((d, i) => {
45380
- var _a2;
45400
+ var _a;
45381
45401
  points[d.id] = [
45382
- [0, accumulatedHeight],
45383
- [0, accumulatedHeight += ((_a2 = targets == null ? void 0 : targets[i]) != null ? _a2 : d).ratio]
45402
+ [center, accumulatedHeight],
45403
+ [center, accumulatedHeight += ((_a = targets == null ? void 0 : targets[i]) != null ? _a : d).ratio]
45384
45404
  ];
45385
45405
  });
45386
45406
  return (d) => points[d.id];
@@ -45394,9 +45414,8 @@ function updateRatio(data) {
45394
45414
  const { $T, $el: { funnel } } = $$;
45395
45415
  const targets = $$.filterTargetsToShow(funnel.path);
45396
45416
  const coords = getCoord.call($$, updateRatio.call($$, targets.data()));
45397
- const neckPath = getNeckPath.bind($$)();
45398
- funnel.attr("clip-path", `path('${neckPath}')`);
45399
- funnel.background.attr("d", neckPath);
45417
+ funnel.attr("clip-path", `path('${getClipPath.bind($$)()}')`);
45418
+ funnel.background.attr("d", getClipPath.call($$, true));
45400
45419
  $T(targets).attr("d", (d, i) => `M${coords[i].join("L")}z`).style("opacity", "1");
45401
45420
  funnel.selectAll("g").style("opacity", null);
45402
45421
  }
@@ -48558,7 +48577,7 @@ const bb = {
48558
48577
  * bb.version; // "1.0.0"
48559
48578
  * @memberof bb
48560
48579
  */
48561
- version: "3.12.1",
48580
+ version: "3.12.2-patch",
48562
48581
  /**
48563
48582
  * Generate chart
48564
48583
  * - **NOTE:** Bear in mind for the possiblity of ***throwing an error***, during the generation when: