UNPKG

laif-ds

Version:

Design System di Laif con componenti React basati su principi di Atomic Design

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