laif-ds
Version:
Design System di Laif con componenti React basati su principi di Atomic Design
109 lines (108 loc) • 3.3 kB
JavaScript
"use client";
import { createSelector as c } from "../../../../reselect/dist/reselect.js";
import { selectLegendSettings as A, selectLegendSize as P } from "./legendSelectors.js";
import { appendOffsetOfLegend as S } from "../../util/ChartUtils.js";
import { selectChartWidth as s, selectChartHeight as a, selectMargin as _ } from "./containerSelectors.js";
import { selectAllYAxes as h, selectAllXAxes as p } from "./selectAllAxes.js";
import { DEFAULT_Y_AXIS_WIDTH as m } from "../../util/Constants.js";
function u(e, o) {
var r = Object.keys(e);
if (Object.getOwnPropertySymbols) {
var t = Object.getOwnPropertySymbols(e);
o && (t = t.filter(function(n) {
return Object.getOwnPropertyDescriptor(e, n).enumerable;
})), r.push.apply(r, t);
}
return r;
}
function f(e) {
for (var o = 1; o < arguments.length; o++) {
var r = arguments[o] != null ? arguments[o] : {};
o % 2 ? u(Object(r), !0).forEach(function(t) {
D(e, t, r[t]);
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(r)) : u(Object(r)).forEach(function(t) {
Object.defineProperty(e, t, Object.getOwnPropertyDescriptor(r, t));
});
}
return e;
}
function D(e, o, r) {
return (o = H(o)) in e ? Object.defineProperty(e, o, { value: r, enumerable: !0, configurable: !0, writable: !0 }) : e[o] = r, e;
}
function H(e) {
var o = L(e, "string");
return typeof o == "symbol" ? o : o + "";
}
function L(e, o) {
if (typeof e != "object" || !e) return e;
var r = e[Symbol.toPrimitive];
if (r !== void 0) {
var t = r.call(e, o);
if (typeof t != "object") return t;
throw new TypeError("@@toPrimitive must return a primitive value.");
}
return (o === "string" ? String : Number)(e);
}
var B = (e) => e.brush.height;
function C(e) {
var o = h(e);
return o.reduce((r, t) => {
if (t.orientation === "left" && !t.mirror && !t.hide) {
var n = typeof t.width == "number" ? t.width : m;
return r + n;
}
return r;
}, 0);
}
function E(e) {
var o = h(e);
return o.reduce((r, t) => {
if (t.orientation === "right" && !t.mirror && !t.hide) {
var n = typeof t.width == "number" ? t.width : m;
return r + n;
}
return r;
}, 0);
}
function T(e) {
var o = p(e);
return o.reduce((r, t) => t.orientation === "top" && !t.mirror && !t.hide ? r + t.height : r, 0);
}
function I(e) {
var o = p(e);
return o.reduce((r, t) => t.orientation === "bottom" && !t.mirror && !t.hide ? r + t.height : r, 0);
}
var M = c([s, a, _, B, C, E, T, I, A, P], (e, o, r, t, n, l, b, g, v, d) => {
var O = {
left: (r.left || 0) + n,
right: (r.right || 0) + l
}, w = {
top: (r.top || 0) + b,
bottom: (r.bottom || 0) + g
}, i = f(f({}, w), O), x = i.bottom;
i.bottom += t, i = S(i, v, d);
var j = e - i.left - i.right, y = o - i.top - i.bottom;
return f(f({
brushBottom: x
}, i), {}, {
// never return negative values for height and width
width: Math.max(j, 0),
height: Math.max(y, 0)
});
}), z = c(M, (e) => ({
x: e.left,
y: e.top,
width: e.width,
height: e.height
}));
c(s, a, (e, o) => ({
x: 0,
y: 0,
width: e,
height: o
}));
export {
B as selectBrushHeight,
M as selectChartOffsetInternal,
z as selectChartViewBox
};